(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[890],{25292:function(e,l,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/shell",function(){return n(30904)}])},40806:function(e,l,n){"use strict";n.d(l,{Z:function(){return x}});var s=n(85893),r=n(93452),t=n(76242),i=n(36969),c=n(25808),a=n(94495),u=n(57493),o=n(94655),d=n(3668),p=n(60),f=n(67294),m=n(98388);function x(e){let{url:l,wrapperProps:n,title:x,...h}=e,{loading:j,setLoading:g}=(0,c.Z)();return(0,s.jsx)(r.Z,{...n,className:(0,m.m6)("p-0",null==n?void 0:n.className),children:(0,s.jsxs)(p.Z,{className:"gap-0",children:[(0,s.jsxs)(o.Z,{className:"p-4 w-full justify-between",children:[(0,s.jsx)(o.Z,{children:x?(0,s.jsx)(f.Fragment,{children:(0,s.jsx)(d.Z,{size:"small",variant:"faded",children:x})}):null}),(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(a.Z,{title:"Open Full Screen",variant:"ghost",className:"p-1!",onClick:()=>{window.open(l,"__blank")},children:(0,s.jsx)(i.Z,{name:"ArrowUpRight",size:20})}),(0,s.jsx)(a.Z,{title:"Refresh Iframe",variant:"ghost",className:"p-1!",loading:j,onClick:()=>{g(!0),setTimeout(()=>{g(!1)},2e3)},loadingProps:{size:"smaller"},children:(0,s.jsx)(i.Z,{name:"RotateCcw",size:18})})]})]}),(0,s.jsx)("hr",{}),j?(0,s.jsx)(u.Z,{className:"w-full p-10 h-[400px]",children:(0,s.jsx)(t.Z,{})}):(0,s.jsx)("iframe",{...h,src:l,className:(0,m.m6)("w-full h-[400px]",h.className)})]})})}},30904:function(e,l,n){"use strict";n.r(l),n.d(l,{__N_SSP:function(){return g},default:function(){return v}});var s=n(85893),r=n(67294),t=n(5606),i=n(60705),c=n(33028),a=n(60),u=n(71077),o=n(76242),d=n(57493),p=n(40806),f=n(25808);function m(e){let{paradigm:l}=e,{pageProps:n,ws:i}=(0,r.useContext)(t.AppContext),{user:c}=n,m=c.super_admin?"root":c.username,x="pm2-logs"==l?"pm2 logs":c.super_admin?"bash":m?"su - ".concat(m,' -c "bash"'):void 0,{data:h}=(0,u.Z)(),[j,g]=(0,r.useState)(),{refresh:v,setRefresh:Z}=(0,f.Z)(),N=(0,r.useRef)(!1);function w(){(null==j?void 0:j.port)&&i.sendData({event:"client:kill-port",port:j.port})}return(0,r.useEffect)(()=>{if((null==i?void 0:i.socket)&&!N.current)return i.sendData({event:"pm2-logs"==l?"client:relay-pm2-logs":"client:relay-shell",cmd:x}),N.current=!0,function(){w()}},[i,v]),(0,r.useEffect)(()=>{N.current&&(w(),g(void 0),N.current=!1,Z(e=>e+1))},[]),(0,r.useEffect)(()=>{!j&&("shell"==l&&(null==h?void 0:h.event)=="server:relay-shell"&&(null==h?void 0:h.ttyd)||"pm2-logs"==l&&(null==h?void 0:h.event)=="server:relay-pm2-logs"&&(null==h?void 0:h.ttyd))&&setTimeout(()=>{g(h.ttyd?{...h.ttyd,href:"".concat(window.location.origin).concat(h.ttyd.url)}:void 0)},2e3)},[h]),(0,s.jsxs)(a.Z,{className:"gap-0 w-full",children:[(null==j?void 0:j.url)&&j.port?(0,s.jsx)(a.Z,{className:"gap-0",children:(0,s.jsx)(p.Z,{url:null==j?void 0:j.url,title:"pm2-logs"==l?"Admin Logs":"Relay Shell",wrapperProps:{className:"border-none"}})}):(0,s.jsx)(d.Z,{className:"p-10 h-[460px]",children:(0,s.jsx)(o.Z,{})}),(0,s.jsx)("hr",{})]})}function x(){let{pageProps:e}=(0,r.useContext)(t.AppContext),{user:l}=e;return(0,s.jsxs)(a.Z,{className:"w-full nested-grid-frame xl:grid-cols-2",children:[(0,s.jsx)(a.Z,{className:"grid-cell w-full",children:(0,s.jsx)(m,{paradigm:"shell"})}),l.super_admin?(0,s.jsx)(a.Z,{className:"grid-cell w-full",children:(0,s.jsx)(m,{paradigm:"pm2-logs"})}):null]})}function h(){let{pageProps:e}=(0,r.useContext)(t.AppContext);return(0,s.jsxs)(r.Fragment,{children:[(0,s.jsx)(c.Z,{title:"Shell",description:(0,s.jsx)(s.Fragment,{children:"Access the relay server shell"})}),(0,s.jsx)(i.Z,{}),(0,s.jsx)(x,{})]})}var j=n(89350),g=!0;function v(){return(0,s.jsx)(j.Z,{children:(0,s.jsx)(h,{})})}},93452:function(e,l,n){"use strict";n.d(l,{Z:function(){return t}});var s=n(85893),r=n(98388);function t(e){let{spacing:l,componentRef:n,...t}=e;return(0,s.jsx)("div",{...t,className:(0,r.m6)("relative flex items-center gap-2 border border-solid rounded-default","border-slate-200 dark:border-white/10",l?"normal"==l?"px-3 py-2":"tight"==l?"px-2 py-1":"":"px-3 py-2","twui-border",t.className),ref:n,children:t.children})}},57493:function(e,l,n){"use strict";n.d(l,{Z:function(){return t}});var s=n(85893),r=n(98388);function t(e){let{...l}=e;return(0,s.jsx)("div",{...l,className:(0,r.m6)("flex flex-col items-center justify-center gap-4 p-2 w-full","h-full twui-center",l.className),children:l.children})}},9008:function(e,l,n){e.exports=n(23867)}},function(e){e.O(0,[662,75,664,433,7,910,888,774,179],function(){return e(e.s=25292)}),_N_E=e.O()}]);