peachsim 0.1.2499 → 0.1.2500

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 (135) hide show
  1. package/cli/agent-note.ts +76 -59
  2. package/cli/cloud-client.ts +59 -1
  3. package/cli/cloud-dispatch.ts +8 -1
  4. package/cli/commands/serve.ts +30 -5
  5. package/cli/commands/stream.ts +29 -33
  6. package/cli/outbound-endpoints.ts +2 -0
  7. package/cli/stream-record.ts +56 -0
  8. package/dist-lib/agent-daemon-client.cjs +1 -1
  9. package/dist-lib/agent-events.cjs +1 -1
  10. package/dist-lib/attached-projects.cjs +1 -1
  11. package/dist-lib/auth/shared-session.cjs +1 -1
  12. package/dist-lib/backend-origin.cjs +1 -1
  13. package/dist-lib/beta.cjs +1 -1
  14. package/dist-lib/beta.mjs +2 -2
  15. package/dist-lib/bridge-constants.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.cjs +1 -1
  17. package/dist-lib/bridge-contract-input.mjs +5 -5
  18. package/dist-lib/bridge-contract.cjs +1 -1
  19. package/dist-lib/bridge-contract.mjs +3 -3
  20. package/dist-lib/bundle-channel.cjs +1 -1
  21. package/dist-lib/capture-contract.cjs +1 -1
  22. package/dist-lib/capture-contract.mjs +3 -3
  23. package/dist-lib/cloud-contract.cjs +1 -1
  24. package/dist-lib/cloud-contract.mjs +3 -3
  25. package/dist-lib/cloud-test-args.cjs +1 -1
  26. package/dist-lib/cloud-test-args.mjs +2 -2
  27. package/dist-lib/cloud.cjs +1 -1
  28. package/dist-lib/cloud.mjs +7 -7
  29. package/dist-lib/config.cjs +1 -1
  30. package/dist-lib/config.mjs +5 -5
  31. package/dist-lib/detox/index.cjs +35 -19
  32. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  33. package/dist-lib/esm-chunks/{acorn-IYZTMBZB.mjs → acorn-FAFTHRIF.mjs} +3 -3
  34. package/dist-lib/esm-chunks/{chunk-NC3S3RUQ.mjs → chunk-2TEZ22ZJ.mjs} +5 -5
  35. package/dist-lib/esm-chunks/{chunk-GEPXMQLD.mjs → chunk-3WW5WG4Z.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-O5OXZSPW.mjs → chunk-B47KUDF6.mjs} +2 -2
  37. package/dist-lib/esm-chunks/{chunk-AMCGU7G3.mjs → chunk-BHMUWCQ3.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-O2NAIB7T.mjs → chunk-BZZDAC5F.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-TKVDALS6.mjs → chunk-COY6S3UO.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-JWXQPOE4.mjs → chunk-DVVPGZAO.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-BAG7H6CI.mjs → chunk-EE3RVR43.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-QSN7ACP5.mjs → chunk-FTW7FYVC.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-MKWEZN5Y.mjs → chunk-G5XQIR2J.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-L7PBNY33.mjs → chunk-GUWMIHAV.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-OUL5LFNX.mjs → chunk-HC2AC7SK.mjs} +4 -4
  46. package/dist-lib/esm-chunks/{chunk-KNSIBVRX.mjs → chunk-HQFK43EA.mjs} +12 -12
  47. package/dist-lib/esm-chunks/{chunk-ZVA3TIMK.mjs → chunk-JRVAB44R.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-4BQEG5SG.mjs → chunk-MAV7ERB4.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-2QXY3HHQ.mjs → chunk-NVK7HKIG.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-AD5AMO2H.mjs → chunk-SMNIC2BY.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{chunk-AF4M23XW.mjs → chunk-U2A7SW35.mjs} +1 -1
  52. package/dist-lib/esm-chunks/{chunk-SIG45VVY.mjs → chunk-X7BCKYHC.mjs} +1 -1
  53. package/dist-lib/esm-chunks/{chunk-YC6JAUGD.mjs → chunk-Z4J4KXU3.mjs} +3 -3
  54. package/dist-lib/esm-chunks/{chunk-RTF2ZDLQ.mjs → chunk-ZUTV47C5.mjs} +5 -5
  55. package/dist-lib/esm-chunks/{metro-layout-parser-BI54UMFP.mjs → metro-layout-parser-23DHUJCN.mjs} +3 -3
  56. package/dist-lib/esm-chunks/{swift-package-prebuilt-WQRBOQLW.mjs → swift-package-prebuilt-TVGODNLV.mjs} +10 -10
  57. package/dist-lib/esm-chunks/{swift-sdk-app-module-7GREAIPH.mjs → swift-sdk-app-module-CZGSZHEG.mjs} +13 -13
  58. package/dist-lib/esm-chunks/{swift-sdk-image-YVOFRTJS.mjs → swift-sdk-image-2ZL67WIA.mjs} +13 -13
  59. package/dist-lib/esm-chunks/{swift-sdk-image-producer-CBZRZQKH.mjs → swift-sdk-image-producer-F4O3V7LJ.mjs} +4 -4
  60. package/dist-lib/expo-swift-bundle.cjs +1 -1
  61. package/dist-lib/expo-swift-metadata.cjs +1 -1
  62. package/dist-lib/expo-swift-metadata.mjs +7 -7
  63. package/dist-lib/home-paths.cjs +1 -1
  64. package/dist-lib/host/bridge-host.cjs +92 -59
  65. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  66. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  67. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  68. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  69. package/dist-lib/host/websocket-proxy.cjs +1 -1
  70. package/dist-lib/index.cjs +98 -16
  71. package/dist-lib/kotlin-host.cjs +1 -1
  72. package/dist-lib/menu.cjs +1 -1
  73. package/dist-lib/menu.mjs +3 -3
  74. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  75. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  76. package/dist-lib/metro-production-bundle.cjs +1 -1
  77. package/dist-lib/metro-production-bundle.mjs +4 -4
  78. package/dist-lib/native-app-identity-project.cjs +1 -1
  79. package/dist-lib/native-app-identity-project.mjs +15 -15
  80. package/dist-lib/native-app-identity.cjs +1 -1
  81. package/dist-lib/native-app-identity.mjs +6 -6
  82. package/dist-lib/native-firebase-metadata.cjs +1 -1
  83. package/dist-lib/native-firebase-metadata.mjs +3 -3
  84. package/dist-lib/pdfium-raster.cjs +1 -1
  85. package/dist-lib/pdfium-raster.mjs +2 -2
  86. package/dist-lib/plist.cjs +1 -1
  87. package/dist-lib/plist.mjs +3 -3
  88. package/dist-lib/profiles.cjs +1 -1
  89. package/dist-lib/public-brand.cjs +1 -1
  90. package/dist-lib/public-origins-lib-esm.json +81 -80
  91. package/dist-lib/public-origins-lib.json +78 -71
  92. package/dist-lib/react-native-host-modules.cjs +1 -1
  93. package/dist-lib/react-native-host-modules.mjs +2 -2
  94. package/dist-lib/reap-browser.cjs +1 -1
  95. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  96. package/dist-lib/sdk.cjs +1 -1
  97. package/dist-lib/sdk.mjs +7 -7
  98. package/dist-lib/skills.cjs +543 -457
  99. package/dist-lib/swift-compile.cjs +1 -1
  100. package/dist-lib/swift-compile.mjs +10 -10
  101. package/dist-lib/swift-package.cjs +1 -1
  102. package/dist-lib/swift-package.mjs +3 -3
  103. package/dist-lib/swift-submit.cjs +1 -1
  104. package/dist-lib/swift-submit.mjs +5 -5
  105. package/dist-lib/swift-svg-raster.cjs +30 -20
  106. package/dist-lib/swift-svg-raster.mjs +31 -21
  107. package/dist-lib/swift-toolchain.cjs +1 -1
  108. package/dist-lib/swift.cjs +1 -1
  109. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  110. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  111. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  112. package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
  113. package/dist-lib/vendor/acorn.cjs +1 -1
  114. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  115. package/dist-lib/vendor/ignore.cjs +1 -1
  116. package/dist-lib/vendor/magic-string.cjs +1 -1
  117. package/dist-lib/vendor/plist.cjs +1 -1
  118. package/dist-lib/vendor/smol-toml.cjs +1 -1
  119. package/dist-lib/vendor/stream-json.cjs +1 -1
  120. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  121. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  122. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  123. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  124. package/dist-lib/vendor/sucrase.cjs +1 -1
  125. package/dist-lib/vendor/terser.cjs +1 -1
  126. package/dist-lib/vendor/valibot.cjs +1 -1
  127. package/dist-lib/vendor/ws.cjs +1 -1
  128. package/dist-lib/vendor/zod.cjs +1 -1
  129. package/dist-lib/worklet-executable.cjs +1 -1
  130. package/dist-lib/worklet-executable.mjs +3 -3
  131. package/dist-types/packages/peach-engine/src/engine/image-svg-raster.d.ts +1 -1
  132. package/dist-types/packages/peach-engine/vendor/camera/camera-heic.d.ts +2 -1
  133. package/package.json +1 -1
  134. package/src/svg-rasterizer-wasm.ts +44 -0
  135. package/src/swift-svg-raster.ts +10 -39
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2499 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2500 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -37463,8 +37463,8 @@ function arrayMethod(interp, self, call, env) {
37463
37463
  return Array.from({ length: intArg(interp, a) }, () => self).flat();
37464
37464
  case "join": {
37465
37465
  const sep4 = a === void 0 || a === null ? "" : strArg(interp, a);
37466
- const join36 = (values) => values.map((v10) => Array.isArray(v10) ? join36(v10) : interp.toS(v10, env)).join(sep4);
37467
- return str(join36(self));
37466
+ const join37 = (values) => values.map((v10) => Array.isArray(v10) ? join37(v10) : interp.toS(v10, env)).join(sep4);
37467
+ return str(join37(self));
37468
37468
  }
37469
37469
  case "compact":
37470
37470
  return self.filter((v10) => v10 !== null);
@@ -41210,7 +41210,7 @@ function rubyGlob(pattern, base2, dotMatch = false) {
41210
41210
  return;
41211
41211
  }
41212
41212
  const segment2 = segments[index];
41213
- const join36 = (name3) => shown === "" ? name3 : shown.endsWith("/") ? shown + name3 : `${shown}/${name3}`;
41213
+ const join37 = (name3) => shown === "" ? name3 : shown.endsWith("/") ? shown + name3 : `${shown}/${name3}`;
41214
41214
  if (segment2 === "" && index === 0) {
41215
41215
  walk4("/", "/", index + 1);
41216
41216
  return;
@@ -41226,14 +41226,14 @@ function rubyGlob(pattern, base2, dotMatch = false) {
41226
41226
  for (const entry of entries2.sort((a, b) => a.name < b.name ? -1 : 1)) {
41227
41227
  if (!dotMatch && entry.name.startsWith(".")) continue;
41228
41228
  if (entry.isDirectory())
41229
- walk4(import_node_path30.default.join(dir, entry.name), join36(entry.name), index);
41229
+ walk4(import_node_path30.default.join(dir, entry.name), join37(entry.name), index);
41230
41230
  }
41231
41231
  return;
41232
41232
  }
41233
41233
  if (!/[*?[{\\]/.test(segment2)) {
41234
41234
  const next = import_node_path30.default.join(dir, segment2);
41235
41235
  if (index === segments.length - 1 ? import_node_fs34.default.existsSync(next) : isDirectory(next))
41236
- walk4(next, join36(segment2), index + 1);
41236
+ walk4(next, join37(segment2), index + 1);
41237
41237
  return;
41238
41238
  }
41239
41239
  const matcher = segmentMatcher(segment2, dotMatch);
@@ -41247,7 +41247,7 @@ function rubyGlob(pattern, base2, dotMatch = false) {
41247
41247
  if (!matcher.test(name3)) continue;
41248
41248
  const next = import_node_path30.default.join(dir, name3);
41249
41249
  if (index < segments.length - 1 && !isDirectory(next)) continue;
41250
- walk4(next, join36(name3), index + 1);
41250
+ walk4(next, join37(name3), index + 1);
41251
41251
  }
41252
41252
  };
41253
41253
  walk4(absolute ? "/" : base2, "", absolute ? 1 : 0);
@@ -92848,7 +92848,7 @@ function groupParentsOf(objects) {
92848
92848
  groupParents.set(objects, parents);
92849
92849
  return parents;
92850
92850
  }
92851
- function xcodePathResolver(objects, projectDir, join36, sourceTreeRoot) {
92851
+ function xcodePathResolver(objects, projectDir, join37, sourceTreeRoot) {
92852
92852
  const parents = groupParentsOf(objects);
92853
92853
  const paths = /* @__PURE__ */ new Map();
92854
92854
  const resolve15 = (id) => {
@@ -92860,14 +92860,14 @@ function xcodePathResolver(objects, projectDir, join36, sourceTreeRoot) {
92860
92860
  const own2 = str2(entry.path) ?? "";
92861
92861
  const tree2 = str2(entry.sourceTree) ?? "<group>";
92862
92862
  if (tree2 === "<absolute>") result = own2;
92863
- else if (tree2 === "SOURCE_ROOT") result = join36(projectDir, own2);
92863
+ else if (tree2 === "SOURCE_ROOT") result = join37(projectDir, own2);
92864
92864
  else if (tree2 === "<group>") {
92865
92865
  const parent = parents.get(id);
92866
92866
  const base2 = parent ? resolve15(parent) : projectDir;
92867
- if (base2 !== null) result = join36(base2, own2);
92867
+ if (base2 !== null) result = join37(base2, own2);
92868
92868
  } else {
92869
92869
  const base2 = sourceTreeRoot?.(tree2);
92870
- if (base2) result = join36(base2, own2);
92870
+ if (base2) result = join37(base2, own2);
92871
92871
  }
92872
92872
  }
92873
92873
  paths.set(id, result);
@@ -92889,7 +92889,7 @@ function xcodeTargetMemberVisitor(objects) {
92889
92889
  if (isDict(group) && group.isa === "PBXFileSystemSynchronizedRootGroup")
92890
92890
  synchronizedGroups.push({ id, group });
92891
92891
  }
92892
- return (targetId, resolvePath, filesUnder, join36, visit3) => {
92892
+ return (targetId, resolvePath, filesUnder, join37, visit3) => {
92893
92893
  const target = objects[targetId];
92894
92894
  if (!isDict(target)) return;
92895
92895
  for (const phaseId of list(target.buildPhases)) {
@@ -92936,7 +92936,7 @@ function xcodeTargetMemberVisitor(objects) {
92936
92936
  for (const relative6 of list(exception.membershipExceptions))
92937
92937
  exceptions.add(relative6);
92938
92938
  }
92939
- const members2 = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative6) => filesUnder(join36(folder, relative6)));
92939
+ const members2 = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative6) => filesUnder(join37(folder, relative6)));
92940
92940
  for (const file of members2) {
92941
92941
  const relative6 = file.slice(prefix.length);
92942
92942
  const excepted = [...exceptions].some(
@@ -93545,7 +93545,7 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
93545
93545
  if (resourceUri) {
93546
93546
  if (!selectedTarget)
93547
93547
  throw new Error("native app icon target membership is unresolved");
93548
- const join36 = (base2, own2) => {
93548
+ const join37 = (base2, own2) => {
93549
93549
  const segments = [];
93550
93550
  for (const segment2 of `${base2}/${own2}`.split("/")) {
93551
93551
  if (segment2 === "" || segment2 === ".") continue;
@@ -93558,14 +93558,14 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
93558
93558
  const project2 = Object.values(objects).find(
93559
93559
  (object8) => isRecord(object8) && object8.isa === "PBXProject"
93560
93560
  );
93561
- const projectDir = join36(
93561
+ const projectDir = join37(
93562
93562
  pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
93563
93563
  isRecord(project2) && typeof project2.projectDirPath === "string" ? project2.projectDirPath : ""
93564
93564
  );
93565
93565
  const paths = Object.keys(files2);
93566
93566
  xcodeTargetMemberVisitor(objects)(
93567
93567
  selectedTarget.id,
93568
- xcodePathResolver(objects, projectDir, join36),
93568
+ xcodePathResolver(objects, projectDir, join37),
93569
93569
  (file) => {
93570
93570
  if (Object.hasOwn(files2, file)) return [file];
93571
93571
  const prefix = file === "" ? "" : `${file.replace(/\/$/, "")}/`;
@@ -93573,7 +93573,7 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
93573
93573
  (path187) => path187.startsWith(prefix) && !/(?:^|\/)\./.test(path187.slice(prefix.length))
93574
93574
  );
93575
93575
  },
93576
- join36,
93576
+ join37,
93577
93577
  (file, kind) => {
93578
93578
  if (kind === "resource") resources.add(file);
93579
93579
  }
@@ -146335,6 +146335,61 @@ var init_run_registry = __esm({
146335
146335
  }
146336
146336
  });
146337
146337
 
146338
+ // cli/stream-record.ts
146339
+ function streamRecordPath(simId) {
146340
+ return (0, import_node_path179.join)(rnxHomeDir(), "streams", `${encodeURIComponent(simId)}.json`);
146341
+ }
146342
+ function readLocalStreamRecord(simId) {
146343
+ try {
146344
+ return streamRecord.parse(JSON.parse((0, import_node_fs176.readFileSync)(streamRecordPath(simId), "utf8")));
146345
+ } catch (error) {
146346
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
146347
+ throw error;
146348
+ }
146349
+ }
146350
+ function readSceneStreamForParsed(parsed2) {
146351
+ const record6 = !parsed2.explicitPort && parsed2.simId ? readLocalStreamRecord(parsed2.simId) : null;
146352
+ return record6?.command ? { ...record6, command: record6.command } : null;
146353
+ }
146354
+ function writeLocalStreamRecord(simId, record6, durable) {
146355
+ writeSecureJsonAtomic(streamRecordPath(simId), record6, { durable });
146356
+ }
146357
+ function removeLocalStreamRecord(simId) {
146358
+ (0, import_node_fs176.rmSync)(streamRecordPath(simId), { force: true });
146359
+ }
146360
+ var import_node_fs176, import_node_path179, import_zod4, sceneCommandEndpoint, streamRecord;
146361
+ var init_stream_record = __esm({
146362
+ "cli/stream-record.ts"() {
146363
+ "use strict";
146364
+ import_node_fs176 = require("node:fs");
146365
+ import_node_path179 = require("node:path");
146366
+ import_zod4 = require("peachsim/vendor/zod");
146367
+ init_home_paths();
146368
+ init_secure_file();
146369
+ sceneCommandEndpoint = import_zod4.z.object({
146370
+ port: import_zod4.z.number().int().min(1).max(65535),
146371
+ token: import_zod4.z.string().regex(/^[a-f0-9]{64}$/)
146372
+ });
146373
+ streamRecord = import_zod4.z.object({
146374
+ sessionId: import_zod4.z.string(),
146375
+ accountId: import_zod4.z.string(),
146376
+ origin: import_zod4.z.string(),
146377
+ watchUrl: import_zod4.z.string(),
146378
+ command: sceneCommandEndpoint.optional()
146379
+ });
146380
+ }
146381
+ });
146382
+
146383
+ // cli/usage-error.ts
146384
+ var CliUsageError;
146385
+ var init_usage_error = __esm({
146386
+ "cli/usage-error.ts"() {
146387
+ "use strict";
146388
+ CliUsageError = class extends Error {
146389
+ };
146390
+ }
146391
+ });
146392
+
146338
146393
  // cli/cloud-client.ts
146339
146394
  var cloud_client_exports = {};
146340
146395
  __export(cloud_client_exports, {
@@ -146404,27 +146459,27 @@ function cloudConnectionError(cause) {
146404
146459
  );
146405
146460
  }
146406
146461
  function readImmutableBundleSource(bundlePath, command) {
146407
- const filepath = (0, import_node_path179.resolve)(bundlePath);
146408
- if ((0, import_node_path179.extname)(filepath) === ".hbc") {
146462
+ const filepath = (0, import_node_path180.resolve)(bundlePath);
146463
+ if ((0, import_node_path180.extname)(filepath) === ".hbc") {
146409
146464
  const platform3 = filepath.includes("/android/") ? "android" : "ios";
146410
146465
  throw new Error(
146411
146466
  `${command} cannot preview Hermes bytecode (${bundlePath}). Export plain JavaScript with \`npx expo export --platform ${platform3} --no-bytecode\` and preview the .js bundle instead.`
146412
146467
  );
146413
146468
  }
146414
- if ((0, import_node_path179.extname)(filepath) !== ".js") {
146469
+ if ((0, import_node_path180.extname)(filepath) !== ".js") {
146415
146470
  throw new Error(`${command} requires one local .js bundle`);
146416
146471
  }
146417
- const descriptor = (0, import_node_fs176.openSync)(filepath, "r");
146472
+ const descriptor = (0, import_node_fs177.openSync)(filepath, "r");
146418
146473
  try {
146419
- const before = (0, import_node_fs176.fstatSync)(descriptor, { bigint: true });
146474
+ const before = (0, import_node_fs177.fstatSync)(descriptor, { bigint: true });
146420
146475
  if (!before.isFile()) {
146421
146476
  throw new Error(`${command} bundle must be a regular local file`);
146422
146477
  }
146423
146478
  if (before.size <= 0n) {
146424
146479
  throw new Error(`${command} bundle is empty`);
146425
146480
  }
146426
- const bytes = (0, import_node_fs176.readFileSync)(descriptor);
146427
- const after = (0, import_node_fs176.fstatSync)(descriptor, { bigint: true });
146481
+ const bytes = (0, import_node_fs177.readFileSync)(descriptor);
146482
+ const after = (0, import_node_fs177.fstatSync)(descriptor, { bigint: true });
146428
146483
  if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
146429
146484
  throw new Error(`${command} bundle changed while it was being read`);
146430
146485
  }
@@ -146436,7 +146491,7 @@ function readImmutableBundleSource(bundlePath, command) {
146436
146491
  }
146437
146492
  return source;
146438
146493
  } finally {
146439
- (0, import_node_fs176.closeSync)(descriptor);
146494
+ (0, import_node_fs177.closeSync)(descriptor);
146440
146495
  }
146441
146496
  }
146442
146497
  async function fetchBundleSource(bundleUrl, command) {
@@ -146501,15 +146556,15 @@ function assertBundleBuiltFor(bytes, platform3, command) {
146501
146556
  );
146502
146557
  }
146503
146558
  function listMetroAssetDest(assetsPath) {
146504
- const directory2 = (0, import_node_path179.resolve)(assetsPath);
146505
- if (!(0, import_node_fs176.existsSync)(directory2)) return { directory: directory2, files: [], truncated: false };
146506
- const skipNested = (0, import_node_fs176.existsSync)((0, import_node_path179.join)(directory2, "package.json"));
146559
+ const directory2 = (0, import_node_path180.resolve)(assetsPath);
146560
+ if (!(0, import_node_fs177.existsSync)(directory2)) return { directory: directory2, files: [], truncated: false };
146561
+ const skipNested = (0, import_node_fs177.existsSync)((0, import_node_path180.join)(directory2, "package.json"));
146507
146562
  const files2 = [];
146508
146563
  let truncated = false;
146509
146564
  const walk4 = (dir, prefix) => {
146510
146565
  let entries2;
146511
146566
  try {
146512
- entries2 = (0, import_node_fs176.readdirSync)(dir, { withFileTypes: true });
146567
+ entries2 = (0, import_node_fs177.readdirSync)(dir, { withFileTypes: true });
146513
146568
  } catch {
146514
146569
  return;
146515
146570
  }
@@ -146521,7 +146576,7 @@ function listMetroAssetDest(assetsPath) {
146521
146576
  if (entry.isDirectory()) {
146522
146577
  if (entry.name === ".git") continue;
146523
146578
  if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
146524
- walk4((0, import_node_path179.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
146579
+ walk4((0, import_node_path180.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
146525
146580
  } else if (entry.isFile()) {
146526
146581
  files2.push(prefix ? `${prefix}/${entry.name}` : entry.name);
146527
146582
  }
@@ -146556,7 +146611,7 @@ function distinctByContent(directory2, options2) {
146556
146611
  for (const relative6 of options2) {
146557
146612
  let bytes;
146558
146613
  try {
146559
- bytes = (0, import_node_fs176.readFileSync)((0, import_node_path179.join)(directory2, relative6));
146614
+ bytes = (0, import_node_fs177.readFileSync)((0, import_node_path180.join)(directory2, relative6));
146560
146615
  } catch {
146561
146616
  continue;
146562
146617
  }
@@ -146602,7 +146657,7 @@ function placeMetroDescriptor(listing, descriptor) {
146602
146657
  let bytes;
146603
146658
  try {
146604
146659
  bytes = combination.map(
146605
- (relative6) => (0, import_node_fs176.readFileSync)((0, import_node_path179.join)(listing.directory, relative6))
146660
+ (relative6) => (0, import_node_fs177.readFileSync)((0, import_node_path180.join)(listing.directory, relative6))
146606
146661
  );
146607
146662
  } catch {
146608
146663
  continue;
@@ -146630,10 +146685,10 @@ function unverifiedContentKey(dest, fileDigests2) {
146630
146685
  return JSON.stringify(
146631
146686
  dest.placements.map(
146632
146687
  (placement) => placement.verified ? null : [...placement.files].map(([scale, relative6]) => {
146633
- const file = (0, import_node_path179.join)(dest.directory, relative6);
146688
+ const file = (0, import_node_path180.join)(dest.directory, relative6);
146634
146689
  let digest3 = fileDigests2.get(file);
146635
146690
  if (digest3 === void 0) {
146636
- digest3 = (0, import_node_crypto104.createHash)("sha256").update((0, import_node_fs176.readFileSync)(file)).digest("hex");
146691
+ digest3 = (0, import_node_crypto104.createHash)("sha256").update((0, import_node_fs177.readFileSync)(file)).digest("hex");
146637
146692
  fileDigests2.set(file, digest3);
146638
146693
  }
146639
146694
  return [scale, digest3];
@@ -146642,42 +146697,42 @@ function unverifiedContentKey(dest, fileDigests2) {
146642
146697
  );
146643
146698
  }
146644
146699
  function findExpoExportRoot(bundleDirectory) {
146645
- let directory2 = (0, import_node_path179.resolve)(bundleDirectory);
146700
+ let directory2 = (0, import_node_path180.resolve)(bundleDirectory);
146646
146701
  for (let depth = 0; depth < 6; depth++) {
146647
- const metadata = (0, import_node_path179.join)(directory2, "metadata.json");
146648
- if ((0, import_node_fs176.existsSync)(metadata) && (0, import_node_fs176.existsSync)((0, import_node_path179.join)(directory2, "assets"))) {
146702
+ const metadata = (0, import_node_path180.join)(directory2, "metadata.json");
146703
+ if ((0, import_node_fs177.existsSync)(metadata) && (0, import_node_fs177.existsSync)((0, import_node_path180.join)(directory2, "assets"))) {
146649
146704
  try {
146650
- if ((0, import_node_fs176.readFileSync)(metadata, "utf8").includes('"fileMetadata"')) {
146705
+ if ((0, import_node_fs177.readFileSync)(metadata, "utf8").includes('"fileMetadata"')) {
146651
146706
  return directory2;
146652
146707
  }
146653
146708
  } catch {
146654
146709
  }
146655
146710
  }
146656
- const parent = (0, import_node_path179.dirname)(directory2);
146711
+ const parent = (0, import_node_path180.dirname)(directory2);
146657
146712
  if (parent === directory2) return null;
146658
146713
  directory2 = parent;
146659
146714
  }
146660
146715
  return null;
146661
146716
  }
146662
146717
  function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory) {
146663
- const bundleDirectory = (0, import_node_path179.dirname)((0, import_node_path179.resolve)(bundlePath));
146718
+ const bundleDirectory = (0, import_node_path180.dirname)((0, import_node_path180.resolve)(bundlePath));
146664
146719
  const expoRoot = assetsDirectory || isRemoteBundleInput(bundlePath) ? null : findExpoExportRoot(bundleDirectory);
146665
- const candidates = assetsDirectory ? [(0, import_node_path179.resolve)(assetsDirectory)] : [
146666
- ...expoRoot ? [(0, import_node_path179.join)(expoRoot, "assets")] : [],
146667
- (0, import_node_path179.join)(bundleDirectory, "assets"),
146720
+ const candidates = assetsDirectory ? [(0, import_node_path180.resolve)(assetsDirectory)] : [
146721
+ ...expoRoot ? [(0, import_node_path180.join)(expoRoot, "assets")] : [],
146722
+ (0, import_node_path180.join)(bundleDirectory, "assets"),
146668
146723
  bundleDirectory,
146669
- (0, import_node_path179.resolve)(bundleDirectory, "..", "assets")
146724
+ (0, import_node_path180.resolve)(bundleDirectory, "..", "assets")
146670
146725
  ];
146671
146726
  const cwd = process.cwd();
146672
146727
  let projectDirectory = null;
146673
146728
  for (const start of assetsDirectory ? [] : [bundleDirectory, cwd]) {
146674
- let directory2 = (0, import_node_path179.resolve)(start);
146729
+ let directory2 = (0, import_node_path180.resolve)(start);
146675
146730
  while (true) {
146676
146731
  if (detectProject(directory2)?.hasMetroConfig) {
146677
146732
  projectDirectory = directory2;
146678
146733
  break;
146679
146734
  }
146680
- const parent = (0, import_node_path179.dirname)(directory2);
146735
+ const parent = (0, import_node_path180.dirname)(directory2);
146681
146736
  if (parent === directory2) break;
146682
146737
  directory2 = parent;
146683
146738
  }
@@ -146685,11 +146740,11 @@ function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory)
146685
146740
  }
146686
146741
  if (projectDirectory) {
146687
146742
  candidates.push(
146688
- (0, import_node_path179.join)(projectDirectory, "assets"),
146689
- (0, import_node_path179.join)(projectDirectory, "dist"),
146690
- (0, import_node_path179.join)(projectDirectory, "dist", "assets"),
146691
- (0, import_node_path179.join)(projectDirectory, "build"),
146692
- (0, import_node_path179.join)(projectDirectory, "build", "assets")
146743
+ (0, import_node_path180.join)(projectDirectory, "assets"),
146744
+ (0, import_node_path180.join)(projectDirectory, "dist"),
146745
+ (0, import_node_path180.join)(projectDirectory, "dist", "assets"),
146746
+ (0, import_node_path180.join)(projectDirectory, "build"),
146747
+ (0, import_node_path180.join)(projectDirectory, "build", "assets")
146693
146748
  );
146694
146749
  }
146695
146750
  const searched = [];
@@ -146697,7 +146752,7 @@ function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory)
146697
146752
  const stale = [];
146698
146753
  let truncated = false;
146699
146754
  for (const candidate of candidates) {
146700
- const directory2 = (0, import_node_path179.resolve)(candidate);
146755
+ const directory2 = (0, import_node_path180.resolve)(candidate);
146701
146756
  if (searched.includes(directory2)) continue;
146702
146757
  searched.push(directory2);
146703
146758
  const listing = listMetroAssetDest(directory2);
@@ -146807,20 +146862,20 @@ async function producePreviewArtifact(bundlePath) {
146807
146862
  }
146808
146863
  function bundleAppProject(bundlePath) {
146809
146864
  if (isRemoteBundleInput(bundlePath)) return null;
146810
- for (let dir = (0, import_node_path179.dirname)((0, import_node_path179.resolve)(bundlePath)); ; dir = (0, import_node_path179.dirname)(dir)) {
146811
- const manifest = (0, import_node_path179.join)(dir, "package.json");
146812
- if ((0, import_node_fs176.existsSync)(manifest)) {
146813
- const json = JSON.parse((0, import_node_fs176.readFileSync)(manifest, "utf8"));
146865
+ for (let dir = (0, import_node_path180.dirname)((0, import_node_path180.resolve)(bundlePath)); ; dir = (0, import_node_path180.dirname)(dir)) {
146866
+ const manifest = (0, import_node_path180.join)(dir, "package.json");
146867
+ if ((0, import_node_fs177.existsSync)(manifest)) {
146868
+ const json = JSON.parse((0, import_node_fs177.readFileSync)(manifest, "utf8"));
146814
146869
  if (isRecord(json) && [json.dependencies, json.devDependencies].some(
146815
146870
  (dependencies) => isRecord(dependencies) && "react-native" in dependencies
146816
146871
  ))
146817
146872
  return dir;
146818
146873
  }
146819
- if ((0, import_node_path179.dirname)(dir) === dir) return null;
146874
+ if ((0, import_node_path180.dirname)(dir) === dir) return null;
146820
146875
  }
146821
146876
  }
146822
146877
  async function embedBundleAssets(bundlePath, command, assetPolicy, assetsDirectory, assetServer, nativeProjectDir) {
146823
- const project2 = nativeProjectDir ? (0, import_node_path179.resolve)(nativeProjectDir) : bundleAppProject(bundlePath);
146878
+ const project2 = nativeProjectDir ? (0, import_node_path180.resolve)(nativeProjectDir) : bundleAppProject(bundlePath);
146824
146879
  const loaded4 = await loadBundleSource(bundlePath, command);
146825
146880
  const source = project2 && !readPackageVersionsFooter(loaded4)?.["react-native"] ? insertPackageVersionsFooter(
146826
146881
  loaded4,
@@ -146861,7 +146916,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy, assetsDirecto
146861
146916
  );
146862
146917
  }
146863
146918
  const relative6 = placement?.files.get(variant2.scale);
146864
- if (relative6 && dest) return (0, import_node_fs176.readFileSync)((0, import_node_path179.join)(dest.directory, relative6));
146919
+ if (relative6 && dest) return (0, import_node_fs177.readFileSync)((0, import_node_path180.join)(dest.directory, relative6));
146865
146920
  if (assetServer) {
146866
146921
  const filename2 = metroAssetScaleFilename(
146867
146922
  variant2.descriptor.name,
@@ -146909,7 +146964,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy, assetsDirecto
146909
146964
  );
146910
146965
  const classic = metroIosAssetDestRelatives(variant2.descriptor.httpServerLocation, filename)[0] ?? filename;
146911
146966
  throw new Error(
146912
- `${command} could not read ${(0, import_node_path179.join)(dest?.directory ?? ".", classic)} for ${variant2.descriptor.name}.${variant2.descriptor.type} at scale ${variant2.scale}, and has no stand-in for a .${variant2.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
146967
+ `${command} could not read ${(0, import_node_path180.join)(dest?.directory ?? ".", classic)} for ${variant2.descriptor.name}.${variant2.descriptor.type} at scale ${variant2.scale}, and has no stand-in for a .${variant2.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
146913
146968
  );
146914
146969
  });
146915
146970
  return {
@@ -147308,9 +147363,11 @@ function cloudCommand(command) {
147308
147363
  return clean2;
147309
147364
  }
147310
147365
  function createCloudBridgeForParsed(parsed2) {
147366
+ const scene = readSceneStreamForParsed(parsed2);
147367
+ const timeoutMs = parsed2.explicitTimeout ? parsed2.commandTimeoutMs : void 0;
147368
+ if (scene) return new SceneBridge(scene.command, timeoutMs);
147311
147369
  const session = resolveCloudSessionForParsed(parsed2);
147312
147370
  if (!session) return null;
147313
- const timeoutMs = parsed2.explicitTimeout ? parsed2.commandTimeoutMs : void 0;
147314
147371
  return session.service === "box" ? new CloudBoxBridge(session, timeoutMs) : new CloudBridge(session, timeoutMs);
147315
147372
  }
147316
147373
  async function closeCloudBox(session) {
@@ -147465,13 +147522,13 @@ async function closeCloudSession(session) {
147465
147522
  throw responseError(response.status, text7);
147466
147523
  }
147467
147524
  }
147468
- var import_node_crypto104, import_node_fs176, import_node_path179, import_node_vm, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, PREVIEW_COMMAND, NanoDevelopmentOnlyError, UnsupportedRemoteHostError, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, REMOTE_HAS_NO_LOCAL_SIMS, CloudBridge, CloudBoxBridge, BoxBootFailedError, BOX_BOOT_WAIT_MS;
147525
+ var import_node_crypto104, import_node_fs177, import_node_path180, import_node_vm, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, PREVIEW_COMMAND, NanoDevelopmentOnlyError, UnsupportedRemoteHostError, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS, REMOTE_HAS_NO_LOCAL_SIMS, CloudBridge, CloudBoxBridge, SceneBridge, BoxBootFailedError, BOX_BOOT_WAIT_MS;
147469
147526
  var init_cloud_client = __esm({
147470
147527
  "cli/cloud-client.ts"() {
147471
147528
  "use strict";
147472
147529
  import_node_crypto104 = require("node:crypto");
147473
- import_node_fs176 = require("node:fs");
147474
- import_node_path179 = require("node:path");
147530
+ import_node_fs177 = require("node:fs");
147531
+ import_node_path180 = require("node:path");
147475
147532
  import_node_vm = require("node:vm");
147476
147533
  init_package_versions();
147477
147534
  init_metroAssetArtifact();
@@ -147490,6 +147547,8 @@ var init_cloud_client = __esm({
147490
147547
  init_command_agent();
147491
147548
  init_detect();
147492
147549
  init_run_registry();
147550
+ init_stream_record();
147551
+ init_usage_error();
147493
147552
  DEFAULT_RNX_CLOUD_ORIGIN = rnxPublicBrand.origin;
147494
147553
  MAX_RNX_CLOUD_BUNDLE_BYTES = RNX_CLOUD_MAX_ARTIFACT_BYTES;
147495
147554
  REMOTE_COMMAND = "peach remote";
@@ -147669,6 +147728,51 @@ var init_cloud_client = __esm({
147669
147728
  close() {
147670
147729
  }
147671
147730
  };
147731
+ SceneBridge = class {
147732
+ constructor(endpoint, explicitTimeoutMs) {
147733
+ this.endpoint = endpoint;
147734
+ this.explicitTimeoutMs = explicitTimeoutMs;
147735
+ }
147736
+ plane = "cloud";
147737
+ async send(command, options2) {
147738
+ const timeoutMs = options2?.timeoutMs ?? this.explicitTimeoutMs ?? options2?.defaultTimeoutMs ?? 15e3;
147739
+ const agent = commandAgent(command);
147740
+ const response = await fetch(`http://127.0.0.1:${this.endpoint.port}/command`, {
147741
+ method: "POST",
147742
+ headers: {
147743
+ authorization: `Bearer ${this.endpoint.token}`,
147744
+ "content-type": "application/json"
147745
+ },
147746
+ body: JSON.stringify(cloudCommand(agent ? { ...command, agent } : command)),
147747
+ ...timeoutMs ? { signal: AbortSignal.timeout(timeoutMs) } : {}
147748
+ });
147749
+ if (!response.ok && response.headers.get("content-type") !== "application/json")
147750
+ throw new CliUsageError(`Scene host returned HTTP ${response.status}.`);
147751
+ const body = await response.json();
147752
+ if (!response.ok)
147753
+ throw new Error(
147754
+ isRecord(body) && typeof body.error === "string" ? body.error : `scene host returned HTTP ${response.status}`
147755
+ );
147756
+ return body;
147757
+ }
147758
+ async listSims() {
147759
+ throw new CliUsageError("Use peach list to see simulators on the local bridge.");
147760
+ }
147761
+ async resolveReloadedSim() {
147762
+ return null;
147763
+ }
147764
+ async focusSim() {
147765
+ throw new Error("a scene host has no browser window to focus");
147766
+ }
147767
+ async closeSim() {
147768
+ throw new Error("stop the scene host to close its simulator");
147769
+ }
147770
+ async claim() {
147771
+ throw new Error("a scene host does not use CLI claims");
147772
+ }
147773
+ close() {
147774
+ }
147775
+ };
147672
147776
  BoxBootFailedError = class extends Error {
147673
147777
  constructor(boxId, detail) {
147674
147778
  super(`box ${boxId} could not boot the app: ${detail}`);
@@ -149986,7 +150090,7 @@ var init_cli_constants = __esm({
149986
150090
  function pausedPids() {
149987
150091
  try {
149988
150092
  const ledger = JSON.parse(
149989
- (0, import_node_fs177.readFileSync)(LEDGER_PATH2, "utf8")
150093
+ (0, import_node_fs178.readFileSync)(LEDGER_PATH2, "utf8")
149990
150094
  );
149991
150095
  return Object.values(ledger).flatMap((procs) => procs.map((proc) => proc.pid));
149992
150096
  } catch {
@@ -150057,16 +150161,16 @@ function setPauseAwareTimeout(fn, budgetMs, hostPid) {
150057
150161
  schedule();
150058
150162
  };
150059
150163
  }
150060
- var import_node_child_process77, import_node_fs177, import_node_os33, import_node_path180, LEDGER_PATH2, TICK_MS2, timers, poll, pollDueAt;
150164
+ var import_node_child_process77, import_node_fs178, import_node_os33, import_node_path181, LEDGER_PATH2, TICK_MS2, timers, poll, pollDueAt;
150061
150165
  var init_pause_aware_timeout = __esm({
150062
150166
  "cli/pause-aware-timeout.ts"() {
150063
150167
  "use strict";
150064
150168
  import_node_child_process77 = require("node:child_process");
150065
- import_node_fs177 = require("node:fs");
150169
+ import_node_fs178 = require("node:fs");
150066
150170
  import_node_os33 = __toESM(require("node:os"), 1);
150067
- import_node_path180 = __toESM(require("node:path"), 1);
150068
- LEDGER_PATH2 = import_node_path180.default.join(
150069
- process.env.TM_HOME || import_node_path180.default.join(import_node_os33.default.homedir(), ".team-machine"),
150171
+ import_node_path181 = __toESM(require("node:path"), 1);
150172
+ LEDGER_PATH2 = import_node_path181.default.join(
150173
+ process.env.TM_HOME || import_node_path181.default.join(import_node_os33.default.homedir(), ".team-machine"),
150070
150174
  "governor-pauses.json"
150071
150175
  );
150072
150176
  TICK_MS2 = 500;
@@ -150115,17 +150219,17 @@ function liveDevBridgeLockfiles() {
150115
150219
  return readDevBridgeLockfiles().filter((lockfile) => isDevBridgeLockfileFresh(lockfile));
150116
150220
  }
150117
150221
  function checkoutRoot(cwd) {
150118
- let current2 = import_node_path181.default.resolve(cwd);
150222
+ let current2 = import_node_path182.default.resolve(cwd);
150119
150223
  while (true) {
150120
- if (import_node_fs178.default.existsSync(import_node_path181.default.join(current2, ".git"))) return current2;
150121
- const parent = import_node_path181.default.dirname(current2);
150224
+ if (import_node_fs179.default.existsSync(import_node_path182.default.join(current2, ".git"))) return current2;
150225
+ const parent = import_node_path182.default.dirname(current2);
150122
150226
  if (parent === current2) return null;
150123
150227
  current2 = parent;
150124
150228
  }
150125
150229
  }
150126
150230
  function pathContains(parent, child) {
150127
- const relative6 = import_node_path181.default.relative(parent, child);
150128
- return relative6 === "" || relative6 !== ".." && !relative6.startsWith(`..${import_node_path181.default.sep}`) && !import_node_path181.default.isAbsolute(relative6);
150231
+ const relative6 = import_node_path182.default.relative(parent, child);
150232
+ return relative6 === "" || relative6 !== ".." && !relative6.startsWith(`..${import_node_path182.default.sep}`) && !import_node_path182.default.isAbsolute(relative6);
150129
150233
  }
150130
150234
  function resolveDefaultDevBridgeLockfile() {
150131
150235
  const lockfiles = liveDevBridgeLockfiles();
@@ -150857,12 +150961,12 @@ async function callInBridge(bridge, path187, ...args) {
150857
150961
  async function callInBridgeWrite(bridge, path187, ...args) {
150858
150962
  return bridge.send({ type: "call", path: path187, args, acquireLock: true }).catch(explainMissingCallTarget);
150859
150963
  }
150860
- var import_node_fs178, import_node_path181, import_ws4, PEACH_PLACEMENT_ENV, resolvedWorld, refusedBridges, BridgeSimLockedError, BridgeHandshakeTimeoutError, noticedTargets, DisconnectedSimError, TIMEOUT_UNIT_MS, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
150964
+ var import_node_fs179, import_node_path182, import_ws4, PEACH_PLACEMENT_ENV, resolvedWorld, refusedBridges, BridgeSimLockedError, BridgeHandshakeTimeoutError, noticedTargets, DisconnectedSimError, TIMEOUT_UNIT_MS, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
150861
150965
  var init_ws_bridge = __esm({
150862
150966
  "cli/ws-bridge.ts"() {
150863
150967
  "use strict";
150864
- import_node_fs178 = __toESM(require("node:fs"), 1);
150865
- import_node_path181 = __toESM(require("node:path"), 1);
150968
+ import_node_fs179 = __toESM(require("node:fs"), 1);
150969
+ import_node_path182 = __toESM(require("node:path"), 1);
150866
150970
  import_ws4 = require("peachsim/vendor/ws");
150867
150971
  init_bridge_constants();
150868
150972
  init_bridge_contract();
@@ -151190,8 +151294,8 @@ var init_app_url = __esm({
151190
151294
 
151191
151295
  // src/dot-env.ts
151192
151296
  function selectEnvFile(env, notices) {
151193
- if (import_node_fs179.default.existsSync("/tmp/envfile")) {
151194
- return { name: import_node_fs179.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
151297
+ if (import_node_fs180.default.existsSync("/tmp/envfile")) {
151298
+ return { name: import_node_fs180.default.readFileSync("/tmp/envfile", "utf8").trim(), fromEnvfile: false };
151195
151299
  }
151196
151300
  const requested = env.ENVFILE;
151197
151301
  if (!requested) return { name: DEFAULT_ENV_FILE, fromEnvfile: false };
@@ -151254,16 +151358,16 @@ function readProjectDotEnv(envsRoot, env = process.env) {
151254
151358
  const notices = [];
151255
151359
  const selection = selectEnvFile(env, notices);
151256
151360
  const requestedPaths = [
151257
- import_node_path182.default.resolve(import_node_path182.default.join(envsRoot, selection.name)),
151258
- import_node_path182.default.resolve(selection.name)
151361
+ import_node_path183.default.resolve(import_node_path183.default.join(envsRoot, selection.name)),
151362
+ import_node_path183.default.resolve(selection.name)
151259
151363
  ];
151260
151364
  const candidates = [
151261
151365
  ...requestedPaths,
151262
- import_node_path182.default.resolve(import_node_path182.default.join(envsRoot, DEFAULT_ENV_FILE))
151366
+ import_node_path183.default.resolve(import_node_path183.default.join(envsRoot, DEFAULT_ENV_FILE))
151263
151367
  ];
151264
- if (!import_node_fs179.default.existsSync(candidates[2])) candidates.push(import_node_path182.default.resolve(DEFAULT_ENV_FILE));
151368
+ if (!import_node_fs180.default.existsSync(candidates[2])) candidates.push(import_node_path183.default.resolve(DEFAULT_ENV_FILE));
151265
151369
  const tried = [...new Set(candidates)];
151266
- const resolved = tried.find((candidate) => import_node_fs179.default.existsSync(candidate));
151370
+ const resolved = tried.find((candidate) => import_node_fs180.default.existsSync(candidate));
151267
151371
  if (!resolved) {
151268
151372
  notices.push(
151269
151373
  "*** Missing .env file ****",
@@ -151283,7 +151387,7 @@ function readProjectDotEnv(envsRoot, env = process.env) {
151283
151387
  );
151284
151388
  }
151285
151389
  const config = {};
151286
- for (const line of import_node_fs179.default.readFileSync(resolved, "utf8").split("\n")) {
151390
+ for (const line of import_node_fs180.default.readFileSync(resolved, "utf8").split("\n")) {
151287
151391
  if (!line.trim()) continue;
151288
151392
  if (/^[ \t\n\v\f\r]*#/.test(line)) continue;
151289
151393
  const match = DOTENV_PATTERN.exec(line);
@@ -151293,12 +151397,12 @@ function readProjectDotEnv(envsRoot, env = process.env) {
151293
151397
  }
151294
151398
  return { config, notices };
151295
151399
  }
151296
- var import_node_fs179, import_node_path182, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
151400
+ var import_node_fs180, import_node_path183, DEFAULT_ENV_FILE, DOTENV_PATTERN, BUILD_SETTING_PATTERN, INVALID_ENTRY;
151297
151401
  var init_dot_env = __esm({
151298
151402
  "src/dot-env.ts"() {
151299
151403
  "use strict";
151300
- import_node_fs179 = __toESM(require("node:fs"), 1);
151301
- import_node_path182 = __toESM(require("node:path"), 1);
151404
+ import_node_fs180 = __toESM(require("node:fs"), 1);
151405
+ import_node_path183 = __toESM(require("node:path"), 1);
151302
151406
  DEFAULT_ENV_FILE = ".env";
151303
151407
  DOTENV_PATTERN = /^(?:export[ \t\n\v\f\r]+|)(?<key>[\p{Alphabetic}\p{Nd}_]+)[ \t\n\v\f\r]*=[ \t\n\v\f\r]*((?<quote>["'])?(?<val>[^\n]*?[^\\\n])\k<quote>?|)$/u;
151304
151408
  BUILD_SETTING_PATTERN = /\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]|\$([A-Za-z_][A-Za-z0-9_]*)/g;
@@ -151447,37 +151551,37 @@ function processAlive2(pid) {
151447
151551
  }
151448
151552
  function activatePeachHome(home) {
151449
151553
  if (activated.has(home)) return;
151450
- const activity = import_node_path183.default.join(home, ACTIVITY);
151451
- import_node_fs180.default.mkdirSync(activity, { recursive: true });
151452
- const lease = import_node_path183.default.join(activity, String(process.pid));
151453
- import_node_fs180.default.writeFileSync(lease, "");
151454
- import_node_fs180.default.writeFileSync(import_node_path183.default.join(activity, "last-opened"), "");
151455
- const guard = import_node_path183.default.join(home, CLEANUP);
151554
+ const activity = import_node_path184.default.join(home, ACTIVITY);
151555
+ import_node_fs181.default.mkdirSync(activity, { recursive: true });
151556
+ const lease = import_node_path184.default.join(activity, String(process.pid));
151557
+ import_node_fs181.default.writeFileSync(lease, "");
151558
+ import_node_fs181.default.writeFileSync(import_node_path184.default.join(activity, "last-opened"), "");
151559
+ const guard = import_node_path184.default.join(home, CLEANUP);
151456
151560
  const deadline = Date.now() + 3e4;
151457
- while (import_node_fs180.default.existsSync(guard)) {
151561
+ while (import_node_fs181.default.existsSync(guard)) {
151458
151562
  let owner;
151459
151563
  try {
151460
- owner = Number(import_node_fs180.default.readFileSync(guard, "utf8"));
151564
+ owner = Number(import_node_fs181.default.readFileSync(guard, "utf8"));
151461
151565
  } catch (error) {
151462
151566
  if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
151463
151567
  throw error;
151464
151568
  }
151465
151569
  if (owner > 0 && !processAlive2(owner)) {
151466
- import_node_fs180.default.rmSync(guard, { force: true });
151570
+ import_node_fs181.default.rmSync(guard, { force: true });
151467
151571
  continue;
151468
151572
  }
151469
151573
  if (Date.now() >= deadline) throw new Error(`Peach home cleanup is busy: ${home}`);
151470
151574
  Atomics.wait(sleepWord, 0, 0, 25);
151471
151575
  }
151472
151576
  activated.add(home);
151473
- process.once("exit", () => import_node_fs180.default.rmSync(lease, { force: true }));
151577
+ process.once("exit", () => import_node_fs181.default.rmSync(lease, { force: true }));
151474
151578
  }
151475
- var import_node_fs180, import_node_path183, ACTIVITY, CLEANUP, activated, sleepWord, PORT_HOME_EXPIRY_MS;
151579
+ var import_node_fs181, import_node_path184, ACTIVITY, CLEANUP, activated, sleepWord, PORT_HOME_EXPIRY_MS;
151476
151580
  var init_home_activity = __esm({
151477
151581
  "src/home-activity.ts"() {
151478
151582
  "use strict";
151479
- import_node_fs180 = __toESM(require("node:fs"), 1);
151480
- import_node_path183 = __toESM(require("node:path"), 1);
151583
+ import_node_fs181 = __toESM(require("node:fs"), 1);
151584
+ import_node_path184 = __toESM(require("node:path"), 1);
151481
151585
  init_is_record();
151482
151586
  ACTIVITY = ".home-activity";
151483
151587
  CLEANUP = ".home-cleanup";
@@ -151718,10 +151822,10 @@ var init_binarySidecarContract = __esm({
151718
151822
 
151719
151823
  // cli/binary-sidecar.ts
151720
151824
  function isAppBinaryPath(target) {
151721
- return /\.(ipa|apk)$/i.test(target) && import_node_fs181.default.statSync(target, { throwIfNoEntry: false })?.isFile() === true;
151825
+ return /\.(ipa|apk)$/i.test(target) && import_node_fs182.default.statSync(target, { throwIfNoEntry: false })?.isFile() === true;
151722
151826
  }
151723
151827
  function extractAppBinaryBundle(binary2) {
151724
- const file = import_node_path184.default.resolve(binary2);
151828
+ const file = import_node_path185.default.resolve(binary2);
151725
151829
  const entries2 = (0, import_node_child_process78.execFileSync)("unzip", ["-Z1", file], {
151726
151830
  encoding: "utf8",
151727
151831
  maxBuffer: 256 * 1024 * 1024
@@ -151735,54 +151839,54 @@ function extractAppBinaryBundle(binary2) {
151735
151839
  throw new Error(
151736
151840
  `${binary2} carries no peach sidecar; only apps built by Contrast include the plain javascript peach runs`
151737
151841
  );
151738
- const sidecar = import_node_path184.default.posix.dirname(manifestEntry);
151739
- const appRoot = import_node_path184.default.posix.dirname(sidecar);
151740
- const digest3 = (0, import_node_crypto106.createHash)("sha256").update(import_node_fs181.default.readFileSync(file)).digest("hex");
151741
- const out = import_node_path184.default.join(cacheDir(), "app-binaries", digest3);
151742
- const bundlePath = import_node_path184.default.join(out, "main.js");
151743
- const extracted = import_node_path184.default.join(out, "extracted");
151744
- if (!import_node_fs181.default.existsSync(bundlePath)) {
151745
- import_node_fs181.default.rmSync(out, { recursive: true, force: true });
151746
- import_node_fs181.default.mkdirSync(extracted, { recursive: true });
151842
+ const sidecar = import_node_path185.default.posix.dirname(manifestEntry);
151843
+ const appRoot = import_node_path185.default.posix.dirname(sidecar);
151844
+ const digest3 = (0, import_node_crypto106.createHash)("sha256").update(import_node_fs182.default.readFileSync(file)).digest("hex");
151845
+ const out = import_node_path185.default.join(cacheDir(), "app-binaries", digest3);
151846
+ const bundlePath = import_node_path185.default.join(out, "main.js");
151847
+ const extracted = import_node_path185.default.join(out, "extracted");
151848
+ if (!import_node_fs182.default.existsSync(bundlePath)) {
151849
+ import_node_fs182.default.rmSync(out, { recursive: true, force: true });
151850
+ import_node_fs182.default.mkdirSync(extracted, { recursive: true });
151747
151851
  const patterns = [`${sidecar}/*`];
151748
151852
  const iosAssets = `${appRoot}/assets/`;
151749
151853
  if (appRoot.startsWith("Payload/") && entries2.some((entry) => entry.startsWith(iosAssets)))
151750
151854
  patterns.push(`${iosAssets}*`);
151751
151855
  (0, import_node_child_process78.execFileSync)("unzip", ["-q", "-o", file, ...patterns, "-d", extracted]);
151752
151856
  const manifest = readPeachSidecarManifest(
151753
- JSON.parse(import_node_fs181.default.readFileSync(import_node_path184.default.join(extracted, manifestEntry), "utf8"))
151857
+ JSON.parse(import_node_fs182.default.readFileSync(import_node_path185.default.join(extracted, manifestEntry), "utf8"))
151754
151858
  );
151755
151859
  const bundle = (0, import_node_zlib10.brotliDecompressSync)(
151756
- import_node_fs181.default.readFileSync(import_node_path184.default.join(extracted, sidecar, PEACH_SIDECAR_BUNDLE))
151860
+ import_node_fs182.default.readFileSync(import_node_path185.default.join(extracted, sidecar, PEACH_SIDECAR_BUNDLE))
151757
151861
  );
151758
151862
  if ((0, import_node_crypto106.createHash)("sha256").update(bundle).digest("hex") !== manifest.bundleSha256)
151759
151863
  throw new Error(`${binary2}: the peach sidecar bundle does not match its manifest`);
151760
- const assets2 = manifest.platform === "ios" ? import_node_path184.default.join(extracted, appRoot, "assets") : import_node_path184.default.join(extracted, sidecar, PEACH_SIDECAR_ASSETS);
151761
- if (import_node_fs181.default.existsSync(assets2)) import_node_fs181.default.renameSync(assets2, import_node_path184.default.join(out, "assets"));
151762
- import_node_fs181.default.copyFileSync(
151763
- import_node_path184.default.join(extracted, manifestEntry),
151764
- import_node_path184.default.join(out, PEACH_SIDECAR_MANIFEST)
151864
+ const assets2 = manifest.platform === "ios" ? import_node_path185.default.join(extracted, appRoot, "assets") : import_node_path185.default.join(extracted, sidecar, PEACH_SIDECAR_ASSETS);
151865
+ if (import_node_fs182.default.existsSync(assets2)) import_node_fs182.default.renameSync(assets2, import_node_path185.default.join(out, "assets"));
151866
+ import_node_fs182.default.copyFileSync(
151867
+ import_node_path185.default.join(extracted, manifestEntry),
151868
+ import_node_path185.default.join(out, PEACH_SIDECAR_MANIFEST)
151765
151869
  );
151766
- import_node_fs181.default.writeFileSync(
151870
+ import_node_fs182.default.writeFileSync(
151767
151871
  `${bundlePath}.partial`,
151768
151872
  insertPackageVersionsFooter(bundle.toString("utf8"), manifest.nativePackages)
151769
151873
  );
151770
- import_node_fs181.default.renameSync(`${bundlePath}.partial`, bundlePath);
151771
- import_node_fs181.default.rmSync(extracted, { recursive: true, force: true });
151874
+ import_node_fs182.default.renameSync(`${bundlePath}.partial`, bundlePath);
151875
+ import_node_fs182.default.rmSync(extracted, { recursive: true, force: true });
151772
151876
  }
151773
151877
  const { platform: platform3 } = readPeachSidecarManifest(
151774
- JSON.parse(import_node_fs181.default.readFileSync(import_node_path184.default.join(out, PEACH_SIDECAR_MANIFEST), "utf8"))
151878
+ JSON.parse(import_node_fs182.default.readFileSync(import_node_path185.default.join(out, PEACH_SIDECAR_MANIFEST), "utf8"))
151775
151879
  );
151776
151880
  return { bundlePath, platform: platform3 };
151777
151881
  }
151778
- var import_node_child_process78, import_node_crypto106, import_node_fs181, import_node_path184, import_node_zlib10;
151882
+ var import_node_child_process78, import_node_crypto106, import_node_fs182, import_node_path185, import_node_zlib10;
151779
151883
  var init_binary_sidecar = __esm({
151780
151884
  "cli/binary-sidecar.ts"() {
151781
151885
  "use strict";
151782
151886
  import_node_child_process78 = require("node:child_process");
151783
151887
  import_node_crypto106 = require("node:crypto");
151784
- import_node_fs181 = __toESM(require("node:fs"), 1);
151785
- import_node_path184 = __toESM(require("node:path"), 1);
151888
+ import_node_fs182 = __toESM(require("node:fs"), 1);
151889
+ import_node_path185 = __toESM(require("node:path"), 1);
151786
151890
  import_node_zlib10 = require("node:zlib");
151787
151891
  init_package_versions();
151788
151892
  init_binarySidecarContract();
@@ -154086,12 +154190,12 @@ function trackCliDiagnostic(diagnostic) {
154086
154190
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
154087
154191
  });
154088
154192
  }
154089
- var import_node_crypto109, import_node_fs182, import_node_os34, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
154193
+ var import_node_crypto109, import_node_fs183, import_node_os34, observedRuntimeVersion, queue, CRASH_REPORT_EVERY_MS;
154090
154194
  var init_telemetry = __esm({
154091
154195
  "cli/telemetry.ts"() {
154092
154196
  "use strict";
154093
154197
  import_node_crypto109 = require("node:crypto");
154094
- import_node_fs182 = require("node:fs");
154198
+ import_node_fs183 = require("node:fs");
154095
154199
  import_node_os34 = require("node:os");
154096
154200
  init_event_identity();
154097
154201
  init_cli_version();
@@ -158914,11 +159018,11 @@ async function confirm(message, defaultYes = true) {
158914
159018
  if (answer2 === "") return defaultYes;
158915
159019
  return answer2.toLowerCase().startsWith("y");
158916
159020
  }
158917
- var import_node_fs183, import_readline, rl;
159021
+ var import_node_fs184, import_readline, rl;
158918
159022
  var init_prompt = __esm({
158919
159023
  "cli/prompt.ts"() {
158920
159024
  "use strict";
158921
- import_node_fs183 = require("node:fs");
159025
+ import_node_fs184 = require("node:fs");
158922
159026
  import_readline = require("readline");
158923
159027
  init_ui();
158924
159028
  rl = () => (0, import_readline.createInterface)({
@@ -159722,29 +159826,29 @@ function launcherActivities(application) {
159722
159826
  function readModuleNamespace(moduleRoot, manifest) {
159723
159827
  if (manifest.attributes.package) return manifest.attributes.package;
159724
159828
  for (const name3 of ["build.gradle", "build.gradle.kts"]) {
159725
- const file = import_node_path185.default.join(moduleRoot, name3);
159726
- if (!import_node_fs184.default.existsSync(file)) continue;
159829
+ const file = import_node_path186.default.join(moduleRoot, name3);
159830
+ if (!import_node_fs185.default.existsSync(file)) continue;
159727
159831
  const match = /\bnamespace\s*=?\s*["']([\w.]+)["']/.exec(
159728
- import_node_fs184.default.readFileSync(file, "utf8")
159832
+ import_node_fs185.default.readFileSync(file, "utf8")
159729
159833
  );
159730
159834
  if (match) return match[1];
159731
159835
  }
159732
159836
  return void 0;
159733
159837
  }
159734
159838
  function readModuleRootModuleName(moduleRoot) {
159735
- const sourceSets = import_node_path185.default.join(moduleRoot, "src");
159736
- const manifestFile = import_node_path185.default.join(sourceSets, "main/AndroidManifest.xml");
159737
- if (!import_node_fs184.default.existsSync(manifestFile)) return null;
159738
- const document = parseXml(import_node_fs184.default.readFileSync(manifestFile, "utf8"), manifestFile);
159839
+ const sourceSets = import_node_path186.default.join(moduleRoot, "src");
159840
+ const manifestFile = import_node_path186.default.join(sourceSets, "main/AndroidManifest.xml");
159841
+ if (!import_node_fs185.default.existsSync(manifestFile)) return null;
159842
+ const document = parseXml(import_node_fs185.default.readFileSync(manifestFile, "utf8"), manifestFile);
159739
159843
  const manifest = document.children[0];
159740
159844
  const application = manifest?.children.find((child) => child.name === "application");
159741
159845
  if (manifest?.name !== "manifest" || !application) return null;
159742
159846
  const launchers = launcherActivities(application);
159743
159847
  if (launchers.length === 0) return null;
159744
- for (const set2 of import_node_fs184.default.readdirSync(sourceSets, { withFileTypes: true })) {
159745
- const file = import_node_path185.default.join(sourceSets, set2.name, "AndroidManifest.xml");
159746
- if (!set2.isDirectory() || set2.name === "main" || !import_node_fs184.default.existsSync(file)) continue;
159747
- if (import_node_fs184.default.readFileSync(file, "utf8").includes("<activity")) return void 0;
159848
+ for (const set2 of import_node_fs185.default.readdirSync(sourceSets, { withFileTypes: true })) {
159849
+ const file = import_node_path186.default.join(sourceSets, set2.name, "AndroidManifest.xml");
159850
+ if (!set2.isDirectory() || set2.name === "main" || !import_node_fs185.default.existsSync(file)) continue;
159851
+ if (import_node_fs185.default.readFileSync(file, "utf8").includes("<activity")) return void 0;
159748
159852
  }
159749
159853
  const launcher2 = launchers[0];
159750
159854
  const enabled2 = launcher2.attributes["android:enabled"];
@@ -159756,31 +159860,31 @@ function readModuleRootModuleName(moduleRoot) {
159756
159860
  const qualified3 = declared.startsWith(".") ? namespace && `${namespace}${declared}` : declared.includes(".") ? declared : namespace && `${namespace}.${declared}`;
159757
159861
  if (!qualified3 || qualified3.includes("$")) return void 0;
159758
159862
  const relative6 = qualified3.split(".").join("/");
159759
- const files2 = import_node_fs184.default.readdirSync(sourceSets, { withFileTypes: true }).filter((set2) => set2.isDirectory()).flatMap(
159863
+ const files2 = import_node_fs185.default.readdirSync(sourceSets, { withFileTypes: true }).filter((set2) => set2.isDirectory()).flatMap(
159760
159864
  (set2) => ["java", "kotlin"].flatMap(
159761
159865
  (language) => ["kt", "java"].map(
159762
- (extension) => import_node_path185.default.join(sourceSets, set2.name, language, `${relative6}.${extension}`)
159866
+ (extension) => import_node_path186.default.join(sourceSets, set2.name, language, `${relative6}.${extension}`)
159763
159867
  )
159764
159868
  )
159765
- ).filter((file) => import_node_fs184.default.existsSync(file));
159869
+ ).filter((file) => import_node_fs185.default.existsSync(file));
159766
159870
  if (files2.length !== 1) return void 0;
159767
159871
  return readAndroidRootModuleFromActivitySource(
159768
- import_node_fs184.default.readFileSync(files2[0], "utf8"),
159872
+ import_node_fs185.default.readFileSync(files2[0], "utf8"),
159769
159873
  qualified3.slice(qualified3.lastIndexOf(".") + 1)
159770
159874
  );
159771
159875
  }
159772
159876
  function readAndroidLauncherRootModuleName(projectRoot) {
159773
- const androidRoot = import_node_path185.default.join(projectRoot, "android");
159774
- if (!import_node_fs184.default.existsSync(androidRoot)) return void 0;
159775
- const names = import_node_fs184.default.readdirSync(androidRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => readModuleRootModuleName(import_node_path185.default.join(androidRoot, entry.name))).filter((name3) => name3 !== null);
159877
+ const androidRoot = import_node_path186.default.join(projectRoot, "android");
159878
+ if (!import_node_fs185.default.existsSync(androidRoot)) return void 0;
159879
+ const names = import_node_fs185.default.readdirSync(androidRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => readModuleRootModuleName(import_node_path186.default.join(androidRoot, entry.name))).filter((name3) => name3 !== null);
159776
159880
  return names.length === 1 ? names[0] : void 0;
159777
159881
  }
159778
- var import_node_fs184, import_node_path185, STRINGS_AND_COMMENTS, DECLARATION, KOTLIN_LITERAL, JAVA_LITERAL;
159882
+ var import_node_fs185, import_node_path186, STRINGS_AND_COMMENTS, DECLARATION, KOTLIN_LITERAL, JAVA_LITERAL;
159779
159883
  var init_android_root_module = __esm({
159780
159884
  "src/android-root-module.ts"() {
159781
159885
  "use strict";
159782
- import_node_fs184 = __toESM(require("node:fs"), 1);
159783
- import_node_path185 = __toESM(require("node:path"), 1);
159886
+ import_node_fs185 = __toESM(require("node:fs"), 1);
159887
+ import_node_path186 = __toESM(require("node:path"), 1);
159784
159888
  init_android_xml();
159785
159889
  STRINGS_AND_COMMENTS = /"(?:\\.|[^"\\])*"|\/\/[^\n]*|\/\*[\s\S]*?\*\//g;
159786
159890
  DECLARATION = /\b(?:fun|String)\s+getMainComponentName\s*\(/g;
@@ -159803,27 +159907,27 @@ var init_appBundleResourcesContract = __esm({
159803
159907
  function stageAppBundleResources(appDir, origin, iosTarget, environment) {
159804
159908
  const app = readIosAppTarget(appDir, iosTarget, environment);
159805
159909
  if (!app) return {};
159806
- let root = import_node_fs185.default.realpathSync(findWorkspaceRoot(appDir));
159910
+ let root = import_node_fs186.default.realpathSync(findWorkspaceRoot(appDir));
159807
159911
  for (; ; ) {
159808
159912
  const escaped = app.resources.some((file) => {
159809
- const relative6 = import_node_path186.default.relative(root, import_node_fs185.default.realpathSync(file));
159810
- return relative6.startsWith(`..${import_node_path186.default.sep}`) || import_node_path186.default.isAbsolute(relative6);
159913
+ const relative6 = import_node_path187.default.relative(root, import_node_fs186.default.realpathSync(file));
159914
+ return relative6.startsWith(`..${import_node_path187.default.sep}`) || import_node_path187.default.isAbsolute(relative6);
159811
159915
  });
159812
159916
  if (!escaped) break;
159813
- const wider = import_node_fs185.default.realpathSync(findWorkspaceRoot(import_node_path186.default.dirname(root)));
159917
+ const wider = import_node_fs186.default.realpathSync(findWorkspaceRoot(import_node_path187.default.dirname(root)));
159814
159918
  if (wider === root) break;
159815
159919
  root = wider;
159816
159920
  }
159817
159921
  const members2 = /* @__PURE__ */ new Map();
159818
159922
  for (const file of app.resources) {
159819
- const real = import_node_fs185.default.realpathSync(file);
159820
- const relative6 = import_node_path186.default.relative(root, real);
159821
- if (relative6.startsWith(`..${import_node_path186.default.sep}`) || import_node_path186.default.isAbsolute(relative6))
159923
+ const real = import_node_fs186.default.realpathSync(file);
159924
+ const relative6 = import_node_path187.default.relative(root, real);
159925
+ if (relative6.startsWith(`..${import_node_path187.default.sep}`) || import_node_path187.default.isAbsolute(relative6))
159822
159926
  throw new Error("native app resource escapes the Xcode input root");
159823
- const lexical = import_node_path186.default.relative(root, file);
159824
- if (lexical === ".." || lexical.startsWith(`..${import_node_path186.default.sep}`) || import_node_path186.default.isAbsolute(lexical))
159927
+ const lexical = import_node_path187.default.relative(root, file);
159928
+ if (lexical === ".." || lexical.startsWith(`..${import_node_path187.default.sep}`) || import_node_path187.default.isAbsolute(lexical))
159825
159929
  throw new Error("native app resource escapes the selected project");
159826
- const name3 = `Resources/${lexical.split(import_node_path186.default.sep).join("/")}`;
159930
+ const name3 = `Resources/${lexical.split(import_node_path187.default.sep).join("/")}`;
159827
159931
  members2.set(name3, file);
159828
159932
  }
159829
159933
  const resources = enumerateBundleResources([...members2.keys()]);
@@ -159846,13 +159950,13 @@ function stageAppBundleResources(appDir, origin, iosTarget, environment) {
159846
159950
  });
159847
159951
  return result;
159848
159952
  }
159849
- var import_node_crypto110, import_node_fs185, import_node_path186;
159953
+ var import_node_crypto110, import_node_fs186, import_node_path187;
159850
159954
  var init_app_bundle_resources = __esm({
159851
159955
  "cli/app-bundle-resources.ts"() {
159852
159956
  "use strict";
159853
159957
  import_node_crypto110 = require("node:crypto");
159854
- import_node_fs185 = __toESM(require("node:fs"), 1);
159855
- import_node_path186 = __toESM(require("node:path"), 1);
159958
+ import_node_fs186 = __toESM(require("node:fs"), 1);
159959
+ import_node_path187 = __toESM(require("node:path"), 1);
159856
159960
  init_uttype_mime();
159857
159961
  init_bundleAssets();
159858
159962
  init_appBundleResourcesContract();
@@ -159954,45 +160058,45 @@ var init_material_symbol_fonts = __esm({
159954
160058
 
159955
160059
  // cli/material-symbol-fonts.ts
159956
160060
  function materialSymbolFontPaths(appDir) {
159957
- const appRequire = (0, import_node_module28.createRequire)(import_node_path187.default.join(appDir, "package.json"));
160061
+ const appRequire = (0, import_node_module28.createRequire)(import_node_path188.default.join(appDir, "package.json"));
159958
160062
  let nativeManifest;
159959
160063
  try {
159960
160064
  nativeManifest = appRequire.resolve("@react-navigation/native/package.json");
159961
160065
  } catch {
159962
160066
  return [];
159963
160067
  }
159964
- const nativePackage = JSON.parse(import_node_fs186.default.readFileSync(nativeManifest, "utf8"));
160068
+ const nativePackage = JSON.parse(import_node_fs187.default.readFileSync(nativeManifest, "utf8"));
159965
160069
  const dependencies = nativePackage && typeof nativePackage === "object" ? Reflect.get(nativePackage, "dependencies") : null;
159966
160070
  if (!dependencies || typeof dependencies !== "object" || !Reflect.has(dependencies, "@react-navigation/material-symbols"))
159967
160071
  return [];
159968
160072
  const nativeRequire = (0, import_node_module28.createRequire)(nativeManifest);
159969
- const symbolsDir = import_node_path187.default.dirname(
160073
+ const symbolsDir = import_node_path188.default.dirname(
159970
160074
  nativeRequire.resolve("@react-navigation/material-symbols/package.json")
159971
160075
  );
159972
- const fontsDir = import_node_path187.default.join(symbolsDir, "assets/fonts");
159973
- const available2 = import_node_fs186.default.existsSync(fontsDir) ? import_node_fs186.default.readdirSync(fontsDir).filter((name3) => name3.startsWith("MaterialSymbols") && name3.endsWith(".ttf")) : [];
160076
+ const fontsDir = import_node_path188.default.join(symbolsDir, "assets/fonts");
160077
+ const available2 = import_node_fs187.default.existsSync(fontsDir) ? import_node_fs187.default.readdirSync(fontsDir).filter((name3) => name3.startsWith("MaterialSymbols") && name3.endsWith(".ttf")) : [];
159974
160078
  const manifest = JSON.parse(
159975
- import_node_fs186.default.readFileSync(import_node_path187.default.join(appDir, "package.json"), "utf8")
160079
+ import_node_fs187.default.readFileSync(import_node_path188.default.join(appDir, "package.json"), "utf8")
159976
160080
  );
159977
160081
  return materialSymbolFontNames(manifest, available2, symbolsDir).map(
159978
- (name3) => import_node_path187.default.join(fontsDir, name3)
160082
+ (name3) => import_node_path188.default.join(fontsDir, name3)
159979
160083
  );
159980
160084
  }
159981
160085
  function materialSymbolFontAssets(fontPaths) {
159982
160086
  const selected = fontPaths.filter(
159983
160087
  (fontPath) => /^MaterialSymbols(?:Outlined|Rounded|Sharp)_\d+(?:_Filled)?\.ttf$/.test(
159984
- import_node_path187.default.basename(fontPath)
160088
+ import_node_path188.default.basename(fontPath)
159985
160089
  )
159986
160090
  );
159987
160091
  if (!selected.length) return void 0;
159988
- const directory2 = import_node_path187.default.dirname(selected[0]);
159989
- const codepointsFile = import_node_path187.default.join(directory2, "MaterialSymbols.codepoints");
159990
- const mirroredFile = import_node_path187.default.join(directory2, "MaterialSymbols.mirrored");
160092
+ const directory2 = import_node_path188.default.dirname(selected[0]);
160093
+ const codepointsFile = import_node_path188.default.join(directory2, "MaterialSymbols.codepoints");
160094
+ const mirroredFile = import_node_path188.default.join(directory2, "MaterialSymbols.mirrored");
159991
160095
  const digest3 = (0, import_node_crypto111.createHash)("md5");
159992
160096
  for (const asset of [...selected, codepointsFile, mirroredFile].sort(
159993
- (a, b) => import_node_path187.default.basename(a) < import_node_path187.default.basename(b) ? -1 : import_node_path187.default.basename(a) > import_node_path187.default.basename(b) ? 1 : 0
160097
+ (a, b) => import_node_path188.default.basename(a) < import_node_path188.default.basename(b) ? -1 : import_node_path188.default.basename(a) > import_node_path188.default.basename(b) ? 1 : 0
159994
160098
  )) {
159995
- digest3.update(import_node_fs186.default.readFileSync(asset));
160099
+ digest3.update(import_node_fs187.default.readFileSync(asset));
159996
160100
  }
159997
160101
  return {
159998
160102
  hash: digest3.digest("hex").slice(0, 8),
@@ -160000,14 +160104,14 @@ function materialSymbolFontAssets(fontPaths) {
160000
160104
  mirroredPath: mirroredFile
160001
160105
  };
160002
160106
  }
160003
- var import_node_crypto111, import_node_fs186, import_node_module28, import_node_path187;
160107
+ var import_node_crypto111, import_node_fs187, import_node_module28, import_node_path188;
160004
160108
  var init_material_symbol_fonts2 = __esm({
160005
160109
  "cli/material-symbol-fonts.ts"() {
160006
160110
  "use strict";
160007
160111
  import_node_crypto111 = require("node:crypto");
160008
- import_node_fs186 = __toESM(require("node:fs"), 1);
160112
+ import_node_fs187 = __toESM(require("node:fs"), 1);
160009
160113
  import_node_module28 = require("node:module");
160010
- import_node_path187 = __toESM(require("node:path"), 1);
160114
+ import_node_path188 = __toESM(require("node:path"), 1);
160011
160115
  init_material_symbol_fonts();
160012
160116
  }
160013
160117
  });
@@ -160015,11 +160119,11 @@ var init_material_symbol_fonts2 = __esm({
160015
160119
  // cli/app-fonts.ts
160016
160120
  function discoverNativeLinkedAppFonts(opts) {
160017
160121
  const { paths, materialSymbols } = discoverNativeLinkedAppFontAssets(opts);
160018
- const realProjectRoot = import_node_fs187.default.realpathSync(opts.projectDir);
160122
+ const realProjectRoot = import_node_fs188.default.realpathSync(opts.projectDir);
160019
160123
  const specs = getCliRuntime().engine_config_plugin_fonts.nativeLinkedFontSpecsFromPaths(
160020
160124
  projectRelativeFontPaths(opts.projectDir, paths),
160021
160125
  nativeFontPlatform(opts.platform),
160022
- (fontPath) => stageHostFile(import_node_path188.default.resolve(realProjectRoot, fontPath), opts.nativeAssetOrigin)
160126
+ (fontPath) => stageHostFile(import_node_path189.default.resolve(realProjectRoot, fontPath), opts.nativeAssetOrigin)
160023
160127
  );
160024
160128
  attachMaterialSymbolMetadata(
160025
160129
  specs,
@@ -160043,28 +160147,28 @@ function attachMaterialSymbolMetadata(specs, files2, assetUrl) {
160043
160147
  };
160044
160148
  }
160045
160149
  function projectRelativeFontPaths(projectDir, fontPaths) {
160046
- const projectRoot = import_node_path188.default.resolve(projectDir);
160047
- const realProjectRoot = import_node_fs187.default.realpathSync(projectDir);
160150
+ const projectRoot = import_node_path189.default.resolve(projectDir);
160151
+ const realProjectRoot = import_node_fs188.default.realpathSync(projectDir);
160048
160152
  return fontPaths.map((fontPath) => {
160049
- const lexical = import_node_path188.default.relative(projectRoot, fontPath);
160050
- const relative6 = lexical.startsWith("..") || import_node_path188.default.isAbsolute(lexical) ? import_node_path188.default.relative(realProjectRoot, import_node_fs187.default.realpathSync(fontPath)) : lexical;
160051
- return relative6.split(import_node_path188.default.sep).join("/");
160153
+ const lexical = import_node_path189.default.relative(projectRoot, fontPath);
160154
+ const relative6 = lexical.startsWith("..") || import_node_path189.default.isAbsolute(lexical) ? import_node_path189.default.relative(realProjectRoot, import_node_fs188.default.realpathSync(fontPath)) : lexical;
160155
+ return relative6.split(import_node_path189.default.sep).join("/");
160052
160156
  });
160053
160157
  }
160054
160158
  function resolveDeclaredFontPath(appDir, declared) {
160055
- let resolved = import_node_path188.default.resolve(appDir, declared);
160056
- if (!import_node_fs187.default.existsSync(resolved)) {
160159
+ let resolved = import_node_path189.default.resolve(appDir, declared);
160160
+ if (!import_node_fs188.default.existsSync(resolved)) {
160057
160161
  try {
160058
- resolved = (0, import_node_module29.createRequire)(import_node_path188.default.join(appDir, "package.json")).resolve(declared);
160162
+ resolved = (0, import_node_module29.createRequire)(import_node_path189.default.join(appDir, "package.json")).resolve(declared);
160059
160163
  } catch {
160060
160164
  return [];
160061
160165
  }
160062
160166
  }
160063
- return import_node_fs187.default.statSync(resolved).isDirectory() ? import_node_fs187.default.readdirSync(resolved).map((file) => import_node_path188.default.join(resolved, file)) : [resolved];
160167
+ return import_node_fs188.default.statSync(resolved).isDirectory() ? import_node_fs188.default.readdirSync(resolved).map((file) => import_node_path189.default.join(resolved, file)) : [resolved];
160064
160168
  }
160065
160169
  function isFile(filePath) {
160066
160170
  try {
160067
- return import_node_fs187.default.statSync(filePath).isFile();
160171
+ return import_node_fs188.default.statSync(filePath).isFile();
160068
160172
  } catch {
160069
160173
  return false;
160070
160174
  }
@@ -160110,13 +160214,13 @@ function discoverNativeLinkedAppFontAssets(opts) {
160110
160214
  scannedFontDirectories++;
160111
160215
  let entries2;
160112
160216
  try {
160113
- entries2 = import_node_fs187.default.readdirSync(current2.dir, { withFileTypes: true });
160217
+ entries2 = import_node_fs188.default.readdirSync(current2.dir, { withFileTypes: true });
160114
160218
  } catch {
160115
160219
  continue;
160116
160220
  }
160117
160221
  for (const entry of entries2) {
160118
160222
  if (entry.isSymbolicLink()) continue;
160119
- const fullPath = import_node_path188.default.join(current2.dir, entry.name);
160223
+ const fullPath = import_node_path189.default.join(current2.dir, entry.name);
160120
160224
  if (entry.isDirectory()) {
160121
160225
  if (current2.depth < 4 && pending2.length < 64 && !entry.name.startsWith(".")) {
160122
160226
  pending2.push({ dir: fullPath, depth: current2.depth + 1 });
@@ -160131,7 +160235,7 @@ function discoverNativeLinkedAppFontAssets(opts) {
160131
160235
  };
160132
160236
  try {
160133
160237
  const packageJson = JSON.parse(
160134
- import_node_fs187.default.readFileSync(import_node_path188.default.join(selectedAppDir, "package.json"), "utf8")
160238
+ import_node_fs188.default.readFileSync(import_node_path189.default.join(selectedAppDir, "package.json"), "utf8")
160135
160239
  );
160136
160240
  const dependencyNames = /* @__PURE__ */ new Set();
160137
160241
  for (const field2 of ["dependencies", "devDependencies", "optionalDependencies"]) {
@@ -160146,22 +160250,22 @@ function discoverNativeLinkedAppFontAssets(opts) {
160146
160250
  const config = Reflect.get(packageJson, "reactNativeVectorIcons");
160147
160251
  const configuredFontDir = config && typeof config === "object" ? Reflect.get(config, "fontDir") : null;
160148
160252
  const configuredDir = typeof configuredFontDir === "string" ? configuredFontDir : "rnvi-fonts";
160149
- const root = import_node_path188.default.resolve(selectedAppDir, configuredDir);
160150
- const relativeRoot = import_node_path188.default.relative(selectedAppDir, root);
160151
- if (!relativeRoot.startsWith("..") && !import_node_path188.default.isAbsolute(relativeRoot)) {
160253
+ const root = import_node_path189.default.resolve(selectedAppDir, configuredDir);
160254
+ const relativeRoot = import_node_path189.default.relative(selectedAppDir, root);
160255
+ if (!relativeRoot.startsWith("..") && !import_node_path189.default.isAbsolute(relativeRoot)) {
160152
160256
  collectFontFiles(root);
160153
160257
  }
160154
- const vectorIconRequire = (0, import_node_module29.createRequire)(import_node_path188.default.join(selectedAppDir, "package.json"));
160258
+ const vectorIconRequire = (0, import_node_module29.createRequire)(import_node_path189.default.join(selectedAppDir, "package.json"));
160155
160259
  for (const dependencyName of vectorIconDependencies) {
160156
160260
  try {
160157
160261
  const entryPath = vectorIconRequire.resolve(dependencyName);
160158
- const dependencyPath = dependencyName.split("/").join(import_node_path188.default.sep);
160159
- const marker = `${import_node_path188.default.sep}node_modules${import_node_path188.default.sep}${dependencyPath}${import_node_path188.default.sep}`;
160262
+ const dependencyPath = dependencyName.split("/").join(import_node_path189.default.sep);
160263
+ const marker = `${import_node_path189.default.sep}node_modules${import_node_path189.default.sep}${dependencyPath}${import_node_path189.default.sep}`;
160160
160264
  const markerIndex = entryPath.lastIndexOf(marker);
160161
160265
  if (markerIndex === -1) continue;
160162
160266
  const packageRoot2 = entryPath.slice(0, markerIndex + marker.length - 1);
160163
160267
  const fontsDir = dependencyName === "react-native-vector-icons" ? "Fonts" : "fonts";
160164
- collectFontFiles(import_node_path188.default.join(packageRoot2, fontsDir));
160268
+ collectFontFiles(import_node_path189.default.join(packageRoot2, fontsDir));
160165
160269
  } catch {
160166
160270
  }
160167
160271
  }
@@ -160169,17 +160273,17 @@ function discoverNativeLinkedAppFontAssets(opts) {
160169
160273
  } catch {
160170
160274
  }
160171
160275
  try {
160172
- const configPath = import_node_path188.default.join(selectedAppDir, "react-native.config.js");
160173
- if (import_node_fs187.default.statSync(configPath).isFile()) {
160174
- const appConfigRequire = (0, import_node_module29.createRequire)(import_node_path188.default.join(selectedAppDir, "package.json"));
160276
+ const configPath = import_node_path189.default.join(selectedAppDir, "react-native.config.js");
160277
+ if (import_node_fs188.default.statSync(configPath).isFile()) {
160278
+ const appConfigRequire = (0, import_node_module29.createRequire)(import_node_path189.default.join(selectedAppDir, "package.json"));
160175
160279
  const rnConfig = appConfigRequire(configPath);
160176
160280
  const assets2 = rnConfig && typeof rnConfig === "object" ? Reflect.get(rnConfig, "assets") : null;
160177
160281
  if (Array.isArray(assets2)) {
160178
160282
  for (const assetDir of assets2) {
160179
160283
  if (typeof assetDir !== "string") continue;
160180
- const root = import_node_path188.default.resolve(selectedAppDir, assetDir);
160181
- const relativeRoot = import_node_path188.default.relative(selectedAppDir, root);
160182
- if (relativeRoot.startsWith("..") || import_node_path188.default.isAbsolute(relativeRoot)) continue;
160284
+ const root = import_node_path189.default.resolve(selectedAppDir, assetDir);
160285
+ const relativeRoot = import_node_path189.default.relative(selectedAppDir, root);
160286
+ if (relativeRoot.startsWith("..") || import_node_path189.default.isAbsolute(relativeRoot)) continue;
160183
160287
  collectFontFiles(root);
160184
160288
  }
160185
160289
  }
@@ -160187,33 +160291,33 @@ function discoverNativeLinkedAppFontAssets(opts) {
160187
160291
  } catch {
160188
160292
  }
160189
160293
  if (platform3 === "ios") {
160190
- const iosDir = import_node_path188.default.join(selectedAppDir, "ios");
160294
+ const iosDir = import_node_path189.default.join(selectedAppDir, "ios");
160191
160295
  try {
160192
- const targetDirs = import_node_fs187.default.readdirSync(iosDir, { withFileTypes: true }).filter(
160296
+ const targetDirs = import_node_fs188.default.readdirSync(iosDir, { withFileTypes: true }).filter(
160193
160297
  (entry) => entry.isDirectory() && !entry.isSymbolicLink() && entry.name !== "Pods" && entry.name !== "build" && !entry.name.startsWith(".")
160194
160298
  ).slice(0, 64);
160195
160299
  const bundledByName = /* @__PURE__ */ new Map();
160196
- for (const entry of import_node_fs187.default.readdirSync(iosDir, { withFileTypes: true })) {
160300
+ for (const entry of import_node_fs188.default.readdirSync(iosDir, { withFileTypes: true })) {
160197
160301
  if (!entry.isDirectory() || !entry.name.endsWith(".xcodeproj")) continue;
160198
- const xcodeproj = import_node_path188.default.join(iosDir, entry.name);
160302
+ const xcodeproj = import_node_path189.default.join(iosDir, entry.name);
160199
160303
  for (const target of listXcodeAppTargets(xcodeproj, { requireSources: false })) {
160200
160304
  const members2 = readXcodeAppTarget(xcodeproj, target, void 0, {
160201
160305
  requireSources: false
160202
160306
  });
160203
160307
  for (const file of members2.resources) {
160204
- if (!bundledByName.has(import_node_path188.default.basename(file)))
160205
- bundledByName.set(import_node_path188.default.basename(file), file);
160308
+ if (!bundledByName.has(import_node_path189.default.basename(file)))
160309
+ bundledByName.set(import_node_path189.default.basename(file), file);
160206
160310
  }
160207
160311
  }
160208
160312
  }
160209
- const plistPaths = [import_node_path188.default.join(iosDir, "Info.plist")];
160313
+ const plistPaths = [import_node_path189.default.join(iosDir, "Info.plist")];
160210
160314
  for (const entry of targetDirs) {
160211
- plistPaths.push(import_node_path188.default.join(iosDir, entry.name, "Info.plist"));
160315
+ plistPaths.push(import_node_path189.default.join(iosDir, entry.name, "Info.plist"));
160212
160316
  }
160213
160317
  for (const plistPath of plistPaths) {
160214
160318
  let parsed2;
160215
160319
  try {
160216
- parsed2 = parsePlistSource(import_node_fs187.default.readFileSync(plistPath, "utf8"));
160320
+ parsed2 = parsePlistSource(import_node_fs188.default.readFileSync(plistPath, "utf8"));
160217
160321
  } catch {
160218
160322
  continue;
160219
160323
  }
@@ -160224,12 +160328,12 @@ function discoverNativeLinkedAppFontAssets(opts) {
160224
160328
  if (typeof declaredFont !== "string") continue;
160225
160329
  const bundled = bundledByName.get(declaredFont);
160226
160330
  const candidates = [
160227
- import_node_path188.default.resolve(import_node_path188.default.dirname(plistPath), declaredFont),
160228
- import_node_path188.default.resolve(iosDir, declaredFont)
160331
+ import_node_path189.default.resolve(import_node_path189.default.dirname(plistPath), declaredFont),
160332
+ import_node_path189.default.resolve(iosDir, declaredFont)
160229
160333
  ];
160230
160334
  const fontPath = candidates.find((candidate) => {
160231
- const relative6 = import_node_path188.default.relative(selectedAppDir, candidate);
160232
- if (relative6.startsWith("..") || import_node_path188.default.isAbsolute(relative6)) return false;
160335
+ const relative6 = import_node_path189.default.relative(selectedAppDir, candidate);
160336
+ if (relative6.startsWith("..") || import_node_path189.default.isAbsolute(relative6)) return false;
160233
160337
  return isFile(candidate);
160234
160338
  }) ?? (bundled && isFile(bundled) ? bundled : void 0);
160235
160339
  if (fontPath) fontPaths.push(fontPath);
@@ -160243,14 +160347,14 @@ function discoverNativeLinkedAppFontAssets(opts) {
160243
160347
  materialSymbols: materialSymbolFontAssets(materialFonts)
160244
160348
  };
160245
160349
  }
160246
- var import_node_crypto112, import_node_fs187, import_node_module29, import_node_path188, require3;
160350
+ var import_node_crypto112, import_node_fs188, import_node_module29, import_node_path189, require3;
160247
160351
  var init_app_fonts = __esm({
160248
160352
  "cli/app-fonts.ts"() {
160249
160353
  "use strict";
160250
160354
  import_node_crypto112 = require("node:crypto");
160251
- import_node_fs187 = __toESM(require("node:fs"), 1);
160355
+ import_node_fs188 = __toESM(require("node:fs"), 1);
160252
160356
  import_node_module29 = require("node:module");
160253
- import_node_path188 = __toESM(require("node:path"), 1);
160357
+ import_node_path189 = __toESM(require("node:path"), 1);
160254
160358
  init_cli_runtime();
160255
160359
  init_staged_host_files();
160256
160360
  init_native_firebase_config();
@@ -160262,16 +160366,6 @@ var init_app_fonts = __esm({
160262
160366
  }
160263
160367
  });
160264
160368
 
160265
- // cli/usage-error.ts
160266
- var CliUsageError;
160267
- var init_usage_error = __esm({
160268
- "cli/usage-error.ts"() {
160269
- "use strict";
160270
- CliUsageError = class extends Error {
160271
- };
160272
- }
160273
- });
160274
-
160275
160369
  // cli/commands/shell-url.ts
160276
160370
  function normalizeKnownTarget(target) {
160277
160371
  return target.trim();
@@ -160532,7 +160626,7 @@ function splashImageOnDisk(imageUrl, appDir) {
160532
160626
  const { pathname } = new URL(imageUrl);
160533
160627
  if (!pathname.startsWith("/assets/")) return false;
160534
160628
  try {
160535
- return import_node_fs188.default.statSync(import_node_path189.default.join(appDir, decodeURIComponent(pathname.slice("/assets/".length)))).isFile();
160629
+ return import_node_fs189.default.statSync(import_node_path190.default.join(appDir, decodeURIComponent(pathname.slice("/assets/".length)))).isFile();
160536
160630
  } catch {
160537
160631
  return false;
160538
160632
  }
@@ -160578,19 +160672,19 @@ function stageBuiltBundleManifest(bundleUrl, config) {
160578
160672
  const bundle = new URL(bundleUrl);
160579
160673
  if (!isStagedHostFileRequest(bundle.pathname) || Object.keys(config).length === 0)
160580
160674
  return null;
160581
- const directory2 = import_node_fs188.default.mkdtempSync(import_node_path189.default.join(import_node_os35.default.tmpdir(), "peach-app-manifest-"));
160675
+ const directory2 = import_node_fs189.default.mkdtempSync(import_node_path190.default.join(import_node_os35.default.tmpdir(), "peach-app-manifest-"));
160582
160676
  try {
160583
- const file = import_node_path189.default.join(directory2, "manifest.json");
160584
- import_node_fs188.default.writeFileSync(file, JSON.stringify({ extra: { expoClient: config } }));
160677
+ const file = import_node_path190.default.join(directory2, "manifest.json");
160678
+ import_node_fs189.default.writeFileSync(file, JSON.stringify({ extra: { expoClient: config } }));
160585
160679
  return stageHostFile(file, bundle.origin);
160586
160680
  } finally {
160587
- import_node_fs188.default.rmSync(directory2, { recursive: true, force: true });
160681
+ import_node_fs189.default.rmSync(directory2, { recursive: true, force: true });
160588
160682
  }
160589
160683
  }
160590
160684
  function readOneConfigNativeAppIdentity(appDir, platform3) {
160591
160685
  const read = (file) => {
160592
- const resolved = import_node_path189.default.join(appDir, file);
160593
- return import_node_fs188.default.statSync(resolved, { throwIfNoEntry: false })?.isFile() ? import_node_fs188.default.readFileSync(resolved, "utf8") : void 0;
160686
+ const resolved = import_node_path190.default.join(appDir, file);
160687
+ return import_node_fs189.default.statSync(resolved, { throwIfNoEntry: false })?.isFile() ? import_node_fs189.default.readFileSync(resolved, "utf8") : void 0;
160594
160688
  };
160595
160689
  return oneNativeAppIdentity(read("vite.config.ts"), platform3, read);
160596
160690
  }
@@ -160847,13 +160941,13 @@ function applyShellLaunchOptions(url, opts) {
160847
160941
  for (const entry of opts.args ?? []) url.searchParams.append("arg", entry);
160848
160942
  return url;
160849
160943
  }
160850
- var import_node_fs188, import_node_os35, import_node_path189, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS, startedExpoConfigReads;
160944
+ var import_node_fs189, import_node_os35, import_node_path190, SHELL_APPS, DEV_BUNDLE_RESOLVE_ATTEMPTS, DEV_BUNDLE_RESOLVE_INTERVAL_MS, startedExpoConfigReads;
160851
160945
  var init_shell_url = __esm({
160852
160946
  "cli/commands/shell-url.ts"() {
160853
160947
  "use strict";
160854
- import_node_fs188 = __toESM(require("node:fs"), 1);
160948
+ import_node_fs189 = __toESM(require("node:fs"), 1);
160855
160949
  import_node_os35 = __toESM(require("node:os"), 1);
160856
- import_node_path189 = __toESM(require("node:path"), 1);
160950
+ import_node_path190 = __toESM(require("node:path"), 1);
160857
160951
  init_androidAutolinkingContract();
160858
160952
  init_androidRootModuleContract();
160859
160953
  init_oneViteAliases();
@@ -161447,8 +161541,8 @@ __export(metro_bundle_assets_exports, {
161447
161541
  stageMetroBundleAssets: () => stageMetroBundleAssets
161448
161542
  });
161449
161543
  async function stageMetroBundleAssets(bundleFile, source, origin) {
161450
- const directory2 = import_node_path190.default.join(import_node_path190.default.dirname(bundleFile), "assets");
161451
- if (!import_node_fs189.default.existsSync(directory2)) return;
161544
+ const directory2 = import_node_path191.default.join(import_node_path191.default.dirname(bundleFile), "assets");
161545
+ if (!import_node_fs190.default.existsSync(directory2)) return;
161452
161546
  const descriptors = extractAssetDescriptors(source).filter(
161453
161547
  (descriptor) => !isEmbeddedAssetDescriptor(descriptor)
161454
161548
  );
@@ -161472,7 +161566,7 @@ async function stageMetroBundleAssets(bundleFile, source, origin) {
161472
161566
  const bytes = scales.map((scale) => {
161473
161567
  const relative6 = placement.files.get(scale);
161474
161568
  if (!relative6 || !search.dest) throw new Error("Metro asset scale is missing");
161475
- return import_node_fs189.default.readFileSync(import_node_path190.default.join(search.dest.directory, relative6));
161569
+ return import_node_fs190.default.readFileSync(import_node_path191.default.join(search.dest.directory, relative6));
161476
161570
  });
161477
161571
  const verified2 = perFile && hashes ? bytes.every((content, i) => {
161478
161572
  const hash = (0, import_node_crypto113.createHash)("md5").update(content).digest("hex");
@@ -161506,13 +161600,13 @@ async function stageMetroBundleAssets(bundleFile, source, origin) {
161506
161600
  });
161507
161601
  stageHostMetroAssets(staged, origin);
161508
161602
  }
161509
- var import_node_crypto113, import_node_fs189, import_node_path190;
161603
+ var import_node_crypto113, import_node_fs190, import_node_path191;
161510
161604
  var init_metro_bundle_assets = __esm({
161511
161605
  "cli/metro-bundle-assets.ts"() {
161512
161606
  "use strict";
161513
161607
  import_node_crypto113 = require("node:crypto");
161514
- import_node_fs189 = __toESM(require("node:fs"), 1);
161515
- import_node_path190 = __toESM(require("node:path"), 1);
161608
+ import_node_fs190 = __toESM(require("node:fs"), 1);
161609
+ import_node_path191 = __toESM(require("node:path"), 1);
161516
161610
  init_metroAssetArtifact();
161517
161611
  init_staged_host_files();
161518
161612
  }
@@ -161938,12 +162032,12 @@ __export(account_gate_exports, {
161938
162032
  requireAccount: () => requireAccount
161939
162033
  });
161940
162034
  function checkFile() {
161941
- return import_node_path191.default.join(rnxHomeDir(), "account-check.json");
162035
+ return import_node_path192.default.join(rnxHomeDir(), "account-check.json");
161942
162036
  }
161943
162037
  function readCheck() {
161944
- if (!(0, import_node_fs190.existsSync)(checkFile())) return null;
162038
+ if (!(0, import_node_fs191.existsSync)(checkFile())) return null;
161945
162039
  try {
161946
- return checkSchema.parse(JSON.parse((0, import_node_fs190.readFileSync)(checkFile(), "utf8")));
162040
+ return checkSchema.parse(JSON.parse((0, import_node_fs191.readFileSync)(checkFile(), "utf8")));
161947
162041
  } catch {
161948
162042
  return null;
161949
162043
  }
@@ -162033,14 +162127,14 @@ ${header}`).digest("hex");
162033
162127
  `${name3} could not reach ${origin} to verify your account${status ? ` (${status})` : ""}; connect once and run it again`
162034
162128
  );
162035
162129
  }
162036
- var import_node_crypto115, import_node_fs190, import_node_path191, import_zod4, REFRESH_AFTER_MS, VALID_FOR_MS, VERIFY_TIMEOUT_MS, checkSchema, ACCOUNT_REQUIRED_HINT, waitlistedSchema;
162130
+ var import_node_crypto115, import_node_fs191, import_node_path192, import_zod5, REFRESH_AFTER_MS, VALID_FOR_MS, VERIFY_TIMEOUT_MS, checkSchema, ACCOUNT_REQUIRED_HINT, waitlistedSchema;
162037
162131
  var init_account_gate = __esm({
162038
162132
  "cli/account-gate.ts"() {
162039
162133
  "use strict";
162040
162134
  import_node_crypto115 = require("node:crypto");
162041
- import_node_fs190 = require("node:fs");
162042
- import_node_path191 = __toESM(require("node:path"), 1);
162043
- import_zod4 = require("peachsim/vendor/zod");
162135
+ import_node_fs191 = require("node:fs");
162136
+ import_node_path192 = __toESM(require("node:path"), 1);
162137
+ import_zod5 = require("peachsim/vendor/zod");
162044
162138
  init_home_paths();
162045
162139
  init_auth();
162046
162140
  init_login();
@@ -162052,15 +162146,15 @@ var init_account_gate = __esm({
162052
162146
  REFRESH_AFTER_MS = 24 * 60 * 60 * 1e3;
162053
162147
  VALID_FOR_MS = 7 * 24 * 60 * 60 * 1e3;
162054
162148
  VERIFY_TIMEOUT_MS = 4e3;
162055
- checkSchema = import_zod4.z.object({
162056
- credential: import_zod4.z.string(),
162057
- origin: import_zod4.z.string(),
162058
- verifiedAt: import_zod4.z.number()
162149
+ checkSchema = import_zod5.z.object({
162150
+ credential: import_zod5.z.string(),
162151
+ origin: import_zod5.z.string(),
162152
+ verifiedAt: import_zod5.z.number()
162059
162153
  });
162060
162154
  ACCOUNT_REQUIRED_HINT = "sign in with `peach login`, or set PEACH_API_KEY to a free key (`peach auth key create`, or Billing \u2192 API Keys on peachsim.com)";
162061
- waitlistedSchema = import_zod4.z.object({
162062
- error: import_zod4.z.literal("waitlisted"),
162063
- email: import_zod4.z.string().optional()
162155
+ waitlistedSchema = import_zod5.z.object({
162156
+ error: import_zod5.z.literal("waitlisted"),
162157
+ email: import_zod5.z.string().optional()
162064
162158
  });
162065
162159
  }
162066
162160
  });
@@ -162069,19 +162163,9 @@ var init_account_gate = __esm({
162069
162163
  var stream_exports = {};
162070
162164
  __export(stream_exports, {
162071
162165
  STREAM_FLAG: () => STREAM_FLAG,
162072
- readLocalStreamRecord: () => readLocalStreamRecord,
162073
162166
  registerSceneStream: () => registerSceneStream,
162074
162167
  runStreamCommand: () => runStreamCommand
162075
162168
  });
162076
- function readLocalStreamRecord(simId) {
162077
- const file = (0, import_node_path192.join)(rnxHomeDir(), "streams", `${encodeURIComponent(simId)}.json`);
162078
- try {
162079
- return recordSchema.parse(JSON.parse((0, import_node_fs191.readFileSync)(file, "utf8")));
162080
- } catch (error) {
162081
- if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
162082
- throw error;
162083
- }
162084
- }
162085
162169
  async function registerStream(command, body, { auth, header } = authHeaderOrExit(command)) {
162086
162170
  const origin = (process.env.PEACH_API_ORIGIN?.trim() || (auth.kind === "session" ? auth.origin : rnxPublicBrand.origin)).replace(/\/+$/, "");
162087
162171
  const response = await fetch(new URL("/api/v1/rnx/streams", origin), {
@@ -162123,11 +162207,21 @@ async function registerSceneStream(body) {
162123
162207
  transport: "scene",
162124
162208
  ...body
162125
162209
  });
162210
+ const simId = registration.session.externalId;
162126
162211
  return {
162127
162212
  relay: registration.url,
162128
162213
  credential: registration.credential,
162129
162214
  watchUrl: record6.watchUrl,
162130
- stop: stop2
162215
+ recordCommand(command) {
162216
+ writeLocalStreamRecord(simId, { ...record6, command }, false);
162217
+ },
162218
+ async stop() {
162219
+ try {
162220
+ removeLocalStreamRecord(simId);
162221
+ } finally {
162222
+ await stop2();
162223
+ }
162224
+ }
162131
162225
  };
162132
162226
  }
162133
162227
  async function runStreamCommand(args, opts = {}) {
@@ -162150,9 +162244,8 @@ async function runStreamCommand(args, opts = {}) {
162150
162244
  });
162151
162245
  if (typeof simId !== "string" || !simId)
162152
162246
  throw new Error("Could not identify the local simulator.");
162153
- const directory2 = (0, import_node_path192.join)(rnxHomeDir(), "streams");
162154
- (0, import_node_fs191.mkdirSync)(directory2, { recursive: true });
162155
- const file = (0, import_node_path192.join)(directory2, `${encodeURIComponent(simId)}.json`);
162247
+ const directory2 = (0, import_node_path193.join)(rnxHomeDir(), "streams");
162248
+ (0, import_node_fs192.mkdirSync)(directory2, { recursive: true });
162156
162249
  const state = await callInBridge(bridge, "SootSim.bridges.videoStream.state");
162157
162250
  if (action === "status") {
162158
162251
  console.log(` stream: ${state}`);
@@ -162163,7 +162256,7 @@ async function runStreamCommand(args, opts = {}) {
162163
162256
  await callInBridge(bridge, "SootSim.bridges.videoStream.stop");
162164
162257
  const record7 = readLocalStreamRecord(simId);
162165
162258
  if (record7) await stopStreamSession(record7, header);
162166
- (0, import_node_fs191.rmSync)(file, { force: true });
162259
+ removeLocalStreamRecord(simId);
162167
162260
  console.log(" stream: off");
162168
162261
  return;
162169
162262
  }
@@ -162194,8 +162287,8 @@ async function runStreamCommand(args, opts = {}) {
162194
162287
  url: registration.url,
162195
162288
  token: registration.token
162196
162289
  });
162197
- writeSecureJsonAtomic(file, record6, { durable: !opts.signal });
162198
- removeRecord = () => (0, import_node_fs191.rmSync)(file, { force: true });
162290
+ writeLocalStreamRecord(simId, record6, !opts.signal);
162291
+ removeRecord = () => removeLocalStreamRecord(simId);
162199
162292
  if (opts.onStarted) opts.onStarted(record6.watchUrl);
162200
162293
  else {
162201
162294
  console.log(` simulator: ${record6.watchUrl}`);
@@ -162233,15 +162326,9 @@ async function runStreamCommand(args, opts = {}) {
162233
162326
  if (!finished2) alive = setTimeout(checkStream, 5e3);
162234
162327
  }
162235
162328
  let alive = setTimeout(checkStream, 5e3);
162236
- const watcher = (0, import_node_fs191.watch)(directory2, (_event, filename) => {
162329
+ const watcher = (0, import_node_fs192.watch)(directory2, (_event, filename) => {
162237
162330
  if (filename !== `${encodeURIComponent(simId)}.json`) return;
162238
- try {
162239
- (0, import_node_fs191.readFileSync)(file);
162240
- } catch (error) {
162241
- if (error instanceof Error && "code" in error && error.code === "ENOENT")
162242
- finish();
162243
- else throw error;
162244
- }
162331
+ if (!readLocalStreamRecord(simId)) finish();
162245
162332
  });
162246
162333
  if (opts.signal) {
162247
162334
  opts.signal.addEventListener("abort", stopped, { once: true });
@@ -162271,31 +162358,30 @@ async function runStreamCommand(args, opts = {}) {
162271
162358
  }
162272
162359
  }
162273
162360
  }
162274
- var import_node_fs191, import_node_path192, import_zod5, STREAM_FLAG, registrationSchema, recordSchema;
162361
+ var import_node_fs192, import_node_path193, import_zod6, STREAM_FLAG, registrationSchema;
162275
162362
  var init_stream = __esm({
162276
162363
  "cli/commands/stream.ts"() {
162277
162364
  "use strict";
162278
- import_node_fs191 = require("node:fs");
162279
- import_node_path192 = require("node:path");
162280
- import_zod5 = require("peachsim/vendor/zod");
162365
+ import_node_fs192 = require("node:fs");
162366
+ import_node_path193 = require("node:path");
162367
+ import_zod6 = require("peachsim/vendor/zod");
162281
162368
  init_home_paths();
162282
162369
  init_public_brand();
162283
162370
  init_auth();
162284
162371
  init_run_registry();
162285
- init_secure_file();
162372
+ init_stream_record();
162286
162373
  init_ws_bridge();
162287
162374
  STREAM_FLAG = "--stream";
162288
- registrationSchema = import_zod5.z.object({
162289
- session: import_zod5.z.object({ id: import_zod5.z.string(), accountId: import_zod5.z.string(), url: import_zod5.z.string() }),
162290
- url: import_zod5.z.string(),
162291
- token: import_zod5.z.string(),
162292
- credential: import_zod5.z.string()
162293
- });
162294
- recordSchema = import_zod5.z.object({
162295
- sessionId: import_zod5.z.string(),
162296
- accountId: import_zod5.z.string(),
162297
- origin: import_zod5.z.string(),
162298
- watchUrl: import_zod5.z.string()
162375
+ registrationSchema = import_zod6.z.object({
162376
+ session: import_zod6.z.object({
162377
+ id: import_zod6.z.string(),
162378
+ accountId: import_zod6.z.string(),
162379
+ externalId: import_zod6.z.string(),
162380
+ url: import_zod6.z.string()
162381
+ }),
162382
+ url: import_zod6.z.string(),
162383
+ token: import_zod6.z.string(),
162384
+ credential: import_zod6.z.string()
162299
162385
  });
162300
162386
  }
162301
162387
  });
@@ -162320,14 +162406,14 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
162320
162406
  const neededPackages = /* @__PURE__ */ new Set();
162321
162407
  const factories = [];
162322
162408
  const visit3 = (filePath) => {
162323
- const real = import_node_fs192.default.realpathSync(filePath);
162409
+ const real = import_node_fs193.default.realpathSync(filePath);
162324
162410
  const previous = files2.get(real);
162325
162411
  if (previous !== void 0) return previous;
162326
162412
  const id = "peach-config-file:" + files2.size;
162327
162413
  files2.set(real, id);
162328
162414
  const compiled = compileReplacementModule({
162329
162415
  filePath: real,
162330
- source: import_node_fs192.default.readFileSync(real, "utf8"),
162416
+ source: import_node_fs193.default.readFileSync(real, "utf8"),
162331
162417
  runtimePackages,
162332
162418
  localModuleUrl: (specifier) => visit3(resolveReplacementModuleFile(real, specifier))
162333
162419
  });
@@ -162351,7 +162437,7 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
162351
162437
  if (!entries2 || typeof entries2 !== "object") continue;
162352
162438
  for (const resolution2 of Object.values(entries2)) {
162353
162439
  if (resolution2 && typeof resolution2 === "object" && "file" in resolution2 && typeof resolution2.file === "string") {
162354
- resolution2.file = visit3(import_node_path193.default.resolve(resolution2.file));
162440
+ resolution2.file = visit3(import_node_path194.default.resolve(resolution2.file));
162355
162441
  }
162356
162442
  }
162357
162443
  }
@@ -162375,12 +162461,12 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
162375
162461
  const identityStart = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
162376
162462
  return prefix + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
162377
162463
  }
162378
- var import_node_fs192, import_node_path193, import_sucrase5, import_terser2, PREFIX_START, PREFIX_END;
162464
+ var import_node_fs193, import_node_path194, import_sucrase5, import_terser2, PREFIX_START, PREFIX_END;
162379
162465
  var init_configured_bundle_producer = __esm({
162380
162466
  "src/configured-bundle-producer.ts"() {
162381
162467
  "use strict";
162382
- import_node_fs192 = __toESM(require("node:fs"), 1);
162383
- import_node_path193 = __toESM(require("node:path"), 1);
162468
+ import_node_fs193 = __toESM(require("node:fs"), 1);
162469
+ import_node_path194 = __toESM(require("node:path"), 1);
162384
162470
  init_bundle_global_footer();
162385
162471
  import_sucrase5 = require("peachsim/vendor/sucrase");
162386
162472
  import_terser2 = require("peachsim/vendor/terser");
@@ -162605,9 +162691,9 @@ var init_android_theme = __esm({
162605
162691
 
162606
162692
  // src/android-drawables.ts
162607
162693
  function readAndroidDrawables(moduleDir, sources) {
162608
- const res = import_node_path194.default.join(moduleDir, "src/main/res");
162694
+ const res = import_node_path195.default.join(moduleDir, "src/main/res");
162609
162695
  const byName2 = /* @__PURE__ */ new Map();
162610
- for (const dir of import_node_fs193.default.existsSync(res) ? import_node_fs193.default.readdirSync(res).sort() : []) {
162696
+ for (const dir of import_node_fs194.default.existsSync(res) ? import_node_fs194.default.readdirSync(res).sort() : []) {
162611
162697
  if (!dir.startsWith("drawable")) continue;
162612
162698
  const match = DRAWABLE_DIR.exec(dir);
162613
162699
  const qualifier = match?.[1];
@@ -162617,10 +162703,10 @@ function readAndroidDrawables(moduleDir, sources) {
162617
162703
  `${res}/${dir}: drawables under this qualifier are not resolved by Peach yet`
162618
162704
  );
162619
162705
  const version2 = Number(match[2] ?? 0);
162620
- for (const entry of import_node_fs193.default.readdirSync(import_node_path194.default.join(res, dir)).sort()) {
162706
+ for (const entry of import_node_fs194.default.readdirSync(import_node_path195.default.join(res, dir)).sort()) {
162621
162707
  if (!entry.endsWith(".xml") && !BITMAP.test(entry)) continue;
162622
162708
  const name3 = entry.replace(BITMAP, "").replace(/\.xml$/, "");
162623
- const file = import_node_path194.default.join(res, dir, entry);
162709
+ const file = import_node_path195.default.join(res, dir, entry);
162624
162710
  const files2 = byName2.get(name3) ?? [];
162625
162711
  byName2.set(name3, files2);
162626
162712
  if (version2 > DEVICE_API) continue;
@@ -162633,7 +162719,7 @@ function readAndroidDrawables(moduleDir, sources) {
162633
162719
  ninePatch: entry.endsWith(".9.png")
162634
162720
  });
162635
162721
  else {
162636
- const root = parseXml(import_node_fs193.default.readFileSync(file, "utf8"), file).children[0];
162722
+ const root = parseXml(import_node_fs194.default.readFileSync(file, "utf8"), file).children[0];
162637
162723
  files2.push(
162638
162724
  root?.name === "vector" ? {
162639
162725
  file,
@@ -162800,12 +162886,12 @@ function readVector(root, file, sources) {
162800
162886
  calls
162801
162887
  };
162802
162888
  }
162803
- var import_node_fs193, import_node_path194, DEVICE_API, BUCKETS, DRAWABLE_DIR, BITMAP;
162889
+ var import_node_fs194, import_node_path195, DEVICE_API, BUCKETS, DRAWABLE_DIR, BITMAP;
162804
162890
  var init_android_drawables = __esm({
162805
162891
  "src/android-drawables.ts"() {
162806
162892
  "use strict";
162807
- import_node_fs193 = __toESM(require("node:fs"), 1);
162808
- import_node_path194 = __toESM(require("node:path"), 1);
162893
+ import_node_fs194 = __toESM(require("node:fs"), 1);
162894
+ import_node_path195 = __toESM(require("node:path"), 1);
162809
162895
  init_android_theme();
162810
162896
  init_android_xml();
162811
162897
  DEVICE_API = 37;
@@ -162827,12 +162913,12 @@ var init_android_drawables = __esm({
162827
162913
 
162828
162914
  // src/android-layout-ids.ts
162829
162915
  function readAndroidLayoutIds(moduleDir) {
162830
- const res = import_node_path195.default.join(moduleDir, "src/main/res");
162916
+ const res = import_node_path196.default.join(moduleDir, "src/main/res");
162831
162917
  const layouts = /* @__PURE__ */ new Set();
162832
162918
  const ids = /* @__PURE__ */ new Set();
162833
162919
  const elements = /* @__PURE__ */ new Map();
162834
- for (const dir of import_node_fs194.default.existsSync(res) ? import_node_fs194.default.readdirSync(res).sort() : []) {
162835
- const directory2 = import_node_path195.default.join(res, dir);
162920
+ for (const dir of import_node_fs195.default.existsSync(res) ? import_node_fs195.default.readdirSync(res).sort() : []) {
162921
+ const directory2 = import_node_path196.default.join(res, dir);
162836
162922
  if (dir === "layout" || dir.startsWith("layout-")) {
162837
162923
  const match = LAYOUT_DIR.exec(dir);
162838
162924
  if (!match)
@@ -162842,13 +162928,13 @@ function readAndroidLayoutIds(moduleDir) {
162842
162928
  const orientation = match[1] === "port" ? 1 : match[1] === "land" ? 2 : 0;
162843
162929
  const night = match[2] === "notnight" ? 1 : match[2] === "night" ? 2 : 0;
162844
162930
  const version2 = Number(match[3] ?? 0);
162845
- for (const entry of import_node_fs194.default.readdirSync(directory2).sort()) {
162931
+ for (const entry of import_node_fs195.default.readdirSync(directory2).sort()) {
162846
162932
  if (!entry.endsWith(".xml")) continue;
162847
162933
  const name3 = entry.slice(0, -".xml".length);
162848
162934
  layouts.add(name3);
162849
- const xml = import_node_fs194.default.readFileSync(import_node_path195.default.join(directory2, entry), "utf8");
162935
+ const xml = import_node_fs195.default.readFileSync(import_node_path196.default.join(directory2, entry), "utf8");
162850
162936
  for (const reference of xml.matchAll(ID_REFERENCE)) ids.add(reference[1]);
162851
- const element = parseXml(xml, import_node_path195.default.join(directory2, entry)).children[0];
162937
+ const element = parseXml(xml, import_node_path196.default.join(directory2, entry)).children[0];
162852
162938
  if (!element || version2 > DEVICE_API) continue;
162853
162939
  elements.set(name3, [
162854
162940
  ...elements.get(name3) ?? [],
@@ -162856,9 +162942,9 @@ function readAndroidLayoutIds(moduleDir) {
162856
162942
  ]);
162857
162943
  }
162858
162944
  } else if (dir.startsWith("values")) {
162859
- for (const entry of import_node_fs194.default.readdirSync(directory2).sort()) {
162945
+ for (const entry of import_node_fs195.default.readdirSync(directory2).sort()) {
162860
162946
  if (!entry.endsWith(".xml")) continue;
162861
- const xml = import_node_fs194.default.readFileSync(import_node_path195.default.join(directory2, entry), "utf8");
162947
+ const xml = import_node_fs195.default.readFileSync(import_node_path196.default.join(directory2, entry), "utf8");
162862
162948
  for (const item of xml.matchAll(ID_ITEM)) {
162863
162949
  const name3 = ITEM_NAME.exec(item[0])?.[1];
162864
162950
  if (name3) ids.add(name3);
@@ -162868,12 +162954,12 @@ function readAndroidLayoutIds(moduleDir) {
162868
162954
  }
162869
162955
  return { layouts: [...layouts].sort(), ids: [...ids].sort(), elements };
162870
162956
  }
162871
- var import_node_fs194, import_node_path195, LAYOUT_DIR, ID_REFERENCE, ID_ITEM, ITEM_NAME;
162957
+ var import_node_fs195, import_node_path196, LAYOUT_DIR, ID_REFERENCE, ID_ITEM, ITEM_NAME;
162872
162958
  var init_android_layout_ids = __esm({
162873
162959
  "src/android-layout-ids.ts"() {
162874
162960
  "use strict";
162875
- import_node_fs194 = __toESM(require("node:fs"), 1);
162876
- import_node_path195 = __toESM(require("node:path"), 1);
162961
+ import_node_fs195 = __toESM(require("node:fs"), 1);
162962
+ import_node_path196 = __toESM(require("node:path"), 1);
162877
162963
  init_android_drawables();
162878
162964
  init_android_xml();
162879
162965
  LAYOUT_DIR = /^layout(?:-(port|land))?(?:-(notnight|night))?(?:-v(\d+))?$/;
@@ -162888,15 +162974,15 @@ function readAndroidStrings(moduleDir) {
162888
162974
  const strings7 = /* @__PURE__ */ new Map();
162889
162975
  const plurals = /* @__PURE__ */ new Map();
162890
162976
  const arrays = /* @__PURE__ */ new Map();
162891
- const res = import_node_path196.default.join(moduleDir, "src/main/res");
162892
- const dirs = import_node_fs195.default.existsSync(res) ? import_node_fs195.default.readdirSync(res).sort() : [];
162977
+ const res = import_node_path197.default.join(moduleDir, "src/main/res");
162978
+ const dirs = import_node_fs196.default.existsSync(res) ? import_node_fs196.default.readdirSync(res).sort() : [];
162893
162979
  for (const dir of dirs) {
162894
162980
  if (!dir.startsWith("values")) continue;
162895
162981
  const qualifier = VALUES_DIR.exec(dir);
162896
- for (const entry of import_node_fs195.default.readdirSync(import_node_path196.default.join(res, dir)).sort()) {
162982
+ for (const entry of import_node_fs196.default.readdirSync(import_node_path197.default.join(res, dir)).sort()) {
162897
162983
  if (!entry.endsWith(".xml")) continue;
162898
- const file = import_node_path196.default.join(res, dir, entry);
162899
- const text7 = import_node_fs195.default.readFileSync(file, "utf8").replace(/<!--[\s\S]*?-->/g, "");
162984
+ const file = import_node_path197.default.join(res, dir, entry);
162985
+ const text7 = import_node_fs196.default.readFileSync(file, "utf8").replace(/<!--[\s\S]*?-->/g, "");
162900
162986
  for (const match of text7.matchAll(ELEMENT)) {
162901
162987
  const kind = match[1] ?? "";
162902
162988
  const name3 = NAME.exec(match[2] ?? "")?.[1];
@@ -162947,12 +163033,12 @@ function compileString(raw2, where) {
162947
163033
  where
162948
163034
  );
162949
163035
  }
162950
- var import_node_fs195, import_node_path196, VALUES_DIR, ELEMENT, ITEM, NAME, QUANTITY, QUANTITIES, isQuantity, sorted2;
163036
+ var import_node_fs196, import_node_path197, VALUES_DIR, ELEMENT, ITEM, NAME, QUANTITY, QUANTITIES, isQuantity, sorted2;
162951
163037
  var init_android_strings = __esm({
162952
163038
  "src/android-strings.ts"() {
162953
163039
  "use strict";
162954
- import_node_fs195 = __toESM(require("node:fs"), 1);
162955
- import_node_path196 = __toESM(require("node:path"), 1);
163040
+ import_node_fs196 = __toESM(require("node:fs"), 1);
163041
+ import_node_path197 = __toESM(require("node:path"), 1);
162956
163042
  init_android_string_value();
162957
163043
  init_android_xml();
162958
163044
  VALUES_DIR = /^values(?:-([a-z]{2,3})(?:-r([A-Z]{2}))?)?$/;
@@ -174335,7 +174421,7 @@ function repositories(body, where) {
174335
174421
  if (name3 === "google") roots.push("https://dl.google.com/dl/android/maven2");
174336
174422
  else if (name3 === "mavenCentral") roots.push("https://repo1.maven.org/maven2");
174337
174423
  else if (name3 === "mavenLocal")
174338
- roots.push(import_node_path197.default.join(import_node_os36.default.homedir(), ".m2", "repository"));
174424
+ roots.push(import_node_path198.default.join(import_node_os36.default.homedir(), ".m2", "repository"));
174339
174425
  else {
174340
174426
  const declared = direct ?? /["']([^"']+)["']/.exec(block2 ?? "")?.[1];
174341
174427
  if (!declared)
@@ -174350,9 +174436,9 @@ function repositories(body, where) {
174350
174436
  return roots;
174351
174437
  }
174352
174438
  function mavenRepositories(projectDir, where) {
174353
- const file = ["settings.gradle.kts", "settings.gradle"].map((name3) => import_node_path197.default.join(projectDir, name3)).find((candidate) => import_node_fs196.default.existsSync(candidate));
174439
+ const file = ["settings.gradle.kts", "settings.gradle"].map((name3) => import_node_path198.default.join(projectDir, name3)).find((candidate) => import_node_fs197.default.existsSync(candidate));
174354
174440
  if (!file) throw new Error(`${where}: ${projectDir} has no settings.gradle`);
174355
- const text7 = import_node_fs196.default.readFileSync(file, "utf8");
174441
+ const text7 = import_node_fs197.default.readFileSync(file, "utf8");
174356
174442
  const management = text7.search(/\bdependencyResolutionManagement\b/);
174357
174443
  if (management < 0)
174358
174444
  throw new Error(`${where}: ${file} declares no dependency repositories`);
@@ -174442,31 +174528,31 @@ function extract(bytes, where) {
174442
174528
  const cached5 = pending.get(key2);
174443
174529
  if (cached5) return cached5;
174444
174530
  const request = (async () => {
174445
- const dest = import_node_path197.default.join(import_node_os36.default.tmpdir(), "peach-maven-sources", key2);
174446
- const marker = import_node_path197.default.join(dest, ".complete");
174447
- if (!import_node_fs196.default.existsSync(marker)) {
174531
+ const dest = import_node_path198.default.join(import_node_os36.default.tmpdir(), "peach-maven-sources", key2);
174532
+ const marker = import_node_path198.default.join(dest, ".complete");
174533
+ if (!import_node_fs197.default.existsSync(marker)) {
174448
174534
  const sources = zipSources(bytes, where);
174449
174535
  const staging = `${dest}.partial-${process.pid}`;
174450
- import_node_fs196.default.rmSync(staging, { recursive: true, force: true });
174451
- const stagingRoot = import_node_path197.default.resolve(staging);
174452
- import_node_fs196.default.mkdirSync(stagingRoot, { recursive: true });
174536
+ import_node_fs197.default.rmSync(staging, { recursive: true, force: true });
174537
+ const stagingRoot = import_node_path198.default.resolve(staging);
174538
+ import_node_fs197.default.mkdirSync(stagingRoot, { recursive: true });
174453
174539
  for (const entry of sources) {
174454
- const file = import_node_path197.default.resolve(stagingRoot, entry.name);
174455
- if (!file.startsWith(`${stagingRoot}${import_node_path197.default.sep}`)) {
174540
+ const file = import_node_path198.default.resolve(stagingRoot, entry.name);
174541
+ if (!file.startsWith(`${stagingRoot}${import_node_path198.default.sep}`)) {
174456
174542
  throw new Error(`${where}: ${entry.name} escapes the sources jar`);
174457
174543
  }
174458
- import_node_fs196.default.mkdirSync(import_node_path197.default.dirname(file), { recursive: true });
174459
- import_node_fs196.default.writeFileSync(file, entry.data);
174544
+ import_node_fs197.default.mkdirSync(import_node_path198.default.dirname(file), { recursive: true });
174545
+ import_node_fs197.default.writeFileSync(file, entry.data);
174460
174546
  }
174461
- import_node_fs196.default.writeFileSync(import_node_path197.default.join(staging, ".complete"), "");
174547
+ import_node_fs197.default.writeFileSync(import_node_path198.default.join(staging, ".complete"), "");
174462
174548
  try {
174463
- import_node_fs196.default.renameSync(staging, dest);
174549
+ import_node_fs197.default.renameSync(staging, dest);
174464
174550
  } catch (error) {
174465
- import_node_fs196.default.rmSync(staging, { recursive: true, force: true });
174466
- if (!import_node_fs196.default.existsSync(marker)) throw error;
174551
+ import_node_fs197.default.rmSync(staging, { recursive: true, force: true });
174552
+ if (!import_node_fs197.default.existsSync(marker)) throw error;
174467
174553
  }
174468
174554
  }
174469
- const files2 = import_node_fs196.default.readdirSync(dest, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path197.default.join(entry.parentPath, entry.name)).sort();
174555
+ const files2 = import_node_fs197.default.readdirSync(dest, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path198.default.join(entry.parentPath, entry.name)).sort();
174470
174556
  return {
174471
174557
  directory: dest,
174472
174558
  java: files2.filter((file) => file.endsWith(".java")),
@@ -174522,14 +174608,14 @@ async function sourcesJar(root, group, artifact, version2) {
174522
174608
  }
174523
174609
  return Buffer.concat(chunks, total);
174524
174610
  }
174525
- const file = import_node_path197.default.join(root, ...parts);
174526
- if (!import_node_fs196.default.existsSync(file)) return null;
174611
+ const file = import_node_path198.default.join(root, ...parts);
174612
+ if (!import_node_fs197.default.existsSync(file)) return null;
174527
174613
  return readSourcesJar(file, file);
174528
174614
  }
174529
174615
  function readSourcesJar(archive, where) {
174530
- if (import_node_fs196.default.statSync(archive).size > MAX_SOURCES_JAR_BYTES)
174616
+ if (import_node_fs197.default.statSync(archive).size > MAX_SOURCES_JAR_BYTES)
174531
174617
  throw new Error(`${where}: ${archive} exceeds sources jar size limit`);
174532
- return import_node_fs196.default.readFileSync(archive);
174618
+ return import_node_fs197.default.readFileSync(archive);
174533
174619
  }
174534
174620
  async function mavenKotlinSources(projectDir, coordinate, where) {
174535
174621
  const { group, artifact, version: version2 } = coordinate;
@@ -174545,18 +174631,18 @@ function readKotlinSourcesArchive(archive, where) {
174545
174631
  async function kotlinSources2(bytes, where) {
174546
174632
  const { directory: directory2, java, kotlin } = await extract(bytes, where);
174547
174633
  if (java[0])
174548
- throw new Error(`${where}: ${import_node_path197.default.relative(directory2, java[0])} is a Java source`);
174634
+ throw new Error(`${where}: ${import_node_path198.default.relative(directory2, java[0])} is a Java source`);
174549
174635
  if (kotlin.length === 0) throw new Error(`${where}: sources jar has no Kotlin`);
174550
174636
  return kotlin;
174551
174637
  }
174552
- var import_node_crypto116, import_node_fs196, import_node_os36, import_node_path197, import_node_zlib11, pending, MAX_SOURCES_JAR_BYTES, MAX_SOURCE_ENTRY_BYTES, MAX_TOTAL_EXTRACTED_BYTES;
174638
+ var import_node_crypto116, import_node_fs197, import_node_os36, import_node_path198, import_node_zlib11, pending, MAX_SOURCES_JAR_BYTES, MAX_SOURCE_ENTRY_BYTES, MAX_TOTAL_EXTRACTED_BYTES;
174553
174639
  var init_kotlin_maven_sources = __esm({
174554
174640
  "src/kotlin-maven-sources.ts"() {
174555
174641
  "use strict";
174556
174642
  import_node_crypto116 = require("node:crypto");
174557
- import_node_fs196 = __toESM(require("node:fs"), 1);
174643
+ import_node_fs197 = __toESM(require("node:fs"), 1);
174558
174644
  import_node_os36 = __toESM(require("node:os"), 1);
174559
- import_node_path197 = __toESM(require("node:path"), 1);
174645
+ import_node_path198 = __toESM(require("node:path"), 1);
174560
174646
  import_node_zlib11 = require("node:zlib");
174561
174647
  pending = /* @__PURE__ */ new Map();
174562
174648
  MAX_SOURCES_JAR_BYTES = 64 * 1024 * 1024;
@@ -174566,12 +174652,12 @@ var init_kotlin_maven_sources = __esm({
174566
174652
  });
174567
174653
 
174568
174654
  // src/kotlin-version-catalog.ts
174569
- var import_node_fs197, import_node_path198, import_smol_toml, accessorName, KotlinVersionCatalog;
174655
+ var import_node_fs198, import_node_path199, import_smol_toml, accessorName, KotlinVersionCatalog;
174570
174656
  var init_kotlin_version_catalog = __esm({
174571
174657
  "src/kotlin-version-catalog.ts"() {
174572
174658
  "use strict";
174573
- import_node_fs197 = __toESM(require("node:fs"), 1);
174574
- import_node_path198 = __toESM(require("node:path"), 1);
174659
+ import_node_fs198 = __toESM(require("node:fs"), 1);
174660
+ import_node_path199 = __toESM(require("node:path"), 1);
174575
174661
  import_smol_toml = require("peachsim/vendor/smol-toml");
174576
174662
  init_is_record();
174577
174663
  accessorName = (name3) => name3.replace(/[-_.]/g, ".");
@@ -174579,8 +174665,8 @@ var init_kotlin_version_catalog = __esm({
174579
174665
  file;
174580
174666
  tables;
174581
174667
  constructor(projectDir) {
174582
- this.file = import_node_path198.default.join(projectDir, "gradle/libs.versions.toml");
174583
- this.tables = import_node_fs197.default.existsSync(this.file) ? (0, import_smol_toml.parse)(import_node_fs197.default.readFileSync(this.file, "utf8")) : {};
174668
+ this.file = import_node_path199.default.join(projectDir, "gradle/libs.versions.toml");
174669
+ this.tables = import_node_fs198.default.existsSync(this.file) ? (0, import_smol_toml.parse)(import_node_fs198.default.readFileSync(this.file, "utf8")) : {};
174584
174670
  }
174585
174671
  entry(section2, accessor, where) {
174586
174672
  const table = this.tables[section2];
@@ -174638,7 +174724,7 @@ __export(kotlin_app_exports, {
174638
174724
  });
174639
174725
  function readAndroidPins(moduleRoot) {
174640
174726
  const toolchain = JSON.parse(
174641
- import_node_fs198.default.readFileSync(import_node_path199.default.join(moduleRoot, "toolchain.json"), "utf8")
174727
+ import_node_fs199.default.readFileSync(import_node_path200.default.join(moduleRoot, "toolchain.json"), "utf8")
174642
174728
  );
174643
174729
  if (!isRecord(toolchain))
174644
174730
  throw new Error("peachsim kotlin/toolchain.json is not an object");
@@ -174679,8 +174765,8 @@ function readAndroidPins(moduleRoot) {
174679
174765
  }
174680
174766
  function readGradle(dir) {
174681
174767
  for (const name3 of ["build.gradle.kts", "build.gradle"]) {
174682
- const file = import_node_path199.default.join(dir, name3);
174683
- if (import_node_fs198.default.existsSync(file)) return { file, text: import_node_fs198.default.readFileSync(file, "utf8") };
174768
+ const file = import_node_path200.default.join(dir, name3);
174769
+ if (import_node_fs199.default.existsSync(file)) return { file, text: import_node_fs199.default.readFileSync(file, "utf8") };
174684
174770
  }
174685
174771
  return null;
174686
174772
  }
@@ -174896,15 +174982,15 @@ function themeSources(moduleDir, night) {
174896
174982
  } : { android, app: read("values") };
174897
174983
  }
174898
174984
  function valuesFiles(moduleDir, qualifier) {
174899
- const values = import_node_path199.default.join(moduleDir, "src/main/res", qualifier);
174900
- return import_node_fs198.default.existsSync(values) ? import_node_fs198.default.readdirSync(values).filter((entry) => entry.endsWith(".xml")).map((entry) => {
174901
- const file = import_node_path199.default.join(values, entry);
174902
- return { file, text: import_node_fs198.default.readFileSync(file, "utf8") };
174985
+ const values = import_node_path200.default.join(moduleDir, "src/main/res", qualifier);
174986
+ return import_node_fs199.default.existsSync(values) ? import_node_fs199.default.readdirSync(values).filter((entry) => entry.endsWith(".xml")).map((entry) => {
174987
+ const file = import_node_path200.default.join(values, entry);
174988
+ return { file, text: import_node_fs199.default.readFileSync(file, "utf8") };
174903
174989
  }) : [];
174904
174990
  }
174905
174991
  function readAppColors(moduleDir, theme) {
174906
- const res = import_node_path199.default.join(moduleDir, "src/main/res");
174907
- for (const dir of import_node_fs198.default.existsSync(res) ? import_node_fs198.default.readdirSync(res).sort() : []) {
174992
+ const res = import_node_path200.default.join(moduleDir, "src/main/res");
174993
+ for (const dir of import_node_fs199.default.existsSync(res) ? import_node_fs199.default.readdirSync(res).sort() : []) {
174908
174994
  if (!dir.startsWith("values") || dir === "values" || dir === "values-night") continue;
174909
174995
  const colors = Object.keys(readResourceValues(valuesFiles(moduleDir, dir)).colors);
174910
174996
  if (colors.length > 0)
@@ -174976,17 +175062,17 @@ function isLauncher(element) {
174976
175062
  );
174977
175063
  }
174978
175064
  async function readKotlinApp(moduleArg, options2) {
174979
- const moduleDir = import_node_fs198.default.realpathSync(import_node_path199.default.resolve(moduleArg));
174980
- const manifestFile = import_node_path199.default.join(moduleDir, "src/main/AndroidManifest.xml");
174981
- if (!import_node_fs198.default.existsSync(manifestFile))
175065
+ const moduleDir = import_node_fs199.default.realpathSync(import_node_path200.default.resolve(moduleArg));
175066
+ const manifestFile = import_node_path200.default.join(moduleDir, "src/main/AndroidManifest.xml");
175067
+ if (!import_node_fs199.default.existsSync(manifestFile))
174982
175068
  throw new Error(
174983
175069
  `${moduleDir} is not an Android app module: no src/main/AndroidManifest.xml`
174984
175070
  );
174985
175071
  let projectDir = moduleDir;
174986
175072
  while (!["settings.gradle.kts", "settings.gradle"].some(
174987
- (name3) => import_node_fs198.default.existsSync(import_node_path199.default.join(projectDir, name3))
175073
+ (name3) => import_node_fs199.default.existsSync(import_node_path200.default.join(projectDir, name3))
174988
175074
  )) {
174989
- const parent = import_node_path199.default.dirname(projectDir);
175075
+ const parent = import_node_path200.default.dirname(projectDir);
174990
175076
  if (parent === projectDir)
174991
175077
  throw new Error(`${moduleDir} has no settings.gradle above it`);
174992
175078
  projectDir = parent;
@@ -175029,7 +175115,7 @@ async function readKotlinApp(moduleArg, options2) {
175029
175115
  const language = /^(\d+)\.(\d+)/.exec(kotlin)?.slice(1, 3).join(".");
175030
175116
  if (!language)
175031
175117
  throw new Error(`Kotlin plugin version ${kotlin} names no language version`);
175032
- const manifest = parseXml(import_node_fs198.default.readFileSync(manifestFile, "utf8"), manifestFile);
175118
+ const manifest = parseXml(import_node_fs199.default.readFileSync(manifestFile, "utf8"), manifestFile);
175033
175119
  const root = manifest.children.find((element) => element.name === "manifest");
175034
175120
  const application = root?.children.find((element) => element.name === "application");
175035
175121
  if (!root || !application) throw new Error(`${manifestFile} has no <application>`);
@@ -175123,11 +175209,11 @@ async function readKotlinApp(moduleArg, options2) {
175123
175209
  const sources = selected ? selected.kotlin : [];
175124
175210
  if (!selected)
175125
175211
  for (const set2 of ["java", "kotlin"]) {
175126
- const dir = import_node_path199.default.join(moduleDir, "src/main", set2);
175127
- if (!import_node_fs198.default.existsSync(dir)) continue;
175212
+ const dir = import_node_path200.default.join(moduleDir, "src/main", set2);
175213
+ if (!import_node_fs199.default.existsSync(dir)) continue;
175128
175214
  const walk4 = (current2) => {
175129
- for (const entry of import_node_fs198.default.readdirSync(current2, { withFileTypes: true })) {
175130
- const full = import_node_path199.default.join(current2, entry.name);
175215
+ for (const entry of import_node_fs199.default.readdirSync(current2, { withFileTypes: true })) {
175216
+ const full = import_node_path200.default.join(current2, entry.name);
175131
175217
  if (entry.isDirectory()) walk4(full);
175132
175218
  else if (entry.name.endsWith(".java"))
175133
175219
  throw new Error(`${full}: Java sources are not supported by peach open`);
@@ -175173,12 +175259,12 @@ async function readKotlinApp(moduleArg, options2) {
175173
175259
  layoutIds: readAndroidLayoutIds(moduleDir)
175174
175260
  };
175175
175261
  }
175176
- var import_node_fs198, import_node_path199, ANDROID_NS, MAIN, LAUNCHER, PLUGINS, PLATFORM_GROUPS, PLATFORM_ARTIFACTS, ANDROID_PIN;
175262
+ var import_node_fs199, import_node_path200, ANDROID_NS, MAIN, LAUNCHER, PLUGINS, PLATFORM_GROUPS, PLATFORM_ARTIFACTS, ANDROID_PIN;
175177
175263
  var init_kotlin_app = __esm({
175178
175264
  "src/kotlin-app.ts"() {
175179
175265
  "use strict";
175180
- import_node_fs198 = __toESM(require("node:fs"), 1);
175181
- import_node_path199 = __toESM(require("node:path"), 1);
175266
+ import_node_fs199 = __toESM(require("node:fs"), 1);
175267
+ import_node_path200 = __toESM(require("node:path"), 1);
175182
175268
  init_android_drawables();
175183
175269
  init_android_layout_ids();
175184
175270
  init_android_strings();
@@ -175230,24 +175316,24 @@ __export(native_input_exports, {
175230
175316
  });
175231
175317
  function resolveNativeInput(target) {
175232
175318
  if (!target || /^\w+:\/\//.test(target) || /^\d+$/.test(target)) return null;
175233
- const resolved = import_node_path200.default.resolve(target);
175234
- const stat2 = import_node_fs199.default.statSync(resolved, { throwIfNoEntry: false });
175319
+ const resolved = import_node_path201.default.resolve(target);
175320
+ const stat2 = import_node_fs200.default.statSync(resolved, { throwIfNoEntry: false });
175235
175321
  if (!stat2) return null;
175236
175322
  if (stat2.isFile()) {
175237
- if (resolved.endsWith(".swift") && import_node_path200.default.basename(resolved) !== "Package.swift")
175238
- return { kind: "swift-file", path: import_node_fs199.default.realpathSync(resolved) };
175239
- if (import_node_path200.default.basename(resolved) === "Package.swift")
175240
- return { kind: "swift-package", path: import_node_fs199.default.realpathSync(import_node_path200.default.dirname(resolved)) };
175323
+ if (resolved.endsWith(".swift") && import_node_path201.default.basename(resolved) !== "Package.swift")
175324
+ return { kind: "swift-file", path: import_node_fs200.default.realpathSync(resolved) };
175325
+ if (import_node_path201.default.basename(resolved) === "Package.swift")
175326
+ return { kind: "swift-package", path: import_node_fs200.default.realpathSync(import_node_path201.default.dirname(resolved)) };
175241
175327
  return null;
175242
175328
  }
175243
175329
  if (!stat2.isDirectory()) return null;
175244
- if (import_node_fs199.default.existsSync(import_node_path200.default.join(resolved, "Package.swift")))
175245
- return { kind: "swift-package", path: import_node_fs199.default.realpathSync(resolved) };
175330
+ if (import_node_fs200.default.existsSync(import_node_path201.default.join(resolved, "Package.swift")))
175331
+ return { kind: "swift-package", path: import_node_fs200.default.realpathSync(resolved) };
175246
175332
  const xcode = findXcodeProject(resolved);
175247
- if (xcode) return { kind: "xcode", path: import_node_fs199.default.realpathSync(xcode) };
175248
- if (import_node_fs199.default.existsSync(import_node_path200.default.join(resolved, "src/main/AndroidManifest.xml")))
175249
- return { kind: "kotlin", path: import_node_fs199.default.realpathSync(resolved) };
175250
- if (!import_node_fs199.default.existsSync(import_node_path200.default.join(resolved, "package.json")) && import_node_fs199.default.readdirSync(resolved).some((name3) => name3.endsWith(".swift")))
175333
+ if (xcode) return { kind: "xcode", path: import_node_fs200.default.realpathSync(xcode) };
175334
+ if (import_node_fs200.default.existsSync(import_node_path201.default.join(resolved, "src/main/AndroidManifest.xml")))
175335
+ return { kind: "kotlin", path: import_node_fs200.default.realpathSync(resolved) };
175336
+ if (!import_node_fs200.default.existsSync(import_node_path201.default.join(resolved, "package.json")) && import_node_fs200.default.readdirSync(resolved).some((name3) => name3.endsWith(".swift")))
175251
175337
  throw new Error(
175252
175338
  `${target} holds Swift files but no Package.swift or Xcode project; open one .swift file, a Swift package, or an Xcode project`
175253
175339
  );
@@ -175279,7 +175365,7 @@ async function prepareSwiftInput(input, opts = {}) {
175279
175365
  module2?.root,
175280
175366
  configuration
175281
175367
  ) : input.path;
175282
- const name3 = input.kind === "swift-file" ? import_node_path200.default.basename(input.path, ".swift") : import_node_path200.default.basename(packagePath);
175368
+ const name3 = input.kind === "swift-file" ? import_node_path201.default.basename(input.path, ".swift") : import_node_path201.default.basename(packagePath);
175283
175369
  const appProject = resolveAppProject(packagePath);
175284
175370
  let appInfo;
175285
175371
  try {
@@ -175344,7 +175430,7 @@ async function prepareNativeInput(input, opts) {
175344
175430
  const metadata = await host2.kotlinAppArtifact(project2, moduleRoot, opts.origin);
175345
175431
  const prefix = new URL(metadata.url).pathname.slice(0, -"app.mjs".length);
175346
175432
  return {
175347
- name: import_node_path200.default.basename(project2.projectDir),
175433
+ name: import_node_path201.default.basename(project2.projectDir),
175348
175434
  guestSource: kotlinGuestBundle(),
175349
175435
  guestPath: KOTLIN_GUEST_PATH,
175350
175436
  metadataPath: KOTLIN_PACKAGE_PATH,
@@ -175381,12 +175467,12 @@ async function prepareNativeInput(input, opts) {
175381
175467
  throw error;
175382
175468
  }
175383
175469
  }
175384
- var import_node_fs199, import_node_path200;
175470
+ var import_node_fs200, import_node_path201;
175385
175471
  var init_native_input = __esm({
175386
175472
  "cli/native-input.ts"() {
175387
175473
  "use strict";
175388
- import_node_fs199 = __toESM(require("node:fs"), 1);
175389
- import_node_path200 = __toESM(require("node:path"), 1);
175474
+ import_node_fs200 = __toESM(require("node:fs"), 1);
175475
+ import_node_path201 = __toESM(require("node:path"), 1);
175390
175476
  init_kotlinDiscoveryContract();
175391
175477
  init_swiftDiscoveryContract();
175392
175478
  init_app_config();
@@ -175529,7 +175615,7 @@ async function runKotlin(args, opts = {}) {
175529
175615
  throw new Error(`unknown peach open flag for an Android app: ${arg}`);
175530
175616
  else if (modulePath)
175531
175617
  throw new Error("peach open expects one Android app module directory");
175532
- else modulePath = import_node_path201.default.resolve(arg);
175618
+ else modulePath = import_node_path202.default.resolve(arg);
175533
175619
  }
175534
175620
  if (!modulePath) throw new Error("usage: peach open <android-app-module>");
175535
175621
  const device = opts.device ?? opts.openArgs?.find((_, index) => opts.openArgs?.[index - 1] === "--device") ?? DEFAULT_DEVICE_BY_PLATFORM.android;
@@ -175552,7 +175638,7 @@ async function runKotlin(args, opts = {}) {
175552
175638
  let origin = "";
175553
175639
  let artifact;
175554
175640
  let compileError = "Kotlin compilation is starting";
175555
- const projectName = import_node_path201.default.basename(project2.projectDir);
175641
+ const projectName = import_node_path202.default.basename(project2.projectDir);
175556
175642
  const routes2 = () => ({
175557
175643
  root: project2.projectDir,
175558
175644
  moduleRoot,
@@ -175677,7 +175763,7 @@ async function runKotlin(args, opts = {}) {
175677
175763
  });
175678
175764
  console.log(` Kotlin app: ${project2.launcher.name} in ${project2.moduleDir}`);
175679
175765
  console.log(` Kotlin preview host: ${origin}`);
175680
- watcher = import_node_fs200.default.watch(project2.projectDir, { recursive: true }, (_event, file) => {
175766
+ watcher = import_node_fs201.default.watch(project2.projectDir, { recursive: true }, (_event, file) => {
175681
175767
  if (file && file.split(/[\\/]/).some((segment2) => segment2 === "build" || segment2.startsWith(".")))
175682
175768
  return;
175683
175769
  void rebuild();
@@ -175733,13 +175819,13 @@ async function runKotlin(args, opts = {}) {
175733
175819
  }
175734
175820
  return code;
175735
175821
  }
175736
- var import_node_fs200, import_node_http5, import_node_path201, import_ws6, HMR_PATH;
175822
+ var import_node_fs201, import_node_http5, import_node_path202, import_ws6, HMR_PATH;
175737
175823
  var init_kotlin = __esm({
175738
175824
  "cli/commands/kotlin.ts"() {
175739
175825
  "use strict";
175740
- import_node_fs200 = __toESM(require("node:fs"), 1);
175826
+ import_node_fs201 = __toESM(require("node:fs"), 1);
175741
175827
  import_node_http5 = __toESM(require("node:http"), 1);
175742
- import_node_path201 = __toESM(require("node:path"), 1);
175828
+ import_node_path202 = __toESM(require("node:path"), 1);
175743
175829
  init_kotlinDiscoveryContract();
175744
175830
  import_ws6 = require("peachsim/vendor/ws");
175745
175831
  init_device_catalog();
@@ -175803,7 +175889,7 @@ async function runSwift(args, opts = {}) {
175803
175889
  const value = input[++index];
175804
175890
  if (!value || value.startsWith("-"))
175805
175891
  throw new Error("--swift-sdks-path requires a value");
175806
- process.env.PEACH_SWIFT_SDKS_PATH = import_node_path202.default.resolve(value);
175892
+ process.env.PEACH_SWIFT_SDKS_PATH = import_node_path203.default.resolve(value);
175807
175893
  } else if (arg === "--host-port" || valueFlags.has(arg)) {
175808
175894
  const value = input[++index];
175809
175895
  if (!value || value.startsWith("-")) throw new Error(`${arg} requires a value`);
@@ -175817,7 +175903,7 @@ async function runSwift(args, opts = {}) {
175817
175903
  else if (arg.startsWith("-"))
175818
175904
  throw new Error(`unknown peach open flag for a Swift app: ${arg}`);
175819
175905
  else if (packagePath) throw new Error("peach open expects one project");
175820
- else packagePath = import_node_path202.default.resolve(arg);
175906
+ else packagePath = import_node_path203.default.resolve(arg);
175821
175907
  }
175822
175908
  if (!packagePath) {
175823
175909
  throw new Error(
@@ -176031,7 +176117,7 @@ async function runSwift(args, opts = {}) {
176031
176117
  code = 1;
176032
176118
  stop2();
176033
176119
  });
176034
- watcher = import_node_fs201.default.watch(
176120
+ watcher = import_node_fs202.default.watch(
176035
176121
  nativeInput.kind === "swift-file" ? nativeInput.path : packagePath,
176036
176122
  { recursive: nativeInput.kind !== "swift-file" },
176037
176123
  (_event, file) => {
@@ -176100,13 +176186,13 @@ async function runSwift(args, opts = {}) {
176100
176186
  }
176101
176187
  return code;
176102
176188
  }
176103
- var import_node_fs201, import_node_http6, import_node_path202, import_node_util24, import_node_zlib12, import_ws7, compressMetadata;
176189
+ var import_node_fs202, import_node_http6, import_node_path203, import_node_util24, import_node_zlib12, import_ws7, compressMetadata;
176104
176190
  var init_swift2 = __esm({
176105
176191
  "cli/commands/swift.ts"() {
176106
176192
  "use strict";
176107
- import_node_fs201 = __toESM(require("node:fs"), 1);
176193
+ import_node_fs202 = __toESM(require("node:fs"), 1);
176108
176194
  import_node_http6 = __toESM(require("node:http"), 1);
176109
- import_node_path202 = __toESM(require("node:path"), 1);
176195
+ import_node_path203 = __toESM(require("node:path"), 1);
176110
176196
  import_node_util24 = require("node:util");
176111
176197
  import_node_zlib12 = require("node:zlib");
176112
176198
  init_swiftDiscoveryContract();
@@ -176318,11 +176404,11 @@ async function connectBridgeForOpen(preferredPort, explicitPort, resources, runt
176318
176404
  );
176319
176405
  }
176320
176406
  const { executable, prefixArgs } = rnxSelfInvocation();
176321
- const bridgeLogPath = import_node_path203.default.join(
176407
+ const bridgeLogPath = import_node_path204.default.join(
176322
176408
  import_node_os37.default.tmpdir(),
176323
176409
  `peach-bridge-${Date.now()}-${process.pid}.log`
176324
176410
  );
176325
- const bridgeLogFd = import_node_fs202.default.openSync(bridgeLogPath, "a");
176411
+ const bridgeLogFd = import_node_fs203.default.openSync(bridgeLogPath, "a");
176326
176412
  let child;
176327
176413
  try {
176328
176414
  child = (0, import_node_child_process79.spawn)(
@@ -176336,7 +176422,7 @@ async function connectBridgeForOpen(preferredPort, explicitPort, resources, runt
176336
176422
  }
176337
176423
  );
176338
176424
  } finally {
176339
- import_node_fs202.default.closeSync(bridgeLogFd);
176425
+ import_node_fs203.default.closeSync(bridgeLogFd);
176340
176426
  }
176341
176427
  if (resources) {
176342
176428
  resources.bridge = child;
@@ -176378,7 +176464,7 @@ async function connectBridgeForOpen(preferredPort, explicitPort, resources, runt
176378
176464
  await sleep2(Math.max(0, Math.min(150, deadline - Date.now())));
176379
176465
  }
176380
176466
  const reason = childExit ? `peach bridge exited before becoming ready (exit ${childExit})` : `peach bridge did not start within ${Math.round(OPEN_BRIDGE_SPAWN_TIMEOUT_MS / 1e3)}s`;
176381
- const bridgeLog = import_node_fs202.default.readFileSync(bridgeLogPath, "utf8").trim().slice(-2e3);
176467
+ const bridgeLog = import_node_fs203.default.readFileSync(bridgeLogPath, "utf8").trim().slice(-2e3);
176382
176468
  throw new Error(
176383
176469
  `${reason}${bridgeLog ? `
176384
176470
  ${bridgeLog}` : ""}
@@ -176390,8 +176476,8 @@ async function retireOutdatedIdleBridge(lock) {
176390
176476
  const current2 = getCliVersion();
176391
176477
  if (isSootsimDevCheckout() || lock.cliVersion === current2) return;
176392
176478
  if (lock.cliVersion && compareSemver(current2, lock.cliVersion) <= 0) return;
176393
- const appRecord = import_node_path203.default.join(rnxHomeDir(), "app-runtime.json");
176394
- if (import_node_fs202.default.existsSync(appRecord)) return;
176479
+ const appRecord = import_node_path204.default.join(rnxHomeDir(), "app-runtime.json");
176480
+ if (import_node_fs203.default.existsSync(appRecord)) return;
176395
176481
  const bridge = createBridge(lock.bridgePort, { commandTimeoutMs: 2e3 });
176396
176482
  const simCount = await bridge.listSims({ includeRetained: true }).then(
176397
176483
  (sims) => sims.length,
@@ -176417,31 +176503,31 @@ function isolateHomeForExplicitPort(preferredPort, explicitPort, lock) {
176417
176503
  return;
176418
176504
  }
176419
176505
  const sharedRuntimes = runtimesDir();
176420
- const home = import_node_path203.default.join(rnxHomeDir(), "port-homes", String(preferredPort));
176506
+ const home = import_node_path204.default.join(rnxHomeDir(), "port-homes", String(preferredPort));
176421
176507
  activatePeachHome(home);
176422
- const runtimes = import_node_path203.default.join(home, "runtimes");
176508
+ const runtimes = import_node_path204.default.join(home, "runtimes");
176423
176509
  if (resolveDevCheckoutRuntimeRoot()) {
176424
176510
  removePortHomeSharedRuntimesLink(runtimes, sharedRuntimes);
176425
- } else if (import_node_fs202.default.existsSync(sharedRuntimes) && !import_node_fs202.default.existsSync(runtimes)) {
176426
- import_node_fs202.default.symlinkSync(sharedRuntimes, runtimes);
176511
+ } else if (import_node_fs203.default.existsSync(sharedRuntimes) && !import_node_fs203.default.existsSync(runtimes)) {
176512
+ import_node_fs203.default.symlinkSync(sharedRuntimes, runtimes);
176427
176513
  }
176428
176514
  process.env[PEACH_HOME_ENV] = home;
176429
176515
  }
176430
176516
  function removePortHomeSharedRuntimesLink(runtimes, sharedRuntimes) {
176431
176517
  let stat2;
176432
176518
  try {
176433
- stat2 = import_node_fs202.default.lstatSync(runtimes);
176519
+ stat2 = import_node_fs203.default.lstatSync(runtimes);
176434
176520
  } catch {
176435
176521
  return;
176436
176522
  }
176437
176523
  if (!stat2.isSymbolicLink()) return;
176438
176524
  let target;
176439
176525
  try {
176440
- target = import_node_path203.default.resolve(import_node_path203.default.dirname(runtimes), import_node_fs202.default.readlinkSync(runtimes));
176526
+ target = import_node_path204.default.resolve(import_node_path204.default.dirname(runtimes), import_node_fs203.default.readlinkSync(runtimes));
176441
176527
  } catch {
176442
176528
  return;
176443
176529
  }
176444
- if (target === sharedRuntimes) import_node_fs202.default.unlinkSync(runtimes);
176530
+ if (target === sharedRuntimes) import_node_fs203.default.unlinkSync(runtimes);
176445
176531
  }
176446
176532
  async function ensureRuntimeForOpen() {
176447
176533
  if (resolveDevCheckoutRuntimeRoot()) return;
@@ -176451,12 +176537,12 @@ async function ensureRuntimeForOpen() {
176451
176537
  );
176452
176538
  }
176453
176539
  const active = readActiveRuntime();
176454
- if (active && import_node_fs202.default.existsSync(import_node_path203.default.join(runtimeDir(active), "index.html"))) {
176540
+ if (active && import_node_fs203.default.existsSync(import_node_path204.default.join(runtimeDir(active), "index.html"))) {
176455
176541
  await ensureCliCompanion(peachRuntimeRoot());
176456
176542
  return;
176457
176543
  }
176458
176544
  const directory2 = runtimesDir();
176459
- if (import_node_fs202.default.existsSync(directory2) && import_node_fs202.default.readdirSync(directory2).length > 0) {
176545
+ if (import_node_fs203.default.existsSync(directory2) && import_node_fs203.default.readdirSync(directory2).length > 0) {
176460
176546
  throw new Error(
176461
176547
  "peach open: runtime staging or selection is incomplete. finish staging and select the runtime with peach runtime use <version> before opening."
176462
176548
  );
@@ -176542,11 +176628,11 @@ async function readSimDevice(bridge, simId) {
176542
176628
  }
176543
176629
  function prebuiltBundleFile(target) {
176544
176630
  if (!/\.(js|bundle|jsbundle)$/i.test(target)) return null;
176545
- const file = import_node_path203.default.resolve(process.cwd(), target);
176546
- return import_node_fs202.default.statSync(file, { throwIfNoEntry: false })?.isFile() ? file : null;
176631
+ const file = import_node_path204.default.resolve(process.cwd(), target);
176632
+ return import_node_fs203.default.statSync(file, { throwIfNoEntry: false })?.isFile() ? file : null;
176547
176633
  }
176548
176634
  async function stagePrebuiltBundle(file, bridgePort, prepareSource) {
176549
- const bytes = import_node_fs202.default.readFileSync(file);
176635
+ const bytes = import_node_fs203.default.readFileSync(file);
176550
176636
  const source = bytes.toString("utf8");
176551
176637
  const mode = await detectBundleModeFromText(source);
176552
176638
  if (!mode) {
@@ -176559,14 +176645,14 @@ async function stagePrebuiltBundle(file, bridgePort, prepareSource) {
176559
176645
  const { stageMetroBundleAssets: stageMetroBundleAssets2 } = await Promise.resolve().then(() => (init_metro_bundle_assets(), metro_bundle_assets_exports));
176560
176646
  await stageMetroBundleAssets2(file, source, origin);
176561
176647
  const url = new URL(
176562
- prepareSource ? stageHostBytes(encoded(await prepareSource(source)), origin, import_node_path203.default.extname(file)) : (
176648
+ prepareSource ? stageHostBytes(encoded(await prepareSource(source)), origin, import_node_path204.default.extname(file)) : (
176563
176649
  // the inventory parse costs seconds on a large bundle; the companion
176564
176650
  // that wrote it identifies the output
176565
176651
  await stageHostDerivedBytes(
176566
176652
  bytes,
176567
176653
  cliCompanionPath(),
176568
176654
  origin,
176569
- import_node_path203.default.extname(file),
176655
+ import_node_path204.default.extname(file),
176570
176656
  async () => encoded(
176571
176657
  await getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleHttpPayload(
176572
176658
  source,
@@ -176581,10 +176667,10 @@ async function stagePrebuiltBundle(file, bridgePort, prepareSource) {
176581
176667
  }
176582
176668
  function normalizeReplacementPath(filePath) {
176583
176669
  if (filePath.startsWith("~/")) {
176584
- return import_node_path203.default.join(import_node_os37.default.homedir(), filePath.slice(2));
176670
+ return import_node_path204.default.join(import_node_os37.default.homedir(), filePath.slice(2));
176585
176671
  }
176586
- if (import_node_path203.default.isAbsolute(filePath)) return filePath;
176587
- return import_node_path203.default.resolve(process.cwd(), filePath);
176672
+ if (import_node_path204.default.isAbsolute(filePath)) return filePath;
176673
+ return import_node_path204.default.resolve(process.cwd(), filePath);
176588
176674
  }
176589
176675
  function parseOpenRuntimeConfig(args) {
176590
176676
  const modules = {};
@@ -176603,7 +176689,7 @@ function parseOpenRuntimeConfig(args) {
176603
176689
  }
176604
176690
  const moduleName2 = raw2.slice(0, eqIndex).trim();
176605
176691
  const filePath = normalizeReplacementPath(raw2.slice(eqIndex + 1).trim());
176606
- if (!import_node_fs202.default.existsSync(filePath)) {
176692
+ if (!import_node_fs203.default.existsSync(filePath)) {
176607
176693
  console.error(` peach open: replacement file not found: ${filePath}`);
176608
176694
  peachExit(1);
176609
176695
  }
@@ -176629,7 +176715,7 @@ function parseOpenRuntimeConfig(args) {
176629
176715
  return config.modules || config.network ? config : void 0;
176630
176716
  }
176631
176717
  async function ensureConfiguredRuntime(version2) {
176632
- if (import_node_fs202.default.existsSync(import_node_path203.default.join(runtimeDir(version2), "index.html"))) return;
176718
+ if (import_node_fs203.default.existsSync(import_node_path204.default.join(runtimeDir(version2), "index.html"))) return;
176633
176719
  console.error(` installing configured engine runtime ${version2}...`);
176634
176720
  const result = await rnxRuntime.install({
176635
176721
  version: version2,
@@ -176711,7 +176797,7 @@ async function waitForSimMatchOrHostExit(wsPort, commandTimeoutMs, predicate, ho
176711
176797
  const watchHost = !!hostPid && Number.isInteger(hostPid) && hostPid > 1;
176712
176798
  const hostExited = () => watchHost && hostPid !== void 0 && !isProcessRunning(hostPid);
176713
176799
  if (opts.admittedFile && watchHost) {
176714
- while (!import_node_fs202.default.existsSync(opts.admittedFile)) {
176800
+ while (!import_node_fs203.default.existsSync(opts.admittedFile)) {
176715
176801
  opts.signal?.throwIfAborted();
176716
176802
  if (hostExited()) return { kind: "host-exit" };
176717
176803
  await sleep2(intervalMs);
@@ -176771,7 +176857,7 @@ function playwrightHostPidForSim(sim) {
176771
176857
  function signalDriverLaunchConnected(result) {
176772
176858
  if (!result.connectAckFile) return false;
176773
176859
  try {
176774
- import_node_fs202.default.writeFileSync(
176860
+ import_node_fs203.default.writeFileSync(
176775
176861
  result.connectAckFile,
176776
176862
  `${JSON.stringify({ connectedAt: Date.now(), pid: result.pid ?? null })}
176777
176863
  `,
@@ -176785,7 +176871,7 @@ function signalDriverLaunchConnected(result) {
176785
176871
  function readUnservedUrl(result) {
176786
176872
  if (!result.diagnosticLogPath) return null;
176787
176873
  try {
176788
- const detail = import_node_fs202.default.readFileSync(result.diagnosticLogPath, "utf8");
176874
+ const detail = import_node_fs203.default.readFileSync(result.diagnosticLogPath, "utf8");
176789
176875
  const match = detail.match(/\[unserved\] nothing serves (\S+)/);
176790
176876
  return match ? match[1] : null;
176791
176877
  } catch {
@@ -176795,14 +176881,14 @@ function readUnservedUrl(result) {
176795
176881
  function printDriverDiagnosticLogTail(result) {
176796
176882
  if (!result.diagnosticLogPath) return;
176797
176883
  try {
176798
- const detail = import_node_fs202.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
176884
+ const detail = import_node_fs203.default.readFileSync(result.diagnosticLogPath, "utf8").trim();
176799
176885
  if (!detail) {
176800
- console.error(` ${import_node_path203.default.basename(result.diagnosticLogPath)} was empty`);
176886
+ console.error(` ${import_node_path204.default.basename(result.diagnosticLogPath)} was empty`);
176801
176887
  return;
176802
176888
  }
176803
176889
  const shown = detail.length > 4e3 ? `\u2026
176804
176890
  ${detail.slice(-4e3)}` : detail;
176805
- console.error(` ${import_node_path203.default.basename(result.diagnosticLogPath)}:`);
176891
+ console.error(` ${import_node_path204.default.basename(result.diagnosticLogPath)}:`);
176806
176892
  console.error(shown);
176807
176893
  if (/No usable sandbox/i.test(detail)) {
176808
176894
  console.error(
@@ -176812,7 +176898,7 @@ ${detail.slice(-4e3)}` : detail;
176812
176898
  } catch (err) {
176813
176899
  const message = err instanceof Error ? err.message : String(err);
176814
176900
  console.error(
176815
- ` failed to read ${import_node_path203.default.basename(result.diagnosticLogPath)}: ${message}`
176901
+ ` failed to read ${import_node_path204.default.basename(result.diagnosticLogPath)}: ${message}`
176816
176902
  );
176817
176903
  }
176818
176904
  }
@@ -176827,7 +176913,7 @@ async function waitForProcessExit(pid, timeoutMs = 2500) {
176827
176913
  function isPlaywrightHostProcess(pid) {
176828
176914
  if (process.platform === "linux") {
176829
176915
  try {
176830
- return import_node_fs202.default.readFileSync(`/proc/${pid}/environ`, "utf8").split("\0").some((entry) => entry.startsWith("SOOTSIM_PW_URL="));
176916
+ return import_node_fs203.default.readFileSync(`/proc/${pid}/environ`, "utf8").split("\0").some((entry) => entry.startsWith("SOOTSIM_PW_URL="));
176831
176917
  } catch {
176832
176918
  return false;
176833
176919
  }
@@ -178236,17 +178322,17 @@ async function runCloseCommand(args, opts = {}) {
178236
178322
  bridge.close();
178237
178323
  }
178238
178324
  }
178239
- var import_node_child_process79, import_node_fs202, import_node_http7, import_node_https3, import_node_net, import_node_os37, import_node_path203, import_ws8, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, OPEN_BRIDGE_RUNTIME_TIMEOUT_MS, OPEN_BRIDGE_HEALTH_TIMEOUT_MS, OPEN_BRIDGE_SILENCE_MS, LIVE_BRIDGE_HANDSHAKE_TIMEOUT_MS;
178325
+ var import_node_child_process79, import_node_fs203, import_node_http7, import_node_https3, import_node_net, import_node_os37, import_node_path204, import_ws8, DEFAULT_DRIVER_CONNECT_TIMEOUT_MS, DRIVER_CONNECT_INTERVAL_MS, DRIVER_CONNECT_HOST_GRACE_MS, OPEN_BRIDGE_SPAWN_TIMEOUT_MS, OPEN_BRIDGE_RUNTIME_TIMEOUT_MS, OPEN_BRIDGE_HEALTH_TIMEOUT_MS, OPEN_BRIDGE_SILENCE_MS, LIVE_BRIDGE_HANDSHAKE_TIMEOUT_MS;
178240
178326
  var init_control = __esm({
178241
178327
  "cli/commands/control.ts"() {
178242
178328
  "use strict";
178243
178329
  import_node_child_process79 = require("node:child_process");
178244
- import_node_fs202 = __toESM(require("node:fs"), 1);
178330
+ import_node_fs203 = __toESM(require("node:fs"), 1);
178245
178331
  import_node_http7 = __toESM(require("node:http"), 1);
178246
178332
  import_node_https3 = __toESM(require("node:https"), 1);
178247
178333
  import_node_net = __toESM(require("node:net"), 1);
178248
178334
  import_node_os37 = __toESM(require("node:os"), 1);
178249
- import_node_path203 = __toESM(require("node:path"), 1);
178335
+ import_node_path204 = __toESM(require("node:path"), 1);
178250
178336
  init_src();
178251
178337
  init_src2();
178252
178338
  init_androidAutolinkingContract();