tmex-cli 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime/{cpufeatures-jxwx4v5j.node → cpufeatures-9rk1k79p.node} +0 -0
- package/dist/runtime/server.js +1813 -1298
- package/dist/runtime/{sshcrypto-sx6755rw.node → sshcrypto-z1hq11fy.node} +0 -0
- package/package.json +1 -1
- package/resources/fe-dist/assets/DevicePage-BE5Hlzny.js +26 -0
- package/resources/fe-dist/assets/DevicePage-BE5Hlzny.js.map +1 -0
- package/resources/fe-dist/assets/DevicesPage-BTB6mlBW.js +17 -0
- package/resources/fe-dist/assets/{DevicesPage-BrvmKNIQ.js.map → DevicesPage-BTB6mlBW.js.map} +1 -1
- package/resources/fe-dist/assets/SettingsPage-BDVq_Akt.js +17 -0
- package/resources/fe-dist/assets/{SettingsPage-XFRzVSzI.js.map → SettingsPage-BDVq_Akt.js.map} +1 -1
- package/resources/fe-dist/assets/ghostty-vt-BKQMf-5X.wasm +0 -0
- package/resources/fe-dist/assets/index-Chps0Pui.js +448 -0
- package/resources/fe-dist/assets/index-Chps0Pui.js.map +1 -0
- package/resources/fe-dist/assets/index-CyKyNcdz.css +1 -0
- package/resources/fe-dist/assets/select-7tfuDWw3.js +17 -0
- package/resources/fe-dist/assets/{select-CRYPgkuV.js.map → select-7tfuDWw3.js.map} +1 -1
- package/resources/fe-dist/assets/switch-CNHRGb7-.js +12 -0
- package/resources/fe-dist/assets/{switch-D216fzW5.js.map → switch-CNHRGb7-.js.map} +1 -1
- package/resources/fe-dist/assets/useValueChanged-Bi_NzPTr.js +7 -0
- package/resources/fe-dist/assets/{useValueChanged-CJav2OS1.js.map → useValueChanged-Bi_NzPTr.js.map} +1 -1
- package/resources/fe-dist/index.html +2 -2
- package/resources/fe-dist/assets/DevicePage-6GBZ9nXN.css +0 -32
- package/resources/fe-dist/assets/DevicePage-BOtxQsop.js +0 -267
- package/resources/fe-dist/assets/DevicePage-BOtxQsop.js.map +0 -1
- package/resources/fe-dist/assets/DevicesPage-BrvmKNIQ.js +0 -17
- package/resources/fe-dist/assets/SettingsPage-XFRzVSzI.js +0 -17
- package/resources/fe-dist/assets/index-CxzyWqMn.css +0 -1
- package/resources/fe-dist/assets/index-Vweko0vT.js +0 -200
- package/resources/fe-dist/assets/index-Vweko0vT.js.map +0 -1
- package/resources/fe-dist/assets/select-CRYPgkuV.js +0 -17
- package/resources/fe-dist/assets/switch-D216fzW5.js +0 -12
- package/resources/fe-dist/assets/useValueChanged-CJav2OS1.js +0 -7
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var Lt=Object.defineProperty;var Pt=(t,e,s)=>e in t?Lt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var y=(t,e,s)=>Pt(t,typeof e!="symbol"?e+"":e,s);import{c as De,r as d,bw as W,bx as Je,j as f,b as ze,u as dt,by as Ge,bz as At,bA as Ye,d as ne,e as Mt,bB as Se,f as Me,B as de}from"./index-Chps0Pui.js";import{T as It,A as Ot,a as Ut,b as Vt,c as Ft,d as Bt,e as Ht,f as zt,g as Gt}from"./useValueChanged-Bi_NzPTr.js";import{L as Ie,S as Yt,a as Qe}from"./switch-CNHRGb7-.js";/**
|
|
2
|
+
* @license lucide-react v0.564.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const jt=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Kt=De("arrow-down-to-line",jt);/**
|
|
7
|
+
* @license lucide-react v0.564.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Wt=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],$t=De("keyboard",Wt);/**
|
|
12
|
+
* @license lucide-react v0.564.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const qt=[["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"}]],Xt=De("refresh-cw",qt);/**
|
|
17
|
+
* @license lucide-react v0.564.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Jt=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Qt=De("smartphone",Jt);function Zt(t){return`rgb(${t.r} ${t.g} ${t.b})`}function Oe(t){const e=t.getContext("2d");if(!e)throw new Error("2d canvas context unavailable");return e}class es{constructor(e){y(this,"kind","canvas");y(this,"mainCanvas");y(this,"selectionCanvas");y(this,"cursorCanvas");y(this,"mainContext");y(this,"selectionContext");y(this,"cursorContext");y(this,"theme");y(this,"fontFamily");y(this,"fontSize");y(this,"cellDimensions",{width:9,height:17});y(this,"cols",0);y(this,"rows",0);y(this,"lastCursor",null);y(this,"frameCount",0);y(this,"lastDrawnRows",[]);y(this,"colorCache",new Map);y(this,"fontCache",new Map);y(this,"cursorBlinkVisible",!0);y(this,"cursorBlinkTimer",null);this.theme=e.theme,this.fontFamily=e.fontFamily,this.fontSize=e.fontSize,e.screenElement.style.position="relative",e.screenElement.style.overflow="hidden",this.mainCanvas=document.createElement("canvas"),this.selectionCanvas=document.createElement("canvas"),this.cursorCanvas=document.createElement("canvas");for(const[s,n]of[[this.mainCanvas,"main"],[this.selectionCanvas,"selection"],[this.cursorCanvas,"cursor"]])s.dataset.layer=n,s.style.position="absolute",s.style.inset="0",s.style.width="100%",s.style.height="100%",s.style.pointerEvents="none",e.screenElement.appendChild(s);this.mainContext=Oe(this.mainCanvas),this.selectionContext=Oe(this.selectionCanvas),this.cursorContext=Oe(this.cursorCanvas)}setTheme(e){this.theme=e,this.colorCache.clear()}render(e){if(this.frameCount+=1,this.lastDrawnRows=[],this.cellDimensions=e.cellDimensions,this.resize(e.meta.cols,e.meta.rows),this.drawSelection(e.selectionRects??[],e.selectionColor??this.theme.selectionBackground),e.meta.dirty==="clean"){this.drawCursor(e.meta);return}const n=e.meta.dirty==="full"?e.rows:e.rows.filter(r=>r.dirty);for(const r of n)this.drawRow(r,e.meta.colors),this.lastDrawnRows.push(r.y);this.drawCursor(e.meta)}getDebugState(){return{kind:this.kind,frameCount:this.frameCount,lastDrawnRows:[...this.lastDrawnRows]}}dispose(){this.mainCanvas.remove(),this.selectionCanvas.remove(),this.cursorCanvas.remove(),this.colorCache.clear(),this.fontCache.clear(),this.lastCursor=null,this.stopCursorBlink()}startCursorBlink(){this.cursorBlinkTimer||(this.cursorBlinkTimer=setInterval(()=>{this.cursorBlinkVisible=!this.cursorBlinkVisible,this.cursorCanvas.style.opacity=this.cursorBlinkVisible?"1":"0"},1e3))}stopCursorBlink(){this.cursorBlinkTimer&&(clearInterval(this.cursorBlinkTimer),this.cursorBlinkTimer=null),this.cursorBlinkVisible=!0,this.cursorCanvas.style.opacity="1"}resize(e,s){const n=Math.max(1,e),r=Math.max(1,s),i=n*this.cellDimensions.width,o=r*this.cellDimensions.height,l=Math.max(1,globalThis.devicePixelRatio??1);if(this.cols===n&&this.rows===r){const u=`${i}px`,c=`${o}px`;if(this.mainCanvas.style.width===u&&this.mainCanvas.style.height===c)return}this.cols=n,this.rows=r;for(const u of[this.mainCanvas,this.selectionCanvas,this.cursorCanvas])u.width=Math.max(1,Math.ceil(i*l)),u.height=Math.max(1,Math.ceil(o*l)),u.style.width=`${i}px`,u.style.height=`${o}px`;for(const u of[this.mainContext,this.selectionContext,this.cursorContext])u.setTransform(l,0,0,l,0,0),u.textBaseline="top",u.imageSmoothingEnabled=!1}drawSelection(e,s){if(this.selectionContext.clearRect(0,0,this.cols*this.cellDimensions.width,this.rows*this.cellDimensions.height),e.length!==0){this.selectionContext.fillStyle=s;for(const n of e)this.selectionContext.fillRect(n.x*this.cellDimensions.width,n.row*this.cellDimensions.height,n.width*this.cellDimensions.width,this.cellDimensions.height)}}drawRow(e,s){const n=e.y*this.cellDimensions.height,r=this.cols*this.cellDimensions.width,i=this.toCss(s.background);this.mainContext.clearRect(0,n,r,this.cellDimensions.height),this.mainContext.fillStyle=i,this.mainContext.fillRect(0,n,r,this.cellDimensions.height);for(const o of e.cells){if(o.widthKind==="spacer-tail"||o.widthKind==="spacer-head")continue;const l=o.x*this.cellDimensions.width,u=o.style.inverse?o.fgColor??s.foreground:o.bgColor??s.background,c=o.style.inverse?o.bgColor??s.background:o.fgColor??s.foreground,b=o.widthKind==="wide"?this.cellDimensions.width*2:this.cellDimensions.width;(u.r!==s.background.r||u.g!==s.background.g||u.b!==s.background.b)&&(this.mainContext.fillStyle=this.toCss(u),this.mainContext.fillRect(l,n,b,this.cellDimensions.height)),!(!o.text||o.style.invisible)&&(this.mainContext.font=this.resolveFont(o.style),this.mainContext.fillStyle=this.toCss(c),this.mainContext.fillText(o.text,l,n),o.style.underline>0&&this.mainContext.fillRect(l,n+this.cellDimensions.height-2,Math.max(b-1,1),1),o.style.strikethrough&&this.mainContext.fillRect(l,n+this.cellDimensions.height*.55,Math.max(b-1,1),1),o.style.overline&&this.mainContext.fillRect(l,n+1,Math.max(b-1,1),1))}}drawCursor(e){const s=e.colors,n=e.cursor,r=this.lastCursor;if(this.cursorContext.clearRect(0,0,this.cols*this.cellDimensions.width,this.rows*this.cellDimensions.height),!n.visible||n.x===null||n.y===null){this.lastCursor=null,this.stopCursorBlink();return}const i=n.x*this.cellDimensions.width,o=n.y*this.cellDimensions.height,l=n.wideTail?this.cellDimensions.width*2:this.cellDimensions.width,u=s.cursor??s.foreground,c=this.toCss(u);this.cursorContext.fillStyle=c,this.cursorContext.strokeStyle=c,this.cursorContext.globalAlpha=.7,this.cursorContext.fillRect(i,o+this.cellDimensions.height-2,Math.max(l-1,1),2),this.cursorContext.globalAlpha=1,this.startCursorBlink(),this.lastCursor={x:n.x,y:n.y,style:n.style},r&&(r.x!==this.lastCursor.x||r.y!==this.lastCursor.y||r.style!==this.lastCursor.style)&&this.lastDrawnRows.push(r.y)}resolveFont(e){const s=[e.italic?"italic":"normal",e.bold?"700":"400",`${this.fontSize}px`,this.fontFamily].join("|"),n=this.fontCache.get(s);if(n)return n;const r=`${e.italic?"italic ":""}${e.bold?"700 ":""}${this.fontSize}px ${this.fontFamily}`;return this.fontCache.set(s,r),r}toCss(e){const s=`${e.r},${e.g},${e.b}`,n=this.colorCache.get(s);if(n)return n;const r=Zt(e);return this.colorCache.set(s,r),r}}const ts=0,ss={Backquote:1,Backslash:2,BracketLeft:3,BracketRight:4,Comma:5,Digit0:6,Digit1:7,Digit2:8,Digit3:9,Digit4:10,Digit5:11,Digit6:12,Digit7:13,Digit8:14,Digit9:15,Equal:16,IntlBackslash:17,IntlRo:18,IntlYen:19,KeyA:20,KeyB:21,KeyC:22,KeyD:23,KeyE:24,KeyF:25,KeyG:26,KeyH:27,KeyI:28,KeyJ:29,KeyK:30,KeyL:31,KeyM:32,KeyN:33,KeyO:34,KeyP:35,KeyQ:36,KeyR:37,KeyS:38,KeyT:39,KeyU:40,KeyV:41,KeyW:42,KeyX:43,KeyY:44,KeyZ:45,Minus:46,Period:47,Quote:48,Semicolon:49,Slash:50,AltLeft:51,AltRight:52,Backspace:53,CapsLock:54,ContextMenu:55,ControlLeft:56,ControlRight:57,Enter:58,MetaLeft:59,MetaRight:60,ShiftLeft:61,ShiftRight:62,Space:63,Tab:64,Convert:65,KanaMode:66,NonConvert:67,Delete:68,End:69,Help:70,Home:71,Insert:72,PageDown:73,PageUp:74,ArrowDown:75,ArrowLeft:76,ArrowRight:77,ArrowUp:78,NumLock:79,Numpad0:80,Numpad1:81,Numpad2:82,Numpad3:83,Numpad4:84,Numpad5:85,Numpad6:86,Numpad7:87,Numpad8:88,Numpad9:89,NumpadAdd:90,NumpadBackspace:91,NumpadClear:92,NumpadClearEntry:93,NumpadComma:94,NumpadDecimal:95,NumpadDivide:96,NumpadEnter:97,NumpadEqual:98,NumpadMemoryAdd:99,NumpadMemoryClear:100,NumpadMemoryRecall:101,NumpadMemoryStore:102,NumpadMemorySubtract:103,NumpadMultiply:104,NumpadParenLeft:105,NumpadParenRight:106,NumpadSubtract:107,NumpadSeparator:108,NumpadUp:109,NumpadDown:110,NumpadRight:111,NumpadLeft:112,NumpadBegin:113,NumpadHome:114,NumpadEnd:115,NumpadInsert:116,NumpadDelete:117,NumpadPageUp:118,NumpadPageDown:119,Escape:120,F1:121,F2:122,F3:123,F4:124,F5:125,F6:126,F7:127,F8:128,F9:129,F10:130,F11:131,F12:132,F13:133,F14:134,F15:135,F16:136,F17:137,F18:138,F19:139,F20:140,F21:141,F22:142,F23:143,F24:144,F25:145,Fn:146,FnLock:147,PrintScreen:148,ScrollLock:149,Pause:150,BrowserBack:151,BrowserFavorites:152,BrowserForward:153,BrowserHome:154,BrowserRefresh:155,BrowserSearch:156,BrowserStop:157,Eject:158,LaunchApp1:159,LaunchApp2:160,LaunchMail:161,MediaPlayPause:162,MediaSelect:163,MediaStop:164,MediaTrackNext:165,MediaTrackPrevious:166,Power:167,Sleep:168,AudioVolumeDown:169,AudioVolumeMute:170,AudioVolumeUp:171,WakeUp:172,Copy:173,Cut:174,Paste:175},je={Backquote:"`",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Comma:",",Equal:"=",Minus:"-",Period:".",Quote:"'",Semicolon:";",Slash:"/",Space:" ",IntlBackslash:"\\",IntlYen:"¥",IntlRo:"\\"};for(let t=0;t<=9;t+=1)je[`Digit${t}`]=String(t);for(let t=0;t<26;t+=1){const e=String.fromCharCode(65+t),s=String.fromCharCode(97+t);je[`Key${e}`]=s}function ns(t){return ss[t]??ts}function rs(t){const e=je[t];return e?e.codePointAt(0)??null:null}const me=0,is=-2,os=1,ls=2,as=3,cs=10,ds=11,us=12,hs=13,fs=14,ms=15,ps=16,gs=17,ws=1,ys=2,bs=1,xs=2,Ss=3,_s=4,vs=5,Ts=6,Cs=1,Rs=2,Es=3,Ds=4;function Ke(t){if(t.disposed||t.renderStateHandle===0)throw new Error("render state resources already disposed")}function Ns(t){switch(t){case 2:return"full";case 1:return"partial";default:return"clean"}}function ks(t){switch(t){case 0:return"bar";case 2:return"underline";case 3:return"block-hollow";default:return"block"}}function Ls(t){switch(t){case 1:return"wide";case 2:return"spacer-tail";case 3:return"spacer-head";default:return"narrow"}}function _e(t,e){return{r:t.view().getUint8(e),g:t.view().getUint8(e+1),b:t.view().getUint8(e+2)}}function Ze(t,e){const s=t.bindings.allocStruct("GhosttyColorRgb");try{const n=e(s.ptr);if(n===is)return null;if(n!==me)throw new Error(`ghostty optional color read failed with result ${n}`);return _e(t.bindings,s.ptr)}finally{s.free()}}function oe(t,e){const s=t.bindings.allocU8();try{const n=e(s);if(typeof n=="number"&&n!==me)throw new Error(`ghostty bool read failed with result ${n}`);return t.bindings.readU8(s)!==0}finally{t.bindings.freeU8(s)}}function Re(t,e){const s=t.bindings.allocBytes(2);try{const n=e(s);if(typeof n=="number"&&n!==me)throw new Error(`ghostty u16 read failed with result ${n}`);return t.bindings.view().getUint16(s,!0)}finally{t.bindings.freeBytes(s,2)}}function Ps(t,e){const s=t.bindings.allocBytes(4);try{const n=e(s);if(typeof n=="number"&&n!==me)throw new Error(`ghostty u32 read failed with result ${n}`);return t.bindings.view().getUint32(s,!0)}finally{t.bindings.freeBytes(s,4)}}function Be(t,e){const s=t.bindings.allocBytes(4);try{const n=e(s);if(typeof n=="number"&&n!==me)throw new Error(`ghostty enum read failed with result ${n}`);return t.bindings.view().getInt32(s,!0)}finally{t.bindings.freeBytes(s,4)}}function et(t,e){const s=t.bindings.allocBytes(8);try{const n=e(s);if(typeof n=="number"&&n!==me)throw new Error(`ghostty u64 read failed with result ${n}`);return t.bindings.readU64(s)}finally{t.bindings.freeBytes(s,8)}}function As(t){const e=t.bindings.allocStruct("GhosttyStyle");try{t.bindings.setField(e.view,"GhosttyStyle","size",t.bindings.typeSize("GhosttyStyle")),t.bindings.getRenderStateRowCellValue(t.rowCellsHandle,xs,e.ptr);const s=n=>t.bindings.field("GhosttyStyle",n).offset;return{bold:e.view.getUint8(s("bold"))!==0,italic:e.view.getUint8(s("italic"))!==0,faint:e.view.getUint8(s("faint"))!==0,blink:e.view.getUint8(s("blink"))!==0,inverse:e.view.getUint8(s("inverse"))!==0,invisible:e.view.getUint8(s("invisible"))!==0,strikethrough:e.view.getUint8(s("strikethrough"))!==0,overline:e.view.getUint8(s("overline"))!==0,underline:e.view.getInt32(s("underline"),!0)}}finally{e.free()}}function Ms(t){const e=Ps(t,n=>t.bindings.getRenderStateRowCellValueResult(t.rowCellsHandle,Ss,n));if(e===0)return[];const s=t.bindings.allocBytes(e*4);try{t.bindings.getRenderStateRowCellValue(t.rowCellsHandle,_s,s);const n=[];for(let r=0;r<e;r+=1)n.push(t.bindings.view().getUint32(s+r*4,!0));return n}finally{t.bindings.freeBytes(s,e*4)}}function Is(t){if(t.length===0)return"";try{return String.fromCodePoint(...t)}catch{return""}}function Os(t){let e="";for(const s of t)if(!(s.widthKind==="spacer-tail"||s.widthKind==="spacer-head")){if(s.text){e+=s.text;continue}s.widthKind==="narrow"&&(e+=" ")}return e}function Us(t){const e=t.bindings.allocStruct("GhosttyRenderStateColors");try{t.bindings.setField(e.view,"GhosttyRenderStateColors","size",t.bindings.typeSize("GhosttyRenderStateColors")),t.bindings.getRenderStateColors(t.renderStateHandle,e.ptr);const s=t.bindings.field("GhosttyRenderStateColors","palette").offset,n=[];for(let o=0;o<256;o+=1){const l=e.ptr+s+o*3;n.push(_e(t.bindings,l))}const r=e.view.getUint8(t.bindings.field("GhosttyRenderStateColors","cursor_has_value").offset)!==0,i=oe(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,fs,o));return{cols:Re(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,os,o)),rows:Re(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,ls,o)),dirty:Ns(Be(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,as,o))),colors:{background:_e(t.bindings,e.ptr+t.bindings.field("GhosttyRenderStateColors","background").offset),foreground:_e(t.bindings,e.ptr+t.bindings.field("GhosttyRenderStateColors","foreground").offset),cursor:r?_e(t.bindings,e.ptr+t.bindings.field("GhosttyRenderStateColors","cursor").offset):null,palette:n},cursor:{style:ks(Be(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,cs,o))),visible:oe(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,ds,o)),blinking:oe(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,us,o)),passwordInput:oe(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,hs,o)),x:i?Re(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,ms,o)):null,y:i?Re(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,ps,o)):null,wideTail:i?oe(t,o=>t.bindings.getRenderStateValueResult(t.renderStateHandle,gs,o)):!1}}}finally{e.free()}}function Vs(t,e){const s=et(t,i=>t.bindings.getRenderStateRowValueResult(t.rowIteratorHandle,ys,i));t.bindings.bindRenderStateRowCells(t.rowIteratorHandle,t.rowCellsHandle);const n=[];let r=0;for(;t.bindings.nextRenderStateRowCell(t.rowCellsHandle);){const i=et(t,c=>t.bindings.getRenderStateRowCellValueResult(t.rowCellsHandle,bs,c)),o=Ms(t),l=Ls(Be(t,c=>t.bindings.getRawCellValueResult(i,Es,c))),u={x:r,text:Is(o),codepoints:o,widthKind:l,hasText:oe(t,c=>t.bindings.getRawCellValueResult(i,Ds,c)),style:As(t),fgColor:Ze(t,c=>t.bindings.getRenderStateRowCellValueResult(t.rowCellsHandle,Ts,c)),bgColor:Ze(t,c=>t.bindings.getRenderStateRowCellValueResult(t.rowCellsHandle,vs,c))};n.push(u),r+=1}return{y:e,dirty:oe(t,i=>t.bindings.getRenderStateRowValueResult(t.rowIteratorHandle,ws,i)),wrap:oe(t,i=>t.bindings.getRawRowValueResult(s,Cs,i)),wrapContinuation:oe(t,i=>t.bindings.getRawRowValueResult(s,Rs,i)),text:Os(n),cells:n}}function tt(t){return{bindings:t,renderStateHandle:t.createRenderState(),rowIteratorHandle:t.createRenderStateRowIterator(),rowCellsHandle:t.createRenderStateRowCells(),snapshotVersion:0,disposed:!1,cachedMeta:null}}function st(t,e){Ke(t),t.bindings.updateRenderState(t.renderStateHandle,e),t.bindings.bindRenderStateRowIterator(t.renderStateHandle,t.rowIteratorHandle),t.snapshotVersion+=1,t.cachedMeta=null}function He(t){return Ke(t),t.cachedMeta||(t.cachedMeta=Us(t)),t.cachedMeta}function*Fs(t){Ke(t);const e=He(t);t.bindings.bindRenderStateRowIterator(t.renderStateHandle,t.rowIteratorHandle);let s=0;for(;s<e.rows&&t.bindings.nextRenderStateRowIterator(t.rowIteratorHandle);)yield Vs(t,s),s+=1}function Ue(t){t.disposed||(t.disposed=!0,t.rowCellsHandle!==0&&(t.bindings.freeRenderStateRowCells(t.rowCellsHandle),t.rowCellsHandle=0),t.rowIteratorHandle!==0&&(t.bindings.freeRenderStateRowIterator(t.rowIteratorHandle),t.rowIteratorHandle=0),t.renderStateHandle!==0&&(t.bindings.freeRenderState(t.renderStateHandle),t.renderStateHandle=0),t.cachedMeta=null)}function We(t,e){return Math.max(0,Math.min(Math.max(t.length-1,0),Math.floor(e)))}function Bs(t,e){return t.line<e.line?{start:t,end:e}:t.line>e.line?{start:e,end:t}:t.col<=e.col?{start:t,end:e}:{start:e,end:t}}function Hs(t,e,s){if(!s)return{start:{line:t,col:0},end:{line:t,col:0}};const n=We(s,e),r=u=>/[\p{L}\p{N}_-]/u.test(u),i=s[n]??"";if(!r(i))return{start:{line:t,col:n},end:{line:t,col:n}};let o=n,l=n;for(;o>0&&r(s[o-1]??"");)o-=1;for(;l+1<s.length&&r(s[l+1]??"");)l+=1;return{start:{line:t,col:o},end:{line:t,col:l}}}function ut(t,e){const s=Math.max(e.length-1,0);return{start:{line:t,col:0},end:{line:t,col:s}}}function ht(t,e,s){const n=s(t.line);switch(e){case"word":return Hs(t.line,t.col,n);case"line":return ut(t.line,n);default:{const r=We(n,t.col);return{start:{line:t.line,col:r},end:{line:t.line,col:r}}}}}function ft(){return{anchor:null,focus:null,mode:"character"}}function zs(t){return!!(t.anchor&&t.focus)}function Gs(){return ft()}function Ys(t,e,s){const n=ht(e,e.mode,s);return{anchor:n.start,focus:n.end,mode:e.mode}}function nt(t,e,s){return t.anchor?t.mode==="line"?{...t,focus:ut(e.line,s(e.line)).end}:t.mode==="word"?{...t,focus:ht(e,"word",s).end}:{...t,focus:{line:e.line,col:We(s(e.line),e.col)}}:t}function mt(t){return!t.anchor||!t.focus?null:Bs(t.anchor,t.focus)}function js(t,e){const s=mt(t);if(!s)return null;const n=[];for(let r=s.start.line;r<=s.end.line;r+=1){const i=e(r);if(r===s.start.line&&r===s.end.line){n.push(i.slice(s.start.col,s.end.col+1));continue}if(r===s.start.line){n.push(i.slice(s.start.col));continue}if(r===s.end.line){n.push(i.slice(0,s.end.col+1));continue}n.push(i)}return n.join(`
|
|
22
|
+
`)}function Ks(t,e,s,n){const r=mt(t);if(!r)return[];const i=e+s-1,o=[];for(let l=Math.max(r.start.line,e);l<=Math.min(r.end.line,i);l+=1){const u=l-e;if(l===r.start.line&&l===r.end.line){o.push({row:u,x:r.start.col,width:r.end.col-r.start.col+1});continue}if(l===r.start.line){const b=n?Math.max(n(l).length-r.start.col,0):Number.MAX_SAFE_INTEGER;o.push({row:u,x:r.start.col,width:b});continue}if(l===r.end.line){o.push({row:u,x:0,width:r.end.col+1});continue}const c=n?n(l).length:Number.MAX_SAFE_INTEGER;o.push({row:u,x:0,width:c})}return o}function Ws(t){return(t.metaKey||t.ctrlKey)&&!t.altKey}function $s(t){return Ws(t)&&t.key.toLowerCase()==="c"}async function qs(t){var e;t&&typeof navigator<"u"&&(e=navigator.clipboard)!=null&&e.writeText&&await navigator.clipboard.writeText(t)}function Xs(t,e){return!e||!t.clipboardData?!1:(t.clipboardData.setData("text/plain",e),t.preventDefault(),!0)}const Js="/assets/ghostty-vt-BKQMf-5X.wasm",Ee=0,rt=-3,Qs=11,Zs=12,en=13,tn=14,sn=1,nn=2,rn=9,on=1,ln=0,an=1,cn=2,dn=0,un=1,hn=2,fn=2004;let Ve=null;function P(t,e){if(t!==Ee)throw new Error(`${e} failed with result ${t}`)}function pt(t){const e=t.trim().replace(/^#/,"");if(e.length!==6)throw new Error(`expected #RRGGBB color, received: ${t}`);return[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16)]}function mn(t){const s=[...[t.black,t.red,t.green,t.yellow,t.blue,t.magenta,t.cyan,t.white,t.brightBlack,t.brightRed,t.brightGreen,t.brightYellow,t.brightBlue,t.brightMagenta,t.brightCyan,t.brightWhite].map(pt)],n=[0,95,135,175,215,255];for(const r of n)for(const i of n)for(const o of n)s.push([r,i,o]);for(let r=0;r<24;r+=1){const i=8+r*10;s.push([i,i,i])}return s}function pn(t){var s,n;let e=0;return t.shiftKey&&(e|=1),t.ctrlKey&&(e|=2),t.altKey&&(e|=4),t.metaKey&&(e|=8),(s=t.getModifierState)!=null&&s.call(t,"CapsLock")&&(e|=16),(n=t.getModifierState)!=null&&n.call(t,"NumLock")&&(e|=32),e}class gn{constructor(e,s,n){this.bindings=e,this.typeName=s,this.ptr=n}get view(){return this.bindings.view(this.ptr,this.bindings.typeSize(this.typeName))}free(){this.bindings.freeBytes(this.ptr,this.bindings.typeSize(this.typeName))}}class wn{constructor(e,s){y(this,"exports");y(this,"layout");y(this,"decoder",new TextDecoder);y(this,"encoder",new TextEncoder);this.exports=e,this.layout=s}buffer(){return this.exports.memory.buffer}bytes(e=0,s=this.buffer().byteLength-e){return new Uint8Array(this.buffer(),e,s)}view(e=0,s=this.buffer().byteLength-e){return new DataView(this.buffer(),e,s)}typeSize(e){const s=this.layout[e];if(!s)throw new Error(`unknown ghostty type: ${e}`);return s.size}field(e,s){const n=this.layout[e],r=n==null?void 0:n.fields[s];if(!n||!r)throw new Error(`unknown ghostty field: ${e}.${s}`);return r}allocStruct(e){const s=this.allocBytes(this.typeSize(e));return this.bytes(s,this.typeSize(e)).fill(0),new gn(this,e,s)}allocBytes(e){return this.exports.ghostty_wasm_alloc_u8_array(e)}freeBytes(e,s){this.exports.ghostty_wasm_free_u8_array(e,s)}allocOpaque(){return this.exports.ghostty_wasm_alloc_opaque()}freeOpaque(e){this.exports.ghostty_wasm_free_opaque(e)}allocU8(){return this.exports.ghostty_wasm_alloc_u8()}freeU8(e){this.exports.ghostty_wasm_free_u8(e)}allocUsize(){return this.exports.ghostty_wasm_alloc_usize()}freeUsize(e){this.exports.ghostty_wasm_free_usize(e)}readPointer(e){return this.view().getUint32(e,!0)}readU8(e){return this.view().getUint8(e)}readUsize(e){return this.view().getUint32(e,!0)}readU64(e){return this.view().getBigUint64(e,!0)}setField(e,s,n,r){const i=this.field(s,n),o=i.offset;switch(i.type){case"u8":case"bool":e.setUint8(o,Number(r));return;case"u16":e.setUint16(o,Number(r),!0);return;case"u32":e.setUint32(o,Number(r),!0);return;case"u64":e.setBigUint64(o,BigInt(r),!0);return;case"usize":{e.setUint32(o,Number(r),!0);return}case"i32":case"enum":e.setInt32(o,Number(r),!0);return;default:throw new Error(`unsupported field type ${s}.${n}: ${i.type}`)}}writeString(e){const s=this.encoder.encode(e),n=this.allocBytes(s.length);return this.bytes(n,s.length).set(s),{ptr:n,len:s.length,free:()=>this.freeBytes(n,s.length)}}writeBytes(e){const s=this.allocBytes(e.length);return this.bytes(s,e.length).set(e),{ptr:s,len:e.length,free:()=>this.freeBytes(s,e.length)}}readOwnedUtf8(e,s){return this.decoder.decode(this.bytes(e,s))}createTerminal(e,s,n){const r=this.allocStruct("GhosttyTerminalOptions");this.setField(r.view,"GhosttyTerminalOptions","cols",e),this.setField(r.view,"GhosttyTerminalOptions","rows",s),this.setField(r.view,"GhosttyTerminalOptions","max_scrollback",n);const i=this.allocOpaque();try{return P(this.exports.ghostty_terminal_new(0,i,r.ptr),"ghostty_terminal_new"),this.readPointer(i)}finally{r.free(),this.freeOpaque(i)}}freeTerminal(e){this.exports.ghostty_terminal_free(e)}writeVt(e,s){const n=typeof s=="string"?this.encoder.encode(s):s,r=this.writeBytes(n);try{this.exports.ghostty_terminal_vt_write(e,r.ptr,r.len)}finally{r.free()}}resetTerminal(e){this.exports.ghostty_terminal_reset(e)}resizeTerminal(e,s,n,r){P(this.exports.ghostty_terminal_resize(e,s,n,Math.max(1,Math.round(r.width)),Math.max(1,Math.round(r.height))),"ghostty_terminal_resize")}scrollViewportDelta(e,s){const n=this.allocStruct("GhosttyTerminalScrollViewport");try{this.setField(n.view,"GhosttyTerminalScrollViewport","tag",cn),n.view.setBigInt64(this.field("GhosttyTerminalScrollViewport","value").offset,BigInt(s),!0),this.exports.ghostty_terminal_scroll_viewport(e,n.ptr)}finally{n.free()}}scrollViewportTop(e){const s=this.allocStruct("GhosttyTerminalScrollViewport");try{this.setField(s.view,"GhosttyTerminalScrollViewport","tag",ln),this.exports.ghostty_terminal_scroll_viewport(e,s.ptr)}finally{s.free()}}scrollViewportBottom(e){const s=this.allocStruct("GhosttyTerminalScrollViewport");try{this.setField(s.view,"GhosttyTerminalScrollViewport","tag",an),this.exports.ghostty_terminal_scroll_viewport(e,s.ptr)}finally{s.free()}}setTerminalTheme(e,s){const n=this.allocStruct("GhosttyColorRgb"),r=this.allocStruct("GhosttyColorRgb"),i=this.allocStruct("GhosttyColorRgb"),o=mn(s),l=this.allocBytes(o.length*3),u=(b,k)=>{const[M,F,R]=pt(k);this.setField(b.view,"GhosttyColorRgb","r",M),this.setField(b.view,"GhosttyColorRgb","g",F),this.setField(b.view,"GhosttyColorRgb","b",R)};u(n,s.foreground),u(r,s.background),u(i,s.cursor);const c=this.bytes(l,o.length*3);o.forEach(([b,k,M],F)=>{const R=F*3;c[R]=b,c[R+1]=k,c[R+2]=M});try{P(this.exports.ghostty_terminal_set(e,Qs,n.ptr),"ghostty_terminal_set(foreground)"),P(this.exports.ghostty_terminal_set(e,Zs,r.ptr),"ghostty_terminal_set(background)"),P(this.exports.ghostty_terminal_set(e,en,i.ptr),"ghostty_terminal_set(cursor)"),P(this.exports.ghostty_terminal_set(e,tn,l),"ghostty_terminal_set(palette)")}finally{n.free(),r.free(),i.free(),this.freeBytes(l,o.length*3)}}readTerminalSize(e){const s=this.allocBytes(2),n=this.allocBytes(2);try{return P(this.exports.ghostty_terminal_get(e,sn,s),"ghostty_terminal_get(cols)"),P(this.exports.ghostty_terminal_get(e,nn,n),"ghostty_terminal_get(rows)"),{cols:this.view().getUint16(s,!0),rows:this.view().getUint16(n,!0)}}finally{this.freeBytes(s,2),this.freeBytes(n,2)}}readScrollbar(e){const s=this.allocStruct("GhosttyTerminalScrollbar");try{return P(this.exports.ghostty_terminal_get(e,rn,s.ptr),"ghostty_terminal_get(scrollbar)"),{total:Number(s.view.getBigUint64(this.field("GhosttyTerminalScrollbar","total").offset,!0)),offset:Number(s.view.getBigUint64(this.field("GhosttyTerminalScrollbar","offset").offset,!0)),len:Number(s.view.getBigUint64(this.field("GhosttyTerminalScrollbar","len").offset,!0))}}finally{s.free()}}isTerminalModeEnabled(e,s){const n=this.allocU8();try{return P(this.exports.ghostty_terminal_mode_get(e,s,n),"ghostty_terminal_mode_get"),this.readU8(n)!==0}finally{this.freeU8(n)}}createFormatter(e,s,n){const r=this.allocStruct("GhosttyFormatterTerminalOptions"),i=this.field("GhosttyFormatterTerminalOptions","extra").offset,o=this.view(r.ptr+i,this.typeSize("GhosttyFormatterTerminalExtra")),l=this.field("GhosttyFormatterTerminalExtra","screen").offset,u=this.view(r.ptr+i+l,this.typeSize("GhosttyFormatterScreenExtra")),c=this.allocOpaque();try{this.setField(r.view,"GhosttyFormatterTerminalOptions","size",this.typeSize("GhosttyFormatterTerminalOptions")),this.setField(r.view,"GhosttyFormatterTerminalOptions","emit",s),this.setField(r.view,"GhosttyFormatterTerminalOptions","unwrap",n.unwrap),this.setField(r.view,"GhosttyFormatterTerminalOptions","trim",n.trim),this.setField(o,"GhosttyFormatterTerminalExtra","size",this.typeSize("GhosttyFormatterTerminalExtra")),this.setField(o,"GhosttyFormatterTerminalExtra","palette",n.includePalette),this.setField(u,"GhosttyFormatterScreenExtra","size",this.typeSize("GhosttyFormatterScreenExtra"));const b=this.field("GhosttyFormatterTerminalOptions","selection").offset;return r.view.setUint32(b,n.selectionPtr??0,!0),P(this.exports.ghostty_formatter_terminal_new(0,c,e,r.ptr),"ghostty_formatter_terminal_new"),this.readPointer(c)}finally{r.free(),this.freeOpaque(c)}}freeFormatter(e){this.exports.ghostty_formatter_free(e)}resolveViewportGridRef(e,s,n){const r=this.allocStruct("GhosttyPoint"),i=this.allocStruct("GhosttyGridRef");try{this.setField(r.view,"GhosttyPoint","tag",on);const o=this.field("GhosttyPoint","value").offset,l=this.view(r.ptr+o,this.typeSize("GhosttyPointCoordinate"));return this.setField(l,"GhosttyPointCoordinate","x",s),this.setField(l,"GhosttyPointCoordinate","y",n),this.exports.ghostty_terminal_grid_ref(e,r.ptr,i.ptr)!==Ee?(i.free(),null):i}finally{r.free()}}createViewportSelection(e,s,n){const r=Math.max(1,Math.floor(s)),i=Math.max(1,Math.floor(n)),o=this.resolveViewportGridRef(e,0,0);if(!o)return null;let l=null;for(let c=i-1;c>=0&&(l=this.resolveViewportGridRef(e,r-1,c),!l);c-=1);if(!l)return o.free(),null;const u=this.allocStruct("GhosttySelection");try{this.setField(u.view,"GhosttySelection","size",this.typeSize("GhosttySelection")),this.setField(u.view,"GhosttySelection","rectangle",!1);const c=this.field("GhosttySelection","start").offset,b=this.field("GhosttySelection","end").offset;return this.bytes(u.ptr+c,this.typeSize("GhosttyGridRef")).set(this.bytes(o.ptr,this.typeSize("GhosttyGridRef"))),this.bytes(u.ptr+b,this.typeSize("GhosttyGridRef")).set(this.bytes(l.ptr,this.typeSize("GhosttyGridRef"))),u}finally{o.free(),l.free()}}formatViewport(e,s,n,r){const i=this.readTerminalSize(e),o=this.createViewportSelection(e,Math.max(1,Math.min(i.cols,r.cols)),Math.max(1,Math.min(i.rows,r.rows))),l=this.createFormatter(e,s,{...n,selectionPtr:(o==null?void 0:o.ptr)??null});try{return this.formatFormatter(l)}finally{this.freeFormatter(l),o==null||o.free()}}formatFormatter(e){const s=this.allocOpaque(),n=this.allocUsize();try{P(this.exports.ghostty_formatter_format_alloc(e,0,s,n),"ghostty_formatter_format_alloc");const r=this.readPointer(s),i=this.readUsize(n),o=this.buffer().byteLength;try{if(i===0||r===0)return"";if(r<0||r>o||i>o-r)throw new Error(`ghostty_formatter_format_alloc returned invalid slice ptr=${r} len=${i} mem=${o}`);return this.readOwnedUtf8(r,i)}finally{i>0&&r!==0&&this.exports.ghostty_free(0,r,i)}}finally{this.freeOpaque(s),this.freeUsize(n)}}createRenderState(){const e=this.allocOpaque();try{return P(this.exports.ghostty_render_state_new(0,e),"ghostty_render_state_new"),this.readPointer(e)}finally{this.freeOpaque(e)}}freeRenderState(e){this.exports.ghostty_render_state_free(e)}updateRenderState(e,s){P(this.exports.ghostty_render_state_update(e,s),"ghostty_render_state_update")}getRenderStateValueResult(e,s,n){return this.exports.ghostty_render_state_get(e,s,n)}getRenderStateValue(e,s,n){P(this.getRenderStateValueResult(e,s,n),"ghostty_render_state_get")}setRenderStateValue(e,s,n){P(this.exports.ghostty_render_state_set(e,s,n),"ghostty_render_state_set")}getRenderStateColors(e,s){P(this.exports.ghostty_render_state_colors_get(e,s),"ghostty_render_state_colors_get")}createRenderStateRowIterator(){const e=this.allocOpaque();try{return P(this.exports.ghostty_render_state_row_iterator_new(0,e),"ghostty_render_state_row_iterator_new"),this.readPointer(e)}finally{this.freeOpaque(e)}}freeRenderStateRowIterator(e){this.exports.ghostty_render_state_row_iterator_free(e)}bindRenderStateRowIterator(e,s){const n=this.allocOpaque();try{this.view(n,4).setUint32(0,s,!0),this.getRenderStateValue(e,4,n)}finally{this.freeOpaque(n)}}nextRenderStateRowIterator(e){return this.exports.ghostty_render_state_row_iterator_next(e)!==0}getRenderStateRowValueResult(e,s,n){return this.exports.ghostty_render_state_row_get(e,s,n)}getRenderStateRowValue(e,s,n){P(this.getRenderStateRowValueResult(e,s,n),"ghostty_render_state_row_get")}setRenderStateRowValue(e,s,n){P(this.exports.ghostty_render_state_row_set(e,s,n),"ghostty_render_state_row_set")}createRenderStateRowCells(){const e=this.allocOpaque();try{return P(this.exports.ghostty_render_state_row_cells_new(0,e),"ghostty_render_state_row_cells_new"),this.readPointer(e)}finally{this.freeOpaque(e)}}freeRenderStateRowCells(e){this.exports.ghostty_render_state_row_cells_free(e)}bindRenderStateRowCells(e,s){const n=this.allocOpaque();try{this.view(n,4).setUint32(0,s,!0),this.getRenderStateRowValue(e,3,n)}finally{this.freeOpaque(n)}}nextRenderStateRowCell(e){return this.exports.ghostty_render_state_row_cells_next(e)!==0}selectRenderStateRowCell(e,s){P(this.exports.ghostty_render_state_row_cells_select(e,s),"ghostty_render_state_row_cells_select")}getRenderStateRowCellValueResult(e,s,n){return this.exports.ghostty_render_state_row_cells_get(e,s,n)}getRenderStateRowCellValue(e,s,n){P(this.getRenderStateRowCellValueResult(e,s,n),"ghostty_render_state_row_cells_get")}getRawRowValueResult(e,s,n){return this.exports.ghostty_row_get(e,s,n)}getRawRowValue(e,s,n){P(this.getRawRowValueResult(e,s,n),"ghostty_row_get")}getRawCellValueResult(e,s,n){return this.exports.ghostty_cell_get(e,s,n)}getRawCellValue(e,s,n){P(this.getRawCellValueResult(e,s,n),"ghostty_cell_get")}createKeyEncoder(){const e=this.allocOpaque();try{return P(this.exports.ghostty_key_encoder_new(0,e),"ghostty_key_encoder_new"),this.readPointer(e)}finally{this.freeOpaque(e)}}freeKeyEncoder(e){this.exports.ghostty_key_encoder_free(e)}encodeKeyEvent(e,s,n){if(n.keyCode<=0)return null;const r=this.allocOpaque();let i=0,o=null;try{return P(this.exports.ghostty_key_event_new(0,r),"ghostty_key_event_new"),i=this.readPointer(r),this.exports.ghostty_key_encoder_setopt_from_terminal(e,s),this.exports.ghostty_key_event_set_action(i,n.action==="release"?dn:n.action==="repeat"?hn:un),this.exports.ghostty_key_event_set_key(i,n.keyCode),this.exports.ghostty_key_event_set_mods(i,n.mods),this.exports.ghostty_key_event_set_consumed_mods(i,0),this.exports.ghostty_key_event_set_composing(i,n.composing?1:0),n.utf8&&(o=this.writeString(n.utf8),this.exports.ghostty_key_event_set_utf8(i,o.ptr,o.len)),typeof n.unshiftedCodepoint=="number"&&this.exports.ghostty_key_event_set_unshifted_codepoint(i,n.unshiftedCodepoint),this.encodeKeyHandle(e,i)}finally{o==null||o.free(),i!==0&&this.exports.ghostty_key_event_free(i),this.freeOpaque(r)}}encodeKeyHandle(e,s){const n=this.allocUsize();try{const r=this.exports.ghostty_key_encoder_encode(e,s,0,0,n);r!==rt&&r!==Ee&&P(r,"ghostty_key_encoder_encode(size)");const i=Math.max(0,this.readUsize(n));if(i===0)return null;const o=this.allocBytes(i),l=this.allocUsize();try{P(this.exports.ghostty_key_encoder_encode(e,s,o,i,l),"ghostty_key_encoder_encode");const u=this.readUsize(l);return u===0?null:this.readOwnedUtf8(o,u)}finally{this.freeBytes(o,i),this.freeUsize(l)}}finally{this.freeUsize(n)}}encodePaste(e,s){const n=this.writeString(s),r=this.allocUsize();try{const i=this.isTerminalModeEnabled(e,fn),o=this.exports.ghostty_paste_encode(n.ptr,n.len,i?1:0,0,0,r);o!==rt&&o!==Ee&&P(o,"ghostty_paste_encode(size)");const l=Math.max(0,this.readUsize(r));if(l===0)return"";const u=this.allocBytes(l),c=this.allocUsize();try{return P(this.exports.ghostty_paste_encode(n.ptr,n.len,i?1:0,u,l,c),"ghostty_paste_encode"),this.readOwnedUtf8(u,this.readUsize(c))}finally{this.freeBytes(u,l),this.freeUsize(c)}}finally{n.free(),this.freeUsize(r)}}}async function yn(t){if((t.startsWith("/")||t.startsWith("./")||t.startsWith("../")||/^[A-Za-z]:[\\/]/.test(t))&&typeof Bun<"u")return Bun.file(t).arrayBuffer();const s=await fetch(t);if(!s.ok)throw new Error(`failed to load ghostty wasm: ${s.status} ${s.statusText}`);return s.arrayBuffer()}async function bn(){return Ve||(Ve=(async()=>{const t=await yn(Js),s=(await WebAssembly.instantiate(t,{env:{log(){}}})).instance.exports,n=new Uint8Array(s.memory.buffer),r=s.ghostty_type_json();let i=r;for(;n[i]!==0;)i+=1;const o=JSON.parse(new TextDecoder().decode(n.subarray(r,i)));return new wn(s,o)})()),Ve}const it=80,ve=24,ot=9,Fe=17,xn=48,gt="ghostty-official";class Sn{constructor(e){this.content=e}translateToString(e){return e?this.content.replace(/\s+$/u,""):this.content}}class _n{constructor(){y(this,"active",{baseY:0,viewportY:0,length:ve,getLine:e=>{const s=e-this.active.viewportY,n=this.visibleLines[s];return typeof n=="string"?new Sn(n):null}});y(this,"visibleLines",Array.from({length:ve},()=>""))}setViewport(e,s,n,r){this.active.viewportY=e,this.active.baseY=s,this.active.length=n,this.visibleLines=r}}function vn(t){return!(t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey)}function Tn(t,e){const s=t.slice(0,e).map(n=>n.text);for(;s.length<e;)s.push("");return s}class Cn{constructor(){y(this,"terminal",null)}activate(e){this.terminal=e instanceof Ne?e:null}fit(){const e=this.proposeDimensions();!this.terminal||!e||this.terminal.resize(e.cols,e.rows)}proposeDimensions(){var e;return((e=this.terminal)==null?void 0:e.measureSizeFromElement())??null}dispose(){this.terminal=null}}class Ne{constructor(e,s,n,r,i){y(this,"buffer",new _n);y(this,"_core",{_renderService:{dimensions:{css:{cell:{width:ot,height:Fe}}}}});y(this,"options");y(this,"element",null);y(this,"textarea",null);y(this,"cols",it);y(this,"rows",ve);y(this,"bindings");y(this,"terminalHandle");y(this,"keyEncoderHandle");y(this,"renderState");y(this,"dataListeners",new Set);y(this,"addons",new Set);y(this,"screenElement",null);y(this,"renderer",null);y(this,"renderRaf",null);y(this,"disposed",!1);y(this,"disableStdin");y(this,"customKeyEventHandler",()=>!0);y(this,"imeIsComposing",!1);y(this,"lastCompositionCommit",null);y(this,"selectionState",ft());y(this,"lineCache",new Map);y(this,"lastViewportOffset",0);y(this,"lastViewportRows",ve);y(this,"lastRenderedRows",[]);y(this,"pointerDrag",{active:!1,moved:!1,mode:"character",lastClientX:null,lastClientY:null});y(this,"autoScrollTimer",null);y(this,"domEventDisposers",[]);y(this,"copyShortcutSuppressed",!1);y(this,"scrollbarThumb",null);y(this,"scrollbarFadeTimer",null);this.bindings=e,this.terminalHandle=s,this.keyEncoderHandle=n,this.renderState=r,this.options=i,this.disableStdin=!!i.disableStdin}static async create(e){const s=await bn(),n=s.createTerminal(it,ve,e.scrollback);let r=0,i=null;try{return s.setTerminalTheme(n,e.theme),r=s.createKeyEncoder(),i=tt(s),new Ne(s,n,r,i,e)}catch(o){throw i&&Ue(i),r!==0&&s.freeKeyEncoder(r),s.freeTerminal(n),o}}open(e){if(this.disposed||this.element)return;const s=document.createElement("div");s.className="xterm",s.style.position="absolute",s.style.inset="0",s.style.overflow="hidden",s.style.width="100%",s.style.height="100%",s.style.backgroundColor=this.options.theme.background,s.style.color=this.options.theme.foreground,s.style.fontFamily=this.options.fontFamily,s.style.fontSize=`${this.options.fontSize}px`,s.style.lineHeight="1.2";const n=document.createElement("div");n.className="xterm-viewport",n.style.width="100%",n.style.height="100%",n.style.overflow="hidden",n.style.position="relative";const r=document.createElement("div");r.className="xterm-screen",r.style.width="100%",r.style.height="100%",r.style.position="relative",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.backgroundColor=this.options.theme.background;const i=document.createElement("div");i.className="xterm-helper-textarea",i.setAttribute("aria-label","Terminal Input"),i.setAttribute("role","textbox"),i.setAttribute("contenteditable","true"),i.setAttribute("autocorrect","off"),i.setAttribute("autocapitalize","off"),i.setAttribute("spellcheck","false"),i.style.position="absolute",i.style.opacity="1",i.style.pointerEvents="none",i.style.left="0",i.style.top="0",i.style.minWidth="1px",i.style.minHeight="1px",i.style.whiteSpace="pre",i.style.border="0",i.style.padding="0",i.style.margin="0",i.style.color=this.options.theme.foreground,i.style.backgroundColor="transparent",i.style.caretColor="transparent",i.style.overflow="visible",i.style.outline="none",i.style.boxShadow="none",i.style.fontFamily=this.options.fontFamily,i.style.fontSize=`${this.options.fontSize}px`,i.style.userSelect="text",i.style.webkitUserSelect="text";const o=document.createElement("div");o.className="xterm-scrollbar-track",o.style.position="absolute",o.style.top="0",o.style.right="0",o.style.width="8px",o.style.height="100%",o.style.backgroundColor="transparent",o.style.pointerEvents="none";const l=document.createElement("div");l.className="xterm-scrollbar-thumb",l.style.position="absolute",l.style.top="0",l.style.right="0",l.style.width="6px",l.style.marginRight="1px",l.style.borderRadius="3px",l.style.backgroundColor="rgba(128, 128, 128, 0.5)",l.style.pointerEvents="none",l.style.transition="opacity 0.15s ease",l.style.opacity="0",o.appendChild(l),n.appendChild(r),s.appendChild(n),s.appendChild(i),s.appendChild(o),e.appendChild(s),this.element=s,this.screenElement=r,this.textarea=i,this.scrollbarThumb=l,this.renderer=new es({screenElement:r,theme:this.options.theme,fontFamily:this.options.fontFamily,fontSize:this.options.fontSize}),this.syncInputState(),this.bindDomEvents(),this.updateCellDimensions();const u=this.measureSizeFromElement();u?this.resize(u.cols,u.rows):this.render()}loadAddon(e){e.activate(this),this.addons.add(e)}onData(e){return this.dataListeners.add(e),{dispose:()=>{this.dataListeners.delete(e)}}}attachCustomKeyEventHandler(e){this.customKeyEventHandler=e}write(e){this.disposed||(this.bindings.writeVt(this.terminalHandle,e),this.scheduleRender())}reset(){this.disposed||(this.lineCache.clear(),this.clearSelectionState(!1),this.bindings.resetTerminal(this.terminalHandle),this.scheduleRender())}resize(e,s){if(this.disposed)return;const n=Math.max(2,Math.floor(e)),r=Math.max(2,Math.floor(s));this.cols=n,this.rows=r,this.clearSelectionState(!1),this.bindings.resizeTerminal(this.terminalHandle,n,r,this.cellDimensions()),this.scheduleRender()}scrollLines(e){this.disposed||e===0||(this.bindings.scrollViewportDelta(this.terminalHandle,e),this.render())}scrollToTop(){this.disposed||(this.bindings.scrollViewportTop(this.terminalHandle),this.render())}scrollToBottom(){this.disposed||(this.bindings.scrollViewportBottom(this.terminalHandle),this.render())}paste(e){if(this.disposed||this.disableStdin||!e)return;const s=this.bindings.encodePaste(this.terminalHandle,e);s&&this.emitData(s)}focus(){var e;(e=this.textarea)==null||e.focus({preventScroll:!0})}getRendererKind(){var e;return((e=this.renderer)==null?void 0:e.kind)??"unknown"}setTheme(e){var s;this.bindings.setTerminalTheme(this.terminalHandle,e),this.options.theme=e,this.element&&(this.element.style.backgroundColor=e.background,this.element.style.color=e.foreground),this.screenElement&&(this.screenElement.style.backgroundColor=e.background),(s=this.renderer)==null||s.setTheme(e),this.scheduleRender()}setDisableStdin(e){this.disableStdin=e,this.syncInputState()}measureSizeFromElement(){const e=this.element;if(!e)return null;const s=e.getBoundingClientRect(),{width:n,height:r}=this.cellDimensions();return s.width===0||s.height===0||n<=0||r<=0?null:{cols:Math.max(2,Math.floor(s.width/n)),rows:Math.max(2,Math.floor(s.height/r))}}dispose(){var e,s;if(!this.disposed){this.disposed=!0,this.renderRaf!==null&&(cancelAnimationFrame(this.renderRaf),this.renderRaf=null),this.stopAutoScroll(),this.updateSelectionTextProbe(null),this.clearDomEventListeners(),this.scrollbarFadeTimer&&(clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=null);for(const n of this.addons)n.dispose();this.addons.clear(),(e=this.renderer)==null||e.dispose(),this.renderer=null,(s=this.element)==null||s.remove(),this.element=null,this.screenElement=null,this.textarea=null,this.scrollbarThumb=null,Ue(this.renderState),this.bindings.freeKeyEncoder(this.keyEncoderHandle),this.bindings.freeTerminal(this.terminalHandle)}}cellDimensions(){return this._core._renderService.dimensions.css.cell}syncInputState(){this.textarea&&(this.textarea.readOnly=this.disableStdin,this.textarea.tabIndex=this.disableStdin?-1:0,this.disableStdin&&document.activeElement===this.textarea&&this.textarea.blur())}bindDomEvents(){const e=this.element,s=this.textarea;if(!e||!s)return;e.addEventListener("click",()=>{this.disableStdin||this.focus()}),(this.screenElement??e).addEventListener("mousedown",i=>{!(i instanceof MouseEvent)||i.button!==0||(this.disableStdin||this.focus(),this.beginPointerSelection(i),i.preventDefault())}),e.addEventListener("wheel",i=>{const o=this.cellDimensions().height||Fe,l=i.deltaY>0?Math.ceil(i.deltaY/o):Math.floor(i.deltaY/o);l!==0&&(i.preventDefault(),this.scrollLines(l))},{passive:!1});const r=typeof window<"u"&&typeof window.addEventListener=="function"?window:null;if(r){const i=l=>{this.updatePointerSelection(l)},o=l=>{this.finishPointerSelection(l)};r.addEventListener("mousemove",i),r.addEventListener("mouseup",o),this.domEventDisposers.push(()=>{r.removeEventListener("mousemove",i),r.removeEventListener("mouseup",o)})}s.addEventListener("keydown",i=>{const o=this.getSelectionText();if(o&&$s(i)){this.copyShortcutSuppressed=!0,i.preventDefault(),qs(o).catch(()=>{}),this.clearTextarea();return}if(!this.customKeyEventHandler(i)||this.disableStdin||this.imeIsComposing||i.keyCode===229||!vn(i))return;const l=this.encodeKeyboardEvent(i,i.repeat?"repeat":"press");l&&(i.preventDefault(),this.emitData(l),this.clearTextarea())}),s.addEventListener("keyup",i=>{if(this.copyShortcutSuppressed){const l=i.key.toLowerCase();if(l==="c"){i.preventDefault();return}if(l==="control"||l==="meta"||l==="os"){this.copyShortcutSuppressed=!1,i.preventDefault();return}}if(this.disableStdin||this.imeIsComposing)return;const o=this.encodeKeyboardEvent(i,"release");o&&(i.preventDefault(),this.emitData(o),this.clearTextarea())}),s.addEventListener("compositionstart",()=>{this.imeIsComposing=!0,this.lastCompositionCommit=null,this.syncTextareaPositionToCursor()}),s.addEventListener("compositionupdate",()=>{this.syncTextareaPositionToCursor()}),s.addEventListener("compositionend",i=>{this.imeIsComposing=!1;const o=i.data??"";o&&(this.lastCompositionCommit={data:o,at:Date.now()},this.emitData(o),this.clearTextarea())}),s.addEventListener("beforeinput",i=>{if(this.disableStdin||i.inputType==="insertFromPaste")return;const o=i.data??"";if(!o||i.isComposing||this.imeIsComposing)return;const l=this.lastCompositionCommit;if(l&&l.data===o&&Date.now()-l.at<40){this.lastCompositionCommit=null,i.preventDefault(),this.clearTextarea();return}this.lastCompositionCommit=null,i.preventDefault(),this.emitData(o),this.clearTextarea()}),s.addEventListener("paste",i=>{var l;if(this.disableStdin)return;const o=((l=i.clipboardData)==null?void 0:l.getData("text/plain"))??"";o&&(i.preventDefault(),this.paste(o),this.clearTextarea())}),s.addEventListener("copy",i=>{const o=this.getSelectionText();o&&Xs(i,o)}),s.addEventListener("input",()=>{if(this.disableStdin||this.imeIsComposing)return;const i=s.textContent??"";if(!i){this.clearTextarea();return}const o=this.lastCompositionCommit;if(o&&o.data===i&&Date.now()-o.at<40){this.lastCompositionCommit=null,this.clearTextarea();return}this.lastCompositionCommit=null,this.emitData(i),this.clearTextarea()})}encodeKeyboardEvent(e,s){const n=ns(e.code);if(n===0)return null;const r=e.key.length===1&&!e.ctrlKey&&!e.metaKey?e.key:null;return this.bindings.encodeKeyEvent(this.keyEncoderHandle,this.terminalHandle,{action:s,keyCode:n,mods:pn(e),composing:e.isComposing,utf8:r,unshiftedCodepoint:rs(e.code)})}emitData(e){for(const s of this.dataListeners)s(e)}clearTextarea(){this.textarea&&(this.textarea.textContent="")}syncTextareaPositionToCursor(){const e=this.textarea,s=this.screenElement;if(!e||!s)return;const{width:n,height:r}=this.cellDimensions();if(n<=0||r<=0)return;const i=tt(this.bindings);let o=0,l=0;try{st(i,this.terminalHandle);const b=He(i);b.cursor.x!==null&&b.cursor.y!==null&&(o=b.cursor.x,l=b.cursor.y)}finally{Ue(i)}const u=o*n,c=l*r;e.style.left=`${u}px`,e.style.top=`${c}px`,e.style.width=`${Math.max(1,n)}px`,e.style.height=`${Math.max(1,r)}px`,e.style.lineHeight=`${r}px`,e.style.fontFamily=this.options.fontFamily,e.style.fontSize=`${this.options.fontSize}px`}scheduleRender(){this.renderRaf===null&&(this.renderRaf=requestAnimationFrame(()=>{this.renderRaf=null,this.render()}))}render(){if(this.disposed||!this.screenElement||!this.renderer)return;const e=this.bindings.readScrollbar(this.terminalHandle),s=Math.max(1,e.len||this.rows);st(this.renderState,this.terminalHandle);const n=He(this.renderState),r=Array.from(Fs(this.renderState));this.cols=Math.max(2,n.cols),this.rows=Math.max(2,n.rows||s),this.lastViewportOffset=e.offset,this.lastViewportRows=this.rows,this.lastRenderedRows=r;for(const c of r)this.lineCache.set(e.offset+c.y,c.text);const i=Ks(this.selectionState,this.lastViewportOffset,this.lastViewportRows,c=>this.getLineText(c)),o=this.getSelectionText();this.renderer.render({meta:n,rows:r,cellDimensions:this.cellDimensions(),selectionRects:i,selectionColor:this.options.theme.selectionBackground});const l=Tn(r,this.rows),u=Math.max(0,e.total-e.len);this.buffer.setViewport(e.offset,u,e.total,l),this.updateSelectionTextProbe(o),this.updateScrollbar(e)}updateScrollbar(e){var u;const s=this.scrollbarThumb;if(!s)return;const n=((u=this.screenElement)==null?void 0:u.clientHeight)??0;if(n===0||e.total<=e.len){s.style.opacity="0";return}const r=e.len/e.total,i=Math.max(20,r*n),l=e.offset/Math.max(1,e.total-e.len)*(n-i);s.style.height=`${i}px`,s.style.transform=`translateY(${l}px)`,s.style.opacity="1",this.scrollbarFadeTimer&&clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=setTimeout(()=>{s.style.opacity="0"},800)}updateCellDimensions(){if(!this.element)return;const e=document.createElement("span");e.textContent="WWWWWWWWWW",e.style.position="absolute",e.style.visibility="hidden",e.style.whiteSpace="pre",e.style.fontFamily=this.options.fontFamily,e.style.fontSize=`${this.options.fontSize}px`,e.style.lineHeight="1.2",this.element.appendChild(e);const s=e.getBoundingClientRect();e.remove(),this._core._renderService.dimensions.css.cell.width=s.width>0?s.width/10:ot,this._core._renderService.dimensions.css.cell.height=s.height>0?s.height:Fe}clearSelectionState(e=!0){this.selectionState=Gs(),this.pointerDrag={active:!1,moved:!1,mode:"character",lastClientX:null,lastClientY:null},this.copyShortcutSuppressed=!1,this.stopAutoScroll(),this.updateSelectionTextProbe(null),e&&this.screenElement&&this.renderer&&this.render()}beginPointerSelection(e){const s=this.hitTest(e.clientX,e.clientY);if(!s)return;const n=this.selectionModeFromClickDetail(e.detail);this.pointerDrag={active:!0,moved:!1,mode:n,lastClientX:e.clientX,lastClientY:e.clientY},this.selectionState=Ys(this.selectionState,{...s,mode:n},r=>this.getLineText(r)),this.updateAutoScroll(),this.render()}updatePointerSelection(e){if(!this.pointerDrag.active)return;const s=this.hitTest(e.clientX,e.clientY);this.pointerDrag.lastClientX=e.clientX,this.pointerDrag.lastClientY=e.clientY,s&&(this.pointerDrag.moved=!0,this.selectionState=nt(this.selectionState,s,n=>this.getLineText(n)),this.render()),this.updateAutoScroll()}finishPointerSelection(e){var n,r,i,o;if(!this.pointerDrag.active||e.button!==0)return;this.pointerDrag.lastClientX=e.clientX,this.pointerDrag.lastClientY=e.clientY,this.stopAutoScroll();const s=this.pointerDrag.mode==="character"&&!this.pointerDrag.moved&&((n=this.selectionState.anchor)==null?void 0:n.line)===((r=this.selectionState.focus)==null?void 0:r.line)&&((i=this.selectionState.anchor)==null?void 0:i.col)===((o=this.selectionState.focus)==null?void 0:o.col);if(this.pointerDrag.active=!1,s){this.clearSelectionState();return}this.render()}selectionModeFromClickDetail(e){return e>=3?"line":e===2?"word":"character"}hitTest(e,s){var M;const n=(M=this.screenElement)==null?void 0:M.getBoundingClientRect();if(!n)return null;const{width:r,height:i}=this.cellDimensions();if(r<=0||i<=0)return null;const o=e-n.left,l=s-n.top,u=Math.max(this.cols-1,0),c=Math.max(this.lastViewportRows-1,0),b=Math.max(0,Math.min(u,Math.floor(o/r))),k=Math.max(0,Math.min(c,Math.floor(l/i)));return{line:this.lastViewportOffset+k,col:b}}getLineText(e){const s=this.lineCache.get(e);if(typeof s=="string")return s;const n=e-this.lastViewportOffset,r=this.lastRenderedRows[n];return(r==null?void 0:r.text)??""}getSelectionText(){return zs(this.selectionState)?js(this.selectionState,e=>this.getLineText(e)):null}updateSelectionTextProbe(e){globalThis.__tmexE2eTerminalSelectionText=e}updateAutoScroll(){var n;if(!this.pointerDrag.active||this.pointerDrag.lastClientY===null){this.stopAutoScroll();return}const e=(n=this.screenElement)==null?void 0:n.getBoundingClientRect();if(!e){this.stopAutoScroll();return}if(!(this.pointerDrag.lastClientY<e.top||this.pointerDrag.lastClientY>e.bottom)){this.stopAutoScroll();return}this.autoScrollTimer===null&&(this.autoScrollTimer=setInterval(()=>{this.stepAutoScroll()},xn))}stepAutoScroll(){var r;if(!this.pointerDrag.active||this.pointerDrag.lastClientX===null||this.pointerDrag.lastClientY===null){this.stopAutoScroll();return}const e=(r=this.screenElement)==null?void 0:r.getBoundingClientRect();if(!e){this.stopAutoScroll();return}let s=0;if(this.pointerDrag.lastClientY<e.top?s=-1:this.pointerDrag.lastClientY>e.bottom&&(s=1),s===0){this.stopAutoScroll();return}this.bindings.scrollViewportDelta(this.terminalHandle,s),this.render();const n=this.hitTest(this.pointerDrag.lastClientX,this.pointerDrag.lastClientY);n&&(this.selectionState=nt(this.selectionState,n,i=>this.getLineText(i)),this.pointerDrag.moved=!0,this.render())}stopAutoScroll(){this.autoScrollTimer!==null&&(clearInterval(this.autoScrollTimer),this.autoScrollTimer=null)}clearDomEventListeners(){for(;this.domEventDisposers.length>0;){const e=this.domEventDisposers.pop();e==null||e()}}}async function Rn(t){return Ne.create(t)}const wt={background:"#e1e1e1",foreground:"#616161",cursor:"#616161",selectionBackground:"rgba(97, 97, 97, 0.25)",black:"#171717",red:"#bf2172",green:"#009799",yellow:"#9a7200",blue:"#007299",magenta:"#9b1d72",cyan:"#007173",white:"#d9d9d9",brightBlack:"#4e4e4e",brightRed:"#e12672",brightGreen:"#00bddf",brightYellow:"#ffdd00",brightBlue:"#7299bc",brightMagenta:"#e17899",brightCyan:"#6fbcbd",brightWhite:"#f1f1f1"},yt={background:"#262626",foreground:"#d0d0d0",cursor:"#c5c5c5",selectionBackground:"rgba(197, 197, 197, 0.25)",black:"#000000",red:"#ba3c3c",green:"#5d876d",yellow:"#d5a54e",blue:"#887c8d",magenta:"#cd6d6d",cyan:"#618484",white:"#cfcdc3",brightBlack:"#000000",brightRed:"#ea7171",brightGreen:"#7aab7a",brightYellow:"#d1d194",brightBlue:"#afa3b5",brightMagenta:"#e29f9f",brightCyan:"#a0aea3",brightWhite:"#d0d0d0"},En='"JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Noto Sans Mono CJK SC", "Source Han Mono SC", "Sarasa Mono SC", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", monospace';function Dn(t){if(!t)return t;const e=t.replace(/\r\n/g,`
|
|
23
|
+
`);return(e.endsWith(`
|
|
24
|
+
`)?e.slice(0,-1):e).replace(/\n/g,`\r
|
|
25
|
+
`)}function lt(t,e){let s=e,n=0;for(const l of t)l===10&&!s&&(n+=1),s=l===13;const r=s;if(n===0)return{normalized:t,endedWithCR:r};const i=new Uint8Array(t.length+n);let o=0;s=e;for(const l of t)l===10&&!s&&(i[o]=13,o+=1),i[o]=l,o+=1,s=l===13;return{normalized:i,endedWithCR:r}}const Nn=1.3,kn=36;function Ln(t,e){const s=d.useRef(!1);return d.useEffect(()=>{const n=t.current;if(!n||!(window.innerWidth<768||navigator.maxTouchPoints>0||"ontouchstart"in window))return;s.current=!0;let i=0,o=null,l=!1,u=0;const c=T=>T?!!(T.closest(".scrollbar")||T.closest(".slider")||T.closest(".xterm-scroll-area")):!1,b=(T,h,N)=>{const E=N instanceof Element?N:null;if(c(E))return!0;const H=document.elementFromPoint(T,h);if(c(H))return!0;const L=n.querySelector(".xterm");if(!(L instanceof HTMLElement))return!1;const I=L.getBoundingClientRect(),j=T>=I.left&&T<=I.right,$=h>=I.top&&h<=I.bottom;return!j||!$?!1:T>=I.right-kn},k=()=>[n.querySelector(".xterm-viewport"),n.querySelector(".xterm-scrollable-element")].filter(h=>h instanceof HTMLElement),M=T=>{if(o===null)return null;for(let h=0;h<T.length;h+=1){const N=T.item(h);if(N&&N.identifier===o)return N}return null},F=T=>{if(T.touches.length!==1)return;const h=T.touches.item(0);h&&(o=h.identifier,i=h.clientY,u=0,l=b(h.clientX,h.clientY,T.target))},R=T=>{var j,$,J,x,A,U,B,p;const h=M(T.touches)??T.touches.item(0);if(!h||(l||(l=b(h.clientX,h.clientY,T.target),l&&(u=0)),l))return;const N=h.clientY,E=i-N;if(i=N,E===0)return;let H=!1,L=!1;const I=(e==null?void 0:e())??null;if(I){const g=I==null?void 0:I._core,v=((x=(J=($=(j=g==null?void 0:g._renderService)==null?void 0:j.dimensions)==null?void 0:$.css)==null?void 0:J.cell)==null?void 0:x.height)??18;u+=E*Nn;const _=u>0?Math.floor(u/v):Math.ceil(u/v);if(_!==0){const O=((U=(A=I.buffer)==null?void 0:A.active)==null?void 0:U.viewportY)??0;I.scrollLines(_);const G=((p=(B=I.buffer)==null?void 0:B.active)==null?void 0:p.viewportY)??0;H=O!==G,L=_<0&&O<=0&&G<=0,u-=_*v}}else{const g=k();if(g.length===0)return;for(const v of g){const _=v.scrollTop;v.scrollTop+=E;const O=v.scrollTop;Math.abs(O-_)>0&&(H=!0),E<0&&O<=0&&(L=!0)}if(!H){const v=n.querySelector(".xterm");if(v instanceof HTMLElement){const _=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,deltaMode:WheelEvent.DOM_DELTA_PIXEL,deltaY:E}),O=v.dispatchEvent(_);H=_.defaultPrevented||!O}}}T.cancelable&&(H||L)&&T.preventDefault()},S=T=>{o===null||!M(T.changedTouches)||(o=null,u=0,l=!1)};return n.addEventListener("touchstart",F,{passive:!0}),n.addEventListener("touchmove",R,{passive:!1}),n.addEventListener("touchend",S,{passive:!0}),n.addEventListener("touchcancel",S,{passive:!0}),()=>{s.current=!1,n.removeEventListener("touchstart",F),n.removeEventListener("touchmove",R),n.removeEventListener("touchend",S),n.removeEventListener("touchcancel",S)}},[t,e]),s}function Pn({now:t,remoteSize:e,pendingLocalSize:s,ttlMs:n=2e3}){return!s||t-s.at>n?!0:s.cols===e.cols&&s.rows===e.rows}function An({currentSize:t,containerSize:e,force:s=!1}){return s?!0:t.cols!==e.cols||t.rows!==e.rows}function Mn({deviceId:t,paneId:e,deviceConnected:s,isSelectionInvalid:n,onResize:r,onSync:i,getContainerRect:o}){const l=d.useRef(null),u=d.useRef(null),c=d.useRef(null),b=d.useRef(null),k=d.useRef(0),M=d.useRef([]),F=d.useRef(null),R=d.useRef(null),S=d.useRef(o),T=d.useRef(r),h=d.useRef(i);d.useEffect(()=>{T.current=r},[r]),d.useEffect(()=>{h.current=i},[i]),d.useEffect(()=>{S.current=o},[o]);const N=d.useCallback(()=>{var _,O,G,ue,re,ce,Q,le,q,Z;const x=R.current,A=F.current;if(!x||!A||!x.element)return null;let U;try{const D=A.proposeDimensions();if(!D)throw new Error("fitAddon.proposeDimensions() returned null");U=Math.max(2,D.cols)}catch{const D=x._core,he=((ue=(G=(O=(_=D==null?void 0:D._renderService)==null?void 0:_.dimensions)==null?void 0:O.css)==null?void 0:G.cell)==null?void 0:ue.width)??9,X=(re=S.current)==null?void 0:re.call(S);if(!X||X.width===0)return null;U=Math.max(2,Math.floor(X.width/he))}const B=(ce=S.current)==null?void 0:ce.call(S);if(!B||B.height===0)return null;const p=x._core,g=((Z=(q=(le=(Q=p==null?void 0:p._renderService)==null?void 0:Q.dimensions)==null?void 0:le.css)==null?void 0:q.cell)==null?void 0:Z.height)??17,v=Math.max(2,Math.floor(B.height/g));return{cols:U,rows:v}},[]),E=d.useCallback((x,A)=>{const U=R.current;U&&(U.cols===x&&U.rows===A||U.resize(x,A))},[]),H=d.useCallback((x,A=!1)=>{if(!t||!e||!s||n&&x!=="sync"||!A&&Date.now()<k.current||!R.current)return!1;const B=N();if(!B)return!1;const{cols:p,rows:g}=B,v=c.current;return!A&&v&&v.cols===p&&v.rows===g?(E(p,g),!0):(E(p,g),x==="sync"?h.current(p,g):T.current(p,g),c.current={cols:p,rows:g},b.current={cols:p,rows:g,at:Date.now()},!0)},[E,s,t,n,N,e]),L=d.useCallback((x="resize",A={})=>{const{immediate:U=!1,force:B=!1}=A;u.current!==null&&(window.clearTimeout(u.current),u.current=null),l.current!==null&&(cancelAnimationFrame(l.current),l.current=null);const p=()=>{l.current=requestAnimationFrame(()=>{l.current=null,H(x,B)})};if(U){p();return}u.current=window.setTimeout(()=>{u.current=null,p()},150)},[H]),I=d.useCallback(()=>{for(const x of M.current)window.clearTimeout(x);M.current=[]},[]),j=d.useCallback(()=>{var A;I(),L("sync",{immediate:!0,force:!0});const x=window.setTimeout(()=>{L("sync",{immediate:!0,force:!0})},60);M.current.push(x),typeof document<"u"&&"fonts"in document&&((A=document.fonts)!=null&&A.ready)&&document.fonts.ready.then(()=>{L("sync",{immediate:!0,force:!0})}).catch(()=>{})},[I,L]);d.useEffect(()=>{let x=null;const A=()=>{x!==null&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{x=null,L("resize")})};return window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A),x!==null&&cancelAnimationFrame(x)}},[L]),d.useEffect(()=>{const x=()=>{const B=R.current,p=N();!B||!p||!An({currentSize:{cols:Math.max(2,B.cols),rows:Math.max(2,B.rows)},containerSize:p,force:!0})||L("sync",{force:!0})},A=()=>{document.visibilityState==="visible"&&x()},U=()=>{x()};return document.addEventListener("visibilitychange",A),window.addEventListener("focus",U),()=>{document.removeEventListener("visibilitychange",A),window.removeEventListener("focus",U)}},[N,L]),d.useEffect(()=>()=>{I(),u.current!==null&&window.clearTimeout(u.current),l.current!==null&&cancelAnimationFrame(l.current)},[I]);const $=d.useCallback(x=>{F.current=x},[]),J=d.useCallback(x=>{R.current=x},[]);return{scheduleResize:L,runPostSelectResize:j,clearPostSelectResizeTimers:I,setFitAddon:$,setTerminal:J,lastReportedSize:c,pendingLocalSize:b,suppressLocalResizeUntil:k}}const In={fontFamily:En,fontSize:13,scrollback:1e4};function On(t){var s;const e=globalThis;e.__tmexE2eXterm=t,e.__tmexE2eTerminal=t,e.__tmexE2eTerminalEngine=gt,e.__tmexE2eTerminalRenderer=((s=t.getRendererKind)==null?void 0:s.call(t))??null}function Un(t){if(!t)return;const e=globalThis;e.__tmexE2eTerminal!==t&&e.__tmexE2eXterm!==t||(e.__tmexE2eXterm=null,e.__tmexE2eTerminal=null,e.__tmexE2eTerminalEngine=null,e.__tmexE2eTerminalRenderer=null,e.__tmexE2eTerminalSelectionText=null)}const bt=d.forwardRef(({deviceId:t,paneId:e,theme:s,inputMode:n,deviceConnected:r,isSelectionInvalid:i,onResize:o,onSync:l},u)=>{const[c,b]=d.useState(null),k=W(p=>p.sendInput),M=d.useMemo(()=>{switch(s){case"light":return wt;default:return yt}},[s]),F=d.useRef(null),R=d.useRef(null),S=d.useRef(null),T=d.useRef(t),h=d.useRef(e),N=d.useRef(r&&!i),E=d.useRef(!1),H=d.useRef(!1),L=d.useRef(null),I=d.useCallback(()=>c,[c]);Ln(F,I),d.useEffect(()=>{T.current=t,h.current=e,H.current=!1},[t,e]),d.useEffect(()=>{N.current=r&&!i},[r,i]);const j=d.useCallback(p=>{if(!p||n!=="direct"||!N.current)return;const g=T.current,v=h.current;!g||!v||k(g,v,p,!1)},[n,k]),{pendingLocalSize:$,scheduleResize:J,runPostSelectResize:x,setFitAddon:A,setTerminal:U}=Mn({deviceId:t,paneId:e,deviceConnected:r,isSelectionInvalid:i,onResize:o,onSync:l,getContainerRect:()=>{const p=F.current;if(!p)return null;const g=p.getBoundingClientRect();return{width:g.width,height:g.height}}});d.useEffect(()=>{let p=!1,g=null;return Rn({...In,theme:M,disableStdin:n==="editor"}).then(v=>{if(p){v.dispose();return}g=v,R.current&&v.open(R.current),On(v),b(v)}),()=>{p=!0,b(null),Un(g),g==null||g.dispose()}},[]),d.useEffect(()=>{!c||!("setTheme"in c)||c.setTheme(M)},[c,M]),d.useEffect(()=>{!c||!("setDisableStdin"in c)||c.setDisableStdin(n==="editor")},[c,n]);const B=d.useMemo(()=>c?{onResetTerminal:p=>{T.current===p&&(c.reset(),E.current=!1,x())},onApplyHistory:(p,g)=>{T.current===p&&(H.current=!0,c.write(Dn(g)))},onFlushBuffer:(p,g)=>{if(T.current===p){for(const v of g){const _=lt(v,E.current);E.current=_.endedWithCR,c.write(_.normalized)}H.current&&(c.buffer.active.baseY<=1&&c.scrollToTop(),H.current=!1)}},onOutput:(p,g,v)=>{if(T.current!==p||h.current!==g||!N.current)return;const _=lt(v,E.current);E.current=_.endedWithCR,c.write(_.normalized),H.current&&(c.buffer.active.baseY<=1&&c.scrollToTop(),H.current=!1)}}:{},[c,x]);return d.useEffect(()=>{c?L.current!==c&&(E.current=!1,c.reset(),L.current=c):L.current=null},[c]),d.useEffect(()=>{Je(B)},[B]),d.useEffect(()=>()=>{Je({})},[]),d.useEffect(()=>{if(!c){S.current=null,A(null),U(null);return}const p=new Cn;return c.loadAddon(p),S.current=p,A(p),U(c),x(),()=>{try{p.dispose()}finally{S.current=null,A(null),U(null)}}},[c,x,A,U]),d.useEffect(()=>{const p=F.current;if(!p)return;let g=null;const v=new ResizeObserver(()=>{g!==null&&cancelAnimationFrame(g),g=requestAnimationFrame(()=>{g=null,J("resize")})});return v.observe(p),()=>{v.disconnect(),g!==null&&cancelAnimationFrame(g)}},[J]),d.useEffect(()=>{if(!c||!t||!e)return;const p=c.onData(g=>{!r||i||j(g)});return c.attachCustomKeyEventHandler(g=>!r||i||g.type!=="keydown"||n!=="direct"?!0:g.shiftKey&&g.key==="Enter"?(g.preventDefault(),j("\x1B[13;2u"),!1):!0),()=>{p.dispose(),c.attachCustomKeyEventHandler(()=>!0)}},[c,r,i,n,j,t,e]),d.useImperativeHandle(u,()=>({write:p=>c==null?void 0:c.write(p),reset:()=>{c==null||c.reset(),E.current=!1},scrollToBottom:()=>c==null?void 0:c.scrollToBottom(),resize:(p,g)=>c==null?void 0:c.resize(p,g),getTerminal:()=>c??null,getSize:()=>c?{cols:Math.max(2,c.cols),rows:Math.max(2,c.rows)}:null,runPostSelectResize:()=>x(),scheduleResize:(p,g)=>J(p,g),calculateSizeFromContainer:()=>{var ce,Q,le,q,Z,D,he,X,ie,ee,te,pe,ke,Le,Pe,ge;const p=F.current,g=c,v=S.current;if(!p||!g)return null;const _=p.getBoundingClientRect();if(_.width===0||_.height===0)return null;const O=g._core;let G;if(v)try{const z=v.proposeDimensions();if(z)G=Math.max(2,z.cols);else{const Ce=((q=(le=(Q=(ce=O==null?void 0:O._renderService)==null?void 0:ce.dimensions)==null?void 0:Q.css)==null?void 0:le.cell)==null?void 0:q.width)??9;G=Math.max(2,Math.floor(_.width/Ce))}}catch{const z=((X=(he=(D=(Z=O==null?void 0:O._renderService)==null?void 0:Z.dimensions)==null?void 0:D.css)==null?void 0:he.cell)==null?void 0:X.width)??9;G=Math.max(2,Math.floor(_.width/z))}else{const z=((pe=(te=(ee=(ie=O==null?void 0:O._renderService)==null?void 0:ie.dimensions)==null?void 0:ee.css)==null?void 0:te.cell)==null?void 0:pe.width)??9;G=Math.max(2,Math.floor(_.width/z))}const ue=((ge=(Pe=(Le=(ke=O==null?void 0:O._renderService)==null?void 0:ke.dimensions)==null?void 0:Le.css)==null?void 0:Pe.cell)==null?void 0:ge.height)??17,re=Math.max(2,Math.floor(_.height/ue));return{cols:G,rows:re}},getPendingLocalSize:()=>$.current}),[c,$,x,J]),f.jsxDEV("div",{ref:F,className:"h-full w-full relative",style:{backgroundColor:M.background},"data-terminal-engine":gt,children:f.jsxDEV("div",{ref:R,className:"absolute inset-0"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/components/terminal/Terminal.tsx",lineNumber:393,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/components/terminal/Terminal.tsx",lineNumber:387,columnNumber:7},void 0)});bt.displayName="Terminal";const Vn=1200,Fn=2e3;function ae(t,e){return!t||!e?!1:t.windowId===e.windowId&&t.paneId===e.paneId}function xt(t,e){const s=t.filter(n=>e-n.at<Vn);return s.length===0?null:s.reduce((n,r)=>r.at>n.at?r:n)}function Te(t,e=Date.now()){return!t||e-t.at>Fn?null:t}function Bn(t){const e=t.now??Date.now(),s=xt(t.recentSelectRequests,e);if(s&&!ae(s,t.activePaneFromEvent)||ae(t.currentRoute,t.activePaneFromEvent)||ae(t.lastHandledActive,t.activePaneFromEvent))return!0;const n=Te(t.pendingUserSelection,e);return!!(n&&!ae(n,t.activePaneFromEvent))}function Hn(t){const e=t.now??Date.now(),s=xt(t.recentSelectRequests,e),n=Te(t.pendingUserSelection,e);return!!(n&&!ae(n,t.snapshotActive)||s&&!ae(s,t.snapshotActive))}function zn(t){const e=t.now??Date.now(),s=Te(t.pendingUserSelection,e);return!(s&&ae(s,t.routeTarget)||t.snapshotActive&&ae(t.snapshotActive,t.routeTarget))}function Gn(){const t=ze.getState().settings;return(t==null?void 0:t.siteName)||"tmex"}function at(t){const e=t==null?void 0:t.trim();return e&&e.length>0?e:"?"}function St({paneIdx:t,windowIdx:e,paneTitle:s,windowName:n,deviceName:r}){const i=e??"?",o=t??"?",l=at(s??n),u=at(r);return`${i}/${o}: ${l}@${u}`}function Yn(t){const e=Gn();return t!=null&&t.trim()?`[${e}]${t}`:e}function jn(){if(typeof navigator>"u")return!1;const t=navigator.userAgent,e=/iPad|iPhone|iPod/.test(t),s=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return e||s}const Kn=[{key:"enter",label:"ENTER",payload:"\r"},{key:"ctrl-c",label:"CTRL-C",payload:""},{key:"ctrl-d",label:"CTRL-D",payload:""},{key:"up",label:"↑",payload:"\x1B[A"},{key:"down",label:"↓",payload:"\x1B[B"},{key:"left",label:"←",payload:"\x1B[D"},{key:"right",label:"→",payload:"\x1B[C"},{key:"shift-enter",label:"SHIFT+ENTER",payload:"\x1B[13;2u"},{key:"tab",label:"TAB",payload:" "},{key:"backspace",label:"BACKSPACE",payload:"\b"},{key:"esc",label:"ESC",payload:"\x1B"},{key:"delete",label:"DELETE",payload:""},{key:":",label:":",payload:":"},{key:"/",label:"/",payload:"/"},{key:"'",label:"'",payload:"'"},{key:'"',label:'"',payload:'"'},{key:"`",label:"`",payload:"`"}],ct=d.memo(function({onSend:e,onFocusEditor:s,disabled:n,isMobile:r,inputMode:i}){return f.jsxDEV("div",{className:"terminal-shortcuts-strip my-2 bg-muted rounded-xl","data-testid":"terminal-shortcuts-strip",children:f.jsxDEV("div",{className:"shortcut-row flex items-center gap-1.5 p-2 overflow-x-auto scrollbar-thin","data-testid":"editor-shortcuts-row",children:Kn.map(o=>f.jsxDEV(de,{variant:"secondary",size:"sm",className:"h-7 min-w-9 px-2.5 rounded-full text-[11px] font-medium tracking-wide shrink-0 [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:min-w-10 [@media(any-pointer:coarse)]:px-3",title:o.label,"aria-label":o.label,"data-testid":`editor-shortcut-${o.key}`,onPointerDown:l=>l.preventDefault(),onClick:()=>{e(o.payload),r&&i==="editor"&&(s==null||s())},disabled:n,children:o.label},o.key,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:107,columnNumber:11},this))},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:102,columnNumber:7},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:98,columnNumber:5},this)});function Jn(){var Xe;const{t}=dt(),{deviceId:e,windowId:s,paneId:n}=Ge(),r=At(),i=d.useRef(null),o=d.useRef(null),l=d.useRef(null),u=d.useRef(null),c=d.useRef(!1),b=d.useRef(!1),k=d.useRef(null),M=W(a=>a.selectPane),F=W(a=>e?a.snapshots[e]:void 0),R=W(a=>{var m;return e?(m=a.deviceErrors)==null?void 0:m[e]:void 0}),S=W(a=>{var m;return e?((m=a.deviceConnected)==null?void 0:m[e])??!1:!1}),T=ze(a=>{var m;return((m=a.settings)==null?void 0:m.siteName)??"tmex"}),h=d.useMemo(()=>Ye(n),[n]),N=d.useMemo(()=>e&&h?`${e}:${h}`:null,[e,h]),[E,H]=d.useState(!1),[L,I]=d.useState(""),[j,$]=d.useState(!1),J=d.useRef(!1),x=!S||!h,[A,U]=d.useState(0),[B,p]=d.useState(0),[g,v]=d.useState(!1),_=ne(a=>a.inputMode),O=ne(a=>a.theme),G=ne(a=>a.editorSendWithEnter),ue=ne(a=>a.setEditorSendWithEnter),re=ne(a=>a.addEditorHistory),ce=ne(a=>a.setEditorDraft),Q=ne(a=>a.removeEditorDraft),le=ne(a=>N?a.editorDrafts[N]??"":""),q=d.useMemo(()=>jn(),[]),Z=E&&_==="editor"&&q&&j,D=(Xe=F==null?void 0:F.session)==null?void 0:Xe.windows,he=O==="light"?wt:yt,{data:X}=Mt({queryKey:["devices"],queryFn:async()=>{const a=await fetch("/api/devices");if(!a.ok)throw new Error("Failed to fetch devices");return a.json()},throwOnError:!1}),ie=d.useMemo(()=>{if(e)return X==null?void 0:X.devices.find(a=>a.id===e)},[e,X==null?void 0:X.devices]),ee=d.useMemo(()=>{if(!(!s||!D))return D.find(a=>a.id===s)},[s,D]),te=d.useMemo(()=>{if(!(!h||!ee))return ee.panes.find(a=>a.id===h)},[h,ee]),pe=!!D,ge=!!(pe&&!!s&&!ee||pe&&!!s&&!!h&&!!ee&&!te?t("wsError.checkGateway"):null),z=!!(S&&h&&!ge),Ce=d.useMemo(()=>{if(!ee||!te)return null;const a=(ie==null?void 0:ie.name)??e;return St({paneIdx:te.index,windowIdx:ee.index,paneTitle:te.title,windowName:ee.name,deviceName:a})},[ie==null?void 0:ie.name,e,te,ee]),$e=d.useMemo(()=>{if(!D||D.length===0)return null;const a=D.find(w=>w.active),m=a==null?void 0:a.panes.find(w=>w.active);return!a||!m?null:{windowId:a.id,paneId:m.id}},[D]),_t=d.useCallback((a,m)=>{!e||!h||W.getState().resizePane(e,h,a,m)},[e,h]),vt=d.useCallback((a,m)=>{!e||!h||W.getState().syncPaneSize(e,h,a,m)},[e,h]),fe=d.useCallback((a,m)=>{const w=u.current,C=(w==null?void 0:w.calculateSizeFromContainer())??(w==null?void 0:w.getSize())??void 0;if(C)return C;if(!a||!m||!D)return;const Y=D.find(se=>se.id===a),V=Y==null?void 0:Y.panes.find(se=>se.id===m);if(!(!V||V.width<=1||V.height<=1))return{cols:V.width,rows:V.height}},[D]);d.useEffect(()=>{const a=()=>{H(window.innerWidth<768||"ontouchstart"in window)};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),d.useEffect(()=>{if(!E||!q||b.current)return;b.current=!0;const a=()=>{window.scrollTo(0,1)},m=window.requestAnimationFrame(a),w=window.setTimeout(a,120),C=window.setTimeout(a,420);return()=>{window.cancelAnimationFrame(m),window.clearTimeout(w),window.clearTimeout(C)}},[q,E]),d.useEffect(()=>{_!=="editor"&&$(!1)},[_]),d.useEffect(()=>{var C,Y;if(!(E&&q&&_==="editor"&&j)){U(0);return}let a=null;const m=()=>{const V=window.visualViewport,se=(V==null?void 0:V.height)??window.innerHeight,xe=(V==null?void 0:V.offsetTop)??0,kt=Math.max(0,Math.round(window.innerHeight-se-xe));U(kt)},w=()=>{a===null&&(a=window.requestAnimationFrame(()=>{a=null,m()}))};return m(),(C=window.visualViewport)==null||C.addEventListener("resize",w),(Y=window.visualViewport)==null||Y.addEventListener("scroll",w),window.addEventListener("resize",w),()=>{var V,se;(V=window.visualViewport)==null||V.removeEventListener("resize",w),(se=window.visualViewport)==null||se.removeEventListener("scroll",w),window.removeEventListener("resize",w),a!==null&&window.cancelAnimationFrame(a)}},[_,j,q,E]),d.useEffect(()=>{if(!Z){p(0);return}const a=o.current;if(!a)return;const m=()=>{p(Math.ceil(a.getBoundingClientRect().height))};m();const w=new ResizeObserver(m);return w.observe(a),()=>w.disconnect()},[Z]),d.useEffect(()=>{e&&(c.current=!1,Ae.current=null,be.current=null,k.current=null,we.current=[])},[e]),d.useEffect(()=>{S||(c.current=!1)},[S]),d.useEffect(()=>{if(!e||!S||!s||!D)return;if(D.length===0){r("/devices",{replace:!0});return}const a=D.find(w=>w.id===s);if(!a)return;if(!h){const w=a.panes.find(C=>C.active)??a.panes[0];w&&r(`/devices/${e}/windows/${s}/panes/${Se(w.id)}`,{replace:!0});return}if(!a.panes.find(w=>w.id===h)){const w=a.panes.find(C=>C.active)??a.panes[0];w&&r(`/devices/${e}/windows/${s}/panes/${Se(w.id)}`,{replace:!0});return}},[e,S,D,s,h,r]),d.useEffect(()=>{if(!e||!S||!D||D.length===0||s&&h||c.current)return;const a=D.find(w=>w.active)??D[0],m=a.panes.find(w=>w.active)??a.panes[0];m&&(c.current=!0,r(`/devices/${e}/windows/${a.id}/panes/${Se(m.id)}`,{replace:!0}))},[S,e,r,h,s,D]),d.useEffect(()=>{if(!e||!s||!h||x||!S)return;const a=W.getState().selectedPanes[e];if(a&&a.windowId===s&&a.paneId===h)return;const m=fe(s,h);ye(s,h),M(e,s,h,m)},[S,e,fe,x,h,M,s]),d.useEffect(()=>{if(!e||!S||!s||!h)return;const a={windowId:s,paneId:h};zn({routeTarget:a,snapshotActive:$e,pendingUserSelection:k.current})&&(k.current={windowId:a.windowId,paneId:a.paneId,at:Date.now()})},[S,e,h,$e,s]);const we=d.useRef([]),ye=d.useCallback((a,m)=>{const w=Date.now(),C=[...we.current.filter(Y=>w-Y.at<2e3),{windowId:a,paneId:m,at:w}];we.current=C.slice(-8)},[]),K=W(a=>e?a.activePaneFromEvent[e]:void 0),Ae=d.useRef(null);d.useEffect(()=>{if(!e||!S||!s||!h||!K)return;const a=Date.now(),m=Te(k.current,a);if(k.current=m,Bn({now:a,pendingUserSelection:m,activePaneFromEvent:K,currentRoute:{windowId:s,paneId:h},recentSelectRequests:we.current,lastHandledActive:Ae.current}))return;Ae.current={...K},m&&m.windowId===K.windowId&&m.paneId===K.paneId&&(k.current=null);const w=fe(K.windowId,K.paneId);ye(K.windowId,K.paneId),M(e,K.windowId,K.paneId,w),r(`/devices/${e}/windows/${K.windowId}/panes/${Se(K.paneId)}`,{replace:!0})},[e,S,s,h,K,ye,fe,M,r]);const be=d.useRef(null);d.useEffect(()=>{if(!e||!S||!D||D.length===0)return;const a=we.current,m=D.find(xe=>xe.active);if(!m)return;const w=m.panes.find(xe=>xe.active);if(!w)return;const C={windowId:m.id,paneId:w.id},Y=Date.now(),V=Te(k.current,Y);if(k.current=V,Hn({now:Y,pendingUserSelection:V,snapshotActive:C,recentSelectRequests:a})||be.current&&be.current.windowId===C.windowId&&be.current.paneId===C.paneId||(be.current={...C},V&&V.windowId===C.windowId&&V.paneId===C.paneId&&(k.current=null),s===C.windowId&&h===C.paneId))return;const se=fe(C.windowId,C.paneId);ye(C.windowId,C.paneId),M(e,C.windowId,C.paneId,se),r(`/devices/${e}/windows/${C.windowId}/panes/${Se(C.paneId)}`,{replace:!0})},[e,S,D,s,h,ye,fe,M,r]),d.useEffect(()=>{if(!z||!te||x)return;const a=u.current,m=a==null?void 0:a.getTerminal();if(!m)return;const w=Math.max(2,Math.floor(te.width||0)),C=Math.max(2,Math.floor(te.height||0));if(!w||!C)return;const Y=Date.now(),V={cols:w,rows:C},se=(a==null?void 0:a.getPendingLocalSize())??null;Pn({now:Y,remoteSize:V,pendingLocalSize:se})&&(m.cols===w&&m.rows===C||m.resize(w,C))},[z,x,te]),d.useEffect(()=>{const a=window.requestAnimationFrame(()=>{var w;(w=u.current)==null||w.scrollToBottom()}),m=window.setTimeout(()=>{var w;(w=u.current)==null||w.scrollToBottom()},120);return()=>{window.cancelAnimationFrame(a),window.clearTimeout(m)}},[_]),d.useEffect(()=>{R!=null&&R.message&&Me.error(R.message)},[R==null?void 0:R.message]),d.useEffect(()=>(document.title=Yn(Ce),()=>{document.title=T}),[T,Ce]),d.useEffect(()=>{const a=()=>{var m;(m=u.current)==null||m.scrollToBottom()};return window.addEventListener("tmex:jump-to-latest",a),()=>{window.removeEventListener("tmex:jump-to-latest",a)}},[]),d.useEffect(()=>{const a=m=>{const{deviceId:w,windowId:C,paneId:Y}=m.detail;w===e&&(k.current={windowId:C,paneId:Y,at:Date.now()})};return window.addEventListener("tmex:user-initiated-selection",a),()=>{window.removeEventListener("tmex:user-initiated-selection",a)}},[e]),d.useEffect(()=>{I(le)},[le]);const qe=d.useCallback(a=>{if(!e||!h||!z)return;W.getState().sendInput(e,h,a,!1)},[z,e,h]),Tt=d.useCallback(()=>{if(!z){Me.error(t("wsError.checkGateway"));return}if(!e||!h||!L.trim())return;v(!0),window.setTimeout(()=>v(!1),150);const a=G?`${L}\r`:L;W.getState().sendInput(e,h,a,!1),re(L),N&&Q(N),I("")},[re,z,e,N,G,L,Q,h,t]),Ct=d.useCallback(()=>{if(!z){Me.error(t("wsError.checkGateway"));return}if(!e||!h||!L.trim())return;v(!0),window.setTimeout(()=>v(!1),150);const a=L.split(/\r?\n/),m=W.getState();for(const w of a)w.trim()&&m.sendInput(e,h,`${w}\r`,!1);re(L),N&&Q(N),I("")},[re,z,e,N,L,Q,h,t]),Rt=d.useCallback(a=>{if($(!0),!(E&&q))return;const m=a.currentTarget;window.requestAnimationFrame(()=>{m.scrollIntoView({block:"nearest",inline:"nearest"})}),window.setTimeout(()=>{window.scrollTo(0,1)},60)},[q,E]),Et=d.useCallback(()=>{$(!1)},[]),Dt=d.useCallback(()=>{var a;(a=l.current)==null||a.focus({preventScroll:!0})},[]);if(!e)return f.jsxDEV("div",{className:"flex h-full items-center justify-center p-4",children:f.jsxDEV("div",{className:"rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground",children:t("device.noDevices")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:917,columnNumber:9},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:916,columnNumber:7},this);const Nt=!S&&!R;return f.jsxDEV("div",{className:"flex h-full min-h-0 flex-col bg-background","data-testid":"device-page",children:[f.jsxDEV("div",{className:`flex-1 relative overflow-hidden min-h-0 min-w-0 ${E&&_==="editor"&&!Z?"pb-1":""}`,style:{paddingBottom:Z?`${B+60}px`:void 0},children:[f.jsxDEV("div",{className:"h-full px-3 py-1 min-h-0 min-w-0 w-full relative flex rounded-xl",style:{backgroundColor:he.background},children:S&&h?f.jsxDEV("div",{ref:i,className:"flex-1 h-full min-h-0 w-full",children:f.jsxDEV(bt,{ref:u,deviceId:e,paneId:h,theme:O,inputMode:_,deviceConnected:S,isSelectionInvalid:ge,onResize:_t,onSync:vt},`${e}:${h}`,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:942,columnNumber:15},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:941,columnNumber:13},this):f.jsxDEV("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-8 text-center",children:f.jsxDEV("div",{className:"max-w-sm space-y-4",children:S?s?f.jsxDEV(f.Fragment,{children:[f.jsxDEV("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:f.jsxDEV(Ie,{className:"h-6 w-6 text-muted-foreground animate-spin"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:979,columnNumber:23},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:978,columnNumber:21},this),f.jsxDEV("h3",{className:"text-lg font-medium",children:t("terminal.connecting")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:981,columnNumber:21},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:977,columnNumber:19},this):f.jsxDEV(f.Fragment,{children:[f.jsxDEV("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:f.jsxDEV("span",{className:"text-2xl text-muted-foreground",children:"📋"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:969,columnNumber:23},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:968,columnNumber:21},this),f.jsxDEV("h3",{className:"text-lg font-medium",children:t("window.noWindowSelected")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:971,columnNumber:21},this),f.jsxDEV("p",{className:"text-sm text-muted-foreground",children:t("window.selectWindowToStart")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:972,columnNumber:21},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:967,columnNumber:19},this):f.jsxDEV(f.Fragment,{children:[f.jsxDEV("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:f.jsxDEV("span",{className:"text-2xl text-muted-foreground",children:"🔌"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:961,columnNumber:23},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:960,columnNumber:21},this),f.jsxDEV("h3",{className:"text-lg font-medium",children:t("device.disconnected")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:963,columnNumber:21},this),f.jsxDEV("p",{className:"text-sm text-muted-foreground",children:t("device.connectToStart")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:964,columnNumber:21},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:959,columnNumber:19},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:957,columnNumber:15},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:956,columnNumber:13},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:936,columnNumber:9},this),Nt&&f.jsxDEV("div",{className:"absolute inset-0 flex items-center justify-center bg-background/85 backdrop-blur-sm","data-testid":"terminal-status-overlay",children:f.jsxDEV("div",{className:"flex flex-col items-center gap-2 rounded-lg border border-border bg-card/90 px-4 py-3 shadow-sm",children:[f.jsxDEV("div",{className:"h-7 w-7 rounded-full border-2 border-primary border-t-transparent animate-spin"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:995,columnNumber:15},this),f.jsxDEV("span",{className:"text-xs text-muted-foreground","data-testid":"terminal-status-text",children:t("terminal.connecting")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:996,columnNumber:15},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:994,columnNumber:13},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:990,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:928,columnNumber:7},this),_==="direct"&&f.jsxDEV("div",{className:"",children:f.jsxDEV(ct,{onSend:qe,disabled:!z,isMobile:E,inputMode:_},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1007,columnNumber:11},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1006,columnNumber:9},this),_==="editor"&&f.jsxDEV("div",{ref:o,className:`editor-mode-input bg-card/85 backdrop-blur-sm ${Z?"fixed left-0 right-0 z-50":""}`,style:Z?{bottom:`${A}px`}:void 0,children:[E&&f.jsxDEV(ct,{onSend:qe,onFocusEditor:Dt,disabled:!z,isMobile:E,inputMode:_},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1026,columnNumber:13},this),f.jsxDEV("textarea",{ref:l,"data-testid":"editor-input",className:"min-h-[88px] max-h-[28vh] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground shadow-xs outline-none transition-colors focus:border-ring",value:L,onChange:a=>{const m=a.target.value;if(I(m),!!N){if(m){ce(N,m);return}Q(N)}},placeholder:t("terminal.inputPlaceholder"),onFocus:Rt,onBlur:Et,onCompositionStart:()=>{J.current=!0},onCompositionEnd:()=>{J.current=!1}},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1034,columnNumber:11},this),f.jsxDEV("div",{className:"actions mt-2",children:f.jsxDEV("div",{className:"send-row flex flex-wrap items-center justify-end gap-2","data-testid":"editor-send-row",children:[f.jsxDEV("div",{className:"send-with-enter-toggle mr-auto flex items-center gap-2 text-xs text-muted-foreground","data-testid":"editor-send-with-enter-toggle",children:[f.jsxDEV(Yt,{size:"sm",checked:G,onCheckedChange:a=>ue(!!a)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1070,columnNumber:17},this),f.jsxDEV("span",{children:t("terminal.editorSendWithEnter")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1075,columnNumber:17},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1066,columnNumber:15},this),f.jsxDEV(de,{variant:"outline",size:"sm","data-testid":"editor-clear",onPointerDown:a=>a.preventDefault(),onClick:()=>{var a;I(""),N&&Q(N),E&&_==="editor"&&((a=l.current)==null||a.focus({preventScroll:!0}))},title:t("terminal.clear"),children:[f.jsxDEV(It,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1093,columnNumber:17},this),t("terminal.clear")]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1077,columnNumber:15},this),f.jsxDEV(de,{variant:"secondary",size:"sm","data-testid":"editor-send-line-by-line",onPointerDown:a=>a.preventDefault(),onClick:()=>{var a;Ct(),E&&_==="editor"&&((a=l.current)==null||a.focus({preventScroll:!0}))},disabled:!z||g,children:[g?f.jsxDEV(Ie,{className:"h-4 w-4 animate-spin"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1110,columnNumber:19},this):f.jsxDEV(Qe,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1112,columnNumber:19},this),t("terminal.editorSendLineByLine")]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1096,columnNumber:15},this),f.jsxDEV(de,{variant:"default",size:"sm","data-testid":"editor-send",onPointerDown:a=>a.preventDefault(),onClick:()=>{var a;Tt(),E&&_==="editor"&&((a=l.current)==null||a.focus({preventScroll:!0}))},disabled:!z||g,children:[g?f.jsxDEV(Ie,{className:"h-4 w-4 animate-spin"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1130,columnNumber:19},this):f.jsxDEV(Qe,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1132,columnNumber:19},this),t("common.send")]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1116,columnNumber:15},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1062,columnNumber:13},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1061,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1017,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:927,columnNumber:5},this)}function Qn(){const{deviceId:t,windowId:e,paneId:s}=Ge(),n=s?Ye(s):void 0,r=W(b=>b.snapshots),i=ze(b=>{var k;return((k=b.settings)==null?void 0:k.siteName)??"tmex"}),o=t?r[t]:void 0,l=d.useMemo(()=>{var b;if(!(!e||!((b=o==null?void 0:o.session)!=null&&b.windows)))return o.session.windows.find(k=>k.id===e)},[e,o]),u=d.useMemo(()=>{if(!(!n||!l))return l.panes.find(b=>b.id===n)},[n,l]),c=d.useMemo(()=>l&&u?St({paneIdx:u.index,windowIdx:l.index,paneTitle:u.title,windowName:l.name,deviceName:i}):t??"",[l,u,i,t]);return f.jsxDEV(f.Fragment,{children:c},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1175,columnNumber:10},this)}function Zn(){const{t}=dt(),{deviceId:e,paneId:s}=Ge(),n=s?Ye(s):void 0,r=ne(R=>R.inputMode),i=ne(R=>R.setInputMode),o=W(R=>{var S;return e?((S=R.deviceConnected)==null?void 0:S[e])??!1:!1}),[l,u]=d.useState(!1),c=!!(n&&o),b=()=>{i(r==="direct"?"editor":"direct")},k=()=>{window.dispatchEvent(new CustomEvent("tmex:jump-to-latest"))},M=()=>{u(!0)},F=()=>{window.location.reload()};return f.jsxDEV(f.Fragment,{children:[f.jsxDEV(de,{variant:"ghost",size:"icon-sm",onClick:M,"aria-label":t("nav.refreshPage"),title:t("nav.refreshPage"),children:f.jsxDEV(Xt,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1219,columnNumber:9},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1212,columnNumber:7},this),f.jsxDEV(de,{variant:"ghost",size:"icon-sm",onClick:b,disabled:!c,"data-testid":"terminal-input-mode-toggle","aria-label":t(r==="direct"?"nav.switchToEditor":"nav.switchToDirect"),title:t(r==="direct"?"nav.switchToEditor":"nav.switchToDirect"),children:r==="direct"?f.jsxDEV($t,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1231,columnNumber:11},this):f.jsxDEV(Qt,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1233,columnNumber:11},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1221,columnNumber:7},this),f.jsxDEV(de,{variant:"ghost",size:"icon-sm",onClick:k,disabled:!c,"aria-label":t("nav.jumpToLatest"),title:t("nav.jumpToLatest"),children:f.jsxDEV(Kt,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1244,columnNumber:9},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1236,columnNumber:7},this),f.jsxDEV(Ot,{open:l,onOpenChange:u,children:f.jsxDEV(Ut,{children:[f.jsxDEV(Vt,{children:[f.jsxDEV(Ft,{children:t("nav.refreshPage")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1250,columnNumber:13},this),f.jsxDEV(Bt,{children:t("nav.refreshPageConfirm")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1251,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1249,columnNumber:11},this),f.jsxDEV(Ht,{children:[f.jsxDEV(zt,{onClick:()=>u(!1),children:t("common.cancel")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1254,columnNumber:13},this),f.jsxDEV(Gt,{onClick:F,children:t("common.confirm")},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1257,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1253,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1248,columnNumber:9},this)},void 0,!1,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1247,columnNumber:7},this)]},void 0,!0,{fileName:"/Users/krhougs/LocalCodes/tmex/apps/fe/src/pages/DevicePage.tsx",lineNumber:1211,columnNumber:5},this)}export{Zn as PageActions,Qn as PageTitle,Jn as default};
|
|
26
|
+
//# sourceMappingURL=DevicePage-BE5Hlzny.js.map
|