9remote 3.0.12 → 3.0.22
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/README.md +12 -10
- package/dist/cli.cjs +101 -98
- package/dist/server.cjs +200 -200
- package/dist/ui/assets/index-MGNIw0uJ.js +8 -0
- package/dist/ui/assets/index-SHlsPzjb.css +1 -0
- package/dist/ui/index.html +2 -2
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +2 -2
- package/dist/web/__next._full.txt +3 -3
- package/dist/web/__next._head.txt +1 -1
- package/dist/web/__next._index.txt +2 -2
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/3346-23aafd4add63869a.js +1 -0
- package/dist/web/_next/static/chunks/4023-66934a18c86e64c8.js +1 -0
- package/dist/web/_next/static/chunks/4958-179397687a9efabd.js +86 -0
- package/dist/web/_next/static/chunks/8387-1f4afaae933bccf8.js +1 -0
- package/dist/web/_next/static/chunks/8669-9e059733295a6fc1.js +1 -0
- package/dist/web/_next/static/chunks/9958-5fc614927f62bfc7.js +1 -0
- package/dist/web/_next/static/chunks/app/admin/admins/{page-55a5b7d9e2cce009.js → page-cbe0a81654621c59.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/login/{page-0ee5816b25a58124.js → page-385a65c442c5f9eb.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/modes/{page-4a42062c1aa3bdfe.js → page-3c1c39a594e21bf9.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/ota/{page-f933a80b41b1fa71.js → page-71f6fb68d1dc9334.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/{page-9af75732b2cda9b6.js → page-680a917a0c0b046c.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/turn/{page-fbb8e50d077e6051.js → page-271235635424b233.js} +1 -1
- package/dist/web/_next/static/chunks/app/dev/question/page-f2ee24ff4054692f.js +1 -0
- package/dist/web/_next/static/chunks/app/login/page-443799292c8698e7.js +1 -0
- package/dist/web/_next/static/chunks/app/page-0baf88f7e34590ca.js +22 -0
- package/dist/web/_next/static/chunks/app/workspace/layout-cae18c509e47f3b2.js +14 -0
- package/dist/web/_next/static/chunks/webpack-34aa84f85d3087cb.js +1 -0
- package/dist/web/_next/static/css/7bac24727badd523.css +1 -0
- package/dist/web/_not-found/__next._full.txt +2 -2
- package/dist/web/_not-found/__next._head.txt +1 -1
- package/dist/web/_not-found/__next._index.txt +2 -2
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/web/_not-found/__next._not-found.txt +1 -1
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +2 -2
- package/dist/web/admin/__next._full.txt +3 -3
- package/dist/web/admin/__next._head.txt +1 -1
- package/dist/web/admin/__next._index.txt +2 -2
- package/dist/web/admin/__next._tree.txt +2 -2
- package/dist/web/admin/__next.admin.__PAGE__.txt +2 -2
- package/dist/web/admin/__next.admin.txt +1 -1
- package/dist/web/admin/admins/__next._full.txt +3 -3
- package/dist/web/admin/admins/__next._head.txt +1 -1
- package/dist/web/admin/admins/__next._index.txt +2 -2
- package/dist/web/admin/admins/__next._tree.txt +2 -2
- package/dist/web/admin/admins/__next.admin.admins.__PAGE__.txt +2 -2
- package/dist/web/admin/admins/__next.admin.admins.txt +1 -1
- package/dist/web/admin/admins/__next.admin.txt +1 -1
- package/dist/web/admin/admins.html +1 -1
- package/dist/web/admin/admins.txt +3 -3
- package/dist/web/admin/login/__next._full.txt +3 -3
- package/dist/web/admin/login/__next._head.txt +1 -1
- package/dist/web/admin/login/__next._index.txt +2 -2
- package/dist/web/admin/login/__next._tree.txt +2 -2
- package/dist/web/admin/login/__next.admin.login.__PAGE__.txt +2 -2
- package/dist/web/admin/login/__next.admin.login.txt +1 -1
- package/dist/web/admin/login/__next.admin.txt +1 -1
- package/dist/web/admin/login.html +1 -1
- package/dist/web/admin/login.txt +3 -3
- package/dist/web/admin/modes/__next._full.txt +3 -3
- package/dist/web/admin/modes/__next._head.txt +1 -1
- package/dist/web/admin/modes/__next._index.txt +2 -2
- package/dist/web/admin/modes/__next._tree.txt +2 -2
- package/dist/web/admin/modes/__next.admin.modes.__PAGE__.txt +2 -2
- package/dist/web/admin/modes/__next.admin.modes.txt +1 -1
- package/dist/web/admin/modes/__next.admin.txt +1 -1
- package/dist/web/admin/modes.html +1 -1
- package/dist/web/admin/modes.txt +3 -3
- package/dist/web/admin/ota/__next._full.txt +3 -3
- package/dist/web/admin/ota/__next._head.txt +1 -1
- package/dist/web/admin/ota/__next._index.txt +2 -2
- package/dist/web/admin/ota/__next._tree.txt +2 -2
- package/dist/web/admin/ota/__next.admin.ota.__PAGE__.txt +2 -2
- package/dist/web/admin/ota/__next.admin.ota.txt +1 -1
- package/dist/web/admin/ota/__next.admin.txt +1 -1
- package/dist/web/admin/ota.html +1 -1
- package/dist/web/admin/ota.txt +3 -3
- package/dist/web/admin/turn/__next._full.txt +3 -3
- package/dist/web/admin/turn/__next._head.txt +1 -1
- package/dist/web/admin/turn/__next._index.txt +2 -2
- package/dist/web/admin/turn/__next._tree.txt +2 -2
- package/dist/web/admin/turn/__next.admin.turn.__PAGE__.txt +2 -2
- package/dist/web/admin/turn/__next.admin.turn.txt +1 -1
- package/dist/web/admin/turn/__next.admin.txt +1 -1
- package/dist/web/admin/turn.html +1 -1
- package/dist/web/admin/turn.txt +3 -3
- package/dist/web/admin.html +1 -1
- package/dist/web/admin.txt +3 -3
- package/dist/web/dev/question/__next._full.txt +3 -3
- package/dist/web/dev/question/__next._head.txt +1 -1
- package/dist/web/dev/question/__next._index.txt +2 -2
- package/dist/web/dev/question/__next._tree.txt +2 -2
- package/dist/web/dev/question/__next.dev.question.__PAGE__.txt +2 -2
- package/dist/web/dev/question/__next.dev.question.txt +1 -1
- package/dist/web/dev/question/__next.dev.txt +1 -1
- package/dist/web/dev/question.html +1 -1
- package/dist/web/dev/question.txt +3 -3
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +3 -3
- package/dist/web/login/__next._full.txt +3 -3
- package/dist/web/login/__next._head.txt +1 -1
- package/dist/web/login/__next._index.txt +2 -2
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +2 -2
- package/dist/web/login/__next.login.txt +1 -1
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +3 -3
- package/dist/web/workspace/__next._full.txt +3 -3
- package/dist/web/workspace/__next._head.txt +1 -1
- package/dist/web/workspace/__next._index.txt +2 -2
- package/dist/web/workspace/__next._tree.txt +2 -2
- package/dist/web/workspace/__next.workspace.__PAGE__.txt +1 -1
- package/dist/web/workspace/__next.workspace.txt +2 -2
- package/dist/web/workspace/browse/__next._full.txt +3 -3
- package/dist/web/workspace/browse/__next._head.txt +1 -1
- package/dist/web/workspace/browse/__next._index.txt +2 -2
- package/dist/web/workspace/browse/__next._tree.txt +2 -2
- package/dist/web/workspace/browse/__next.workspace.browse.__PAGE__.txt +1 -1
- package/dist/web/workspace/browse/__next.workspace.browse.txt +1 -1
- package/dist/web/workspace/browse/__next.workspace.txt +2 -2
- package/dist/web/workspace/browse.html +1 -1
- package/dist/web/workspace/browse.txt +3 -3
- package/dist/web/workspace/editor/__next._full.txt +3 -3
- package/dist/web/workspace/editor/__next._head.txt +1 -1
- package/dist/web/workspace/editor/__next._index.txt +2 -2
- package/dist/web/workspace/editor/__next._tree.txt +2 -2
- package/dist/web/workspace/editor/__next.workspace.editor.__PAGE__.txt +1 -1
- package/dist/web/workspace/editor/__next.workspace.editor.txt +1 -1
- package/dist/web/workspace/editor/__next.workspace.txt +2 -2
- package/dist/web/workspace/editor.html +1 -1
- package/dist/web/workspace/editor.txt +3 -3
- package/dist/web/workspace/files/__next._full.txt +3 -3
- package/dist/web/workspace/files/__next._head.txt +1 -1
- package/dist/web/workspace/files/__next._index.txt +2 -2
- package/dist/web/workspace/files/__next._tree.txt +2 -2
- package/dist/web/workspace/files/__next.workspace.files.__PAGE__.txt +1 -1
- package/dist/web/workspace/files/__next.workspace.files.txt +1 -1
- package/dist/web/workspace/files/__next.workspace.txt +2 -2
- package/dist/web/workspace/files.html +1 -1
- package/dist/web/workspace/files.txt +3 -3
- package/dist/web/workspace/git/__next._full.txt +3 -3
- package/dist/web/workspace/git/__next._head.txt +1 -1
- package/dist/web/workspace/git/__next._index.txt +2 -2
- package/dist/web/workspace/git/__next._tree.txt +2 -2
- package/dist/web/workspace/git/__next.workspace.git.__PAGE__.txt +1 -1
- package/dist/web/workspace/git/__next.workspace.git.txt +1 -1
- package/dist/web/workspace/git/__next.workspace.txt +2 -2
- package/dist/web/workspace/git.html +1 -1
- package/dist/web/workspace/git.txt +3 -3
- package/dist/web/workspace/mobile/__next._full.txt +3 -3
- package/dist/web/workspace/mobile/__next._head.txt +1 -1
- package/dist/web/workspace/mobile/__next._index.txt +2 -2
- package/dist/web/workspace/mobile/__next._tree.txt +2 -2
- package/dist/web/workspace/mobile/__next.workspace.mobile.__PAGE__.txt +1 -1
- package/dist/web/workspace/mobile/__next.workspace.mobile.txt +1 -1
- package/dist/web/workspace/mobile/__next.workspace.txt +2 -2
- package/dist/web/workspace/mobile.html +1 -1
- package/dist/web/workspace/mobile.txt +3 -3
- package/dist/web/workspace/remote/__next._full.txt +3 -3
- package/dist/web/workspace/remote/__next._head.txt +1 -1
- package/dist/web/workspace/remote/__next._index.txt +2 -2
- package/dist/web/workspace/remote/__next._tree.txt +2 -2
- package/dist/web/workspace/remote/__next.workspace.remote.__PAGE__.txt +1 -1
- package/dist/web/workspace/remote/__next.workspace.remote.txt +1 -1
- package/dist/web/workspace/remote/__next.workspace.txt +2 -2
- package/dist/web/workspace/remote.html +1 -1
- package/dist/web/workspace/remote.txt +3 -3
- package/dist/web/workspace/terminal/default/__next._full.txt +3 -3
- package/dist/web/workspace/terminal/default/__next._head.txt +1 -1
- package/dist/web/workspace/terminal/default/__next._index.txt +2 -2
- package/dist/web/workspace/terminal/default/__next._tree.txt +2 -2
- package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.__PAGE__.txt +1 -1
- package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.txt +1 -1
- package/dist/web/workspace/terminal/default/__next.workspace.terminal.txt +1 -1
- package/dist/web/workspace/terminal/default/__next.workspace.txt +2 -2
- package/dist/web/workspace/terminal/default.html +1 -1
- package/dist/web/workspace/terminal/default.txt +3 -3
- package/dist/web/workspace/workspaces/__next._full.txt +3 -3
- package/dist/web/workspace/workspaces/__next._head.txt +1 -1
- package/dist/web/workspace/workspaces/__next._index.txt +2 -2
- package/dist/web/workspace/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspace/workspaces/__next.workspace.txt +2 -2
- package/dist/web/workspace/workspaces/__next.workspace.workspaces.__PAGE__.txt +1 -1
- package/dist/web/workspace/workspaces/__next.workspace.workspaces.txt +1 -1
- package/dist/web/workspace/workspaces.html +1 -1
- package/dist/web/workspace/workspaces.txt +3 -3
- package/dist/web/workspace.html +1 -1
- package/dist/web/workspace.txt +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/index-Dpl_RN3z.js +0 -8
- package/dist/ui/assets/index-NAPslvk3.css +0 -1
- package/dist/web/_next/static/chunks/3977.8cfd8dec4cb8e893.js +0 -1
- package/dist/web/_next/static/chunks/5018-0af0eec430de34c7.js +0 -86
- package/dist/web/_next/static/chunks/635-d6ae421935055337.js +0 -1
- package/dist/web/_next/static/chunks/774-72d0e3531439cf1c.js +0 -1
- package/dist/web/_next/static/chunks/8439-43c6c0f6514a09d9.js +0 -1
- package/dist/web/_next/static/chunks/9958-448e936357b2d620.js +0 -1
- package/dist/web/_next/static/chunks/app/dev/question/page-c28a92f80ec9e5a7.js +0 -1
- package/dist/web/_next/static/chunks/app/login/page-4515f1948afb340b.js +0 -1
- package/dist/web/_next/static/chunks/app/page-0697c18fdefef84e.js +0 -22
- package/dist/web/_next/static/chunks/app/workspace/layout-69aa78d0d618e242.js +0 -14
- package/dist/web/_next/static/chunks/webpack-d869f11e68050bab.js +0 -1
- package/dist/web/_next/static/css/98e745d5833fdea2.css +0 -1
- /package/dist/web/_next/static/{DzBpmOtMidkKu3UY9el_- → dNBmqAWanNAbYsZm6KaX1}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{DzBpmOtMidkKu3UY9el_- → dNBmqAWanNAbYsZm6KaX1}/_ssgManifest.js +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const __importMetaUrl = require('url').pathToFileURL(__filename).href;
|
|
3
|
-
var
|
|
4
|
-
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return P.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return P.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return P.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(P){var g=c((0,d.execSync)(A[T]).toString());return P?g:a(g)}function u(P){return new p.default(function(g,b){return(0,d.exec)(A[T],{},function(S,O,_){if(S)return b(new Error("Error while obtaining machine id: "+S.stack));var U=c(O.toString());return g(P?U:a(U))})})}Object.defineProperty(o,"__esModule",{value:!0});var f=n(35),p=i(f);o.machineIdSync=l,o.machineId=u;var d=n(70),h=n(71),w=process,T=w.platform,I={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},A={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:I[s()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(r,o,n){r.exports={default:n(36),__esModule:!0}},function(r,o,n){n(66),n(68),n(69),n(67),r.exports=n(6).Promise},function(r,o){r.exports=function(){}},function(r,o){r.exports=function(n,i,s,a){if(!(n instanceof i)||a!==void 0&&a in n)throw TypeError(s+": incorrect invocation!");return n}},function(r,o,n){var i=n(13),s=n(31),a=n(62);r.exports=function(c){return function(l,u,f){var p,d=i(l),h=s(d.length),w=a(f,h);if(c&&u!=u){for(;h>w;)if(p=d[w++],p!=p)return!0}else for(;h>w;w++)if((c||w in d)&&d[w]===u)return c||w||0;return!c&&-1}}},function(r,d,n){var i=n(7),s=n(44),a=n(43),c=n(3),l=n(31),u=n(64),f={},p={},d=r.exports=function(h,w,T,I,A){var P,g,b,S,O=A?function(){return h}:u(h),_=i(T,I,w?2:1),U=0;if(typeof O!="function")throw TypeError(h+" is not iterable!");if(a(O)){for(P=l(h.length);P>U;U++)if(S=w?_(c(g=h[U])[0],g[1]):_(h[U]),S===f||S===p)return S}else for(b=O.call(h);!(g=b.next()).done;)if(S=s(b,_,g.value,w),S===f||S===p)return S};d.BREAK=f,d.RETURN=p},function(r,o){r.exports=function(n,i,s){var a=s===void 0;switch(i.length){case 0:return a?n():n.call(s);case 1:return a?n(i[0]):n.call(s,i[0]);case 2:return a?n(i[0],i[1]):n.call(s,i[0],i[1]);case 3:return a?n(i[0],i[1],i[2]):n.call(s,i[0],i[1],i[2]);case 4:return a?n(i[0],i[1],i[2],i[3]):n.call(s,i[0],i[1],i[2],i[3])}return n.apply(s,i)}},function(r,o,n){var i=n(11);r.exports=Object("z").propertyIsEnumerable(0)?Object:function(s){return i(s)=="String"?s.split(""):Object(s)}},function(r,o,n){var i=n(10),s=n(1)("iterator"),a=Array.prototype;r.exports=function(c){return c!==void 0&&(i.Array===c||a[s]===c)}},function(r,o,n){var i=n(3);r.exports=function(s,a,c,l){try{return l?a(i(c)[0],c[1]):a(c)}catch(f){var u=s.return;throw u!==void 0&&i(u.call(s)),f}}},function(r,o,n){"use strict";var i=n(49),s=n(17),a=n(18),c={};n(5)(c,n(1)("iterator"),function(){return this}),r.exports=function(l,u,f){l.prototype=i(c,{next:s(1,f)}),a(l,u+" Iterator")}},function(r,o,n){var i=n(1)("iterator"),s=!1;try{var a=[7][i]();a.return=function(){s=!0},Array.from(a,function(){throw 2})}catch{}r.exports=function(c,l){if(!l&&!s)return!1;var u=!1;try{var f=[7],p=f[i]();p.next=function(){return{done:u=!0}},f[i]=function(){return p},c(f)}catch{}return u}},function(r,o){r.exports=function(n,i){return{value:i,done:!!n}}},function(r,o,n){var i=n(2),s=n(30).set,a=i.MutationObserver||i.WebKitMutationObserver,c=i.process,l=i.Promise,u=n(11)(c)=="process";r.exports=function(){var f,p,d,h=function(){var A,P;for(u&&(A=c.domain)&&A.exit();f;){P=f.fn,f=f.next;try{P()}catch(g){throw f?d():p=void 0,g}}p=void 0,A&&A.enter()};if(u)d=function(){c.nextTick(h)};else if(a){var w=!0,T=document.createTextNode("");new a(h).observe(T,{characterData:!0}),d=function(){T.data=w=!w}}else if(l&&l.resolve){var I=l.resolve();d=function(){I.then(h)}}else d=function(){s.call(i,h)};return function(A){var P={fn:A,next:void 0};p&&(p.next=P),f||(f=P,d()),p=P}}},function(r,o,n){var i=n(3),s=n(50),a=n(22),c=n(19)("IE_PROTO"),l=function(){},u="prototype",f=function(){var p,d=n(16)("iframe"),h=a.length,w=">";for(d.style.display="none",n(25).appendChild(d),d.src="javascript:",p=d.contentWindow.document,p.open(),p.write("<script>document.F=Object</script"+w),p.close(),f=p.F;h--;)delete f[u][a[h]];return f()};r.exports=Object.create||function(p,d){var h;return p!==null?(l[u]=i(p),h=new l,l[u]=null,h[c]=p):h=f(),d===void 0?h:s(h,d)}},function(r,o,n){var i=n(12),s=n(3),a=n(54);r.exports=n(4)?Object.defineProperties:function(c,l){s(c);for(var u,f=a(l),p=f.length,d=0;p>d;)i.f(c,u=f[d++],l[u]);return c}},function(r,o,n){var i=n(55),s=n(17),a=n(13),c=n(32),l=n(8),u=n(26),f=Object.getOwnPropertyDescriptor;o.f=n(4)?f:function(p,d){if(p=a(p),d=c(d,!0),u)try{return f(p,d)}catch{}if(l(p,d))return s(!i.f.call(p,d),p[d])}},function(r,o,n){var i=n(8),s=n(63),a=n(19)("IE_PROTO"),c=Object.prototype;r.exports=Object.getPrototypeOf||function(l){return l=s(l),i(l,a)?l[a]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(r,o,n){var i=n(8),s=n(13),a=n(39)(!1),c=n(19)("IE_PROTO");r.exports=function(l,u){var f,p=s(l),d=0,h=[];for(f in p)f!=c&&i(p,f)&&h.push(f);for(;u.length>d;)i(p,f=u[d++])&&(~a(h,f)||h.push(f));return h}},function(r,o,n){var i=n(53),s=n(22);r.exports=Object.keys||function(a){return i(a,s)}},function(r,o){o.f={}.propertyIsEnumerable},function(r,o,n){var i=n(5);r.exports=function(s,a,c){for(var l in a)c&&s[l]?s[l]=a[l]:i(s,l,a[l]);return s}},function(r,o,n){r.exports=n(5)},function(r,o,n){var i=n(9),s=n(3),a=function(c,l){if(s(c),!i(l)&&l!==null)throw TypeError(l+": can't set as prototype!")};r.exports={set:Object.setPrototypeOf||("__proto__"in{}?(function(c,l,u){try{u=n(7)(Function.call,n(51).f(Object.prototype,"__proto__").set,2),u(c,[]),l=!(c instanceof Array)}catch{l=!0}return function(f,p){return a(f,p),l?f.__proto__=p:u(f,p),f}})({},!1):void 0),check:a}},function(r,o,n){"use strict";var i=n(2),s=n(6),a=n(12),c=n(4),l=n(1)("species");r.exports=function(u){var f=typeof s[u]=="function"?s[u]:i[u];c&&f&&!f[l]&&a.f(f,l,{configurable:!0,get:function(){return this}})}},function(r,o,n){var i=n(3),s=n(14),a=n(1)("species");r.exports=function(c,l){var u,f=i(c).constructor;return f===void 0||(u=i(f)[a])==null?l:s(u)}},function(r,o,n){var i=n(20),s=n(15);r.exports=function(a){return function(c,l){var u,f,p=String(s(c)),d=i(l),h=p.length;return d<0||d>=h?a?"":void 0:(u=p.charCodeAt(d),u<55296||u>56319||d+1===h||(f=p.charCodeAt(d+1))<56320||f>57343?a?p.charAt(d):u:a?p.slice(d,d+2):(u-55296<<10)+(f-56320)+65536)}}},function(r,o,n){var i=n(20),s=Math.max,a=Math.min;r.exports=function(c,l){return c=i(c),c<0?s(c+l,0):a(c,l)}},function(r,o,n){var i=n(15);r.exports=function(s){return Object(i(s))}},function(r,o,n){var i=n(21),s=n(1)("iterator"),a=n(10);r.exports=n(6).getIteratorMethod=function(c){if(c!=null)return c[s]||c["@@iterator"]||a[i(c)]}},function(r,o,n){"use strict";var i=n(37),s=n(47),a=n(10),c=n(13);r.exports=n(27)(Array,"Array",function(l,u){this._t=c(l),this._i=0,this._k=u},function(){var l=this._t,u=this._k,f=this._i++;return!l||f>=l.length?(this._t=void 0,s(1)):u=="keys"?s(0,f):u=="values"?s(0,l[f]):s(0,[f,l[f]])},"values"),a.Arguments=a.Array,i("keys"),i("values"),i("entries")},function(r,o){},function(r,o,n){"use strict";var i,s,a,c=n(28),l=n(2),u=n(7),f=n(21),p=n(23),d=n(9),h=(n(3),n(14)),w=n(38),T=n(40),I=(n(58).set,n(60)),A=n(30).set,P=n(48)(),g="Promise",b=l.TypeError,O=l.process,S=l[g],O=l.process,_=f(O)=="process",U=function(){},Z=!!(function(){try{var y=S.resolve(1),v=(y.constructor={})[n(1)("species")]=function(x){x(U,U)};return(_||typeof PromiseRejectionEvent=="function")&&y.then(U)instanceof v}catch{}})(),ge=function(y,v){return y===v||y===S&&v===a},ye=function(y){var v;return!(!d(y)||typeof(v=y.then)!="function")&&v},ne=function(y){return ge(S,y)?new De(y):new s(y)},De=s=function(y){var v,x;this.promise=new y(function(N,z){if(v!==void 0||x!==void 0)throw b("Bad Promise constructor");v=N,x=z}),this.resolve=h(v),this.reject=h(x)},Ot=function(y){try{y()}catch(v){return{error:v}}},gt=function(y,v){if(!y._n){y._n=!0;var x=y._c;P(function(){for(var N=y._v,z=y._s==1,yt=0,Lt=function(Ze){var be,zn,gn=z?Ze.ok:Ze.fail,yn=Ze.resolve,_t=Ze.reject,er=Ze.domain;try{gn?(z||(y._h==2&&Je(y),y._h=1),gn===!0?be=N:(er&&er.enter(),be=gn(N),er&&er.exit()),be===Ze.promise?_t(b("Promise-chain cycle")):(zn=ye(be))?zn.call(be,yn,_t):yn(be)):_t(N)}catch(Ha){_t(Ha)}};x.length>yt;)Lt(x[yt++]);y._c=[],y._n=!1,v&&!y._h&&mn(y)})}},mn=function(y){A.call(l,function(){var v,x,N,z=y._v;if(re(y)&&(v=Ot(function(){_?O.emit("unhandledRejection",z,y):(x=l.onunhandledrejection)?x({promise:y,reason:z}):(N=l.console)&&N.error&&N.error("Unhandled promise rejection",z)}),y._h=_||re(y)?2:1),y._a=void 0,v)throw v.error})},re=function(y){if(y._h==1)return!1;for(var v,x=y._a||y._c,N=0;x.length>N;)if(v=x[N++],v.fail||!re(v.promise))return!1;return!0},Je=function(y){A.call(l,function(){var v;_?O.emit("rejectionHandled",y):(v=l.onrejectionhandled)&&v({promise:y,reason:y._v})})},ae=function(y){var v=this;v._d||(v._d=!0,v=v._w||v,v._v=y,v._s=2,v._a||(v._a=v._c.slice()),gt(v,!0))},hn=function(y){var v,x=this;if(!x._d){x._d=!0,x=x._w||x;try{if(x===y)throw b("Promise can't be resolved itself");(v=ye(y))?P(function(){var N={_w:x,_d:!1};try{v.call(y,u(hn,N,1),u(ae,N,1))}catch(z){ae.call(N,z)}}):(x._v=y,x._s=1,gt(x,!1))}catch(N){ae.call({_w:x,_d:!1},N)}}};Z||(S=function(y){w(this,S,g,"_h"),h(y),i.call(this);try{y(u(hn,this,1),u(ae,this,1))}catch(v){ae.call(this,v)}},i=function(y){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},i.prototype=n(56)(S.prototype,{then:function(y,v){var x=ne(I(this,S));return x.ok=typeof y!="function"||y,x.fail=typeof v=="function"&&v,x.domain=_?O.domain:void 0,this._c.push(x),this._a&&this._a.push(x),this._s&>(this,!1),x.promise},catch:function(y){return this.then(void 0,y)}}),De=function(){var y=new i;this.promise=y,this.resolve=u(hn,y,1),this.reject=u(ae,y,1)}),p(p.G+p.W+p.F*!Z,{Promise:S}),n(18)(S,g),n(59)(g),a=n(6)[g],p(p.S+p.F*!Z,g,{reject:function(y){var v=ne(this),x=v.reject;return x(y),v.promise}}),p(p.S+p.F*(c||!Z),g,{resolve:function(y){if(y instanceof S&&ge(y.constructor,this))return y;var v=ne(this),x=v.resolve;return x(y),v.promise}}),p(p.S+p.F*!(Z&&n(46)(function(y){S.all(y).catch(U)})),g,{all:function(y){var v=this,x=ne(v),N=x.resolve,z=x.reject,yt=Ot(function(){var Lt=[],Ze=0,be=1;T(y,!1,function(zn){var gn=Ze++,yn=!1;Lt.push(void 0),be++,v.resolve(zn).then(function(_t){yn||(yn=!0,Lt[gn]=_t,--be||N(Lt))},z)}),--be||N(Lt)});return yt&&z(yt.error),x.promise},race:function(y){var v=this,x=ne(v),N=x.reject,z=Ot(function(){T(y,!1,function(yt){v.resolve(yt).then(x.resolve,N)})});return z&&N(z.error),x.promise}})},function(r,o,n){"use strict";var i=n(61)(!0);n(27)(String,"String",function(s){this._t=String(s),this._i=0},function(){var s,a=this._t,c=this._i;return c>=a.length?{value:void 0,done:!0}:(s=i(a,c),this._i+=s.length,{value:s,done:!1})})},function(r,o,n){n(65);for(var i=n(2),s=n(5),a=n(10),c=n(1)("toStringTag"),l=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],u=0;u<5;u++){var f=l[u],p=i[f],d=p&&p.prototype;d&&!d[c]&&s(d,c,f),a[f]=a.Array}},function(r,o){r.exports=require("child_process")},function(r,o){r.exports=require("crypto")}])})});var Fs={};Qa(Fs,{initTray:()=>To,killTray:()=>Gn,openBrowser:()=>Vn,showTrayNotification:()=>Ao,updateTrayTooltip:()=>Ir});function _s(e){for(let t of e)try{if(rn.default.existsSync(t))return t}catch{}return null}function kl(){if(process.platform==="win32"){for(let e of Ds)try{if(rn.default.existsSync(e))return rn.default.readFileSync(e).toString("base64")}catch{}return Ls}return Ls}function Il(){if(process.env.NREMOTE_DESKTOP)return!1;let e=process.platform;return!(!["darwin","win32","linux"].includes(e)||e==="linux"&&!process.env.DISPLAY)}function Bs(){let{port:e,tunnelUrl:t,running:r}=on,o=r?t?"Tunnel ON":"Local only":"Idle",n=`http://localhost:${e}`;return`9Remote \u2022 ${o}
|
|
3
|
+
var Ya=Object.create;var Vr=Object.defineProperty;var Xa=Object.getOwnPropertyDescriptor;var qa=Object.getOwnPropertyNames;var Qa=Object.getPrototypeOf,Ja=Object.prototype.hasOwnProperty;var Za=(e,t)=>()=>(e&&(t=e(e=0)),t);var de=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),za=(e,t)=>{for(var r in t)Vr(e,r,{get:t[r],enumerable:!0})},ec=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of qa(t))!Ja.call(e,n)&&n!==r&&Vr(e,n,{get:()=>t[n],enumerable:!(o=Xa(t,n))||o.enumerable});return e};var R=(e,t,r)=>(r=e!=null?Ya(Qa(e)):{},ec(t||!e||!e.__esModule?Vr(r,"default",{value:e,enumerable:!0}):r,e));var si=de((kn,qr)=>{(function(e,t){typeof kn=="object"&&typeof qr=="object"?qr.exports=t(require("child_process"),require("crypto")):typeof define=="function"&&define.amd?define(["child_process","crypto"],t):typeof kn=="object"?kn["electron-machine-id"]=t(require("child_process"),require("crypto")):e["electron-machine-id"]=t(e.child_process,e.crypto)})(kn,function(e,t){return(function(r){function o(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return r[i].call(s.exports,s,s.exports,o),s.loaded=!0,s.exports}var n={};return o.m=r,o.c=n,o.p="",o(0)})([function(r,o,n){r.exports=n(34)},function(r,o,n){var i=n(29)("wks"),s=n(33),a=n(2).Symbol,c=typeof a=="function",l=r.exports=function(u){return i[u]||(i[u]=c&&a[u]||(c?a:s)("Symbol."+u))};l.store=i},function(r,o){var n=r.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=n)},function(r,o,n){var i=n(9);r.exports=function(s){if(!i(s))throw TypeError(s+" is not an object!");return s}},function(r,o,n){r.exports=!n(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(r,o,n){var i=n(12),s=n(17);r.exports=n(4)?function(a,c,l){return i.f(a,c,s(1,l))}:function(a,c,l){return a[c]=l,a}},function(r,o){var n=r.exports={version:"2.4.0"};typeof __e=="number"&&(__e=n)},function(r,o,n){var i=n(14);r.exports=function(s,a,c){if(i(s),a===void 0)return s;switch(c){case 1:return function(l){return s.call(a,l)};case 2:return function(l,u){return s.call(a,l,u)};case 3:return function(l,u,f){return s.call(a,l,u,f)}}return function(){return s.apply(a,arguments)}}},function(r,o){var n={}.hasOwnProperty;r.exports=function(i,s){return n.call(i,s)}},function(r,o){r.exports=function(n){return typeof n=="object"?n!==null:typeof n=="function"}},function(r,o){r.exports={}},function(r,o){var n={}.toString;r.exports=function(i){return n.call(i).slice(8,-1)}},function(r,o,n){var i=n(3),s=n(26),a=n(32),c=Object.defineProperty;o.f=n(4)?Object.defineProperty:function(l,u,f){if(i(l),u=a(u,!0),i(f),s)try{return c(l,u,f)}catch{}if("get"in f||"set"in f)throw TypeError("Accessors not supported!");return"value"in f&&(l[u]=f.value),l}},function(r,o,n){var i=n(42),s=n(15);r.exports=function(a){return i(s(a))}},function(r,o){r.exports=function(n){if(typeof n!="function")throw TypeError(n+" is not a function!");return n}},function(r,o){r.exports=function(n){if(n==null)throw TypeError("Can't call method on "+n);return n}},function(r,o,n){var i=n(9),s=n(2).document,a=i(s)&&i(s.createElement);r.exports=function(c){return a?s.createElement(c):{}}},function(r,o){r.exports=function(n,i){return{enumerable:!(1&n),configurable:!(2&n),writable:!(4&n),value:i}}},function(r,o,n){var i=n(12).f,s=n(8),a=n(1)("toStringTag");r.exports=function(c,l,u){c&&!s(c=u?c:c.prototype,a)&&i(c,a,{configurable:!0,value:l})}},function(r,o,n){var i=n(29)("keys"),s=n(33);r.exports=function(a){return i[a]||(i[a]=s(a))}},function(r,o){var n=Math.ceil,i=Math.floor;r.exports=function(s){return isNaN(s=+s)?0:(s>0?i:n)(s)}},function(r,o,n){var i=n(11),s=n(1)("toStringTag"),a=i((function(){return arguments})())=="Arguments",c=function(l,u){try{return l[u]}catch{}};r.exports=function(l){var u,f,p;return l===void 0?"Undefined":l===null?"Null":typeof(f=c(u=Object(l),s))=="string"?f:a?i(u):(p=i(u))=="Object"&&typeof u.callee=="function"?"Arguments":p}},function(r,o){r.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(r,o,n){var i=n(2),s=n(6),a=n(7),c=n(5),l="prototype",u=function(f,p,d){var h,w,E,O=f&u.F,T=f&u.G,A=f&u.S,P=f&u.P,M=f&u.B,g=f&u.W,b=T?s:s[p]||(s[p]={}),_=b[l],$=T?i:A?i[p]:(i[p]||{})[l];T&&(d=p);for(h in d)w=!O&&$&&$[h]!==void 0,w&&h in b||(E=w?$[h]:d[h],b[h]=T&&typeof $[h]!="function"?d[h]:M&&w?a(E,i):g&&$[h]==E?(function(Y){var re=function(ve,oe,Be){if(this instanceof Y){switch(arguments.length){case 0:return new Y;case 1:return new Y(ve);case 2:return new Y(ve,oe)}return new Y(ve,oe,Be)}return Y.apply(this,arguments)};return re[l]=Y[l],re})(E):P&&typeof E=="function"?a(Function.call,E):E,P&&((b.virtual||(b.virtual={}))[h]=E,f&u.R&&_&&!_[h]&&c(_,h,E)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,r.exports=u},function(r,o){r.exports=function(n){try{return!!n()}catch{return!0}}},function(r,o,n){r.exports=n(2).document&&document.documentElement},function(r,o,n){r.exports=!n(4)&&!n(24)(function(){return Object.defineProperty(n(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(r,o,n){"use strict";var i=n(28),s=n(23),a=n(57),c=n(5),l=n(8),u=n(10),f=n(45),p=n(18),d=n(52),h=n(1)("iterator"),w=!([].keys&&"next"in[].keys()),E="@@iterator",O="keys",T="values",A=function(){return this};r.exports=function(P,M,g,b,_,$,Y){f(g,M,b);var re,ve,oe,Be=function(v){if(!w&&v in ie)return ie[v];switch(v){case O:return function(){return new g(this,v)};case T:return function(){return new g(this,v)}}return function(){return new g(this,v)}},Nt=M+" Iterator",wt=_==T,Sn=!1,ie=P.prototype,et=ie[h]||ie[E]||_&&ie[_],ue=et||Be(_),Tn=_?wt?Be("entries"):ue:void 0,y=M=="Array"&&ie.entries||et;if(y&&(oe=d(y.call(new P)),oe!==Object.prototype&&(p(oe,Nt,!0),i||l(oe,h)||c(oe,h,A))),wt&&et&&et.name!==T&&(Sn=!0,ue=function(){return et.call(this)}),i&&!Y||!w&&!Sn&&ie[h]||c(ie,h,ue),u[M]=ue,u[Nt]=A,_)if(re={values:wt?ue:Be(T),keys:$?ue:Be(O),entries:Tn},Y)for(ve in re)ve in ie||a(ie,ve,re[ve]);else s(s.P+s.F*(w||Sn),M,re);return re}},function(r,o){r.exports=!0},function(r,o,n){var i=n(2),s="__core-js_shared__",a=i[s]||(i[s]={});r.exports=function(c){return a[c]||(a[c]={})}},function(r,o,n){var i,s,a,c=n(7),l=n(41),u=n(25),f=n(16),p=n(2),d=p.process,h=p.setImmediate,w=p.clearImmediate,E=p.MessageChannel,O=0,T={},A="onreadystatechange",P=function(){var g=+this;if(T.hasOwnProperty(g)){var b=T[g];delete T[g],b()}},M=function(g){P.call(g.data)};h&&w||(h=function(g){for(var b=[],_=1;arguments.length>_;)b.push(arguments[_++]);return T[++O]=function(){l(typeof g=="function"?g:Function(g),b)},i(O),O},w=function(g){delete T[g]},n(11)(d)=="process"?i=function(g){d.nextTick(c(P,g,1))}:E?(s=new E,a=s.port2,s.port1.onmessage=M,i=c(a.postMessage,a,1)):p.addEventListener&&typeof postMessage=="function"&&!p.importScripts?(i=function(g){p.postMessage(g+"","*")},p.addEventListener("message",M,!1)):i=A in f("script")?function(g){u.appendChild(f("script"))[A]=function(){u.removeChild(this),P.call(g)}}:function(g){setTimeout(c(P,g,1),0)}),r.exports={set:h,clear:w}},function(r,o,n){var i=n(20),s=Math.min;r.exports=function(a){return a>0?s(i(a),9007199254740991):0}},function(r,o,n){var i=n(9);r.exports=function(s,a){if(!i(s))return s;var c,l;if(a&&typeof(c=s.toString)=="function"&&!i(l=c.call(s))||typeof(c=s.valueOf)=="function"&&!i(l=c.call(s))||!a&&typeof(c=s.toString)=="function"&&!i(l=c.call(s)))return l;throw TypeError("Can't convert object to primitive value")}},function(r,o){var n=0,i=Math.random();r.exports=function(s){return"Symbol(".concat(s===void 0?"":s,")_",(++n+i).toString(36))}},function(r,o,n){"use strict";function i(A){return A&&A.__esModule?A:{default:A}}function s(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function a(A){return(0,h.createHash)("sha256").update(A).digest("hex")}function c(A){switch(E){case"darwin":return A.split("IOPlatformUUID")[1].split(`
|
|
4
|
+
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return A.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return A.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return A.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(A){var P=c((0,d.execSync)(T[E]).toString());return A?P:a(P)}function u(A){return new p.default(function(P,M){return(0,d.exec)(T[E],{},function(g,b,_){if(g)return M(new Error("Error while obtaining machine id: "+g.stack));var $=c(b.toString());return P(A?$:a($))})})}Object.defineProperty(o,"__esModule",{value:!0});var f=n(35),p=i(f);o.machineIdSync=l,o.machineId=u;var d=n(70),h=n(71),w=process,E=w.platform,O={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},T={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:O[s()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(r,o,n){r.exports={default:n(36),__esModule:!0}},function(r,o,n){n(66),n(68),n(69),n(67),r.exports=n(6).Promise},function(r,o){r.exports=function(){}},function(r,o){r.exports=function(n,i,s,a){if(!(n instanceof i)||a!==void 0&&a in n)throw TypeError(s+": incorrect invocation!");return n}},function(r,o,n){var i=n(13),s=n(31),a=n(62);r.exports=function(c){return function(l,u,f){var p,d=i(l),h=s(d.length),w=a(f,h);if(c&&u!=u){for(;h>w;)if(p=d[w++],p!=p)return!0}else for(;h>w;w++)if((c||w in d)&&d[w]===u)return c||w||0;return!c&&-1}}},function(r,d,n){var i=n(7),s=n(44),a=n(43),c=n(3),l=n(31),u=n(64),f={},p={},d=r.exports=function(h,w,E,O,T){var A,P,M,g,b=T?function(){return h}:u(h),_=i(E,O,w?2:1),$=0;if(typeof b!="function")throw TypeError(h+" is not iterable!");if(a(b)){for(A=l(h.length);A>$;$++)if(g=w?_(c(P=h[$])[0],P[1]):_(h[$]),g===f||g===p)return g}else for(M=b.call(h);!(P=M.next()).done;)if(g=s(M,_,P.value,w),g===f||g===p)return g};d.BREAK=f,d.RETURN=p},function(r,o){r.exports=function(n,i,s){var a=s===void 0;switch(i.length){case 0:return a?n():n.call(s);case 1:return a?n(i[0]):n.call(s,i[0]);case 2:return a?n(i[0],i[1]):n.call(s,i[0],i[1]);case 3:return a?n(i[0],i[1],i[2]):n.call(s,i[0],i[1],i[2]);case 4:return a?n(i[0],i[1],i[2],i[3]):n.call(s,i[0],i[1],i[2],i[3])}return n.apply(s,i)}},function(r,o,n){var i=n(11);r.exports=Object("z").propertyIsEnumerable(0)?Object:function(s){return i(s)=="String"?s.split(""):Object(s)}},function(r,o,n){var i=n(10),s=n(1)("iterator"),a=Array.prototype;r.exports=function(c){return c!==void 0&&(i.Array===c||a[s]===c)}},function(r,o,n){var i=n(3);r.exports=function(s,a,c,l){try{return l?a(i(c)[0],c[1]):a(c)}catch(f){var u=s.return;throw u!==void 0&&i(u.call(s)),f}}},function(r,o,n){"use strict";var i=n(49),s=n(17),a=n(18),c={};n(5)(c,n(1)("iterator"),function(){return this}),r.exports=function(l,u,f){l.prototype=i(c,{next:s(1,f)}),a(l,u+" Iterator")}},function(r,o,n){var i=n(1)("iterator"),s=!1;try{var a=[7][i]();a.return=function(){s=!0},Array.from(a,function(){throw 2})}catch{}r.exports=function(c,l){if(!l&&!s)return!1;var u=!1;try{var f=[7],p=f[i]();p.next=function(){return{done:u=!0}},f[i]=function(){return p},c(f)}catch{}return u}},function(r,o){r.exports=function(n,i){return{value:i,done:!!n}}},function(r,o,n){var i=n(2),s=n(30).set,a=i.MutationObserver||i.WebKitMutationObserver,c=i.process,l=i.Promise,u=n(11)(c)=="process";r.exports=function(){var f,p,d,h=function(){var T,A;for(u&&(T=c.domain)&&T.exit();f;){A=f.fn,f=f.next;try{A()}catch(P){throw f?d():p=void 0,P}}p=void 0,T&&T.enter()};if(u)d=function(){c.nextTick(h)};else if(a){var w=!0,E=document.createTextNode("");new a(h).observe(E,{characterData:!0}),d=function(){E.data=w=!w}}else if(l&&l.resolve){var O=l.resolve();d=function(){O.then(h)}}else d=function(){s.call(i,h)};return function(T){var A={fn:T,next:void 0};p&&(p.next=A),f||(f=A,d()),p=A}}},function(r,o,n){var i=n(3),s=n(50),a=n(22),c=n(19)("IE_PROTO"),l=function(){},u="prototype",f=function(){var p,d=n(16)("iframe"),h=a.length,w=">";for(d.style.display="none",n(25).appendChild(d),d.src="javascript:",p=d.contentWindow.document,p.open(),p.write("<script>document.F=Object</script"+w),p.close(),f=p.F;h--;)delete f[u][a[h]];return f()};r.exports=Object.create||function(p,d){var h;return p!==null?(l[u]=i(p),h=new l,l[u]=null,h[c]=p):h=f(),d===void 0?h:s(h,d)}},function(r,o,n){var i=n(12),s=n(3),a=n(54);r.exports=n(4)?Object.defineProperties:function(c,l){s(c);for(var u,f=a(l),p=f.length,d=0;p>d;)i.f(c,u=f[d++],l[u]);return c}},function(r,o,n){var i=n(55),s=n(17),a=n(13),c=n(32),l=n(8),u=n(26),f=Object.getOwnPropertyDescriptor;o.f=n(4)?f:function(p,d){if(p=a(p),d=c(d,!0),u)try{return f(p,d)}catch{}if(l(p,d))return s(!i.f.call(p,d),p[d])}},function(r,o,n){var i=n(8),s=n(63),a=n(19)("IE_PROTO"),c=Object.prototype;r.exports=Object.getPrototypeOf||function(l){return l=s(l),i(l,a)?l[a]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(r,o,n){var i=n(8),s=n(13),a=n(39)(!1),c=n(19)("IE_PROTO");r.exports=function(l,u){var f,p=s(l),d=0,h=[];for(f in p)f!=c&&i(p,f)&&h.push(f);for(;u.length>d;)i(p,f=u[d++])&&(~a(h,f)||h.push(f));return h}},function(r,o,n){var i=n(53),s=n(22);r.exports=Object.keys||function(a){return i(a,s)}},function(r,o){o.f={}.propertyIsEnumerable},function(r,o,n){var i=n(5);r.exports=function(s,a,c){for(var l in a)c&&s[l]?s[l]=a[l]:i(s,l,a[l]);return s}},function(r,o,n){r.exports=n(5)},function(r,o,n){var i=n(9),s=n(3),a=function(c,l){if(s(c),!i(l)&&l!==null)throw TypeError(l+": can't set as prototype!")};r.exports={set:Object.setPrototypeOf||("__proto__"in{}?(function(c,l,u){try{u=n(7)(Function.call,n(51).f(Object.prototype,"__proto__").set,2),u(c,[]),l=!(c instanceof Array)}catch{l=!0}return function(f,p){return a(f,p),l?f.__proto__=p:u(f,p),f}})({},!1):void 0),check:a}},function(r,o,n){"use strict";var i=n(2),s=n(6),a=n(12),c=n(4),l=n(1)("species");r.exports=function(u){var f=typeof s[u]=="function"?s[u]:i[u];c&&f&&!f[l]&&a.f(f,l,{configurable:!0,get:function(){return this}})}},function(r,o,n){var i=n(3),s=n(14),a=n(1)("species");r.exports=function(c,l){var u,f=i(c).constructor;return f===void 0||(u=i(f)[a])==null?l:s(u)}},function(r,o,n){var i=n(20),s=n(15);r.exports=function(a){return function(c,l){var u,f,p=String(s(c)),d=i(l),h=p.length;return d<0||d>=h?a?"":void 0:(u=p.charCodeAt(d),u<55296||u>56319||d+1===h||(f=p.charCodeAt(d+1))<56320||f>57343?a?p.charAt(d):u:a?p.slice(d,d+2):(u-55296<<10)+(f-56320)+65536)}}},function(r,o,n){var i=n(20),s=Math.max,a=Math.min;r.exports=function(c,l){return c=i(c),c<0?s(c+l,0):a(c,l)}},function(r,o,n){var i=n(15);r.exports=function(s){return Object(i(s))}},function(r,o,n){var i=n(21),s=n(1)("iterator"),a=n(10);r.exports=n(6).getIteratorMethod=function(c){if(c!=null)return c[s]||c["@@iterator"]||a[i(c)]}},function(r,o,n){"use strict";var i=n(37),s=n(47),a=n(10),c=n(13);r.exports=n(27)(Array,"Array",function(l,u){this._t=c(l),this._i=0,this._k=u},function(){var l=this._t,u=this._k,f=this._i++;return!l||f>=l.length?(this._t=void 0,s(1)):u=="keys"?s(0,f):u=="values"?s(0,l[f]):s(0,[f,l[f]])},"values"),a.Arguments=a.Array,i("keys"),i("values"),i("entries")},function(r,o){},function(r,o,n){"use strict";var i,s,a,c=n(28),l=n(2),u=n(7),f=n(21),p=n(23),d=n(9),h=(n(3),n(14)),w=n(38),E=n(40),O=(n(58).set,n(60)),T=n(30).set,A=n(48)(),P="Promise",M=l.TypeError,b=l.process,g=l[P],b=l.process,_=f(b)=="process",$=function(){},Y=!!(function(){try{var y=g.resolve(1),v=(y.constructor={})[n(1)("species")]=function(x){x($,$)};return(_||typeof PromiseRejectionEvent=="function")&&y.then($)instanceof v}catch{}})(),re=function(y,v){return y===v||y===g&&v===a},ve=function(y){var v;return!(!d(y)||typeof(v=y.then)!="function")&&v},oe=function(y){return re(g,y)?new Be(y):new s(y)},Be=s=function(y){var v,x;this.promise=new y(function(D,ee){if(v!==void 0||x!==void 0)throw M("Bad Promise constructor");v=D,x=ee}),this.resolve=h(v),this.reject=h(x)},Nt=function(y){try{y()}catch(v){return{error:v}}},wt=function(y,v){if(!y._n){y._n=!0;var x=y._c;A(function(){for(var D=y._v,ee=y._s==1,vt=0,Dt=function(tt){var Re,sr,bn=ee?tt.ok:tt.fail,An=tt.resolve,Bt=tt.reject,ar=tt.domain;try{bn?(ee||(y._h==2&&et(y),y._h=1),bn===!0?Re=D:(ar&&ar.enter(),Re=bn(D),ar&&ar.exit()),Re===tt.promise?Bt(M("Promise-chain cycle")):(sr=ve(Re))?sr.call(Re,An,Bt):An(Re)):Bt(D)}catch(Va){Bt(Va)}};x.length>vt;)Dt(x[vt++]);y._c=[],y._n=!1,v&&!y._h&&Sn(y)})}},Sn=function(y){T.call(l,function(){var v,x,D,ee=y._v;if(ie(y)&&(v=Nt(function(){_?b.emit("unhandledRejection",ee,y):(x=l.onunhandledrejection)?x({promise:y,reason:ee}):(D=l.console)&&D.error&&D.error("Unhandled promise rejection",ee)}),y._h=_||ie(y)?2:1),y._a=void 0,v)throw v.error})},ie=function(y){if(y._h==1)return!1;for(var v,x=y._a||y._c,D=0;x.length>D;)if(v=x[D++],v.fail||!ie(v.promise))return!1;return!0},et=function(y){T.call(l,function(){var v;_?b.emit("rejectionHandled",y):(v=l.onrejectionhandled)&&v({promise:y,reason:y._v})})},ue=function(y){var v=this;v._d||(v._d=!0,v=v._w||v,v._v=y,v._s=2,v._a||(v._a=v._c.slice()),wt(v,!0))},Tn=function(y){var v,x=this;if(!x._d){x._d=!0,x=x._w||x;try{if(x===y)throw M("Promise can't be resolved itself");(v=ve(y))?A(function(){var D={_w:x,_d:!1};try{v.call(y,u(Tn,D,1),u(ue,D,1))}catch(ee){ue.call(D,ee)}}):(x._v=y,x._s=1,wt(x,!1))}catch(D){ue.call({_w:x,_d:!1},D)}}};Y||(g=function(y){w(this,g,P,"_h"),h(y),i.call(this);try{y(u(Tn,this,1),u(ue,this,1))}catch(v){ue.call(this,v)}},i=function(y){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},i.prototype=n(56)(g.prototype,{then:function(y,v){var x=oe(O(this,g));return x.ok=typeof y!="function"||y,x.fail=typeof v=="function"&&v,x.domain=_?b.domain:void 0,this._c.push(x),this._a&&this._a.push(x),this._s&&wt(this,!1),x.promise},catch:function(y){return this.then(void 0,y)}}),Be=function(){var y=new i;this.promise=y,this.resolve=u(Tn,y,1),this.reject=u(ue,y,1)}),p(p.G+p.W+p.F*!Y,{Promise:g}),n(18)(g,P),n(59)(P),a=n(6)[P],p(p.S+p.F*!Y,P,{reject:function(y){var v=oe(this),x=v.reject;return x(y),v.promise}}),p(p.S+p.F*(c||!Y),P,{resolve:function(y){if(y instanceof g&&re(y.constructor,this))return y;var v=oe(this),x=v.resolve;return x(y),v.promise}}),p(p.S+p.F*!(Y&&n(46)(function(y){g.all(y).catch($)})),P,{all:function(y){var v=this,x=oe(v),D=x.resolve,ee=x.reject,vt=Nt(function(){var Dt=[],tt=0,Re=1;E(y,!1,function(sr){var bn=tt++,An=!1;Dt.push(void 0),Re++,v.resolve(sr).then(function(Bt){An||(An=!0,Dt[bn]=Bt,--Re||D(Dt))},ee)}),--Re||D(Dt)});return vt&&ee(vt.error),x.promise},race:function(y){var v=this,x=oe(v),D=x.reject,ee=Nt(function(){E(y,!1,function(vt){v.resolve(vt).then(x.resolve,D)})});return ee&&D(ee.error),x.promise}})},function(r,o,n){"use strict";var i=n(61)(!0);n(27)(String,"String",function(s){this._t=String(s),this._i=0},function(){var s,a=this._t,c=this._i;return c>=a.length?{value:void 0,done:!0}:(s=i(a,c),this._i+=s.length,{value:s,done:!1})})},function(r,o,n){n(65);for(var i=n(2),s=n(5),a=n(10),c=n(1)("toStringTag"),l=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],u=0;u<5;u++){var f=l[u],p=i[f],d=p&&p.prototype;d&&!d[c]&&s(d,c,f),a[f]=a.Array}},function(r,o){r.exports=require("child_process")},function(r,o){r.exports=require("crypto")}])})});var Ys={};za(Ys,{initTray:()=>Zn,killTray:()=>Pt,openBrowser:()=>kt,showTrayNotification:()=>_o,updateTrayTooltip:()=>dn});function Us(e){for(let t of e)try{if(fn.default.existsSync(t))return t}catch{}return null}function Ll(){if(process.platform==="win32"){for(let e of js)try{if(fn.default.existsSync(e))return fn.default.readFileSync(e).toString("base64")}catch{}return Bs}return Bs}function Cl(){if(process.env.NREMOTE_DESKTOP)return!1;let e=process.platform;return!(!["darwin","win32","linux"].includes(e)||e==="linux"&&!process.env.DISPLAY)}function Gs(){let{port:e,tunnelUrl:t,running:r}=pn,o=r?t?"Tunnel ON":"Local only":"Idle",n=`http://localhost:${e}`;return`9Remote \u2022 ${o}
|
|
5
5
|
Local: ${n}
|
|
6
|
-
Right-click to open / quit`}function
|
|
7
|
-
`,"utf8")}catch{}};return Cs.default.createInterface({input:i.stdout}).on("line",c=>{try{let l=JSON.parse(c);if(l.type!=="click")return;l.index===0?r?.():l.index===1&&(t?.(),Gn(),setTimeout(()=>process.exit(0),500))}catch{}}),i.on("error",()=>{}),i.stderr.on("data",()=>{}),["Open Web UI","Shutdown"].forEach((c,l)=>s({action:"add-item",index:l,title:c,enabled:!0})),{_isWin:!0,_setTooltip(c){s({action:"set-tooltip",text:c})},sendAction(){},kill(){try{s({action:"kill"})}catch{}setTimeout(()=>{try{i&&!i.killed&&i.kill()}catch{}},300)}}}async function To({port:e,onQuit:t,onOpenUI:r}){if(!Il())return null;if(process.platform==="win32")return on={port:e,tunnelUrl:"",running:!0},te=Ll({port:e,onQuit:t,onOpenUI:r}),te;try{let o=Ol();if(!o)return null;let i={darwin:"tray_darwin_release",win32:"tray_windows_release.exe",linux:"tray_linux_release"}[process.platform];if(!i)return null;let s=Ce.default.join(Ns,"systray2","traybin",i);if(!rn.default.existsSync(s))return null;if(process.platform!=="win32")try{rn.default.chmodSync(s,493)}catch{}return on={port:e,tunnelUrl:"",running:!0},te=new o({menu:Us(),debug:!1,copyDir:!0}),te.onClick(a=>{let c=a.item?.title||a.item;c==="Open Web UI"?r?.():c==="Shutdown"&&(t?.(),Gn(),setTimeout(()=>process.exit(0),500))}),typeof te.ready=="function"?te.ready().catch(()=>{}):(te.onReady(()=>{}),te.onError(()=>{})),te}catch{return null}}function Ir({tunnelUrl:e,running:t}={}){if(e!==void 0&&(on.tunnelUrl=e),t!==void 0&&(on.running=t),!!te){if(te._isWin){te._setTooltip?.(Bs());return}try{te.sendAction({type:"update-menu",menu:Us(),seq_id:-1})}catch{}}}function Gn(){let e=te;if(te=null,e)try{e.kill(!0)}catch{}}function Ao({title:e="9Remote",message:t}){let r=process.platform;if(t){if(r==="win32"){let o=c=>String(c).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),n=c=>String(c).replace(/'/g,"''"),i="9Remote",s=`<toast><visual><binding template="ToastText02"><text id="1">${o(e)}</text><text id="2">${o(t)}</text></binding></visual></toast>`,a=["try {","[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType=WindowsRuntime] > $null;","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType=WindowsRuntime] > $null;","$xml = New-Object Windows.Data.Xml.Dom.XmlDocument;",`$xml.LoadXml('${n(s)}');`,"$toast = [Windows.UI.Notifications.ToastNotification]::new($xml);",`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${n(i)}').Show($toast);`,"} catch {","Add-Type -AssemblyName System.Windows.Forms;","$n = New-Object System.Windows.Forms.NotifyIcon;","$n.Icon = [System.Drawing.SystemIcons]::Information;",`$n.BalloonTipTitle = '${n(e)}';`,`$n.BalloonTipText = '${n(t)}';`,"$n.Visible = $true;","$n.ShowBalloonTip(5000);","Start-Sleep -Seconds 6;","$n.Dispose();","}"].join(" ");try{(0,Ye.spawn)("powershell.exe",["-NoProfile","-WindowStyle","Hidden","-Command",a],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(r==="darwin"){try{let o=s=>String(s).replace(/"/g,'\\"'),n=`display notification "${o(t)}" with title "${o(e)}"`;(0,Ye.spawn)("osascript",["-e",n],{detached:!0,stdio:"ignore"}).unref()}catch{}return}try{(0,Ye.spawn)("notify-send",[e,t],{detached:!0,stdio:"ignore"}).unref()}catch{}}}function Vn(e){let t=process.platform;if(t==="win32"){try{(0,Ye.spawn)("rundll32.exe",["url.dll,FileProtocolHandler",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref();return}catch{}try{(0,Ye.spawn)("cmd.exe",["/d","/s","/c","start","",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(t==="darwin"){try{(0,Ye.spawn)("open",[e],{detached:!0,stdio:"ignore"}).unref()}catch{}return}let r=[["setsid",["--fork","xdg-open",e]],["setsid",["xdg-open",e]],["xdg-open",[e]],["gio",["open",e]],["sensible-browser",[e]],["x-www-browser",[e]]];for(let[o,n]of r)try{(0,Ye.spawn)(o,n,{detached:!0,stdio:"ignore",env:{...process.env}}).unref();return}catch{}}var Ye,Cs,rn,Ce,Ms,$s,Ns,te,on,kr,Ls,Ds,Pl,sn=Xa(()=>{Ye=require("child_process"),Cs=R(require("readline"),1),rn=R(require("fs"),1),Ce=R(require("path"),1),Ms=R(require("os"),1),$s=require("url"),Ns=(0,Ce.join)(Ms.default.homedir(),".9remote","runtime","node_modules"),te=null,on={port:0,tunnelUrl:"",running:!1},kr=Ce.default.dirname((0,$s.fileURLToPath)(__importMetaUrl)),Ls="iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAHhlWElmTU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAAEsAAAAAQAAASwAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAECgAwAEAAAAAQAAAEAAAAAAEz0GrAAAAA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4RZB4M9yGZsQzalb0HlTOBsE8JHWlYA8qiASpAIvxH2ZGaSR2aEOJ4llAMxnWfRu7qKhDlOHxmnVlTRah7NKwIc8I4o3/EP2jsEH8v5XWAJPJ30Hyagtg0bAYX4A9wH1MVCC6sKMhGWgos8SFxu2Layhr8uK8DkPFZ2f/9F0Ir0DhTfRUUWTFy+VIYsxIk6Dh2OgUDImbMH2ND34c/lfKc7FPluIAuBESGgcdEIMg3Q5AAt1OEjaWRLYflCWKkHoHWGieucdAFITwAfQlF2xXk8pBICjBO+arkvyIWGQIcUWXBfV+BC7OJvrAcWPKIZAvzsIm4CLPt1tOGwUIUiLQ3MnJvoAAuABPGWWgC8f8tAkMeKgTN5T8grOJ2TfyefXRfy9KPMhFZJ/mXknPAQ6clC3QVaZmKcdYUmpQ1hv84J/hMYE0jZgsUJpKvtuQUdw2/5lZkUtNcUnI8WdpA4uSkUHRxZ6xmpPk0KcKVZA8AUBVKR1h5kMHGlBTXuk8TQWEtp3kfyt+vxwaz92s28o4uVu/y9p4V8+omyBPpxSB3Vb+WgNOt3WFDopT/1ol4dI8/a22B50Efu7rFE/6T6xbnQKRrCODPxT4dddmATMJmFGM9ws8Bga8Q2KuYWgiTscKjD2uU16JzIm47Pux/7jpNo8YMhfVlwYqekRwrwDAd4xOMnxjvsIwNY+/OssmFKLVKXbhMNq/wfFc4pjZ/mOwLsZbxPKhcTk4e/LYLvgm4EkyyTQI9MYnkM+yH7Lf56+E42k/n0+83kdH4+Ew1AYnU/37Js4qTZ6Ma/nCEUItORwoC6+Z6jx1qRu+1Slx0jnQ8/QLTDpn9XlinV+R/8+/7/EshPRLVmq9wAAAABJRU5ErkJggg==",Ds=[Ce.default.join(kr,"assets","trayIcon.ico"),Ce.default.join(kr,"..","assets","trayIcon.ico")],Pl=[Ce.default.join(kr,"assets","tray.ps1"),Ce.default.join(kr,"..","assets","tray.ps1")]});var Lo=ue((kp,oa)=>{oa.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var aa=ue((Ip,sa)=>{var Wl=Lo();function ia(e){this.mode=Wl.MODE_8BIT_BYTE,this.data=e}ia.prototype={getLength:function(){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}};sa.exports=ia});var _o=ue((Op,ca)=>{var Ae={glog:function(e){if(e<1)throw new Error("glog("+e+")");return Ae.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return Ae.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(j=0;j<8;j++)Ae.EXP_TABLE[j]=1<<j;var j;for(j=8;j<256;j++)Ae.EXP_TABLE[j]=Ae.EXP_TABLE[j-4]^Ae.EXP_TABLE[j-5]^Ae.EXP_TABLE[j-6]^Ae.EXP_TABLE[j-8];var j;for(j=0;j<255;j++)Ae.LOG_TABLE[Ae.EXP_TABLE[j]]=j;var j;ca.exports=Ae});var Co=ue((Lp,la)=>{var It=_o();function Mr(e,t){if(e.length===void 0)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&e[r]===0;)r++;this.num=new Array(e.length-r+t);for(var o=0;o<e.length-r;o++)this.num[o]=e[o+r]}Mr.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<e.getLength();o++)t[r+o]^=It.gexp(It.glog(this.get(r))+It.glog(e.get(o)));return new Mr(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=It.glog(this.get(0))-It.glog(e.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(var n=0;n<e.getLength();n++)r[n]^=It.gexp(It.glog(e.get(n))+t);return new Mr(r,0).mod(e)}};la.exports=Mr});var fa=ue((_p,ua)=>{ua.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var ma=ue((Cp,da)=>{var he=Lo(),pa=Co(),jl=_o(),pt=fa(),J={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;J.getBCHDigit(t)-J.getBCHDigit(J.G15)>=0;)t^=J.G15<<J.getBCHDigit(t)-J.getBCHDigit(J.G15);return(e<<10|t)^J.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;J.getBCHDigit(t)-J.getBCHDigit(J.G18)>=0;)t^=J.G18<<J.getBCHDigit(t)-J.getBCHDigit(J.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!==0;)t++,e>>>=1;return t},getPatternPosition:function(e){return J.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case pt.PATTERN000:return(t+r)%2===0;case pt.PATTERN001:return t%2===0;case pt.PATTERN010:return r%3===0;case pt.PATTERN011:return(t+r)%3===0;case pt.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case pt.PATTERN101:return t*r%2+t*r%3===0;case pt.PATTERN110:return(t*r%2+t*r%3)%2===0;case pt.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new pa([1],0),r=0;r<e;r++)t=t.multiply(new pa([1,jl.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case he.MODE_NUMBER:return 10;case he.MODE_ALPHA_NUM:return 9;case he.MODE_8BIT_BYTE:return 8;case he.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case he.MODE_NUMBER:return 12;case he.MODE_ALPHA_NUM:return 11;case he.MODE_8BIT_BYTE:return 16;case he.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case he.MODE_NUMBER:return 14;case he.MODE_ALPHA_NUM:return 13;case he.MODE_8BIT_BYTE:return 16;case he.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){var t=e.getModuleCount(),r=0,o=0,n=0;for(o=0;o<t;o++)for(n=0;n<t;n++){for(var i=0,s=e.isDark(o,n),a=-1;a<=1;a++)if(!(o+a<0||t<=o+a))for(var c=-1;c<=1;c++)n+c<0||t<=n+c||a===0&&c===0||s===e.isDark(o+a,n+c)&&i++;i>5&&(r+=3+i-5)}for(o=0;o<t-1;o++)for(n=0;n<t-1;n++){var l=0;e.isDark(o,n)&&l++,e.isDark(o+1,n)&&l++,e.isDark(o,n+1)&&l++,e.isDark(o+1,n+1)&&l++,(l===0||l===4)&&(r+=3)}for(o=0;o<t;o++)for(n=0;n<t-6;n++)e.isDark(o,n)&&!e.isDark(o,n+1)&&e.isDark(o,n+2)&&e.isDark(o,n+3)&&e.isDark(o,n+4)&&!e.isDark(o,n+5)&&e.isDark(o,n+6)&&(r+=40);for(n=0;n<t;n++)for(o=0;o<t-6;o++)e.isDark(o,n)&&!e.isDark(o+1,n)&&e.isDark(o+2,n)&&e.isDark(o+3,n)&&e.isDark(o+4,n)&&!e.isDark(o+5,n)&&e.isDark(o+6,n)&&(r+=40);var u=0;for(n=0;n<t;n++)for(o=0;o<t;o++)e.isDark(o,n)&&u++;var f=Math.abs(100*u/t/t-50)/5;return r+=f*10,r}};da.exports=J});var Mo=ue((Mp,ha)=>{ha.exports={L:1,M:0,Q:3,H:2}});var ya=ue(($p,ga)=>{var $r=Mo();function Me(e,t){this.totalCount=e,this.dataCount=t}Me.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Me.getRSBlocks=function(e,t){var r=Me.getRsBlockTable(e,t);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var o=r.length/3,n=[],i=0;i<o;i++)for(var s=r[i*3+0],a=r[i*3+1],c=r[i*3+2],l=0;l<s;l++)n.push(new Me(a,c));return n};Me.getRsBlockTable=function(e,t){switch(t){case $r.L:return Me.RS_BLOCK_TABLE[(e-1)*4+0];case $r.M:return Me.RS_BLOCK_TABLE[(e-1)*4+1];case $r.Q:return Me.RS_BLOCK_TABLE[(e-1)*4+2];case $r.H:return Me.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};ga.exports=Me});var Ea=ue((Np,va)=>{function wa(){this.buffer=[],this.length=0}wa.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};va.exports=wa});var ba=ue((Dp,Aa)=>{var Gl=aa(),dt=ma(),Vl=Co(),Sa=ya(),Ta=Ea();function $e(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}$e.prototype={addData:function(e){var t=new Gl(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=Sa.getRSBlocks(e,this.errorCorrectLevel),r=new Ta,o=0,n=0;n<t.length;n++)o+=t[n].dataCount;for(var i=0;i<this.dataList.length;i++){var s=this.dataList[i];r.put(s.mode,4),r.put(s.getLength(),dt.getLengthInBits(s.mode,e)),s.write(r)}if(r.getLengthInBits()<=o*8)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache===null&&(this.dataCache=$e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var o=-1;o<=7;o++)t+o<=-1||this.moduleCount<=t+o||(0<=r&&r<=6&&(o===0||o===6)||0<=o&&o<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=o&&o<=4?this.modules[e+r][t+o]=!0:this.modules[e+r][t+o]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=dt.getLostPoint(this);(r===0||e>o)&&(e=o,t=r)}return t},createMovieClip:function(e,t,r){var o=e.createEmptyMovieClip(t,r),n=1;this.make();for(var i=0;i<this.modules.length;i++)for(var s=i*n,a=0;a<this.modules[i].length;a++){var c=a*n,l=this.modules[i][a];l&&(o.beginFill(0,100),o.moveTo(c,s),o.lineTo(c+n,s),o.lineTo(c+n,s+n),o.lineTo(c,s+n),o.endFill())}return o},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]===null&&(this.modules[e][6]=e%2===0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]===null&&(this.modules[6][t]=t%2===0)},setupPositionAdjustPattern:function(){for(var e=dt.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var o=e[t],n=e[r];if(this.modules[o][n]===null)for(var i=-2;i<=2;i++)for(var s=-2;s<=2;s++)Math.abs(i)===2||Math.abs(s)===2||i===0&&s===0?this.modules[o+i][n+s]=!0:this.modules[o+i][n+s]=!1}},setupTypeNumber:function(e){for(var t=dt.getBCHTypeNumber(this.typeNumber),r,o=0;o<18;o++)r=!e&&(t>>o&1)===1,this.modules[Math.floor(o/3)][o%3+this.moduleCount-8-3]=r;for(var n=0;n<18;n++)r=!e&&(t>>n&1)===1,this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,o=dt.getBCHTypeInfo(r),n,i=0;i<15;i++)n=!e&&(o>>i&1)===1,i<6?this.modules[i][8]=n:i<8?this.modules[i+1][8]=n:this.modules[this.moduleCount-15+i][8]=n;for(var s=0;s<15;s++)n=!e&&(o>>s&1)===1,s<8?this.modules[8][this.moduleCount-s-1]=n:s<9?this.modules[8][15-s-1+1]=n:this.modules[8][15-s-1]=n;this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,o=this.moduleCount-1,n=7,i=0,s=this.moduleCount-1;s>0;s-=2)for(s===6&&s--;;){for(var a=0;a<2;a++)if(this.modules[o][s-a]===null){var c=!1;i<e.length&&(c=(e[i]>>>n&1)===1);var l=dt.getMask(t,o,s-a);l&&(c=!c),this.modules[o][s-a]=c,n--,n===-1&&(i++,n=7)}if(o+=r,o<0||this.moduleCount<=o){o-=r,r=-r;break}}}};$e.PAD0=236;$e.PAD1=17;$e.createData=function(e,t,r){for(var o=Sa.getRSBlocks(e,t),n=new Ta,i=0;i<r.length;i++){var s=r[i];n.put(s.mode,4),n.put(s.getLength(),dt.getLengthInBits(s.mode,e)),s.write(n)}for(var a=0,c=0;c<o.length;c++)a+=o[c].dataCount;if(n.getLengthInBits()>a*8)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+a*8+")");for(n.getLengthInBits()+4<=a*8&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(!1);for(;!(n.getLengthInBits()>=a*8||(n.put($e.PAD0,8),n.getLengthInBits()>=a*8));)n.put($e.PAD1,8);return $e.createBytes(n,o)};$e.createBytes=function(e,t){for(var r=0,o=0,n=0,i=new Array(t.length),s=new Array(t.length),a=0;a<t.length;a++){var c=t[a].dataCount,l=t[a].totalCount-c;o=Math.max(o,c),n=Math.max(n,l),i[a]=new Array(c);for(var u=0;u<i[a].length;u++)i[a][u]=255&e.buffer[u+r];r+=c;var f=dt.getErrorCorrectPolynomial(l),p=new Vl(i[a],f.getLength()-1),d=p.mod(f);s[a]=new Array(f.getLength()-1);for(var h=0;h<s[a].length;h++){var w=h+d.getLength()-s[a].length;s[a][h]=w>=0?d.get(w):0}}for(var T=0,I=0;I<t.length;I++)T+=t[I].totalCount;for(var A=new Array(T),P=0,g=0;g<o;g++)for(var b=0;b<t.length;b++)g<i[b].length&&(A[P++]=i[b][g]);for(var S=0;S<n;S++)for(var O=0;O<t.length;O++)S<s[O].length&&(A[P++]=s[O][S]);return A};Aa.exports=$e});var Pa=ue((Bp,Ra)=>{var Yl=ba(),xa=Mo(),Xl="\x1B[40m \x1B[0m",Nr="\x1B[47m \x1B[0m",Ql=function(e){return e?Xl:Nr},$o=function(e){return{times:function(t){return new Array(t).join(e)}}},ql=function(e,t){for(var r=new Array(e),o=0;o<e;o++)r[o]=t;return r};Ra.exports={error:xa.L,generate:function(e,t,r){typeof t=="function"&&(r=t,t={});var o=new Yl(-1,this.error);o.addData(e),o.make();var n="";if(t&&t.small){var i=!0,s=!1,a=o.getModuleCount(),c=o.modules.slice(),l=a%2===1;l&&c.push(ql(a,s));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},f=$o(u.BLACK_WHITE).times(a+3),p=$o(u.WHITE_BLACK).times(a+3);n+=f+`
|
|
6
|
+
Right-click to open / quit`}function Vs(){let{port:e,tunnelUrl:t}=pn,r=process.platform==="win32",o=t?`9Remote (Port ${e}) \u2022 Tunnel ON`:`9Remote (Port ${e}) \u2022 Local only`;return{icon:Ll(),title:r?`9Remote - Port ${e}`:"",tooltip:Gs(),items:[{title:o,tooltip:t||`http://localhost:${e}`,checked:!1,enabled:!1},{title:"Open Web UI",tooltip:`Open http://localhost:${e} in your browser`,checked:!1,enabled:!0},{title:"Shutdown",tooltip:"Stop 9Remote server, tunnel and quit",checked:!1,enabled:!0}]}}function Ml(){try{let e=require($e.default.join(Ws,"systray2"));return e.default?.default||e.default||e}catch{return null}}function $l({port:e,onQuit:t,onOpenUI:r}){let o=Us(js),n=Us(_l);if(!o||!n)return null;let i;try{i=(0,Xe.spawn)("powershell.exe",["-NoProfile","-ExecutionPolicy","Bypass","-WindowStyle","Hidden","-InputFormat","Text","-OutputFormat","Text","-File",n,"-IconPath",o,"-Tooltip",`9Remote - Port ${e}`],{windowsHide:!0,stdio:["pipe","pipe","pipe"]})}catch{return null}let s=c=>{try{i.stdin.writable&&i.stdin.write(`${JSON.stringify(c)}
|
|
7
|
+
`,"utf8")}catch{}};return Fs.default.createInterface({input:i.stdout}).on("line",c=>{try{let l=JSON.parse(c);if(l.type!=="click")return;l.index===0?r?.():l.index===1&&(t?.(),Pt(),setTimeout(()=>process.exit(0),500))}catch{}}),i.on("error",()=>{}),i.stderr.on("data",()=>{}),["Open Web UI","Shutdown"].forEach((c,l)=>s({action:"add-item",index:l,title:c,enabled:!0})),{_isWin:!0,_setTooltip(c){s({action:"set-tooltip",text:c})},sendAction(){},kill(){try{s({action:"kill"})}catch{}setTimeout(()=>{try{i&&!i.killed&&i.kill()}catch{}},300)}}}async function Zn({port:e,onQuit:t,onOpenUI:r}){if(!Cl())return null;if(process.platform==="win32")return pn={port:e,tunnelUrl:"",running:!0},ne=$l({port:e,onQuit:t,onOpenUI:r}),ne;try{let o=Ml();if(!o)return null;let i={darwin:"tray_darwin_release",win32:"tray_windows_release.exe",linux:"tray_linux_release"}[process.platform];if(!i)return null;let s=$e.default.join(Ws,"systray2","traybin",i);if(!fn.default.existsSync(s))return null;if(process.platform!=="win32")try{fn.default.chmodSync(s,493)}catch{}if(pn={port:e,tunnelUrl:"",running:!0},ne=new o({menu:Vs(),debug:!1,copyDir:!0}),ne.onClick(a=>{let c=a.item?.title||a.item;c==="Open Web UI"?r?.():c==="Shutdown"&&(t?.(),Pt(),setTimeout(()=>process.exit(0),500))}),typeof ne.ready=="function")try{await ne.ready()}catch{return ne=null,null}else ne.onReady(()=>{}),ne.onError(()=>{});return ne}catch{return null}}function dn({tunnelUrl:e,running:t}={}){if(e!==void 0&&(pn.tunnelUrl=e),t!==void 0&&(pn.running=t),!!ne){if(ne._isWin){ne._setTooltip?.(Gs());return}try{ne.sendAction({type:"update-menu",menu:Vs(),seq_id:-1})?.catch?.(()=>{})}catch{}}}function Pt(){let e=ne;if(ne=null,e)try{e.kill(!0)}catch{}}function _o({title:e="9Remote",message:t}){let r=process.platform;if(t){if(r==="win32"){let o=c=>String(c).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),n=c=>String(c).replace(/'/g,"''"),i="9Remote",s=`<toast><visual><binding template="ToastText02"><text id="1">${o(e)}</text><text id="2">${o(t)}</text></binding></visual></toast>`,a=["try {","[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType=WindowsRuntime] > $null;","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType=WindowsRuntime] > $null;","$xml = New-Object Windows.Data.Xml.Dom.XmlDocument;",`$xml.LoadXml('${n(s)}');`,"$toast = [Windows.UI.Notifications.ToastNotification]::new($xml);",`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${n(i)}').Show($toast);`,"} catch {","Add-Type -AssemblyName System.Windows.Forms;","$n = New-Object System.Windows.Forms.NotifyIcon;","$n.Icon = [System.Drawing.SystemIcons]::Information;",`$n.BalloonTipTitle = '${n(e)}';`,`$n.BalloonTipText = '${n(t)}';`,"$n.Visible = $true;","$n.ShowBalloonTip(5000);","Start-Sleep -Seconds 6;","$n.Dispose();","}"].join(" ");try{(0,Xe.spawn)("powershell.exe",["-NoProfile","-WindowStyle","Hidden","-Command",a],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(r==="darwin"){try{let o=s=>String(s).replace(/"/g,'\\"'),n=`display notification "${o(t)}" with title "${o(e)}"`;(0,Xe.spawn)("osascript",["-e",n],{detached:!0,stdio:"ignore"}).unref()}catch{}return}try{(0,Xe.spawn)("notify-send",[e,t],{detached:!0,stdio:"ignore"}).unref()}catch{}}}function kt(e){let t=process.platform;if(t==="win32"){try{(0,Xe.spawn)("rundll32.exe",["url.dll,FileProtocolHandler",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref();return}catch{}try{(0,Xe.spawn)("cmd.exe",["/d","/s","/c","start","",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(t==="darwin"){try{(0,Xe.spawn)("open",[e],{detached:!0,stdio:"ignore"}).unref()}catch{}return}let r=[["setsid",["--fork","xdg-open",e]],["setsid",["xdg-open",e]],["xdg-open",[e]],["gio",["open",e]],["sensible-browser",[e]],["x-www-browser",[e]]];for(let[o,n]of r)try{(0,Xe.spawn)(o,n,{detached:!0,stdio:"ignore",env:{...process.env}}).unref();return}catch{}}var Xe,Fs,fn,$e,Ks,Hs,Ws,ne,pn,Nr,Bs,js,_l,Ot=Za(()=>{Xe=require("child_process"),Fs=R(require("readline"),1),fn=R(require("fs"),1),$e=R(require("path"),1),Ks=R(require("os"),1),Hs=require("url"),Ws=(0,$e.join)(Ks.default.homedir(),".9remote","runtime","node_modules"),ne=null,pn={port:0,tunnelUrl:"",running:!1},Nr=$e.default.dirname((0,Hs.fileURLToPath)(__importMetaUrl)),Bs="iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAHhlWElmTU0AKgAAAAgABAEaAAUAAAABAA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.join(Nr,"..","assets","trayIcon.ico")],_l=[$e.default.join(Nr,"assets","tray.ps1"),$e.default.join(Nr,"..","assets","tray.ps1")]});var Fo=de((_p,la)=>{la.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var pa=de((Lp,fa)=>{var Vl=Fo();function ua(e){this.mode=Vl.MODE_8BIT_BYTE,this.data=e}ua.prototype={getLength:function(){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}};fa.exports=ua});var Ko=de((Cp,da)=>{var xe={glog:function(e){if(e<1)throw new Error("glog("+e+")");return xe.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return xe.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(j=0;j<8;j++)xe.EXP_TABLE[j]=1<<j;var j;for(j=8;j<256;j++)xe.EXP_TABLE[j]=xe.EXP_TABLE[j-4]^xe.EXP_TABLE[j-5]^xe.EXP_TABLE[j-6]^xe.EXP_TABLE[j-8];var j;for(j=0;j<255;j++)xe.LOG_TABLE[xe.EXP_TABLE[j]]=j;var j;da.exports=xe});var Ho=de((Mp,ma)=>{var Mt=Ko();function Kr(e,t){if(e.length===void 0)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&e[r]===0;)r++;this.num=new Array(e.length-r+t);for(var o=0;o<e.length-r;o++)this.num[o]=e[o+r]}Kr.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<e.getLength();o++)t[r+o]^=Mt.gexp(Mt.glog(this.get(r))+Mt.glog(e.get(o)));return new Kr(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=Mt.glog(this.get(0))-Mt.glog(e.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(var n=0;n<e.getLength();n++)r[n]^=Mt.gexp(Mt.glog(e.get(n))+t);return new Kr(r,0).mod(e)}};ma.exports=Kr});var ga=de(($p,ha)=>{ha.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var va=de((Np,wa)=>{var ye=Fo(),ya=Ho(),Yl=Ko(),ht=ga(),z={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;z.getBCHDigit(t)-z.getBCHDigit(z.G15)>=0;)t^=z.G15<<z.getBCHDigit(t)-z.getBCHDigit(z.G15);return(e<<10|t)^z.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;z.getBCHDigit(t)-z.getBCHDigit(z.G18)>=0;)t^=z.G18<<z.getBCHDigit(t)-z.getBCHDigit(z.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!==0;)t++,e>>>=1;return t},getPatternPosition:function(e){return z.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case ht.PATTERN000:return(t+r)%2===0;case ht.PATTERN001:return t%2===0;case ht.PATTERN010:return r%3===0;case ht.PATTERN011:return(t+r)%3===0;case ht.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case ht.PATTERN101:return t*r%2+t*r%3===0;case ht.PATTERN110:return(t*r%2+t*r%3)%2===0;case ht.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new ya([1],0),r=0;r<e;r++)t=t.multiply(new ya([1,Yl.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case ye.MODE_NUMBER:return 10;case ye.MODE_ALPHA_NUM:return 9;case ye.MODE_8BIT_BYTE:return 8;case ye.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case ye.MODE_NUMBER:return 12;case ye.MODE_ALPHA_NUM:return 11;case ye.MODE_8BIT_BYTE:return 16;case ye.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case ye.MODE_NUMBER:return 14;case ye.MODE_ALPHA_NUM:return 13;case ye.MODE_8BIT_BYTE:return 16;case ye.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){var t=e.getModuleCount(),r=0,o=0,n=0;for(o=0;o<t;o++)for(n=0;n<t;n++){for(var i=0,s=e.isDark(o,n),a=-1;a<=1;a++)if(!(o+a<0||t<=o+a))for(var c=-1;c<=1;c++)n+c<0||t<=n+c||a===0&&c===0||s===e.isDark(o+a,n+c)&&i++;i>5&&(r+=3+i-5)}for(o=0;o<t-1;o++)for(n=0;n<t-1;n++){var l=0;e.isDark(o,n)&&l++,e.isDark(o+1,n)&&l++,e.isDark(o,n+1)&&l++,e.isDark(o+1,n+1)&&l++,(l===0||l===4)&&(r+=3)}for(o=0;o<t;o++)for(n=0;n<t-6;n++)e.isDark(o,n)&&!e.isDark(o,n+1)&&e.isDark(o,n+2)&&e.isDark(o,n+3)&&e.isDark(o,n+4)&&!e.isDark(o,n+5)&&e.isDark(o,n+6)&&(r+=40);for(n=0;n<t;n++)for(o=0;o<t-6;o++)e.isDark(o,n)&&!e.isDark(o+1,n)&&e.isDark(o+2,n)&&e.isDark(o+3,n)&&e.isDark(o+4,n)&&!e.isDark(o+5,n)&&e.isDark(o+6,n)&&(r+=40);var u=0;for(n=0;n<t;n++)for(o=0;o<t;o++)e.isDark(o,n)&&u++;var f=Math.abs(100*u/t/t-50)/5;return r+=f*10,r}};wa.exports=z});var Wo=de((Dp,Ea)=>{Ea.exports={L:1,M:0,Q:3,H:2}});var Ta=de((Bp,Sa)=>{var Hr=Wo();function Ne(e,t){this.totalCount=e,this.dataCount=t}Ne.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Ne.getRSBlocks=function(e,t){var r=Ne.getRsBlockTable(e,t);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var o=r.length/3,n=[],i=0;i<o;i++)for(var s=r[i*3+0],a=r[i*3+1],c=r[i*3+2],l=0;l<s;l++)n.push(new Ne(a,c));return n};Ne.getRsBlockTable=function(e,t){switch(t){case Hr.L:return Ne.RS_BLOCK_TABLE[(e-1)*4+0];case Hr.M:return Ne.RS_BLOCK_TABLE[(e-1)*4+1];case Hr.Q:return Ne.RS_BLOCK_TABLE[(e-1)*4+2];case Hr.H:return Ne.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};Sa.exports=Ne});var xa=de((Up,Aa)=>{function ba(){this.buffer=[],this.length=0}ba.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};Aa.exports=ba});var Oa=de((Fp,ka)=>{var Xl=pa(),gt=va(),ql=Ho(),Ra=Ta(),Pa=xa();function De(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}De.prototype={addData:function(e){var t=new Xl(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=Ra.getRSBlocks(e,this.errorCorrectLevel),r=new Pa,o=0,n=0;n<t.length;n++)o+=t[n].dataCount;for(var i=0;i<this.dataList.length;i++){var s=this.dataList[i];r.put(s.mode,4),r.put(s.getLength(),gt.getLengthInBits(s.mode,e)),s.write(r)}if(r.getLengthInBits()<=o*8)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache===null&&(this.dataCache=De.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var o=-1;o<=7;o++)t+o<=-1||this.moduleCount<=t+o||(0<=r&&r<=6&&(o===0||o===6)||0<=o&&o<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=o&&o<=4?this.modules[e+r][t+o]=!0:this.modules[e+r][t+o]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=gt.getLostPoint(this);(r===0||e>o)&&(e=o,t=r)}return t},createMovieClip:function(e,t,r){var o=e.createEmptyMovieClip(t,r),n=1;this.make();for(var i=0;i<this.modules.length;i++)for(var s=i*n,a=0;a<this.modules[i].length;a++){var c=a*n,l=this.modules[i][a];l&&(o.beginFill(0,100),o.moveTo(c,s),o.lineTo(c+n,s),o.lineTo(c+n,s+n),o.lineTo(c,s+n),o.endFill())}return o},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]===null&&(this.modules[e][6]=e%2===0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]===null&&(this.modules[6][t]=t%2===0)},setupPositionAdjustPattern:function(){for(var e=gt.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var o=e[t],n=e[r];if(this.modules[o][n]===null)for(var i=-2;i<=2;i++)for(var s=-2;s<=2;s++)Math.abs(i)===2||Math.abs(s)===2||i===0&&s===0?this.modules[o+i][n+s]=!0:this.modules[o+i][n+s]=!1}},setupTypeNumber:function(e){for(var t=gt.getBCHTypeNumber(this.typeNumber),r,o=0;o<18;o++)r=!e&&(t>>o&1)===1,this.modules[Math.floor(o/3)][o%3+this.moduleCount-8-3]=r;for(var n=0;n<18;n++)r=!e&&(t>>n&1)===1,this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,o=gt.getBCHTypeInfo(r),n,i=0;i<15;i++)n=!e&&(o>>i&1)===1,i<6?this.modules[i][8]=n:i<8?this.modules[i+1][8]=n:this.modules[this.moduleCount-15+i][8]=n;for(var s=0;s<15;s++)n=!e&&(o>>s&1)===1,s<8?this.modules[8][this.moduleCount-s-1]=n:s<9?this.modules[8][15-s-1+1]=n:this.modules[8][15-s-1]=n;this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,o=this.moduleCount-1,n=7,i=0,s=this.moduleCount-1;s>0;s-=2)for(s===6&&s--;;){for(var a=0;a<2;a++)if(this.modules[o][s-a]===null){var c=!1;i<e.length&&(c=(e[i]>>>n&1)===1);var l=gt.getMask(t,o,s-a);l&&(c=!c),this.modules[o][s-a]=c,n--,n===-1&&(i++,n=7)}if(o+=r,o<0||this.moduleCount<=o){o-=r,r=-r;break}}}};De.PAD0=236;De.PAD1=17;De.createData=function(e,t,r){for(var o=Ra.getRSBlocks(e,t),n=new Pa,i=0;i<r.length;i++){var s=r[i];n.put(s.mode,4),n.put(s.getLength(),gt.getLengthInBits(s.mode,e)),s.write(n)}for(var a=0,c=0;c<o.length;c++)a+=o[c].dataCount;if(n.getLengthInBits()>a*8)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+a*8+")");for(n.getLengthInBits()+4<=a*8&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(!1);for(;!(n.getLengthInBits()>=a*8||(n.put(De.PAD0,8),n.getLengthInBits()>=a*8));)n.put(De.PAD1,8);return De.createBytes(n,o)};De.createBytes=function(e,t){for(var r=0,o=0,n=0,i=new Array(t.length),s=new Array(t.length),a=0;a<t.length;a++){var c=t[a].dataCount,l=t[a].totalCount-c;o=Math.max(o,c),n=Math.max(n,l),i[a]=new Array(c);for(var u=0;u<i[a].length;u++)i[a][u]=255&e.buffer[u+r];r+=c;var f=gt.getErrorCorrectPolynomial(l),p=new ql(i[a],f.getLength()-1),d=p.mod(f);s[a]=new Array(f.getLength()-1);for(var h=0;h<s[a].length;h++){var w=h+d.getLength()-s[a].length;s[a][h]=w>=0?d.get(w):0}}for(var E=0,O=0;O<t.length;O++)E+=t[O].totalCount;for(var T=new Array(E),A=0,P=0;P<o;P++)for(var M=0;M<t.length;M++)P<i[M].length&&(T[A++]=i[M][P]);for(var g=0;g<n;g++)for(var b=0;b<t.length;b++)g<s[b].length&&(T[A++]=s[b][g]);return T};ka.exports=De});var La=de((Kp,_a)=>{var Ql=Oa(),Ia=Wo(),Jl="\x1B[40m \x1B[0m",Wr="\x1B[47m \x1B[0m",Zl=function(e){return e?Jl:Wr},jo=function(e){return{times:function(t){return new Array(t).join(e)}}},zl=function(e,t){for(var r=new Array(e),o=0;o<e;o++)r[o]=t;return r};_a.exports={error:Ia.L,generate:function(e,t,r){typeof t=="function"&&(r=t,t={});var o=new Ql(-1,this.error);o.addData(e),o.make();var n="";if(t&&t.small){var i=!0,s=!1,a=o.getModuleCount(),c=o.modules.slice(),l=a%2===1;l&&c.push(zl(a,s));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},f=jo(u.BLACK_WHITE).times(a+3),p=jo(u.WHITE_BLACK).times(a+3);n+=f+`
|
|
8
8
|
`;for(var d=0;d<a;d+=2){n+=u.WHITE_ALL;for(var h=0;h<a;h++)c[d][h]===s&&c[d+1][h]===s?n+=u.WHITE_ALL:c[d][h]===s&&c[d+1][h]===i?n+=u.WHITE_BLACK:c[d][h]===i&&c[d+1][h]===s?n+=u.BLACK_WHITE:n+=u.BLACK_ALL;n+=u.WHITE_ALL+`
|
|
9
|
-
`}l||(n+=p)}else{var w
|
|
10
|
-
`,o.modules.forEach(function(
|
|
11
|
-
`}),n+=w}r?r(n):console.log(n)},setErrorLevel:function(e){this.error=
|
|
12
|
-
`)){let r=t.trim();if(!r||r.startsWith("#"))continue;let o=r.match(/^([A-Z_][A-Z0-9_]*)\s*=\s*"?(.*?)"?$/);o&&!process.env[o[1]]&&(process.env[o[1]]=o[2])}}for(let e of
|
|
13
|
-
`)}catch{}}function
|
|
14
|
-
=== SESSION ${new Date().toISOString()} pid=${process.pid} argv=${process.argv.slice(2).join(" ")} ===`),
|
|
15
|
-
`).filter(Boolean).slice(-e)}catch{return[]}}var
|
|
9
|
+
`}l||(n+=p)}else{var w=jo(Wr).times(o.getModuleCount()+3);n+=w+`
|
|
10
|
+
`,o.modules.forEach(function(E){n+=Wr,n+=E.map(Zl).join(""),n+=Wr+`
|
|
11
|
+
`}),n+=w}r?r(n):console.log(n)},setErrorLevel:function(e){this.error=Ia[e]||this.error}}});var lr=require("fs"),Pn=require("path"),oi=require("url"),ii=R(require("os"),1);var cr=R(require("dns"),1),Ee=R(require("path"),1),Jo=R(require("os"),1),se="9remote",Xr=process.env.NREMOTE_REGISTRY||`https://registry.npmjs.org/${se}/latest`,Ue=`${se}@latest`,Pe=process.env.NREMOTE_HOME||Ee.default.join(Jo.default.homedir(),".9remote"),G={ROOT:Pe,LOGS:Ee.default.join(Pe,"logs"),STATE:Ee.default.join(Pe,"state"),CONFIG:Ee.default.join(Pe,"config"),BIN:Ee.default.join(Pe,"bin"),PIDS:Ee.default.join(Pe,"pids"),BUFFERS:Ee.default.join(Pe,"buffers"),DAEMON:Ee.default.join(Pe,"daemon"),AI_SESSIONS:Ee.default.join(Pe,"ai-sessions"),BACKGROUNDS:Ee.default.join(Pe,"backgrounds")},xn=new cr.default.promises.Resolver;xn.setServers(["1.1.1.1","1.0.0.1","8.8.8.8"]);var Yr=cr.default.lookup,tc=/^(\d{1,3}\.){3}\d{1,3}$|^::1$|^[0-9a-f:]+$/i;cr.default.lookup=(e,t,r)=>{if(typeof t=="function"&&(r=t,t={}),e==="localhost"||tc.test(e))return Yr(e,t,r);(async()=>{if(t.family===6)return{addrs:await xn.resolve6(e),family:6};if(t.family===4)return{addrs:await xn.resolve4(e),family:4};let[n,i]=await Promise.allSettled([xn.resolve4(e),xn.resolve6(e)]);return n.status==="fulfilled"&&n.value?.length?{addrs:n.value,family:4}:i.status==="fulfilled"&&i.value?.length?{addrs:i.value,family:6}:null})().then(n=>{if(!n?.addrs?.length)return Yr(e,t,r);t.all?r(null,n.addrs.map(i=>({address:i,family:n.family}))):r(null,n.addrs[0],n.family)}).catch(()=>Yr(e,t,r))};var k=2208,Zo=process.execPath,zo=(e=process.env)=>process.versions.electron?{...e,ELECTRON_RUN_AS_NODE:"1"}:{...e};var qo=5173,Qo=3e3;var Eu=[`http://localhost:${k}`,`http://127.0.0.1:${k}`,`http://localhost:${qo}`,`http://127.0.0.1:${qo}`,`http://localhost:${Qo}`,`http://127.0.0.1:${Qo}`],Rn={fileName:"agent.log",rotatedName:"agent.log.1",maxBytes:2*1024*1024,cleanupAfterDays:7},ei=60,I={STOPPED:0,PREPARING:1,CONNECTING:2,TUNNELING:3,VERIFYING:4,READY:5},ti={showTunnelUrlInMenu:!1};var ni={CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN:"1"};var ri={checkIntervalMs:3e4,requestTimeoutMs:5e3},fe={server:{strategy:"exp",baseMs:1e3,maxMs:6e4},tunnelRestart:{strategy:"exp",baseMs:2e3,maxMs:3e5},tunnelSpawn:{strategy:"linear",baseMs:5e3,maxMs:6e4},tunnelRateLimit:{strategy:"exp",baseMs:6e4,maxMs:9e5},internet:{strategy:"linear",baseMs:3e3,maxMs:6e4},sse:{strategy:"linear",baseMs:2e3,maxMs:2e3},urlSync:{strategy:"linear",baseMs:5e3,maxMs:6e4}},nc={Accept:"application/json, text/plain, */*","Accept-Language":"en-US,en;q=0.9","Cache-Control":"no-cache",Pragma:"no-cache","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"};function K(e,t={}){return fetch(e,{...t,headers:{...nc,...t.headers}})}var rc=(0,Pn.dirname)((0,oi.fileURLToPath)(__importMetaUrl)),oc=[(0,Pn.join)(ii.default.homedir(),".9remote",".env"),(0,Pn.join)(rc,"..",".env")];function ic(e){for(let t of e.split(`
|
|
12
|
+
`)){let r=t.trim();if(!r||r.startsWith("#"))continue;let o=r.match(/^([A-Z_][A-Z0-9_]*)\s*=\s*"?(.*?)"?$/);o&&!process.env[o[1]]&&(process.env[o[1]]=o[2])}}for(let e of oc)if((0,lr.existsSync)(e))try{ic((0,lr.readFileSync)(e,"utf8"))}catch{}for(let[e,t]of Object.entries(ni))process.env[e]||(process.env[e]=t);var Zr=R(require("path"),1),wi=R(require("fs"),1),vi=require("url");var ai=R(si(),1),Qr=R(require("crypto"),1),{machineIdSync:sc}=ai.default;async function Ut(e=null){let t=e||process.env.MACHINE_ID_SALT||"9remote-salt";try{let r=sc();return Qr.default.createHash("sha256").update(r+t).digest("hex").substring(0,16)}catch(r){return console.error("Error getting machine ID:",r),Qr.default.randomUUID().replace(/-/g,"").substring(0,16)}}var ui=R(require("crypto"),1),Au=process.env.API_KEY_SECRET||process.env.APP_SECRET;var ci="abcdefghijklmnpqrstuvwxyz123456789",ac=8;function li(){let e="";for(let t=0;t<ac;t++)e+=ci[ui.default.randomInt(ci.length)];return e}function Ft(e){return`sk-${(e||"").slice(0,8).toLowerCase()}-${li()}-${li()}`}function cc(e){return/^sk-[a-z0-9]{8}-[a-np-z1-9]{8}-[a-np-z1-9]{8}$/.test(e||"")}function V(e){if(!cc(e))return e||null;let t=e.split("-");return`${t[0]}-${t[1]}-${t[2]}`}function ur(e){return!e||e.length<8?"sk-***":`${e.slice(0,3)}***${e.slice(-4)}`}var ae=R(require("fs"),1),In=R(require("path"),1);var pe=require("fs"),fi=require("path"),lc=0;function Fe(e,t,r={}){let{mode:o=384,spaces:n=2}=r;(0,pe.mkdirSync)((0,fi.dirname)(e),{recursive:!0});let i=`${e}.${process.pid}.${++lc}.tmp`;try{(0,pe.writeFileSync)(i,JSON.stringify(t,null,n),{mode:o}),(0,pe.renameSync)(i,e)}catch(s){try{(0,pe.existsSync)(i)&&(0,pe.unlinkSync)(i)}catch{}throw s}}function pi(e,t=null){try{return(0,pe.existsSync)(e)?JSON.parse((0,pe.readFileSync)(e,"utf8")):t}catch{return t}}var Ou=G.STATE,On=In.default.join(G.STATE,"state.json"),Jr=In.default.join(G.ROOT,"keys.json"),fr=In.default.join(G.STATE,"cmd.json"),di=In.default.join(G.STATE,"settings.json");function Kt(){for(let e of[G.ROOT,G.STATE])ae.default.existsSync(e)||ae.default.mkdirSync(e,{recursive:!0})}function mi(){try{return Kt(),ae.default.existsSync(On)?JSON.parse(ae.default.readFileSync(On,"utf8")):null}catch{return null}}function _n(e){try{Kt(),Fe(On,e)}catch(t){console.error("Error saving state:",t)}}function hi(){try{ae.default.existsSync(On)&&ae.default.unlinkSync(On)}catch{}}function X(){try{return Kt(),ae.default.existsSync(di)?JSON.parse(ae.default.readFileSync(di,"utf8"))||{}:{}}catch{return{}}}function pr(){try{return Kt(),ae.default.existsSync(Jr)?JSON.parse(ae.default.readFileSync(Jr,"utf8")):{machineId:null,key:null,name:"Default",createdAt:null}}catch{return{machineId:null,key:null,name:"Default",createdAt:null}}}function Ht(e){try{Kt(),Fe(fr,{cmd:e,ts:Date.now()},{spaces:0})}catch{}}function gi(){try{if(!ae.default.existsSync(fr))return null;let e=JSON.parse(ae.default.readFileSync(fr,"utf8"));return ae.default.unlinkSync(fr),e.cmd}catch{return null}}function Et(e,t,r="Default"){try{Kt();let o={machineId:e,key:t,name:r,createdAt:new Date().toISOString()};return Fe(Jr,o),o}catch(o){return console.error("Error saving key:",o),null}}function yi(){return process.env.CODESPACES==="true"}var uc=Zr.default.dirname((0,vi.fileURLToPath)(__importMetaUrl));async function nt(){let e=await Ut();if(yi()&&process.env.NREMOTE_API_KEY)return Et(e,process.env.NREMOTE_API_KEY,"Codespace");let t=pr();if(!t.key){let r=Ft(e);t=Et(e,r,"Default")}return t}function ke(){return"3.0.22"}var Oe=R(require("fs"),1),zr=R(require("path"),1);var mr=G.LOGS,Ln=zr.default.join(mr,Rn.fileName),hr=zr.default.join(mr,Rn.rotatedName),Ei=!1,Si=null;function fc(){Oe.default.existsSync(mr)||Oe.default.mkdirSync(mr,{recursive:!0})}function pc(){try{if(Oe.default.statSync(Ln).size<Rn.maxBytes)return;try{Oe.default.rmSync(hr,{force:!0})}catch{}Oe.default.renameSync(Ln,hr)}catch{}}function dc(){try{let e=Oe.default.statSync(hr);Date.now()-e.mtimeMs>Rn.cleanupAfterDays*864e5&&Oe.default.rmSync(hr,{force:!0})}catch{}}function eo(e){try{pc(),Oe.default.appendFileSync(Ln,e+`
|
|
13
|
+
`)}catch{}}function dr(e){return e.map(t=>{if(t instanceof Error)return t.stack||t.message;if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)}).join(" ")}function Ti(){let e=new Date,t=(r,o=2)=>String(r).padStart(o,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`}var mc=/\x1b\[[0-9;]*m/g,hc=/https?:\/\/[^\s]+/g;function gc(e){return String(e).replace(mc,"").replace(hc,"").replace(/\s+$/g,"")}function Wt(e,t,r){let o=gc(r);if(!o)return;let n=t==="info"?e:`${e}:${t}`,i=`${Ti()} [${n}] ${o}`;if(eo(i),Si)try{Si(i)}catch{}}function yc(){process.on("uncaughtException",e=>Wt("crash","error",`uncaughtException: ${e?.stack||e?.message||e}`)),process.on("unhandledRejection",e=>{let t=e instanceof Error?e.stack||e.message:String(e);Wt("crash","error",`unhandledRejection: ${t}`)}),process.on("exit",e=>eo(`${Ti()} [exit] code=${e} pid=${process.pid}`))}function bi(){Ei||(Ei=!0,fc(),dc(),eo(`
|
|
14
|
+
=== SESSION ${new Date().toISOString()} pid=${process.pid} argv=${process.argv.slice(2).join(" ")} ===`),yc())}function Ai(e=60){try{return Oe.default.readFileSync(Ln,"utf8").split(`
|
|
15
|
+
`).filter(Boolean).slice(-e)}catch{return[]}}var wc=process.env.NODE_ENV==="development"||process.env.AGENT_DEBUG==="1";function H(e){return{debug:(...t)=>{wc&&Wt(e,"debug",dr(t))},info:(...t)=>Wt(e,"info",dr(t)),warn:(...t)=>Wt(e,"warn",dr(t)),error:(...t)=>Wt(e,"error",dr(t))}}var Cn=Ln;var xi=(e=0)=>t=>`\x1B[${t+e}m`,Ri=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Pi=(e=0)=>(t,r,o)=>`\x1B[${38+e};2;${t};${r};${o}m`,B={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Uu=Object.keys(B.modifier),vc=Object.keys(B.color),Ec=Object.keys(B.bgColor),Fu=[...vc,...Ec];function Sc(){let e=new Map;for(let[t,r]of Object.entries(B)){for(let[o,n]of Object.entries(r))B[o]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[o]=B[o],e.set(n[0],n[1]);Object.defineProperty(B,t,{value:r,enumerable:!1})}return Object.defineProperty(B,"codes",{value:e,enumerable:!1}),B.color.close="\x1B[39m",B.bgColor.close="\x1B[49m",B.color.ansi=xi(),B.color.ansi256=Ri(),B.color.ansi16m=Pi(),B.bgColor.ansi=xi(10),B.bgColor.ansi256=Ri(10),B.bgColor.ansi16m=Pi(10),Object.defineProperties(B,{rgbToAnsi256:{value(t,r,o){return t===r&&r===o?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[o]=r;o.length===3&&(o=[...o].map(i=>i+i).join(""));let n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>B.rgbToAnsi256(...B.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,o,n;if(t>=232)r=((t-232)*10+8)/255,o=r,n=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,o=Math.floor(a/6)/5,n=a%6/5}let i=Math.max(r,o,n)*2;if(i===0)return 30;let s=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,o)=>B.ansi256ToAnsi(B.rgbToAnsi256(t,r,o)),enumerable:!1},hexToAnsi:{value:t=>B.ansi256ToAnsi(B.hexToAnsi256(t)),enumerable:!1}}),B}var Tc=Sc(),Se=Tc;var yr=R(require("node:process"),1),Oi=R(require("node:os"),1),to=R(require("node:tty"),1);function me(e,t=globalThis.Deno?globalThis.Deno.args:yr.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",o=t.indexOf(r+e),n=t.indexOf("--");return o!==-1&&(n===-1||o<n)}var{env:U}=yr.default,gr;me("no-color")||me("no-colors")||me("color=false")||me("color=never")?gr=0:(me("color")||me("colors")||me("color=true")||me("color=always"))&&(gr=1);function bc(){if("FORCE_COLOR"in U)return U.FORCE_COLOR==="true"?1:U.FORCE_COLOR==="false"?0:U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}function Ac(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function xc(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let o=bc();o!==void 0&&(gr=o);let n=r?gr:o;if(n===0)return 0;if(r){if(me("color=16m")||me("color=full")||me("color=truecolor"))return 3;if(me("color=256"))return 2}if("TF_BUILD"in U&&"AGENT_NAME"in U)return 1;if(e&&!t&&n===void 0)return 0;let i=n||0;if(U.TERM==="dumb")return i;if(yr.default.platform==="win32"){let s=Oi.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in U)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in U)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in U)||U.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor"||U.TERM==="xterm-kitty"||U.TERM==="xterm-ghostty"||U.TERM==="wezterm")return 3;if("TERM_PROGRAM"in U){let s=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(U.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM)||"COLORTERM"in U?1:i}function ki(e,t={}){let r=xc(e,{streamIsTTY:e&&e.isTTY,...t});return Ac(r)}var Rc={stdout:ki({isTTY:to.default.isatty(1)}),stderr:ki({isTTY:to.default.isatty(2)})},Ii=Rc;function _i(e,t,r){let o=e.indexOf(t);if(o===-1)return e;let n=t.length,i=0,s="";do s+=e.slice(i,o)+t+r,i=o+n,o=e.indexOf(t,i);while(o!==-1);return s+=e.slice(i),s}function Li(e,t,r,o){let n=0,i="";do{let s=e[o-1]==="\r";i+=e.slice(n,s?o-1:o)+t+(s?`\r
|
|
16
16
|
`:`
|
|
17
17
|
`)+r,n=o+1,o=e.indexOf(`
|
|
18
|
-
`,n)}while(o!==-1);return i+=e.slice(n),i}var{stdout:
|
|
19
|
-
`);return i!==-1&&(t=
|
|
20
|
-
`),(0,
|
|
18
|
+
`,n)}while(o!==-1);return i+=e.slice(n),i}var{stdout:Ci,stderr:Mi}=Ii,no=Symbol("GENERATOR"),jt=Symbol("STYLER"),Mn=Symbol("IS_EMPTY"),$i=["ansi","ansi","ansi256","ansi16m"],Gt=Object.create(null),Pc=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Ci?Ci.level:0;e.level=t.level===void 0?r:t.level};var kc=e=>{let t=(...r)=>r.join(" ");return Pc(t,e),Object.setPrototypeOf(t,$n.prototype),t};function $n(e){return kc(e)}Object.setPrototypeOf($n.prototype,Function.prototype);for(let[e,t]of Object.entries(Se))Gt[e]={get(){let r=wr(this,oo(t.open,t.close,this[jt]),this[Mn]);return Object.defineProperty(this,e,{value:r}),r}};Gt.visible={get(){let e=wr(this,this[jt],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var ro=(e,t,r,...o)=>e==="rgb"?t==="ansi16m"?Se[r].ansi16m(...o):t==="ansi256"?Se[r].ansi256(Se.rgbToAnsi256(...o)):Se[r].ansi(Se.rgbToAnsi(...o)):e==="hex"?ro("rgb",t,r,...Se.hexToRgb(...o)):Se[r][e](...o),Oc=["rgb","hex","ansi256"];for(let e of Oc){Gt[e]={get(){let{level:r}=this;return function(...o){let n=oo(ro(e,$i[r],"color",...o),Se.color.close,this[jt]);return wr(this,n,this[Mn])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);Gt[t]={get(){let{level:r}=this;return function(...o){let n=oo(ro(e,$i[r],"bgColor",...o),Se.bgColor.close,this[jt]);return wr(this,n,this[Mn])}}}}var Ic=Object.defineProperties(()=>{},{...Gt,level:{enumerable:!0,get(){return this[no].level},set(e){this[no].level=e}}}),oo=(e,t,r)=>{let o,n;return r===void 0?(o=e,n=t):(o=r.openAll+e,n=t+r.closeAll),{open:e,close:t,openAll:o,closeAll:n,parent:r}},wr=(e,t,r)=>{let o=(...n)=>_c(o,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(o,Ic),o[no]=e,o[jt]=t,o[Mn]=r,o},_c=(e,t)=>{if(e.level<=0||!t)return e[Mn]?"":t;let r=e[jt];if(r===void 0)return t;let{openAll:o,closeAll:n}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=_i(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
|
|
19
|
+
`);return i!==-1&&(t=Li(t,n,o,i)),o+t+n};Object.defineProperties($n.prototype,Gt);var Lc=$n(),Yu=$n({level:Mi?Mi.level:0});var m=Lc;var Q=require("fs"),Zi=require("url"),Bn=require("child_process"),Le=R(require("path"),1),Xt=R(require("os"),1);var Vt=R(require("fs"),1),io=R(require("path"),1),Ni=R(require("os"),1),Di=require("child_process"),vr=io.default.join(Ni.default.homedir(),".9remote","pids");function Cc(){try{Vt.default.existsSync(vr)||Vt.default.mkdirSync(vr,{recursive:!0})}catch{}}function so(e){return io.default.join(vr,`${e}.pid`)}function Ie(e,t){if(t)try{Cc(),Vt.default.writeFileSync(so(e),String(t))}catch{}}function Nn(e){try{let t=Vt.default.readFileSync(so(e),"utf8").trim(),r=parseInt(t,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function Ke(e){try{Vt.default.unlinkSync(so(e))}catch{}}function ao(e){if(!e)return!1;try{return process.kill(e,0),!0}catch{return!1}}function Mc(e){let t=Nn(e);if(Ke(e),!t)return!1;try{process.platform==="win32"?(0,Di.execSync)(`taskkill /F /T /PID ${t}`,{stdio:"ignore",windowsHide:!0}):process.kill(t,"SIGKILL")}catch{}return!0}var $c=["cloudflared","agent"];function Bi(){for(let e of $c)Mc(e)}function Ui(){return vr}var bt=require("child_process"),N=require("fs"),St=require("path"),lo=R(require("os"),1),Tt=R(require("path"),1),Ki=require("url");var Sr=(0,St.join)(G.LOGS,"autostart.log"),Er="cc.9remote.agent",Tr="9Remote",br=["--tray","--skip-update","--start"],Dn=lo.default.homedir(),Fi=Tt.default.dirname((0,Ki.fileURLToPath)(__importMetaUrl)),te={darwin:(0,St.join)(Dn,"Library","LaunchAgents",`${Er}.plist`),linux:(0,St.join)(Dn,".config","autostart",`${Er}.desktop`),linuxSystemd:(0,St.join)(Dn,".config","systemd","user",`${Er}.service`),win:(0,St.join)(process.env.APPDATA||"","Microsoft","Windows","Start Menu","Programs","Startup",`${Tr}.vbs`)};function rt(){for(let e=Fi,t=null;e!==t;t=e,e=Tt.default.dirname(e)){let r=Tt.default.join(e,"package.json");if((0,N.existsSync)(r)){try{let o=JSON.parse((0,N.readFileSync)(r,"utf8"));if(o.name!==se)continue;let n=typeof o.bin=="string"?o.bin:o.bin?.[se];if(n){let i=Tt.default.resolve(e,n);if((0,N.existsSync)(i))return i}}catch{}break}}return process.argv[1]||Tt.default.resolve(Fi,"..","index.js")}function _e(){return process.execPath}function Hi(){return process.versions.electron?"env ELECTRON_RUN_AS_NODE=1 ":""}function Wi(e){let t=_e(),r=rt();if(process.platform==="win32"){let n=e.join(" "),i=(0,St.join)(lo.default.tmpdir(),`${se}-launch.vbs`);return(0,N.writeFileSync)(i,`CreateObject("WScript.Shell").Run """${t}"" ""${r}"" ${n}", 0, False
|
|
20
|
+
`),(0,bt.execFile)("wscript.exe",[i],{windowsHide:!0}).unref?.(),null}let o=(0,bt.spawn)(t,[r,...e],{detached:!0,stdio:"ignore"});return o.unref(),o.pid||null}function ji(){let e=Tt.default.dirname(_e()),t=["/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin","/opt/homebrew/bin"];return t.includes(e)||t.unshift(e),t.join(":")}function co(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Nc(e,t){let r=[e,t,...br].map(o=>` <string>${co(o)}</string>`).join(`
|
|
21
21
|
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
22
22
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
23
23
|
<plist version="1.0">
|
|
24
24
|
<dict>
|
|
25
25
|
<key>Label</key>
|
|
26
|
-
<string>${
|
|
26
|
+
<string>${Er}</string>
|
|
27
27
|
<key>ProgramArguments</key>
|
|
28
28
|
<array>
|
|
29
29
|
${r}
|
|
@@ -35,43 +35,43 @@ ${r}
|
|
|
35
35
|
<key>EnvironmentVariables</key>
|
|
36
36
|
<dict>
|
|
37
37
|
<key>PATH</key>
|
|
38
|
-
<string>${
|
|
38
|
+
<string>${co(ji())}</string>
|
|
39
39
|
<key>HOME</key>
|
|
40
|
-
<string>${
|
|
40
|
+
<string>${co(Dn)}</string>
|
|
41
41
|
</dict>
|
|
42
42
|
<key>StandardOutPath</key>
|
|
43
|
-
<string>${
|
|
43
|
+
<string>${Sr}</string>
|
|
44
44
|
<key>StandardErrorPath</key>
|
|
45
|
-
<string>${
|
|
45
|
+
<string>${Sr}</string>
|
|
46
46
|
</dict>
|
|
47
47
|
</plist>
|
|
48
|
-
`}function
|
|
49
|
-
WshShell.Run """${
|
|
50
|
-
`}function
|
|
48
|
+
`}function Dc(){return(0,N.existsSync)(te.darwin)}function Bc(){let e=br.join(" ");return`Set WshShell = CreateObject("WScript.Shell")
|
|
49
|
+
WshShell.Run """${_e()}"" ""${rt()}"" ${e}", 0, False
|
|
50
|
+
`}function Uc(){try{(0,bt.execFileSync)("reg",["DELETE","HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run","/V",Tr,"/F"],{windowsHide:!0,stdio:"ignore"})}catch{}}function Fc(){return(0,N.existsSync)(te.win)}function Kc(){let e=`${_e()} ${rt()} ${br.join(" ")}`;return`[Desktop Entry]
|
|
51
51
|
Type=Application
|
|
52
|
-
Name=${
|
|
52
|
+
Name=${Tr}
|
|
53
53
|
Exec=${e}
|
|
54
54
|
X-GNOME-Autostart-enabled=true
|
|
55
55
|
NoDisplay=false
|
|
56
56
|
Terminal=false
|
|
57
|
-
`}function
|
|
58
|
-
Description=${
|
|
57
|
+
`}function Hc(){let e=br.map(t=>`'${t}'`).join(" ");return`[Unit]
|
|
58
|
+
Description=${Tr} Agent
|
|
59
59
|
After=network-online.target
|
|
60
60
|
Wants=network-online.target
|
|
61
61
|
|
|
62
62
|
[Service]
|
|
63
63
|
Type=simple
|
|
64
|
-
ExecStart=${
|
|
64
|
+
ExecStart=${_e()} ${rt()} ${e}
|
|
65
65
|
Restart=always
|
|
66
66
|
RestartSec=10
|
|
67
|
-
Environment=PATH=${
|
|
68
|
-
Environment=HOME=${
|
|
69
|
-
StandardOutput=append:${
|
|
70
|
-
StandardError=append:${
|
|
67
|
+
Environment=PATH=${ji()}
|
|
68
|
+
Environment=HOME=${Dn}
|
|
69
|
+
StandardOutput=append:${Sr}
|
|
70
|
+
StandardError=append:${Sr}
|
|
71
71
|
|
|
72
72
|
[Install]
|
|
73
73
|
WantedBy=default.target
|
|
74
|
-
`}function
|
|
74
|
+
`}function Wc(e){try{return(0,bt.execFileSync)("systemctl",["--user",...e],{stdio:"ignore"}),!0}catch{return!1}}function jc(){return(0,N.existsSync)(te.linux)||(0,N.existsSync)(te.linuxSystemd)}async function Gc(){try{if(process.platform==="darwin")return Dc();if(process.platform==="win32")return await Fc();if(process.platform==="linux")return jc()}catch{}return!1}async function Gi(){try{if(process.platform==="win32"&&Uc(),!await Gc())return!1;if(process.platform==="darwin"){let e=Nc(_e(),rt());return((0,N.existsSync)(te.darwin)?(0,N.readFileSync)(te.darwin,"utf8"):"")===e?!1:((0,N.writeFileSync)(te.darwin,e),!0)}if(process.platform==="win32"){let e=Bc();return((0,N.existsSync)(te.win)?(0,N.readFileSync)(te.win,"utf8"):"")===e?!1:((0,N.writeFileSync)(te.win,e),!0)}if(process.platform==="linux"){if((0,N.existsSync)(te.linuxSystemd)){let e=Hc();return(0,N.readFileSync)(te.linuxSystemd,"utf8")===e?!1:((0,N.writeFileSync)(te.linuxSystemd,e),Wc(["daemon-reload"]),!0)}if((0,N.existsSync)(te.linux)){let e=Kc();return(0,N.readFileSync)(te.linux,"utf8")===e?!1:((0,N.writeFileSync)(te.linux,e),!0)}}}catch{}return!1}var zu=process.env.NODE_ENV==="development";var L=process.env.NREMOTE_WORKER_URL||"https://9remote.cc",Vi=3e4,Yi=500,uo=300,Te={cmdMs:1e3,pendingApprovalMs:3e3,statsMs:5e3,serverReadyIntervalMs:200,serverReadyTimeoutMs:5e3,bgServerReadyTimeoutMs:15e3,bgServerReadyIntervalMs:300},ot={intervalMs:2e3,timeoutMs:12e4,fetchTimeoutMs:5e3,dnsTimeoutMs:2e3,maxLogEntries:80,postReadyHoldMs:2e3},he={killCloudflaredMs:500,killCloudflaredTuiMs:300,serverBootMs:2e3,trayReadyMs:1e3,postReadyHoldMs:2e3,bgSpawnFlushMs:400};var He={maxLogLines:200,headerWidth:44},Yt={checkIntervalMs:36e5,connectCheckDebounceMs:9e5,maxRetry:3,retryDelayMs:3e3,verifyTimeoutMs:15e3,lockTtlMs:3e5,lockFile:"update.lock"},Xi=5e3,fo=12e4,Ar=1500,qi=2,Qi=3e4,ce={orange:m.rgb(230,138,110),orangeDim:m.rgb(200,120,95)};var Vc=Le.default.dirname((0,Zi.fileURLToPath)(__importMetaUrl)),zi=8e3;var Rr=2208,po=Le.default.join(Xt.default.homedir(),".9remote","cloudflared.pid");function Yc(){try{Bi()}catch{}try{if((0,Q.existsSync)(po)){let e=parseInt((0,Q.readFileSync)(po,"utf8"));if(Number.isFinite(e))try{process.kill(e)}catch{}try{(0,Q.unlinkSync)(po)}catch{}}}catch{}try{process.platform==="win32"?(0,Bn.execSync)(`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${Rr}') do taskkill /F /PID %a`,{stdio:"ignore",windowsHide:!0}):(0,Bn.execSync)(`lsof -ti:${Rr} | xargs kill -9 2>/dev/null || true`,{stdio:"ignore"})}catch{}if(process.platform==="win32"){let e=Date.now()+1500;for(;Date.now()<e;);}}function es(){return"3.0.22"}function ts(e,t){let r=e.split(".").map(Number),o=t.split(".").map(Number);for(let n=0;n<3;n++){if(o[n]>r[n])return!0;if(o[n]<r[n])return!1}return!1}function Xc(){return process.env.CODESPACES==="true"||process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN?"GitHub Codespaces":(0,Q.existsSync)("/.dockerenv")?"Docker":null}function Pr(){Yc()}async function ns(){try{let e=es();if(!e)return null;let t=await K(Xr,{signal:AbortSignal.timeout(zi)});if(!t.ok)return null;let{version:r}=await t.json();return r&&ts(e,r)?{current:e,latest:r}:null}catch{return null}}var xr=Le.default.join(G.STATE,Yt.lockFile);function qc(){try{if((0,Q.existsSync)(xr)){let{pid:e,ts:t}=JSON.parse((0,Q.readFileSync)(xr,"utf8")),r=Date.now()-t<Yt.lockTtlMs,o=!1;try{process.kill(e,0),o=!0}catch{}if(r&&o)return!1}}catch{}try{(0,Q.writeFileSync)(xr,JSON.stringify({pid:process.pid,ts:Date.now()}))}catch{}return!0}async function Qc(){try{let e=await K(Xr,{signal:AbortSignal.timeout(zi)});if(!e.ok)return null;let{version:t}=await e.json();return t||null}catch{return null}}function Jc(){try{if(process.env.NREMOTE_REGISTRY)return`--registry ${new URL(process.env.NREMOTE_REGISTRY).origin}`}catch{}return""}function Zc(){let e=rt(),t=Le.default.sep,r=`${t}lib${t}node_modules${t}`,o=e.indexOf(r);return o>0?{global:"-g",prefix:`--prefix "${e.slice(0,o)}"`}:(o=e.indexOf(`${t}node_modules${t}`),o>0?{global:"",prefix:`--prefix "${e.slice(0,o)}"`}:{global:"-g",prefix:""})}function Ji(){let e=process.argv.slice(2).filter(n=>n!=="--skip-update"),r=e.includes("ui")||e.includes("start")||e.some(n=>["--tray","--auto","--start"].includes(n))?e.join(" "):"--tray";return`${r.includes("--start")||r.includes("start")?r:`${r} --start`} --skip-update`}function zc(){let e=process.env.NREMOTE_NPM_CLI;return e&&(0,Q.existsSync)(e)?process.platform==="win32"?`"${_e()}" "${e}"`:`env ELECTRON_RUN_AS_NODE=1 "${_e()}" "${e}"`:"npm"}function el({currentVersion:e,latest:t,agentPid:r}){let o=Ui(),n=Jc(),i=_e(),s=Hi(),a=rt(),c=xr,{global:l,prefix:u}=Zc(),f=`${l} --prefer-online --no-audit --no-fund ${n} ${u}`.trim(),p=zc();if(process.platform==="win32"){let w=Le.default.join(Xt.default.tmpdir(),`${se}-restart.vbs`),E=`@echo off
|
|
75
75
|
setlocal EnableDelayedExpansion
|
|
76
76
|
set "NODE=${i}"
|
|
77
77
|
set "CLI=${a}"
|
|
@@ -90,16 +90,16 @@ for %%N in (cloudflared agent) do (
|
|
|
90
90
|
del /f /q "${o}\\%%N.pid" >nul 2>&1
|
|
91
91
|
)
|
|
92
92
|
)
|
|
93
|
-
for /f "tokens=5" %%a in ('netstat -aon ^| findstr :${
|
|
93
|
+
for /f "tokens=5" %%a in ('netstat -aon ^| findstr :${Rr}') do taskkill /F /PID %%a >nul 2>&1
|
|
94
94
|
timeout /t 3 /nobreak >nul
|
|
95
95
|
|
|
96
96
|
set ATTEMPT=0
|
|
97
97
|
:installloop
|
|
98
98
|
set /a ATTEMPT+=1
|
|
99
|
-
call ${p} install ${
|
|
99
|
+
call ${p} install ${Ue} ${f} >nul 2>&1
|
|
100
100
|
if !ERRORLEVEL! EQU 0 goto verify
|
|
101
|
-
if !ATTEMPT! GEQ ${
|
|
102
|
-
call ${p} install ${
|
|
101
|
+
if !ATTEMPT! GEQ ${Yt.maxRetry} (
|
|
102
|
+
call ${p} install ${Ue} ${f} --omit=optional >nul 2>&1
|
|
103
103
|
goto verify
|
|
104
104
|
)
|
|
105
105
|
timeout /t 3 /nobreak >nul
|
|
@@ -107,7 +107,7 @@ goto installloop
|
|
|
107
107
|
|
|
108
108
|
:verify
|
|
109
109
|
set "NEWVER="
|
|
110
|
-
set "VERFILE=%TEMP%\\${
|
|
110
|
+
set "VERFILE=%TEMP%\\${se}-ver.txt"
|
|
111
111
|
"%NODE%" "%CLI%" --version > "%VERFILE%" 2>nul
|
|
112
112
|
REM Read first line + strip surrounding whitespace/CR via for/f tokens
|
|
113
113
|
for /f "usebackq tokens=* delims= " %%V in ("%VERFILE%") do (
|
|
@@ -118,15 +118,15 @@ for /f "usebackq tokens=* delims= " %%V in ("%VERFILE%") do (
|
|
|
118
118
|
del /f /q "%VERFILE%" >nul 2>&1
|
|
119
119
|
if defined NEWVER set "NEWVER=!NEWVER: =!"
|
|
120
120
|
if not "!NEWVER!"=="${t}" (
|
|
121
|
-
call ${p} install ${
|
|
121
|
+
call ${p} install ${se}@${e} ${f} >nul 2>&1
|
|
122
122
|
)
|
|
123
123
|
del /f /q "${c}" >nul 2>&1
|
|
124
124
|
|
|
125
125
|
wscript "${w}"
|
|
126
126
|
exit /b 0
|
|
127
|
-
`,
|
|
128
|
-
`);let
|
|
129
|
-
`),{shellCmd:["wscript.exe",[
|
|
127
|
+
`,O=Le.default.join(Xt.default.tmpdir(),`${se}-update.bat`);(0,Q.writeFileSync)(O,E),(0,Q.writeFileSync)(w,`CreateObject("WScript.Shell").Run """%NODE%"" ""%CLI%"" ${Ji()}", 0, False`.replace("%NODE%",i).replace("%CLI%",a)+`
|
|
128
|
+
`);let T=Le.default.join(Xt.default.tmpdir(),`${se}-update.vbs`);return(0,Q.writeFileSync)(T,`CreateObject("WScript.Shell").Run "cmd /c ""${O}""", 0, False
|
|
129
|
+
`),{shellCmd:["wscript.exe",[T]],windowsVerbatim:!1}}let d=`#!/bin/bash
|
|
130
130
|
# Wait for agent to exit so it releases the cli.cjs file lock
|
|
131
131
|
while kill -0 ${r} 2>/dev/null; do sleep 1; done
|
|
132
132
|
|
|
@@ -139,16 +139,16 @@ for name in cloudflared agent; do
|
|
|
139
139
|
rm -f "$f"
|
|
140
140
|
fi
|
|
141
141
|
done
|
|
142
|
-
lsof -ti:${
|
|
142
|
+
lsof -ti:${Rr} | xargs kill -9 2>/dev/null || true
|
|
143
143
|
sleep 2
|
|
144
144
|
|
|
145
145
|
attempt=0
|
|
146
|
-
while [ $attempt -lt ${
|
|
146
|
+
while [ $attempt -lt ${Yt.maxRetry} ]; do
|
|
147
147
|
attempt=$((attempt+1))
|
|
148
148
|
echo "Installing (attempt $attempt)..."
|
|
149
|
-
if ${p} install ${
|
|
150
|
-
if [ $attempt -eq ${
|
|
151
|
-
${p} install ${
|
|
149
|
+
if ${p} install ${Ue} ${f}; then break; fi
|
|
150
|
+
if [ $attempt -eq ${Yt.maxRetry} ]; then
|
|
151
|
+
${p} install ${Ue} ${f} --omit=optional || true
|
|
152
152
|
fi
|
|
153
153
|
sleep 3
|
|
154
154
|
done
|
|
@@ -158,99 +158,102 @@ done
|
|
|
158
158
|
NEWVER=$(${s}"${i}" "${a}" --version 2>/dev/null | head -1 | sed 's/\x1B[[0-9;?]*[a-zA-Z]//g' | tr -d '[:space:]')
|
|
159
159
|
if [ "$NEWVER" != "${t}" ]; then
|
|
160
160
|
echo "Verify failed (got $NEWVER, want ${t}), rolling back to ${e}..."
|
|
161
|
-
${p} install ${
|
|
161
|
+
${p} install ${se}@${e} ${f} || true
|
|
162
162
|
fi
|
|
163
163
|
|
|
164
164
|
rm -f "${c}"
|
|
165
|
-
${
|
|
166
|
-
|
|
167
|
-
`)}function
|
|
165
|
+
${process.env.NREMOTE_REGISTRY?`export NREMOTE_REGISTRY="${process.env.NREMOTE_REGISTRY}"
|
|
166
|
+
`:""}${s}"${i}" "${a}" ${Ji()}
|
|
167
|
+
`,h=Le.default.join(Xt.default.tmpdir(),`${se}-update.sh`);return(0,Q.writeFileSync)(h,d,{mode:493}),{shellCmd:["sh",[h]],windowsVerbatim:!1}}async function rs(){let e=es();if(!e||Xc())return!1;let t=await Qc();if(!t||!ts(e,t)||!qc())return!1;let{shellCmd:r,windowsVerbatim:o}=el({currentVersion:e,latest:t,agentPid:process.pid});return(0,Bn.spawn)(r[0],r[1],{detached:!0,stdio:"ignore",windowsHide:!0,windowsVerbatimArguments:o}).unref(),setTimeout(()=>process.exit(0),500),!0}var gs=R(require("os"),1);var Lr=R(require("readline"),1),is=R(require("http"),1);var mo=require("child_process"),tl={screenRecording:"x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture",accessibility:"x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"};function kr(e){let t=tl[e];t&&process.platform==="darwin"&&(0,mo.exec)(`open "${t}"`,()=>{})}function be({strategy:e,baseMs:t,maxMs:r},o){let n=Math.max(1,o),i=e==="exp"?t*Math.pow(2,n-1):t*n;return Math.min(i,r)}async function Or({config:e,task:t,label:r="task",log:o=()=>{},ctx:n={}}){let i=0;for(;!n.cancelled;){i++;try{if(await t(i))return!0}catch(a){o(`\u274C ${r} attempt ${i} error: ${a?.message||a}`)}if(n.cancelled)return!1;let s=be(e,i);o(`\u{1F504} ${r} retry in ${s}ms (attempt ${i})`),await new Promise(a=>setTimeout(a,s))}return!1}var S={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",orange:"\x1B[38;2;230;138;110m",green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",white:"\x1B[37m"},ss=()=>Math.min(44,process.stdout.columns||44);function go(e,t=null){let o=ss()-2,n=(a="")=>{let c=a.replace(/\x1b\[[0-9;]*m/g,""),l=Math.max(0,o-c.length);return S.orange+"\u2551"+S.reset+a+" ".repeat(l)+S.orange+"\u2551"+S.reset},i=(a,c=l=>l)=>{let l=a.replace(/\x1b\[[0-9;]*m/g,""),u=Math.floor((o-l.length)/2),f=o-l.length-u;return S.orange+"\u2551"+S.reset+" ".repeat(u)+c(a)+" ".repeat(f)+S.orange+"\u2551"+S.reset},s=["",S.orange+"\u2554"+"\u2550".repeat(o)+"\u2557"+S.reset,n(),i(`\u{1F680} 9Remote v${e}`,a=>S.bold+S.orange+a+S.reset),i("Remote terminal access from anywhere",a=>S.dim+a+S.reset),n()];return t&&(s.push(i(`\u2B06 New version v${t} available!`,a=>S.yellow+S.bold+a+S.reset)),s.push(i(`Run: npm i -g ${Ue}`,a=>S.dim+a+S.reset)),s.push(n())),s.push(S.orange+"\u255A"+"\u2550".repeat(o)+"\u255D"+S.reset),s.push(""),s.join(`
|
|
168
|
+
`)}function Qt(e,t=null){console.log(go(e,t))}var os=["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"],ho=[{label:"Preparing",desc:"Checking dependencies"},{label:"Connecting",desc:"Creating session"},{label:"Starting tunnel",desc:"Spawning tunnel"},{label:"Verifying tunnel",desc:"Health check"},{label:"Ready",desc:"Tunnel is live"}],nl=process.platform==="win32",rl=nl?120:80;process.on("exit",()=>process.stdout.write("\x1B[?25h"));var as=(e,t)=>{process.stdout.write("\x1B[?25h"),process.listenerCount(e)<=1&&process.exit(t)};process.on("SIGINT",()=>as("SIGINT",130));process.on("SIGTERM",()=>as("SIGTERM",143));var We=0,At=null,Ir=0,Ce=-1,Un=null,qt=null,_r=!1;function cs(){let e=[],t=Ce===ho.length-1;return ho.forEach((r,o)=>{let n=o===Ce&&Un?Un:r.desc;if(o<Ce||t&&o===Ce)e.push(` ${S.green}\u2713${S.reset} ${S.dim}${r.label}${S.reset}`),qt&&o===qt.afterIdx&&e.push(` ${S.green}\u2713${S.reset} ${S.cyan}${qt.text}${S.reset}`);else if(o===Ce){let i=os[Ir%os.length];e.push(` ${S.orange}${i}${S.reset} ${S.bold}${r.label}${S.reset} ${S.dim}${n}${S.reset}`)}else e.push(` ${S.dim}\u25CB ${r.label}${S.reset}`)}),e}function ls(){let e=cs();We>0&&process.stdout.write(`\x1B[${We}A\x1B[0J`),process.stdout.write(e.join(`
|
|
168
169
|
`)+`
|
|
169
|
-
`),
|
|
170
|
-
`))process.stdout.write(
|
|
171
|
-
`);e&&process.stdout.write(`${
|
|
170
|
+
`),We=e.length}function us(){if(We===0||Ce<0)return;let e=cs();if(e.length!==We){ls();return}let t=Ce+(qt&&qt.afterIdx<Ce?1:0),r=We-t;process.stdout.write(`\x1B[${r}A\r\x1B[2K${e[t]}\x1B[${r}B\r`)}function ol(){_r||(process.stdout.write("\x1B[?25l"),_r=!0)}function fs(){_r&&(process.stdout.write("\x1B[?25h"),_r=!1)}function ps(e,t=!1,r=null){At&&(clearInterval(At),At=null),Ce=e,Un=r,Ir=0,t||(We=0),ls(),e>=0&&e<ho.length-1?(ol(),At=setInterval(()=>{Ir++,us()},rl)):fs()}function Jt(e){Un=e,We>0&&us()}function ds(){At&&(clearInterval(At),At=null),fs(),We=0,Ce=-1,Un=null,qt=null,Ir=0}function Me(e,t,r=0,o="",n=null,i=null){return new Promise(s=>{let a=r,c=!0,l=!0,u=process.platform==="win32",f=()=>{if(!c)return;process.stdout.write(l?"\x1B[2J\x1B[H":"\x1B[H"),l=!1;let w=typeof o=="function"?o():o;if(w)for(let E of w.split(`
|
|
171
|
+
`))process.stdout.write(E+`\x1B[K
|
|
172
|
+
`);e&&process.stdout.write(`${S.dim}${e}${S.reset}\x1B[K
|
|
172
173
|
\x1B[K
|
|
173
|
-
`),t.forEach((
|
|
174
|
-
`)}),process.stdout.write("\x1B[J")},p=()=>{if(c){if(c=!1,process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.removeListener("keypress",d),process.stdin.pause()}},d=(w,
|
|
174
|
+
`),t.forEach((E,O)=>{let T=O===a?u?">":"\u2605":u?" ":"\u2606",A=O===a?` \x1B[7m${S.bold}${T} ${E.label}${S.reset}`:` ${T} ${E.label}`;process.stdout.write(A+`\x1B[K
|
|
175
|
+
`)}),process.stdout.write("\x1B[J")},p=()=>{if(c){if(c=!1,process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.removeListener("keypress",d),process.stdin.pause()}},d=(w,E)=>{!c||!E||(E.name==="up"?(a=(a-1+t.length)%t.length,f()):E.name==="down"?(a=(a+1)%t.length,f()):E.name==="return"?(p(),s(a)):E.name==="escape"?(p(),s(-1)):E.ctrl&&E.name==="c"&&(p(),i&&i(),process.exit(0)))};if(process.stdin.removeAllListeners("keypress"),Lr.default.emitKeypressEvents(process.stdin),process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{s(-1);return}process.stdin.on("keypress",d),process.stdin.resume(),f(),n&&n(f,()=>{c&&(p(),s(-2))})})}function yo(e){return new Promise(t=>{if(process.stdin.removeAllListeners("keypress"),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}if(process.stdin.pause(),process.stdout.write(`${e} (y/N): `),Lr.default.emitKeypressEvents(process.stdin),process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{}process.stdin.resume();let r=(o,n)=>{if(!n)return;if(process.stdin.removeListener("keypress",r),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),n.ctrl&&n.name==="c"&&(process.stdout.write(`
|
|
175
176
|
`),process.exit(0));let i=(n.name||"").toLowerCase()==="y";process.stdout.write((i?"y":"n")+`
|
|
176
|
-
`),t(i)};process.stdin.on("keypress",r)})}function
|
|
177
|
+
`),t(i)};process.stdin.on("keypress",r)})}function ms(e,t){return new Promise(r=>{let o=e?e.slice(0,8):"unknown",n=ss(),i=process.stdin.listeners("keypress").slice();if(process.stdin.removeAllListeners("keypress"),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause();let s=`${S.orange}${"\u2550".repeat(n)}${S.reset}`;if(process.stdout.write(`\x1B[2J\x1B[H
|
|
177
178
|
${s}
|
|
178
|
-
${
|
|
179
|
+
${S.orange}${S.bold} \u{1F514} New Device Connection${S.reset}
|
|
179
180
|
${s}
|
|
180
|
-
Device: ${
|
|
181
|
-
IP: ${
|
|
181
|
+
Device: ${S.cyan}${o}...${S.reset}
|
|
182
|
+
IP: ${S.cyan}${t}${S.reset}
|
|
182
183
|
${s}
|
|
183
184
|
|
|
184
|
-
Allow this device? ${
|
|
185
|
+
Allow this device? ${S.dim}(y/n)${S.reset} `),Lr.default.emitKeypressEvents(process.stdin),process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{}process.stdin.resume();let a=()=>{for(let l of i)process.stdin.on("keypress",l);if(i.length>0){if(process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{}process.stdin.resume()}},c=(l,u)=>{if(!u)return;let f=(u.name||"").toLowerCase(),p=f==="y"||u.name==="return",d=f==="n"||u.name==="escape",h=u.ctrl&&u.name==="c";if(!p&&!d&&!h)return;try{if(process.stdin.removeListener("keypress",c),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause()}catch{}h&&process.exit(0);let w=p,E=w?`${S.green}y${S.reset}
|
|
185
186
|
|
|
186
|
-
${
|
|
187
|
-
`:`${
|
|
187
|
+
${S.green}\u2713 Device approved${S.reset}
|
|
188
|
+
`:`${S.red}n${S.reset}
|
|
188
189
|
|
|
189
|
-
${
|
|
190
|
-
`;process.stdout.write(
|
|
191
|
-
`);u=p.pop();let d="";for(let h of p)if(h.startsWith("data: "))d=h.slice(6);else if(h===""&&d){try{let w=JSON.parse(d);Promise.resolve(t(w.type,w)).catch(()=>{})}catch{}d=""}}),l.on("end",()=>{n&&clearTimeout(n),o||setTimeout(a,
|
|
192
|
-
`).find(c=>c.includes(r));if(!n){
|
|
193
|
-
`,"utf8");let s=!1,a=()=>{if(!s){s=!0;try{W.default.rmSync(n,{recursive:!0,force:!0})}catch{}}},c=(0,
|
|
194
|
-
`).slice(-5).join(" | ");
|
|
195
|
-
`).flatMap(t=>{let r=t.match(/^\s*(\d+)\s+(.+)$/);return r?[{pid:Number(r[1]),args:r[2].trim()}]:[]}):[]}function
|
|
196
|
-
`).map(o=>+o.trim()).filter(Boolean);for(let r of new Set(t))Pr(r)}catch{}}function Te(){if(!wo){wo=!0;try{try{if(W.default.existsSync(vo)){let t=parseInt(W.default.readFileSync(vo,"utf8"));Number.isFinite(t)&&(Fn=!0,Pr(t)),W.default.unlinkSync(vo)}}catch{}let e=In("cloudflared");Fn=!0,Jt=null,e&&(Pr(e),Fe("cloudflared")),Al(k)}finally{setTimeout(()=>{wo=!1},2e3)}}}function Is(){if(!me)return!1;let e=In("cloudflared");return!!e&&zr(e)}function Os(){Dn=0,en=!1,Hn=null,zt=null,me=null,je=0,Wn=0,Zt=null,Rl()}var bl=/^(utun|awdl|llw|anpi|bridge|gif|stf|ipsec|ap|tun|tap|vmnet|veth|docker)/i;function As(){let e=ot.default.networkInterfaces(),t=[];for(let[r,o]of Object.entries(e))if(o&&!bl.test(r))for(let n of o)!n.internal&&n.family==="IPv4"&&t.push(`${r}:${n.address}`);return t.sort().join("|")}function xl(){Un||(Rr=As(),go=Date.now(),Un=setInterval(async()=>{try{let e=Date.now(),t=e-go;if(go=e,Eo||en||!Hn||zt==null)return;if(t>ll){if(q.info(`Sleep/wake detected (gap=${t}ms)`),me){let s=!1;for(let a=0;a<3;a++){if((await Yt(me)).ok){s=!0;break}a<2&&await new Promise(l=>setTimeout(l,3e3))}if(s)return;q.info("tunnel unresponsive after sleep \u2192 restarting")}bt("unreachable"),Te(),Kn(zt,"woke from sleep");return}let r=As(),o=r!==Rr;Rr=r;let n=In("cloudflared"),i=!n||!zr(n);if(!o&&!i){if(me&&tn&&Date.now()-tn>Ss&&e-Wn>=We.edgeProbeIntervalMs){Wn=e;let s=await Yt(me);if(s.ok)je=0;else if(++je>=We.edgeProbeFailureThreshold){let a=await al(We.readyTimeoutMs);if(a>0){q.info(`edge probe failing but cloudflared holds ${a} connection(s) \u2014 not restarting`),je=0;return}q.warn(`tunnel unreachable but cloudflared alive \u2014 edge lost after ${je} probes (ready=${a??"unknown"}), restarting`),je=0,bt("unreachable"),Te(),Kn(zt,"tunnel unreachable (edge lost)")}else q.debug(`edge probe failed (${je}/${We.edgeProbeFailureThreshold}) \u2014 ${s.dnsCode??s.httpStatus??"no response"}`)}return}if(o&&!i&&tn&&Date.now()-tn<Ss||(o&&q.info("Network change detected"),i&&q.warn("cloudflared not alive \u2014 watchdog"),bt("unreachable"),await new Promise(s=>setTimeout(s,We.networkRestoreDelayMs)),!await Rs()))return;if(o&&!i&&me){let s=!1;for(let a=0;a<2;a++){if((await Yt(me)).ok){s=!0;break}a===0&&await new Promise(l=>setTimeout(l,2e3))}if(s){q.info("Tunnel survived network change, skip restart");return}}o&&!i&&Te(),Kn(zt,o?"network change":"liveness watchdog")}catch(e){q.error(`network monitor tick failed: ${e?.message||e}`)}},We.networkCheckIntervalMs))}function Rl(){Un&&(clearInterval(Un),Un=null),Rr=null}sn();var it=R(require("crypto"),1),cn=require("fs");var Ks=require("path");var Of=Buffer.from("302a300506032b656e","hex");var Or=(0,Ks.join)(G.CONFIG,"hostKey.json"),Df=Buffer.from("302a300506032b6570032100","hex"),an=null;function bo(){if(an)return an;try{if((0,cn.existsSync)(Or)){let s=JSON.parse((0,cn.readFileSync)(Or,"utf8")),a=Buffer.from(s.publicKey,"base64");if(!s.x25519PrivateKey){let l=it.default.generateKeyPairSync("x25519");s.x25519PrivateKey=l.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),s.x25519PublicKey=l.publicKey.export({type:"spki",format:"der"}).toString("base64"),Ue(Or,s)}let c=Buffer.from(s.x25519PublicKey,"base64");return an={privateKey:it.default.createPrivateKey({key:Buffer.from(s.privateKey,"base64"),format:"der",type:"pkcs8"}),publicKey:it.default.createPublicKey({key:a,format:"der",type:"spki"}),publicKeyB64:a.subarray(-32).toString("base64"),x25519PrivateKey:it.default.createPrivateKey({key:Buffer.from(s.x25519PrivateKey,"base64"),format:"der",type:"pkcs8"}),x25519PublicKeyB64:c.subarray(-32).toString("base64")},an}}catch{}(0,cn.mkdirSync)(G.CONFIG,{recursive:!0});let{privateKey:e,publicKey:t}=it.default.generateKeyPairSync("ed25519"),r=t.export({type:"spki",format:"der"}).toString("base64"),o=e.export({type:"pkcs8",format:"der"}).toString("base64"),n=it.default.generateKeyPairSync("x25519"),i=n.publicKey.export({type:"spki",format:"der"}).toString("base64");return Ue(Or,{privateKey:o,publicKey:r,x25519PrivateKey:n.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),x25519PublicKey:i}),an={privateKey:e,publicKey:t,publicKeyB64:Buffer.from(r,"base64").subarray(-32).toString("base64"),x25519PrivateKey:n.privateKey,x25519PublicKeyB64:Buffer.from(i,"base64").subarray(-32).toString("base64")},an}function st(){return bo().publicKeyB64}function at(){return bo().x25519PublicKeyB64}var _l="9remote-session-v1";function Cl({apiKey:e,tunnelUrl:t,localIp:r,expiryMinutes:o,ts:n}){let i=a=>{let c=a==null?"":String(a);return`${c.length}:${c}`},s=`${_l}|${i(e)}${i(t)}${i(r)}${i(o)}${i(n)}`;return it.default.sign(null,Buffer.from(s,"utf8"),bo().privateKey).toString("base64")}function xt(e){let t=Date.now();return{ts:t,sig:Cl({...e,ts:t})}}async function ct(e,t={}){let r=t.intervalMs??tt.intervalMs,o=t.timeoutMs??tt.timeoutMs,n=`${e}/api/health`,i=(()=>{try{return new URL(e).hostname}catch{return null}})(),s=Date.now(),a=0,c=[];await F({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:[]}});let l=u=>{c.push(u);let f=c.length>tt.maxLogEntries?c.slice(-tt.maxLogEntries):c;F({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:f}})};for(;Date.now()-s<o;){if(a++,Vt(),i){let f=await fo(i,tt.dnsTimeoutMs);if(!f.ok){let p=f.code==="ENOTFOUND"||f.code==="ETIMEOUT"||f.code==="ESERVFAIL",d=p?"connecting...":f.code;jt(`#${a} \u2192 ${d}`),l({attempt:a,status:d,elapsedMs:f.elapsedMs,ok:!1,waiting:p,time:Date.now()}),await new Promise(h=>setTimeout(h,r));continue}}let u=Date.now();try{let f=await K(n,{signal:AbortSignal.timeout(tt.fetchTimeoutMs)}),p=Date.now()-u;if(jt(`#${a} \u2192 ${f.status}`),l({attempt:a,status:String(f.status),elapsedMs:p,ok:f.ok,time:Date.now()}),f.ok)return await F({healthCheck:{running:!1,timeoutMs:0,startedAt:null,logs:[]}}),await new Promise(d=>setTimeout(d,tt.postReadyHoldMs)),!0}catch(f){let p=Date.now()-u,d=f.cause?.code||f.code||f.message,h=d==="ENOTFOUND",w=h?"connecting...":d;jt(`#${a} \u2192 ${w}`),l({attempt:a,status:w,elapsedMs:p,ok:!1,waiting:h,time:Date.now()})}await new Promise(f=>setTimeout(f,r))}return await F({healthCheck:{running:!1,timeoutMs:o,startedAt:s,logs:c}}),!1}var lt=H("tunnel"),xo=null,Hs=null,Ws=0;async function Rt(e,t){if(lt.debug(`updateTunnelUrl: key=${e?.slice(0,8)} url=${t}`),Ml(e),t&&t===Hs&&Date.now()-Ws<Ui){lt.debug("updateTunnelUrl: skipped (debounce, same URL)");return}xo&&(xo.cancelled=!0);let r={cancelled:!1};xo=r;let o=fs();Sr({config:ce.urlSync,label:`urlSync ${t}`,log:n=>lt.warn(n),ctx:r,task:async()=>{let n=await K(`${C}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let s={apiKey:V(e),tunnelUrl:t,localIp:o?`${o}:${k}`:null};return{...s,...xt(s)}})())});if(r.cancelled)return!0;if(n.ok)return Hs=t,Ws=Date.now(),lt.debug(`urlSync OK: pushed ${t} to server`),$l(t),!0;let i=await n.text().catch(()=>"");return lt.warn(`urlSync HTTP ${n.status}: ${i.slice(0,200)}`),!1}}),t&&ys(t)}var ln=null,un=null,Ro=!1,ko=0;async function js(e,t){let r={apiKey:e,online:t},o=await K(`${C}/api/session/heartbeat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...xt(r)})});return o.ok||lt.warn(`heartbeat online=${t} HTTP ${o.status}`),o.ok}async function Po(){if(!(Ro||!un)){Ro=!0;try{await js(un,!0),ko=Date.now()}catch(e){lt.debug(`heartbeat failed: ${e?.message||e}`)}finally{Ro=!1}}}function Ml(e){let t=V(e);if(t){if(ln&&un===t){Date.now()-ko>=ro&&Po();return}Io(),un=t,Po(),ln=setInterval(Po,ro),ln.unref?.()}}function Io({offline:e=!1}={}){ln&&(clearInterval(ln),ln=null);let t=un;return un=null,ko=0,!e||!t?null:js(t,!1).catch(r=>lt.debug(`goodbye failed: ${r?.message||r}`))}var Yn=null;async function $l(e){if(Yn?.url===e)return;let t={url:e};Yn=t,ws();try{let r=await ct(e,{timeoutMs:Hi});if(Yn!==t)return;r&&bt("healthy")}catch{}finally{Yn===t&&(Yn=null),vs()}}var Xe=H("server"),Xs=Qn.default.dirname((0,Ys.fileURLToPath)(__importMetaUrl)),Nl=Qn.default.resolve(Xs,"./server.cjs"),Gs=Qn.default.resolve(Xs,"../../index.js");function Lr(e){try{process.platform==="win32"?(0,Xn.execSync)(`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${e}') do taskkill /F /PID %a`,{stdio:"ignore",windowsHide:!0}):(0,Xn.execSync)(`lsof -ti:${e} | xargs kill -9 2>/dev/null || true`,{stdio:"ignore"})}catch{}}function ut(e,t,r){let o=null,n=!1,i=!1,s=!0,a=0,c=null,l=()=>{s&&(Lr(k),s=!1);let u=process.env.NODE_ENV==="development"&&Oo.default.existsSync(Gs),f=u?Gs:Nl;Oo.default.existsSync(f)||(Xe.error(`Server not found: ${f}`),process.exit(1));let p={...process.env,PORT:String(k)};u||delete p.NODE_ENV,o=(0,Xn.spawn)(jo,[f],{cwd:Qn.default.dirname(f),stdio:["ignore","inherit","inherit"],detached:!1,windowsHide:!0,env:Go(p)}),c&&clearTimeout(c),c=setTimeout(()=>{a=0},Di),o.on("exit",(d,h)=>{if(c&&(clearTimeout(c),c=null),n)return;if(i){i=!1,Xe.info("Restarting server (requested)..."),setTimeout(()=>{l(),r?.()},500);return}Xe.error(`Server exited unexpectedly (code: ${d}, signal: ${h})`),a++;let w=Se(ce.server,a);Xe.warn(`Restarting server in ${w}ms (fail#${a})`),t&&t(),setTimeout(()=>{l(),r?.()},w)}),o.on("error",d=>{Xe.error(`Server error: ${d.message}`)}),e?.(o)};return l(),{getProcess:()=>o,shutdown:()=>{if(n=!0,!!o){try{o.kill("SIGTERM")}catch{}setTimeout(()=>{try{o&&o.kill("SIGKILL")}catch{}},2e3)}},restart:()=>{if(!o)return!1;i=!0;try{o.kill("SIGTERM")}catch{}return setTimeout(()=>{try{o&&i&&o.kill("SIGKILL")}catch{}},2e3),!0}}}function Qs(e){return e?.restart?e.restart():!1}function Pt({serverManager:e,tunnelProcess:t,exit:r=!0,code:o=0}={}){try{Nn()}catch{}try{e?.shutdown?.()}catch{}try{t?.kill?.()}catch{}try{Te()}catch{}try{Gn()}catch{}try{Lr(k)}catch{}try{Os()}catch{}try{si()}catch{}try{Fe("agent")}catch{}try{Fe("cloudflared")}catch{}let n=Io({offline:!0});if(r){let i=new Promise(a=>setTimeout(a,Bi)),s=n?Promise.race([n,new Promise(a=>setTimeout(a,Fi))]):null;Promise.all([i,s]).finally(()=>process.exit(o))}}var Vs=!1;function ft(e,t){if(Vs)return;Vs=!0;let r=!1,o=n=>{r||(r=!0,Xe.info(`Stopping 9Remote (${n})...`),Pt({serverManager:e,tunnelProcess:t}),Xe.info("Server stopped"))};if(process.on("SIGINT",()=>o("SIGINT")),process.on("SIGTERM",()=>o("SIGTERM")),process.on("SIGHUP",()=>o("SIGHUP")),process.platform==="win32"){process.on("SIGBREAK",()=>o("SIGBREAK"));try{import("readline").then(({createInterface:n})=>{n({input:process.stdin,output:process.stdout}).on("SIGINT",()=>o("SIGINT")),process.stdin.isTTY&&process.stdin.unref?.()}).catch(()=>{})}catch{}}process.on("uncaughtException",n=>{Xe.error(`Uncaught exception: ${n?.stack||n?.message||n}`),o("uncaughtException"),setTimeout(()=>process.exit(1),no)}),process.on("unhandledRejection",n=>{Xe.error(`Unhandled rejection: ${n?.stack||n?.message||n}`),o("unhandledRejection"),setTimeout(()=>process.exit(1),no)})}sn();var Js=R(require("crypto"),1),Zs=require("path");var Dl=H("pairing"),zs=(0,Zs.join)(G.STATE,"pairing.json"),qs="ABCDEFGHIJKLMNPQRSTUVWXYZ123456789",Bl=2;function ea(){let e="";for(let t=0;t<Bl;t++)e+=qs[Js.default.randomInt(qs.length)];return e}function Ul(){let e=oi(zs,null);return!e||Date.now()>e.expiresAt?null:e}function Fl(e){try{Ue(zs,e)}catch(t){Dl.error(`persist pairing state: ${t.message}`)}}function ta(e,t,r,o=null){Fl({tempKey:e,tail:t,expiresAt:r,workerUrl:o})}function na(){let e=Ul();return e?{tempKey:e.tempKey,tail:e.tail,expiresAt:e.expiresAt}:null}var ra=H("session"),Kl=10;async function qn(e,t){try{let r=await K(`${t}/api/temp-key/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let i={apiKey:V(e),expiryMinutes:Kl};return{...i,...xt(i)}})())});if(!r.ok){let i=await r.json().catch(()=>null);throw new Error(i?.error||`HTTP ${r.status}`)}let o=await r.json(),n=ea();return ta(o.tempKey,n,o.expiresAt,t),{...o,oneTimeKey:`${o.tempKey}${n}`}}catch(r){return ra.error(`Temp key creation failed: ${r?.message||r}`),null}}function Jn(e,t){return t?.tempKey?`${e}/login?k=${t.tempKey}#${t.oneTimeKey}`:`${e}/login`}async function _r(e,t,r,o){try{let n=await K(`${t}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),hostPublicKey:st(),hostX25519Key:at(),tempKey:na()?.tempKey||void 0})});if(!n.ok)throw new Error(`HTTP ${n.status}`);return r&&await K(`${t}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),tunnelUrl:r,...xt({apiKey:V(e),tunnelUrl:r})})}).catch(()=>{}),o&&V(o)!==V(e)&&await K(`${t}/api/session/delete`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(o),...xt({apiKey:V(o)})})}).catch(()=>{}),!0}catch(n){return ra.error(`Session registration failed: ${n?.message||n}`),!1}}var kt=H("tunnel");async function Hl(e,t,r,o){let n=0;for(;;){n++;try{return await Ve(e,t,r)}catch(i){let s=Se(ce.tunnelSpawn,n);kt.warn(`spawn attempt ${n} failed: ${i?.message||i} \u2014 retry in ${s}ms`),o?.({attempt:n,delay:s}),await new Promise(a=>setTimeout(a,s))}}}function Qe({onUrlUpdate:e,setTunnel:t,onRetry:r}){return async o=>{try{let n=await Hl(o,e,null,r);qe(),t(n.child),await e(n.tunnelUrl),kt.info(`Tunnel restarted: ${n.tunnelUrl}`)}catch(n){kt.error(`Tunnel restart failed: ${n?.message||n}`)}}}var Cr=null;function qe(){Cr&&(Cr.cancelled=!0,Cr=null)}function fn(e,{onUrlUpdate:t,onRestart:r,setActiveTunnel:o,onReady:n}){qe();let i={cancelled:!1};return Cr=i,Sr({config:ce.tunnelRateLimit,task:async()=>{if(i.cancelled)return!0;if(Is())return kt.info("bg-tunnel: a tunnel is already live \u2014 standing down"),!0;let s=await Ve(e,t,r);if(i.cancelled){try{Te()}catch{}return!0}try{o?.(s.child),await t?.(s.tunnelUrl),await n?.(s),kt.info(`bg tunnel up: ${s.tunnelUrl}`)}catch(a){kt.error(`bg tunnel post-spawn failed: ${a?.message||a}`)}return!0},label:"bg-tunnel",log:s=>kt.info(s),ctx:i}),i}var No=R(Pa(),1);var Jl=H("session");function Zl(e,t="\u{1F4F1} Scan QR to connect:"){console.log(ie.orange(`
|
|
197
|
-
${t}`)),
|
|
198
|
-
`+r.trim())})})}async function
|
|
199
|
-
\u274C Failed to create one-time key \u2014 generate a new one from the menu`)),console.log(
|
|
190
|
+
${S.red}\u2717 Device rejected${S.reset}
|
|
191
|
+
`;process.stdout.write(E),setTimeout(()=>{try{a()}catch{}r(w)},500)};process.stdin.on("keypress",c)})}function hs(e,t){let r=null,o=!1,n=null,i=45e3,s=()=>{n&&clearTimeout(n),n=setTimeout(()=>{try{r?.destroy()}catch{}},i)},a=async()=>{if(o)return;let c=await Zt();r=is.default.get(`http://${c}:${e}/api/ui/events`,l=>{let u="";s(),l.on("data",f=>{s(),u+=f.toString();let p=u.split(`
|
|
192
|
+
`);u=p.pop();let d="";for(let h of p)if(h.startsWith("data: "))d=h.slice(6);else if(h===""&&d){try{let w=JSON.parse(d);Promise.resolve(t(w.type,w)).catch(()=>{})}catch{}d=""}}),l.on("end",()=>{n&&clearTimeout(n),o||setTimeout(a,be(fe.sse,1))})}),r.on("error",()=>{n&&clearTimeout(n),o||setTimeout(a,be(fe.sse,1))})};return a(),()=>{o=!0,n&&clearTimeout(n),r?.destroy()}}var wo=!1;function ys(e){wo=e}var Fn=null;async function Zt(){if(Fn)return Fn;let e=o=>fetch(`http://${o}:${k}/api/health`,{signal:AbortSignal.timeout(2e3)}).then(n=>n.ok?o:Promise.reject()),r=(await Promise.allSettled(["localhost","127.0.0.1"].map(e))).map((o,n)=>o.status==="fulfilled"?["localhost","127.0.0.1"][n]:null);return Fn=r.find(o=>o==="localhost")||r.find(Boolean)||null,Fn||"127.0.0.1"}function ws(){Fn=null}async function q(e,t){let r=await Zt();try{return await fetch(`http://${r}:${k}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{return ws(),null}}async function J(e){let t=await Zt();try{let r=await fetch(`http://${t}:${k}${e}`);return r.ok?await r.json():null}catch{return ws(),null}}async function F(e){await q("/api/ui/state",e)}async function C(e,t={}){wo&&ps(e-1,e>I.PREPARING),await F({step:e,stepDesc:"",...t})}function Cr({phase:e,percent:t}){let r=e==="download"?`Downloading tunnel binary ${t??0}%`:"Extracting tunnel binary";wo&&Jt(r),F({stepDesc:r})}async function le(){return!!await J("/api/health")}async function vo(){let[e,t,r,o]=await Promise.all([J("/api/ui/state"),J("/api/device/auto-approve"),J("/api/autostart"),J("/api/sleep-inhibit")]);return{desktopEnabled:!!e?.desktopEnabled,remoteAvailable:!!e?.remoteAvailable,autoApprove:!!t?.enabled,autoStart:!!r?.enabled,sleepInhibitMode:o?.mode||"never",sleepInhibitActive:!!o?.active,sleepInhibitPresets:Array.isArray(o?.presets)?o.presets:[]}}function vs(){let e=gs.default.networkInterfaces();for(let t of Object.values(e))for(let r of t)if(r.family==="IPv4"&&!r.internal)return r.address;return null}var er=require("child_process"),tr=R(require("path"),1),Bo=R(require("fs"),1),zs=require("url");var W=R(require("fs"),1),st=R(require("path"),1),Io=R(require("https"),1),at=R(require("os"),1),_s=R(require("net"),1),Ve=require("child_process");var Es=R(require("dns"),1),Ss=require("child_process");var il=2e3,sl=5e3,Eo=new Es.default.promises.Resolver;Eo.setServers(["1.1.1.1","1.0.0.1","8.8.8.8"]);function zt(){process.platform==="win32"&&(0,Ss.execFile)("ipconfig",["/flushdns"],{windowsHide:!0},()=>{})}async function So(e,t=il){let r=Date.now();try{let o=async()=>{let[i,s]=await Promise.allSettled([Eo.resolve4(e),Eo.resolve6(e)]);if(i.status==="fulfilled"&&i.value?.length)return i.value;if(s.status==="fulfilled"&&s.value?.length)return s.value;throw i.reason||s.reason||Object.assign(new Error("DNS query failed"),{code:"ENOTFOUND"})};return{ok:!0,addrs:await Promise.race([o(),new Promise((i,s)=>setTimeout(()=>s(Object.assign(new Error("DNS timeout"),{code:"ETIMEOUT"})),t))]),elapsedMs:Date.now()-r}}catch(o){return{ok:!1,code:o.code||o.message,elapsedMs:Date.now()-r}}}async function en(e,{flushDns:t=!1}={}){let r=Date.now(),o=null;try{o=new URL(e).hostname}catch{}if(t&&zt(),o){let n=await So(o);if(!n.ok)return zt(),{ok:!1,dnsCode:n.code,elapsedMs:Date.now()-r}}try{let n=await K(`${e}/api/health`,{signal:AbortSignal.timeout(sl)});return{ok:n.ok,httpStatus:n.status,elapsedMs:Date.now()-r}}catch(n){return{ok:!1,dnsCode:n.cause?.code||n.code||n.message,elapsedMs:Date.now()-r}}}var al=H("tunnel"),Kn=null,Hn=null,tn=null,xt=null,it=0,bo=!1;async function Ao(e){try{let t=await Zt();await fetch(`http://${t}:${k}/api/ui/state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch{}}var To=!1;async function Ts(){if(!(!Hn||bo||To)){To=!0;try{await cl()}finally{To=!1}}}async function cl(){let e=await en(Hn),t=e.ok?"healthy":"unreachable";if(t===tn){xt=null,it=0;return}if(t!==xt){xt=t,it=1;return}it++,!(it<qi)&&(al.info(`${tn??"init"} \u2192 ${t}${e.ok?"":` (http=${e.httpStatus??"-"} dns=${e.dnsCode??"-"})`}`),tn=t,xt=null,it=0,await Ao({tunnelHealth:{status:t,checkedAt:Date.now()}}))}function bs(e){if(!e)return Wn();e!==Hn&&(Hn=e,tn=null,xt=null,it=0,zt(),Kn||(Kn=setInterval(Ts,ri.checkIntervalMs)),Ts())}var As=bs,nn=bs;function xs(){bo=!0}function Rs(){bo=!1}function Rt(e){tn=e,xt=null,it=0,Ao({tunnelHealth:{status:e,checkedAt:Date.now()}})}function Wn(){Kn&&(clearInterval(Kn),Kn=null),Hn=null,tn=null,xt=null,it=0,Ao({tunnelHealth:{status:"unknown",checkedAt:null}})}var Z=H("tunnel"),je={networkCheckIntervalMs:5e3,networkRestoreDelayMs:2500,internetCheckTimeoutMs:3e3,internetCheckHost:"1.1.1.1",internetCheckPort:443,edgeProbeIntervalMs:15e3,edgeProbeFailureThreshold:3,readyTimeoutMs:1500},ll=[20241,20242,20243,20244,20245],sn=null;async function ul(e,t){try{let o=await(await fetch(`http://localhost:${e}/ready`,{signal:AbortSignal.timeout(t)})).json();return typeof o?.readyConnections=="number"?o:null}catch{return null}}async function Ps(e,t){let r=await ul(e,t);if(!r)return null;let o=await pl(e,t);return o&&ge&&!ge.includes(o)?null:r.readyConnections}async function fl(e){if(sn!==null){let o=await Ps(sn,e);if(o!==null)return o;sn=null}let r=(await Promise.all(ll.map(async o=>({port:o,conns:await Ps(o,e)})))).find(o=>o.conns!==null);return r?(sn=r.port,r.conns):null}async function pl(e,t){try{return(await(await fetch(`http://localhost:${e}/quicktunnel`,{signal:AbortSignal.timeout(t)})).json())?.hostname||null}catch{return null}}var dl=3e4,xo=0,Vn=null,Mr=null,an=null,qn=null,cn=!1,jn=0,Oo=!1,ge=null,ln=0,Ro=0,Po=!1,Qn=0,Ge=0,ks=3e4,ml=5e3,Gn=st.default.join(at.default.homedir(),".9remote","bin"),Os="cloudflared",un=at.default.platform()==="win32",hl=un?`${Os}.exe`:Os,rn=st.default.join(Gn,hl),ko=st.default.join(at.default.homedir(),".9remote","cloudflared.pid"),Yn=!1,on=null,gl="2026.6.1",Ls=`https://github.com/cloudflare/cloudflared/releases/download/${gl}`;function Cs(){return new Promise(e=>{let t=new _s.default.Socket,r=!1,o=n=>{if(!r){r=!0;try{t.destroy()}catch{}e(n)}};t.setTimeout(je.internetCheckTimeoutMs),t.once("connect",()=>o(!0)),t.once("timeout",()=>o(!1)),t.once("error",()=>o(!1));try{t.connect(je.internetCheckPort,je.internetCheckHost)}catch{o(!1)}})}async function yl(){Oo=!0;try{let e=0;for(;;){if(e++,await Cs())return;await new Promise(t=>setTimeout(t,be(fe.internet,e)))}}finally{Oo=!1}}async function Xn(e,t){if(!qn){Z.warn("No restartCallback registered \u2014 skip");return}if(!cn&&!(Date.now()-Ro<ml)){Ro=Date.now(),cn=!0;try{await yl();let r=be(fe.tunnelRestart,jn+1);await new Promise(o=>setTimeout(o,r)),await qn(e),jn=0,Ro=0}catch(r){jn++,Z.error(`restart failed (#${jn}): ${r?.message||r}`),setImmediate(()=>{cn=!1,Xn(e,"retry after fail")});return}finally{cn=!1}}}var wl={darwin:{x64:"cloudflared-darwin-amd64.tgz",arm64:"cloudflared-darwin-arm64.tgz"},win32:{x64:"cloudflared-windows-amd64.exe"},linux:{x64:"cloudflared-linux-amd64",arm64:"cloudflared-linux-arm64"}};function vl(){let e=at.default.platform(),t=at.default.arch(),r=wl[e];if(!r)throw new Error(`Unsupported platform: ${e}`);let o=r[t];if(!o)throw new Error(`Unsupported architecture: ${t} for platform ${e}`);return`${Ls}/${o}`}var El=150;async function Ms(e,t,r){return new Promise((o,n)=>{let i=W.default.createWriteStream(t);Io.default.get(e,s=>{if([301,302].includes(s.statusCode)){i.close(),W.default.unlinkSync(t),Ms(s.headers.location,t,r).then(o).catch(n);return}if(s.statusCode!==200){i.close(),W.default.unlinkSync(t),n(new Error(`Download failed with status ${s.statusCode}`));return}let a=parseInt(s.headers["content-length"]||"0",10),c=0,l=0,u=-1;s.on("data",f=>{if(c+=f.length,!r||!a)return;let p=Date.now(),d=Math.min(100,Math.floor(c/a*100));d!==u&&p-l>=El&&(l=p,u=d,r(d))}),s.pipe(i),i.on("finish",()=>{r&&a&&r(100),i.close(()=>o(t))}),i.on("error",f=>{i.close(),W.default.unlinkSync(t),n(f)})}).on("error",s=>{i.close(),W.default.existsSync(t)&&W.default.unlinkSync(t),n(s)})})}async function Jn(e){if(W.default.existsSync(Gn)||W.default.mkdirSync(Gn,{recursive:!0}),W.default.existsSync(rn))return un||W.default.chmodSync(rn,"755"),rn;let t=vl(),r=t.endsWith(".tgz"),o=r?st.default.join(Gn,"cloudflared.tgz"):rn;try{return e?.({phase:"download",percent:0}),await Ms(t,o,n=>{e?.({phase:"download",percent:n})}),await Sl(t,o),r&&(e?.({phase:"extract"}),(0,Ve.execSync)(`tar -xzf "${o}" -C "${Gn}"`,{stdio:"pipe",windowsHide:!0}),W.default.unlinkSync(o)),un||W.default.chmodSync(rn,"755"),rn}catch(n){try{W.default.existsSync(o)&&W.default.unlinkSync(o)}catch{}throw console.error("Failed to download cloudflared:",n.message),n}}function $s(e){return new Promise((t,r)=>{Io.default.get(e,o=>{if([301,302].includes(o.statusCode))return $s(o.headers.location).then(t).catch(r);if(o.statusCode!==200)return r(new Error(`HTTP ${o.statusCode}`));let n="";o.on("data",i=>n+=i),o.on("end",()=>t(n))}).on("error",r)})}async function Sl(e,t){let r=st.default.basename(e),o;try{o=await $s(`${Ls}/sha256sum.txt`)}catch(c){Z.warn(`sha256 manifest unavailable (${c.message}), skipping verify`);return}let n=o.split(`
|
|
193
|
+
`).find(c=>c.includes(r));if(!n){Z.warn(`No sha256 entry for ${r}, skipping verify`);return}let i=n.trim().split(/\s+/)[0],{createHash:s}=await import("crypto"),a=s("sha256").update(W.default.readFileSync(t)).digest("hex");if(a!==i)throw new Error(`Integrity check failed: SHA256 mismatch (expected ${i}, got ${a})`)}function Tl(e){let t=/https:\/\/([a-z0-9-]+)\.trycloudflare\.com/gi,r=[];for(let o of e.matchAll(t))o[1]!=="api"&&r.push(`https://${o[1]}.trycloudflare.com`);return r.length?r[r.length-1]:null}async function Ye(e,t=null,r=null){let o=await Jn();Rl(o),r&&(qn=r),an=e;let n=W.default.mkdtempSync(st.default.join(at.default.tmpdir(),"9remote-quick-")),i=st.default.join(n,"config.yml");W.default.writeFileSync(i,`# quick-tunnel
|
|
194
|
+
`,"utf8");let s=!1,a=()=>{if(!s){s=!0;try{W.default.rmSync(n,{recursive:!0,force:!0})}catch{}}},c=(0,Ve.spawn)(o,["tunnel","--url",`http://localhost:${e}`,"--config",i,"--no-autoupdate","--protocol","http2"],{detached:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"]});return Ie("cloudflared",c.pid),on=c.pid,Yn=!1,new Promise((l,u)=>{let f=!1,p=null,d="",h=setTimeout(()=>{if(!f){f=!0,a(),on===c.pid&&(on=null);try{c.kill("SIGKILL")}catch{}Ke("cloudflared"),u(new Error("Quick tunnel timed out after 90s"))}},9e4),w=E=>{let O=E.toString();d+=O,d.length>4096&&(d=d.slice(-4096));let T=Tl(O);if(T){if(!f){f=!0,p=T,ge=T,ln=Date.now(),Ge=0,Qn=0,sn=null,clearTimeout(h),a(),Ol(),Z.info(`tunnel ready: ${T}`),l({child:c,tunnelUrl:T});return}T!==p&&(Z.info(`URL rotated: ${T}`),p=T,ge=T,ln=Date.now(),Ge=0,Qn=0,t?.(T))}};c.stdout.on("data",w),c.stderr.on("data",w),c.on("error",E=>{f||(f=!0,clearTimeout(h),a(),u(E))}),c.on("exit",(E,O)=>{a();let T=on!==c.pid,A=Yn||T;if(Z.info(`cloudflared exited (intentional=${Yn} superseded=${T})`),A||Rt("unreachable"),!f){f=!0,clearTimeout(h);let P=d.trim().split(`
|
|
195
|
+
`).slice(-5).join(" | ");on=null,u(new Error(`cloudflared exited (code=${E}, signal=${O}) output: ${P||"(empty)"}`));return}A||Xn(e,`quick tunnel exit code ${E}`)})})}function $r(e){if(un)try{(0,Ve.execSync)(`taskkill /PID ${e} /T /F`,{windowsHide:!0,stdio:"ignore"})}catch{}else try{process.kill(e,"SIGKILL")}catch{}}function bl(e){return e?e.split(`
|
|
196
|
+
`).flatMap(t=>{let r=t.match(/^\s*(\d+)\s+(.+)$/);return r?[{pid:Number(r[1]),args:r[2].trim()}]:[]}):[]}function Al(e,t){return Array.isArray(e)?e.filter(r=>{if(!r?.args||typeof r.pid!="number")return!1;let o=r.args.split(/\s+/);return o.includes(t)&&o.includes("tunnel")}).map(r=>r.pid):[]}function xl(e){try{let t=un?(0,Ve.execSync)(`powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter 'Name=\\'cloudflared.exe\\'' | ForEach-Object { \\"$($_.ProcessId) $($_.CommandLine)\\"" }"`,{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}):(0,Ve.execSync)("ps -eo pid=,args=",{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return Al(bl(t),e)}catch{return[]}}function Rl(e){let t=xl(e);for(let r of t)r!==process.pid&&(Z.info(`killing leftover cloudflared pid=${r}`),$r(r));return t}function Pl(e){try{let t=[];if(un){let r=`Get-NetTCPConnection -LocalPort ${e} -State Established -ErrorAction SilentlyContinue | Where-Object { (Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).Name -eq 'cloudflared' } | Select-Object -ExpandProperty OwningProcess -Unique`;t=(0,Ve.execSync)(`powershell -NoProfile -Command "${r}"`,{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}).split(/\r?\n/).map(n=>+n.trim()).filter(Boolean)}else t=(0,Ve.execSync)(`lsof -nP -iTCP:${e} -sTCP:ESTABLISHED 2>/dev/null | awk '/cloudflar/ {print $2}' | sort -u`,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).split(`
|
|
197
|
+
`).map(o=>+o.trim()).filter(Boolean);for(let r of new Set(t))$r(r)}catch{}}function Ae(){if(!Po){Po=!0;try{try{if(W.default.existsSync(ko)){let t=parseInt(W.default.readFileSync(ko,"utf8"));Number.isFinite(t)&&(Yn=!0,$r(t)),W.default.unlinkSync(ko)}}catch{}let e=Nn("cloudflared");Yn=!0,on=null,e&&($r(e),Ke("cloudflared")),Pl(k)}finally{setTimeout(()=>{Po=!1},2e3)}}}function Ns(){if(!ge)return!1;let e=Nn("cloudflared");return!!e&&ao(e)}function Ds(){jn=0,cn=!1,qn=null,an=null,ge=null,Ge=0,Qn=0,sn=null,Il()}var kl=/^(utun|awdl|llw|anpi|bridge|gif|stf|ipsec|ap|tun|tap|vmnet|veth|docker)/i;function Is(){let e=at.default.networkInterfaces(),t=[];for(let[r,o]of Object.entries(e))if(o&&!kl.test(r))for(let n of o)!n.internal&&n.family==="IPv4"&&t.push(`${r}:${n.address}`);return t.sort().join("|")}function Ol(){Vn||(Mr=Is(),xo=Date.now(),Vn=setInterval(async()=>{try{let e=Date.now(),t=e-xo;if(xo=e,Oo||cn||!qn||an==null)return;if(t>dl){if(Z.info(`Sleep/wake detected (gap=${t}ms)`),ge){let s=!1;for(let a=0;a<3;a++){if((await en(ge)).ok){s=!0;break}a<2&&await new Promise(l=>setTimeout(l,3e3))}if(s)return;Z.info("tunnel unresponsive after sleep \u2192 restarting")}Rt("unreachable"),Ae(),Xn(an,"woke from sleep");return}let r=Is(),o=r!==Mr;Mr=r;let n=Nn("cloudflared"),i=!n||!ao(n);if(!o&&!i){if(ge&&ln&&Date.now()-ln>ks&&e-Qn>=je.edgeProbeIntervalMs){Qn=e;let s=await en(ge);if(s.ok)Ge=0;else if(++Ge>=je.edgeProbeFailureThreshold){let a=await fl(je.readyTimeoutMs);if(a>0){Z.info(`edge probe failing but cloudflared holds ${a} connection(s) \u2014 not restarting`),Ge=0;return}Z.warn(`tunnel unreachable but cloudflared alive \u2014 edge lost after ${Ge} probes (ready=${a??"unknown"}), restarting`),Ge=0,Rt("unreachable"),Ae(),Xn(an,"tunnel unreachable (edge lost)")}else Z.debug(`edge probe failed (${Ge}/${je.edgeProbeFailureThreshold}) \u2014 ${s.dnsCode??s.httpStatus??"no response"}`)}return}if(o&&!i&&ln&&Date.now()-ln<ks||(o&&Z.info("Network change detected"),i&&Z.warn("cloudflared not alive \u2014 watchdog"),Rt("unreachable"),await new Promise(s=>setTimeout(s,je.networkRestoreDelayMs)),!await Cs()))return;if(o&&!i&&ge){let s=!1;for(let a=0;a<2;a++){if((await en(ge)).ok){s=!0;break}a===0&&await new Promise(l=>setTimeout(l,2e3))}if(s){Z.info("Tunnel survived network change, skip restart");return}}o&&!i&&Ae(),Xn(an,o?"network change":"liveness watchdog")}catch(e){Z.error(`network monitor tick failed: ${e?.message||e}`)}},je.networkCheckIntervalMs))}function Il(){Vn&&(clearInterval(Vn),Vn=null),Mr=null}Ot();var ct=R(require("crypto"),1),hn=require("fs");var Xs=require("path");var Lf=Buffer.from("302a300506032b656e","hex");var Dr=(0,Xs.join)(G.CONFIG,"hostKey.json"),Uf=Buffer.from("302a300506032b6570032100","hex"),mn=null;function Lo(){if(mn)return mn;try{if((0,hn.existsSync)(Dr)){let s=JSON.parse((0,hn.readFileSync)(Dr,"utf8")),a=Buffer.from(s.publicKey,"base64");if(!s.x25519PrivateKey){let l=ct.default.generateKeyPairSync("x25519");s.x25519PrivateKey=l.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),s.x25519PublicKey=l.publicKey.export({type:"spki",format:"der"}).toString("base64"),Fe(Dr,s)}let c=Buffer.from(s.x25519PublicKey,"base64");return mn={privateKey:ct.default.createPrivateKey({key:Buffer.from(s.privateKey,"base64"),format:"der",type:"pkcs8"}),publicKey:ct.default.createPublicKey({key:a,format:"der",type:"spki"}),publicKeyB64:a.subarray(-32).toString("base64"),x25519PrivateKey:ct.default.createPrivateKey({key:Buffer.from(s.x25519PrivateKey,"base64"),format:"der",type:"pkcs8"}),x25519PublicKeyB64:c.subarray(-32).toString("base64")},mn}}catch{}(0,hn.mkdirSync)(G.CONFIG,{recursive:!0});let{privateKey:e,publicKey:t}=ct.default.generateKeyPairSync("ed25519"),r=t.export({type:"spki",format:"der"}).toString("base64"),o=e.export({type:"pkcs8",format:"der"}).toString("base64"),n=ct.default.generateKeyPairSync("x25519"),i=n.publicKey.export({type:"spki",format:"der"}).toString("base64");return Fe(Dr,{privateKey:o,publicKey:r,x25519PrivateKey:n.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),x25519PublicKey:i}),mn={privateKey:e,publicKey:t,publicKeyB64:Buffer.from(r,"base64").subarray(-32).toString("base64"),x25519PrivateKey:n.privateKey,x25519PublicKeyB64:Buffer.from(i,"base64").subarray(-32).toString("base64")},mn}function lt(){return Lo().publicKeyB64}function ut(){return Lo().x25519PublicKeyB64}var Nl="9remote-session-v1";function Dl({apiKey:e,tunnelUrl:t,localIp:r,expiryMinutes:o,ts:n}){let i=a=>{let c=a==null?"":String(a);return`${c.length}:${c}`},s=`${Nl}|${i(e)}${i(t)}${i(r)}${i(o)}${i(n)}`;return ct.default.sign(null,Buffer.from(s,"utf8"),Lo().privateKey).toString("base64")}function It(e){let t=Date.now();return{ts:t,sig:Dl({...e,ts:t})}}async function ft(e,t={}){let r=t.intervalMs??ot.intervalMs,o=t.timeoutMs??ot.timeoutMs,n=`${e}/api/health`,i=(()=>{try{return new URL(e).hostname}catch{return null}})(),s=Date.now(),a=0,c=[];await F({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:[]}});let l=u=>{c.push(u);let f=c.length>ot.maxLogEntries?c.slice(-ot.maxLogEntries):c;F({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:f}})};for(;Date.now()-s<o;){if(a++,zt(),i){let f=await So(i,ot.dnsTimeoutMs);if(!f.ok){let p=f.code==="ENOTFOUND"||f.code==="ETIMEOUT"||f.code==="ESERVFAIL",d=p?"connecting...":f.code;Jt(`#${a} \u2192 ${d}`),l({attempt:a,status:d,elapsedMs:f.elapsedMs,ok:!1,waiting:p,time:Date.now()}),await new Promise(h=>setTimeout(h,r));continue}}let u=Date.now();try{let f=await K(n,{signal:AbortSignal.timeout(ot.fetchTimeoutMs)}),p=Date.now()-u;if(Jt(`#${a} \u2192 ${f.status}`),l({attempt:a,status:String(f.status),elapsedMs:p,ok:f.ok,time:Date.now()}),f.ok)return await F({healthCheck:{running:!1,timeoutMs:0,startedAt:null,logs:[]}}),await new Promise(d=>setTimeout(d,ot.postReadyHoldMs)),!0}catch(f){let p=Date.now()-u,d=f.cause?.code||f.code||f.message,h=d==="ENOTFOUND",w=h?"connecting...":d;Jt(`#${a} \u2192 ${w}`),l({attempt:a,status:w,elapsedMs:p,ok:!1,waiting:h,time:Date.now()})}await new Promise(f=>setTimeout(f,r))}return await F({healthCheck:{running:!1,timeoutMs:o,startedAt:s,logs:c}}),!1}var qe=H("tunnel"),Co=null,qs=null,Qs=0;async function _t(e,t){if(qe.debug(`updateTunnelUrl: key=${e?.slice(0,8)} url=${t}`),X().remoteEnabled===!1)return;if(Lt(e),t&&t===qs&&Date.now()-Qs<Xi){qe.debug("updateTunnelUrl: skipped (debounce, same URL)");return}Co&&(Co.cancelled=!0);let r={cancelled:!1};Co=r;let o=vs();Or({config:fe.urlSync,label:`urlSync ${t}`,log:n=>qe.warn(n),ctx:r,task:async()=>{let n=await K(`${L}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let s={apiKey:V(e),tunnelUrl:t,localIp:o?`${o}:${k}`:null};return{...s,...It(s)}})())});if(r.cancelled)return!0;if(n.ok)return qs=t,Qs=Date.now(),qe.debug(`urlSync OK: pushed ${t} to server`),Bl(t),!0;let i=await n.text().catch(()=>"");return qe.warn(`urlSync HTTP ${n.status}: ${i.slice(0,200)}`),!1}}),t&&As(t)}var gn=null,yn=null,Mo=!1,No=0;async function Do(e,t){let r={apiKey:e,online:t},o=await K(`${L}/api/session/heartbeat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...It(r)})});return o.ok||qe.warn(`heartbeat online=${t} HTTP ${o.status}`),o.ok}async function $o(){if(!(Mo||!yn)){Mo=!0;try{await Do(yn,!0),No=Date.now()}catch(e){qe.debug(`heartbeat failed: ${e?.message||e}`)}finally{Mo=!1}}}function Lt(e){let t=V(e);if(t&&X().remoteEnabled!==!1){if(gn&&yn===t){Date.now()-No>=fo&&$o();return}Br(),yn=t,$o(),gn=setInterval($o,fo),gn.unref?.()}}function Br({offline:e=!1}={}){gn&&(clearInterval(gn),gn=null);let t=yn;return yn=null,No=0,!e||!t?null:Do(t,!1).catch(r=>qe.debug(`goodbye failed: ${r?.message||r}`))}function pt(e){let t=V(e);if(!t)return Promise.resolve(!1);Br();let r=Do(t,!1).catch(o=>(qe.debug(`offline mark failed: ${o?.message||o}`),!1));return Promise.race([r,new Promise(o=>setTimeout(()=>o(!1),Ar))])}var zn=null;async function Bl(e){if(zn?.url===e)return;let t={url:e};zn=t,xs();try{let r=await ft(e,{timeoutMs:Qi});if(zn!==t)return;r&&Rt("healthy")}catch{}finally{zn===t&&(zn=null),Rs()}}var Qe=H("server"),ea=tr.default.dirname((0,zs.fileURLToPath)(__importMetaUrl)),Ul=tr.default.resolve(ea,"./server.cjs"),Js=tr.default.resolve(ea,"../../index.js");function Ur(e){try{process.platform==="win32"?(0,er.execSync)(`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${e}') do taskkill /F /PID %a`,{stdio:"ignore",windowsHide:!0}):(0,er.execSync)(`lsof -ti:${e} | xargs kill -9 2>/dev/null || true`,{stdio:"ignore"})}catch{}}function dt(e,t,r){let o=null,n=!1,i=!1,s=!0,a=0,c=null,l=()=>{s&&(Ur(k),s=!1);let u=process.env.NODE_ENV==="development"&&Bo.default.existsSync(Js),f=u?Js:Ul;Bo.default.existsSync(f)||(Qe.error(`Server not found: ${f}`),process.exit(1));let p={...process.env,PORT:String(k)};u||delete p.NODE_ENV,o=(0,er.spawn)(Zo,[f],{cwd:tr.default.dirname(f),stdio:["ignore","inherit","inherit"],detached:!1,windowsHide:!0,env:zo(p)}),c&&clearTimeout(c),c=setTimeout(()=>{a=0},Vi),o.on("exit",(d,h)=>{if(c&&(clearTimeout(c),c=null),n)return;if(i){i=!1,Qe.info("Restarting server (requested)..."),setTimeout(()=>{l(),r?.()},500);return}Qe.error(`Server exited unexpectedly (code: ${d}, signal: ${h})`),a++;let w=be(fe.server,a);Qe.warn(`Restarting server in ${w}ms (fail#${a})`),t&&t(),setTimeout(()=>{l(),r?.()},w)}),o.on("error",d=>{Qe.error(`Server error: ${d.message}`)}),e?.(o)};return l(),{getProcess:()=>o,shutdown:()=>{if(n=!0,!!o){try{o.kill("SIGTERM")}catch{}setTimeout(()=>{try{o&&o.kill("SIGKILL")}catch{}},2e3)}},restart:()=>{if(!o)return!1;i=!0;try{o.kill("SIGTERM")}catch{}return setTimeout(()=>{try{o&&i&&o.kill("SIGKILL")}catch{}},2e3),!0}}}function ta(e){return e?.restart?e.restart():!1}function Je({serverManager:e,tunnelProcess:t,exit:r=!0,code:o=0}={}){try{Wn()}catch{}try{e?.shutdown?.()}catch{}try{t?.kill?.()}catch{}try{Ae()}catch{}try{Pt()}catch{}try{Ur(k)}catch{}try{Ds()}catch{}try{hi()}catch{}try{Ke("agent")}catch{}try{Ke("cloudflared")}catch{}let n=Br({offline:!0});if(r){let i=new Promise(a=>setTimeout(a,Yi)),s=n?Promise.race([n,new Promise(a=>setTimeout(a,Ar))]):null;Promise.all([i,s]).finally(()=>process.exit(o))}}var Zs=!1;function mt(e,t){if(Zs)return;Zs=!0;let r=!1,o=n=>{r||(r=!0,Qe.info(`Stopping 9Remote (${n})...`),Je({serverManager:e,tunnelProcess:t}),Qe.info("Server stopped"))};if(process.on("SIGINT",()=>o("SIGINT")),process.on("SIGTERM",()=>o("SIGTERM")),process.on("SIGHUP",()=>o("SIGHUP")),process.platform==="win32"){process.on("SIGBREAK",()=>o("SIGBREAK"));try{import("readline").then(({createInterface:n})=>{n({input:process.stdin,output:process.stdout}).on("SIGINT",()=>o("SIGINT")),process.stdin.isTTY&&process.stdin.unref?.()}).catch(()=>{})}catch{}}process.on("uncaughtException",n=>{Qe.error(`Uncaught exception: ${n?.stack||n?.message||n}`),o("uncaughtException"),setTimeout(()=>process.exit(1),uo)}),process.on("unhandledRejection",n=>{Qe.error(`Unhandled rejection: ${n?.stack||n?.message||n}`),o("unhandledRejection"),setTimeout(()=>process.exit(1),uo)})}Ot();var ra=R(require("crypto"),1),oa=require("path");var Fl=H("pairing"),ia=(0,oa.join)(G.STATE,"pairing.json"),na="ABCDEFGHIJKLMNPQRSTUVWXYZ123456789",Kl=2;function sa(){let e="";for(let t=0;t<Kl;t++)e+=na[ra.default.randomInt(na.length)];return e}function Hl(){let e=pi(ia,null);return!e||Date.now()>e.expiresAt?null:e}function Wl(e){try{Fe(ia,e)}catch(t){Fl.error(`persist pairing state: ${t.message}`)}}function aa(e,t,r,o=null){Wl({tempKey:e,tail:t,expiresAt:r,workerUrl:o})}function ca(){let e=Hl();return e?{tempKey:e.tempKey,tail:e.tail,expiresAt:e.expiresAt}:null}var Uo=H("session"),jl=10;async function nr(e,t){let r=async()=>{let o=await K(`${t}/api/temp-key/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let n={apiKey:V(e),expiryMinutes:jl};return{...n,...It(n)}})())});if(!o.ok){let n=await o.json().catch(()=>null);throw new Error(n?.error||`HTTP ${o.status}`)}return o.json()};try{let o;try{o=await r()}catch(i){if(Uo.warn(`Temp key creation failed (${i.message}) \u2014 re-registering session`),!await or(e,t))throw i;o=await r()}let n=sa();return aa(o.tempKey,n,o.expiresAt,t),{...o,oneTimeKey:`${o.tempKey}${n}`}}catch(o){return Uo.error(`Temp key creation failed: ${o?.message||o}`),null}}function rr(e,t){return t?.tempKey?`${e}/login?k=${t.tempKey}#${t.oneTimeKey}`:`${e}/login`}async function or(e,t,r,o){try{let n=await K(`${t}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),hostPublicKey:lt(),hostX25519Key:ut(),tempKey:ca()?.tempKey||void 0})});if(!n.ok)throw new Error(`HTTP ${n.status}`);return r&&await K(`${t}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),tunnelUrl:r,...It({apiKey:V(e),tunnelUrl:r})})}).catch(()=>{}),o&&V(o)!==V(e)&&await K(`${t}/api/session/delete`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(o),...It({apiKey:V(o)})})}).catch(()=>{}),!0}catch(n){return Uo.error(`Session registration failed: ${n?.message||n}`),!1}}var Ct=H("tunnel");async function Gl(e,t,r,o){let n=0;for(;;){n++;try{return await Ye(e,t,r)}catch(i){let s=be(fe.tunnelSpawn,n);Ct.warn(`spawn attempt ${n} failed: ${i?.message||i} \u2014 retry in ${s}ms`),o?.({attempt:n,delay:s}),await new Promise(a=>setTimeout(a,s))}}}function Ze({onUrlUpdate:e,setTunnel:t,onRetry:r}){return async o=>{try{let n=await Gl(o,e,null,r);ze(),t(n.child),await e(n.tunnelUrl),Ct.info(`Tunnel restarted: ${n.tunnelUrl}`)}catch(n){Ct.error(`Tunnel restart failed: ${n?.message||n}`)}}}var Fr=null;function ze(){Fr&&(Fr.cancelled=!0,Fr=null)}function wn(e,{onUrlUpdate:t,onRestart:r,setActiveTunnel:o,onReady:n}){ze();let i={cancelled:!1};return Fr=i,Or({config:fe.tunnelRateLimit,task:async()=>{if(i.cancelled)return!0;if(Ns())return Ct.info("bg-tunnel: a tunnel is already live \u2014 standing down"),!0;let s=await Ye(e,t,r);if(i.cancelled){try{Ae()}catch{}return!0}try{o?.(s.child),await t?.(s.tunnelUrl),await n?.(s),Ct.info(`bg tunnel up: ${s.tunnelUrl}`)}catch(a){Ct.error(`bg tunnel post-spawn failed: ${a?.message||a}`)}return!0},label:"bg-tunnel",log:s=>Ct.info(s),ctx:i}),i}var Go=R(La(),1);var eu=H("session");function tu(e,t="\u{1F4F1} Scan QR to connect:"){console.log(ce.orange(`
|
|
198
|
+
${t}`)),Go.default.generate(e,{small:!0,type:"terminal",margin:0},r=>{console.log(r.trim())})}function nu(e){return new Promise(t=>{Go.default.generate(e,{small:!0,type:"terminal",margin:0},r=>{t(ce.orangeDim("\u{1F4F1} Scan QR to connect:")+`
|
|
199
|
+
`+r.trim())})})}async function jr(e,t){let r=await nr(e,L),o=Math.min(He.headerWidth,process.stdout.columns||55);if(!r){eu.warn("Temp key creation failed \u2014 showing UI without a QR"),await C(I.READY,{tunnelUrl:t,permanentKey:e,workerUrl:L}),console.log(m.red(`
|
|
200
|
+
\u274C Failed to create one-time key \u2014 generate a new one from the menu`)),console.log(ce.orange("\u2550".repeat(o))),console.log(m.white("App URL".padEnd(14))+m.gray(`${L}/login`)),console.log(m.white("Key".padEnd(14))+m.gray(e)),console.log(ce.orange("\u2550".repeat(o)));return}let n=rr(L,r);await C(I.READY,{tunnelUrl:t,oneTimeKey:r.oneTimeKey,oneTimeKeyExpiresAt:r.expiresAt,permanentKey:e,qrUrl:n,workerUrl:L}),tu(n),console.log(m.gray(`
|
|
200
201
|
QR will expire in 10 minutes (one-time use)
|
|
201
|
-
`)),console.log(
|
|
202
|
+
`)),console.log(ce.orange("\u2550".repeat(o))),console.log(m.white("App URL".padEnd(14))+m.gray(`${L}/login`)),console.log(m.white("One-Time Key".padEnd(14))+ce.orange.bold(r.oneTimeKey)),console.log(m.white("Key".padEnd(14))+m.gray(e)),console.log(ce.orange("\u2550".repeat(o)))}async function vn(e,t,r,o=""){let n=Math.min(He.headerWidth,process.stdout.columns||He.headerWidth),i=[];return e&&r?(i.push(await nu(r)),i.push(m.gray(`
|
|
202
203
|
QR expires in 30 minutes (one-time use)
|
|
203
204
|
`))):i.push(m.gray(`
|
|
204
205
|
(One-time key used \u2014 generate a new one from menu)
|
|
205
|
-
`)),i.push(
|
|
206
|
-
`)}var
|
|
207
|
-
\u{1F310} UI ready at ${i}`));let s=null;await F({permanentKey:e.key,step:
|
|
208
|
-
\u274C Failed to launch background: ${c.message}`)),process.exit(1)}let i=Date.now()+
|
|
206
|
+
`)),i.push(ce.orange("\u2550".repeat(n)),m.white("App URL".padEnd(14))+m.gray(`${L}/login`)),ti.showTunnelUrlInMenu&&i.push(m.white("Tunnel".padEnd(14))+(o?m.cyan(o):m.gray("\u2014"))),i.push(m.white("One-Time Key".padEnd(14))+(e?ce.orange.bold(e)+m.dim(" (expires in 30m)"):m.gray("\u2014")),m.white("Key".padEnd(14))+m.dim(t),ce.orange("\u2550".repeat(n))),i.join(`
|
|
207
|
+
`)}var we=H("cmd");function yt(e,t,r,o){let n=!1;setInterval(async()=>{if(n)return;let i=gi();if(i){n=!0;try{if(i==="stop-tunnel")await Ca(e,t,r);else if(i==="restart-tunnel")await Ca(e,t,r),await Ma(e,t,r);else if(i==="start-tunnel"){if(await Ma(e,t,r)==="alreadyRunning"){n=!1;return}}else i==="regenerate-key"?await ru():i==="shutdown"?ou(e,t):i==="update"?await rs():i==="restart"&&ta(o?.())}catch(s){we.error(`cmd "${i}" failed: ${s?.message||s}`)}finally{n=!1}}},Te.cmdMs)}async function Ca(e,t,r){ze(),Wn();let o=e();o&&(o.kill(),t(null),we.info("Tunnel stopped")),r&&await pt(r),await C(I.STOPPED,{tunnelUrl:"",oneTimeKey:"",oneTimeKeyExpiresAt:null,qrUrl:""}),dn({tunnelUrl:"",running:!0})}async function Ma(e,t,r){if(X().remoteEnabled===!1){we.info("Start skipped \u2014 remote is disabled");return}let o=e();if(o)if(o.killed||o.exitCode!=null)t(null);else{let n=await J("/api/ui/state");return await C(I.READY,{tunnelUrl:n?.tunnelUrl||""}),"alreadyRunning"}ze(),we.info("Starting...");try{await C(I.PREPARING),await Jn(Cr),await C(I.CONNECTING);let n=await K(`${L}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(r),hostPublicKey:lt(),hostX25519Key:ut()})});if(!n.ok)throw new Error(`Session create failed: ${n.status}`);await q("/api/signaling/retry",{}),Lt(r),await C(I.TUNNELING);let i=async l=>{await _t(r,l),await F({tunnelUrl:l}),nn(l),dn({tunnelUrl:l,running:!0})},s=({attempt:l,delay:u})=>{F({tunnelRetry:{attempt:l,delay:u,at:Date.now()}})},a=null;try{a=await Ye(k,i,Ze({onUrlUpdate:i,setTunnel:l=>t(l),onRetry:s}))}catch(l){we.error(`Tunnel spawn failed: ${l?.message||l} \u2014 QR RTC-only, bg retry`)}F({tunnelRetry:null});let c="";a&&(t(a.child),c=a.tunnelUrl,await C(I.VERIFYING),await ft(c)||(we.warn("Tunnel health check timed out \u2014 bg reconnect"),c="",t(null),a=null)),await jr(r,c),await C(I.READY,{tunnelUrl:c}),a||wn(k,{onUrlUpdate:i,onRestart:Ze({onUrlUpdate:i,setTunnel:l=>t(l),onRetry:s}),setActiveTunnel:t,onReady:async l=>{await C(I.READY,{tunnelUrl:l.tunnelUrl})}})}catch(n){we.error(`Failed to start: ${n.message}`),await C(I.STOPPED)}}async function ru(){if(X().remoteEnabled===!1){we.info("Key regeneration skipped \u2014 remote is disabled");return}let e=await Ut(),t=Ft(e),r=pr();if(!await or(t,L,mi()?.tunnelUrl,r?.key)){we.error("Key regeneration aborted \u2014 could not register the new key");return}Et(e,t,r?.name||"Default"),await F({permanentKey:t,oneTimeKey:"",oneTimeKeyExpiresAt:null,qrUrl:"",pairingUsed:!0}),we.info(`Key regenerated: ${ur(t)}`)}function ou(e,t){ze(),we.info("Shutting down 9Remote completely...");let r=e();t(null),Je({tunnelProcess:r}),we.info("9Remote stopped")}Ot();async function $a(){Ie("agent",process.pid),Qt(ke());let e=await nt(),t=process.argv.find(c=>c.startsWith("--theme=")),r=t?t.split("=")[1]:null,o=await le(),n=o?{getProcess:()=>null,shutdown:()=>{}}:dt(null,null);o||await new Promise(c=>setTimeout(c,he.serverBootMs));let i=`http://localhost:${k}`;console.log(m.green(`
|
|
208
|
+
\u{1F310} UI ready at ${i}`));let s=null;X().remoteEnabled===!1&&await pt(e.key),await F({permanentKey:e.key,step:I.STOPPED,theme:r}),mt(n,null),yt(()=>s,c=>{s=c},e.key,()=>n),await Zn({port:k,onQuit:()=>{let c=s;s=null,Je({serverManager:n,tunnelProcess:c,exit:!1}),Pt(),setTimeout(()=>process.exit(0),500)},onOpenUI:()=>kt(i)}),dn({tunnelUrl:"",running:!0}),(process.argv.includes("--start")||process.argv.includes("--skip-update"))&&X().remoteEnabled!==!1&&Ht("start-tunnel"),await new Promise(()=>{})}Ot();async function Na(){Ie("agent",process.pid),Gi().catch(()=>{});let e=await nt(),t=process.argv.find(u=>u.startsWith("--theme=")),r=t?t.split("=")[1]:null,o=await le(),n=o?{getProcess:()=>null,shutdown:()=>{}}:dt(null,null);o||await new Promise(u=>setTimeout(u,he.serverBootMs));let i=`http://localhost:${k}`,s=null;await F({permanentKey:e.key,step:I.STOPPED,theme:r});let a=()=>{let u=s;s=null,Je({serverManager:n,tunnelProcess:u,exit:!1})};mt(n,null),yt(()=>s,u=>{s=u},e.key,()=>n);try{Ke("cloudflared")}catch{}(process.argv.includes("--start")||process.argv.includes("--skip-update"))&&X().remoteEnabled!==!1&&Ht("start-tunnel"),await Zn({port:k,onQuit:a,onOpenUI:()=>kt(i)})&&_o({title:"9Remote is running",message:`Open ${i} or use the tray icon to manage.`}),await new Promise(()=>{})}var $t=H("mode");async function iu(e){$t.info("Starting server..."),await C(I.PREPARING);try{Ae(),await new Promise(l=>setTimeout(l,he.killCloudflaredMs))}catch{}let t=X().remoteEnabled===!1,r=!t;if(t&&await pt(e),r)try{let l=await K(`${L}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),hostPublicKey:lt(),hostX25519Key:ut()})});if(!l.ok)throw new Error(`Session create failed: ${l.status}`);Lt(e)}catch(l){$t.error(`Session create failed: ${l.message} \u2014 local-only, retry from Web UI`),r=!1}let o=await le(),n=o?{getProcess:()=>null,shutdown:()=>{}}:dt(null,null);o||await new Promise(l=>setTimeout(l,he.serverBootMs)),$t.info("Starting tunnel..."),await C(I.CONNECTING);let i={current:null},s="",a=async l=>{$t.info(`Tunnel URL rotated: ${l}`),await _t(e,l),F({tunnelUrl:l}),nn(l)},c=null;if(r)try{c=await Ye(k,a,Ze({onUrlUpdate:a,setTunnel:l=>{i.current=l}}))}catch(l){$t.error(`Tunnel spawn failed: ${l.message} \u2014 RTC-only, bg retry`)}return c&&(i.current=c.child,s=c.tunnelUrl,await ft(s)||($t.warn("Tunnel health check timed out \u2014 bg reconnect"),i.current=null,s="",c=null)),!c&&r&&wn(k,{onUrlUpdate:a,onRestart:Ze({onUrlUpdate:a,setTunnel:l=>{i.current=l}}),setActiveTunnel:l=>{i.current=l},onReady:async l=>{await C(I.READY,{tunnelUrl:l.tunnelUrl})}}),s&&await _t(e,s),r?await C(I.READY,{tunnelUrl:s}):await C(I.STOPPED,{tunnelUrl:""}),_n({apiKey:e,tunnelUrl:s,serverPid:n.getProcess()?.pid,tunnelPid:i.current?.pid}),{serverManager:n,tunnelRef:i,tunnelUrl:s,remoteOnline:r}}async function Da(){Qt(ke());let e=await nt();$t.info(`Using key: ${ur(e.key)} (${e.name})`);let{serverManager:t,tunnelRef:r,tunnelUrl:o,remoteOnline:n}=await iu(e.key);n?await jr(e.key,o):console.log(`\u26A0 ${X().remoteEnabled===!1?"Remote is disabled \u2014 enable it in Web UI settings":'Remote not connected \u2014 tap "remote \xB7 offline" in the Web UI to retry'}. Local mode.`),mt(t,r.current),yt(()=>r.current,s=>{r.current=s},e.key);let i=Date.now();setInterval(()=>{let s=Math.floor((Date.now()-i)/1e3),a=Math.floor(s/3600),c=Math.floor(s%3600/60),l=s%60;F({uptime:`${a}:${String(c).padStart(2,"0")}:${String(l).padStart(2,"0")}`})},Te.statsMs),await new Promise(()=>{})}var Ba=R(require("path"),1),Ua=R(require("fs"),1);Ot();async function Fa(){let e=`http://localhost:${k}`;await le()&&(Ur(k),await new Promise(c=>setTimeout(c,500)));let t=["--tray"],r=process.argv.find(c=>c.startsWith("--theme="));r&&t.push(r);let o=Cn;try{Ua.default.mkdirSync(Ba.default.dirname(o),{recursive:!0})}catch{}let n=null;try{n=Wi(t),n&&Ie("agent",n)}catch(c){console.log(m.red(`
|
|
209
|
+
\u274C Failed to launch background: ${c.message}`)),process.exit(1)}let i=Date.now()+Te.bgServerReadyTimeoutMs,s=!1;for(;Date.now()<i;){if(await le()){s=!0;break}await new Promise(c=>setTimeout(c,Te.bgServerReadyIntervalMs))}s||(console.log(m.red(`
|
|
209
210
|
\u274C Background server failed to start.`)),console.log(m.gray(` Check log: ${o}
|
|
210
|
-
`)),process.exit(1))
|
|
211
|
+
`)),process.exit(1)),Ht("start-tunnel"),kt(e);let a=n?` (PID: ${n})`:"";console.log(m.green(`
|
|
211
212
|
\u{1F310} 9Remote running at ${e}${a}`)),console.log(m.gray(`\u{1F4A1} Log: ${o}
|
|
212
|
-
`)),await new Promise(c=>setTimeout(c,
|
|
213
|
+
`)),await new Promise(c=>setTimeout(c,he.bgSpawnFlushMs)),process.exit(0)}var Ka=R(require("readline"),1);var Gr=H("mode"),En=null;async function Ha(){Ie("agent",process.pid),console.clear(),ds(),ys(!0),await C(I.PREPARING);let e=await nt(),t=null,r={getProcess:()=>null,shutdown:()=>{}};if(!await le()){r=dt(null,null,()=>{if(process.stdin.isTTY){try{process.stdin.setRawMode(!1)}catch{}try{process.stdin.setRawMode(!0),process.stdin.resume()}catch{}}try{Ka.default.emitKeypressEvents(process.stdin)}catch{}t?.()});let g=Date.now()+Te.serverReadyTimeoutMs;for(;Date.now()<g&&!await le();)await new Promise(b=>setTimeout(b,Te.serverReadyIntervalMs))}try{Ae(),await new Promise(g=>setTimeout(g,he.killCloudflaredTuiMs))}catch{}try{await Jn(Cr)}catch(g){Gr.error(`cloudflared setup failed: ${g?.message||g} \u2014 retry from Web UI`)}await C(I.CONNECTING);let n=X().remoteEnabled===!1,i=!n;if(n&&await pt(e.key),i)try{let g=await K(`${L}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e.key),hostPublicKey:lt(),hostX25519Key:ut()})});if(!g.ok)throw new Error(`Session create failed: ${g.status}`);await q("/api/signaling/retry",{}),Lt(e.key)}catch(g){Gr.error(`Failed to connect: ${g.message}`),i=!1}await C(I.TUNNELING);let s=i?await nr(e.key,L):null,a=rr(L,s),c=s?.oneTimeKey||"",l=a,u="",f=null,p={current:null},d=async g=>{u=g,await _t(e.key,g),await F({tunnelUrl:g}),nn(g),f!==null&&(f=await vn(c,e.key,l,u),t?.())},h=null;if(i)try{h=await Ye(k,d,Ze({onUrlUpdate:d,setTunnel:g=>{p.current=g}}))}catch(g){Gr.error(`Tunnel spawn failed: ${g?.message||g} \u2014 QR RTC-only, bg retry`)}h&&(p.current=h.child,u=h.tunnelUrl,_n({apiKey:e.key,tunnelUrl:h.tunnelUrl,tunnelPid:h.child?.pid}),await C(I.VERIFYING),await ft(h.tunnelUrl)?await d(h.tunnelUrl):(Gr.warn("Tunnel health check timed out \u2014 bg reconnect"),p.current=null,u="",h=null)),!h&&i&&wn(k,{onUrlUpdate:d,onRestart:Ze({onUrlUpdate:d,setTunnel:g=>{p.current=g}}),setActiveTunnel:g=>{p.current=g},onReady:async g=>{_n({apiKey:e.key,tunnelUrl:g.tunnelUrl,tunnelPid:g.child?.pid}),await C(I.READY,{tunnelUrl:g.tunnelUrl})}}),i?await C(I.READY,{tunnelUrl:u,oneTimeKey:s?.oneTimeKey||"",oneTimeKeyExpiresAt:s?.expiresAt||null,permanentKey:e.key,qrUrl:a,workerUrl:L}):(await C(I.STOPPED,{tunnelUrl:"",oneTimeKey:"",oneTimeKeyExpiresAt:null,permanentKey:e.key,qrUrl:"",workerUrl:L}),console.log(m.red(`
|
|
214
|
+
\u26A0 ${n?"Remote is disabled \u2014 enable it in Web UI settings":'Remote not connected \u2014 tap "remote \xB7 offline" in the Web UI to retry'}. Local mode.
|
|
215
|
+
`))),await new Promise(g=>setTimeout(g,he.trayReadyMs)),f=await vn(c,e.key,l,u);let w=[],E=!1,O=()=>{E||t?.()},T=async(g,b,_)=>{if(!E){E=!0;try{let $=await ms(b,_);await q(`/api/device/${$?"approve":"reject"}`,{socketId:g})}catch{}finally{E=!1,t?.()}}},A=hs(k,async(g,b)=>{if(g==="log"&&b.message)w.push(b.message),w.length>He.maxLogLines&&w.shift();else if(g==="state"){let _=b.permanentKey||e.key,$=b.oneTimeKey!==void 0?b.oneTimeKey:c,Y=b.qrUrl!==void 0?b.qrUrl:l,re=b.tunnelUrl!==void 0?b.tunnelUrl:u;($!==c||_!==e.key||re!==u)&&(c=$,l=Y,u=re,b.permanentKey&&(e={...e,key:b.permanentKey}),f=await vn(c,e.key,l,u),O())}else g==="permissions"?(E||Promise.resolve(En?.()).catch(()=>{}),O()):g==="autostart"||g==="sleepInhibit"?(E||Promise.resolve(En?.()).catch(()=>{}),O()):g==="deviceApproval"&&b.action==="pending"&&await T(b.socketId,b.deviceId,b.ip)}),P=setInterval(async()=>{if(!E)try{let b=(await J("/api/device/pending"))?.pending?.[0];b&&await T(b.socketId,b.deviceId,b.ip)}catch{}},Te.pendingApprovalMs);mt({getProcess:r.getProcess,shutdown:()=>{ze(),r.shutdown();try{p.current?.kill()}catch{}A(),clearInterval(P)}}),yt(()=>p.current,g=>{p.current=g},e.key,()=>r),await su(e,u,()=>f,g=>{f=g},g=>{t=g},()=>{ze();try{A()}catch{}try{clearInterval(P)}catch{}Je({serverManager:r,tunnelProcess:p.current,exit:!1})},w)}async function su(e,t,r,o,n,i,s){for(;;){let{desktopEnabled:a,remoteAvailable:c,autoApprove:l}=await vo(),u=[{label:"Open Web UI",action:"webui"}];X().remoteEnabled!==!1&&u.push({label:"Keys \u25B6",action:"keys"}),c&&u.push({label:`Remote Desktop: ${a?m.green("ON"):m.gray("OFF")} \u25B6`,action:"desktop"}),u.push({label:`Manage Devices \u25B6 ${m.dim("(Auto-approve:")} ${l?m.green("ON"):m.gray("OFF")}${m.dim(")")}`,action:"devices"},{label:"Settings \u25B6",action:"settings"},{label:"View Logs",action:"logs"},{label:m.gray("Exit"),action:"exit"});let f=null;n(()=>f?.());let p=await Me("",u,0,r,h=>{f=h},i),d=p>=0?u[p].action:"exit";if(d==="webui"){let h=`http://localhost:${k}`,{openBrowser:w}=await Promise.resolve().then(()=>(Ot(),Ys));w(h),console.log(m.green(`
|
|
213
216
|
\u{1F310} Opening ${h}
|
|
214
|
-
`))}else if(d==="keys")await
|
|
217
|
+
`))}else if(d==="keys")await au(e,t,o,r);else if(d==="desktop")await uu();else if(d==="devices")await fu();else if(d==="settings")await lu();else if(d==="logs")await pu();else{try{i?.()}catch{}console.log(m.gray(`
|
|
215
218
|
Goodbye!
|
|
216
|
-
`)),process.exit(0)}}}async function
|
|
219
|
+
`)),process.exit(0)}}}async function au(e,t,r,o){let n=X().remoteEnabled===!1?[{label:m.gray("Remote access is off \u2014 enable it in the Web UI"),action:"back"}]:[{label:"New One-Time Key",action:"otk"},{label:"Regenerate Permanent Key",action:"regen"},{label:m.gray("\u2190 Back"),action:"back"}],i=await Me("Keys",n,0,o),s=i>=0?n[i].action:"back";if(s==="otk"){let a=await nr(e.key,L);if(a){let c=rr(L,a);r(await vn(a.oneTimeKey,e.key,c,t)),await F({oneTimeKey:a.oneTimeKey,oneTimeKeyExpiresAt:a.expiresAt,qrUrl:c})}}else if(s==="regen"&&await yo(m.yellow("Replace current key and disconnect all sessions? Continue?"))){let c=await Ut(),l=Ft(c);if(!await or(l,L,t,e.key)){r(m.red("Key regeneration failed \u2014 could not reach the server"));return}let u=Et(c,l,e.name||"Default");Object.assign(e,u),r(await vn("",e.key,"",t)),await F({permanentKey:e.key,oneTimeKey:"",oneTimeKeyExpiresAt:null,qrUrl:"",pairingUsed:!0})}}var Vo={none:"Off","30m":"Off after 30 min idle","1h":"Off after 1 hour idle","2h":"Off after 2 hours idle","4h":"Off after 4 hours idle","24h":"Off after 24 hours idle",never:"Never off"};async function cu(e,t){let r=t.map(s=>({label:Vo[s]||s,action:s}));r.push({label:m.gray("\u2190 Back"),action:"back"});let o=Math.max(0,t.indexOf(e)),n=await Me("Prevent sleep",r,o),i=n>=0?r[n].action:"back";i!=="back"&&await q("/api/sleep-inhibit",{mode:i})}async function lu(){for(;;){let e=!1,t="never",r=[],o=()=>[{label:`Launch on system startup: ${e?m.green("ON"):m.gray("OFF")}`,action:"autostart"},{label:`Prevent sleep: ${t==="none"?m.gray(Vo.none):m.green(Vo[t]||t)} \u25B6`,action:"sleep"},{label:m.gray("\u2190 Back"),action:"back"}],n=o(),i=null,s=async()=>{let l=await vo();e=!!l.autoStart,t=l.sleepInhibitMode||"never",r=l.sleepInhibitPresets||[],n=o(),i?.()};await s(),En=s;let a=await Me("Settings",n,0,"",l=>{i=l});En=null;let c=a>=0?n[a].action:"back";if(c==="autostart")await q("/api/autostart",{enabled:!e});else if(c==="sleep")await cu(t,r);else return}}async function uu(){for(;;){let e=!1,t={screenRecording:!1,accessibility:!1},r=()=>({toggle:`Toggle: ${e?m.green("ON \u2192 turn OFF"):m.gray("OFF \u2192 turn ON")}`,sr:`Screen Recording ${t.screenRecording?m.green("\u2713"):m.red("\u2717 (click to grant)")}`,ax:`Mouse & Keyboard control ${t.accessibility?m.green("\u2713"):m.red("\u2717 (click to grant)")}`}),o=[{label:""},{label:""},{label:""},{label:m.gray("\u2190 Back")}],n=null,i=async()=>{let a=await J("/api/ui/state")||{};e=!!a.desktopEnabled,t={screenRecording:!!a.screenRecording,accessibility:!!a.accessibility};let c=r();o[0].label=c.toggle,o[1].label=c.sr,o[2].label=c.ax,n?.()};await i(),En=i;let s=await Me("Remote Desktop",o,0,"",a=>{n=a});if(En=null,s===0)await q("/api/desktop/toggle",{enabled:!e});else if(s===1&&!t.screenRecording)await q("/api/permissions/request",{type:"screenRecording"})||kr("screenRecording");else if(s===2&&!t.accessibility)await q("/api/permissions/request",{type:"accessibility"})||kr("accessibility");else if(s===3||s===-1)return}}async function fu(){for(;;){let[e,t]=await Promise.all([J("/api/device/approved"),J("/api/device/auto-approve")]),r=e?.devices||[],o=!!t?.enabled,n=[{label:`Auto-approve new devices: ${o?m.green("ON"):m.gray("OFF")}`,action:"toggle"},...r.map(a=>{let c=a.deviceId.slice(0,8),l=a.approvedAt?new Date(a.approvedAt).toLocaleString():"unknown";return{label:`${c}... ${m.dim(l)}`,action:"remove",deviceId:a.deviceId}}),{label:m.gray("\u2190 Back"),action:"back"}],i=await Me(`Approved Devices (${r.length})`,n,0);if(i===-1)return;let s=n[i];if(s.action==="back")return;if(s.action==="toggle"){await q("/api/device/auto-approve",{enabled:!o});continue}s.action==="remove"&&await yo(m.yellow(`Remove device ${s.deviceId.slice(0,8)}...?`))&&await q("/api/device/remove",{deviceId:s.deviceId})}}async function pu(){let e=Ai(ei),t=e.length?e.join(`
|
|
217
220
|
`):m.gray(" No logs yet"),r=`
|
|
218
|
-
${m.dim("Log file:")} ${m.cyan(
|
|
219
|
-
${m.dim(`Tail: tail -f ${
|
|
221
|
+
${m.dim("Log file:")} ${m.cyan(Cn)}
|
|
222
|
+
${m.dim(`Tail: tail -f ${Cn}`)}`;await Me("Logs",[{label:m.gray("\u2190 Back")}],0,t+r)}async function Wa(){let e=ke(),t=await ns(),r=go(e,t?.latest??null),o=[];t?.latest&&o.push({label:m.yellow(`Update to v${t.latest}`),action:"update"}),o.push({label:"Open Web UI (background)",action:"ui"},{label:"Terminal UI",action:"tui"},{label:m.gray("Exit"),action:"exit"});let n=await Me("",o,0,r),i=n>=0?o[n].action:"exit";if(i==="update"){let s=Math.min(He.headerWidth,process.stdout.columns||He.headerWidth);Pr(),console.log(ce.orange(`
|
|
220
223
|
`+"\u2550".repeat(s))),console.log(m.gray(` \u2713 Stopped running instances
|
|
221
224
|
`)),console.log(m.yellow(` \u2B06 Run this command to update:
|
|
222
|
-
`)),console.log(m.white.bold(` npm i -g ${
|
|
223
|
-
`)),console.log(
|
|
224
|
-
`),process.exit(0)}else i==="ui"?await
|
|
225
|
+
`)),console.log(m.white.bold(` npm i -g ${Ue}
|
|
226
|
+
`)),console.log(ce.orange("\u2550".repeat(s))+`
|
|
227
|
+
`),process.exit(0)}else i==="ui"?await Fa():i==="tui"?await Ha():process.exit(0)}var ja=[["9remote","Interactive menu (TUI). Falls back to help with no TTY."],["9remote start","Run server + tunnel in foreground (headless)."],["9remote key","Show permanent key + connect URL."],["9remote key --new","Regenerate the permanent key."],["9remote otk","Create a fresh one-time connect key + URL."],["9remote devices","List approved devices."],["9remote auto-approve <on|off>","Toggle device auto-approve."],["9remote approve <socketId>","Approve a pending device."],["9remote help","Show this help."]];function Yo(){Qt(ke()),console.log(m.white.bold(`
|
|
225
228
|
Usage:
|
|
226
|
-
`));let e=Math.max(...
|
|
229
|
+
`));let e=Math.max(...ja.map(([t])=>t.length))+2;for(let[t,r]of ja)console.log(" "+m.cyan(t.padEnd(e))+m.gray(r));console.log()}async function ir(){return await le()?!0:(console.log(m.red(`
|
|
227
230
|
\u2717 Server not running. Start it first: `)+m.cyan("9remote start")+`
|
|
228
|
-
`),!1)}async function
|
|
231
|
+
`),!1)}async function du(e){if(!await ir())return;if(e){let r=await q("/api/key/regenerate"),o=r&&r.ok?await r.json():null;if(!o?.permanentKey){console.log(m.red(`
|
|
229
232
|
\u2717 Regenerate failed
|
|
230
233
|
`));return}console.log(m.green(`
|
|
231
234
|
\u2713 New key: `)+m.white.bold(o.permanentKey)+`
|
|
232
|
-
`);return}let t=await
|
|
235
|
+
`);return}let t=await J("/api/ui/state")||{};if(!t.permanentKey){console.log(m.red(`
|
|
233
236
|
\u2717 No key yet. Run: `)+m.cyan("9remote start")+`
|
|
234
237
|
`);return}console.log(m.white(`
|
|
235
|
-
Key`.padEnd(14))+m.white.bold(t.permanentKey)),t.qrUrl&&console.log(m.white("Connect URL".padEnd(14))+m.cyan(t.qrUrl)),console.log(m.white("App URL".padEnd(14))+m.gray(`${
|
|
236
|
-
`)}async function
|
|
238
|
+
Key`.padEnd(14))+m.white.bold(t.permanentKey)),t.qrUrl&&console.log(m.white("Connect URL".padEnd(14))+m.cyan(t.qrUrl)),console.log(m.white("App URL".padEnd(14))+m.gray(`${L}/login`)+`
|
|
239
|
+
`)}async function mu(){if(!await ir())return;let e=await q("/api/key/one-time"),t=e&&e.ok?await e.json():null;if(!t?.qrUrl){console.log(m.red(`
|
|
237
240
|
\u2717 Failed to create one-time key
|
|
238
241
|
`));return}console.log(m.green(`
|
|
239
242
|
\u2713 One-time key (30 min): `)+m.white.bold(t.oneTimeKey)),console.log(m.white("Connect URL ")+m.cyan(t.qrUrl)+`
|
|
240
|
-
`)}async function
|
|
243
|
+
`)}async function hu(){if(!await ir())return;let t=(await J("/api/device/approved")||{}).devices||[],r=await J("/api/device/auto-approve")||{};if(console.log(m.white(`
|
|
241
244
|
Auto-approve: `)+(r.enabled?m.green("ON"):m.gray("OFF"))),!t.length){console.log(m.gray(`No approved devices
|
|
242
|
-
`));return}console.log(m.white(`Approved devices (${t.length}):`));for(let o of t)console.log(" "+m.cyan(o.deviceId));console.log()}async function
|
|
245
|
+
`));return}console.log(m.white(`Approved devices (${t.length}):`));for(let o of t)console.log(" "+m.cyan(o.deviceId));console.log()}async function gu(e){if(!await ir())return;let t=e==="on";if(e!=="on"&&e!=="off"){console.log(m.red(`
|
|
243
246
|
\u2717 Usage: 9remote auto-approve <on|off>
|
|
244
|
-
`));return}let r=await
|
|
247
|
+
`));return}let r=await q("/api/device/auto-approve",{enabled:t}),o=r&&r.ok?await r.json():null;console.log(m.green(`
|
|
245
248
|
\u2713 Auto-approve: `)+(o?.enabled?m.green("ON"):m.gray("OFF"))+`
|
|
246
|
-
`)}async function
|
|
249
|
+
`)}async function yu(e){if(!await ir())return;if(!e){let n=(await J("/api/device/pending")||{}).pending||[];if(!n.length){console.log(m.gray(`
|
|
247
250
|
No pending devices
|
|
248
251
|
`));return}console.log(m.white(`
|
|
249
252
|
Pending devices (${n.length}):`));for(let i of n)console.log(" "+m.cyan(i.socketId)+m.gray(` ${i.deviceId?.slice(0,8)||""} ${i.ip||""}`));console.log(m.gray(`
|
|
250
253
|
Approve with: `)+m.cyan("9remote approve <socketId>")+`
|
|
251
|
-
`);return}let t=await
|
|
254
|
+
`);return}let t=await q("/api/device/approve",{socketId:e}),r=t&&t.ok?await t.json():null;console.log(r?.ok?m.green(`
|
|
252
255
|
\u2713 Approved
|
|
253
256
|
`):m.red(`
|
|
254
257
|
\u2717 Approve failed (invalid socketId?)
|
|
255
|
-
`))}async function
|
|
256
|
-
`),process.exit(0));
|
|
258
|
+
`))}async function Ga(e){let t=e[2],r=e.slice(3);switch(t){case"help":case"-h":case"--help":return Yo(),!0;case"key":return await du(r.includes("--new")),!0;case"otk":return await mu(),!0;case"devices":return await hu(),!0;case"auto-approve":return await gu(r[0]),!0;case"approve":return await yu(r[0]),!0;default:return!1}}var Xo=process.argv[2];(Xo==="version"||Xo==="--version"||Xo==="-v")&&(process.stdout.write(ke()+`
|
|
259
|
+
`),process.exit(0));bi();async function wu(){let e=process.argv[2];if(await Ga(process.argv))return;process.argv.includes("--tray")||process.argv.includes("--auto")||process.argv.includes("--start")||Pr(),e==="ui"?await $a():e==="start"||process.argv.includes("--auto")?await Da():process.argv.includes("--tray")||process.argv.includes("--start")?await Na():process.stdin.isTTY?await Wa():Yo()}wu().catch(console.error);
|