@maria_rcks/t1code 0.0.5 → 0.0.7

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.
Files changed (101) hide show
  1. package/bin/t1code.js +38 -4
  2. package/dist/index.mjs +10 -4
  3. package/dist/server/BunPTY-tfevpp75.js +114 -0
  4. package/dist/server/NodePTY-shw8pxrb.js +115 -0
  5. package/dist/server/NodeSqliteClient-1zz4vbn2.js +180 -0
  6. package/dist/server/SqliteClient-53018gfq.js +147 -0
  7. package/dist/server/index-313s4ptc.js +18 -0
  8. package/dist/server/index-8anfbrkb.js +844 -0
  9. package/dist/server/index-9kq36ye2.js +584 -0
  10. package/dist/server/index-jgecjkfd.js +34490 -0
  11. package/dist/server/index-wckvcay0.js +48 -0
  12. package/dist/server/index-wrajk4wc.js +523 -0
  13. package/dist/server/index-z7xpvjdt.js +247 -0
  14. package/dist/server/index.js +56202 -0
  15. package/dist/server/node_modules/node-pty/LICENSE +69 -0
  16. package/dist/server/node_modules/node-pty/README.md +165 -0
  17. package/dist/server/node_modules/node-pty/lib/conpty_console_list_agent.js +16 -0
  18. package/dist/server/node_modules/node-pty/lib/conpty_console_list_agent.js.map +1 -0
  19. package/dist/server/node_modules/node-pty/lib/eventEmitter2.js +47 -0
  20. package/dist/server/node_modules/node-pty/lib/eventEmitter2.js.map +1 -0
  21. package/dist/server/node_modules/node-pty/lib/eventEmitter2.test.js +30 -0
  22. package/dist/server/node_modules/node-pty/lib/eventEmitter2.test.js.map +1 -0
  23. package/dist/server/node_modules/node-pty/lib/index.js +52 -0
  24. package/dist/server/node_modules/node-pty/lib/index.js.map +1 -0
  25. package/dist/server/node_modules/node-pty/lib/interfaces.js +7 -0
  26. package/dist/server/node_modules/node-pty/lib/interfaces.js.map +1 -0
  27. package/dist/server/node_modules/node-pty/lib/shared/conout.js +11 -0
  28. package/dist/server/node_modules/node-pty/lib/shared/conout.js.map +1 -0
  29. package/dist/server/node_modules/node-pty/lib/terminal.js +190 -0
  30. package/dist/server/node_modules/node-pty/lib/terminal.js.map +1 -0
  31. package/dist/server/node_modules/node-pty/lib/terminal.test.js +139 -0
  32. package/dist/server/node_modules/node-pty/lib/terminal.test.js.map +1 -0
  33. package/dist/server/node_modules/node-pty/lib/testUtils.test.js +28 -0
  34. package/dist/server/node_modules/node-pty/lib/testUtils.test.js.map +1 -0
  35. package/dist/server/node_modules/node-pty/lib/types.js +7 -0
  36. package/dist/server/node_modules/node-pty/lib/types.js.map +1 -0
  37. package/dist/server/node_modules/node-pty/lib/unixTerminal.js +346 -0
  38. package/dist/server/node_modules/node-pty/lib/unixTerminal.js.map +1 -0
  39. package/dist/server/node_modules/node-pty/lib/unixTerminal.test.js +351 -0
  40. package/dist/server/node_modules/node-pty/lib/unixTerminal.test.js.map +1 -0
  41. package/dist/server/node_modules/node-pty/lib/utils.js +39 -0
  42. package/dist/server/node_modules/node-pty/lib/utils.js.map +1 -0
  43. package/dist/server/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
  44. package/dist/server/node_modules/node-pty/lib/windowsConoutConnection.js.map +1 -0
  45. package/dist/server/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
  46. package/dist/server/node_modules/node-pty/lib/windowsPtyAgent.js.map +1 -0
  47. package/dist/server/node_modules/node-pty/lib/windowsPtyAgent.test.js +90 -0
  48. package/dist/server/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +1 -0
  49. package/dist/server/node_modules/node-pty/lib/windowsTerminal.js +199 -0
  50. package/dist/server/node_modules/node-pty/lib/windowsTerminal.js.map +1 -0
  51. package/dist/server/node_modules/node-pty/lib/windowsTerminal.test.js +219 -0
  52. package/dist/server/node_modules/node-pty/lib/windowsTerminal.test.js.map +1 -0
  53. package/dist/server/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  54. package/dist/server/node_modules/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
  55. package/dist/server/node_modules/node-pty/package.json +64 -0
  56. package/dist/server/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  57. package/dist/server/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  58. package/dist/server/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  59. package/dist/server/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  60. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  61. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  62. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  63. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
  64. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  65. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
  66. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/pty.node +0 -0
  67. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/pty.pdb +0 -0
  68. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
  69. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
  70. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
  71. package/dist/server/node_modules/node-pty/prebuilds/win32-arm64/winpty.pdb +0 -0
  72. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  73. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  74. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  75. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
  76. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  77. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
  78. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
  79. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/pty.pdb +0 -0
  80. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
  81. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.pdb +0 -0
  82. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
  83. package/dist/server/node_modules/node-pty/prebuilds/win32-x64/winpty.pdb +0 -0
  84. package/dist/server/node_modules/node-pty/typings/node-pty.d.ts +211 -0
  85. package/package.json +3 -2
  86. package/dist/server/BunPTY-BulfMn1P.cjs +0 -92
  87. package/dist/server/BunPTY-BulfMn1P.cjs.map +0 -1
  88. package/dist/server/BunPTY-Cueq2gzZ.mjs +0 -92
  89. package/dist/server/BunPTY-Cueq2gzZ.mjs.map +0 -1
  90. package/dist/server/NodePTY-AdcStdsu.mjs +0 -86
  91. package/dist/server/NodePTY-AdcStdsu.mjs.map +0 -1
  92. package/dist/server/NodePTY-DmqnQV86.cjs +0 -87
  93. package/dist/server/NodePTY-DmqnQV86.cjs.map +0 -1
  94. package/dist/server/NodeSqliteClient-BTK-dUey.mjs +0 -156
  95. package/dist/server/NodeSqliteClient-BTK-dUey.mjs.map +0 -1
  96. package/dist/server/NodeSqliteClient-ViK8pcdH.cjs +0 -174
  97. package/dist/server/NodeSqliteClient-ViK8pcdH.cjs.map +0 -1
  98. package/dist/server/index.cjs +0 -20457
  99. package/dist/server/index.cjs.map +0 -1
  100. package/dist/server/index.mjs +0 -20413
  101. package/dist/server/index.mjs.map +0 -1
@@ -0,0 +1,48 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, {
40
+ get: all[name],
41
+ enumerable: true,
42
+ configurable: true,
43
+ set: __exportSetter.bind(all, name)
44
+ });
45
+ };
46
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
47
+
48
+ export { __toESM, __commonJS, __export, __require };
@@ -0,0 +1,523 @@
1
+ import"./index-wckvcay0.js";
2
+
3
+ // ../../node_modules/.bun/open@10.2.0/node_modules/open/index.js
4
+ import process6 from "node:process";
5
+ import { Buffer } from "node:buffer";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { promisify as promisify5 } from "node:util";
9
+ import childProcess from "node:child_process";
10
+ import fs5, { constants as fsConstants2 } from "node:fs/promises";
11
+
12
+ // ../../node_modules/.bun/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
13
+ import process2 from "node:process";
14
+ import fs4, { constants as fsConstants } from "node:fs/promises";
15
+
16
+ // ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
17
+ import process from "node:process";
18
+ import os from "node:os";
19
+ import fs3 from "node:fs";
20
+
21
+ // ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
22
+ import fs2 from "node:fs";
23
+
24
+ // ../../node_modules/.bun/is-docker@3.0.0/node_modules/is-docker/index.js
25
+ import fs from "node:fs";
26
+ var isDockerCached;
27
+ function hasDockerEnv() {
28
+ try {
29
+ fs.statSync("/.dockerenv");
30
+ return true;
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
35
+ function hasDockerCGroup() {
36
+ try {
37
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+ function isDocker() {
43
+ if (isDockerCached === undefined) {
44
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
45
+ }
46
+ return isDockerCached;
47
+ }
48
+
49
+ // ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
50
+ var cachedResult;
51
+ var hasContainerEnv = () => {
52
+ try {
53
+ fs2.statSync("/run/.containerenv");
54
+ return true;
55
+ } catch {
56
+ return false;
57
+ }
58
+ };
59
+ function isInsideContainer() {
60
+ if (cachedResult === undefined) {
61
+ cachedResult = hasContainerEnv() || isDocker();
62
+ }
63
+ return cachedResult;
64
+ }
65
+
66
+ // ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
67
+ var isWsl = () => {
68
+ if (process.platform !== "linux") {
69
+ return false;
70
+ }
71
+ if (os.release().toLowerCase().includes("microsoft")) {
72
+ if (isInsideContainer()) {
73
+ return false;
74
+ }
75
+ return true;
76
+ }
77
+ try {
78
+ if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
79
+ return !isInsideContainer();
80
+ }
81
+ } catch {}
82
+ if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
83
+ return !isInsideContainer();
84
+ }
85
+ return false;
86
+ };
87
+ var is_wsl_default = process.env.__IS_WSL_TEST__ ? isWsl : isWsl();
88
+
89
+ // ../../node_modules/.bun/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
90
+ var wslDrivesMountPoint = (() => {
91
+ const defaultMountPoint = "/mnt/";
92
+ let mountPoint;
93
+ return async function() {
94
+ if (mountPoint) {
95
+ return mountPoint;
96
+ }
97
+ const configFilePath = "/etc/wsl.conf";
98
+ let isConfigFileExists = false;
99
+ try {
100
+ await fs4.access(configFilePath, fsConstants.F_OK);
101
+ isConfigFileExists = true;
102
+ } catch {}
103
+ if (!isConfigFileExists) {
104
+ return defaultMountPoint;
105
+ }
106
+ const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
107
+ const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
108
+ if (!configMountPoint) {
109
+ return defaultMountPoint;
110
+ }
111
+ mountPoint = configMountPoint.groups.mountPoint.trim();
112
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
113
+ return mountPoint;
114
+ };
115
+ })();
116
+ var powerShellPathFromWsl = async () => {
117
+ const mountPoint = await wslDrivesMountPoint();
118
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
119
+ };
120
+ var powerShellPath = async () => {
121
+ if (is_wsl_default) {
122
+ return powerShellPathFromWsl();
123
+ }
124
+ return `${process2.env.SYSTEMROOT || process2.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
125
+ };
126
+
127
+ // ../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
128
+ function defineLazyProperty(object, propertyName, valueGetter) {
129
+ const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
130
+ Object.defineProperty(object, propertyName, {
131
+ configurable: true,
132
+ enumerable: true,
133
+ get() {
134
+ const result = valueGetter();
135
+ define(result);
136
+ return result;
137
+ },
138
+ set(value) {
139
+ define(value);
140
+ }
141
+ });
142
+ return object;
143
+ }
144
+
145
+ // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
146
+ import { promisify as promisify4 } from "node:util";
147
+ import process5 from "node:process";
148
+ import { execFile as execFile4 } from "node:child_process";
149
+
150
+ // ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
151
+ import { promisify } from "node:util";
152
+ import process3 from "node:process";
153
+ import { execFile } from "node:child_process";
154
+ var execFileAsync = promisify(execFile);
155
+ async function defaultBrowserId() {
156
+ if (process3.platform !== "darwin") {
157
+ throw new Error("macOS only");
158
+ }
159
+ const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
160
+ const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
161
+ const browserId = match?.groups.id ?? "com.apple.Safari";
162
+ if (browserId === "com.apple.safari") {
163
+ return "com.apple.Safari";
164
+ }
165
+ return browserId;
166
+ }
167
+
168
+ // ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
169
+ import process4 from "node:process";
170
+ import { promisify as promisify2 } from "node:util";
171
+ import { execFile as execFile2, execFileSync } from "node:child_process";
172
+ var execFileAsync2 = promisify2(execFile2);
173
+ async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
174
+ if (process4.platform !== "darwin") {
175
+ throw new Error("macOS only");
176
+ }
177
+ const outputArguments = humanReadableOutput ? [] : ["-ss"];
178
+ const execOptions = {};
179
+ if (signal) {
180
+ execOptions.signal = signal;
181
+ }
182
+ const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
183
+ return stdout.trim();
184
+ }
185
+
186
+ // ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
187
+ async function bundleName(bundleId) {
188
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
189
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
190
+ }
191
+
192
+ // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
193
+ import { promisify as promisify3 } from "node:util";
194
+ import { execFile as execFile3 } from "node:child_process";
195
+ var execFileAsync3 = promisify3(execFile3);
196
+ var windowsBrowserProgIds = {
197
+ MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
198
+ MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
199
+ MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
200
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
201
+ ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
202
+ ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
203
+ ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
204
+ ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
205
+ BraveHTML: { name: "Brave", id: "com.brave.Browser" },
206
+ BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
207
+ BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
208
+ BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
209
+ FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
210
+ OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
211
+ VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
212
+ "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
213
+ };
214
+ var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
215
+
216
+ class UnknownBrowserError extends Error {
217
+ }
218
+ async function defaultBrowser(_execFileAsync = execFileAsync3) {
219
+ const { stdout } = await _execFileAsync("reg", [
220
+ "QUERY",
221
+ " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
222
+ "/v",
223
+ "ProgId"
224
+ ]);
225
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
226
+ if (!match) {
227
+ throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
228
+ }
229
+ const { id } = match.groups;
230
+ const dotIndex = id.lastIndexOf(".");
231
+ const hyphenIndex = id.lastIndexOf("-");
232
+ const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
233
+ const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
234
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
235
+ }
236
+
237
+ // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
238
+ var execFileAsync4 = promisify4(execFile4);
239
+ var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
240
+ async function defaultBrowser2() {
241
+ if (process5.platform === "darwin") {
242
+ const id = await defaultBrowserId();
243
+ const name = await bundleName(id);
244
+ return { name, id };
245
+ }
246
+ if (process5.platform === "linux") {
247
+ const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
248
+ const id = stdout.trim();
249
+ const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
250
+ return { name, id };
251
+ }
252
+ if (process5.platform === "win32") {
253
+ return defaultBrowser();
254
+ }
255
+ throw new Error("Only macOS, Linux, and Windows are supported");
256
+ }
257
+
258
+ // ../../node_modules/.bun/open@10.2.0/node_modules/open/index.js
259
+ var execFile5 = promisify5(childProcess.execFile);
260
+ var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
261
+ var localXdgOpenPath = path.join(__dirname2, "xdg-open");
262
+ var { platform, arch } = process6;
263
+ async function getWindowsDefaultBrowserFromWsl() {
264
+ const powershellPath = await powerShellPath();
265
+ const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
266
+ const encodedCommand = Buffer.from(rawCommand, "utf16le").toString("base64");
267
+ const { stdout } = await execFile5(powershellPath, [
268
+ "-NoProfile",
269
+ "-NonInteractive",
270
+ "-ExecutionPolicy",
271
+ "Bypass",
272
+ "-EncodedCommand",
273
+ encodedCommand
274
+ ], { encoding: "utf8" });
275
+ const progId = stdout.trim();
276
+ const browserMap = {
277
+ ChromeHTML: "com.google.chrome",
278
+ BraveHTML: "com.brave.Browser",
279
+ MSEdgeHTM: "com.microsoft.edge",
280
+ FirefoxURL: "org.mozilla.firefox"
281
+ };
282
+ return browserMap[progId] ? { id: browserMap[progId] } : {};
283
+ }
284
+ var pTryEach = async (array, mapper) => {
285
+ let latestError;
286
+ for (const item of array) {
287
+ try {
288
+ return await mapper(item);
289
+ } catch (error) {
290
+ latestError = error;
291
+ }
292
+ }
293
+ throw latestError;
294
+ };
295
+ var baseOpen = async (options) => {
296
+ options = {
297
+ wait: false,
298
+ background: false,
299
+ newInstance: false,
300
+ allowNonzeroExitCode: false,
301
+ ...options
302
+ };
303
+ if (Array.isArray(options.app)) {
304
+ return pTryEach(options.app, (singleApp) => baseOpen({
305
+ ...options,
306
+ app: singleApp
307
+ }));
308
+ }
309
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
310
+ appArguments = [...appArguments];
311
+ if (Array.isArray(app)) {
312
+ return pTryEach(app, (appName) => baseOpen({
313
+ ...options,
314
+ app: {
315
+ name: appName,
316
+ arguments: appArguments
317
+ }
318
+ }));
319
+ }
320
+ if (app === "browser" || app === "browserPrivate") {
321
+ const ids = {
322
+ "com.google.chrome": "chrome",
323
+ "google-chrome.desktop": "chrome",
324
+ "com.brave.Browser": "brave",
325
+ "org.mozilla.firefox": "firefox",
326
+ "firefox.desktop": "firefox",
327
+ "com.microsoft.msedge": "edge",
328
+ "com.microsoft.edge": "edge",
329
+ "com.microsoft.edgemac": "edge",
330
+ "microsoft-edge.desktop": "edge"
331
+ };
332
+ const flags = {
333
+ chrome: "--incognito",
334
+ brave: "--incognito",
335
+ firefox: "--private-window",
336
+ edge: "--inPrivate"
337
+ };
338
+ const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
339
+ if (browser.id in ids) {
340
+ const browserName = ids[browser.id];
341
+ if (app === "browserPrivate") {
342
+ appArguments.push(flags[browserName]);
343
+ }
344
+ return baseOpen({
345
+ ...options,
346
+ app: {
347
+ name: apps[browserName],
348
+ arguments: appArguments
349
+ }
350
+ });
351
+ }
352
+ throw new Error(`${browser.name} is not supported as a default browser`);
353
+ }
354
+ let command;
355
+ const cliArguments = [];
356
+ const childProcessOptions = {};
357
+ if (platform === "darwin") {
358
+ command = "open";
359
+ if (options.wait) {
360
+ cliArguments.push("--wait-apps");
361
+ }
362
+ if (options.background) {
363
+ cliArguments.push("--background");
364
+ }
365
+ if (options.newInstance) {
366
+ cliArguments.push("--new");
367
+ }
368
+ if (app) {
369
+ cliArguments.push("-a", app);
370
+ }
371
+ } else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
372
+ command = await powerShellPath();
373
+ cliArguments.push("-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-EncodedCommand");
374
+ if (!is_wsl_default) {
375
+ childProcessOptions.windowsVerbatimArguments = true;
376
+ }
377
+ const encodedArguments = ["Start"];
378
+ if (options.wait) {
379
+ encodedArguments.push("-Wait");
380
+ }
381
+ if (app) {
382
+ encodedArguments.push(`"\`"${app}\`""`);
383
+ if (options.target) {
384
+ appArguments.push(options.target);
385
+ }
386
+ } else if (options.target) {
387
+ encodedArguments.push(`"${options.target}"`);
388
+ }
389
+ if (appArguments.length > 0) {
390
+ appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
391
+ encodedArguments.push("-ArgumentList", appArguments.join(","));
392
+ }
393
+ options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
394
+ } else {
395
+ if (app) {
396
+ command = app;
397
+ } else {
398
+ const isBundled = !__dirname2 || __dirname2 === "/";
399
+ let exeLocalXdgOpen = false;
400
+ try {
401
+ await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
402
+ exeLocalXdgOpen = true;
403
+ } catch {}
404
+ const useSystemXdgOpen = process6.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
405
+ command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
406
+ }
407
+ if (appArguments.length > 0) {
408
+ cliArguments.push(...appArguments);
409
+ }
410
+ if (!options.wait) {
411
+ childProcessOptions.stdio = "ignore";
412
+ childProcessOptions.detached = true;
413
+ }
414
+ }
415
+ if (platform === "darwin" && appArguments.length > 0) {
416
+ cliArguments.push("--args", ...appArguments);
417
+ }
418
+ if (options.target) {
419
+ cliArguments.push(options.target);
420
+ }
421
+ const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
422
+ if (options.wait) {
423
+ return new Promise((resolve, reject) => {
424
+ subprocess.once("error", reject);
425
+ subprocess.once("close", (exitCode) => {
426
+ if (!options.allowNonzeroExitCode && exitCode > 0) {
427
+ reject(new Error(`Exited with code ${exitCode}`));
428
+ return;
429
+ }
430
+ resolve(subprocess);
431
+ });
432
+ });
433
+ }
434
+ subprocess.unref();
435
+ return subprocess;
436
+ };
437
+ var open = (target, options) => {
438
+ if (typeof target !== "string") {
439
+ throw new TypeError("Expected a `target`");
440
+ }
441
+ return baseOpen({
442
+ ...options,
443
+ target
444
+ });
445
+ };
446
+ var openApp = (name, options) => {
447
+ if (typeof name !== "string" && !Array.isArray(name)) {
448
+ throw new TypeError("Expected a valid `name`");
449
+ }
450
+ const { arguments: appArguments = [] } = options ?? {};
451
+ if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
452
+ throw new TypeError("Expected `appArguments` as Array type");
453
+ }
454
+ return baseOpen({
455
+ ...options,
456
+ app: {
457
+ name,
458
+ arguments: appArguments
459
+ }
460
+ });
461
+ };
462
+ function detectArchBinary(binary) {
463
+ if (typeof binary === "string" || Array.isArray(binary)) {
464
+ return binary;
465
+ }
466
+ const { [arch]: archBinary } = binary;
467
+ if (!archBinary) {
468
+ throw new Error(`${arch} is not supported`);
469
+ }
470
+ return archBinary;
471
+ }
472
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
473
+ if (wsl && is_wsl_default) {
474
+ return detectArchBinary(wsl);
475
+ }
476
+ if (!platformBinary) {
477
+ throw new Error(`${platform} is not supported`);
478
+ }
479
+ return detectArchBinary(platformBinary);
480
+ }
481
+ var apps = {};
482
+ defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
483
+ darwin: "google chrome",
484
+ win32: "chrome",
485
+ linux: ["google-chrome", "google-chrome-stable", "chromium"]
486
+ }, {
487
+ wsl: {
488
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
489
+ x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
490
+ }
491
+ }));
492
+ defineLazyProperty(apps, "brave", () => detectPlatformBinary({
493
+ darwin: "brave browser",
494
+ win32: "brave",
495
+ linux: ["brave-browser", "brave"]
496
+ }, {
497
+ wsl: {
498
+ ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
499
+ x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
500
+ }
501
+ }));
502
+ defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
503
+ darwin: "firefox",
504
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
505
+ linux: "firefox"
506
+ }, {
507
+ wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
508
+ }));
509
+ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
510
+ darwin: "microsoft edge",
511
+ win32: "msedge",
512
+ linux: ["microsoft-edge", "microsoft-edge-dev"]
513
+ }, {
514
+ wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
515
+ }));
516
+ defineLazyProperty(apps, "browser", () => "browser");
517
+ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
518
+ var open_default = open;
519
+ export {
520
+ openApp,
521
+ open_default as default,
522
+ apps
523
+ };