blink 1.1.38 → 1.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{auth-CoSUgwyr.js → auth-DcHT4wFv.js} +1 -1
- package/dist/cli/{chat-wAiBl3t2.js → chat-CH6IX_Ao.js} +1 -1
- package/dist/cli/{config-BsZ3w9Jq.js → config-2GO8ol_o.js} +1 -1
- package/dist/cli/connect-Crx6klCf.js +1 -0
- package/dist/cli/{connect-Bv4IIsf7.js → connect-GiF_KyuT.js} +1 -1
- package/dist/cli/{dev-DLhZmDQk.js → dev-B4Xmjy-k.js} +3 -9
- package/dist/cli/index.js +2 -2
- package/dist/cli/{init-CKvxXVHz.js → init-DlL0Hqpe.js} +1 -1
- package/dist/cli/login-gyqns-J2.js +1 -0
- package/dist/cli/logout-DBSOwqWf.js +1 -0
- package/dist/cli/{pull-BD3r6ZuM.js → pull-Cz1_1InT.js} +1 -1
- package/dist/cli/{run-xA0ZUSSZ.js → run-DO2Nc565.js} +1 -1
- package/dist/cli/{setup-github-app-CO4Jn7Ns.js → setup-github-app-Cvt5RYA-.js} +1 -1
- package/dist/cli/{util-DVoCnp-M.js → util-Gf_yR-5b.js} +1 -1
- package/dist/node/agent/index.node.cjs +1 -1
- package/dist/node/agent/index.node.js +1 -1
- package/dist/node/{index.node-CU27y0G9.js → index.node-B1vVJ49J.js} +1 -1
- package/dist/node/{index.node-DfJSk6zl.cjs → index.node-DL1tnrix.cjs} +1 -1
- package/dist/node/react/index.node.cjs +1 -1
- package/dist/node/react/index.node.js +1 -1
- package/package.json +1 -1
- package/dist/cli/connect-CcHBw8DE.js +0 -1
- package/dist/cli/login-CPTUG7RA.js +0 -1
- package/dist/cli/logout-B4OpDEqp.js +0 -1
|
@@ -122,5 +122,5 @@ ${Li}${t.trimStart()}`),n=3+T(t.trimStart()).length)}process.stdout.write(`
|
|
|
122
122
|
`:`
|
|
123
123
|
`)+n,i=r+1,r=e.indexOf(`
|
|
124
124
|
`,i)}while(r!==-1);return a+=e.slice(i),a}const{stdout:na,stderr:ra}=$i,ia=Symbol(`GENERATOR`),aa=Symbol(`STYLER`),oa=Symbol(`IS_EMPTY`),sa=[`ansi`,`ansi`,`ansi256`,`ansi16m`],ca=Object.create(null),la=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=na?na.level:0;e.level=t.level===void 0?n:t.level},ua=e=>{let t=(...e)=>e.join(` `);return la(t,e),Object.setPrototypeOf(t,da.prototype),t};function da(e){return ua(e)}Object.setPrototypeOf(da.prototype,Function.prototype);for(let[e,t]of Object.entries(Z))ca[e]={get(){let n=ha(this,ma(t.open,t.close,this[aa]),this[oa]);return Object.defineProperty(this,e,{value:n}),n}};ca.visible={get(){let e=ha(this,this[aa],!0);return Object.defineProperty(this,`visible`,{value:e}),e}};const fa=(e,t,n,...r)=>e===`rgb`?t===`ansi16m`?Z[n].ansi16m(...r):t===`ansi256`?Z[n].ansi256(Z.rgbToAnsi256(...r)):Z[n].ansi(Z.rgbToAnsi(...r)):e===`hex`?fa(`rgb`,t,n,...Z.hexToRgb(...r)):Z[n][e](...r);for(let e of[`rgb`,`hex`,`ansi256`]){ca[e]={get(){let{level:t}=this;return function(...n){let r=ma(fa(e,sa[t],`color`,...n),Z.color.close,this[aa]);return ha(this,r,this[oa])}}};let t=`bg`+e[0].toUpperCase()+e.slice(1);ca[t]={get(){let{level:t}=this;return function(...n){let r=ma(fa(e,sa[t],`bgColor`,...n),Z.bgColor.close,this[aa]);return ha(this,r,this[oa])}}}}const pa=Object.defineProperties(()=>{},{...ca,level:{enumerable:!0,get(){return this[ia].level},set(e){this[ia].level=e}}}),ma=(e,t,n)=>{let r,i;return n===void 0?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},ha=(e,t,n)=>{let r=(...e)=>ga(r,e.length===1?``+e[0]:e.join(` `));return Object.setPrototypeOf(r,pa),r[ia]=e,r[aa]=t,r[oa]=n,r},ga=(e,t)=>{if(e.level<=0||!t)return e[oa]?``:t;let n=e[aa];if(n===void 0)return t;let{openAll:r,closeAll:i}=n;if(t.includes(`\x1B`))for(;n!==void 0;)t=ea(t,n.close,n.open),n=n.parent;let a=t.indexOf(`
|
|
125
|
-
`);return a!==-1&&(t=ta(t,i,r,a)),r+t+i};Object.defineProperties(da.prototype,ca);const _a=da();da({level:ra?ra.level:0});var va=_a,ya=e((e=>{e.__esModule=!0;function t(e){return i(e)===`boolean`}function n(e){return i(e)===`object`}function r(e){return i(e)===`string`}function i(e){return typeof e}function a(e){var i=e.meta,a=e.path,o=e.xdg;return{XDGAppPaths:new(function(){function e(s){s===void 0&&(s={});function c(t){return t===void 0&&(t={}),new e(t)}var l=n(s)?s:{name:s},u=l.suffix??``,d=l.isolated??!0,f=[l.name,i.pkgMainFilename(),i.mainFilename()],p=a.parse((f.find(function(e){return r(e)})??`$eval`)+u).name;c.$name=function(){return p},c.$isolated=function(){return d};function m(e){return e??={isolated:d},t(e)?e:e.isolated??d}function h(e){return m(e)?p:``}return c.cache=function(e){return a.join(o.cache(),h(e))},c.config=function(e){return a.join(o.config(),h(e))},c.data=function(e){return a.join(o.data(),h(e))},c.runtime=function(e){return o.runtime()?a.join(o.runtime(),h(e)):void 0},c.state=function(e){return a.join(o.state(),h(e))},c.configDirs=function(e){return o.configDirs().map(function(t){return a.join(t,h(e))})},c.dataDirs=function(e){return o.dataDirs().map(function(t){return a.join(t,h(e))})},c}return e}())}}e.Adapt=a})),ba=e((e=>{var t=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};e.__esModule=!0;function n(e){var n=e.env,r=e.osPaths,i=e.path,a=/^darwin$/i.test(e.process.platform),o=/^win/i.test(e.process.platform);function s(){return r.home()||r.temp()}function c(e,t){return e||i.join.apply(i,t)}var l=function(){return{cache:function(){return c(n.get(`XDG_CACHE_HOME`),[s(),`.cache`])},config:function(){return c(n.get(`XDG_CONFIG_HOME`),[s(),`.config`])},data:function(){return c(n.get(`XDG_DATA_HOME`),[s(),`.local`,`share`])},runtime:function(){return n.get(`XDG_RUNTIME_DIR`)||void 0},state:function(){return c(n.get(`XDG_STATE_HOME`),[s(),`.local`,`state`])}}},u=function(){return{cache:function(){return c(n.get(`XDG_CACHE_HOME`),[s(),`Library`,`Caches`])},config:function(){return c(n.get(`XDG_CONFIG_HOME`),[s(),`Library`,`Preferences`])},data:function(){return c(n.get(`XDG_DATA_HOME`),[s(),`Library`,`Application Support`])},runtime:function(){return n.get(`XDG_RUNTIME_DIR`)||void 0},state:function(){return c(n.get(`XDG_STATE_HOME`),[s(),`Library`,`State`])}}},d=function(){function e(){return c(n.get(`APPDATA`),[s(),`AppData`,`Roaming`])}function t(){return c(n.get(`LOCALAPPDATA`),[s(),`AppData`,`Local`])}return{cache:function(){return c(n.get(`XDG_CACHE_HOME`),[t(),`xdg.cache`])},config:function(){return c(n.get(`XDG_CONFIG_HOME`),[e(),`xdg.config`])},data:function(){return c(n.get(`XDG_DATA_HOME`),[e(),`xdg.data`])},runtime:function(){return n.get(`XDG_RUNTIME_DIR`)||void 0},state:function(){return c(n.get(`XDG_STATE_HOME`),[t(),`xdg.state`])}}};return{XDG:new(function(){function e(){function r(){return new e}var s=a?u():o?d():l();return r.cache=s.cache,r.config=s.config,r.data=s.data,r.runtime=s.runtime,r.state=s.state,r.configDirs=function(){var e=n.get(`XDG_CONFIG_DIRS`);return t([s.config()],e?e.split(i.delimiter):[])},r.dataDirs=function(){var e=n.get(`XDG_DATA_DIRS`);return t([s.data()],e?e.split(i.delimiter):[])},r}return e}())}}e.Adapt=n})),xa=e((e=>{var t=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};e.__esModule=!0;function n(e){return!e}function r(e){var r=e.env,i=e.os,a=e.path,o=/^win/i.test(e.process.platform);function s(t){return t?e.path.normalize(e.path.join(t,`.`)):void 0}function c(){return o?function(){var e=[typeof i.homedir==`function`?i.homedir():void 0,r.get(`USERPROFILE`),r.get(`HOME`),r.get(`HOMEDRIVE`)||r.get(`HOMEPATH`)?a.join(r.get(`HOMEDRIVE`)||``,r.get(`HOMEPATH`)||``):void 0];return s(e.find(function(e){return!n(e)}))}():function(){return s((typeof i.homedir==`function`?i.homedir():void 0)||r.get(`HOME`))}()}function l(){function e(e,n){return e?a.join.apply(a,t([e],n)):void 0}function l(){var e=`/tmp`,t=[typeof i.tmpdir==`function`?i.tmpdir():void 0,r.get(`TMPDIR`),r.get(`TEMP`),r.get(`TMP`)];return s(t.find(function(e){return!n(e)}))||e}function u(){var t=`C:\\Temp`,a=[typeof i.tmpdir==`function`?i.tmpdir:function(){},function(){return r.get(`TEMP`)},function(){return r.get(`TMP`)},function(){return e(r.get(`LOCALAPPDATA`),[`Temp`])},function(){return e(c(),[`AppData`,`Local`,`Temp`])},function(){return e(r.get(`ALLUSERSPROFILE`),[`Temp`])},function(){return e(r.get(`SystemRoot`),[`Temp`])},function(){return e(r.get(`windir`),[`Temp`])},function(){return e(r.get(`SystemDrive`),[`\\`,`Temp`])}].find(function(e){return e&&!n(e())});return a&&s(a())||t}return o?u():l()}return{OSPaths:new(function(){function e(){function t(){return new e}return t.home=c,t.temp=l,t}return e}())}}e.Adapt=r})),Sa=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r};e.__esModule=!0;var a=i(r(`os`)),o=i(r(`path`));e.adapter={atImportPermissions:{env:!0},env:{get:function(e){return process.env[e]}},os:a,path:o,process}})),Ca=e(((e,t)=>{var n=xa(),r=Sa();t.exports=n.Adapt(r.adapter).OSPaths})),wa=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},a=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var o=i(r(`path`));e.adapter={atImportPermissions:{env:!0},env:{get:function(e){return process.env[e]}},osPaths:a(Ca()).default,path:o,process}})),Ta=e(((e,t)=>{var n=ba(),r=wa();t.exports=n.Adapt(r.adapter).XDG})),Ea=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},a=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var o=i(r(`path`)),s=a(Ta());e.adapter={atImportPermissions:{env:!0,read:!0},meta:{mainFilename:function(){var e=(r!=null&&r.main?r.main:{filename:void 0}).filename;return(e===process.execArgv[0]?void 0:e)||(process._eval===void 0?process.argv[1]:void 0)},pkgMainFilename:function(){return process.pkg?process.execPath:void 0}},path:o,process,xdg:s.default}})),Da=i(e(((e,t)=>{var n=ya(),r=Ea();t.exports=n.Adapt(r.adapter).XDGAppPaths}))(),1).default;let Oa;function ka(){try{return d.statSync(`/.dockerenv`),!0}catch{return!1}}function Aa(){try{return d.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function ja(){return Oa===void 0&&(Oa=ka()||Aa()),Oa}let Ma;const Na=()=>{try{return d.statSync(`/run/.containerenv`),!0}catch{return!1}};function Pa(){return Ma===void 0&&(Ma=Na()||ja()),Ma}const Fa=()=>{if(_.platform!==`linux`)return!1;if(k.release().toLowerCase().includes(`microsoft`))return!Pa();try{return d.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`)?!Pa():!1}catch{return!1}};var Ia=_.env.__IS_WSL_TEST__?Fa:Fa();const La=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await S.access(n,C.F_OK),r=!0}catch{}if(!r)return e;let i=await S.readFile(n,{encoding:`utf8`}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return a?(t=a.groups.mountPoint.trim(),t=t.endsWith(`/`)?t:`${t}/`,t):e}})(),Ra=async()=>`${await La()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,za=async()=>Ia?Ra():`${_.env.SYSTEMROOT||_.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function Ba(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}const Va=w(s);async function Ha(){if(_.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await Va(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`}const Ua=w(s);async function Wa(e,{humanReadableOutput:t=!0,signal:n}={}){if(_.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await Ua(`osascript`,[`-e`,e,r],i);return a.trim()}async function Ga(e){return Wa(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const Ka=w(s),qa={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},MSEdgeDHTML:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`}};var Ja=class extends Error{};async function Ya(e=Ka){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new Ja(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=qa[r];if(!i)throw new Ja(`Unknown browser ID: ${r}`);return i}const Xa=w(s),Za=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function Qa(){if(_.platform===`darwin`){let e=await Ha();return{name:await Ga(e),id:e}}if(_.platform===`linux`){let{stdout:e}=await Xa(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:Za(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(_.platform===`win32`)return Ya();throw Error(`Only macOS, Linux, and Windows are supported`)}const $a=w(o.execFile),eo=c.dirname(ee(import.meta.url)),to=c.join(eo,`xdg-open`),{platform:no,arch:ro}=_;async function io(){let e=await za(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,n=j.from(t,`utf16le`).toString(`base64`),{stdout:r}=await $a(e,[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`,n],{encoding:`utf8`}),i=r.trim(),a={ChromeHTML:`com.google.chrome`,BraveHTML:`com.brave.Browser`,MSEdgeHTM:`com.microsoft.edge`,FirefoxURL:`org.mozilla.firefox`};return a[i]?{id:a[i]}:{}}const ao=async(e,t)=>{let n;for(let r of e)try{return await t(r)}catch(e){n=e}throw n},oo=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return ao(e.app,t=>oo({...e,app:t}));let{name:t,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(t))return ao(t,t=>oo({...e,app:{name:t,arguments:n}}));if(t===`browser`||t===`browserPrivate`){let r={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.Browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a=Ia?await io():await Qa();if(a.id in r){let o=r[a.id];return t===`browserPrivate`&&n.push(i[o]),oo({...e,app:{name:uo[o],arguments:n}})}throw Error(`${a.name} is not supported as a default browser`)}let r,i=[],a={};if(no===`darwin`)r=`open`,e.wait&&i.push(`--wait-apps`),e.background&&i.push(`--background`),e.newInstance&&i.push(`--new`),t&&i.push(`-a`,t);else if(no===`win32`||Ia&&!Pa()&&!t){r=await za(),i.push(`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`),Ia||(a.windowsVerbatimArguments=!0);let o=[`Start`];e.wait&&o.push(`-Wait`),t?(o.push(`"\`"${t}\`""`),e.target&&n.push(e.target)):e.target&&o.push(`"${e.target}"`),n.length>0&&(n=n.map(e=>`"\`"${e}\`""`),o.push(`-ArgumentList`,n.join(`,`))),e.target=j.from(o.join(` `),`utf16le`).toString(`base64`)}else{if(t)r=t;else{let e=!eo||eo===`/`,t=!1;try{await S.access(to,C.X_OK),t=!0}catch{}r=_.versions.electron??(no===`android`||e||!t)?`xdg-open`:to}n.length>0&&i.push(...n),e.wait||(a.stdio=`ignore`,a.detached=!0)}no===`darwin`&&n.length>0&&i.push(`--args`,...n),e.target&&i.push(e.target);let s=o.spawn(r,i,a);return e.wait?new Promise((t,n)=>{s.once(`error`,n),s.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r>0){n(Error(`Exited with code ${r}`));return}t(s)})}):(s.unref(),s)},so=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return oo({...t,target:e})};function co(e){if(typeof e==`string`||Array.isArray(e))return e;let{[ro]:t}=e;if(!t)throw Error(`${ro} is not supported`);return t}function lo({[no]:e},{wsl:t}){if(t&&Ia)return co(t);if(!e)throw Error(`${no} is not supported`);return co(e)}const uo={};Ba(uo,`chrome`,()=>lo({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),Ba(uo,`brave`,()=>lo({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),Ba(uo,`firefox`,()=>lo({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),Ba(uo,`edge`,()=>lo({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),Ba(uo,`browser`,()=>`browser`),Ba(uo,`browserPrivate`,()=>`browserPrivate`);var fo=so;async function po(e,t=void 0){try{(await fo(e)).once(`error`,n=>{console.log(va.yellow(t??`Could not open the browser. Please visit the URL manually: ${e}`))})}catch{console.log(va.yellow(t??`Could not open the browser. Please visit the URL manually: ${e}`))}}function mo(e){let t=e||wo();if(f(t)){let e=m(t,`utf8`),n=JSON.parse(e);return n.host||=`https://blink.coder.com`,n}}function ho(e,t){let n=t||wo();f(l(n))||p(l(n),{recursive:!0}),g(n,JSON.stringify({_:`This is your Blink credentials file. DO NOT SHARE THIS FILE WITH ANYONE!`,...e}))}function go(e){return!!(e===`localhost`||/^\d{1,3}(\.\d{1,3}){3}$/.test(e)||/^[\da-fA-F:]+$/.test(e)&&e.includes(`:`))}function _o(e){let t=``,n=e;e.startsWith(`http://`)?(t=`http://`,n=e.slice(7)):e.startsWith(`https://`)&&(t=`https://`,n=e.slice(8));let r=n.indexOf(`/`),i=r===-1?n:n.slice(0,r),a=i.match(/:(\d+)$/),o=a?i.slice(0,i.length-a[0].length):i;return t||=go(o)?`http://`:`https://`,t+i}function vo(e){return e.replace(/^http:\/\//,`ws://`).replace(/^https:\/\//,`wss://`)}function yo(e){let t=process.env.BLINK_HOST??mo(e)?.host;return t?_o(t):void 0}function bo(e){return mo(e)?.token}function xo(e,t){let n=mo(t)??{};ho({...n,token:e},t)}function So(e,t){let n=mo(t)??{};ho({...n,host:_o(e)},t)}function Co(e){let t=e||wo();f(t)&&h(t)}function wo(){let e=Da(`blink`).dataDirs();if(e.length===0)throw Error(`No suitable data directory for Blink storage found!`);return u(e[0],`auth.json`)}async function To(e){if(e??=yo(),!e){if(!(process.stdin.isTTY&&process.stdout.isTTY))throw Error("No Blink host configured. Set the BLINK_HOST environment variable or run `blink login <host>` interactively.");let t=await Ti({message:`Enter your Blink host URL:`,placeholder:`https://blink.example.com`,validate:e=>{if(!e||e.trim().length===0)return`Host URL is required`}});if(xr(t))throw Error(`Login cancelled`);if(So(t),e=yo(),!e)throw Error(`Failed to save host configuration`)}let t=new Bn({baseURL:e}),n=process.env.BLINK_TOKEN||bo();if(n){t.authToken=n;try{await t.users.me()}catch{if(process.env.BLINK_TOKEN)throw Error(`BLINK_TOKEN environment variable is invalid`);n=await Do()}}else n=await Do();return n}function Eo(e){let t=!1,n=t=>{(t.toString()===`\r`||t.toString()===`
|
|
125
|
+
`);return a!==-1&&(t=ta(t,i,r,a)),r+t+i};Object.defineProperties(da.prototype,ca);const _a=da();da({level:ra?ra.level:0});var va=_a,ya=e((e=>{e.__esModule=!0;function t(e){return i(e)===`boolean`}function n(e){return i(e)===`object`}function r(e){return i(e)===`string`}function i(e){return typeof e}function a(e){var i=e.meta,a=e.path,o=e.xdg;return{XDGAppPaths:new(function(){function e(s){s===void 0&&(s={});function c(t){return t===void 0&&(t={}),new e(t)}var l=n(s)?s:{name:s},u=l.suffix??``,d=l.isolated??!0,f=[l.name,i.pkgMainFilename(),i.mainFilename()],p=a.parse((f.find(function(e){return r(e)})??`$eval`)+u).name;c.$name=function(){return p},c.$isolated=function(){return d};function m(e){return e??={isolated:d},t(e)?e:e.isolated??d}function h(e){return m(e)?p:``}return c.cache=function(e){return a.join(o.cache(),h(e))},c.config=function(e){return a.join(o.config(),h(e))},c.data=function(e){return a.join(o.data(),h(e))},c.runtime=function(e){return o.runtime()?a.join(o.runtime(),h(e)):void 0},c.state=function(e){return a.join(o.state(),h(e))},c.configDirs=function(e){return o.configDirs().map(function(t){return a.join(t,h(e))})},c.dataDirs=function(e){return o.dataDirs().map(function(t){return a.join(t,h(e))})},c}return e}())}}e.Adapt=a})),ba=e((e=>{var t=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};e.__esModule=!0;function n(e){var n=e.env,r=e.osPaths,i=e.path,a=/^darwin$/i.test(e.process.platform),o=/^win/i.test(e.process.platform);function s(){return r.home()||r.temp()}function c(e,t){return e||i.join.apply(i,t)}var l=function(){return{cache:function(){return c(n.get(`XDG_CACHE_HOME`),[s(),`.cache`])},config:function(){return c(n.get(`XDG_CONFIG_HOME`),[s(),`.config`])},data:function(){return c(n.get(`XDG_DATA_HOME`),[s(),`.local`,`share`])},runtime:function(){return n.get(`XDG_RUNTIME_DIR`)||void 0},state:function(){return c(n.get(`XDG_STATE_HOME`),[s(),`.local`,`state`])}}},u=function(){return{cache:function(){return c(n.get(`XDG_CACHE_HOME`),[s(),`Library`,`Caches`])},config:function(){return c(n.get(`XDG_CONFIG_HOME`),[s(),`Library`,`Preferences`])},data:function(){return c(n.get(`XDG_DATA_HOME`),[s(),`Library`,`Application Support`])},runtime:function(){return n.get(`XDG_RUNTIME_DIR`)||void 0},state:function(){return c(n.get(`XDG_STATE_HOME`),[s(),`Library`,`State`])}}},d=function(){function e(){return c(n.get(`APPDATA`),[s(),`AppData`,`Roaming`])}function t(){return c(n.get(`LOCALAPPDATA`),[s(),`AppData`,`Local`])}return{cache:function(){return c(n.get(`XDG_CACHE_HOME`),[t(),`xdg.cache`])},config:function(){return c(n.get(`XDG_CONFIG_HOME`),[e(),`xdg.config`])},data:function(){return c(n.get(`XDG_DATA_HOME`),[e(),`xdg.data`])},runtime:function(){return n.get(`XDG_RUNTIME_DIR`)||void 0},state:function(){return c(n.get(`XDG_STATE_HOME`),[t(),`xdg.state`])}}};return{XDG:new(function(){function e(){function r(){return new e}var s=a?u():o?d():l();return r.cache=s.cache,r.config=s.config,r.data=s.data,r.runtime=s.runtime,r.state=s.state,r.configDirs=function(){var e=n.get(`XDG_CONFIG_DIRS`);return t([s.config()],e?e.split(i.delimiter):[])},r.dataDirs=function(){var e=n.get(`XDG_DATA_DIRS`);return t([s.data()],e?e.split(i.delimiter):[])},r}return e}())}}e.Adapt=n})),xa=e((e=>{var t=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};e.__esModule=!0;function n(e){return!e}function r(e){var r=e.env,i=e.os,a=e.path,o=/^win/i.test(e.process.platform);function s(t){return t?e.path.normalize(e.path.join(t,`.`)):void 0}function c(){return o?function(){var e=[typeof i.homedir==`function`?i.homedir():void 0,r.get(`USERPROFILE`),r.get(`HOME`),r.get(`HOMEDRIVE`)||r.get(`HOMEPATH`)?a.join(r.get(`HOMEDRIVE`)||``,r.get(`HOMEPATH`)||``):void 0];return s(e.find(function(e){return!n(e)}))}():function(){return s((typeof i.homedir==`function`?i.homedir():void 0)||r.get(`HOME`))}()}function l(){function e(e,n){return e?a.join.apply(a,t([e],n)):void 0}function l(){var e=`/tmp`,t=[typeof i.tmpdir==`function`?i.tmpdir():void 0,r.get(`TMPDIR`),r.get(`TEMP`),r.get(`TMP`)];return s(t.find(function(e){return!n(e)}))||e}function u(){var t=`C:\\Temp`,a=[typeof i.tmpdir==`function`?i.tmpdir:function(){},function(){return r.get(`TEMP`)},function(){return r.get(`TMP`)},function(){return e(r.get(`LOCALAPPDATA`),[`Temp`])},function(){return e(c(),[`AppData`,`Local`,`Temp`])},function(){return e(r.get(`ALLUSERSPROFILE`),[`Temp`])},function(){return e(r.get(`SystemRoot`),[`Temp`])},function(){return e(r.get(`windir`),[`Temp`])},function(){return e(r.get(`SystemDrive`),[`\\`,`Temp`])}].find(function(e){return e&&!n(e())});return a&&s(a())||t}return o?u():l()}return{OSPaths:new(function(){function e(){function t(){return new e}return t.home=c,t.temp=l,t}return e}())}}e.Adapt=r})),Sa=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r};e.__esModule=!0;var a=i(r(`os`)),o=i(r(`path`));e.adapter={atImportPermissions:{env:!0},env:{get:function(e){return process.env[e]}},os:a,path:o,process}})),Ca=e(((e,t)=>{var n=xa(),r=Sa();t.exports=n.Adapt(r.adapter).OSPaths})),wa=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},a=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var o=i(r(`path`));e.adapter={atImportPermissions:{env:!0},env:{get:function(e){return process.env[e]}},osPaths:a(Ca()).default,path:o,process}})),Ta=e(((e,t)=>{var n=ba(),r=wa();t.exports=n.Adapt(r.adapter).XDG})),Ea=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},a=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var o=i(r(`path`)),s=a(Ta());e.adapter={atImportPermissions:{env:!0,read:!0},meta:{mainFilename:function(){var e=(r!=null&&r.main?r.main:{filename:void 0}).filename;return(e===process.execArgv[0]?void 0:e)||(process._eval===void 0?process.argv[1]:void 0)},pkgMainFilename:function(){return process.pkg?process.execPath:void 0}},path:o,process,xdg:s.default}})),Da=i(e(((e,t)=>{var n=ya(),r=Ea();t.exports=n.Adapt(r.adapter).XDGAppPaths}))(),1).default;let Oa;function ka(){try{return d.statSync(`/.dockerenv`),!0}catch{return!1}}function Aa(){try{return d.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function ja(){return Oa===void 0&&(Oa=ka()||Aa()),Oa}let Ma;const Na=()=>{try{return d.statSync(`/run/.containerenv`),!0}catch{return!1}};function Pa(){return Ma===void 0&&(Ma=Na()||ja()),Ma}const Fa=()=>{if(_.platform!==`linux`)return!1;if(k.release().toLowerCase().includes(`microsoft`))return!Pa();try{return d.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`)?!Pa():!1}catch{return!1}};var Ia=_.env.__IS_WSL_TEST__?Fa:Fa();const La=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await S.access(n,C.F_OK),r=!0}catch{}if(!r)return e;let i=await S.readFile(n,{encoding:`utf8`}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return a?(t=a.groups.mountPoint.trim(),t=t.endsWith(`/`)?t:`${t}/`,t):e}})(),Ra=async()=>`${await La()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,za=async()=>Ia?Ra():`${_.env.SYSTEMROOT||_.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function Ba(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}const Va=w(s);async function Ha(){if(_.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await Va(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`}const Ua=w(s);async function Wa(e,{humanReadableOutput:t=!0,signal:n}={}){if(_.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await Ua(`osascript`,[`-e`,e,r],i);return a.trim()}async function Ga(e){return Wa(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const Ka=w(s),qa={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},MSEdgeDHTML:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`}};var Ja=class extends Error{};async function Ya(e=Ka){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new Ja(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=qa[r];if(!i)throw new Ja(`Unknown browser ID: ${r}`);return i}const Xa=w(s),Za=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function Qa(){if(_.platform===`darwin`){let e=await Ha();return{name:await Ga(e),id:e}}if(_.platform===`linux`){let{stdout:e}=await Xa(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:Za(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(_.platform===`win32`)return Ya();throw Error(`Only macOS, Linux, and Windows are supported`)}const $a=w(o.execFile),eo=c.dirname(ee(import.meta.url)),to=c.join(eo,`xdg-open`),{platform:no,arch:ro}=_;async function io(){let e=await za(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,n=j.from(t,`utf16le`).toString(`base64`),{stdout:r}=await $a(e,[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`,n],{encoding:`utf8`}),i=r.trim(),a={ChromeHTML:`com.google.chrome`,BraveHTML:`com.brave.Browser`,MSEdgeHTM:`com.microsoft.edge`,FirefoxURL:`org.mozilla.firefox`};return a[i]?{id:a[i]}:{}}const ao=async(e,t)=>{let n;for(let r of e)try{return await t(r)}catch(e){n=e}throw n},oo=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return ao(e.app,t=>oo({...e,app:t}));let{name:t,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(t))return ao(t,t=>oo({...e,app:{name:t,arguments:n}}));if(t===`browser`||t===`browserPrivate`){let r={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.Browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a=Ia?await io():await Qa();if(a.id in r){let o=r[a.id];return t===`browserPrivate`&&n.push(i[o]),oo({...e,app:{name:uo[o],arguments:n}})}throw Error(`${a.name} is not supported as a default browser`)}let r,i=[],a={};if(no===`darwin`)r=`open`,e.wait&&i.push(`--wait-apps`),e.background&&i.push(`--background`),e.newInstance&&i.push(`--new`),t&&i.push(`-a`,t);else if(no===`win32`||Ia&&!Pa()&&!t){r=await za(),i.push(`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`),Ia||(a.windowsVerbatimArguments=!0);let o=[`Start`];e.wait&&o.push(`-Wait`),t?(o.push(`"\`"${t}\`""`),e.target&&n.push(e.target)):e.target&&o.push(`"${e.target}"`),n.length>0&&(n=n.map(e=>`"\`"${e}\`""`),o.push(`-ArgumentList`,n.join(`,`))),e.target=j.from(o.join(` `),`utf16le`).toString(`base64`)}else{if(t)r=t;else{let e=!eo||eo===`/`,t=!1;try{await S.access(to,C.X_OK),t=!0}catch{}r=_.versions.electron??(no===`android`||e||!t)?`xdg-open`:to}n.length>0&&i.push(...n),e.wait||(a.stdio=`ignore`,a.detached=!0)}no===`darwin`&&n.length>0&&i.push(`--args`,...n),e.target&&i.push(e.target);let s=o.spawn(r,i,a);return e.wait?new Promise((t,n)=>{s.once(`error`,n),s.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r>0){n(Error(`Exited with code ${r}`));return}t(s)})}):(s.unref(),s)},so=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return oo({...t,target:e})};function co(e){if(typeof e==`string`||Array.isArray(e))return e;let{[ro]:t}=e;if(!t)throw Error(`${ro} is not supported`);return t}function lo({[no]:e},{wsl:t}){if(t&&Ia)return co(t);if(!e)throw Error(`${no} is not supported`);return co(e)}const uo={};Ba(uo,`chrome`,()=>lo({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),Ba(uo,`brave`,()=>lo({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),Ba(uo,`firefox`,()=>lo({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),Ba(uo,`edge`,()=>lo({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),Ba(uo,`browser`,()=>`browser`),Ba(uo,`browserPrivate`,()=>`browserPrivate`);var fo=so;async function po(e,t=void 0){try{(await fo(e)).once(`error`,n=>{console.log(va.yellow(t??`Could not open the browser. Please visit the URL manually: ${e}`))})}catch{console.log(va.yellow(t??`Could not open the browser. Please visit the URL manually: ${e}`))}}function mo(e){let t=e||wo();if(f(t)){let e=m(t,`utf8`),n=JSON.parse(e);return n.host||=`https://blink.coder.com`,n}}function ho(e,t){let n=t||wo();f(l(n))||p(l(n),{recursive:!0}),g(n,JSON.stringify({_:`This is your Blink credentials file. DO NOT SHARE THIS FILE WITH ANYONE!`,...e}))}function go(e){return!!(e===`localhost`||/^\d{1,3}(\.\d{1,3}){3}$/.test(e)||/^[\da-fA-F:]+$/.test(e)&&e.includes(`:`))}function _o(e){let t=``,n=e;e.startsWith(`http://`)?(t=`http://`,n=e.slice(7)):e.startsWith(`https://`)&&(t=`https://`,n=e.slice(8));let r=n.indexOf(`/`),i=r===-1?n:n.slice(0,r),a=i.match(/:(\d+)$/),o=a?i.slice(0,i.length-a[0].length):i;return t||=go(o)?`http://`:`https://`,t+i}function vo(e){return e.replace(/^http:\/\//,`ws://`).replace(/^https:\/\//,`wss://`)}function yo(e){let t=process.env.BLINK_HOST??mo(e)?.host;return t?_o(t):void 0}function bo(e){return mo(e)?.token}function xo(e,t){let n=mo(t)??{};ho({...n,token:e},t)}function So(e,t){let n=mo(t)??{};ho({...n,host:_o(e)},t)}function Co(e){let t=e||wo();f(t)&&h(t)}function wo(){let e=Da(`blink`).dataDirs();if(e.length===0)throw Error(`No suitable data directory for Blink storage found!`);return u(e[0],`auth.json`)}async function To(e){if(e&&So(e),e=yo(),!e){if(!(process.stdin.isTTY&&process.stdout.isTTY))throw Error("No Blink host configured. Set the BLINK_HOST environment variable or run `blink login <host>` interactively.");let t=await Ti({message:`Enter your Blink host URL:`,placeholder:`https://blink.example.com`,validate:e=>{if(!e||e.trim().length===0)return`Host URL is required`}});if(xr(t))throw Error(`Login cancelled`);if(So(t),e=yo(),!e)throw Error(`Failed to save host configuration`)}let t=new Bn({baseURL:e}),n=process.env.BLINK_TOKEN||bo();if(n){t.authToken=n;try{await t.users.me()}catch{if(process.env.BLINK_TOKEN)throw Error(`BLINK_TOKEN environment variable is invalid`);n=await Do(e)}}else n=await Do(e);return n}function Eo(e){let t=!1,n=t=>{(t.toString()===`\r`||t.toString()===`
|
|
126
126
|
`)&&e(),t.toString()===``&&(r(),process.exit(1))},r=()=>{if(!t){t=!0;try{process.stdin.removeListener(`data`,n),process.stdin.setRawMode(!1),process.stdin.pause()}catch{}}};return process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on(`data`,n),{cleanup:r}}async function Do(e){e&&So(e);let t=yo();if(!t)throw Error("No Blink host configured. Set the BLINK_HOST environment variable or run `blink login <host>`.");let n=new Bn({baseURL:t}),r,i=!1,a,o=new Promise(e=>{a=e}),s=n.auth.token((e,t)=>{r=e,console.log(`Visit`,va.bold(e),`to authenticate with Blink.`),console.log(va.dim(`Press [ENTER] to open the browser`)),a()}),c=Eo(async()=>{if(!i){if(i=!0,await o,!r)throw Error(`Authentication URL not set, this is a bug.`);await po(r)}});await o;let l=zi();l.start(`Waiting for authentication...`);try{let e=await s;c.cleanup(),n.authToken=e;let t=await n.users.me();return l.stop(`Congratulations, you are now signed in as ${t.email}!`),console.log(``),xo(e),e}catch(e){c.cleanup(),l.stop(`Authentication failed: ${e}`),process.exit(1)}}export{Bn as Client,Pi as Ie,Ii as M,Fi as Se,zi as Y,Co as deleteAuthToken,ei as dist_exports,Ei as ge,bo as getAuthToken,yo as getHost,Ti as he,To as loginIfNeeded,po as openUrl,fo as open_default,xr as pD,xo as setAuthToken,va as source_default,vo as toWsUrl,Oi as ve,Ni as xe,Di as ye};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{import_websocket as e}from"./wrapper-DRdRnzOz.js";import{getHost as t,openUrl as n,toWsUrl as r}from"./auth-
|
|
1
|
+
import{import_websocket as e}from"./wrapper-DRdRnzOz.js";import{getHost as t,openUrl as n,toWsUrl as r}from"./auth-DcHT4wFv.js";import{WorkspaceConnect as i}from"./connect-GiF_KyuT.js";async function a(){let a=t();if(!a)throw Error("No Blink host configured. Set the BLINK_HOST environment variable or run `blink login <host>`.");let o=r(a),s=crypto.randomUUID(),c=new e.default(`${o}/legacy-auth?id=${s}`);await new Promise((e,t)=>{c.onopen=()=>{e()},c.onerror=e=>{t(e)}});let l=new Promise((e,t)=>{c.onmessage=t=>{e(t.data.toString())}}),u=`${a}/legacy-auth?id=${s}&type=workspace`;console.log(`Opening the following URL in your browser: ${u}`),await n(u);let d=await l,f=new i({url:`${o}/api/connect`,token:d});f.onConnect(()=>{console.log(`Connected to Blink`)}),f.onDisconnect(()=>{console.log(`Disconnected from Blink`)})}export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as e,join as t}from"node:path";import{mkdir as n,writeFile as r}from"node:fs/promises";var i=`1.1.
|
|
1
|
+
import{dirname as e,join as t}from"node:path";import{mkdir as n,writeFile as r}from"node:fs/promises";var i=`1.1.40`;async function a(i,a){let o=t(i,`.blink`,`config.json`);await n(e(o),{recursive:!0}),await r(o,JSON.stringify({_:`This file can be source controlled. It contains no secrets.`,...a},null,2),`utf-8`)}export{i as version,a as writeBlinkConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./wrapper-DRdRnzOz.js";import"./auth-DcHT4wFv.js";import{WorkspaceConnect as e,connect as t}from"./connect-GiF_KyuT.js";export{e as WorkspaceConnect,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__require as e}from"./chunk-D9KrCrVq.js";import{wrapper_default as t}from"./wrapper-DRdRnzOz.js";import{getHost as n,toWsUrl as r}from"./auth-
|
|
1
|
+
import{__require as e}from"./chunk-D9KrCrVq.js";import{wrapper_default as t}from"./wrapper-DRdRnzOz.js";import{getHost as n,toWsUrl as r}from"./auth-DcHT4wFv.js";import i from"node:path";import a from"node:fs";import o from"node:os";import{Server as s}from"@blink-sdk/compute-protocol/server";var c=class{listeners=[];get event(){return e=>(this.listeners.push(e),{dispose:()=>{this.listeners=this.listeners.filter(t=>t!==e)}})}emit(e){for(let t=this.listeners.length-1;t>=0;t--)this.listeners[t]?.(e)}dispose(){this.listeners=[]}};const l=i.join(o.tmpdir(),`blink-connect-${process.pid}.log`),u=e=>{if(e instanceof Error)return e.stack??e.message;try{return JSON.stringify(e)}catch{return String(e)}},d=async e=>{let t=`${new Date().toISOString()} ${e}\n`;try{await a.promises.appendFile(l,t,`utf8`)}catch{}},f=`https://blink.coder.com`;async function p(){let e=process.env.BLINK_URL,t=process.env.BLINK_TOKEN;delete process.env.BLINK_TOKEN,process.env.GIT_TERMINAL_PROMPT=`0`,process.env.GIT_PAGER=`cat`,process.env.GIT_AUTHOR_NAME=`blink-so[bot]`,process.env.GIT_AUTHOR_EMAIL=`211532188+blink-so[bot]@users.noreply.github.com`,process.env.GIT_COMMITTER_NAME=`blink-so[bot]`,process.env.GIT_COMMITTER_EMAIL=`211532188+blink-so[bot]@users.noreply.github.com`,process.env.GIT_CONFIG_COUNT=`1`,process.env.GIT_CONFIG_KEY_0=`credential.https://github.com.helper`,process.env.GIT_CONFIG_VALUE_0=`!gh auth git-credential`,process.addListener(`uncaughtException`,e=>{d(`uncaughtException: ${u(e)}`),m(t,e)}),process.addListener(`unhandledRejection`,e=>{d(`unhandledRejection: ${u(e)}`),m(t,e)});let i=n()??f,a=new h({url:e??`${r(i)}/api/connect`,token:t,createDeploymentFromTar:async n=>{let r=new URL(`/api/static-deployment`,e??i);return(await(await fetch(r,{method:`POST`,body:n,headers:{"Content-Type":`application/tar`,Authorization:`Bearer ${t}`},duplex:`half`})).json()).deployment_id}});a.onConnect(()=>{console.log(`Connected`),d(`Connected`)}),a.onDisconnect(()=>{console.log(`Disconnected`),d(`Disconnected`)})}const m=async(e,t)=>{let r=n()??f,i=new URL(`${r}/api/connect-error`);await fetch(i.toString(),{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e}`},body:JSON.stringify({error:t})})};var h=class{_onConnect=new c;onConnect=this._onConnect.event;_onDisconnect=new c;onDisconnect=this._onDisconnect.event;reconnectTimeout=null;disposed=!1;ws;server;hasReconnectedOnce=!1;constructor(n){this.opts=n;let r;try{r=e(`@lydell/node-pty`)}catch{}globalThis.Bun!==void 0&&(r=void 0),this.server=new s({send:e=>{this.ws.readyState===t.OPEN?this.ws.send(e):console.warn(`Message skipped because connection is closed.`)},createDeploymentFromTar:this.opts.createDeploymentFromTar,nodePty:r}),this.connect()}dispose(){this.disposed||(this.disposed=!0,this.ws.close(),this.reconnectTimeout&&clearTimeout(this.reconnectTimeout))}scheduleReconnect(){if(this.disposed)return;let e=this.opts.immediateReconnectFirst??!0,t=this.opts.reconnectionDelay??2500;!this.hasReconnectedOnce&&e&&(t=0),this.hasReconnectedOnce=!0,this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{this.connect()},t)}connect(){let e=new URL(this.opts.url);e.protocol===`http:`?e.protocol=`ws:`:e.protocol===`https:`&&(e.protocol=`wss:`);let n={};this.opts.token&&(n.Authorization=`Bearer ${this.opts.token}`),this.ws=new t(e.toString(),{headers:n}),this.ws.addEventListener(`open`,()=>{this._onConnect.emit(void 0)}),this.ws.addEventListener(`close`,()=>{this._onDisconnect.emit(void 0),!this.disposed&&this.scheduleReconnect()}),this.ws.addEventListener(`error`,e=>{console.error(`Error`,e.message??e)}),this.ws.addEventListener(`message`,e=>{if(typeof e.data==`string`){console.warn(`Message skipped because it is not a buffer.`);return}try{this.server.handleMessage(new Uint8Array(e.data))}catch(e){console.error(`message handler error`,e);try{this.ws.close(1011)}catch{}}})}};export{h as WorkspaceConnect,p as connect};
|