@camstack/system 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
2
1
  import { a as downloadModel, c as getModelFilePath, d as contentTypeFor, f as createAuthenticatedFileServer, h as resolveFilePath, i as downloadFile, l as isModelDownloaded, m as parseTokenizedUrl, n as collectModelFiles, o as ensureModel, p as parseRangeHeader, r as deleteModelFromDisk, s as fetchJson, t as ModelDownloadService, u as createFileDataPlaneHandler } from "./model-download-service-C-IHWnXx.mjs";
3
- import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-BkP504Vq.mjs";
2
+ import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Le3l0qS2.mjs";
4
3
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
5
4
  import { SqliteSettingsAddon, t as SqliteSettingsBackend } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
6
5
  import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
@@ -15,34 +14,34 @@ import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
15
14
  import "./builtins/alerts/index.mjs";
16
15
  import { SystemConfigAddon } from "./builtins/system-config/system-config.addon.mjs";
17
16
  import "./builtins/system-config/index.mjs";
18
- import { LocalAuthAddon, a as require_safe_buffer, i as AuthManager, n as ApiKeyManager, r as UserManager, t as ScopedTokenManager } from "./builtins/local-auth/local-auth.addon.mjs";
17
+ import { LocalAuthAddon, a as require_ms, c as __esmMin, d as __toCommonJS, f as __toESM$1, i as AuthManager, l as __exportAll, n as ApiKeyManager, o as require_safe_buffer, r as UserManager, s as __commonJSMin$1, t as ScopedTokenManager, u as __require } from "./builtins/local-auth/local-auth.addon.mjs";
19
18
  import "./builtins/local-auth/index.mjs";
20
19
  import { DeviceManagerAddon } from "./builtins/device-manager/device-manager.addon.mjs";
21
20
  import "./builtins/device-manager/index.mjs";
22
- import { A as createUdsLoggerWithControl, B as createLocalTransport, C as ipcParentLink, D as createUdsEventBus, E as createUdsEventBridge, F as AGENT_CAP_FWD_SERVICE, G as FrameDecoder, H as UdsLocalTransportServer, I as CapRouteResolver, J as buildUdsNativeCapProxy, K as encodeFrame, L as CapRouteError, M as LocalChildRegistry, N as UDS_NO_ROUTE_PREFIX, O as udsChildLogToWorkerEntry, P as AGENT_CAP_FWD_ACTION, Q as mountNativeCapService, R as classifyCapRoute, S as ipcChildLink, T as createParentUnownedCallHandler, U as SocketChannel, V as UdsLocalTransportClient, W as localEndpointPath, Y as createBrokerDeviceManagerApi, _ as __resetCapUsageRegistryForTests, a as getWorkerDeviceRegistry, at as capBareAction, b as brokerTransportLink, c as setHubConnected, ct as deserializeTypedArrays, d as registerEventBusService, dt as CapabilityHandle, et as createAddonService, f as AddonDepsManager, ft as CapabilityUnavailableError, g as CapUsageRegistry, h as createHwAccelService, i as createUdsAddonContext, it as capActionSuffix, j as LocalChildClient, k as createUdsLogger, l as EVENT_TOPIC_PREFIX, lt as serializeTypedArrays, m as resolveHwAccel, mt as resolveAddonClass, n as adaptBrokerToCluster, nt as NATIVE_PROVIDER_SERVICE_INFIX, o as getOrInitReadinessRegistry, ot as capServiceName, p as createKernelHwAccel, pt as installManifestNativeDeps, q as buildNativeCapProxy, r as createAddonContext, rt as capActionName, s as getOrInitReadinessRegistryForClient, st as parseCapAction, t as installManifestPythonDeps, tt as validateProviderRegistrations, u as getBrokerEventBus, ut as DeviceRegistry, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as callWithServiceDiscovery } from "./manifest-python-deps-i1IOGMpu.mjs";
21
+ import { A as createUdsLoggerWithControl, B as createLocalTransport, C as ipcParentLink, D as createUdsEventBus, E as createUdsEventBridge, F as AGENT_CAP_FWD_SERVICE, G as FrameDecoder, H as UdsLocalTransportServer, I as CapRouteResolver, J as buildUdsNativeCapProxy, K as encodeFrame, L as CapRouteError, M as LocalChildRegistry, N as UDS_NO_ROUTE_PREFIX, O as udsChildLogToWorkerEntry, P as AGENT_CAP_FWD_ACTION, Q as mountNativeCapService, R as classifyCapRoute, S as ipcChildLink, T as createParentUnownedCallHandler, U as SocketChannel, V as UdsLocalTransportClient, W as localEndpointPath, Y as createBrokerDeviceManagerApi, _ as __resetCapUsageRegistryForTests, a as getWorkerDeviceRegistry, at as capBareAction, b as brokerTransportLink, c as setHubConnected, ct as deserializeTypedArrays, d as registerEventBusService, dt as CapabilityHandle, et as createAddonService, f as AddonDepsManager, ft as CapabilityUnavailableError, g as CapUsageRegistry, h as createHwAccelService, i as createUdsAddonContext, it as capActionSuffix, j as LocalChildClient, k as createUdsLogger, l as EVENT_TOPIC_PREFIX, lt as serializeTypedArrays, m as resolveHwAccel, mt as resolveAddonClass, n as adaptBrokerToCluster, nt as NATIVE_PROVIDER_SERVICE_INFIX, o as getOrInitReadinessRegistry, ot as capServiceName, p as createKernelHwAccel, pt as installManifestNativeDeps, q as buildNativeCapProxy, r as createAddonContext, rt as capActionName, s as getOrInitReadinessRegistryForClient, st as parseCapAction, t as installManifestPythonDeps, tt as validateProviderRegistrations, u as getBrokerEventBus, ut as DeviceRegistry, v as getCapUsageRegistry, w as localProviderLink, x as buildLinkChain, y as brokerCallForCap, z as callWithServiceDiscovery } from "./manifest-python-deps-tH6H06_K.mjs";
23
22
  import { t as CustomActionRegistry } from "./custom-action-registry-BEXwC-oo.mjs";
24
- import { n as require_src, t as require_graceful_fs } from "./graceful-fs-BoR9GuPS.mjs";
25
23
  import { PYTHON_VERSION, buildBinaryPath, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
26
24
  import { request } from "node:http";
27
25
  import * as fs$17 from "node:fs";
28
26
  import { accessSync, constants, existsSync, mkdirSync, readFileSync } from "node:fs";
29
- import * as path$40 from "node:path";
27
+ import * as path$39 from "node:path";
30
28
  import { dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
31
29
  import { DATAPLANE_SECRET_HEADER, EventCategory, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, asJsonObject, asNumber, asString, createEvent, emitDownForOwnedCaps, errMsg, lifecycleJobSchema, parseJsonObject, parseJsonUnknown, readinessKey, scopeKey } from "@camstack/types";
32
30
  import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
33
31
  import { execFile, spawn } from "node:child_process";
34
- import * as util$8 from "node:util";
32
+ import * as util$10 from "node:util";
35
33
  import { promisify } from "node:util";
36
34
  import * as vm from "node:vm";
37
- import * as os$17 from "node:os";
35
+ import * as os$18 from "node:os";
38
36
  import { lstat, readdir, readlink, realpath } from "node:fs/promises";
39
37
  import { z } from "zod";
40
38
  import { asJsonObject as asJsonObject$1, parseJsonUnknown as parseJsonUnknown$1 } from "@camstack/types/addon";
41
- import { lstatSync, readdir as readdir$1, readdirSync, readlinkSync, realpathSync } from "fs";
42
39
  import { EventEmitter } from "node:events";
43
- import Pe from "node:stream";
40
+ import As from "node:stream";
44
41
  import { StringDecoder } from "node:string_decoder";
45
42
  import { fileURLToPath } from "node:url";
43
+ import { lstatSync, readdir as readdir$1, readdirSync, readlinkSync, realpathSync } from "fs";
44
+ import "path";
46
45
  import { createRequire } from "module";
47
46
  //#region src/events/event-bus.ts
48
47
  var EventBus = class {
@@ -182,7 +181,7 @@ var PythonEnvManager = class {
182
181
  venvPath;
183
182
  cachedProbe = null;
184
183
  constructor(dataDir) {
185
- this.venvPath = path$40.join(dataDir, ".venv");
184
+ this.venvPath = path$39.join(dataDir, ".venv");
186
185
  }
187
186
  async probe() {
188
187
  if (this.cachedProbe) return this.cachedProbe;
@@ -208,12 +207,12 @@ var PythonEnvManager = class {
208
207
  async ensure(options) {
209
208
  const probe = await this.probe();
210
209
  if (!probe.available || !probe.path) throw new Error("Python 3.10+ is required but not found on this system");
211
- if (!fs$17.existsSync(path$40.join(this.venvPath, "bin", "python"))) await execFileAsync$3(probe.path, [
210
+ if (!fs$17.existsSync(path$39.join(this.venvPath, "bin", "python"))) await execFileAsync$3(probe.path, [
212
211
  "-m",
213
212
  "venv",
214
213
  this.venvPath
215
214
  ]);
216
- const venvPython = path$40.join(this.venvPath, "bin", "python");
215
+ const venvPython = path$39.join(this.venvPath, "bin", "python");
217
216
  if (options.packages.length > 0) await execFileAsync$3(venvPython, [
218
217
  "-m",
219
218
  "pip",
@@ -230,7 +229,7 @@ var PythonEnvManager = class {
230
229
  };
231
230
  }
232
231
  spawn(script, args) {
233
- const venvPython = path$40.join(this.venvPath, "bin", "python");
232
+ const venvPython = path$39.join(this.venvPath, "bin", "python");
234
233
  if (!fs$17.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
235
234
  return spawn(venvPython, [script, ...args]);
236
235
  }
@@ -479,7 +478,7 @@ var ReplEngine = class {
479
478
  duration
480
479
  };
481
480
  return {
482
- output: util$8.inspect(result, {
481
+ output: util$10.inspect(result, {
483
482
  depth: 4,
484
483
  colors: false,
485
484
  maxArrayLength: 50,
@@ -518,8 +517,8 @@ var ReplEngine = class {
518
517
  async buildSandbox(context) {
519
518
  const base = {
520
519
  console: {
521
- log: (...args) => util$8.inspect(args),
522
- warn: (...args) => util$8.inspect(args)
520
+ log: (...args) => util$10.inspect(args),
521
+ warn: (...args) => util$10.inspect(args)
523
522
  },
524
523
  JSON,
525
524
  Math,
@@ -1378,18 +1377,18 @@ var StorageManager = class {
1378
1377
  const basePath = this.locationManager.getBackend(mappedName).basePath;
1379
1378
  location.files = {
1380
1379
  async readFile(p) {
1381
- return fs$17.promises.readFile(path$40.join(basePath, p));
1380
+ return fs$17.promises.readFile(path$39.join(basePath, p));
1382
1381
  },
1383
1382
  async writeFile(p, data) {
1384
- const full = path$40.join(basePath, p);
1385
- await fs$17.promises.mkdir(path$40.dirname(full), { recursive: true });
1383
+ const full = path$39.join(basePath, p);
1384
+ await fs$17.promises.mkdir(path$39.dirname(full), { recursive: true });
1386
1385
  await fs$17.promises.writeFile(full, data);
1387
1386
  },
1388
1387
  async deleteFile(p) {
1389
- await fs$17.promises.rm(path$40.join(basePath, p), { force: true });
1388
+ await fs$17.promises.rm(path$39.join(basePath, p), { force: true });
1390
1389
  },
1391
1390
  async listFiles(prefix) {
1392
- const dir = prefix ? path$40.join(basePath, prefix) : basePath;
1391
+ const dir = prefix ? path$39.join(basePath, prefix) : basePath;
1393
1392
  try {
1394
1393
  return (await fs$17.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
1395
1394
  } catch {
@@ -1397,11 +1396,11 @@ var StorageManager = class {
1397
1396
  }
1398
1397
  },
1399
1398
  async getFileUrl(p) {
1400
- return path$40.join(basePath, p);
1399
+ return path$39.join(basePath, p);
1401
1400
  },
1402
1401
  async exists(p) {
1403
1402
  try {
1404
- await fs$17.promises.access(path$40.join(basePath, p));
1403
+ await fs$17.promises.access(path$39.join(basePath, p));
1405
1404
  return true;
1406
1405
  } catch {
1407
1406
  return false;
@@ -1716,10 +1715,10 @@ async function ensureTlsCert(dataDir, options) {
1716
1715
  const sanDns = new Set([
1717
1716
  "localhost",
1718
1717
  cn,
1719
- os$17.hostname()
1718
+ os$18.hostname()
1720
1719
  ]);
1721
1720
  const sanIps = new Set(["127.0.0.1", "::1"]);
1722
- const interfaces = os$17.networkInterfaces();
1721
+ const interfaces = os$18.networkInterfaces();
1723
1722
  for (const addrs of Object.values(interfaces)) {
1724
1723
  if (!addrs) continue;
1725
1724
  for (const addr of addrs) if (!addr.internal) sanIps.add(addr.address);
@@ -2316,26 +2315,26 @@ var AddonLoader = class {
2316
2315
  for (const entry of entries) {
2317
2316
  if (!isDirectoryEntry(entry, addonsDir)) continue;
2318
2317
  if (entry.name.startsWith("@")) {
2319
- const scopeDir = path$40.join(addonsDir, entry.name);
2318
+ const scopeDir = path$39.join(addonsDir, entry.name);
2320
2319
  const scopeEntries = fs$17.readdirSync(scopeDir, { withFileTypes: true });
2321
2320
  for (const scopeEntry of scopeEntries) {
2322
2321
  if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
2323
- await this.tryLoadAddon(path$40.join(scopeDir, scopeEntry.name));
2322
+ await this.tryLoadAddon(path$39.join(scopeDir, scopeEntry.name));
2324
2323
  }
2325
2324
  continue;
2326
2325
  }
2327
- await this.tryLoadAddon(path$40.join(addonsDir, entry.name));
2326
+ await this.tryLoadAddon(path$39.join(addonsDir, entry.name));
2328
2327
  }
2329
2328
  }
2330
2329
  async tryLoadAddon(addonDir) {
2331
- const pkgJsonPath = path$40.join(addonDir, "package.json");
2330
+ const pkgJsonPath = path$39.join(addonDir, "package.json");
2332
2331
  if (!fs$17.existsSync(pkgJsonPath)) return;
2333
2332
  try {
2334
2333
  await this.loadFromAddonDir(addonDir);
2335
2334
  } catch (err) {
2336
2335
  const error = err instanceof Error ? err : new Error(String(err));
2337
2336
  this.logger.warn(`Failed to load package from ${addonDir}`, { meta: { error: error.message } });
2338
- const packageName = path$40.basename(addonDir);
2337
+ const packageName = path$39.basename(addonDir);
2339
2338
  this.loadFailures.push({
2340
2339
  packageName,
2341
2340
  addonDir,
@@ -2346,7 +2345,7 @@ var AddonLoader = class {
2346
2345
  }
2347
2346
  /** Load addon from a specific directory (package.json + dist/) */
2348
2347
  async loadFromAddonDir(addonDir) {
2349
- const pkgJsonPath = path$40.join(addonDir, "package.json");
2348
+ const pkgJsonPath = path$39.join(addonDir, "package.json");
2350
2349
  const pkgJson = asJsonObject(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
2351
2350
  const packageNameRaw = pkgJson["name"];
2352
2351
  const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
@@ -2379,16 +2378,16 @@ var AddonLoader = class {
2379
2378
  async loadDeclaration(addonDir, declaration, packageName, packageVersion, packageDisplayName, bundle) {
2380
2379
  if (!declaration.entry) throw new Error(`Addon "${declaration.id}" has no entry point in package.json`);
2381
2380
  const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
2382
- let entryPath = path$40.resolve(addonDir, entryFile);
2381
+ let entryPath = path$39.resolve(addonDir, entryFile);
2383
2382
  if (!fs$17.existsSync(entryPath)) {
2384
2383
  const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
2385
2384
  entryPath = [
2386
2385
  `${base}.cjs`,
2387
2386
  `${base}.mjs`,
2388
- path$40.resolve(addonDir, "dist", "index.js"),
2389
- path$40.resolve(addonDir, "dist", "index.cjs"),
2390
- path$40.resolve(addonDir, "dist", "index.mjs"),
2391
- path$40.resolve(addonDir, declaration.entry)
2387
+ path$39.resolve(addonDir, "dist", "index.js"),
2388
+ path$39.resolve(addonDir, "dist", "index.cjs"),
2389
+ path$39.resolve(addonDir, "dist", "index.mjs"),
2390
+ path$39.resolve(addonDir, declaration.entry)
2392
2391
  ].find((p) => fs$17.existsSync(p)) ?? entryPath;
2393
2392
  }
2394
2393
  if (!fs$17.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
@@ -2475,7 +2474,7 @@ var AddonLoader = class {
2475
2474
  function isDirectoryEntry(entry, parentDir) {
2476
2475
  if (entry.isDirectory()) return true;
2477
2476
  if (entry.isSymbolicLink()) try {
2478
- return fs$17.statSync(path$40.join(parentDir, entry.name)).isDirectory();
2477
+ return fs$17.statSync(path$39.join(parentDir, entry.name)).isDirectory();
2479
2478
  } catch {
2480
2479
  return false;
2481
2480
  }
@@ -2621,13 +2620,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
2621
2620
  for (const fileEntry of rawFiles) {
2622
2621
  if (typeof fileEntry !== "string") continue;
2623
2622
  if (fileEntry === "dist" || fileEntry.includes("*")) continue;
2624
- const srcPath = path$40.join(sourceDir, fileEntry);
2623
+ const srcPath = path$39.join(sourceDir, fileEntry);
2625
2624
  if (!fs$17.existsSync(srcPath)) continue;
2626
- const destPath = path$40.join(destDir, fileEntry);
2625
+ const destPath = path$39.join(destDir, fileEntry);
2627
2626
  const stat = await fs$17.promises.stat(srcPath);
2628
2627
  if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
2629
2628
  else if (stat.isFile()) {
2630
- ensureDir(path$40.dirname(destPath));
2629
+ ensureDir(path$39.dirname(destPath));
2631
2630
  await fs$17.promises.copyFile(srcPath, destPath);
2632
2631
  }
2633
2632
  }
@@ -2637,8 +2636,8 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
2637
2636
  * Returns true if rebuild is needed.
2638
2637
  */
2639
2638
  function isSourceNewer(packageDir) {
2640
- const srcDir = path$40.join(packageDir, "src");
2641
- const distDir = path$40.join(packageDir, "dist");
2639
+ const srcDir = path$39.join(packageDir, "src");
2640
+ const distDir = path$39.join(packageDir, "dist");
2642
2641
  if (!fs$17.existsSync(srcDir) || !fs$17.existsSync(distDir)) return true;
2643
2642
  try {
2644
2643
  const distMtime = fs$17.statSync(distDir).mtimeMs;
@@ -2649,7 +2648,7 @@ function isSourceNewer(packageDir) {
2649
2648
  for (const entry of entries) {
2650
2649
  if (!entry.isFile()) continue;
2651
2650
  const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
2652
- const filePath = path$40.join(parentDir, entry.name);
2651
+ const filePath = path$39.join(parentDir, entry.name);
2653
2652
  if (fs$17.statSync(filePath).mtimeMs > distMtime) return true;
2654
2653
  }
2655
2654
  return false;
@@ -2664,10 +2663,10 @@ function isSourceNewer(packageDir) {
2664
2663
  */
2665
2664
  function ensureLibraryBuilt(packageName, packagesDir) {
2666
2665
  const dirName = packageName.replace("@camstack/", "");
2667
- const sourceDir = path$40.join(packagesDir, dirName);
2666
+ const sourceDir = path$39.join(packagesDir, dirName);
2668
2667
  if (!fs$17.existsSync(sourceDir)) return;
2669
- const distDir = path$40.join(sourceDir, "dist");
2670
- if (fs$17.existsSync(path$40.join(distDir, "index.js")) || fs$17.existsSync(path$40.join(distDir, "index.mjs"))) return;
2668
+ const distDir = path$39.join(sourceDir, "dist");
2669
+ if (fs$17.existsSync(path$39.join(distDir, "index.js")) || fs$17.existsSync(path$39.join(distDir, "index.mjs"))) return;
2671
2670
  console.warn(`[ensureLibraryBuilt] ${packageName} has no dist/ — run 'npm run build' first`);
2672
2671
  }
2673
2672
  /**
@@ -2680,7 +2679,7 @@ function ensureLibraryBuilt(packageName, packagesDir) {
2680
2679
  * `copyDirRecursive` for the wedge this prevents.
2681
2680
  */
2682
2681
  async function installPackageFromNpm(packageName, targetDir) {
2683
- const tmpDir = await fs$17.promises.mkdtemp(path$40.join(os$17.tmpdir(), "camstack-install-"));
2682
+ const tmpDir = await fs$17.promises.mkdtemp(path$39.join(os$18.tmpdir(), "camstack-install-"));
2684
2683
  try {
2685
2684
  const { stdout } = await execFileAsync$1("npm", [
2686
2685
  "pack",
@@ -2693,8 +2692,8 @@ async function installPackageFromNpm(packageName, targetDir) {
2693
2692
  });
2694
2693
  const tgzFilename = stdout.trim().split("\n").pop()?.trim();
2695
2694
  if (!tgzFilename) throw new Error("npm pack produced no output");
2696
- const tgzPath = path$40.join(tmpDir, tgzFilename);
2697
- const extractDir = path$40.join(tmpDir, "extracted");
2695
+ const tgzPath = path$39.join(tmpDir, tgzFilename);
2696
+ const extractDir = path$39.join(tmpDir, "extracted");
2698
2697
  ensureDir(extractDir);
2699
2698
  await execFileAsync$1("tar", [
2700
2699
  "-xzf",
@@ -2702,18 +2701,18 @@ async function installPackageFromNpm(packageName, targetDir) {
2702
2701
  "-C",
2703
2702
  extractDir
2704
2703
  ], { timeout: 3e4 });
2705
- const packageSubDir = path$40.join(extractDir, "package");
2706
- const srcPkgJsonDir = fs$17.existsSync(path$40.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
2704
+ const packageSubDir = path$39.join(extractDir, "package");
2705
+ const srcPkgJsonDir = fs$17.existsSync(path$39.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
2707
2706
  await fs$17.promises.rm(targetDir, {
2708
2707
  recursive: true,
2709
2708
  force: true
2710
2709
  });
2711
2710
  ensureDir(targetDir);
2712
- await fs$17.promises.copyFile(path$40.join(srcPkgJsonDir, "package.json"), path$40.join(targetDir, "package.json"));
2713
- const distSrc = path$40.join(srcPkgJsonDir, "dist");
2714
- if (fs$17.existsSync(distSrc)) await copyDirRecursive(distSrc, path$40.join(targetDir, "dist"));
2711
+ await fs$17.promises.copyFile(path$39.join(srcPkgJsonDir, "package.json"), path$39.join(targetDir, "package.json"));
2712
+ const distSrc = path$39.join(srcPkgJsonDir, "dist");
2713
+ if (fs$17.existsSync(distSrc)) await copyDirRecursive(distSrc, path$39.join(targetDir, "dist"));
2715
2714
  try {
2716
- const npmPkg = asJsonObject(parseJsonUnknown(await fs$17.promises.readFile(path$40.join(srcPkgJsonDir, "package.json"), "utf-8")));
2715
+ const npmPkg = asJsonObject(parseJsonUnknown(await fs$17.promises.readFile(path$39.join(srcPkgJsonDir, "package.json"), "utf-8")));
2717
2716
  if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
2718
2717
  } catch {}
2719
2718
  } finally {
@@ -2731,7 +2730,7 @@ var AddonManifest = class {
2731
2730
  manifestPath;
2732
2731
  cache = null;
2733
2732
  constructor(addonsDir) {
2734
- this.manifestPath = path$40.join(addonsDir, MANIFEST_FILENAME);
2733
+ this.manifestPath = path$39.join(addonsDir, MANIFEST_FILENAME);
2735
2734
  }
2736
2735
  /**
2737
2736
  * Read the manifest from disk. Returns an empty manifest if the file is
@@ -2766,7 +2765,7 @@ var AddonManifest = class {
2766
2765
  * a half-written file.
2767
2766
  */
2768
2767
  write(manifest) {
2769
- fs$17.mkdirSync(path$40.dirname(this.manifestPath), { recursive: true });
2768
+ fs$17.mkdirSync(path$39.dirname(this.manifestPath), { recursive: true });
2770
2769
  const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
2771
2770
  fs$17.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
2772
2771
  encoding: "utf-8",
@@ -2842,10 +2841,10 @@ var AddonManifest = class {
2842
2841
  const now = (/* @__PURE__ */ new Date()).toISOString();
2843
2842
  for (const scope of fs$17.readdirSync(addonsDir, { withFileTypes: true })) {
2844
2843
  if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
2845
- const scopeDir = path$40.join(addonsDir, scope.name);
2844
+ const scopeDir = path$39.join(addonsDir, scope.name);
2846
2845
  for (const pkg of fs$17.readdirSync(scopeDir, { withFileTypes: true })) {
2847
2846
  if (!pkg.isDirectory()) continue;
2848
- const pkgJsonPath = path$40.join(scopeDir, pkg.name, "package.json");
2847
+ const pkgJsonPath = path$39.join(scopeDir, pkg.name, "package.json");
2849
2848
  if (!fs$17.existsSync(pkgJsonPath)) continue;
2850
2849
  let pkgJson;
2851
2850
  try {
@@ -2889,12 +2888,12 @@ var AddonManifest = class {
2889
2888
  const now = (/* @__PURE__ */ new Date()).toISOString();
2890
2889
  for (const scope of fs$17.readdirSync(addonsDir, { withFileTypes: true })) {
2891
2890
  if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
2892
- const scopeDir = path$40.join(addonsDir, scope.name);
2891
+ const scopeDir = path$39.join(addonsDir, scope.name);
2893
2892
  for (const pkg of fs$17.readdirSync(scopeDir, { withFileTypes: true })) {
2894
2893
  if (!pkg.isDirectory()) continue;
2895
- const pkgDir = path$40.join(scopeDir, pkg.name);
2896
- const markerPath = path$40.join(pkgDir, ".install-source");
2897
- const pkgJsonPath = path$40.join(pkgDir, "package.json");
2894
+ const pkgDir = path$39.join(scopeDir, pkg.name);
2895
+ const markerPath = path$39.join(pkgDir, ".install-source");
2896
+ const pkgJsonPath = path$39.join(pkgDir, "package.json");
2898
2897
  if (!fs$17.existsSync(pkgJsonPath)) continue;
2899
2898
  let pkgJson;
2900
2899
  try {
@@ -3057,8 +3056,8 @@ var AddonInstaller = class AddonInstaller {
3057
3056
  ensureLibraryBuilt("@camstack/types", this.workspaceDir);
3058
3057
  }
3059
3058
  for (const packageName of pkgList) {
3060
- const addonDir = path$40.join(this.addonsDir, packageName);
3061
- if (fs$17.existsSync(path$40.join(addonDir, "package.json"))) {
3059
+ const addonDir = path$39.join(this.addonsDir, packageName);
3060
+ if (fs$17.existsSync(path$39.join(addonDir, "package.json"))) {
3062
3061
  this.logger.debug(`${packageName} — already installed, skipping`);
3063
3062
  continue;
3064
3063
  }
@@ -3120,9 +3119,9 @@ var AddonInstaller = class AddonInstaller {
3120
3119
  * uses this so the runtime owns its on-disk copy.
3121
3120
  */
3122
3121
  async installLocal(packageName, sourceDir) {
3123
- const pkgView = readPackageJson(path$40.join(sourceDir, "package.json"));
3122
+ const pkgView = readPackageJson(path$39.join(sourceDir, "package.json"));
3124
3123
  if (!pkgView) throw new Error(`Invalid package.json at ${sourceDir}`);
3125
- const targetDir = path$40.join(this.addonsDir, packageName);
3124
+ const targetDir = path$39.join(this.addonsDir, packageName);
3126
3125
  if (this.installSource === "symlink") try {
3127
3126
  return await this.installSymlink(packageName, sourceDir, pkgView.raw, targetDir);
3128
3127
  } catch (err) {
@@ -3151,7 +3150,7 @@ var AddonInstaller = class AddonInstaller {
3151
3150
  recursive: true,
3152
3151
  force: true
3153
3152
  });
3154
- ensureDir(path$40.dirname(targetDir));
3153
+ ensureDir(path$39.dirname(targetDir));
3155
3154
  fs$17.symlinkSync(sourceDir, targetDir, "dir");
3156
3155
  this.manifest.upsert(packageName, {
3157
3156
  version: asString(pkgData.version, "0.0.0"),
@@ -3165,17 +3164,17 @@ var AddonInstaller = class AddonInstaller {
3165
3164
  }
3166
3165
  async installCopy(packageName, sourceDir, pkgData, targetDir) {
3167
3166
  await this.ensureBuilt(packageName, sourceDir, pkgData);
3168
- const distDir = path$40.join(sourceDir, "dist");
3167
+ const distDir = path$39.join(sourceDir, "dist");
3169
3168
  if (!fs$17.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
3170
3169
  await fs$17.promises.rm(targetDir, {
3171
3170
  recursive: true,
3172
3171
  force: true
3173
3172
  });
3174
3173
  ensureDir(targetDir);
3175
- await fs$17.promises.writeFile(path$40.join(targetDir, "package.json"), JSON.stringify(stripCamstackDeps(pkgData), null, 2));
3176
- await copyDirRecursive(distDir, path$40.join(targetDir, "dist"));
3174
+ await fs$17.promises.writeFile(path$39.join(targetDir, "package.json"), JSON.stringify(stripCamstackDeps(pkgData), null, 2));
3175
+ await copyDirRecursive(distDir, path$39.join(targetDir, "dist"));
3177
3176
  await copyExtraFileDirs(pkgData, sourceDir, targetDir);
3178
- await fs$17.promises.writeFile(path$40.join(targetDir, ".install-source"), "local");
3177
+ await fs$17.promises.writeFile(path$39.join(targetDir, ".install-source"), "local");
3179
3178
  const localPkgVersion = asString(pkgData.version, "0.0.0");
3180
3179
  this.manifest.upsert(packageName, {
3181
3180
  version: localPkgVersion,
@@ -3211,7 +3210,7 @@ var AddonInstaller = class AddonInstaller {
3211
3210
  * unusual auth, offline mode, etc).
3212
3211
  */
3213
3212
  async installFromNpm(packageName, version) {
3214
- const tmpDir = fs$17.mkdtempSync(path$40.join(os$17.tmpdir(), "camstack-addon-npm-"));
3213
+ const tmpDir = fs$17.mkdtempSync(path$39.join(os$18.tmpdir(), "camstack-addon-npm-"));
3215
3214
  const packageSpec = version ? `${packageName}@${version}` : packageName;
3216
3215
  this.logger.info(`${packageName} — installing from npm`);
3217
3216
  try {
@@ -3227,10 +3226,10 @@ var AddonInstaller = class AddonInstaller {
3227
3226
  const { stdout } = await execFileAsync("npm", args, { timeout: 12e4 });
3228
3227
  const tgzFiles = fs$17.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
3229
3228
  if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
3230
- return path$40.join(tmpDir, tgzFiles[0]);
3229
+ return path$39.join(tmpDir, tgzFiles[0]);
3231
3230
  });
3232
3231
  const result = await this.installFromTgz(tgzPath);
3233
- fs$17.writeFileSync(path$40.join(this.addonsDir, result.name, ".install-source"), "npm");
3232
+ fs$17.writeFileSync(path$39.join(this.addonsDir, result.name, ".install-source"), "npm");
3234
3233
  this.manifest.upsert(result.name, {
3235
3234
  version: result.version,
3236
3235
  source: "npm"
@@ -3273,7 +3272,7 @@ var AddonInstaller = class AddonInstaller {
3273
3272
  if (!tarballUrl) throw new Error(`no dist.tarball for ${packageName}@${resolvedVersion}`);
3274
3273
  const tarRes = await fetch(tarballUrl);
3275
3274
  if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
3276
- const tgzPath = path$40.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
3275
+ const tgzPath = path$39.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
3277
3276
  const buf = Buffer.from(await tarRes.arrayBuffer());
3278
3277
  fs$17.writeFileSync(tgzPath, buf);
3279
3278
  return tgzPath;
@@ -3297,12 +3296,12 @@ var AddonInstaller = class AddonInstaller {
3297
3296
  */
3298
3297
  async evictInstallDir(targetDir) {
3299
3298
  if (!fs$17.existsSync(targetDir)) return;
3300
- const graveyard = path$40.join(this.addonsDir, ".evicting");
3299
+ const graveyard = path$39.join(this.addonsDir, ".evicting");
3301
3300
  ensureDir(graveyard);
3302
3301
  await this.sweepGraveyard(graveyard);
3303
3302
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
3304
- const flatName = path$40.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
3305
- const asideDir = path$40.join(graveyard, `${flatName}-${ts}`);
3303
+ const flatName = path$39.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
3304
+ const asideDir = path$39.join(graveyard, `${flatName}-${ts}`);
3306
3305
  try {
3307
3306
  fs$17.renameSync(targetDir, asideDir);
3308
3307
  } catch (renameErr) {
@@ -3333,14 +3332,14 @@ var AddonInstaller = class AddonInstaller {
3333
3332
  } catch {
3334
3333
  return;
3335
3334
  }
3336
- await Promise.all(entries.map((name) => fs$17.promises.rm(path$40.join(graveyard, name), {
3335
+ await Promise.all(entries.map((name) => fs$17.promises.rm(path$39.join(graveyard, name), {
3337
3336
  recursive: true,
3338
3337
  force: true
3339
3338
  }).catch(() => void 0)));
3340
3339
  }
3341
3340
  /** Install addon from a tgz file (uploaded or downloaded) */
3342
3341
  async installFromTgz(tgzPath) {
3343
- const tmpDir = fs$17.mkdtempSync(path$40.join(os$17.tmpdir(), "camstack-addon-install-"));
3342
+ const tmpDir = fs$17.mkdtempSync(path$39.join(os$18.tmpdir(), "camstack-addon-install-"));
3344
3343
  try {
3345
3344
  await execFileAsync("tar", [
3346
3345
  "-xzf",
@@ -3348,20 +3347,20 @@ var AddonInstaller = class AddonInstaller {
3348
3347
  "-C",
3349
3348
  tmpDir
3350
3349
  ], { timeout: 3e4 });
3351
- const extractedDir = path$40.join(tmpDir, "package");
3352
- const pkgJsonPath = fs$17.existsSync(path$40.join(extractedDir, "package.json")) ? path$40.join(extractedDir, "package.json") : path$40.join(tmpDir, "package.json");
3350
+ const extractedDir = path$39.join(tmpDir, "package");
3351
+ const pkgJsonPath = fs$17.existsSync(path$39.join(extractedDir, "package.json")) ? path$39.join(extractedDir, "package.json") : path$39.join(tmpDir, "package.json");
3353
3352
  if (!fs$17.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
3354
3353
  const pkgView = readPackageJson(pkgJsonPath);
3355
3354
  if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
3356
3355
  if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
3357
- const targetDir = path$40.join(this.addonsDir, pkgView.name);
3356
+ const targetDir = path$39.join(this.addonsDir, pkgView.name);
3358
3357
  await this.evictInstallDir(targetDir);
3359
3358
  ensureDir(targetDir);
3360
- const sourceDir = path$40.dirname(pkgJsonPath);
3359
+ const sourceDir = path$39.dirname(pkgJsonPath);
3361
3360
  const strippedManifest = stripCamstackDeps(pkgView.raw);
3362
- await fs$17.promises.writeFile(path$40.join(targetDir, "package.json"), JSON.stringify(strippedManifest, null, 2));
3363
- const sourceDist = path$40.join(sourceDir, "dist");
3364
- if (fs$17.existsSync(sourceDist)) await copyDirRecursive(sourceDist, path$40.join(targetDir, "dist"));
3361
+ await fs$17.promises.writeFile(path$39.join(targetDir, "package.json"), JSON.stringify(strippedManifest, null, 2));
3362
+ const sourceDist = path$39.join(sourceDir, "dist");
3363
+ if (fs$17.existsSync(sourceDist)) await copyDirRecursive(sourceDist, path$39.join(targetDir, "dist"));
3365
3364
  await copyExtraFileDirs(pkgView.raw, sourceDir, targetDir);
3366
3365
  const strippedRuntimeDeps = strippedManifest["dependencies"];
3367
3366
  if (strippedRuntimeDeps != null && typeof strippedRuntimeDeps === "object" && Object.keys(strippedRuntimeDeps).length > 0) {
@@ -3426,12 +3425,12 @@ var AddonInstaller = class AddonInstaller {
3426
3425
  async applyUpdate(packageName, version) {
3427
3426
  const current = this.manifest.get(packageName);
3428
3427
  if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
3429
- const addonDir = path$40.join(this.addonsDir, packageName);
3428
+ const addonDir = path$39.join(this.addonsDir, packageName);
3430
3429
  if (!fs$17.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
3431
3430
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
3432
- const backupRoot = path$40.join(this.addonsDir, ".backups", packageName);
3431
+ const backupRoot = path$39.join(this.addonsDir, ".backups", packageName);
3433
3432
  ensureDir(backupRoot);
3434
- const backupDir = path$40.join(backupRoot, ts);
3433
+ const backupDir = path$39.join(backupRoot, ts);
3435
3434
  this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
3436
3435
  fs$17.renameSync(addonDir, backupDir);
3437
3436
  let result;
@@ -3495,12 +3494,12 @@ var AddonInstaller = class AddonInstaller {
3495
3494
  async applyUpdateFromStaged(packageName, version, stagedPath) {
3496
3495
  const current = this.manifest.get(packageName);
3497
3496
  if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
3498
- const addonDir = path$40.join(this.addonsDir, packageName);
3497
+ const addonDir = path$39.join(this.addonsDir, packageName);
3499
3498
  if (!fs$17.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
3500
3499
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
3501
- const backupRoot = path$40.join(this.addonsDir, ".backups", packageName);
3500
+ const backupRoot = path$39.join(this.addonsDir, ".backups", packageName);
3502
3501
  ensureDir(backupRoot);
3503
- const backupDir = path$40.join(backupRoot, ts);
3502
+ const backupDir = path$39.join(backupRoot, ts);
3504
3503
  this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
3505
3504
  fs$17.renameSync(addonDir, backupDir);
3506
3505
  try {
@@ -3564,13 +3563,13 @@ var AddonInstaller = class AddonInstaller {
3564
3563
  this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
3565
3564
  return null;
3566
3565
  }
3567
- const addonDir = path$40.join(this.addonsDir, packageName);
3566
+ const addonDir = path$39.join(this.addonsDir, packageName);
3568
3567
  if (fs$17.existsSync(addonDir)) fs$17.rmSync(addonDir, {
3569
3568
  recursive: true,
3570
3569
  force: true
3571
3570
  });
3572
3571
  fs$17.renameSync(entry.lastBackupDir, addonDir);
3573
- const pkgJsonPath = path$40.join(addonDir, "package.json");
3572
+ const pkgJsonPath = path$39.join(addonDir, "package.json");
3574
3573
  let restoredVersion = entry.version;
3575
3574
  if (fs$17.existsSync(pkgJsonPath)) try {
3576
3575
  const parsed = JSON.parse(fs$17.readFileSync(pkgJsonPath, "utf-8"));
@@ -3606,7 +3605,7 @@ var AddonInstaller = class AddonInstaller {
3606
3605
  });
3607
3606
  }
3608
3607
  async uninstall(packageName) {
3609
- const addonDir = path$40.join(this.addonsDir, packageName);
3608
+ const addonDir = path$39.join(this.addonsDir, packageName);
3610
3609
  if (fs$17.existsSync(addonDir)) {
3611
3610
  fs$17.rmSync(addonDir, {
3612
3611
  recursive: true,
@@ -3615,7 +3614,7 @@ var AddonInstaller = class AddonInstaller {
3615
3614
  this.manifest.remove(packageName);
3616
3615
  return;
3617
3616
  }
3618
- const legacyDir = path$40.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
3617
+ const legacyDir = path$39.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
3619
3618
  if (fs$17.existsSync(legacyDir)) {
3620
3619
  fs$17.rmSync(legacyDir, {
3621
3620
  recursive: true,
@@ -3630,16 +3629,16 @@ var AddonInstaller = class AddonInstaller {
3630
3629
  for (const entry of fs$17.readdirSync(this.addonsDir, { withFileTypes: true })) {
3631
3630
  if (!isDirEntry(entry, this.addonsDir)) continue;
3632
3631
  if (entry.name.startsWith("@")) {
3633
- const scopeDir = path$40.join(this.addonsDir, entry.name);
3634
- for (const inner of fs$17.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$40.join(scopeDir, inner.name));
3635
- } else packageDirs.push(path$40.join(this.addonsDir, entry.name));
3632
+ const scopeDir = path$39.join(this.addonsDir, entry.name);
3633
+ for (const inner of fs$17.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$39.join(scopeDir, inner.name));
3634
+ } else packageDirs.push(path$39.join(this.addonsDir, entry.name));
3636
3635
  }
3637
3636
  return packageDirs.map((dir) => {
3638
- const pkgPath = path$40.join(dir, "package.json");
3637
+ const pkgPath = path$39.join(dir, "package.json");
3639
3638
  if (!fs$17.existsSync(pkgPath)) return null;
3640
3639
  const pkg = readPackageJson(pkgPath);
3641
3640
  if (!pkg || !pkg.camstackAddons) return null;
3642
- const sourceFile = path$40.join(dir, ".install-source");
3641
+ const sourceFile = path$39.join(dir, ".install-source");
3643
3642
  const installSource = fs$17.existsSync(sourceFile) ? parseInstallSource(fs$17.readFileSync(sourceFile, "utf-8").trim()) : void 0;
3644
3643
  return {
3645
3644
  name: pkg.name,
@@ -3650,19 +3649,19 @@ var AddonInstaller = class AddonInstaller {
3650
3649
  }).filter((item) => item !== null);
3651
3650
  }
3652
3651
  isInstalled(packageName) {
3653
- if (fs$17.existsSync(path$40.join(this.addonsDir, packageName, "package.json"))) return true;
3654
- return fs$17.existsSync(path$40.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
3652
+ if (fs$17.existsSync(path$39.join(this.addonsDir, packageName, "package.json"))) return true;
3653
+ return fs$17.existsSync(path$39.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
3655
3654
  }
3656
3655
  getInstalledPackage(packageName) {
3657
- let pkgPath = path$40.join(this.addonsDir, packageName, "package.json");
3658
- if (!fs$17.existsSync(pkgPath)) pkgPath = path$40.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
3656
+ let pkgPath = path$39.join(this.addonsDir, packageName, "package.json");
3657
+ if (!fs$17.existsSync(pkgPath)) pkgPath = path$39.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
3659
3658
  if (!fs$17.existsSync(pkgPath)) return null;
3660
3659
  const pkg = readPackageJson(pkgPath);
3661
3660
  if (!pkg) return null;
3662
3661
  return {
3663
3662
  name: pkg.name,
3664
3663
  version: pkg.version,
3665
- dir: path$40.dirname(pkgPath)
3664
+ dir: path$39.dirname(pkgPath)
3666
3665
  };
3667
3666
  }
3668
3667
  findLocalPackage(packageName) {
@@ -3673,9 +3672,9 @@ var AddonInstaller = class AddonInstaller {
3673
3672
  `addon-${shortName}`,
3674
3673
  shortName.replace("addon-", "")
3675
3674
  ]) {
3676
- const candidate = path$40.join(this.workspaceDir, dirName);
3675
+ const candidate = path$39.join(this.workspaceDir, dirName);
3677
3676
  try {
3678
- const pkg = asJsonObject(parseJsonUnknown(fs$17.readFileSync(path$40.join(candidate, "package.json"), "utf-8")));
3677
+ const pkg = asJsonObject(parseJsonUnknown(fs$17.readFileSync(path$39.join(candidate, "package.json"), "utf-8")));
3679
3678
  if (pkg && asString(pkg["name"]) === packageName) return candidate;
3680
3679
  } catch {}
3681
3680
  }
@@ -3683,7 +3682,7 @@ var AddonInstaller = class AddonInstaller {
3683
3682
  }
3684
3683
  /** Ensure a package is built (dist/ exists and page bundles present) */
3685
3684
  async ensureBuilt(packageName, sourceDir, pkgData) {
3686
- const distDir = path$40.join(sourceDir, "dist");
3685
+ const distDir = path$39.join(sourceDir, "dist");
3687
3686
  if (!(!fs$17.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
3688
3687
  this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
3689
3688
  try {
@@ -3702,7 +3701,7 @@ var AddonInstaller = class AddonInstaller {
3702
3701
  if (!camstack?.addons) return false;
3703
3702
  for (const addon of camstack.addons) {
3704
3703
  if (!addon.pages) continue;
3705
- for (const page of addon.pages) if (page.bundle && !fs$17.existsSync(path$40.join(sourceDir, "dist", page.bundle))) return true;
3704
+ for (const page of addon.pages) if (page.bundle && !fs$17.existsSync(path$39.join(sourceDir, "dist", page.bundle))) return true;
3706
3705
  }
3707
3706
  return false;
3708
3707
  }
@@ -3711,7 +3710,7 @@ var AddonInstaller = class AddonInstaller {
3711
3710
  function isDirEntry(entry, parentDir) {
3712
3711
  if (entry.isDirectory()) return true;
3713
3712
  if (entry.isSymbolicLink()) try {
3714
- return fs$17.statSync(path$40.join(parentDir, entry.name)).isDirectory();
3713
+ return fs$17.statSync(path$39.join(parentDir, entry.name)).isDirectory();
3715
3714
  } catch {
3716
3715
  return false;
3717
3716
  }
@@ -3728,11 +3727,11 @@ function isDirEntry(entry, parentDir) {
3728
3727
  * - addon-bridge.service.ts
3729
3728
  */
3730
3729
  function detectWorkspacePackagesDir(startDir) {
3731
- let current = path$40.resolve(startDir);
3730
+ let current = path$39.resolve(startDir);
3732
3731
  for (let i = 0; i < 6; i++) {
3733
- current = path$40.dirname(current);
3734
- const packagesDir = path$40.join(current, "packages");
3735
- const rootPkgJson = path$40.join(current, "package.json");
3732
+ current = path$39.dirname(current);
3733
+ const packagesDir = path$39.join(current, "packages");
3734
+ const rootPkgJson = path$39.join(current, "package.json");
3736
3735
  if (fs$17.existsSync(packagesDir) && fs$17.existsSync(rootPkgJson)) try {
3737
3736
  const rootPkg = JSON.parse(fs$17.readFileSync(rootPkgJson, "utf-8"));
3738
3737
  if (rootPkg.workspaces || rootPkg.name === "camstack-server" || rootPkg.name === "camstack") return packagesDir;
@@ -3741,21 +3740,6 @@ function detectWorkspacePackagesDir(startDir) {
3741
3740
  return null;
3742
3741
  }
3743
3742
  //#endregion
3744
- //#region ../../node_modules/electron/index.js
3745
- var require_electron = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3746
- var fs$16 = __require("fs");
3747
- var path$39 = __require("path");
3748
- var pathFile = path$39.join(__dirname, "path.txt");
3749
- function getElectronPath() {
3750
- let executablePath;
3751
- if (fs$16.existsSync(pathFile)) executablePath = fs$16.readFileSync(pathFile, "utf-8");
3752
- if (process.env.ELECTRON_OVERRIDE_DIST_PATH) return path$39.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
3753
- if (executablePath) return path$39.join(__dirname, "dist", executablePath);
3754
- else throw new Error("Electron failed to install correctly, please delete node_modules/electron and try installing again");
3755
- }
3756
- module.exports = getElectronPath();
3757
- }));
3758
- //#endregion
3759
3743
  //#region src/kernel/restart-coordinator.ts
3760
3744
  /**
3761
3745
  * RestartCoordinator — shared primitives for the framework live-update flow.
@@ -3778,7 +3762,7 @@ var require_electron = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3778
3762
  var RESTART_MARKER_FILE = ".restart-pending";
3779
3763
  /** Resolve the marker path inside a data directory. */
3780
3764
  function getRestartMarkerPath(dataDir) {
3781
- return path$40.join(dataDir, RESTART_MARKER_FILE);
3765
+ return path$39.join(dataDir, RESTART_MARKER_FILE);
3782
3766
  }
3783
3767
  /**
3784
3768
  * Write the marker atomically. Existing marker is overwritten — the most
@@ -3877,7 +3861,7 @@ function scheduleSelfRestart(options = {}) {
3877
3861
  console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
3878
3862
  }
3879
3863
  if (process.versions.electron !== void 0) {
3880
- const electron = require_electron();
3864
+ const electron = __require("electron");
3881
3865
  electron.app.relaunch();
3882
3866
  electron.app.exit(exitCode);
3883
3867
  return;
@@ -4980,7 +4964,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
4980
4964
  value: mod,
4981
4965
  enumerable: true
4982
4966
  }) : target, mod));
4983
- var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4967
+ var require_common$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4984
4968
  function isNothing(subject) {
4985
4969
  return typeof subject === "undefined" || subject === null;
4986
4970
  }
@@ -5044,7 +5028,7 @@ var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5044
5028
  module.exports = YAMLException;
5045
5029
  }));
5046
5030
  var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5047
- var common = require_common$1();
5031
+ var common = require_common$2();
5048
5032
  function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
5049
5033
  let head = "";
5050
5034
  let tail = "";
@@ -5324,7 +5308,7 @@ var require_bool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5324
5308
  });
5325
5309
  }));
5326
5310
  var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5327
- var common = require_common$1();
5311
+ var common = require_common$2();
5328
5312
  var Type = require_type();
5329
5313
  function isHexCode(c) {
5330
5314
  return c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
@@ -5431,7 +5415,7 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5431
5415
  });
5432
5416
  }));
5433
5417
  var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5434
- var common = require_common$1();
5418
+ var common = require_common$2();
5435
5419
  var Type = require_type();
5436
5420
  var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
5437
5421
  var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
@@ -5732,7 +5716,7 @@ var require_default$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5732
5716
  });
5733
5717
  }));
5734
5718
  var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5735
- var common = require_common$1();
5719
+ var common = require_common$2();
5736
5720
  var YAMLException = require_exception();
5737
5721
  var makeSnippet = require_snippet();
5738
5722
  var DEFAULT_SCHEMA = require_default$1();
@@ -6755,7 +6739,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6755
6739
  module.exports.load = load;
6756
6740
  }));
6757
6741
  var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6758
- var common = require_common$1();
6742
+ var common = require_common$2();
6759
6743
  var YAMLException = require_exception();
6760
6744
  var DEFAULT_SCHEMA = require_default$1();
6761
6745
  var _toString = Object.prototype.toString;
@@ -7435,7 +7419,7 @@ var ConfigManager = class ConfigManager {
7435
7419
  this.bootstrapConfig = bootstrapSchema.parse(merged);
7436
7420
  this.warnDefaultCredentials();
7437
7421
  const dataPath = this.bootstrapConfig.server.dataPath ?? "camstack-data";
7438
- this.runtimeStatePath = path$40.resolve(dataPath, "runtime-state.json");
7422
+ this.runtimeStatePath = path$39.resolve(dataPath, "runtime-state.json");
7439
7423
  this.runtimeState = this.loadRuntimeState();
7440
7424
  }
7441
7425
  /**
@@ -7871,7 +7855,7 @@ var ConfigManager = class ConfigManager {
7871
7855
  }
7872
7856
  }
7873
7857
  saveRuntimeState() {
7874
- const dir = path$40.dirname(this.runtimeStatePath);
7858
+ const dir = path$39.dirname(this.runtimeStatePath);
7875
7859
  if (!fs$17.existsSync(dir)) fs$17.mkdirSync(dir, { recursive: true });
7876
7860
  const tmpPath = `${this.runtimeStatePath}.tmp`;
7877
7861
  fs$17.writeFileSync(tmpPath, JSON.stringify(this.runtimeState, null, 2), "utf-8");
@@ -27893,9 +27877,9 @@ var require_kleur = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
27893
27877
  //#region ../../node_modules/moleculer/src/utils.js
27894
27878
  var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
27895
27879
  var kleur = require_kleur();
27896
- var os$16 = __require("os");
27880
+ var os$17 = __require("os");
27897
27881
  var path$38 = __require("path");
27898
- var fs$15 = __require("fs");
27882
+ var fs$16 = __require("fs");
27899
27883
  var { TimeoutError } = require_errors$2();
27900
27884
  var lut = [];
27901
27885
  for (let i = 0; i < 256; i++) lut[i] = (i < 16 ? "0" : "") + i.toString(16);
@@ -27992,7 +27976,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
27992
27976
  * @returns
27993
27977
  */
27994
27978
  getNodeID() {
27995
- return os$16.hostname().toLowerCase() + "-" + process.pid;
27979
+ return os$17.hostname().toLowerCase() + "-" + process.pid;
27996
27980
  },
27997
27981
  /**
27998
27982
  * Get list of local IPs
@@ -28002,7 +27986,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
28002
27986
  getIpList() {
28003
27987
  const list = [];
28004
27988
  const ilist = [];
28005
- const interfaces = os$16.networkInterfaces();
27989
+ const interfaces = os$17.networkInterfaces();
28006
27990
  for (let iface in interfaces) for (let i in interfaces[iface]) {
28007
27991
  const f = interfaces[iface]?.[i];
28008
27992
  if (f.family === "IPv4") if (f.internal) {
@@ -28188,7 +28172,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
28188
28172
  makeDirs(p) {
28189
28173
  p.split(path$38.sep).reduce((prevPath, folder) => {
28190
28174
  const currentPath = path$38.join(prevPath, folder, path$38.sep);
28191
- if (!fs$15.existsSync(currentPath)) fs$15.mkdirSync(currentPath);
28175
+ if (!fs$16.existsSync(currentPath)) fs$16.mkdirSync(currentPath);
28192
28176
  return currentPath;
28193
28177
  }, "");
28194
28178
  },
@@ -29414,7 +29398,7 @@ var require_csv = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
29414
29398
  var { makeDirs } = require_utils$3();
29415
29399
  var _ = require_lodash();
29416
29400
  var path$37 = __require("path");
29417
- var fs$14 = __require("fs");
29401
+ var fs$15 = __require("fs");
29418
29402
  var METRIC = require_constants$6();
29419
29403
  var MODE_METRIC = "metric";
29420
29404
  var MODE_LABEL = "label";
@@ -29573,8 +29557,8 @@ var require_csv = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
29573
29557
  */
29574
29558
  writeRow(filename, headers, fields) {
29575
29559
  try {
29576
- if (!fs$14.existsSync(filename)) fs$14.writeFileSync(filename, headers.join(this.opts.delimiter) + this.opts.rowDelimiter);
29577
- fs$14.appendFileSync(filename, fields.join(this.opts.delimiter) + this.opts.rowDelimiter);
29560
+ if (!fs$15.existsSync(filename)) fs$15.writeFileSync(filename, headers.join(this.opts.delimiter) + this.opts.rowDelimiter);
29561
+ fs$15.appendFileSync(filename, fields.join(this.opts.delimiter) + this.opts.rowDelimiter);
29578
29562
  } catch (err) {
29579
29563
  /* istanbul ignore next */
29580
29564
  this.logger.error(`Unable to write metrics values to the '${filename}' file. Error: ${err.message}`, fields, err);
@@ -29688,7 +29672,7 @@ var require_event$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
29688
29672
  var require_datadog$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
29689
29673
  var BaseReporter = require_base$8();
29690
29674
  var _ = require_lodash();
29691
- var os$15 = __require("os");
29675
+ var os$16 = __require("os");
29692
29676
  var { MoleculerError } = require_errors$2();
29693
29677
  var METRIC = require_constants$6();
29694
29678
  var { isFunction } = require_utils$3();
@@ -29721,7 +29705,7 @@ var require_datadog$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
29721
29705
  super(opts);
29722
29706
  /** @type {DatadogReporterOptions} */
29723
29707
  this.opts = _.defaultsDeep(this.opts, {
29724
- host: os$15.hostname(),
29708
+ host: os$16.hostname(),
29725
29709
  baseUrl: BASE_URL,
29726
29710
  apiVersion: "v1",
29727
29711
  path: "/series",
@@ -30397,18 +30381,18 @@ var require_cpu_usage$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
30397
30381
  *
30398
30382
  * Based on: https://github.com/icebob/cpu
30399
30383
  */
30400
- var os$14 = __require("os");
30384
+ var os$15 = __require("os");
30401
30385
  /* istanbul ignore next */
30402
30386
  module.exports = function getCpuUsage(sampleTime = 100) {
30403
30387
  return new Promise((resolve, reject) => {
30404
30388
  try {
30405
- const first = os$14.cpus().map((cpu) => cpu.times);
30389
+ const first = os$15.cpus().map((cpu) => cpu.times);
30406
30390
  setTimeout(() => {
30407
30391
  try {
30408
- const second = os$14.cpus().map((cpu) => cpu.times);
30392
+ const second = os$15.cpus().map((cpu) => cpu.times);
30409
30393
  setTimeout(() => {
30410
30394
  try {
30411
- const third = os$14.cpus().map((cpu) => cpu.times);
30395
+ const third = os$15.cpus().map((cpu) => cpu.times);
30412
30396
  const usages = [];
30413
30397
  for (let i = 0; i < first.length; i++) {
30414
30398
  const first_idle = first[i].idle;
@@ -30441,7 +30425,7 @@ var require_cpu_usage$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
30441
30425
  //#endregion
30442
30426
  //#region ../../node_modules/moleculer/src/metrics/commons.js
30443
30427
  var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
30444
- var os$13 = __require("os");
30428
+ var os$14 = __require("os");
30445
30429
  var METRIC = require_constants$6();
30446
30430
  var cpuUsage = require_cpu_usage$1();
30447
30431
  var v8;
@@ -30620,27 +30604,27 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
30620
30604
  name: METRIC.OS_TYPE,
30621
30605
  type: METRIC.TYPE_INFO,
30622
30606
  description: "OS type"
30623
- }).set(os$13.type());
30607
+ }).set(os$14.type());
30624
30608
  this.register({
30625
30609
  name: METRIC.OS_RELEASE,
30626
30610
  type: METRIC.TYPE_INFO,
30627
30611
  description: "OS release"
30628
- }).set(os$13.release());
30612
+ }).set(os$14.release());
30629
30613
  this.register({
30630
30614
  name: METRIC.OS_HOSTNAME,
30631
30615
  type: METRIC.TYPE_INFO,
30632
30616
  description: "Hostname"
30633
- }).set(os$13.hostname());
30617
+ }).set(os$14.hostname());
30634
30618
  this.register({
30635
30619
  name: METRIC.OS_ARCH,
30636
30620
  type: METRIC.TYPE_INFO,
30637
30621
  description: "OS architecture"
30638
- }).set(os$13.arch());
30622
+ }).set(os$14.arch());
30639
30623
  this.register({
30640
30624
  name: METRIC.OS_PLATFORM,
30641
30625
  type: METRIC.TYPE_INFO,
30642
30626
  description: "OS platform"
30643
- }).set(os$13.platform());
30627
+ }).set(os$14.platform());
30644
30628
  const userInfo = getUserInfo();
30645
30629
  this.register({
30646
30630
  name: METRIC.OS_USER_UID,
@@ -30791,22 +30775,22 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
30791
30775
  }
30792
30776
  this.set(METRIC.PROCESS_UPTIME, process.uptime());
30793
30777
  this.set(METRIC.PROCESS_INTERNAL_ACTIVE_HANDLES, process.getActiveResourcesInfo().length);
30794
- const freeMem = os$13.freemem();
30795
- const totalMem = os$13.totalmem();
30778
+ const freeMem = os$14.freemem();
30779
+ const totalMem = os$14.totalmem();
30796
30780
  const usedMem = totalMem - freeMem;
30797
30781
  this.set(METRIC.OS_MEMORY_FREE, freeMem);
30798
30782
  this.set(METRIC.OS_MEMORY_USED, usedMem);
30799
30783
  this.set(METRIC.OS_MEMORY_TOTAL, totalMem);
30800
- this.set(METRIC.OS_UPTIME, os$13.uptime());
30801
- this.set(METRIC.OS_TYPE, os$13.type());
30802
- this.set(METRIC.OS_RELEASE, os$13.release());
30803
- this.set(METRIC.OS_HOSTNAME, os$13.hostname());
30804
- this.set(METRIC.OS_ARCH, os$13.arch());
30805
- this.set(METRIC.OS_PLATFORM, os$13.platform());
30784
+ this.set(METRIC.OS_UPTIME, os$14.uptime());
30785
+ this.set(METRIC.OS_TYPE, os$14.type());
30786
+ this.set(METRIC.OS_RELEASE, os$14.release());
30787
+ this.set(METRIC.OS_HOSTNAME, os$14.hostname());
30788
+ this.set(METRIC.OS_ARCH, os$14.arch());
30789
+ this.set(METRIC.OS_PLATFORM, os$14.platform());
30806
30790
  const getNetworkInterfaces = () => {
30807
30791
  const list = [];
30808
30792
  const ilist = [];
30809
- const interfaces = os$13.networkInterfaces();
30793
+ const interfaces = os$14.networkInterfaces();
30810
30794
  for (let iface in interfaces) for (let i in interfaces[iface]) {
30811
30795
  const f = interfaces[iface][i];
30812
30796
  if (f.internal) ilist.push({
@@ -30836,7 +30820,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
30836
30820
  this.set(METRIC.OS_DATETIME_ISO, d.toISOString());
30837
30821
  this.set(METRIC.OS_DATETIME_UTC, d.toUTCString());
30838
30822
  this.set(METRIC.OS_DATETIME_TZ_OFFSET, d.getTimezoneOffset());
30839
- const load = os$13.loadavg();
30823
+ const load = os$14.loadavg();
30840
30824
  this.set(METRIC.OS_CPU_LOAD_1, load[0]);
30841
30825
  this.set(METRIC.OS_CPU_LOAD_5, load[1]);
30842
30826
  this.set(METRIC.OS_CPU_LOAD_15, load[2]);
@@ -30844,7 +30828,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
30844
30828
  return this.broker.Promise.resolve().then(() => cpuUsage().then((res) => {
30845
30829
  this.set(METRIC.OS_CPU_UTILIZATION, res.avg);
30846
30830
  try {
30847
- const cpus = os$13.cpus();
30831
+ const cpus = os$14.cpus();
30848
30832
  this.set(METRIC.OS_CPU_TOTAL, cpus.length);
30849
30833
  this.set(METRIC.OS_CPU_USER, cpus.reduce((a, b) => a + b.times.user, 0));
30850
30834
  this.set(METRIC.OS_CPU_SYSTEM, cpus.reduce((a, b) => a + b.times.sys, 0));
@@ -30866,7 +30850,7 @@ var require_commons = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
30866
30850
  */
30867
30851
  function getUserInfo() {
30868
30852
  try {
30869
- return os$13.userInfo();
30853
+ return os$14.userInfo();
30870
30854
  } catch {
30871
30855
  /* istanbul ignore next */
30872
30856
  return {};
@@ -32646,7 +32630,7 @@ var require_latency = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
32646
32630
  //#region ../../node_modules/lru-cache/dist/commonjs/node/index.min.js
32647
32631
  var require_index_min = /* @__PURE__ */ __commonJSMin$1(((exports) => {
32648
32632
  var j = (c, t) => () => (t || c((t = { exports: {} }).exports, t), t.exports);
32649
- var I$1 = j((O) => {
32633
+ var I$2 = j((O) => {
32650
32634
  "use strict";
32651
32635
  Object.defineProperty(O, "__esModule", { value: !0 });
32652
32636
  O.tracing = O.metrics = void 0;
@@ -32662,7 +32646,7 @@ var require_index_min = /* @__PURE__ */ __commonJSMin$1(((exports) => {
32662
32646
  });
32663
32647
  Object.defineProperty(exports, "__esModule", { value: !0 });
32664
32648
  exports.LRUCache = void 0;
32665
- var g = I$1(), N = P(), C = () => g.metrics.hasSubscribers || g.tracing.hasSubscribers, k = /* @__PURE__ */ new Set(), G = typeof process == "object" && process ? process : {}, V = (c, t, e, i) => {
32649
+ var g = I$2(), N = P(), C = () => g.metrics.hasSubscribers || g.tracing.hasSubscribers, k = /* @__PURE__ */ new Set(), G = typeof process == "object" && process ? process : {}, V = (c, t, e, i) => {
32666
32650
  typeof G.emitWarning == "function" ? G.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
32667
32651
  }, q = (c) => !k.has(c);
32668
32652
  var T = (c) => !!c && c === Math.floor(c) && c > 0 && isFinite(c), H = (c) => T(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? W : null : null, W = class extends Array {
@@ -34565,10 +34549,10 @@ var require_inherits_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module
34565
34549
  //#region ../../node_modules/inherits/inherits.js
34566
34550
  var require_inherits = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
34567
34551
  try {
34568
- var util$7 = __require("util");
34552
+ var util$9 = __require("util");
34569
34553
  /* istanbul ignore next */
34570
- if (typeof util$7.inherits !== "function") throw "";
34571
- module.exports = util$7.inherits;
34554
+ if (typeof util$9.inherits !== "function") throw "";
34555
+ module.exports = util$9.inherits;
34572
34556
  } catch (e) {
34573
34557
  /* istanbul ignore next */
34574
34558
  module.exports = require_inherits_browser();
@@ -34576,7 +34560,7 @@ var require_inherits = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
34576
34560
  }));
34577
34561
  //#endregion
34578
34562
  //#region ../../node_modules/util-deprecate/node.js
34579
- var require_node$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
34563
+ var require_node$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
34580
34564
  /**
34581
34565
  * For Node.js, simply re-export the core `util.deprecate` function.
34582
34566
  */
@@ -34596,7 +34580,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin$1(((exports, module
34596
34580
  }
34597
34581
  var Duplex;
34598
34582
  Writable.WritableState = WritableState;
34599
- var internalUtil = { deprecate: require_node$1() };
34583
+ var internalUtil = { deprecate: require_node$2() };
34600
34584
  var Stream = require_stream$1();
34601
34585
  var Buffer$13 = __require("buffer").Buffer;
34602
34586
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {};
@@ -36477,14 +36461,14 @@ var require_pipeline$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
36477
36461
  //#endregion
36478
36462
  //#region ../../node_modules/msgpack5/node_modules/readable-stream/readable.js
36479
36463
  var require_readable$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
36480
- var Stream$2 = __require("stream");
36481
- if (process.env.READABLE_STREAM === "disable" && Stream$2) {
36482
- module.exports = Stream$2.Readable;
36483
- Object.assign(module.exports, Stream$2);
36484
- module.exports.Stream = Stream$2;
36464
+ var Stream$3 = __require("stream");
36465
+ if (process.env.READABLE_STREAM === "disable" && Stream$3) {
36466
+ module.exports = Stream$3.Readable;
36467
+ Object.assign(module.exports, Stream$3);
36468
+ module.exports.Stream = Stream$3;
36485
36469
  } else {
36486
36470
  exports = module.exports = require__stream_readable();
36487
- exports.Stream = Stream$2 || exports;
36471
+ exports.Stream = Stream$3 || exports;
36488
36472
  exports.Readable = exports;
36489
36473
  exports.Writable = require__stream_writable();
36490
36474
  exports.Duplex = require__stream_duplex();
@@ -36830,7 +36814,7 @@ var require_streams = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
36830
36814
  //#endregion
36831
36815
  //#region ../../node_modules/msgpack5/lib/helpers.js
36832
36816
  var require_helpers$2 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
36833
- var util$6 = __require("util");
36817
+ var util$8 = __require("util");
36834
36818
  exports.IncompleteBufferError = IncompleteBufferError;
36835
36819
  function IncompleteBufferError(message) {
36836
36820
  Error.call(this);
@@ -36838,7 +36822,7 @@ var require_helpers$2 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
36838
36822
  this.name = this.constructor.name;
36839
36823
  this.message = message || "unable to decode";
36840
36824
  }
36841
- util$6.inherits(IncompleteBufferError, Error);
36825
+ util$8.inherits(IncompleteBufferError, Error);
36842
36826
  exports.isFloat = function isFloat(n) {
36843
36827
  return n % 1 !== 0;
36844
36828
  };
@@ -38376,7 +38360,7 @@ var require_discoverers = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
38376
38360
  }));
38377
38361
  //#endregion
38378
38362
  //#region ../../node_modules/moleculer/src/registry/node.js
38379
- var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
38363
+ var require_node$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
38380
38364
  /**
38381
38365
  * Import types
38382
38366
  *
@@ -38491,8 +38475,8 @@ var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
38491
38475
  //#region ../../node_modules/moleculer/src/registry/node-catalog.js
38492
38476
  var require_node_catalog = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
38493
38477
  var _ = require_lodash();
38494
- var os$12 = __require("os");
38495
- var Node = require_node();
38478
+ var os$13 = __require("os");
38479
+ var Node = require_node$1();
38496
38480
  var { getIpList } = require_utils$3();
38497
38481
  /**
38498
38482
  * Import types
@@ -38537,7 +38521,7 @@ var require_node_catalog = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
38537
38521
  node.local = true;
38538
38522
  node.ipList = getIpList();
38539
38523
  node.instanceID = this.broker.instanceID;
38540
- node.hostname = os$12.hostname();
38524
+ node.hostname = os$13.hostname();
38541
38525
  node.client = {
38542
38526
  type: "nodejs",
38543
38527
  version: this.broker.MOLECULER_VERSION,
@@ -40295,7 +40279,7 @@ var require_formatted = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40295
40279
  var BaseLogger = require_base$4();
40296
40280
  var _ = require_lodash();
40297
40281
  var kleur = require_kleur();
40298
- var util$5 = __require("util");
40282
+ var util$7 = __require("util");
40299
40283
  var { isObject, isFunction } = require_utils$3();
40300
40284
  /**
40301
40285
  * Import types
@@ -40343,7 +40327,7 @@ var require_formatted = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40343
40327
  init(loggerFactory) {
40344
40328
  super.init(loggerFactory);
40345
40329
  if (!this.opts.colors) kleur.enabled = false;
40346
- this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$5.inspect(o, {
40330
+ this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$7.inspect(o, {
40347
40331
  showHidden: false,
40348
40332
  depth: 2,
40349
40333
  colors: kleur.enabled,
@@ -40611,9 +40595,9 @@ var require_console$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40611
40595
  var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40612
40596
  var BaseLogger = require_base$4();
40613
40597
  var _ = require_lodash();
40614
- var os$11 = __require("os");
40598
+ var os$12 = __require("os");
40615
40599
  var { MoleculerError } = require_errors$2();
40616
- var util$4 = __require("util");
40600
+ var util$6 = __require("util");
40617
40601
  var { isObject } = require_utils$3();
40618
40602
  /**
40619
40603
  * Import types
@@ -40644,7 +40628,7 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40644
40628
  apiKey: process.env.DATADOG_API_KEY,
40645
40629
  ddSource: "moleculer",
40646
40630
  env: void 0,
40647
- hostname: os$11.hostname(),
40631
+ hostname: os$12.hostname(),
40648
40632
  objectPrinter: null,
40649
40633
  interval: 10 * 1e3
40650
40634
  });
@@ -40659,7 +40643,7 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40659
40643
  */
40660
40644
  init(loggerFactory) {
40661
40645
  super.init(loggerFactory);
40662
- this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$4.inspect(o, {
40646
+ this.objectPrinter = this.opts.objectPrinter ? this.opts.objectPrinter : (o) => util$6.inspect(o, {
40663
40647
  showHidden: false,
40664
40648
  depth: 2,
40665
40649
  colors: false,
@@ -40768,6 +40752,712 @@ var require_datadog$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40768
40752
  module.exports = DatadogLogger;
40769
40753
  }));
40770
40754
  //#endregion
40755
+ //#region ../../node_modules/debug/src/common.js
40756
+ var require_common$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40757
+ /**
40758
+ * This is the common logic for both the Node.js and web browser
40759
+ * implementations of `debug()`.
40760
+ */
40761
+ function setup(env) {
40762
+ createDebug.debug = createDebug;
40763
+ createDebug.default = createDebug;
40764
+ createDebug.coerce = coerce;
40765
+ createDebug.disable = disable;
40766
+ createDebug.enable = enable;
40767
+ createDebug.enabled = enabled;
40768
+ createDebug.humanize = require_ms();
40769
+ createDebug.destroy = destroy;
40770
+ Object.keys(env).forEach((key) => {
40771
+ createDebug[key] = env[key];
40772
+ });
40773
+ /**
40774
+ * The currently active debug mode names, and names to skip.
40775
+ */
40776
+ createDebug.names = [];
40777
+ createDebug.skips = [];
40778
+ /**
40779
+ * Map of special "%n" handling functions, for the debug "format" argument.
40780
+ *
40781
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
40782
+ */
40783
+ createDebug.formatters = {};
40784
+ /**
40785
+ * Selects a color for a debug namespace
40786
+ * @param {String} namespace The namespace string for the debug instance to be colored
40787
+ * @return {Number|String} An ANSI color code for the given namespace
40788
+ * @api private
40789
+ */
40790
+ function selectColor(namespace) {
40791
+ let hash = 0;
40792
+ for (let i = 0; i < namespace.length; i++) {
40793
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
40794
+ hash |= 0;
40795
+ }
40796
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
40797
+ }
40798
+ createDebug.selectColor = selectColor;
40799
+ /**
40800
+ * Create a debugger with the given `namespace`.
40801
+ *
40802
+ * @param {String} namespace
40803
+ * @return {Function}
40804
+ * @api public
40805
+ */
40806
+ function createDebug(namespace) {
40807
+ let prevTime;
40808
+ let enableOverride = null;
40809
+ let namespacesCache;
40810
+ let enabledCache;
40811
+ function debug(...args) {
40812
+ if (!debug.enabled) return;
40813
+ const self = debug;
40814
+ const curr = Number(/* @__PURE__ */ new Date());
40815
+ self.diff = curr - (prevTime || curr);
40816
+ self.prev = prevTime;
40817
+ self.curr = curr;
40818
+ prevTime = curr;
40819
+ args[0] = createDebug.coerce(args[0]);
40820
+ if (typeof args[0] !== "string") args.unshift("%O");
40821
+ let index = 0;
40822
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
40823
+ if (match === "%%") return "%";
40824
+ index++;
40825
+ const formatter = createDebug.formatters[format];
40826
+ if (typeof formatter === "function") {
40827
+ const val = args[index];
40828
+ match = formatter.call(self, val);
40829
+ args.splice(index, 1);
40830
+ index--;
40831
+ }
40832
+ return match;
40833
+ });
40834
+ createDebug.formatArgs.call(self, args);
40835
+ (self.log || createDebug.log).apply(self, args);
40836
+ }
40837
+ debug.namespace = namespace;
40838
+ debug.useColors = createDebug.useColors();
40839
+ debug.color = createDebug.selectColor(namespace);
40840
+ debug.extend = extend;
40841
+ debug.destroy = createDebug.destroy;
40842
+ Object.defineProperty(debug, "enabled", {
40843
+ enumerable: true,
40844
+ configurable: false,
40845
+ get: () => {
40846
+ if (enableOverride !== null) return enableOverride;
40847
+ if (namespacesCache !== createDebug.namespaces) {
40848
+ namespacesCache = createDebug.namespaces;
40849
+ enabledCache = createDebug.enabled(namespace);
40850
+ }
40851
+ return enabledCache;
40852
+ },
40853
+ set: (v) => {
40854
+ enableOverride = v;
40855
+ }
40856
+ });
40857
+ if (typeof createDebug.init === "function") createDebug.init(debug);
40858
+ return debug;
40859
+ }
40860
+ function extend(namespace, delimiter) {
40861
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
40862
+ newDebug.log = this.log;
40863
+ return newDebug;
40864
+ }
40865
+ /**
40866
+ * Enables a debug mode by namespaces. This can include modes
40867
+ * separated by a colon and wildcards.
40868
+ *
40869
+ * @param {String} namespaces
40870
+ * @api public
40871
+ */
40872
+ function enable(namespaces) {
40873
+ createDebug.save(namespaces);
40874
+ createDebug.namespaces = namespaces;
40875
+ createDebug.names = [];
40876
+ createDebug.skips = [];
40877
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
40878
+ for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
40879
+ else createDebug.names.push(ns);
40880
+ }
40881
+ /**
40882
+ * Checks if the given string matches a namespace template, honoring
40883
+ * asterisks as wildcards.
40884
+ *
40885
+ * @param {String} search
40886
+ * @param {String} template
40887
+ * @return {Boolean}
40888
+ */
40889
+ function matchesTemplate(search, template) {
40890
+ let searchIndex = 0;
40891
+ let templateIndex = 0;
40892
+ let starIndex = -1;
40893
+ let matchIndex = 0;
40894
+ while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
40895
+ starIndex = templateIndex;
40896
+ matchIndex = searchIndex;
40897
+ templateIndex++;
40898
+ } else {
40899
+ searchIndex++;
40900
+ templateIndex++;
40901
+ }
40902
+ else if (starIndex !== -1) {
40903
+ templateIndex = starIndex + 1;
40904
+ matchIndex++;
40905
+ searchIndex = matchIndex;
40906
+ } else return false;
40907
+ while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
40908
+ return templateIndex === template.length;
40909
+ }
40910
+ /**
40911
+ * Disable debug output.
40912
+ *
40913
+ * @return {String} namespaces
40914
+ * @api public
40915
+ */
40916
+ function disable() {
40917
+ const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
40918
+ createDebug.enable("");
40919
+ return namespaces;
40920
+ }
40921
+ /**
40922
+ * Returns true if the given mode name is enabled, false otherwise.
40923
+ *
40924
+ * @param {String} name
40925
+ * @return {Boolean}
40926
+ * @api public
40927
+ */
40928
+ function enabled(name) {
40929
+ for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
40930
+ for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
40931
+ return false;
40932
+ }
40933
+ /**
40934
+ * Coerce `val`.
40935
+ *
40936
+ * @param {Mixed} val
40937
+ * @return {Mixed}
40938
+ * @api private
40939
+ */
40940
+ function coerce(val) {
40941
+ if (val instanceof Error) return val.stack || val.message;
40942
+ return val;
40943
+ }
40944
+ /**
40945
+ * XXX DO NOT USE. This is a temporary stub function.
40946
+ * XXX It WILL be removed in the next major release.
40947
+ */
40948
+ function destroy() {
40949
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
40950
+ }
40951
+ createDebug.enable(createDebug.load());
40952
+ return createDebug;
40953
+ }
40954
+ module.exports = setup;
40955
+ }));
40956
+ //#endregion
40957
+ //#region ../../node_modules/debug/src/browser.js
40958
+ var require_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40959
+ /**
40960
+ * This is the web browser implementation of `debug()`.
40961
+ */
40962
+ exports.formatArgs = formatArgs;
40963
+ exports.save = save;
40964
+ exports.load = load;
40965
+ exports.useColors = useColors;
40966
+ exports.storage = localstorage();
40967
+ exports.destroy = (() => {
40968
+ let warned = false;
40969
+ return () => {
40970
+ if (!warned) {
40971
+ warned = true;
40972
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
40973
+ }
40974
+ };
40975
+ })();
40976
+ /**
40977
+ * Colors.
40978
+ */
40979
+ exports.colors = [
40980
+ "#0000CC",
40981
+ "#0000FF",
40982
+ "#0033CC",
40983
+ "#0033FF",
40984
+ "#0066CC",
40985
+ "#0066FF",
40986
+ "#0099CC",
40987
+ "#0099FF",
40988
+ "#00CC00",
40989
+ "#00CC33",
40990
+ "#00CC66",
40991
+ "#00CC99",
40992
+ "#00CCCC",
40993
+ "#00CCFF",
40994
+ "#3300CC",
40995
+ "#3300FF",
40996
+ "#3333CC",
40997
+ "#3333FF",
40998
+ "#3366CC",
40999
+ "#3366FF",
41000
+ "#3399CC",
41001
+ "#3399FF",
41002
+ "#33CC00",
41003
+ "#33CC33",
41004
+ "#33CC66",
41005
+ "#33CC99",
41006
+ "#33CCCC",
41007
+ "#33CCFF",
41008
+ "#6600CC",
41009
+ "#6600FF",
41010
+ "#6633CC",
41011
+ "#6633FF",
41012
+ "#66CC00",
41013
+ "#66CC33",
41014
+ "#9900CC",
41015
+ "#9900FF",
41016
+ "#9933CC",
41017
+ "#9933FF",
41018
+ "#99CC00",
41019
+ "#99CC33",
41020
+ "#CC0000",
41021
+ "#CC0033",
41022
+ "#CC0066",
41023
+ "#CC0099",
41024
+ "#CC00CC",
41025
+ "#CC00FF",
41026
+ "#CC3300",
41027
+ "#CC3333",
41028
+ "#CC3366",
41029
+ "#CC3399",
41030
+ "#CC33CC",
41031
+ "#CC33FF",
41032
+ "#CC6600",
41033
+ "#CC6633",
41034
+ "#CC9900",
41035
+ "#CC9933",
41036
+ "#CCCC00",
41037
+ "#CCCC33",
41038
+ "#FF0000",
41039
+ "#FF0033",
41040
+ "#FF0066",
41041
+ "#FF0099",
41042
+ "#FF00CC",
41043
+ "#FF00FF",
41044
+ "#FF3300",
41045
+ "#FF3333",
41046
+ "#FF3366",
41047
+ "#FF3399",
41048
+ "#FF33CC",
41049
+ "#FF33FF",
41050
+ "#FF6600",
41051
+ "#FF6633",
41052
+ "#FF9900",
41053
+ "#FF9933",
41054
+ "#FFCC00",
41055
+ "#FFCC33"
41056
+ ];
41057
+ /**
41058
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
41059
+ * and the Firebug extension (any Firefox version) are known
41060
+ * to support "%c" CSS customizations.
41061
+ *
41062
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
41063
+ */
41064
+ function useColors() {
41065
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
41066
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
41067
+ let m;
41068
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
41069
+ }
41070
+ /**
41071
+ * Colorize log arguments if enabled.
41072
+ *
41073
+ * @api public
41074
+ */
41075
+ function formatArgs(args) {
41076
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
41077
+ if (!this.useColors) return;
41078
+ const c = "color: " + this.color;
41079
+ args.splice(1, 0, c, "color: inherit");
41080
+ let index = 0;
41081
+ let lastC = 0;
41082
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
41083
+ if (match === "%%") return;
41084
+ index++;
41085
+ if (match === "%c") lastC = index;
41086
+ });
41087
+ args.splice(lastC, 0, c);
41088
+ }
41089
+ /**
41090
+ * Invokes `console.debug()` when available.
41091
+ * No-op when `console.debug` is not a "function".
41092
+ * If `console.debug` is not available, falls back
41093
+ * to `console.log`.
41094
+ *
41095
+ * @api public
41096
+ */
41097
+ exports.log = console.debug || console.log || (() => {});
41098
+ /**
41099
+ * Save `namespaces`.
41100
+ *
41101
+ * @param {String} namespaces
41102
+ * @api private
41103
+ */
41104
+ function save(namespaces) {
41105
+ try {
41106
+ if (namespaces) exports.storage.setItem("debug", namespaces);
41107
+ else exports.storage.removeItem("debug");
41108
+ } catch (error) {}
41109
+ }
41110
+ /**
41111
+ * Load `namespaces`.
41112
+ *
41113
+ * @return {String} returns the previously persisted debug modes
41114
+ * @api private
41115
+ */
41116
+ function load() {
41117
+ let r;
41118
+ try {
41119
+ r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
41120
+ } catch (error) {}
41121
+ if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
41122
+ return r;
41123
+ }
41124
+ /**
41125
+ * Localstorage attempts to return the localstorage.
41126
+ *
41127
+ * This is necessary because safari throws
41128
+ * when a user disables cookies/localstorage
41129
+ * and you attempt to access it.
41130
+ *
41131
+ * @return {LocalStorage}
41132
+ * @api private
41133
+ */
41134
+ function localstorage() {
41135
+ try {
41136
+ return localStorage;
41137
+ } catch (error) {}
41138
+ }
41139
+ module.exports = require_common$1()(exports);
41140
+ var { formatters } = module.exports;
41141
+ /**
41142
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
41143
+ */
41144
+ formatters.j = function(v) {
41145
+ try {
41146
+ return JSON.stringify(v);
41147
+ } catch (error) {
41148
+ return "[UnexpectedJSONParseError]: " + error.message;
41149
+ }
41150
+ };
41151
+ }));
41152
+ //#endregion
41153
+ //#region ../../node_modules/has-flag/index.js
41154
+ var require_has_flag$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41155
+ module.exports = (flag, argv = process.argv) => {
41156
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
41157
+ const position = argv.indexOf(prefix + flag);
41158
+ const terminatorPosition = argv.indexOf("--");
41159
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
41160
+ };
41161
+ }));
41162
+ //#endregion
41163
+ //#region ../../node_modules/supports-color/index.js
41164
+ var require_supports_color$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41165
+ var os$11 = __require("os");
41166
+ var tty$1 = __require("tty");
41167
+ var hasFlag = require_has_flag$1();
41168
+ var { env } = process;
41169
+ var flagForceColor;
41170
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
41171
+ else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
41172
+ function envForceColor() {
41173
+ if ("FORCE_COLOR" in env) {
41174
+ if (env.FORCE_COLOR === "true") return 1;
41175
+ if (env.FORCE_COLOR === "false") return 0;
41176
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
41177
+ }
41178
+ }
41179
+ function translateLevel(level) {
41180
+ if (level === 0) return false;
41181
+ return {
41182
+ level,
41183
+ hasBasic: true,
41184
+ has256: level >= 2,
41185
+ has16m: level >= 3
41186
+ };
41187
+ }
41188
+ function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
41189
+ const noFlagForceColor = envForceColor();
41190
+ if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
41191
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
41192
+ if (forceColor === 0) return 0;
41193
+ if (sniffFlags) {
41194
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
41195
+ if (hasFlag("color=256")) return 2;
41196
+ }
41197
+ if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
41198
+ const min = forceColor || 0;
41199
+ if (env.TERM === "dumb") return min;
41200
+ if (process.platform === "win32") {
41201
+ const osRelease = os$11.release().split(".");
41202
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
41203
+ return 1;
41204
+ }
41205
+ if ("CI" in env) {
41206
+ if ([
41207
+ "TRAVIS",
41208
+ "CIRCLECI",
41209
+ "APPVEYOR",
41210
+ "GITLAB_CI",
41211
+ "GITHUB_ACTIONS",
41212
+ "BUILDKITE",
41213
+ "DRONE"
41214
+ ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
41215
+ return min;
41216
+ }
41217
+ if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
41218
+ if (env.COLORTERM === "truecolor") return 3;
41219
+ if ("TERM_PROGRAM" in env) {
41220
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
41221
+ switch (env.TERM_PROGRAM) {
41222
+ case "iTerm.app": return version >= 3 ? 3 : 2;
41223
+ case "Apple_Terminal": return 2;
41224
+ }
41225
+ }
41226
+ if (/-256(color)?$/i.test(env.TERM)) return 2;
41227
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
41228
+ if ("COLORTERM" in env) return 1;
41229
+ return min;
41230
+ }
41231
+ function getSupportLevel(stream, options = {}) {
41232
+ return translateLevel(supportsColor(stream, {
41233
+ streamIsTTY: stream && stream.isTTY,
41234
+ ...options
41235
+ }));
41236
+ }
41237
+ module.exports = {
41238
+ supportsColor: getSupportLevel,
41239
+ stdout: getSupportLevel({ isTTY: tty$1.isatty(1) }),
41240
+ stderr: getSupportLevel({ isTTY: tty$1.isatty(2) })
41241
+ };
41242
+ }));
41243
+ //#endregion
41244
+ //#region ../../node_modules/debug/src/node.js
41245
+ var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41246
+ /**
41247
+ * Module dependencies.
41248
+ */
41249
+ var tty = __require("tty");
41250
+ var util$5 = __require("util");
41251
+ /**
41252
+ * This is the Node.js implementation of `debug()`.
41253
+ */
41254
+ exports.init = init;
41255
+ exports.log = log;
41256
+ exports.formatArgs = formatArgs;
41257
+ exports.save = save;
41258
+ exports.load = load;
41259
+ exports.useColors = useColors;
41260
+ exports.destroy = util$5.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
41261
+ /**
41262
+ * Colors.
41263
+ */
41264
+ exports.colors = [
41265
+ 6,
41266
+ 2,
41267
+ 3,
41268
+ 4,
41269
+ 5,
41270
+ 1
41271
+ ];
41272
+ try {
41273
+ const supportsColor = require_supports_color$1();
41274
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
41275
+ 20,
41276
+ 21,
41277
+ 26,
41278
+ 27,
41279
+ 32,
41280
+ 33,
41281
+ 38,
41282
+ 39,
41283
+ 40,
41284
+ 41,
41285
+ 42,
41286
+ 43,
41287
+ 44,
41288
+ 45,
41289
+ 56,
41290
+ 57,
41291
+ 62,
41292
+ 63,
41293
+ 68,
41294
+ 69,
41295
+ 74,
41296
+ 75,
41297
+ 76,
41298
+ 77,
41299
+ 78,
41300
+ 79,
41301
+ 80,
41302
+ 81,
41303
+ 92,
41304
+ 93,
41305
+ 98,
41306
+ 99,
41307
+ 112,
41308
+ 113,
41309
+ 128,
41310
+ 129,
41311
+ 134,
41312
+ 135,
41313
+ 148,
41314
+ 149,
41315
+ 160,
41316
+ 161,
41317
+ 162,
41318
+ 163,
41319
+ 164,
41320
+ 165,
41321
+ 166,
41322
+ 167,
41323
+ 168,
41324
+ 169,
41325
+ 170,
41326
+ 171,
41327
+ 172,
41328
+ 173,
41329
+ 178,
41330
+ 179,
41331
+ 184,
41332
+ 185,
41333
+ 196,
41334
+ 197,
41335
+ 198,
41336
+ 199,
41337
+ 200,
41338
+ 201,
41339
+ 202,
41340
+ 203,
41341
+ 204,
41342
+ 205,
41343
+ 206,
41344
+ 207,
41345
+ 208,
41346
+ 209,
41347
+ 214,
41348
+ 215,
41349
+ 220,
41350
+ 221
41351
+ ];
41352
+ } catch (error) {}
41353
+ /**
41354
+ * Build up the default `inspectOpts` object from the environment variables.
41355
+ *
41356
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
41357
+ */
41358
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
41359
+ return /^debug_/i.test(key);
41360
+ }).reduce((obj, key) => {
41361
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
41362
+ return k.toUpperCase();
41363
+ });
41364
+ let val = process.env[key];
41365
+ if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
41366
+ else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
41367
+ else if (val === "null") val = null;
41368
+ else val = Number(val);
41369
+ obj[prop] = val;
41370
+ return obj;
41371
+ }, {});
41372
+ /**
41373
+ * Is stdout a TTY? Colored output is enabled when `true`.
41374
+ */
41375
+ function useColors() {
41376
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
41377
+ }
41378
+ /**
41379
+ * Adds ANSI color escape codes if enabled.
41380
+ *
41381
+ * @api public
41382
+ */
41383
+ function formatArgs(args) {
41384
+ const { namespace: name, useColors } = this;
41385
+ if (useColors) {
41386
+ const c = this.color;
41387
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
41388
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
41389
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
41390
+ args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
41391
+ } else args[0] = getDate() + name + " " + args[0];
41392
+ }
41393
+ function getDate() {
41394
+ if (exports.inspectOpts.hideDate) return "";
41395
+ return (/* @__PURE__ */ new Date()).toISOString() + " ";
41396
+ }
41397
+ /**
41398
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
41399
+ */
41400
+ function log(...args) {
41401
+ return process.stderr.write(util$5.formatWithOptions(exports.inspectOpts, ...args) + "\n");
41402
+ }
41403
+ /**
41404
+ * Save `namespaces`.
41405
+ *
41406
+ * @param {String} namespaces
41407
+ * @api private
41408
+ */
41409
+ function save(namespaces) {
41410
+ if (namespaces) process.env.DEBUG = namespaces;
41411
+ else delete process.env.DEBUG;
41412
+ }
41413
+ /**
41414
+ * Load `namespaces`.
41415
+ *
41416
+ * @return {String} returns the previously persisted debug modes
41417
+ * @api private
41418
+ */
41419
+ function load() {
41420
+ return process.env.DEBUG;
41421
+ }
41422
+ /**
41423
+ * Init logic for `debug` instances.
41424
+ *
41425
+ * Create a new `inspectOpts` object in case `useColors` is set
41426
+ * differently for a particular `debug` instance.
41427
+ */
41428
+ function init(debug) {
41429
+ debug.inspectOpts = {};
41430
+ const keys = Object.keys(exports.inspectOpts);
41431
+ for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
41432
+ }
41433
+ module.exports = require_common$1()(exports);
41434
+ var { formatters } = module.exports;
41435
+ /**
41436
+ * Map %o to `util.inspect()`, all on a single line.
41437
+ */
41438
+ formatters.o = function(v) {
41439
+ this.inspectOpts.colors = this.useColors;
41440
+ return util$5.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
41441
+ };
41442
+ /**
41443
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
41444
+ */
41445
+ formatters.O = function(v) {
41446
+ this.inspectOpts.colors = this.useColors;
41447
+ return util$5.inspect(v, this.inspectOpts);
41448
+ };
41449
+ }));
41450
+ //#endregion
41451
+ //#region ../../node_modules/debug/src/index.js
41452
+ var require_src = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41453
+ /**
41454
+ * Detect Electron renderer / nwjs process, which is node, but we should
41455
+ * treat as a browser.
41456
+ */
41457
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
41458
+ else module.exports = require_node();
41459
+ }));
41460
+ //#endregion
40771
41461
  //#region ../../node_modules/moleculer/src/loggers/debug.js
40772
41462
  var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40773
41463
  var BaseLogger = require_base$4();
@@ -40838,7 +41528,7 @@ var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40838
41528
  var require_file$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40839
41529
  var FormattedLogger = require_formatted();
40840
41530
  var _ = require_lodash();
40841
- var fs$13 = __require("fs/promises");
41531
+ var fs$14 = __require("fs/promises");
40842
41532
  var path$36 = __require("path");
40843
41533
  var os$10 = __require("os");
40844
41534
  var { makeDirs } = require_utils$3();
@@ -40942,7 +41632,7 @@ var require_file$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
40942
41632
  const rows = Array.from(this.queue);
40943
41633
  this.queue.length = 0;
40944
41634
  const buf = rows.join(this.opts.eol) + this.opts.eol;
40945
- return fs$13.appendFile(filename, buf).catch((err) => {
41635
+ return fs$14.appendFile(filename, buf).catch((err) => {
40946
41636
  /* istanbul ignore next */
40947
41637
  console.debug("Unable to write log file:", filename, err);
40948
41638
  });
@@ -41090,7 +41780,7 @@ var require_rfdc = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41090
41780
  //#endregion
41091
41781
  //#region ../../node_modules/log4js/lib/configuration.js
41092
41782
  var require_configuration = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41093
- var util$3 = __require("util");
41783
+ var util$4 = __require("util");
41094
41784
  var debug = require_src()("log4js:configuration");
41095
41785
  var preProcessingListeners = [];
41096
41786
  var listeners = [];
@@ -41108,7 +41798,7 @@ var require_configuration = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
41108
41798
  };
41109
41799
  var throwExceptionIf = (config, checks, message) => {
41110
41800
  (Array.isArray(checks) ? checks : [checks]).forEach((test) => {
41111
- if (test) throw new Error(`Problem with log4js configuration: (${util$3.inspect(config, { depth: 5 })}) - ${message}`);
41801
+ if (test) throw new Error(`Problem with log4js configuration: (${util$4.inspect(config, { depth: 5 })}) - ${message}`);
41112
41802
  });
41113
41803
  };
41114
41804
  var configure = (candidate) => {
@@ -41290,7 +41980,7 @@ var require_lib$5 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41290
41980
  var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41291
41981
  var dateFormat = require_lib$5();
41292
41982
  var os$9 = __require("os");
41293
- var util$2 = __require("util");
41983
+ var util$3 = __require("util");
41294
41984
  var path$35 = __require("path");
41295
41985
  var styles = {
41296
41986
  bold: [1, 22],
@@ -41320,7 +42010,7 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41320
42010
  return colorizeStart(style) + str + colorizeEnd(style);
41321
42011
  }
41322
42012
  function timestampLevelAndCategory(loggingEvent, colour) {
41323
- return colorize(util$2.format("[%s] [%s] %s - ", dateFormat.asString(loggingEvent.startTime), loggingEvent.level.toString(), loggingEvent.categoryName), colour);
42013
+ return colorize(util$3.format("[%s] [%s] %s - ", dateFormat.asString(loggingEvent.startTime), loggingEvent.level.toString(), loggingEvent.categoryName), colour);
41324
42014
  }
41325
42015
  /**
41326
42016
  * BasicLayout is a simple layout for storing the logs. The logs are stored
@@ -41332,17 +42022,17 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41332
42022
  * @author Stephan Strittmatter
41333
42023
  */
41334
42024
  function basicLayout(loggingEvent) {
41335
- return timestampLevelAndCategory(loggingEvent) + util$2.format(...loggingEvent.data);
42025
+ return timestampLevelAndCategory(loggingEvent) + util$3.format(...loggingEvent.data);
41336
42026
  }
41337
42027
  /**
41338
42028
  * colouredLayout - taken from masylum's fork.
41339
42029
  * same as basicLayout, but with colours.
41340
42030
  */
41341
42031
  function colouredLayout(loggingEvent) {
41342
- return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$2.format(...loggingEvent.data);
42032
+ return timestampLevelAndCategory(loggingEvent, loggingEvent.level.colour) + util$3.format(...loggingEvent.data);
41343
42033
  }
41344
42034
  function messagePassThroughLayout(loggingEvent) {
41345
- return util$2.format(...loggingEvent.data);
42035
+ return util$3.format(...loggingEvent.data);
41346
42036
  }
41347
42037
  function dummyLayout(loggingEvent) {
41348
42038
  return loggingEvent.data[0];
@@ -41418,7 +42108,7 @@ var require_layouts = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41418
42108
  return os$9.hostname().toString();
41419
42109
  }
41420
42110
  function formatMessage(loggingEvent) {
41421
- return util$2.format(...loggingEvent.data);
42111
+ return util$3.format(...loggingEvent.data);
41422
42112
  }
41423
42113
  function endOfLine() {
41424
42114
  return os$9.EOL;
@@ -41697,10 +42387,10 @@ var require_levels$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
41697
42387
  //#region ../../node_modules/flatted/esm/index.js
41698
42388
  var esm_exports$1 = /* @__PURE__ */ __exportAll({
41699
42389
  default: () => Flatted,
41700
- parse: () => parse,
42390
+ parse: () => parse$1,
41701
42391
  stringify: () => stringify
41702
42392
  });
41703
- var Flatted, parse, stringify;
42393
+ var Flatted, parse$1, stringify;
41704
42394
  var init_esm$1 = __esmMin((() => {
41705
42395
  Flatted = function(Primitive, primitive) {
41706
42396
  /*!
@@ -41777,7 +42467,7 @@ var init_esm$1 = __esmMin((() => {
41777
42467
  return typeof value === primitive ? new Primitive(value) : value;
41778
42468
  }
41779
42469
  }(String, "string");
41780
- parse = Flatted.parse;
42470
+ parse$1 = Flatted.parse;
41781
42471
  stringify = Flatted.stringify;
41782
42472
  }));
41783
42473
  //#endregion
@@ -42100,6 +42790,720 @@ var require_universalify = /* @__PURE__ */ __commonJSMin$1(((exports) => {
42100
42790
  };
42101
42791
  }));
42102
42792
  //#endregion
42793
+ //#region ../../node_modules/graceful-fs/polyfills.js
42794
+ var require_polyfills = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
42795
+ var constants$1 = __require("constants");
42796
+ var origCwd = process.cwd;
42797
+ var cwd = null;
42798
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
42799
+ process.cwd = function() {
42800
+ if (!cwd) cwd = origCwd.call(process);
42801
+ return cwd;
42802
+ };
42803
+ try {
42804
+ process.cwd();
42805
+ } catch (er) {}
42806
+ if (typeof process.chdir === "function") {
42807
+ var chdir = process.chdir;
42808
+ process.chdir = function(d) {
42809
+ cwd = null;
42810
+ chdir.call(process, d);
42811
+ };
42812
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
42813
+ }
42814
+ module.exports = patch;
42815
+ function patch(fs) {
42816
+ if (constants$1.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
42817
+ if (!fs.lutimes) patchLutimes(fs);
42818
+ fs.chown = chownFix(fs.chown);
42819
+ fs.fchown = chownFix(fs.fchown);
42820
+ fs.lchown = chownFix(fs.lchown);
42821
+ fs.chmod = chmodFix(fs.chmod);
42822
+ fs.fchmod = chmodFix(fs.fchmod);
42823
+ fs.lchmod = chmodFix(fs.lchmod);
42824
+ fs.chownSync = chownFixSync(fs.chownSync);
42825
+ fs.fchownSync = chownFixSync(fs.fchownSync);
42826
+ fs.lchownSync = chownFixSync(fs.lchownSync);
42827
+ fs.chmodSync = chmodFixSync(fs.chmodSync);
42828
+ fs.fchmodSync = chmodFixSync(fs.fchmodSync);
42829
+ fs.lchmodSync = chmodFixSync(fs.lchmodSync);
42830
+ fs.stat = statFix(fs.stat);
42831
+ fs.fstat = statFix(fs.fstat);
42832
+ fs.lstat = statFix(fs.lstat);
42833
+ fs.statSync = statFixSync(fs.statSync);
42834
+ fs.fstatSync = statFixSync(fs.fstatSync);
42835
+ fs.lstatSync = statFixSync(fs.lstatSync);
42836
+ if (fs.chmod && !fs.lchmod) {
42837
+ fs.lchmod = function(path, mode, cb) {
42838
+ if (cb) process.nextTick(cb);
42839
+ };
42840
+ fs.lchmodSync = function() {};
42841
+ }
42842
+ if (fs.chown && !fs.lchown) {
42843
+ fs.lchown = function(path, uid, gid, cb) {
42844
+ if (cb) process.nextTick(cb);
42845
+ };
42846
+ fs.lchownSync = function() {};
42847
+ }
42848
+ if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
42849
+ function rename(from, to, cb) {
42850
+ var start = Date.now();
42851
+ var backoff = 0;
42852
+ fs$rename(from, to, function CB(er) {
42853
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
42854
+ setTimeout(function() {
42855
+ fs.stat(to, function(stater, st) {
42856
+ if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
42857
+ else cb(er);
42858
+ });
42859
+ }, backoff);
42860
+ if (backoff < 100) backoff += 10;
42861
+ return;
42862
+ }
42863
+ if (cb) cb(er);
42864
+ });
42865
+ }
42866
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
42867
+ return rename;
42868
+ })(fs.rename);
42869
+ fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
42870
+ function read(fd, buffer, offset, length, position, callback_) {
42871
+ var callback;
42872
+ if (callback_ && typeof callback_ === "function") {
42873
+ var eagCounter = 0;
42874
+ callback = function(er, _, __) {
42875
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
42876
+ eagCounter++;
42877
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
42878
+ }
42879
+ callback_.apply(this, arguments);
42880
+ };
42881
+ }
42882
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
42883
+ }
42884
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
42885
+ return read;
42886
+ })(fs.read);
42887
+ fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
42888
+ return function(fd, buffer, offset, length, position) {
42889
+ var eagCounter = 0;
42890
+ while (true) try {
42891
+ return fs$readSync.call(fs, fd, buffer, offset, length, position);
42892
+ } catch (er) {
42893
+ if (er.code === "EAGAIN" && eagCounter < 10) {
42894
+ eagCounter++;
42895
+ continue;
42896
+ }
42897
+ throw er;
42898
+ }
42899
+ };
42900
+ })(fs.readSync);
42901
+ function patchLchmod(fs) {
42902
+ fs.lchmod = function(path, mode, callback) {
42903
+ fs.open(path, constants$1.O_WRONLY | constants$1.O_SYMLINK, mode, function(err, fd) {
42904
+ if (err) {
42905
+ if (callback) callback(err);
42906
+ return;
42907
+ }
42908
+ fs.fchmod(fd, mode, function(err) {
42909
+ fs.close(fd, function(err2) {
42910
+ if (callback) callback(err || err2);
42911
+ });
42912
+ });
42913
+ });
42914
+ };
42915
+ fs.lchmodSync = function(path, mode) {
42916
+ var fd = fs.openSync(path, constants$1.O_WRONLY | constants$1.O_SYMLINK, mode);
42917
+ var threw = true;
42918
+ var ret;
42919
+ try {
42920
+ ret = fs.fchmodSync(fd, mode);
42921
+ threw = false;
42922
+ } finally {
42923
+ if (threw) try {
42924
+ fs.closeSync(fd);
42925
+ } catch (er) {}
42926
+ else fs.closeSync(fd);
42927
+ }
42928
+ return ret;
42929
+ };
42930
+ }
42931
+ function patchLutimes(fs) {
42932
+ if (constants$1.hasOwnProperty("O_SYMLINK") && fs.futimes) {
42933
+ fs.lutimes = function(path, at, mt, cb) {
42934
+ fs.open(path, constants$1.O_SYMLINK, function(er, fd) {
42935
+ if (er) {
42936
+ if (cb) cb(er);
42937
+ return;
42938
+ }
42939
+ fs.futimes(fd, at, mt, function(er) {
42940
+ fs.close(fd, function(er2) {
42941
+ if (cb) cb(er || er2);
42942
+ });
42943
+ });
42944
+ });
42945
+ };
42946
+ fs.lutimesSync = function(path, at, mt) {
42947
+ var fd = fs.openSync(path, constants$1.O_SYMLINK);
42948
+ var ret;
42949
+ var threw = true;
42950
+ try {
42951
+ ret = fs.futimesSync(fd, at, mt);
42952
+ threw = false;
42953
+ } finally {
42954
+ if (threw) try {
42955
+ fs.closeSync(fd);
42956
+ } catch (er) {}
42957
+ else fs.closeSync(fd);
42958
+ }
42959
+ return ret;
42960
+ };
42961
+ } else if (fs.futimes) {
42962
+ fs.lutimes = function(_a, _b, _c, cb) {
42963
+ if (cb) process.nextTick(cb);
42964
+ };
42965
+ fs.lutimesSync = function() {};
42966
+ }
42967
+ }
42968
+ function chmodFix(orig) {
42969
+ if (!orig) return orig;
42970
+ return function(target, mode, cb) {
42971
+ return orig.call(fs, target, mode, function(er) {
42972
+ if (chownErOk(er)) er = null;
42973
+ if (cb) cb.apply(this, arguments);
42974
+ });
42975
+ };
42976
+ }
42977
+ function chmodFixSync(orig) {
42978
+ if (!orig) return orig;
42979
+ return function(target, mode) {
42980
+ try {
42981
+ return orig.call(fs, target, mode);
42982
+ } catch (er) {
42983
+ if (!chownErOk(er)) throw er;
42984
+ }
42985
+ };
42986
+ }
42987
+ function chownFix(orig) {
42988
+ if (!orig) return orig;
42989
+ return function(target, uid, gid, cb) {
42990
+ return orig.call(fs, target, uid, gid, function(er) {
42991
+ if (chownErOk(er)) er = null;
42992
+ if (cb) cb.apply(this, arguments);
42993
+ });
42994
+ };
42995
+ }
42996
+ function chownFixSync(orig) {
42997
+ if (!orig) return orig;
42998
+ return function(target, uid, gid) {
42999
+ try {
43000
+ return orig.call(fs, target, uid, gid);
43001
+ } catch (er) {
43002
+ if (!chownErOk(er)) throw er;
43003
+ }
43004
+ };
43005
+ }
43006
+ function statFix(orig) {
43007
+ if (!orig) return orig;
43008
+ return function(target, options, cb) {
43009
+ if (typeof options === "function") {
43010
+ cb = options;
43011
+ options = null;
43012
+ }
43013
+ function callback(er, stats) {
43014
+ if (stats) {
43015
+ if (stats.uid < 0) stats.uid += 4294967296;
43016
+ if (stats.gid < 0) stats.gid += 4294967296;
43017
+ }
43018
+ if (cb) cb.apply(this, arguments);
43019
+ }
43020
+ return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
43021
+ };
43022
+ }
43023
+ function statFixSync(orig) {
43024
+ if (!orig) return orig;
43025
+ return function(target, options) {
43026
+ var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
43027
+ if (stats) {
43028
+ if (stats.uid < 0) stats.uid += 4294967296;
43029
+ if (stats.gid < 0) stats.gid += 4294967296;
43030
+ }
43031
+ return stats;
43032
+ };
43033
+ }
43034
+ function chownErOk(er) {
43035
+ if (!er) return true;
43036
+ if (er.code === "ENOSYS") return true;
43037
+ if (!process.getuid || process.getuid() !== 0) {
43038
+ if (er.code === "EINVAL" || er.code === "EPERM") return true;
43039
+ }
43040
+ return false;
43041
+ }
43042
+ }
43043
+ }));
43044
+ //#endregion
43045
+ //#region ../../node_modules/graceful-fs/legacy-streams.js
43046
+ var require_legacy_streams = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
43047
+ var Stream$2 = __require("stream").Stream;
43048
+ module.exports = legacy;
43049
+ function legacy(fs) {
43050
+ return {
43051
+ ReadStream,
43052
+ WriteStream
43053
+ };
43054
+ function ReadStream(path, options) {
43055
+ if (!(this instanceof ReadStream)) return new ReadStream(path, options);
43056
+ Stream$2.call(this);
43057
+ var self = this;
43058
+ this.path = path;
43059
+ this.fd = null;
43060
+ this.readable = true;
43061
+ this.paused = false;
43062
+ this.flags = "r";
43063
+ this.mode = 438;
43064
+ this.bufferSize = 64 * 1024;
43065
+ options = options || {};
43066
+ var keys = Object.keys(options);
43067
+ for (var index = 0, length = keys.length; index < length; index++) {
43068
+ var key = keys[index];
43069
+ this[key] = options[key];
43070
+ }
43071
+ if (this.encoding) this.setEncoding(this.encoding);
43072
+ if (this.start !== void 0) {
43073
+ if ("number" !== typeof this.start) throw TypeError("start must be a Number");
43074
+ if (this.end === void 0) this.end = Infinity;
43075
+ else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
43076
+ if (this.start > this.end) throw new Error("start must be <= end");
43077
+ this.pos = this.start;
43078
+ }
43079
+ if (this.fd !== null) {
43080
+ process.nextTick(function() {
43081
+ self._read();
43082
+ });
43083
+ return;
43084
+ }
43085
+ fs.open(this.path, this.flags, this.mode, function(err, fd) {
43086
+ if (err) {
43087
+ self.emit("error", err);
43088
+ self.readable = false;
43089
+ return;
43090
+ }
43091
+ self.fd = fd;
43092
+ self.emit("open", fd);
43093
+ self._read();
43094
+ });
43095
+ }
43096
+ function WriteStream(path, options) {
43097
+ if (!(this instanceof WriteStream)) return new WriteStream(path, options);
43098
+ Stream$2.call(this);
43099
+ this.path = path;
43100
+ this.fd = null;
43101
+ this.writable = true;
43102
+ this.flags = "w";
43103
+ this.encoding = "binary";
43104
+ this.mode = 438;
43105
+ this.bytesWritten = 0;
43106
+ options = options || {};
43107
+ var keys = Object.keys(options);
43108
+ for (var index = 0, length = keys.length; index < length; index++) {
43109
+ var key = keys[index];
43110
+ this[key] = options[key];
43111
+ }
43112
+ if (this.start !== void 0) {
43113
+ if ("number" !== typeof this.start) throw TypeError("start must be a Number");
43114
+ if (this.start < 0) throw new Error("start must be >= zero");
43115
+ this.pos = this.start;
43116
+ }
43117
+ this.busy = false;
43118
+ this._queue = [];
43119
+ if (this.fd === null) {
43120
+ this._open = fs.open;
43121
+ this._queue.push([
43122
+ this._open,
43123
+ this.path,
43124
+ this.flags,
43125
+ this.mode,
43126
+ void 0
43127
+ ]);
43128
+ this.flush();
43129
+ }
43130
+ }
43131
+ }
43132
+ }));
43133
+ //#endregion
43134
+ //#region ../../node_modules/graceful-fs/clone.js
43135
+ var require_clone = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
43136
+ module.exports = clone;
43137
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
43138
+ return obj.__proto__;
43139
+ };
43140
+ function clone(obj) {
43141
+ if (obj === null || typeof obj !== "object") return obj;
43142
+ if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
43143
+ else var copy = Object.create(null);
43144
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
43145
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
43146
+ });
43147
+ return copy;
43148
+ }
43149
+ }));
43150
+ //#endregion
43151
+ //#region ../../node_modules/graceful-fs/graceful-fs.js
43152
+ var require_graceful_fs = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
43153
+ var fs$13 = __require("fs");
43154
+ var polyfills = require_polyfills();
43155
+ var legacy = require_legacy_streams();
43156
+ var clone = require_clone();
43157
+ var util$2 = __require("util");
43158
+ /* istanbul ignore next - node 0.x polyfill */
43159
+ var gracefulQueue;
43160
+ var previousSymbol;
43161
+ /* istanbul ignore else - node 0.x polyfill */
43162
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
43163
+ gracefulQueue = Symbol.for("graceful-fs.queue");
43164
+ previousSymbol = Symbol.for("graceful-fs.previous");
43165
+ } else {
43166
+ gracefulQueue = "___graceful-fs.queue";
43167
+ previousSymbol = "___graceful-fs.previous";
43168
+ }
43169
+ function noop() {}
43170
+ function publishQueue(context, queue) {
43171
+ Object.defineProperty(context, gracefulQueue, { get: function() {
43172
+ return queue;
43173
+ } });
43174
+ }
43175
+ var debug = noop;
43176
+ if (util$2.debuglog) debug = util$2.debuglog("gfs4");
43177
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
43178
+ var m = util$2.format.apply(util$2, arguments);
43179
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
43180
+ console.error(m);
43181
+ };
43182
+ if (!fs$13[gracefulQueue]) {
43183
+ publishQueue(fs$13, global[gracefulQueue] || []);
43184
+ fs$13.close = (function(fs$close) {
43185
+ function close(fd, cb) {
43186
+ return fs$close.call(fs$13, fd, function(err) {
43187
+ if (!err) resetQueue();
43188
+ if (typeof cb === "function") cb.apply(this, arguments);
43189
+ });
43190
+ }
43191
+ Object.defineProperty(close, previousSymbol, { value: fs$close });
43192
+ return close;
43193
+ })(fs$13.close);
43194
+ fs$13.closeSync = (function(fs$closeSync) {
43195
+ function closeSync(fd) {
43196
+ fs$closeSync.apply(fs$13, arguments);
43197
+ resetQueue();
43198
+ }
43199
+ Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
43200
+ return closeSync;
43201
+ })(fs$13.closeSync);
43202
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
43203
+ debug(fs$13[gracefulQueue]);
43204
+ __require("assert").equal(fs$13[gracefulQueue].length, 0);
43205
+ });
43206
+ }
43207
+ if (!global[gracefulQueue]) publishQueue(global, fs$13[gracefulQueue]);
43208
+ module.exports = patch(clone(fs$13));
43209
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$13.__patched) {
43210
+ module.exports = patch(fs$13);
43211
+ fs$13.__patched = true;
43212
+ }
43213
+ function patch(fs) {
43214
+ polyfills(fs);
43215
+ fs.gracefulify = patch;
43216
+ fs.createReadStream = createReadStream;
43217
+ fs.createWriteStream = createWriteStream;
43218
+ var fs$readFile = fs.readFile;
43219
+ fs.readFile = readFile;
43220
+ function readFile(path, options, cb) {
43221
+ if (typeof options === "function") cb = options, options = null;
43222
+ return go$readFile(path, options, cb);
43223
+ function go$readFile(path, options, cb, startTime) {
43224
+ return fs$readFile(path, options, function(err) {
43225
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43226
+ go$readFile,
43227
+ [
43228
+ path,
43229
+ options,
43230
+ cb
43231
+ ],
43232
+ err,
43233
+ startTime || Date.now(),
43234
+ Date.now()
43235
+ ]);
43236
+ else if (typeof cb === "function") cb.apply(this, arguments);
43237
+ });
43238
+ }
43239
+ }
43240
+ var fs$writeFile = fs.writeFile;
43241
+ fs.writeFile = writeFile;
43242
+ function writeFile(path, data, options, cb) {
43243
+ if (typeof options === "function") cb = options, options = null;
43244
+ return go$writeFile(path, data, options, cb);
43245
+ function go$writeFile(path, data, options, cb, startTime) {
43246
+ return fs$writeFile(path, data, options, function(err) {
43247
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43248
+ go$writeFile,
43249
+ [
43250
+ path,
43251
+ data,
43252
+ options,
43253
+ cb
43254
+ ],
43255
+ err,
43256
+ startTime || Date.now(),
43257
+ Date.now()
43258
+ ]);
43259
+ else if (typeof cb === "function") cb.apply(this, arguments);
43260
+ });
43261
+ }
43262
+ }
43263
+ var fs$appendFile = fs.appendFile;
43264
+ if (fs$appendFile) fs.appendFile = appendFile;
43265
+ function appendFile(path, data, options, cb) {
43266
+ if (typeof options === "function") cb = options, options = null;
43267
+ return go$appendFile(path, data, options, cb);
43268
+ function go$appendFile(path, data, options, cb, startTime) {
43269
+ return fs$appendFile(path, data, options, function(err) {
43270
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43271
+ go$appendFile,
43272
+ [
43273
+ path,
43274
+ data,
43275
+ options,
43276
+ cb
43277
+ ],
43278
+ err,
43279
+ startTime || Date.now(),
43280
+ Date.now()
43281
+ ]);
43282
+ else if (typeof cb === "function") cb.apply(this, arguments);
43283
+ });
43284
+ }
43285
+ }
43286
+ var fs$copyFile = fs.copyFile;
43287
+ if (fs$copyFile) fs.copyFile = copyFile;
43288
+ function copyFile(src, dest, flags, cb) {
43289
+ if (typeof flags === "function") {
43290
+ cb = flags;
43291
+ flags = 0;
43292
+ }
43293
+ return go$copyFile(src, dest, flags, cb);
43294
+ function go$copyFile(src, dest, flags, cb, startTime) {
43295
+ return fs$copyFile(src, dest, flags, function(err) {
43296
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43297
+ go$copyFile,
43298
+ [
43299
+ src,
43300
+ dest,
43301
+ flags,
43302
+ cb
43303
+ ],
43304
+ err,
43305
+ startTime || Date.now(),
43306
+ Date.now()
43307
+ ]);
43308
+ else if (typeof cb === "function") cb.apply(this, arguments);
43309
+ });
43310
+ }
43311
+ }
43312
+ var fs$readdir = fs.readdir;
43313
+ fs.readdir = readdir;
43314
+ var noReaddirOptionVersions = /^v[0-5]\./;
43315
+ function readdir(path, options, cb) {
43316
+ if (typeof options === "function") cb = options, options = null;
43317
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
43318
+ return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
43319
+ } : function go$readdir(path, options, cb, startTime) {
43320
+ return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
43321
+ };
43322
+ return go$readdir(path, options, cb);
43323
+ function fs$readdirCallback(path, options, cb, startTime) {
43324
+ return function(err, files) {
43325
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43326
+ go$readdir,
43327
+ [
43328
+ path,
43329
+ options,
43330
+ cb
43331
+ ],
43332
+ err,
43333
+ startTime || Date.now(),
43334
+ Date.now()
43335
+ ]);
43336
+ else {
43337
+ if (files && files.sort) files.sort();
43338
+ if (typeof cb === "function") cb.call(this, err, files);
43339
+ }
43340
+ };
43341
+ }
43342
+ }
43343
+ if (process.version.substr(0, 4) === "v0.8") {
43344
+ var legStreams = legacy(fs);
43345
+ ReadStream = legStreams.ReadStream;
43346
+ WriteStream = legStreams.WriteStream;
43347
+ }
43348
+ var fs$ReadStream = fs.ReadStream;
43349
+ if (fs$ReadStream) {
43350
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
43351
+ ReadStream.prototype.open = ReadStream$open;
43352
+ }
43353
+ var fs$WriteStream = fs.WriteStream;
43354
+ if (fs$WriteStream) {
43355
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
43356
+ WriteStream.prototype.open = WriteStream$open;
43357
+ }
43358
+ Object.defineProperty(fs, "ReadStream", {
43359
+ get: function() {
43360
+ return ReadStream;
43361
+ },
43362
+ set: function(val) {
43363
+ ReadStream = val;
43364
+ },
43365
+ enumerable: true,
43366
+ configurable: true
43367
+ });
43368
+ Object.defineProperty(fs, "WriteStream", {
43369
+ get: function() {
43370
+ return WriteStream;
43371
+ },
43372
+ set: function(val) {
43373
+ WriteStream = val;
43374
+ },
43375
+ enumerable: true,
43376
+ configurable: true
43377
+ });
43378
+ var FileReadStream = ReadStream;
43379
+ Object.defineProperty(fs, "FileReadStream", {
43380
+ get: function() {
43381
+ return FileReadStream;
43382
+ },
43383
+ set: function(val) {
43384
+ FileReadStream = val;
43385
+ },
43386
+ enumerable: true,
43387
+ configurable: true
43388
+ });
43389
+ var FileWriteStream = WriteStream;
43390
+ Object.defineProperty(fs, "FileWriteStream", {
43391
+ get: function() {
43392
+ return FileWriteStream;
43393
+ },
43394
+ set: function(val) {
43395
+ FileWriteStream = val;
43396
+ },
43397
+ enumerable: true,
43398
+ configurable: true
43399
+ });
43400
+ function ReadStream(path, options) {
43401
+ if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
43402
+ else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
43403
+ }
43404
+ function ReadStream$open() {
43405
+ var that = this;
43406
+ open(that.path, that.flags, that.mode, function(err, fd) {
43407
+ if (err) {
43408
+ if (that.autoClose) that.destroy();
43409
+ that.emit("error", err);
43410
+ } else {
43411
+ that.fd = fd;
43412
+ that.emit("open", fd);
43413
+ that.read();
43414
+ }
43415
+ });
43416
+ }
43417
+ function WriteStream(path, options) {
43418
+ if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
43419
+ else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
43420
+ }
43421
+ function WriteStream$open() {
43422
+ var that = this;
43423
+ open(that.path, that.flags, that.mode, function(err, fd) {
43424
+ if (err) {
43425
+ that.destroy();
43426
+ that.emit("error", err);
43427
+ } else {
43428
+ that.fd = fd;
43429
+ that.emit("open", fd);
43430
+ }
43431
+ });
43432
+ }
43433
+ function createReadStream(path, options) {
43434
+ return new fs.ReadStream(path, options);
43435
+ }
43436
+ function createWriteStream(path, options) {
43437
+ return new fs.WriteStream(path, options);
43438
+ }
43439
+ var fs$open = fs.open;
43440
+ fs.open = open;
43441
+ function open(path, flags, mode, cb) {
43442
+ if (typeof mode === "function") cb = mode, mode = null;
43443
+ return go$open(path, flags, mode, cb);
43444
+ function go$open(path, flags, mode, cb, startTime) {
43445
+ return fs$open(path, flags, mode, function(err, fd) {
43446
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
43447
+ go$open,
43448
+ [
43449
+ path,
43450
+ flags,
43451
+ mode,
43452
+ cb
43453
+ ],
43454
+ err,
43455
+ startTime || Date.now(),
43456
+ Date.now()
43457
+ ]);
43458
+ else if (typeof cb === "function") cb.apply(this, arguments);
43459
+ });
43460
+ }
43461
+ }
43462
+ return fs;
43463
+ }
43464
+ function enqueue(elem) {
43465
+ debug("ENQUEUE", elem[0].name, elem[1]);
43466
+ fs$13[gracefulQueue].push(elem);
43467
+ retry();
43468
+ }
43469
+ var retryTimer;
43470
+ function resetQueue() {
43471
+ var now = Date.now();
43472
+ for (var i = 0; i < fs$13[gracefulQueue].length; ++i) if (fs$13[gracefulQueue][i].length > 2) {
43473
+ fs$13[gracefulQueue][i][3] = now;
43474
+ fs$13[gracefulQueue][i][4] = now;
43475
+ }
43476
+ retry();
43477
+ }
43478
+ function retry() {
43479
+ clearTimeout(retryTimer);
43480
+ retryTimer = void 0;
43481
+ if (fs$13[gracefulQueue].length === 0) return;
43482
+ var elem = fs$13[gracefulQueue].shift();
43483
+ var fn = elem[0];
43484
+ var args = elem[1];
43485
+ var err = elem[2];
43486
+ var startTime = elem[3];
43487
+ var lastTime = elem[4];
43488
+ if (startTime === void 0) {
43489
+ debug("RETRY", fn.name, args);
43490
+ fn.apply(null, args);
43491
+ } else if (Date.now() - startTime >= 6e4) {
43492
+ debug("TIMEOUT", fn.name, args);
43493
+ var cb = args.pop();
43494
+ if (typeof cb === "function") cb.call(null, err);
43495
+ } else {
43496
+ var sinceAttempt = Date.now() - lastTime;
43497
+ var sinceStart = Math.max(lastTime - startTime, 1);
43498
+ if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
43499
+ debug("RETRY", fn.name, args);
43500
+ fn.apply(null, args.concat([startTime]));
43501
+ } else fs$13[gracefulQueue].push(elem);
43502
+ }
43503
+ if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
43504
+ }
43505
+ }));
43506
+ //#endregion
42103
43507
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/fs/index.js
42104
43508
  var require_fs = /* @__PURE__ */ __commonJSMin$1(((exports) => {
42105
43509
  var u = require_universalify().fromCallback;
@@ -75331,7 +76735,7 @@ var require_tcp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
75331
76735
  var { isObject, isString } = require_utils$3();
75332
76736
  var fs$8 = __require("fs");
75333
76737
  var kleur = require_kleur();
75334
- var Node = require_node();
76738
+ var Node = require_node$1();
75335
76739
  var P = require_packets();
75336
76740
  var { resolvePacketID } = require_constants();
75337
76741
  var { MoleculerServerError } = require_errors$2();
@@ -86762,7 +88166,7 @@ var xs = new Set([
86762
88166
  "+",
86763
88167
  "*",
86764
88168
  "@"
86765
- ]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
88169
+ ]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As$1 = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt$1 = "[^/]", Se = Kt$1 + "*?", Ee = Kt$1 + "+?", Q = class n {
86766
88170
  type;
86767
88171
  #t;
86768
88172
  #s;
@@ -86969,7 +88373,7 @@ var xs = new Set([
86969
88373
  for (let a = 0; a < t.length; a++) {
86970
88374
  let l = t.charAt(a);
86971
88375
  if (i) {
86972
- i = !1, r += (As.has(l) ? "\\" : "") + l;
88376
+ i = !1, r += (As$1.has(l) ? "\\" : "") + l;
86973
88377
  continue;
86974
88378
  }
86975
88379
  if (l === "*") {
@@ -86989,7 +88393,7 @@ var xs = new Set([
86989
88393
  }
86990
88394
  }
86991
88395
  if (l === "?") {
86992
- r += Kt, e = !0;
88396
+ r += Kt$1, e = !0;
86993
88397
  continue;
86994
88398
  }
86995
88399
  r += ks(l);
@@ -87953,7 +89357,7 @@ var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n
87953
89357
  var Ne = typeof process == "object" && process ? process : {
87954
89358
  stdout: null,
87955
89359
  stderr: null
87956
- }, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P = Symbol("encoding"), et = Symbol("decoder"), v = Symbol("flowing"), dt = Symbol("paused"), st = Symbol("resume"), C = Symbol("buffer"), F = Symbol("pipes"), T = Symbol("bufferLength"), Yt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), k = Symbol("objectMode"), x = Symbol("destroyed"), Xt = Symbol("error"), Jt = Symbol("emitData"), We = Symbol("emitEnd"), Zt = Symbol("emitEnd2"), B = Symbol("async"), Qt = Symbol("abort"), Dt = Symbol("aborted"), pt = Symbol("signal"), Y = Symbol("dataListeners"), M = Symbol("discarded"), mt = (n) => Promise.resolve().then(n), li = (n) => n(), ci = (n) => n === "end" || n === "finish" || n === "prefinish", fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Mt = class {
89360
+ }, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof As || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== As.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P = Symbol("encoding"), et = Symbol("decoder"), v = Symbol("flowing"), dt = Symbol("paused"), st = Symbol("resume"), C = Symbol("buffer"), F = Symbol("pipes"), T = Symbol("bufferLength"), Yt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), k = Symbol("objectMode"), x = Symbol("destroyed"), Xt = Symbol("error"), Jt = Symbol("emitData"), We = Symbol("emitEnd"), Zt = Symbol("emitEnd2"), B = Symbol("async"), Qt = Symbol("abort"), Dt = Symbol("aborted"), pt = Symbol("signal"), Y = Symbol("dataListeners"), M = Symbol("discarded"), mt = (n) => Promise.resolve().then(n), li = (n) => n(), ci = (n) => n === "end" || n === "finish" || n === "prefinish", fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Mt = class {
87957
89361
  src;
87958
89362
  dest;
87959
89363
  opts;
@@ -89511,7 +90915,7 @@ var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? ne
89511
90915
  return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
89512
90916
  }
89513
90917
  };
89514
- var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I = class {
90918
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I$1 = class {
89515
90919
  absolute;
89516
90920
  cwd;
89517
90921
  root;
@@ -89636,22 +91040,22 @@ var le = (n, t = {}) => {
89636
91040
  return !1;
89637
91041
  };
89638
91042
  function Bt(n, t = {}) {
89639
- return new I(n, t).streamSync();
91043
+ return new I$1(n, t).streamSync();
89640
91044
  }
89641
91045
  function Qe(n, t = {}) {
89642
- return new I(n, t).stream();
91046
+ return new I$1(n, t).stream();
89643
91047
  }
89644
91048
  function ts(n, t = {}) {
89645
- return new I(n, t).walkSync();
91049
+ return new I$1(n, t).walkSync();
89646
91050
  }
89647
91051
  async function Je(n, t = {}) {
89648
- return new I(n, t).walk();
91052
+ return new I$1(n, t).walk();
89649
91053
  }
89650
91054
  function Ut(n, t = {}) {
89651
- return new I(n, t).iterateSync();
91055
+ return new I$1(n, t).iterateSync();
89652
91056
  }
89653
91057
  function es(n, t = {}) {
89654
- return new I(n, t).iterate();
91058
+ return new I$1(n, t).iterate();
89655
91059
  }
89656
91060
  var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(es, { sync: Ut }), Ui = Object.assign(ts, {
89657
91061
  stream: Bt,
@@ -89668,7 +91072,7 @@ var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(e
89668
91072
  iterate: Bi,
89669
91073
  globIterateSync: Ut,
89670
91074
  iterateSync: zi,
89671
- Glob: I,
91075
+ Glob: I$1,
89672
91076
  hasMagic: le,
89673
91077
  escape: tt,
89674
91078
  unescape: W
@@ -90784,7 +92188,7 @@ function createProcessService(parentNodeId, dataDir, deps, parentTcpPort, parent
90784
92188
  */
90785
92189
  function spawnRunner(runnerId, addons, env) {
90786
92190
  const nodeId = buildNodeId(runnerId);
90787
- const runnerPath = path$40.resolve(__dirname, "addon-runner.js");
92191
+ const runnerPath = path$39.resolve(__dirname, "addon-runner.js");
90788
92192
  const childEnv = {
90789
92193
  ...process.env,
90790
92194
  CAMSTACK_RUNNER_ID: runnerId,
@@ -91160,13 +92564,13 @@ var JobJournal = class {
91160
92564
  indexPath;
91161
92565
  constructor(jobsDir) {
91162
92566
  this.jobsDir = jobsDir;
91163
- this.indexPath = path$40.join(jobsDir, "index.json");
92567
+ this.indexPath = path$39.join(jobsDir, "index.json");
91164
92568
  }
91165
92569
  jobPath(id) {
91166
- return path$40.join(this.jobsDir, `${id}.json`);
92570
+ return path$39.join(this.jobsDir, `${id}.json`);
91167
92571
  }
91168
92572
  writeAtomic(filePath, data) {
91169
- fs$17.mkdirSync(path$40.dirname(filePath), { recursive: true });
92573
+ fs$17.mkdirSync(path$39.dirname(filePath), { recursive: true });
91170
92574
  const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
91171
92575
  fs$17.writeFileSync(tmp, JSON.stringify(data, null, 2), {
91172
92576
  encoding: "utf-8",
@@ -91260,7 +92664,7 @@ var StagingArea = class {
91260
92664
  this.deps = deps;
91261
92665
  }
91262
92666
  async fetchAndStage(input) {
91263
- const destDir = path$40.join(this.stagingDir, input.jobId, safeSegment$1(input.name));
92667
+ const destDir = path$39.join(this.stagingDir, input.jobId, safeSegment$1(input.name));
91264
92668
  fs$17.rmSync(destDir, {
91265
92669
  recursive: true,
91266
92670
  force: true
@@ -91268,12 +92672,12 @@ var StagingArea = class {
91268
92672
  const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
91269
92673
  if (input.signal.aborted) throw new Error("staging aborted after fetch");
91270
92674
  await this.deps.extract(tgz, destDir);
91271
- const raw = JSON.parse(fs$17.readFileSync(path$40.join(destDir, "package.json"), "utf-8"));
92675
+ const raw = JSON.parse(fs$17.readFileSync(path$39.join(destDir, "package.json"), "utf-8"));
91272
92676
  if (raw.version !== input.version) throw new Error(`staging validation failed: ${input.name} expected version ${input.version}, got ${String(raw.version)}`);
91273
92677
  return { stagedPath: destDir };
91274
92678
  }
91275
92679
  cleanup(jobId) {
91276
- fs$17.rmSync(path$40.join(this.stagingDir, jobId), {
92680
+ fs$17.rmSync(path$39.join(this.stagingDir, jobId), {
91277
92681
  recursive: true,
91278
92682
  force: true
91279
92683
  });
@@ -91545,7 +92949,7 @@ async function stageFrameworkLockstep(input) {
91545
92949
  version,
91546
92950
  signal: input.signal
91547
92951
  });
91548
- const backupPath = path$40.join(input.stagingDir, input.jobId, ".bak-fw", safeSegment(pkg));
92952
+ const backupPath = path$39.join(input.stagingDir, input.jobId, ".bak-fw", safeSegment(pkg));
91549
92953
  const fromVersion = input.currentVersionOf(pkg);
91550
92954
  results.push({
91551
92955
  name: pkg,