@tscircuit/cli 0.1.567 → 0.1.568

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +716 -625
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -60586,8 +60586,8 @@ var require_utils6 = __commonJS((exports2) => {
60586
60586
  var result = transform[inputType][outputType](input);
60587
60587
  return result;
60588
60588
  };
60589
- exports2.resolve = function(path22) {
60590
- var parts = path22.split("/");
60589
+ exports2.resolve = function(path23) {
60590
+ var parts = path23.split("/");
60591
60591
  var result = [];
60592
60592
  for (var index = 0;index < parts.length; index++) {
60593
60593
  var part = parts[index];
@@ -66037,18 +66037,18 @@ var require_object = __commonJS((exports2, module2) => {
66037
66037
  var object = new ZipObject(name, zipObjectContent, o);
66038
66038
  this.files[name] = object;
66039
66039
  };
66040
- var parentFolder = function(path22) {
66041
- if (path22.slice(-1) === "/") {
66042
- path22 = path22.substring(0, path22.length - 1);
66040
+ var parentFolder = function(path23) {
66041
+ if (path23.slice(-1) === "/") {
66042
+ path23 = path23.substring(0, path23.length - 1);
66043
66043
  }
66044
- var lastSlash = path22.lastIndexOf("/");
66045
- return lastSlash > 0 ? path22.substring(0, lastSlash) : "";
66044
+ var lastSlash = path23.lastIndexOf("/");
66045
+ return lastSlash > 0 ? path23.substring(0, lastSlash) : "";
66046
66046
  };
66047
- var forceTrailingSlash = function(path22) {
66048
- if (path22.slice(-1) !== "/") {
66049
- path22 += "/";
66047
+ var forceTrailingSlash = function(path23) {
66048
+ if (path23.slice(-1) !== "/") {
66049
+ path23 += "/";
66050
66050
  }
66051
- return path22;
66051
+ return path23;
66052
66052
  };
66053
66053
  var folderAdd = function(name, createFolders) {
66054
66054
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
@@ -67127,7 +67127,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
67127
67127
  });
67128
67128
  };
67129
67129
  traverse(program3, []);
67130
- return allCommandPaths.filter((path25) => path25 !== "");
67130
+ return allCommandPaths.filter((path26) => path26 !== "");
67131
67131
  };
67132
67132
  var normalizeCommandName = (s) => s.replace(/_/g, "-").toLowerCase();
67133
67133
  var getCommandFromPath = (program3, commandPathAndPositionalArgs) => {
@@ -67135,7 +67135,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
67135
67135
  return commandPath.reduce((curr, nextCommandName) => !curr ? null : curr.commands.find((c) => normalizeCommandName(c.name()) === normalizeCommandName(nextCommandName)), program3);
67136
67136
  };
67137
67137
  var getCommandPathOnly = (program3, commandPathAndPositionalArgs) => {
67138
- const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path25) => normalizeCommandName(path25));
67138
+ const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path26) => normalizeCommandName(path26));
67139
67139
  const commandPath = [];
67140
67140
  for (const elm of commandPathAndPositionalArgs) {
67141
67141
  if (elm.startsWith("-"))
@@ -67422,7 +67422,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67422
67422
  "node_modules/fs.realpath/old.js"(exports3) {
67423
67423
  var pathModule = __require("path");
67424
67424
  var isWindows2 = process.platform === "win32";
67425
- var fs25 = __require("fs");
67425
+ var fs26 = __require("fs");
67426
67426
  var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
67427
67427
  function rethrow() {
67428
67428
  var callback;
@@ -67487,7 +67487,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67487
67487
  base = m2[0];
67488
67488
  previous = "";
67489
67489
  if (isWindows2 && !knownHard[base]) {
67490
- fs25.lstatSync(base);
67490
+ fs26.lstatSync(base);
67491
67491
  knownHard[base] = true;
67492
67492
  }
67493
67493
  }
@@ -67505,7 +67505,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67505
67505
  if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
67506
67506
  resolvedLink = cache[base];
67507
67507
  } else {
67508
- var stat4 = fs25.lstatSync(base);
67508
+ var stat4 = fs26.lstatSync(base);
67509
67509
  if (!stat4.isSymbolicLink()) {
67510
67510
  knownHard[base] = true;
67511
67511
  if (cache)
@@ -67520,8 +67520,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
67520
67520
  }
67521
67521
  }
67522
67522
  if (linkTarget === null) {
67523
- fs25.statSync(base);
67524
- linkTarget = fs25.readlinkSync(base);
67523
+ fs26.statSync(base);
67524
+ linkTarget = fs26.readlinkSync(base);
67525
67525
  }
67526
67526
  resolvedLink = pathModule.resolve(previous, linkTarget);
67527
67527
  if (cache)
@@ -67558,7 +67558,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67558
67558
  base = m2[0];
67559
67559
  previous = "";
67560
67560
  if (isWindows2 && !knownHard[base]) {
67561
- fs25.lstat(base, function(err) {
67561
+ fs26.lstat(base, function(err) {
67562
67562
  if (err)
67563
67563
  return cb(err);
67564
67564
  knownHard[base] = true;
@@ -67586,7 +67586,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67586
67586
  if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
67587
67587
  return gotResolvedLink(cache[base]);
67588
67588
  }
67589
- return fs25.lstat(base, gotStat);
67589
+ return fs26.lstat(base, gotStat);
67590
67590
  }
67591
67591
  function gotStat(err, stat4) {
67592
67592
  if (err)
@@ -67603,10 +67603,10 @@ var require_dist8 = __commonJS((exports2, module2) => {
67603
67603
  return gotTarget(null, seenLinks[id], base);
67604
67604
  }
67605
67605
  }
67606
- fs25.stat(base, function(err2) {
67606
+ fs26.stat(base, function(err2) {
67607
67607
  if (err2)
67608
67608
  return cb(err2);
67609
- fs25.readlink(base, function(err3, target) {
67609
+ fs26.readlink(base, function(err3, target) {
67610
67610
  if (!isWindows2)
67611
67611
  seenLinks[id] = target;
67612
67612
  gotTarget(err3, target);
@@ -67636,9 +67636,9 @@ var require_dist8 = __commonJS((exports2, module2) => {
67636
67636
  realpath2.realpathSync = realpathSync;
67637
67637
  realpath2.monkeypatch = monkeypatch;
67638
67638
  realpath2.unmonkeypatch = unmonkeypatch;
67639
- var fs25 = __require("fs");
67640
- var origRealpath = fs25.realpath;
67641
- var origRealpathSync = fs25.realpathSync;
67639
+ var fs26 = __require("fs");
67640
+ var origRealpath = fs26.realpath;
67641
+ var origRealpathSync = fs26.realpathSync;
67642
67642
  var version2 = process.version;
67643
67643
  var ok = /^v[0-5]\./.test(version2);
67644
67644
  var old = require_old();
@@ -67676,12 +67676,12 @@ var require_dist8 = __commonJS((exports2, module2) => {
67676
67676
  }
67677
67677
  }
67678
67678
  function monkeypatch() {
67679
- fs25.realpath = realpath2;
67680
- fs25.realpathSync = realpathSync;
67679
+ fs26.realpath = realpath2;
67680
+ fs26.realpathSync = realpathSync;
67681
67681
  }
67682
67682
  function unmonkeypatch() {
67683
- fs25.realpath = origRealpath;
67684
- fs25.realpathSync = origRealpathSync;
67683
+ fs26.realpath = origRealpath;
67684
+ fs26.realpathSync = origRealpathSync;
67685
67685
  }
67686
67686
  }
67687
67687
  });
@@ -67907,8 +67907,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
67907
67907
  return new Minimatch(pattern, options).match(p);
67908
67908
  };
67909
67909
  module22.exports = minimatch;
67910
- var path25 = require_path2();
67911
- minimatch.sep = path25.sep;
67910
+ var path26 = require_path2();
67911
+ minimatch.sep = path26.sep;
67912
67912
  var GLOBSTAR = Symbol("globstar **");
67913
67913
  minimatch.GLOBSTAR = GLOBSTAR;
67914
67914
  var expand = require_brace_expansion();
@@ -68399,8 +68399,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
68399
68399
  if (f === "/" && partial)
68400
68400
  return true;
68401
68401
  const options = this.options;
68402
- if (path25.sep !== "/") {
68403
- f = f.split(path25.sep).join("/");
68402
+ if (path26.sep !== "/") {
68403
+ f = f.split(path26.sep).join("/");
68404
68404
  }
68405
68405
  f = f.split(slashSplit);
68406
68406
  this.debug(this.pattern, "split", f);
@@ -68490,8 +68490,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
68490
68490
  function ownProp(obj, field) {
68491
68491
  return Object.prototype.hasOwnProperty.call(obj, field);
68492
68492
  }
68493
- var fs25 = __require("fs");
68494
- var path25 = __require("path");
68493
+ var fs26 = __require("fs");
68494
+ var path26 = __require("path");
68495
68495
  var minimatch = require_minimatch();
68496
68496
  var isAbsolute3 = __require("path").isAbsolute;
68497
68497
  var Minimatch = minimatch.Minimatch;
@@ -68545,7 +68545,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
68545
68545
  self2.stat = !!options.stat;
68546
68546
  self2.noprocess = !!options.noprocess;
68547
68547
  self2.absolute = !!options.absolute;
68548
- self2.fs = options.fs || fs25;
68548
+ self2.fs = options.fs || fs26;
68549
68549
  self2.maxLength = options.maxLength || Infinity;
68550
68550
  self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
68551
68551
  self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
@@ -68554,13 +68554,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
68554
68554
  self2.changedCwd = false;
68555
68555
  var cwd = process.cwd();
68556
68556
  if (!ownProp(options, "cwd"))
68557
- self2.cwd = path25.resolve(cwd);
68557
+ self2.cwd = path26.resolve(cwd);
68558
68558
  else {
68559
- self2.cwd = path25.resolve(options.cwd);
68559
+ self2.cwd = path26.resolve(options.cwd);
68560
68560
  self2.changedCwd = self2.cwd !== cwd;
68561
68561
  }
68562
- self2.root = options.root || path25.resolve(self2.cwd, "/");
68563
- self2.root = path25.resolve(self2.root);
68562
+ self2.root = options.root || path26.resolve(self2.cwd, "/");
68563
+ self2.root = path26.resolve(self2.root);
68564
68564
  self2.cwdAbs = isAbsolute3(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
68565
68565
  self2.nomount = !!options.nomount;
68566
68566
  if (process.platform === "win32") {
@@ -68643,13 +68643,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
68643
68643
  function makeAbs(self2, f) {
68644
68644
  var abs = f;
68645
68645
  if (f.charAt(0) === "/") {
68646
- abs = path25.join(self2.root, f);
68646
+ abs = path26.join(self2.root, f);
68647
68647
  } else if (isAbsolute3(f) || f === "") {
68648
68648
  abs = f;
68649
68649
  } else if (self2.changedCwd) {
68650
- abs = path25.resolve(self2.cwd, f);
68650
+ abs = path26.resolve(self2.cwd, f);
68651
68651
  } else {
68652
- abs = path25.resolve(f);
68652
+ abs = path26.resolve(f);
68653
68653
  }
68654
68654
  if (process.platform === "win32")
68655
68655
  abs = abs.replace(/\\/g, "/");
@@ -68680,7 +68680,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
68680
68680
  var Minimatch = minimatch.Minimatch;
68681
68681
  var Glob = require_glob().Glob;
68682
68682
  var util = __require("util");
68683
- var path25 = __require("path");
68683
+ var path26 = __require("path");
68684
68684
  var assert2 = __require("assert");
68685
68685
  var isAbsolute3 = __require("path").isAbsolute;
68686
68686
  var common = require_common4();
@@ -68810,7 +68810,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
68810
68810
  e = prefix + e;
68811
68811
  }
68812
68812
  if (e.charAt(0) === "/" && !this.nomount) {
68813
- e = path25.join(this.root, e);
68813
+ e = path26.join(this.root, e);
68814
68814
  }
68815
68815
  this._emitMatch(index, e);
68816
68816
  }
@@ -68959,9 +68959,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
68959
68959
  if (prefix && isAbsolute3(prefix) && !this.nomount) {
68960
68960
  var trail = /[\/\\]$/.test(prefix);
68961
68961
  if (prefix.charAt(0) === "/") {
68962
- prefix = path25.join(this.root, prefix);
68962
+ prefix = path26.join(this.root, prefix);
68963
68963
  } else {
68964
- prefix = path25.resolve(this.root, prefix);
68964
+ prefix = path26.resolve(this.root, prefix);
68965
68965
  if (trail)
68966
68966
  prefix += "/";
68967
68967
  }
@@ -69148,7 +69148,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69148
69148
  var Minimatch = minimatch.Minimatch;
69149
69149
  var inherits = require_inherits2();
69150
69150
  var EE = __require("events").EventEmitter;
69151
- var path25 = __require("path");
69151
+ var path26 = __require("path");
69152
69152
  var assert2 = __require("assert");
69153
69153
  var isAbsolute3 = __require("path").isAbsolute;
69154
69154
  var globSync = require_sync7();
@@ -69431,7 +69431,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69431
69431
  e = prefix + e;
69432
69432
  }
69433
69433
  if (e.charAt(0) === "/" && !this.nomount) {
69434
- e = path25.join(this.root, e);
69434
+ e = path26.join(this.root, e);
69435
69435
  }
69436
69436
  this._emitMatch(index, e);
69437
69437
  }
@@ -69618,9 +69618,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69618
69618
  if (prefix && isAbsolute3(prefix) && !this.nomount) {
69619
69619
  var trail = /[\/\\]$/.test(prefix);
69620
69620
  if (prefix.charAt(0) === "/") {
69621
- prefix = path25.join(this.root, prefix);
69621
+ prefix = path26.join(this.root, prefix);
69622
69622
  } else {
69623
- prefix = path25.resolve(this.root, prefix);
69623
+ prefix = path26.resolve(this.root, prefix);
69624
69624
  if (trail)
69625
69625
  prefix += "/";
69626
69626
  }
@@ -69804,7 +69804,7 @@ export default {
69804
69804
  }
69805
69805
  case "export-pathlist": {
69806
69806
  return `export default [
69807
- ` + Object.keys(vfs).map((path25) => ` "${path25}"`).join(`,
69807
+ ` + Object.keys(vfs).map((path26) => ` "${path26}"`).join(`,
69808
69808
  `) + `
69809
69809
  ]`;
69810
69810
  }
@@ -72387,7 +72387,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
72387
72387
  import { execSync as execSync2 } from "node:child_process";
72388
72388
  var import_semver2 = __toESM2(require_semver2(), 1);
72389
72389
  // package.json
72390
- var version = "0.1.566";
72390
+ var version = "0.1.567";
72391
72391
  var package_default = {
72392
72392
  name: "@tscircuit/cli",
72393
72393
  version,
@@ -72649,9 +72649,9 @@ export default () => (
72649
72649
  };
72650
72650
 
72651
72651
  // cli/dev/register.ts
72652
- import * as fs21 from "node:fs";
72652
+ import * as fs22 from "node:fs";
72653
72653
  import * as net from "node:net";
72654
- import * as path21 from "node:path";
72654
+ import * as path22 from "node:path";
72655
72655
 
72656
72656
  // lib/dependency-analysis/installNodeModuleTypesForSnippet.ts
72657
72657
  import * as fs8 from "node:fs";
@@ -74371,8 +74371,8 @@ class EventsWatcher extends EventEmitter {
74371
74371
  }
74372
74372
 
74373
74373
  // cli/dev/DevServer.ts
74374
- import path19 from "node:path";
74375
- import fs19 from "node:fs";
74374
+ import path20 from "node:path";
74375
+ import fs20 from "node:fs";
74376
74376
 
74377
74377
  // node_modules/chokidar/esm/index.js
74378
74378
  import { stat as statcb } from "fs";
@@ -77006,8 +77006,8 @@ var pushSnippet = async ({
77006
77006
  };
77007
77007
 
77008
77008
  // lib/shared/add-package.ts
77009
- import * as fs17 from "node:fs";
77010
- import * as path17 from "node:path";
77009
+ import * as fs18 from "node:fs";
77010
+ import * as path18 from "node:path";
77011
77011
 
77012
77012
  // lib/shared/resolve-tarball-url-from-registry.ts
77013
77013
  async function resolveTarballUrlFromRegistry(packageName) {
@@ -77035,6 +77035,96 @@ async function resolveTarballUrlFromRegistry(packageName) {
77035
77035
  return tarballUrl;
77036
77036
  }
77037
77037
 
77038
+ // lib/shared/detect-and-setup-kicad-library.ts
77039
+ import * as fs17 from "node:fs";
77040
+ import * as path17 from "node:path";
77041
+ function extractPackageName(packageSpec) {
77042
+ if (packageSpec.startsWith("http")) {
77043
+ const match = packageSpec.match(/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:[/#]|$)/);
77044
+ if (match) {
77045
+ return match[2].replace(/\.git$/, "");
77046
+ }
77047
+ }
77048
+ if (packageSpec.startsWith("git+")) {
77049
+ const match = packageSpec.match(/\/([^/]+?)(?:\.git)?(?:[/#]|$)/);
77050
+ if (match) {
77051
+ return match[1].replace(/\.git$/, "");
77052
+ }
77053
+ }
77054
+ if (packageSpec.startsWith("@")) {
77055
+ const match = packageSpec.match(/@([^/]+)\/([^@]+)/);
77056
+ if (match) {
77057
+ return `@${match[1]}/${match[2]}`;
77058
+ }
77059
+ }
77060
+ if (packageSpec.includes("@")) {
77061
+ return packageSpec.split("@")[0];
77062
+ }
77063
+ return packageSpec;
77064
+ }
77065
+ async function detectAndSetupKicadLibrary(packageSpec, projectDir = process.cwd()) {
77066
+ try {
77067
+ const packageName = extractPackageName(packageSpec);
77068
+ const nodeModulesPath = path17.join(projectDir, "node_modules", packageName);
77069
+ if (!fs17.existsSync(nodeModulesPath)) {
77070
+ return false;
77071
+ }
77072
+ const kicadModFiles = globbySync(["**/*.kicad_mod"], {
77073
+ cwd: nodeModulesPath,
77074
+ absolute: false
77075
+ });
77076
+ if (kicadModFiles.length === 0) {
77077
+ return false;
77078
+ }
77079
+ console.log(`Detected ${kicadModFiles.length} KiCad footprint file(s), generating types...`);
77080
+ await generateKicadTypes(projectDir, packageName, kicadModFiles);
77081
+ await setupTsConfig(projectDir);
77082
+ console.log(`✓ Generated types for KiCad library: ${packageName}`);
77083
+ return true;
77084
+ } catch (error) {
77085
+ console.warn(`Warning: Failed to detect/setup KiCad library: ${error instanceof Error ? error.message : String(error)}`);
77086
+ return false;
77087
+ }
77088
+ }
77089
+ async function generateKicadTypes(projectDir, packageName, kicadModFiles) {
77090
+ const typesDir = path17.join(projectDir, "types");
77091
+ fs17.mkdirSync(typesDir, { recursive: true });
77092
+ const typeFileName = `${packageName.replace(/[@/]/g, "-")}.d.ts`;
77093
+ const typesFilePath = path17.join(typesDir, typeFileName);
77094
+ const declarations = kicadModFiles.map((filePath) => {
77095
+ const modulePath = `${packageName}/${filePath}`;
77096
+ return `declare module "${modulePath}" {
77097
+ const value: string
77098
+ export default value
77099
+ }`;
77100
+ }).join(`
77101
+
77102
+ `);
77103
+ fs17.writeFileSync(typesFilePath, declarations);
77104
+ console.log(`✓ Generated types at types/${typeFileName}`);
77105
+ }
77106
+ async function setupTsConfig(projectDir) {
77107
+ const tsconfigPath = path17.join(projectDir, "tsconfig.json");
77108
+ if (!fs17.existsSync(tsconfigPath)) {
77109
+ console.log("Creating tsconfig.json...");
77110
+ generateTsConfig(projectDir);
77111
+ }
77112
+ const content = fs17.readFileSync(tsconfigPath, "utf-8");
77113
+ const tsconfig = JSON.parse(content);
77114
+ if (!tsconfig.compilerOptions) {
77115
+ tsconfig.compilerOptions = {};
77116
+ }
77117
+ if (!tsconfig.compilerOptions.typeRoots) {
77118
+ tsconfig.compilerOptions.typeRoots = ["./types", "./node_modules/@types"];
77119
+ fs17.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
77120
+ console.log("✓ Updated tsconfig.json with types directory");
77121
+ } else if (!tsconfig.compilerOptions.typeRoots.includes("./types")) {
77122
+ tsconfig.compilerOptions.typeRoots.unshift("./types");
77123
+ fs17.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
77124
+ console.log("✓ Updated tsconfig.json with types directory");
77125
+ }
77126
+ }
77127
+
77038
77128
  // lib/shared/add-package.ts
77039
77129
  function normalizeTscircuitPackageName(packageSpec) {
77040
77130
  if (packageSpec.startsWith("@tscircuit/") || packageSpec.startsWith("@tsci/")) {
@@ -77062,8 +77152,8 @@ async function addPackage(packageSpec, projectDir = process.cwd()) {
77062
77152
  let installTarget = normalizedName || packageSpec;
77063
77153
  console.log(`Adding ${displayName}...`);
77064
77154
  if (normalizedName && normalizedName.startsWith("@tsci/")) {
77065
- const npmrcPath = path17.join(projectDir, ".npmrc");
77066
- const npmrcContent = fs17.existsSync(npmrcPath) ? fs17.readFileSync(npmrcPath, "utf-8") : "";
77155
+ const npmrcPath = path18.join(projectDir, ".npmrc");
77156
+ const npmrcContent = fs18.existsSync(npmrcPath) ? fs18.readFileSync(npmrcPath, "utf-8") : "";
77067
77157
  let hasTsciRegistry = /@tsci[/:]/.test(npmrcContent);
77068
77158
  if (!hasTsciRegistry) {
77069
77159
  const { addRegistry } = await prompts({
@@ -77077,7 +77167,7 @@ async function addPackage(packageSpec, projectDir = process.cwd()) {
77077
77167
  const newContent = (trimmedContent.length > 0 ? `${trimmedContent}
77078
77168
  ` : "") + `@tsci:registry=https://npm.tscircuit.com
77079
77169
  `;
77080
- fs17.writeFileSync(npmrcPath, newContent);
77170
+ fs18.writeFileSync(npmrcPath, newContent);
77081
77171
  console.log("Updated .npmrc with tscircuit registry");
77082
77172
  hasTsciRegistry = true;
77083
77173
  } else {
@@ -77092,6 +77182,7 @@ async function addPackage(packageSpec, projectDir = process.cwd()) {
77092
77182
  try {
77093
77183
  packageManager.install({ name: installTarget, cwd: projectDir });
77094
77184
  console.log(`Added ${displayName} successfully.`);
77185
+ await detectAndSetupKicadLibrary(packageSpec, projectDir);
77095
77186
  } catch (error) {
77096
77187
  const errorMessage = error instanceof Error ? error.message : String(error);
77097
77188
  console.error(`Failed to add ${displayName}:`, errorMessage);
@@ -77104,16 +77195,16 @@ import Debug2 from "debug";
77104
77195
 
77105
77196
  // lib/dependency-analysis/getNodeModuleDependencies.ts
77106
77197
  import * as ts3 from "typescript";
77107
- import * as path18 from "path";
77108
- import * as fs18 from "fs";
77198
+ import * as path19 from "path";
77199
+ import * as fs19 from "fs";
77109
77200
  function getLocalPackages(projectDir) {
77110
- const packageJsonPath = path18.join(projectDir, "package.json");
77201
+ const packageJsonPath = path19.join(projectDir, "package.json");
77111
77202
  const localPackages = new Set;
77112
- if (!fs18.existsSync(packageJsonPath)) {
77203
+ if (!fs19.existsSync(packageJsonPath)) {
77113
77204
  return localPackages;
77114
77205
  }
77115
77206
  try {
77116
- const packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf-8"));
77207
+ const packageJson = JSON.parse(fs19.readFileSync(packageJsonPath, "utf-8"));
77117
77208
  const allDeps = {
77118
77209
  ...packageJson.dependencies,
77119
77210
  ...packageJson.devDependencies,
@@ -77133,11 +77224,11 @@ function getLocalPackages(projectDir) {
77133
77224
  return localPackages;
77134
77225
  }
77135
77226
  function getNodeModuleImports(filePath) {
77136
- const absolutePath = path18.resolve(filePath);
77137
- if (!fs18.existsSync(absolutePath)) {
77227
+ const absolutePath = path19.resolve(filePath);
77228
+ if (!fs19.existsSync(absolutePath)) {
77138
77229
  return [];
77139
77230
  }
77140
- const content = fs18.readFileSync(absolutePath, "utf-8");
77231
+ const content = fs19.readFileSync(absolutePath, "utf-8");
77141
77232
  const sourceFile = ts3.createSourceFile(absolutePath, content, ts3.ScriptTarget.Latest, true);
77142
77233
  const imports = new Set;
77143
77234
  function visit(node) {
@@ -77182,31 +77273,31 @@ function getPackageNameFromImport(importPath) {
77182
77273
  }
77183
77274
  function resolveNodeModuleImport(importPath, projectDir) {
77184
77275
  const packageName = getPackageNameFromImport(importPath);
77185
- const packageDir = path18.join(projectDir, "node_modules", packageName);
77186
- if (!fs18.existsSync(packageDir)) {
77276
+ const packageDir = path19.join(projectDir, "node_modules", packageName);
77277
+ if (!fs19.existsSync(packageDir)) {
77187
77278
  return [];
77188
77279
  }
77189
- const packageJsonPath = path18.join(packageDir, "package.json");
77190
- if (!fs18.existsSync(packageJsonPath)) {
77280
+ const packageJsonPath = path19.join(packageDir, "package.json");
77281
+ if (!fs19.existsSync(packageJsonPath)) {
77191
77282
  return [];
77192
77283
  }
77193
- const packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf-8"));
77284
+ const packageJson = JSON.parse(fs19.readFileSync(packageJsonPath, "utf-8"));
77194
77285
  const resolvedFiles = [];
77195
77286
  if (importPath !== packageName) {
77196
77287
  const subpath = importPath.slice(packageName.length + 1);
77197
77288
  const possiblePaths = [
77198
- path18.join(packageDir, subpath),
77199
- path18.join(packageDir, `${subpath}.js`),
77200
- path18.join(packageDir, `${subpath}.mjs`),
77201
- path18.join(packageDir, `${subpath}.ts`),
77202
- path18.join(packageDir, `${subpath}.tsx`),
77203
- path18.join(packageDir, subpath, "index.js"),
77204
- path18.join(packageDir, subpath, "index.mjs"),
77205
- path18.join(packageDir, subpath, "index.ts"),
77206
- path18.join(packageDir, subpath, "index.tsx")
77289
+ path19.join(packageDir, subpath),
77290
+ path19.join(packageDir, `${subpath}.js`),
77291
+ path19.join(packageDir, `${subpath}.mjs`),
77292
+ path19.join(packageDir, `${subpath}.ts`),
77293
+ path19.join(packageDir, `${subpath}.tsx`),
77294
+ path19.join(packageDir, subpath, "index.js"),
77295
+ path19.join(packageDir, subpath, "index.mjs"),
77296
+ path19.join(packageDir, subpath, "index.ts"),
77297
+ path19.join(packageDir, subpath, "index.tsx")
77207
77298
  ];
77208
77299
  for (const p of possiblePaths) {
77209
- if (fs18.existsSync(p) && fs18.statSync(p).isFile()) {
77300
+ if (fs19.existsSync(p) && fs19.statSync(p).isFile()) {
77210
77301
  resolvedFiles.push(p);
77211
77302
  break;
77212
77303
  }
@@ -77220,25 +77311,25 @@ function resolveNodeModuleImport(importPath, projectDir) {
77220
77311
  packageJson.exports?.["."]?.require
77221
77312
  ].filter(Boolean);
77222
77313
  for (const entry of entryPoints) {
77223
- const entryPath = path18.join(packageDir, entry);
77224
- if (fs18.existsSync(entryPath) && fs18.statSync(entryPath).isFile()) {
77314
+ const entryPath = path19.join(packageDir, entry);
77315
+ if (fs19.existsSync(entryPath) && fs19.statSync(entryPath).isFile()) {
77225
77316
  resolvedFiles.push(entryPath);
77226
77317
  }
77227
77318
  }
77228
77319
  if (resolvedFiles.length === 0) {
77229
77320
  const fallbackPaths = [
77230
- path18.join(packageDir, "index.js"),
77231
- path18.join(packageDir, "index.mjs"),
77232
- path18.join(packageDir, "index.ts"),
77233
- path18.join(packageDir, "index.tsx"),
77234
- path18.join(packageDir, "dist", "index.js"),
77235
- path18.join(packageDir, "dist", "index.mjs"),
77236
- path18.join(packageDir, "lib", "index.js"),
77237
- path18.join(packageDir, "src", "index.ts"),
77238
- path18.join(packageDir, "src", "index.tsx")
77321
+ path19.join(packageDir, "index.js"),
77322
+ path19.join(packageDir, "index.mjs"),
77323
+ path19.join(packageDir, "index.ts"),
77324
+ path19.join(packageDir, "index.tsx"),
77325
+ path19.join(packageDir, "dist", "index.js"),
77326
+ path19.join(packageDir, "dist", "index.mjs"),
77327
+ path19.join(packageDir, "lib", "index.js"),
77328
+ path19.join(packageDir, "src", "index.ts"),
77329
+ path19.join(packageDir, "src", "index.tsx")
77239
77330
  ];
77240
77331
  for (const p of fallbackPaths) {
77241
- if (fs18.existsSync(p) && fs18.statSync(p).isFile()) {
77332
+ if (fs19.existsSync(p) && fs19.statSync(p).isFile()) {
77242
77333
  resolvedFiles.push(p);
77243
77334
  break;
77244
77335
  }
@@ -77272,12 +77363,12 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
77272
77363
  }
77273
77364
  }
77274
77365
  function getLocalDependencies(filePath) {
77275
- const absolutePath = path18.resolve(filePath);
77276
- const baseDir = path18.dirname(absolutePath);
77277
- if (!fs18.existsSync(absolutePath)) {
77366
+ const absolutePath = path19.resolve(filePath);
77367
+ const baseDir = path19.dirname(absolutePath);
77368
+ if (!fs19.existsSync(absolutePath)) {
77278
77369
  return [];
77279
77370
  }
77280
- const content = fs18.readFileSync(absolutePath, "utf-8");
77371
+ const content = fs19.readFileSync(absolutePath, "utf-8");
77281
77372
  const sourceFile = ts3.createSourceFile(absolutePath, content, ts3.ScriptTarget.Latest, true);
77282
77373
  const dependencies2 = [];
77283
77374
  function visit(node) {
@@ -77299,20 +77390,20 @@ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth =
77299
77390
  }
77300
77391
  function resolveLocalImport(importPath, baseDir) {
77301
77392
  const extensions = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
77302
- const resolvedPath = path18.resolve(baseDir, importPath);
77303
- if (fs18.existsSync(resolvedPath) && fs18.statSync(resolvedPath).isFile()) {
77393
+ const resolvedPath = path19.resolve(baseDir, importPath);
77394
+ if (fs19.existsSync(resolvedPath) && fs19.statSync(resolvedPath).isFile()) {
77304
77395
  return resolvedPath;
77305
77396
  }
77306
77397
  for (const ext of extensions) {
77307
77398
  const pathWithExt = resolvedPath + ext;
77308
- if (fs18.existsSync(pathWithExt)) {
77399
+ if (fs19.existsSync(pathWithExt)) {
77309
77400
  return pathWithExt;
77310
77401
  }
77311
77402
  }
77312
- if (fs18.existsSync(resolvedPath) && fs18.statSync(resolvedPath).isDirectory()) {
77403
+ if (fs19.existsSync(resolvedPath) && fs19.statSync(resolvedPath).isDirectory()) {
77313
77404
  for (const ext of extensions) {
77314
- const indexPath = path18.join(resolvedPath, `index${ext}`);
77315
- if (fs18.existsSync(indexPath)) {
77405
+ const indexPath = path19.join(resolvedPath, `index${ext}`);
77406
+ if (fs19.existsSync(indexPath)) {
77316
77407
  return indexPath;
77317
77408
  }
77318
77409
  }
@@ -77337,12 +77428,12 @@ var EXCLUDED_PACKAGE_DIRECTORIES = new Set([
77337
77428
  function collectLocalPackageFiles(packageDir) {
77338
77429
  const buildDirs = ["dist", "build"];
77339
77430
  for (const dirName of buildDirs) {
77340
- const dirPath = path18.join(packageDir, dirName);
77341
- if (fs18.existsSync(dirPath)) {
77431
+ const dirPath = path19.join(packageDir, dirName);
77432
+ if (fs19.existsSync(dirPath)) {
77342
77433
  const files = walkDirectory(dirPath, new Set);
77343
77434
  if (files.length > 0) {
77344
- const packageJsonPath = path18.join(packageDir, "package.json");
77345
- if (fs18.existsSync(packageJsonPath)) {
77435
+ const packageJsonPath = path19.join(packageDir, "package.json");
77436
+ if (fs19.existsSync(packageJsonPath)) {
77346
77437
  files.push(packageJsonPath);
77347
77438
  }
77348
77439
  return files;
@@ -77353,11 +77444,11 @@ function collectLocalPackageFiles(packageDir) {
77353
77444
  }
77354
77445
  function walkDirectory(dir, excludedDirs) {
77355
77446
  const files = [];
77356
- if (!fs18.existsSync(dir))
77447
+ if (!fs19.existsSync(dir))
77357
77448
  return files;
77358
- const entries = fs18.readdirSync(dir, { withFileTypes: true });
77449
+ const entries = fs19.readdirSync(dir, { withFileTypes: true });
77359
77450
  for (const entry of entries) {
77360
- const fullPath = path18.join(dir, entry.name);
77451
+ const fullPath = path19.join(dir, entry.name);
77361
77452
  if (entry.isDirectory()) {
77362
77453
  if (excludedDirs.has(entry.name)) {
77363
77454
  continue;
@@ -77383,8 +77474,8 @@ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
77383
77474
  continue;
77384
77475
  }
77385
77476
  processedPackages.add(packageName);
77386
- const packageDir = path18.join(projectDir, "node_modules", packageName);
77387
- if (fs18.existsSync(packageDir)) {
77477
+ const packageDir = path19.join(projectDir, "node_modules", packageName);
77478
+ if (fs19.existsSync(packageDir)) {
77388
77479
  const packageFiles = collectLocalPackageFiles(packageDir);
77389
77480
  packageFiles.forEach((file) => allFiles.add(file));
77390
77481
  }
@@ -77414,7 +77505,7 @@ class DevServer {
77414
77505
  }) {
77415
77506
  this.port = port;
77416
77507
  this.componentFilePath = componentFilePath;
77417
- this.projectDir = projectDir ?? path19.dirname(componentFilePath);
77508
+ this.projectDir = projectDir ?? path20.dirname(componentFilePath);
77418
77509
  const projectConfig = loadProjectConfig(this.projectDir);
77419
77510
  this.ignoredFiles = projectConfig?.ignoredFiles ?? [];
77420
77511
  this.fsKy = distribution_default.create({
@@ -77425,7 +77516,7 @@ class DevServer {
77425
77516
  async start() {
77426
77517
  const { server } = await createHttpServer({
77427
77518
  port: this.port,
77428
- defaultMainComponentPath: path19.relative(this.projectDir, this.componentFilePath)
77519
+ defaultMainComponentPath: path20.relative(this.projectDir, this.componentFilePath)
77429
77520
  });
77430
77521
  this.httpServer = server;
77431
77522
  this.eventsWatcher = new EventsWatcher(`http://localhost:${this.port}`);
@@ -77438,7 +77529,7 @@ class DevServer {
77438
77529
  this.filesystemWatcher = watch(this.projectDir, {
77439
77530
  persistent: true,
77440
77531
  ignoreInitial: true,
77441
- ignored: (p) => shouldIgnorePath(path19.relative(this.projectDir, p), this.ignoredFiles)
77532
+ ignored: (p) => shouldIgnorePath(path20.relative(this.projectDir, p), this.ignoredFiles)
77442
77533
  });
77443
77534
  this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
77444
77535
  this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
@@ -77454,27 +77545,27 @@ class DevServer {
77454
77545
  const { file } = await this.fsKy.get("api/files/get", {
77455
77546
  searchParams: { file_path: ev.file_path }
77456
77547
  }).json();
77457
- const fullPath = path19.join(this.projectDir, ev.file_path);
77458
- const dirPath = path19.dirname(fullPath);
77459
- if (!fs19.existsSync(dirPath)) {
77460
- fs19.mkdirSync(dirPath, { recursive: true });
77548
+ const fullPath = path20.join(this.projectDir, ev.file_path);
77549
+ const dirPath = path20.dirname(fullPath);
77550
+ if (!fs20.existsSync(dirPath)) {
77551
+ fs20.mkdirSync(dirPath, { recursive: true });
77461
77552
  }
77462
77553
  if (file.binary_content_b64) {
77463
77554
  const decodedContent = Buffer.from(file.binary_content_b64, "base64");
77464
- fs19.writeFileSync(fullPath, decodedContent);
77555
+ fs20.writeFileSync(fullPath, decodedContent);
77465
77556
  } else {
77466
- fs19.writeFileSync(fullPath, file.text_content ?? "", "utf-8");
77557
+ fs20.writeFileSync(fullPath, file.text_content ?? "", "utf-8");
77467
77558
  }
77468
77559
  }
77469
77560
  async handleFileDeletedEventFromServer(ev) {
77470
- const fullPath = path19.join(this.projectDir, ev.file_path);
77471
- if (fs19.existsSync(fullPath)) {
77561
+ const fullPath = path20.join(this.projectDir, ev.file_path);
77562
+ if (fs20.existsSync(fullPath)) {
77472
77563
  debug2(`Deleting file ${ev.file_path} from filesystem`);
77473
- fs19.unlinkSync(fullPath);
77564
+ fs20.unlinkSync(fullPath);
77474
77565
  }
77475
77566
  }
77476
77567
  async handleFileChangedOnFilesystem(absoluteFilePath) {
77477
- const relativeFilePath = path19.relative(this.projectDir, absoluteFilePath);
77568
+ const relativeFilePath = path20.relative(this.projectDir, absoluteFilePath);
77478
77569
  if (relativeFilePath.includes("manual-edits.json"))
77479
77570
  return;
77480
77571
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
@@ -77492,14 +77583,14 @@ class DevServer {
77492
77583
  await this.checkAndUploadNewNodeModules(absoluteFilePath);
77493
77584
  }
77494
77585
  async checkAndUploadNewNodeModules(filePath) {
77495
- const ext = path19.extname(filePath).toLowerCase();
77586
+ const ext = path20.extname(filePath).toLowerCase();
77496
77587
  const isSourceFile = [".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext);
77497
77588
  if (!isSourceFile)
77498
77589
  return;
77499
77590
  try {
77500
77591
  const nodeModuleFiles = getAllNodeModuleFilePaths(filePath, this.projectDir);
77501
77592
  const newFiles = nodeModuleFiles.filter((file) => {
77502
- const relativePath = path19.relative(this.projectDir, file);
77593
+ const relativePath = path20.relative(this.projectDir, file);
77503
77594
  return !this.uploadedNodeModules.has(relativePath);
77504
77595
  });
77505
77596
  if (newFiles.length === 0)
@@ -77512,7 +77603,7 @@ class DevServer {
77512
77603
  }
77513
77604
  }
77514
77605
  async handleFileRemovedFromFilesystem(absoluteFilePath) {
77515
- const relativeFilePath = path19.relative(this.projectDir, absoluteFilePath);
77606
+ const relativeFilePath = path20.relative(this.projectDir, absoluteFilePath);
77516
77607
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
77517
77608
  return;
77518
77609
  if (!relativeFilePath || relativeFilePath.trim() === "") {
@@ -77550,8 +77641,8 @@ class DevServer {
77550
77641
  debug2(`Successfully deleted file ${relativeFilePath} from server`);
77551
77642
  }
77552
77643
  async handleFileRename(oldPath, newPath) {
77553
- const oldRelativePath = path19.relative(this.projectDir, oldPath);
77554
- const newRelativePath = path19.relative(this.projectDir, newPath);
77644
+ const oldRelativePath = path20.relative(this.projectDir, oldPath);
77645
+ const newRelativePath = path20.relative(this.projectDir, newPath);
77555
77646
  if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
77556
77647
  return;
77557
77648
  await this.handleFileRemovedFromFilesystem(oldPath);
@@ -77571,7 +77662,7 @@ class DevServer {
77571
77662
  });
77572
77663
  const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
77573
77664
  for (const filePath of filePaths) {
77574
- const relativeFilePath = path19.relative(this.projectDir, filePath);
77665
+ const relativeFilePath = path20.relative(this.projectDir, filePath);
77575
77666
  const filePayload = this.createFileUploadPayload(filePath, relativeFilePath);
77576
77667
  await this.fsKy.post("api/files/upsert", {
77577
77668
  json: {
@@ -77605,7 +77696,7 @@ class DevServer {
77605
77696
  }
77606
77697
  async uploadNodeModuleFiles(files) {
77607
77698
  for (const nodeModuleFile of files) {
77608
- const relativeFilePath = path19.relative(this.projectDir, nodeModuleFile);
77699
+ const relativeFilePath = path20.relative(this.projectDir, nodeModuleFile);
77609
77700
  this.uploadedNodeModules.add(relativeFilePath);
77610
77701
  const filePayload = this.createFileUploadPayload(nodeModuleFile, relativeFilePath);
77611
77702
  await this.fsKy.post("api/files/upsert", {
@@ -77641,12 +77732,12 @@ class DevServer {
77641
77732
  await this.filesystemWatcher?.close();
77642
77733
  }
77643
77734
  createFileUploadPayload(absoluteFilePath, relativeFilePath) {
77644
- const ext = path19.extname(relativeFilePath).toLowerCase();
77735
+ const ext = path20.extname(relativeFilePath).toLowerCase();
77645
77736
  if (BINARY_FILE_EXTENSIONS.has(ext)) {
77646
- const fileBuffer = fs19.readFileSync(absoluteFilePath);
77737
+ const fileBuffer = fs20.readFileSync(absoluteFilePath);
77647
77738
  return { binary_content_b64: fileBuffer.toString("base64") };
77648
77739
  }
77649
- return { text_content: fs19.readFileSync(absoluteFilePath, "utf-8") };
77740
+ return { text_content: fs20.readFileSync(absoluteFilePath, "utf-8") };
77650
77741
  }
77651
77742
  async handleInstallPackage(full_package_name) {
77652
77743
  const postEvent = async (event, message) => {
@@ -77682,11 +77773,11 @@ var getVersion = () => {
77682
77773
  };
77683
77774
 
77684
77775
  // lib/shared/find-board-files.ts
77685
- import fs20 from "node:fs";
77686
- import path20 from "node:path";
77776
+ import fs21 from "node:fs";
77777
+ import path21 from "node:path";
77687
77778
  var isSubPath = (maybeChild, maybeParent) => {
77688
- const relative5 = path20.relative(maybeParent, maybeChild);
77689
- return relative5 === "" || !relative5.startsWith("..") && !path20.isAbsolute(relative5);
77779
+ const relative5 = path21.relative(maybeParent, maybeChild);
77780
+ return relative5 === "" || !relative5.startsWith("..") && !path21.isAbsolute(relative5);
77690
77781
  };
77691
77782
  var isGlobPattern = (str) => {
77692
77783
  return /[*?[\]{}]/.test(str);
@@ -77696,13 +77787,13 @@ var findBoardFiles = ({
77696
77787
  ignore = DEFAULT_IGNORED_PATTERNS,
77697
77788
  filePaths = []
77698
77789
  } = {}) => {
77699
- const resolvedProjectDir = path20.resolve(projectDir);
77790
+ const resolvedProjectDir = path21.resolve(projectDir);
77700
77791
  const boardFilePatterns = getBoardFilePatterns(resolvedProjectDir);
77701
77792
  const relativeBoardFiles = globbySync(boardFilePatterns, {
77702
77793
  cwd: resolvedProjectDir,
77703
77794
  ignore
77704
77795
  });
77705
- const absoluteBoardFiles = relativeBoardFiles.map((f) => path20.join(resolvedProjectDir, f));
77796
+ const absoluteBoardFiles = relativeBoardFiles.map((f) => path21.join(resolvedProjectDir, f));
77706
77797
  const boardFileSet = new Set;
77707
77798
  if (filePaths.length > 0) {
77708
77799
  for (const inputPath of filePaths) {
@@ -77716,13 +77807,13 @@ var findBoardFiles = ({
77716
77807
  boardFileSet.add(match);
77717
77808
  }
77718
77809
  } else {
77719
- const targetPath = path20.resolve(resolvedProjectDir, inputPath);
77720
- if (!fs20.existsSync(targetPath)) {
77810
+ const targetPath = path21.resolve(resolvedProjectDir, inputPath);
77811
+ if (!fs21.existsSync(targetPath)) {
77721
77812
  continue;
77722
77813
  }
77723
- const stat4 = fs20.statSync(targetPath);
77814
+ const stat4 = fs21.statSync(targetPath);
77724
77815
  if (stat4.isDirectory()) {
77725
- const resolvedDir = path20.resolve(targetPath);
77816
+ const resolvedDir = path21.resolve(targetPath);
77726
77817
  if (isSubPath(resolvedDir, resolvedProjectDir)) {
77727
77818
  for (const boardFile of absoluteBoardFiles) {
77728
77819
  if (isSubPath(boardFile, resolvedDir)) {
@@ -77733,7 +77824,7 @@ var findBoardFiles = ({
77733
77824
  const externalMatches = globbySync(boardFilePatterns, {
77734
77825
  cwd: resolvedDir,
77735
77826
  ignore
77736
- }).map((f) => path20.join(resolvedDir, f));
77827
+ }).map((f) => path21.join(resolvedDir, f));
77737
77828
  for (const match of externalMatches) {
77738
77829
  boardFileSet.add(match);
77739
77830
  }
@@ -77753,7 +77844,7 @@ var findBoardFiles = ({
77753
77844
 
77754
77845
  // cli/dev/register.ts
77755
77846
  var findSelectableTsxFiles = (projectDir) => {
77756
- const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs21.existsSync(file)).sort();
77847
+ const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs22.existsSync(file)).sort();
77757
77848
  if (boardFiles.length > 0) {
77758
77849
  return boardFiles;
77759
77850
  }
@@ -77761,15 +77852,15 @@ var findSelectableTsxFiles = (projectDir) => {
77761
77852
  cwd: projectDir,
77762
77853
  ignore: DEFAULT_IGNORED_PATTERNS
77763
77854
  });
77764
- return files.map((file) => path21.resolve(projectDir, file)).filter((file) => fs21.existsSync(file)).sort();
77855
+ return files.map((file) => path22.resolve(projectDir, file)).filter((file) => fs22.existsSync(file)).sort();
77765
77856
  };
77766
77857
  var warnIfTsconfigMissingTscircuitType = (projectDir) => {
77767
- const tsconfigPath = path21.join(projectDir, "tsconfig.json");
77768
- if (!fs21.existsSync(tsconfigPath)) {
77858
+ const tsconfigPath = path22.join(projectDir, "tsconfig.json");
77859
+ if (!fs22.existsSync(tsconfigPath)) {
77769
77860
  return;
77770
77861
  }
77771
77862
  try {
77772
- const tsconfig = JSON.parse(fs21.readFileSync(tsconfigPath, "utf-8"));
77863
+ const tsconfig = JSON.parse(fs22.readFileSync(tsconfigPath, "utf-8"));
77773
77864
  const types = tsconfig?.compilerOptions?.types;
77774
77865
  if (!Array.isArray(types) || !types.includes("tscircuit")) {
77775
77866
  console.warn(kleur_default.yellow('Warning: "tscircuit" is missing from tsconfig.json compilerOptions.types. Add it (e.g. "types": ["tscircuit"]) to ensure CLI-provided types work correctly.'));
@@ -77796,7 +77887,7 @@ var registerDev = (program3) => {
77796
77887
  }
77797
77888
  let absolutePath;
77798
77889
  if (file) {
77799
- absolutePath = path21.resolve(file);
77890
+ absolutePath = path22.resolve(file);
77800
77891
  if (!absolutePath.endsWith(".tsx") && !absolutePath.endsWith(".ts")) {
77801
77892
  console.error("Error: Only .tsx files are supported");
77802
77893
  return;
@@ -77805,7 +77896,7 @@ var registerDev = (program3) => {
77805
77896
  const entrypointPath = await getEntrypoint({
77806
77897
  onError: () => {}
77807
77898
  });
77808
- if (entrypointPath && fs21.existsSync(entrypointPath)) {
77899
+ if (entrypointPath && fs22.existsSync(entrypointPath)) {
77809
77900
  absolutePath = entrypointPath;
77810
77901
  console.log("Found entrypoint at:", entrypointPath);
77811
77902
  } else {
@@ -77815,7 +77906,7 @@ var registerDev = (program3) => {
77815
77906
  return;
77816
77907
  }
77817
77908
  absolutePath = availableFiles[0];
77818
- console.log("Selected file:", path21.relative(process.cwd(), absolutePath));
77909
+ console.log("Selected file:", path22.relative(process.cwd(), absolutePath));
77819
77910
  }
77820
77911
  }
77821
77912
  warnIfTsconfigMissingTscircuitType(process.cwd());
@@ -77837,7 +77928,7 @@ var registerDev = (program3) => {
77837
77928
 
77838
77929
  ${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
77839
77930
  console.log(`
77840
- ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path21.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
77931
+ ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path22.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
77841
77932
 
77842
77933
  `);
77843
77934
  console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
@@ -77972,26 +78063,26 @@ var registerConfigPrint = (program3) => {
77972
78063
  };
77973
78064
 
77974
78065
  // cli/clone/register.ts
77975
- import * as fs24 from "node:fs";
77976
- import * as path24 from "node:path";
78066
+ import * as fs25 from "node:fs";
78067
+ import * as path25 from "node:path";
77977
78068
 
77978
78069
  // cli/clone/clone-bug-report.ts
77979
78070
  var import_jszip = __toESM2(require_lib4(), 1);
77980
78071
  var import_prompts7 = __toESM2(require_prompts3(), 1);
77981
- import * as fs23 from "node:fs";
77982
- import * as path23 from "node:path";
78072
+ import * as fs24 from "node:fs";
78073
+ import * as path24 from "node:path";
77983
78074
 
77984
78075
  // cli/clone/handle-existing-directory.ts
77985
78076
  var import_prompts6 = __toESM2(require_prompts3(), 1);
77986
- import * as fs22 from "node:fs";
77987
- import * as path22 from "node:path";
78077
+ import * as fs23 from "node:fs";
78078
+ import * as path23 from "node:path";
77988
78079
  var handleExistingDirectory = async (dirPath) => {
77989
- if (!fs22.existsSync(dirPath))
78080
+ if (!fs23.existsSync(dirPath))
77990
78081
  return;
77991
78082
  const response = await import_prompts6.default({
77992
78083
  type: "select",
77993
78084
  name: "action",
77994
- message: `Directory "${path22.basename(dirPath)}" already exists. What would you like to do?`,
78085
+ message: `Directory "${path23.basename(dirPath)}" already exists. What would you like to do?`,
77995
78086
  choices: [
77996
78087
  { title: "Merge files into existing directory", value: "merge" },
77997
78088
  {
@@ -78006,7 +78097,7 @@ var handleExistingDirectory = async (dirPath) => {
78006
78097
  process.exit(0);
78007
78098
  }
78008
78099
  if (response.action === "delete") {
78009
- fs22.rmSync(dirPath, { recursive: true, force: true });
78100
+ fs23.rmSync(dirPath, { recursive: true, force: true });
78010
78101
  console.log(`Deleted existing directory: ${dirPath}`);
78011
78102
  } else if (response.action === "merge") {
78012
78103
  console.log(`Merging files into existing directory: ${dirPath}`);
@@ -78032,12 +78123,12 @@ var getCommonDirectoryPrefix = (paths) => {
78032
78123
  return commonSegments.join("/");
78033
78124
  };
78034
78125
  var sanitizeRelativePath = (relativePath) => {
78035
- const normalizedPath = path23.normalize(relativePath);
78126
+ const normalizedPath = path24.normalize(relativePath);
78036
78127
  if (!normalizedPath)
78037
78128
  return null;
78038
- if (path23.isAbsolute(normalizedPath))
78129
+ if (path24.isAbsolute(normalizedPath))
78039
78130
  return null;
78040
- const segments = normalizedPath.split(path23.sep);
78131
+ const segments = normalizedPath.split(path24.sep);
78041
78132
  if (segments.some((segment) => segment === ".." || segment === "")) {
78042
78133
  return null;
78043
78134
  }
@@ -78052,7 +78143,7 @@ var cloneBugReport = async ({
78052
78143
  console.error("Bug report ID must not be empty.");
78053
78144
  process.exit(1);
78054
78145
  }
78055
- let dirPath = path23.resolve(`bug-report-${trimmedBugReportId}`);
78146
+ let dirPath = path24.resolve(`bug-report-${trimmedBugReportId}`);
78056
78147
  await handleExistingDirectory(dirPath);
78057
78148
  const ky2 = getRegistryApiKy();
78058
78149
  let zipBuffer;
@@ -78070,7 +78161,7 @@ var cloneBugReport = async ({
78070
78161
  }
78071
78162
  process.exit(1);
78072
78163
  }
78073
- fs23.mkdirSync(dirPath, { recursive: true });
78164
+ fs24.mkdirSync(dirPath, { recursive: true });
78074
78165
  const zip = await import_jszip.default.loadAsync(zipBuffer);
78075
78166
  const fileEntries = Object.entries(zip.files).filter(([, entry]) => !entry.dir);
78076
78167
  const commonPrefix = getCommonDirectoryPrefix(fileEntries.map(([fileName]) => fileName));
@@ -78082,29 +78173,29 @@ var cloneBugReport = async ({
78082
78173
  console.warn(`Skipping potentially unsafe path: ${fileName}`);
78083
78174
  continue;
78084
78175
  }
78085
- const fullPath = path23.join(dirPath, sanitizedRelativePath);
78086
- fs23.mkdirSync(path23.dirname(fullPath), { recursive: true });
78176
+ const fullPath = path24.join(dirPath, sanitizedRelativePath);
78177
+ fs24.mkdirSync(path24.dirname(fullPath), { recursive: true });
78087
78178
  const fileContent = await entry.async("nodebuffer");
78088
- fs23.writeFileSync(fullPath, fileContent);
78179
+ fs24.writeFileSync(fullPath, fileContent);
78089
78180
  }
78090
- const packageJsonPath = path23.join(dirPath, "package.json");
78091
- if (fs23.existsSync(packageJsonPath)) {
78181
+ const packageJsonPath = path24.join(dirPath, "package.json");
78182
+ if (fs24.existsSync(packageJsonPath)) {
78092
78183
  try {
78093
- const packageJson = JSON.parse(fs23.readFileSync(packageJsonPath, "utf-8"));
78184
+ const packageJson = JSON.parse(fs24.readFileSync(packageJsonPath, "utf-8"));
78094
78185
  const packageName = packageJson?.name;
78095
78186
  if (typeof packageName === "string" && packageName.trim()) {
78096
78187
  const sanitizedName = packageName.replace(/[^a-zA-Z0-9]/g, "_");
78097
- const suggestedDirPath = path23.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
78188
+ const suggestedDirPath = path24.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
78098
78189
  if (suggestedDirPath !== dirPath) {
78099
78190
  const response = await import_prompts7.default({
78100
78191
  type: "confirm",
78101
78192
  name: "rename",
78102
78193
  initial: true,
78103
- message: `Rename the directory to "${path23.basename(suggestedDirPath)}"?`
78194
+ message: `Rename the directory to "${path24.basename(suggestedDirPath)}"?`
78104
78195
  });
78105
78196
  if (response.rename) {
78106
78197
  await handleExistingDirectory(suggestedDirPath);
78107
- fs23.renameSync(dirPath, suggestedDirPath);
78198
+ fs24.renameSync(dirPath, suggestedDirPath);
78108
78199
  dirPath = suggestedDirPath;
78109
78200
  }
78110
78201
  }
@@ -78113,10 +78204,10 @@ var cloneBugReport = async ({
78113
78204
  console.warn("Unable to read package name for renaming:", error);
78114
78205
  }
78115
78206
  }
78116
- fs23.writeFileSync(path23.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
78207
+ fs24.writeFileSync(path24.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
78117
78208
  generateTsConfig(dirPath);
78118
78209
  await setupTsciProject(dirPath);
78119
- const relativeDirPath = path23.relative(originalCwd, dirPath);
78210
+ const relativeDirPath = path24.relative(originalCwd, dirPath);
78120
78211
  console.log(kleur_default.green(`
78121
78212
  Successfully cloned bug report to:`));
78122
78213
  console.log(` ${dirPath}/
@@ -78155,7 +78246,7 @@ var registerClone = (program3) => {
78155
78246
  const [, author, packageName] = match;
78156
78247
  console.log(`Cloning ${author}/${packageName}...`);
78157
78248
  const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
78158
- const dirPath = userSettingToIncludeAuthor ? path24.resolve(`${author}.${packageName}`) : path24.resolve(packageName);
78249
+ const dirPath = userSettingToIncludeAuthor ? path25.resolve(`${author}.${packageName}`) : path25.resolve(packageName);
78159
78250
  await handleExistingDirectory(dirPath);
78160
78251
  const ky2 = getRegistryApiKy();
78161
78252
  let packageFileList = {
@@ -78176,13 +78267,13 @@ var registerClone = (program3) => {
78176
78267
  console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
78177
78268
  process.exit(1);
78178
78269
  }
78179
- fs24.mkdirSync(dirPath, { recursive: true });
78270
+ fs25.mkdirSync(dirPath, { recursive: true });
78180
78271
  for (const fileInfo of packageFileList.package_files) {
78181
78272
  const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
78182
78273
  if (!filePath)
78183
78274
  continue;
78184
- const fullPath = path24.join(dirPath, filePath);
78185
- fs24.mkdirSync(path24.dirname(fullPath), { recursive: true });
78275
+ const fullPath = path25.join(dirPath, filePath);
78276
+ fs25.mkdirSync(path25.dirname(fullPath), { recursive: true });
78186
78277
  try {
78187
78278
  const fileContent = await ky2.get("package_files/get", {
78188
78279
  searchParams: {
@@ -78191,15 +78282,15 @@ var registerClone = (program3) => {
78191
78282
  file_path: fileInfo.file_path
78192
78283
  }
78193
78284
  }).json();
78194
- fs24.writeFileSync(fullPath, fileContent.package_file.content_text);
78285
+ fs25.writeFileSync(fullPath, fileContent.package_file.content_text);
78195
78286
  } catch (error) {
78196
78287
  console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
78197
78288
  }
78198
78289
  }
78199
- fs24.writeFileSync(path24.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
78290
+ fs25.writeFileSync(path25.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
78200
78291
  generateTsConfig(dirPath);
78201
78292
  await setupTsciProject(dirPath);
78202
- const relativeDirPath = path24.relative(originalCwd, dirPath);
78293
+ const relativeDirPath = path25.relative(originalCwd, dirPath);
78203
78294
  console.log(kleur_default.green(`
78204
78295
  Successfully cloned to:`));
78205
78296
  console.log(` ${dirPath}/
@@ -78215,8 +78306,8 @@ Successfully cloned to:`));
78215
78306
  var import_perfect_cli = __toESM2(require_dist7(), 1);
78216
78307
 
78217
78308
  // lib/shared/export-snippet.ts
78218
- import fs26 from "node:fs";
78219
- import path26 from "node:path";
78309
+ import fs27 from "node:fs";
78310
+ import path27 from "node:path";
78220
78311
  import { promisify as promisify3 } from "node:util";
78221
78312
 
78222
78313
  // node_modules/circuit-json-to-readable-netlist/dist/index.js
@@ -79395,9 +79486,9 @@ var stringifyDsnJson = (dsnJson) => {
79395
79486
  const stringifyCoordinates = (coordinates) => {
79396
79487
  return coordinates.join(" ");
79397
79488
  };
79398
- const stringifyPath = (path25, level) => {
79489
+ const stringifyPath = (path26, level) => {
79399
79490
  const padding = indent.repeat(level);
79400
- return `${padding}(path ${path25.layer} ${path25.width} ${stringifyCoordinates(path25.coordinates)})`;
79491
+ return `${padding}(path ${path26.layer} ${path26.width} ${stringifyCoordinates(path26.coordinates)})`;
79401
79492
  };
79402
79493
  result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
79403
79494
  `;
@@ -82577,8 +82668,8 @@ var SymbolInstancesProject = class _SymbolInstancesProject extends SxClass {
82577
82668
  }
82578
82669
  getString() {
82579
82670
  const lines = [`(project ${quoteSExprString(this.name)}`];
82580
- for (const path25 of this.paths) {
82581
- lines.push(path25.getStringIndented());
82671
+ for (const path26 of this.paths) {
82672
+ lines.push(path26.getStringIndented());
82582
82673
  }
82583
82674
  lines.push(")");
82584
82675
  return lines.join(`
@@ -82600,11 +82691,11 @@ var SymbolInstancePath = class _SymbolInstancePath extends SxClass {
82600
82691
  static fromSexprPrimitives(primitiveSexprs) {
82601
82692
  const [pathPrimitive, ...rest] = primitiveSexprs;
82602
82693
  const value = toStringValue(pathPrimitive) ?? "";
82603
- const path25 = new _SymbolInstancePath(value);
82694
+ const path26 = new _SymbolInstancePath(value);
82604
82695
  const { propertyMap } = SxClass.parsePrimitivesToClassProperties(rest, this.token);
82605
- path25._sxReference = propertyMap.reference;
82606
- path25._sxUnit = propertyMap.unit;
82607
- return path25;
82696
+ path26._sxReference = propertyMap.reference;
82697
+ path26._sxUnit = propertyMap.unit;
82698
+ return path26;
82608
82699
  }
82609
82700
  get reference() {
82610
82701
  return this._sxReference?.value;
@@ -83651,8 +83742,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
83651
83742
  if (value === undefined) {
83652
83743
  throw new Error("sheet_instances path requires a string identifier");
83653
83744
  }
83654
- const path25 = new _SheetInstancesRootPath;
83655
- path25._value = value;
83745
+ const path26 = new _SheetInstancesRootPath;
83746
+ path26._value = value;
83656
83747
  const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_instances_path");
83657
83748
  const unsupportedSingularTokens = Object.keys(propertyMap).filter((token) => !SUPPORTED_ARRAY_TOKENS2.has(token));
83658
83749
  if (unsupportedSingularTokens.length > 0) {
@@ -83666,8 +83757,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
83666
83757
  if (!pages.length && propertyMap.page) {
83667
83758
  pages.push(propertyMap.page);
83668
83759
  }
83669
- path25._pages = pages;
83670
- return path25;
83760
+ path26._pages = pages;
83761
+ return path26;
83671
83762
  }
83672
83763
  get value() {
83673
83764
  return this._value;
@@ -83815,8 +83906,8 @@ var SheetInstancesProject = class _SheetInstancesProject extends SxClass {
83815
83906
  }
83816
83907
  getString() {
83817
83908
  const lines = [`(project ${quoteSExprString(this.name)}`];
83818
- for (const path25 of this.paths) {
83819
- lines.push(path25.getStringIndented());
83909
+ for (const path26 of this.paths) {
83910
+ lines.push(path26.getStringIndented());
83820
83911
  }
83821
83912
  lines.push(")");
83822
83913
  return lines.join(`
@@ -83840,10 +83931,10 @@ var SheetInstancePath = class _SheetInstancePath extends SxClass {
83840
83931
  if (value === undefined) {
83841
83932
  throw new Error("sheet instance path value must be a string");
83842
83933
  }
83843
- const path25 = new _SheetInstancePath(value);
83934
+ const path26 = new _SheetInstancePath(value);
83844
83935
  const { arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_path");
83845
- path25.pages = arrayPropertyMap.page ?? [];
83846
- return path25;
83936
+ path26.pages = arrayPropertyMap.page ?? [];
83937
+ return path26;
83847
83938
  }
83848
83939
  getChildren() {
83849
83940
  return [...this.pages];
@@ -89081,20 +89172,20 @@ var FootprintModel = class _FootprintModel extends SxClass {
89081
89172
  _offset;
89082
89173
  _scale;
89083
89174
  _rotate;
89084
- constructor(path25) {
89175
+ constructor(path26) {
89085
89176
  super();
89086
- this._path = path25;
89177
+ this._path = path26;
89087
89178
  }
89088
89179
  static fromSexprPrimitives(primitiveSexprs) {
89089
89180
  if (primitiveSexprs.length === 0) {
89090
89181
  throw new Error("model requires a path argument");
89091
89182
  }
89092
89183
  const [rawPath, ...rest] = primitiveSexprs;
89093
- const path25 = toStringValue(rawPath);
89094
- if (path25 === undefined) {
89184
+ const path26 = toStringValue(rawPath);
89185
+ if (path26 === undefined) {
89095
89186
  throw new Error("model path must be a string value");
89096
89187
  }
89097
- const model = new _FootprintModel(path25);
89188
+ const model = new _FootprintModel(path26);
89098
89189
  for (const primitive of rest) {
89099
89190
  if (!Array.isArray(primitive) || primitive.length === 0) {
89100
89191
  throw new Error(`model encountered invalid child expression: ${JSON.stringify(primitive)}`);
@@ -93782,10 +93873,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
93782
93873
  }
93783
93874
  const instances = new SymbolInstances;
93784
93875
  const project = new SymbolInstancesProject("");
93785
- const path25 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
93786
- path25.reference = reference;
93787
- path25.unit = 1;
93788
- project.paths.push(path25);
93876
+ const path26 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
93877
+ path26.reference = reference;
93878
+ path26.unit = 1;
93879
+ project.paths.push(path26);
93789
93880
  instances.projects.push(project);
93790
93881
  symbol._sxInstances = instances;
93791
93882
  symbols3.push(symbol);
@@ -93993,11 +94084,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
93993
94084
  throw new Error("KicadSch instance not initialized in context");
93994
94085
  }
93995
94086
  const sheetInstances = new SheetInstances;
93996
- const path25 = new SheetInstancesRootPath;
93997
- path25.value = "/";
94087
+ const path26 = new SheetInstancesRootPath;
94088
+ path26.value = "/";
93998
94089
  const page = new SheetInstancesRootPage("1");
93999
- path25.pages = [page];
94000
- sheetInstances.paths = [path25];
94090
+ path26.pages = [page];
94091
+ sheetInstances.paths = [path26];
94001
94092
  kicadSch.sheetInstances = sheetInstances;
94002
94093
  kicadSch.embeddedFonts = new EmbeddedFonts(false);
94003
94094
  this.finished = true;
@@ -94352,12 +94443,12 @@ var AddGraphicsStage = class extends ConverterStage {
94352
94443
  throw new Error("PCB transformation matrix not initialized in context");
94353
94444
  }
94354
94445
  const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
94355
- for (const path25 of pcbSilkscreenPaths) {
94356
- if (!path25.route || path25.route.length < 2)
94446
+ for (const path26 of pcbSilkscreenPaths) {
94447
+ if (!path26.route || path26.route.length < 2)
94357
94448
  continue;
94358
- for (let i = 0;i < path25.route.length - 1; i++) {
94359
- const startPoint = path25.route[i];
94360
- const endPoint = path25.route[i + 1];
94449
+ for (let i = 0;i < path26.route.length - 1; i++) {
94450
+ const startPoint = path26.route[i];
94451
+ const endPoint = path26.route[i + 1];
94361
94452
  if (!startPoint || !endPoint)
94362
94453
  continue;
94363
94454
  const transformedStart = applyToPoint62(c2kMatPcb, {
@@ -94372,12 +94463,12 @@ var AddGraphicsStage = class extends ConverterStage {
94372
94463
  top: "F.SilkS",
94373
94464
  bottom: "B.SilkS"
94374
94465
  };
94375
- const kicadLayer = layerMap[path25.layer] || path25.layer || "F.SilkS";
94466
+ const kicadLayer = layerMap[path26.layer] || path26.layer || "F.SilkS";
94376
94467
  const grLine = new GrLine({
94377
94468
  start: { x: transformedStart.x, y: transformedStart.y },
94378
94469
  end: { x: transformedEnd.x, y: transformedEnd.y },
94379
94470
  layer: kicadLayer,
94380
- width: path25.stroke_width || 0.15
94471
+ width: path26.stroke_width || 0.15
94381
94472
  });
94382
94473
  const graphicLines = kicadPcb.graphicLines;
94383
94474
  graphicLines.push(grLine);
@@ -94485,8 +94576,8 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
94485
94576
 
94486
94577
  // lib/shared/generate-circuit-json.tsx
94487
94578
  var import_make_vfs2 = __toESM2(require_dist8(), 1);
94488
- import path25 from "node:path";
94489
- import fs25 from "node:fs";
94579
+ import path26 from "node:path";
94580
+ import fs26 from "node:fs";
94490
94581
  import { pathToFileURL } from "node:url";
94491
94582
  import Debug11 from "debug";
94492
94583
 
@@ -94548,12 +94639,12 @@ async function generateCircuitJson({
94548
94639
  const runner = new userLandTscircuit.RootCircuit({
94549
94640
  platform: platformConfig
94550
94641
  });
94551
- const absoluteFilePath = path25.isAbsolute(filePath) ? filePath : path25.resolve(process.cwd(), filePath);
94552
- const projectDir = path25.dirname(absoluteFilePath);
94642
+ const absoluteFilePath = path26.isAbsolute(filePath) ? filePath : path26.resolve(process.cwd(), filePath);
94643
+ const projectDir = path26.dirname(absoluteFilePath);
94553
94644
  const resolvedOutputDir = outputDir ?? projectDir;
94554
- const relativeComponentPath = path25.relative(projectDir, absoluteFilePath);
94555
- const baseFileName = outputFileName || path25.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
94556
- const outputPath = path25.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
94645
+ const relativeComponentPath = path26.relative(projectDir, absoluteFilePath);
94646
+ const baseFileName = outputFileName || path26.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
94647
+ const outputPath = path26.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
94557
94648
  debug11(`Project directory: ${projectDir}`);
94558
94649
  debug11(`Relative component path: ${relativeComponentPath}`);
94559
94650
  debug11(`Output path: ${outputPath}`);
@@ -94570,7 +94661,7 @@ async function generateCircuitJson({
94570
94661
  return false;
94571
94662
  if (normalizedFilePath.match(/^\.[^/]/))
94572
94663
  return false;
94573
- if (!ALLOWED_FILE_EXTENSIONS.includes(path25.extname(normalizedFilePath)))
94664
+ if (!ALLOWED_FILE_EXTENSIONS.includes(path26.extname(normalizedFilePath)))
94574
94665
  return false;
94575
94666
  return true;
94576
94667
  },
@@ -94588,7 +94679,7 @@ async function generateCircuitJson({
94588
94679
  const circuitJson = await runner.getCircuitJson();
94589
94680
  if (saveToFile) {
94590
94681
  debug11(`Saving circuit JSON to ${outputPath}`);
94591
- fs25.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
94682
+ fs26.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
94592
94683
  }
94593
94684
  return {
94594
94685
  circuitJson,
@@ -94597,7 +94688,7 @@ async function generateCircuitJson({
94597
94688
  }
94598
94689
 
94599
94690
  // lib/shared/export-snippet.ts
94600
- var writeFileAsync = promisify3(fs26.writeFile);
94691
+ var writeFileAsync = promisify3(fs27.writeFile);
94601
94692
  var ALLOWED_EXPORT_FORMATS = [
94602
94693
  "json",
94603
94694
  "circuit-json",
@@ -94640,10 +94731,10 @@ var exportSnippet = async ({
94640
94731
  onError(`Invalid format: ${format}`);
94641
94732
  return onExit(1);
94642
94733
  }
94643
- const projectDir = path26.dirname(filePath);
94644
- const outputBaseName = path26.basename(filePath).replace(/\.[^.]+$/, "");
94734
+ const projectDir = path27.dirname(filePath);
94735
+ const outputBaseName = path27.basename(filePath).replace(/\.[^.]+$/, "");
94645
94736
  const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
94646
- const outputDestination = path26.join(projectDir, outputPath ?? outputFileName);
94737
+ const outputDestination = path27.join(projectDir, outputPath ?? outputFileName);
94647
94738
  const circuitData = await generateCircuitJson({
94648
94739
  filePath,
94649
94740
  saveToFile: format === "circuit-json",
@@ -94827,20 +94918,20 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
94827
94918
  };
94828
94919
 
94829
94920
  // lib/eecircuit-engine/run-simulation.ts
94830
- import { promises as fs27, existsSync as existsSync11 } from "node:fs";
94831
- import path27 from "node:path";
94921
+ import { promises as fs28, existsSync as existsSync12 } from "node:fs";
94922
+ import path28 from "node:path";
94832
94923
  import os2 from "node:os";
94833
94924
  var sim = null;
94834
94925
  var fetchSimulation = async () => {
94835
- const tempFilePath = path27.join(os2.tmpdir(), "eecircuit-engine-1.5.2.mjs");
94836
- if (!existsSync11(tempFilePath)) {
94926
+ const tempFilePath = path28.join(os2.tmpdir(), "eecircuit-engine-1.5.2.mjs");
94927
+ if (!existsSync12(tempFilePath)) {
94837
94928
  const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
94838
94929
  const response = await fetch(url);
94839
94930
  if (!response.ok) {
94840
94931
  throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
94841
94932
  }
94842
94933
  const scriptContent = await response.text();
94843
- await fs27.writeFile(tempFilePath, scriptContent);
94934
+ await fs28.writeFile(tempFilePath, scriptContent);
94844
94935
  }
94845
94936
  const module2 = await import(tempFilePath);
94846
94937
  return module2.Simulation;
@@ -94929,8 +95020,8 @@ var resultToCsv = (result) => {
94929
95020
  };
94930
95021
 
94931
95022
  // cli/export/register.ts
94932
- import path28 from "node:path";
94933
- import { promises as fs28 } from "node:fs";
95023
+ import path29 from "node:path";
95024
+ import { promises as fs29 } from "node:fs";
94934
95025
  var registerExport = (program3) => {
94935
95026
  program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", `Output format (${ALLOWED_EXPORT_FORMATS.join(", ")})`).option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
94936
95027
  const formatOption = options.format ?? "json";
@@ -94942,12 +95033,12 @@ var registerExport = (program3) => {
94942
95033
  });
94943
95034
  if (circuitJson) {
94944
95035
  const spiceString = getSpiceWithPaddedSim(circuitJson);
94945
- const outputSpicePath = options.output ?? path28.join(path28.dirname(file), `${path28.basename(file, path28.extname(file))}.spice.cir`);
94946
- await fs28.writeFile(outputSpicePath, spiceString);
95036
+ const outputSpicePath = options.output ?? path29.join(path29.dirname(file), `${path29.basename(file, path29.extname(file))}.spice.cir`);
95037
+ await fs29.writeFile(outputSpicePath, spiceString);
94947
95038
  const { result } = await runSimulation(spiceString);
94948
95039
  const csvContent = resultToCsv(result);
94949
95040
  const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
94950
- await fs28.writeFile(outputCsvPath, csvContent);
95041
+ await fs29.writeFile(outputCsvPath, csvContent);
94951
95042
  console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
94952
95043
  }
94953
95044
  return;
@@ -95179,14 +95270,14 @@ class KeyStore {
95179
95270
  }
95180
95271
  }
95181
95272
  function createKey(key) {
95182
- let path29 = null;
95273
+ let path30 = null;
95183
95274
  let id = null;
95184
95275
  let src = null;
95185
95276
  let weight = 1;
95186
95277
  let getFn = null;
95187
95278
  if (isString2(key) || isArray(key)) {
95188
95279
  src = key;
95189
- path29 = createKeyPath(key);
95280
+ path30 = createKeyPath(key);
95190
95281
  id = createKeyId(key);
95191
95282
  } else {
95192
95283
  if (!hasOwn.call(key, "name")) {
@@ -95200,11 +95291,11 @@ function createKey(key) {
95200
95291
  throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
95201
95292
  }
95202
95293
  }
95203
- path29 = createKeyPath(name);
95294
+ path30 = createKeyPath(name);
95204
95295
  id = createKeyId(name);
95205
95296
  getFn = key.getFn;
95206
95297
  }
95207
- return { path: path29, id, weight, src, getFn };
95298
+ return { path: path30, id, weight, src, getFn };
95208
95299
  }
95209
95300
  function createKeyPath(key) {
95210
95301
  return isArray(key) ? key : key.split(".");
@@ -95212,34 +95303,34 @@ function createKeyPath(key) {
95212
95303
  function createKeyId(key) {
95213
95304
  return isArray(key) ? key.join(".") : key;
95214
95305
  }
95215
- function get(obj, path29) {
95306
+ function get(obj, path30) {
95216
95307
  let list = [];
95217
95308
  let arr = false;
95218
- const deepGet = (obj2, path30, index) => {
95309
+ const deepGet = (obj2, path31, index) => {
95219
95310
  if (!isDefined(obj2)) {
95220
95311
  return;
95221
95312
  }
95222
- if (!path30[index]) {
95313
+ if (!path31[index]) {
95223
95314
  list.push(obj2);
95224
95315
  } else {
95225
- let key = path30[index];
95316
+ let key = path31[index];
95226
95317
  const value = obj2[key];
95227
95318
  if (!isDefined(value)) {
95228
95319
  return;
95229
95320
  }
95230
- if (index === path30.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
95321
+ if (index === path31.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
95231
95322
  list.push(toString(value));
95232
95323
  } else if (isArray(value)) {
95233
95324
  arr = true;
95234
95325
  for (let i = 0, len = value.length;i < len; i += 1) {
95235
- deepGet(value[i], path30, index + 1);
95326
+ deepGet(value[i], path31, index + 1);
95236
95327
  }
95237
- } else if (path30.length) {
95238
- deepGet(value, path30, index + 1);
95328
+ } else if (path31.length) {
95329
+ deepGet(value, path31, index + 1);
95239
95330
  }
95240
95331
  }
95241
95332
  };
95242
- deepGet(obj, isString2(path29) ? path29.split(".") : path29, 0);
95333
+ deepGet(obj, isString2(path30) ? path30.split(".") : path30, 0);
95243
95334
  return arr ? list : list[0];
95244
95335
  }
95245
95336
  var MatchOptions = {
@@ -96431,8 +96522,8 @@ var registerSearch = (program3) => {
96431
96522
  }
96432
96523
  if (kicadResults.length) {
96433
96524
  console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
96434
- kicadResults.forEach((path29, idx) => {
96435
- console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path29.replace(".kicad_mod", "").replace(".pretty", "")}`);
96525
+ kicadResults.forEach((path30, idx) => {
96526
+ console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path30.replace(".kicad_mod", "").replace(".pretty", "")}`);
96436
96527
  });
96437
96528
  }
96438
96529
  if (!onlyKicad && results.packages.length) {
@@ -101610,7 +101701,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
101610
101701
  var U = e({ primitives: [...Object.values(Ad)], ports: [{ ...Pd.left1, labels: ["1"] }], center: { x: ss.centerX, y: ss.centerY } }).rotateRightFacingSymbol("right").labelPort("left1", ["1"]).build();
101611
101702
  var ms = r(U, "down");
101612
101703
  var ns = r(U, "left");
101613
- var fs29 = r(U, "up");
101704
+ var fs30 = r(U, "up");
101614
101705
  var g = { paths: { path11: { type: "path", points: [{ x: -0.39, y: 0 }, { x: 0.06, y: -0.01 }], color: "primary", fill: false }, "path40-0": { type: "path", points: [{ x: 0.07, y: 0.27 }, { x: 0.07, y: -0.28 }], color: "primary", fill: false }, "path40-0-5": { type: "path", points: [{ x: 0.28, y: 0.24 }, { x: 0.08, y: 0.11 }], color: "primary", fill: false }, "path40-0-5-0": { type: "path", points: [{ x: 0.29, y: -0.24 }, { x: 0.09, y: -0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.29, y: 0.25 }, { x: 0.29, y: 0.54 }], color: "primary", fill: false }, "path12-1-5-3": { type: "path", points: [{ x: 0.29, y: -0.54 }, { x: 0.29, y: -0.25 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: 0.19, y: -0.1 }, { x: 0.12, y: -0.2 }, { x: 0.22, y: -0.2 }, { x: 0.19, y: -0.1 }], color: "primary", fill: true } }, texts: { top1: { type: "text", text: "{REF}", x: -0.08, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: -0.07, y: -0.41 } }, refblocks: { top1: { x: 0.29, y: 0.55 }, bottom1: { x: 0.29, y: -0.55 }, left1: { x: -0.4, y: 0 } }, bounds: { minX: -0.43, maxX: 0.43, minY: -0.58, maxY: 0.58, width: 0.85, height: 1.16, centerX: 0, centerY: 0 }, circles: { "path1-0": { type: "circle", x: 0.14, y: 0, radius: 0.29, color: "primary", fill: false } } };
101615
101706
  var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
101616
101707
  var hs = e({ primitives: [...Object.values(Fd), ...Object.values(Rd), { type: "text", text: "{REF}", x: -0.1, y: 0.3094553499999995 }, { type: "text", text: "{VAL}", x: -0.1, y: -0.3094553499999995 }], ports: [{ ...Mo.top1, labels: ["1", "collector"] }, { ...Mo.bottom1, labels: ["2", "emitter"] }, { ...Mo.left1, labels: ["3", "base"] }], size: { width: e0.width, height: e0.height }, center: { x: e0.centerX, y: e0.centerY } }).rotateRightFacingSymbol("right").changeTextAnchor("{REF}", "middle_right").changeTextAnchor("{VAL}", "middle_right").build();
@@ -102179,7 +102270,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
102179
102270
  sb.anchor = "middle_left";
102180
102271
  mb.anchor = "middle_right";
102181
102272
  var B1 = Cl;
102182
- var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At2, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os3, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs29, npn_bipolar_transistor_down: hs, npn_bipolar_transistor_horz: cs, npn_bipolar_transistor_left: ds, npn_bipolar_transistor_right: bs, npn_bipolar_transistor_up: _s, npn_bipolar_transistor_vert: gs, opamp_no_power_down: vs, opamp_no_power_left: ws, opamp_no_power_right: G, opamp_no_power_up: As, opamp_with_power_down: Ss, opamp_with_power_left: Fs, opamp_with_power_right: W, opamp_with_power_up: Rs, p_channel_d_mosfet_transistor_horz: a0, p_channel_d_mosfet_transistor_vert: Ls, p_channel_e_mosfet_transistor_horz: x0, p_channel_e_mosfet_transistor_vert: Os, photodiode_horz: s0, photodiode_vert: Cs, pjfet_transistor_horz: n0, pjfet_transistor_vert: Ds, pnp_bipolar_transistor_down: Us, pnp_bipolar_transistor_horz: Gs, pnp_bipolar_transistor_left: Ws, pnp_bipolar_transistor_right: Hs, pnp_bipolar_transistor_up: Zs, pnp_bipolar_transistor_vert: Qs, potentiometer_horz: g0, potentiometer_vert: rm, potentiometer2_down: pm, potentiometer2_left: am, potentiometer2_right: H, potentiometer2_up: ym, potentiometer3_down: xm, potentiometer3_left: sm, potentiometer3_right: mm, potentiometer3_up: nm, power_factor_meter_horz: S0, power_factor_meter_vert: dm, push_button_normally_closed_momentary_horz: R0, push_button_normally_closed_momentary_vert: um, push_button_normally_open_momentary_horz: E0, push_button_normally_open_momentary_vert: Pm, rectifier_diode_horz: L0, rectifier_diode_vert: Rm, resistor_down: Em, resistor_left: Xm, resistor_right: Vm, resistor_up: km, resonator_down: Om, resonator_horz: M0, resonator_left: Jm, resonator_right: K, resonator_up: $m, resonator_vert: Mm, schottky_diode_down: Nm, schottky_diode_left: Im, schottky_diode_right: tt, schottky_diode_up: Bm, silicon_controlled_rectifier_horz: C0, silicon_controlled_rectifier_vert: Um, solderjumper2_bridged12_down: Gm, solderjumper2_bridged12_left: Wm, solderjumper2_bridged12_right: Hm, solderjumper2_bridged12_up: Zm, solderjumper2_down: Qm, solderjumper2_left: Km, solderjumper2_right: tn, solderjumper2_up: en, solderjumper3_bridged12_down: rn, solderjumper3_bridged12_left: on2, solderjumper3_bridged12_right: ln, solderjumper3_bridged12_up: pn, solderjumper3_bridged123_down: an, solderjumper3_bridged123_left: yn, solderjumper3_bridged123_right: xn, solderjumper3_bridged123_up: sn, solderjumper3_bridged23_down: mn, solderjumper3_bridged23_left: nn, solderjumper3_bridged23_right: fn, solderjumper3_bridged23_up: hn, solderjumper3_down: cn, solderjumper3_left: dn, solderjumper3_right: bn, solderjumper3_up: _n, spdt_normally_closed_switch_down: un, spdt_normally_closed_switch_left: vn, spdt_normally_closed_switch_right: at, spdt_normally_closed_switch_up: wn, spdt_switch_down: Pn, spdt_switch_left: Sn, spdt_switch_right: yt, spdt_switch_up: Fn, spst_normally_closed_switch_down: Rn, spst_normally_closed_switch_left: Tn, spst_normally_closed_switch_right: xt, spst_normally_closed_switch_up: En, spst_switch_down: Yn, spst_switch_left: Xn, spst_switch_right: st, spst_switch_up: Ln, square_wave_down: Vn, square_wave_left: jn, square_wave_right: kn, square_wave_up: zn, step_recovery_diode_horz: N0, step_recovery_diode_vert: On, tachometer_horz: Tt, tachometer_vert: Cn, testpoint_down: Bn, testpoint_left: qn, testpoint_right: nt, testpoint_up: Gn, tilted_ground_down: Hn, tilted_ground_left: Zn, tilted_ground_right: ut, tilted_ground_up: B0, triac_horz: q0, triac_vert: t1, tunnel_diode_horz: U0, tunnel_diode_vert: i1, unijunction_transistor_horz: W0, unijunction_transistor_vert: s1, usbc: n1, var_meter_horz: Z0, var_meter_vert: c1, varactor_diode_horz: K0, varactor_diode_vert: g1, varistor_horz: er, varistor_vert: A1, varmeter_horz: Et, varmeter_vert: R1, vcc_down: T1, vcc_left: E1, vcc_right: Y1, vcc_up: X1, volt_meter_horz: or, volt_meter_vert: L1, watt_hour_meter_horz: Yt, watt_hour_meter_vert: z1, wattmeter_horz: Xt, wattmeter_vert: M1, zener_diode_horz: ar, zener_diode_vert: B1 };
102273
+ var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At2, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os3, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs30, npn_bipolar_transistor_down: hs, npn_bipolar_transistor_horz: cs, npn_bipolar_transistor_left: ds, npn_bipolar_transistor_right: bs, npn_bipolar_transistor_up: _s, npn_bipolar_transistor_vert: gs, opamp_no_power_down: vs, opamp_no_power_left: ws, opamp_no_power_right: G, opamp_no_power_up: As, opamp_with_power_down: Ss, opamp_with_power_left: Fs, opamp_with_power_right: W, opamp_with_power_up: Rs, p_channel_d_mosfet_transistor_horz: a0, p_channel_d_mosfet_transistor_vert: Ls, p_channel_e_mosfet_transistor_horz: x0, p_channel_e_mosfet_transistor_vert: Os, photodiode_horz: s0, photodiode_vert: Cs, pjfet_transistor_horz: n0, pjfet_transistor_vert: Ds, pnp_bipolar_transistor_down: Us, pnp_bipolar_transistor_horz: Gs, pnp_bipolar_transistor_left: Ws, pnp_bipolar_transistor_right: Hs, pnp_bipolar_transistor_up: Zs, pnp_bipolar_transistor_vert: Qs, potentiometer_horz: g0, potentiometer_vert: rm, potentiometer2_down: pm, potentiometer2_left: am, potentiometer2_right: H, potentiometer2_up: ym, potentiometer3_down: xm, potentiometer3_left: sm, potentiometer3_right: mm, potentiometer3_up: nm, power_factor_meter_horz: S0, power_factor_meter_vert: dm, push_button_normally_closed_momentary_horz: R0, push_button_normally_closed_momentary_vert: um, push_button_normally_open_momentary_horz: E0, push_button_normally_open_momentary_vert: Pm, rectifier_diode_horz: L0, rectifier_diode_vert: Rm, resistor_down: Em, resistor_left: Xm, resistor_right: Vm, resistor_up: km, resonator_down: Om, resonator_horz: M0, resonator_left: Jm, resonator_right: K, resonator_up: $m, resonator_vert: Mm, schottky_diode_down: Nm, schottky_diode_left: Im, schottky_diode_right: tt, schottky_diode_up: Bm, silicon_controlled_rectifier_horz: C0, silicon_controlled_rectifier_vert: Um, solderjumper2_bridged12_down: Gm, solderjumper2_bridged12_left: Wm, solderjumper2_bridged12_right: Hm, solderjumper2_bridged12_up: Zm, solderjumper2_down: Qm, solderjumper2_left: Km, solderjumper2_right: tn, solderjumper2_up: en, solderjumper3_bridged12_down: rn, solderjumper3_bridged12_left: on2, solderjumper3_bridged12_right: ln, solderjumper3_bridged12_up: pn, solderjumper3_bridged123_down: an, solderjumper3_bridged123_left: yn, solderjumper3_bridged123_right: xn, solderjumper3_bridged123_up: sn, solderjumper3_bridged23_down: mn, solderjumper3_bridged23_left: nn, solderjumper3_bridged23_right: fn, solderjumper3_bridged23_up: hn, solderjumper3_down: cn, solderjumper3_left: dn, solderjumper3_right: bn, solderjumper3_up: _n, spdt_normally_closed_switch_down: un, spdt_normally_closed_switch_left: vn, spdt_normally_closed_switch_right: at, spdt_normally_closed_switch_up: wn, spdt_switch_down: Pn, spdt_switch_left: Sn, spdt_switch_right: yt, spdt_switch_up: Fn, spst_normally_closed_switch_down: Rn, spst_normally_closed_switch_left: Tn, spst_normally_closed_switch_right: xt, spst_normally_closed_switch_up: En, spst_switch_down: Yn, spst_switch_left: Xn, spst_switch_right: st, spst_switch_up: Ln, square_wave_down: Vn, square_wave_left: jn, square_wave_right: kn, square_wave_up: zn, step_recovery_diode_horz: N0, step_recovery_diode_vert: On, tachometer_horz: Tt, tachometer_vert: Cn, testpoint_down: Bn, testpoint_left: qn, testpoint_right: nt, testpoint_up: Gn, tilted_ground_down: Hn, tilted_ground_left: Zn, tilted_ground_right: ut, tilted_ground_up: B0, triac_horz: q0, triac_vert: t1, tunnel_diode_horz: U0, tunnel_diode_vert: i1, unijunction_transistor_horz: W0, unijunction_transistor_vert: s1, usbc: n1, var_meter_horz: Z0, var_meter_vert: c1, varactor_diode_horz: K0, varactor_diode_vert: g1, varistor_horz: er, varistor_vert: A1, varmeter_horz: Et, varmeter_vert: R1, vcc_down: T1, vcc_left: E1, vcc_right: Y1, vcc_up: X1, volt_meter_horz: or, volt_meter_vert: L1, watt_hour_meter_horz: Yt, watt_hour_meter_vert: z1, wattmeter_horz: Xt, wattmeter_vert: M1, zener_diode_horz: ar, zener_diode_vert: B1 };
102183
102274
  var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
102184
102275
  function doesLineIntersectLine([a12, a22], [b12, b22], {
102185
102276
  lineThickness = 0
@@ -104209,11 +104300,11 @@ var require_react_reconciler_development = __commonJS2({
104209
104300
  fiber = fiber.next, id2--;
104210
104301
  return fiber;
104211
104302
  }
104212
- function copyWithSetImpl(obj, path29, index, value) {
104213
- if (index >= path29.length)
104303
+ function copyWithSetImpl(obj, path30, index, value) {
104304
+ if (index >= path30.length)
104214
104305
  return value;
104215
- var key = path29[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
104216
- updated[key] = copyWithSetImpl(obj[key], path29, index + 1, value);
104306
+ var key = path30[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
104307
+ updated[key] = copyWithSetImpl(obj[key], path30, index + 1, value);
104217
104308
  return updated;
104218
104309
  }
104219
104310
  function copyWithRename(obj, oldPath, newPath) {
@@ -104233,11 +104324,11 @@ var require_react_reconciler_development = __commonJS2({
104233
104324
  index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1);
104234
104325
  return updated;
104235
104326
  }
104236
- function copyWithDeleteImpl(obj, path29, index) {
104237
- var key = path29[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
104238
- if (index + 1 === path29.length)
104327
+ function copyWithDeleteImpl(obj, path30, index) {
104328
+ var key = path30[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
104329
+ if (index + 1 === path30.length)
104239
104330
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
104240
- updated[key] = copyWithDeleteImpl(obj[key], path29, index + 1);
104331
+ updated[key] = copyWithDeleteImpl(obj[key], path30, index + 1);
104241
104332
  return updated;
104242
104333
  }
104243
104334
  function shouldSuspendImpl() {
@@ -113268,29 +113359,29 @@ Check the top-level render call using <` + componentName2 + ">.");
113268
113359
  var didWarnAboutNestedUpdates = false;
113269
113360
  var didWarnAboutFindNodeInStrictMode = {};
113270
113361
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
113271
- overrideHookState = function(fiber, id2, path29, value) {
113362
+ overrideHookState = function(fiber, id2, path30, value) {
113272
113363
  id2 = findHook(fiber, id2);
113273
- id2 !== null && (path29 = copyWithSetImpl(id2.memoizedState, path29, 0, value), id2.memoizedState = path29, id2.baseState = path29, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path29 = enqueueConcurrentRenderForLane(fiber, 2), path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2));
113364
+ id2 !== null && (path30 = copyWithSetImpl(id2.memoizedState, path30, 0, value), id2.memoizedState = path30, id2.baseState = path30, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path30 = enqueueConcurrentRenderForLane(fiber, 2), path30 !== null && scheduleUpdateOnFiber(path30, fiber, 2));
113274
113365
  };
113275
- overrideHookStateDeletePath = function(fiber, id2, path29) {
113366
+ overrideHookStateDeletePath = function(fiber, id2, path30) {
113276
113367
  id2 = findHook(fiber, id2);
113277
- id2 !== null && (path29 = copyWithDeleteImpl(id2.memoizedState, path29, 0), id2.memoizedState = path29, id2.baseState = path29, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path29 = enqueueConcurrentRenderForLane(fiber, 2), path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2));
113368
+ id2 !== null && (path30 = copyWithDeleteImpl(id2.memoizedState, path30, 0), id2.memoizedState = path30, id2.baseState = path30, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path30 = enqueueConcurrentRenderForLane(fiber, 2), path30 !== null && scheduleUpdateOnFiber(path30, fiber, 2));
113278
113369
  };
113279
113370
  overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
113280
113371
  id2 = findHook(fiber, id2);
113281
113372
  id2 !== null && (oldPath = copyWithRename(id2.memoizedState, oldPath, newPath), id2.memoizedState = oldPath, id2.baseState = oldPath, fiber.memoizedProps = assign2({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), oldPath !== null && scheduleUpdateOnFiber(oldPath, fiber, 2));
113282
113373
  };
113283
- overrideProps = function(fiber, path29, value) {
113284
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path29, 0, value);
113374
+ overrideProps = function(fiber, path30, value) {
113375
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path30, 0, value);
113285
113376
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
113286
- path29 = enqueueConcurrentRenderForLane(fiber, 2);
113287
- path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2);
113377
+ path30 = enqueueConcurrentRenderForLane(fiber, 2);
113378
+ path30 !== null && scheduleUpdateOnFiber(path30, fiber, 2);
113288
113379
  };
113289
- overridePropsDeletePath = function(fiber, path29) {
113290
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path29, 0);
113380
+ overridePropsDeletePath = function(fiber, path30) {
113381
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path30, 0);
113291
113382
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
113292
- path29 = enqueueConcurrentRenderForLane(fiber, 2);
113293
- path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2);
113383
+ path30 = enqueueConcurrentRenderForLane(fiber, 2);
113384
+ path30 !== null && scheduleUpdateOnFiber(path30, fiber, 2);
113294
113385
  };
113295
113386
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
113296
113387
  fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
@@ -128627,10 +128718,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128627
128718
  var setErrorHandler = null;
128628
128719
  var setSuspenseHandler = null;
128629
128720
  {
128630
- var copyWithDeleteImpl = function(obj, path29, index2) {
128631
- var key = path29[index2];
128721
+ var copyWithDeleteImpl = function(obj, path30, index2) {
128722
+ var key = path30[index2];
128632
128723
  var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
128633
- if (index2 + 1 === path29.length) {
128724
+ if (index2 + 1 === path30.length) {
128634
128725
  if (isArray2(updated)) {
128635
128726
  updated.splice(key, 1);
128636
128727
  } else {
@@ -128638,11 +128729,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128638
128729
  }
128639
128730
  return updated;
128640
128731
  }
128641
- updated[key] = copyWithDeleteImpl(obj[key], path29, index2 + 1);
128732
+ updated[key] = copyWithDeleteImpl(obj[key], path30, index2 + 1);
128642
128733
  return updated;
128643
128734
  };
128644
- var copyWithDelete = function(obj, path29) {
128645
- return copyWithDeleteImpl(obj, path29, 0);
128735
+ var copyWithDelete = function(obj, path30) {
128736
+ return copyWithDeleteImpl(obj, path30, 0);
128646
128737
  };
128647
128738
  var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
128648
128739
  var oldKey = oldPath[index2];
@@ -128674,17 +128765,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128674
128765
  }
128675
128766
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
128676
128767
  };
128677
- var copyWithSetImpl = function(obj, path29, index2, value) {
128678
- if (index2 >= path29.length) {
128768
+ var copyWithSetImpl = function(obj, path30, index2, value) {
128769
+ if (index2 >= path30.length) {
128679
128770
  return value;
128680
128771
  }
128681
- var key = path29[index2];
128772
+ var key = path30[index2];
128682
128773
  var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
128683
- updated[key] = copyWithSetImpl(obj[key], path29, index2 + 1, value);
128774
+ updated[key] = copyWithSetImpl(obj[key], path30, index2 + 1, value);
128684
128775
  return updated;
128685
128776
  };
128686
- var copyWithSet = function(obj, path29, value) {
128687
- return copyWithSetImpl(obj, path29, 0, value);
128777
+ var copyWithSet = function(obj, path30, value) {
128778
+ return copyWithSetImpl(obj, path30, 0, value);
128688
128779
  };
128689
128780
  var findHook = function(fiber, id2) {
128690
128781
  var currentHook2 = fiber.memoizedState;
@@ -128694,10 +128785,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128694
128785
  }
128695
128786
  return currentHook2;
128696
128787
  };
128697
- overrideHookState = function(fiber, id2, path29, value) {
128788
+ overrideHookState = function(fiber, id2, path30, value) {
128698
128789
  var hook = findHook(fiber, id2);
128699
128790
  if (hook !== null) {
128700
- var newState = copyWithSet(hook.memoizedState, path29, value);
128791
+ var newState = copyWithSet(hook.memoizedState, path30, value);
128701
128792
  hook.memoizedState = newState;
128702
128793
  hook.baseState = newState;
128703
128794
  fiber.memoizedProps = assign2({}, fiber.memoizedProps);
@@ -128707,10 +128798,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128707
128798
  }
128708
128799
  }
128709
128800
  };
128710
- overrideHookStateDeletePath = function(fiber, id2, path29) {
128801
+ overrideHookStateDeletePath = function(fiber, id2, path30) {
128711
128802
  var hook = findHook(fiber, id2);
128712
128803
  if (hook !== null) {
128713
- var newState = copyWithDelete(hook.memoizedState, path29);
128804
+ var newState = copyWithDelete(hook.memoizedState, path30);
128714
128805
  hook.memoizedState = newState;
128715
128806
  hook.baseState = newState;
128716
128807
  fiber.memoizedProps = assign2({}, fiber.memoizedProps);
@@ -128733,8 +128824,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128733
128824
  }
128734
128825
  }
128735
128826
  };
128736
- overrideProps = function(fiber, path29, value) {
128737
- fiber.pendingProps = copyWithSet(fiber.memoizedProps, path29, value);
128827
+ overrideProps = function(fiber, path30, value) {
128828
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path30, value);
128738
128829
  if (fiber.alternate) {
128739
128830
  fiber.alternate.pendingProps = fiber.pendingProps;
128740
128831
  }
@@ -128743,8 +128834,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128743
128834
  scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
128744
128835
  }
128745
128836
  };
128746
- overridePropsDeletePath = function(fiber, path29) {
128747
- fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path29);
128837
+ overridePropsDeletePath = function(fiber, path30) {
128838
+ fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path30);
128748
128839
  if (fiber.alternate) {
128749
128840
  fiber.alternate.pendingProps = fiber.pendingProps;
128750
128841
  }
@@ -134795,7 +134886,7 @@ var parsePin = (pinString) => {
134795
134886
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
134796
134887
  const labelColor = colorMatch ? colorMatch[0] : "";
134797
134888
  const pathMatch = pinString.match(/\^\^([^~]+)/);
134798
- const path29 = pathMatch ? pathMatch[1] : "";
134889
+ const path30 = pathMatch ? pathMatch[1] : "";
134799
134890
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
134800
134891
  const arrow = arrowMatch ? arrowMatch[1] : "";
134801
134892
  const r3 = Number.parseFloat(rotation2);
@@ -134809,7 +134900,7 @@ var parsePin = (pinString) => {
134809
134900
  rotation: Number.isNaN(r3) ? 0 : r3,
134810
134901
  label,
134811
134902
  labelColor,
134812
- path: path29,
134903
+ path: path30,
134813
134904
  arrow
134814
134905
  };
134815
134906
  };
@@ -135249,15 +135340,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
135249
135340
  }
135250
135341
  }
135251
135342
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
135252
- const path29 = [];
135343
+ const path30 = [];
135253
135344
  for (let i = 0;i <= numPoints; i++) {
135254
135345
  const t3 = i / numPoints;
135255
135346
  const angle2 = startAngle + t3 * (endAngle - startAngle);
135256
135347
  const x = centerX + radius * Math.cos(angle2);
135257
135348
  const y = centerY + radius * Math.sin(angle2);
135258
- path29.push({ x, y });
135349
+ path30.push({ x, y });
135259
135350
  }
135260
- return path29;
135351
+ return path30;
135261
135352
  }
135262
135353
  var __defProp4 = Object.defineProperty;
135263
135354
  var __export22 = (target, all) => {
@@ -136675,7 +136766,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
136675
136766
  };
136676
136767
  };
136677
136768
  var silkscreenPin = ({
136678
- fs: fs30,
136769
+ fs: fs31,
136679
136770
  pn: pn2,
136680
136771
  anchor_x,
136681
136772
  anchor_y,
@@ -136718,7 +136809,7 @@ var silkscreenPin = ({
136718
136809
  type: "pcb_silkscreen_text",
136719
136810
  pcb_silkscreen_text_id: "silkscreen_text_1",
136720
136811
  font: "tscircuit2024",
136721
- font_size: fs30,
136812
+ font_size: fs31,
136722
136813
  pcb_component_id: "pcb_component_1",
136723
136814
  text: `{PIN${pn2}}`,
136724
136815
  layer,
@@ -144334,17 +144425,17 @@ var ObstacleList = class {
144334
144425
  return obstacles;
144335
144426
  }
144336
144427
  };
144337
- function removePathLoops(path29) {
144338
- if (path29.length < 4)
144339
- return path29;
144340
- const result = [{ ...path29[0] }];
144341
- let currentLayer = path29[0].layer;
144342
- for (let i = 1;i < path29.length; i++) {
144343
- const currentSegment = { start: path29[i - 1], end: path29[i] };
144344
- const isVia = path29[i].route_type === "via" || path29[i - 1].route_type === "via";
144345
- if (path29[i].layer !== currentLayer || isVia) {
144346
- result.push({ ...path29[i] });
144347
- currentLayer = path29[i].layer;
144428
+ function removePathLoops(path30) {
144429
+ if (path30.length < 4)
144430
+ return path30;
144431
+ const result = [{ ...path30[0] }];
144432
+ let currentLayer = path30[0].layer;
144433
+ for (let i = 1;i < path30.length; i++) {
144434
+ const currentSegment = { start: path30[i - 1], end: path30[i] };
144435
+ const isVia = path30[i].route_type === "via" || path30[i - 1].route_type === "via";
144436
+ if (path30[i].layer !== currentLayer || isVia) {
144437
+ result.push({ ...path30[i] });
144438
+ currentLayer = path30[i].layer;
144348
144439
  continue;
144349
144440
  }
144350
144441
  let intersectionFound = false;
@@ -144373,8 +144464,8 @@ function removePathLoops(path29) {
144373
144464
  result.push(intersectionPoint);
144374
144465
  }
144375
144466
  const lastPoint = result[result.length - 1];
144376
- if (lastPoint.x !== path29[i].x || lastPoint.y !== path29[i].y) {
144377
- result.push(path29[i]);
144467
+ if (lastPoint.x !== path30[i].x || lastPoint.y !== path30[i].y) {
144468
+ result.push(path30[i]);
144378
144469
  }
144379
144470
  }
144380
144471
  return result;
@@ -144863,10 +144954,10 @@ var GeneralizedAstarAutorouter = class {
144863
144954
  });
144864
144955
  }
144865
144956
  if (current2.parent) {
144866
- const path29 = [];
144957
+ const path30 = [];
144867
144958
  let p = current2;
144868
144959
  while (p) {
144869
- path29.unshift(p);
144960
+ path30.unshift(p);
144870
144961
  p = p.parent;
144871
144962
  }
144872
144963
  debugSolution.push({
@@ -144874,7 +144965,7 @@ var GeneralizedAstarAutorouter = class {
144874
144965
  pcb_component_id: "",
144875
144966
  pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
144876
144967
  layer: "top",
144877
- route: path29,
144968
+ route: path30,
144878
144969
  stroke_width: 0.01
144879
144970
  });
144880
144971
  }
@@ -149796,13 +149887,13 @@ var RBush = class {
149796
149887
  return this;
149797
149888
  let node = this.data;
149798
149889
  const bbox = this.toBBox(item);
149799
- const path29 = [];
149890
+ const path30 = [];
149800
149891
  const indexes = [];
149801
149892
  let i, parent, goingUp;
149802
- while (node || path29.length) {
149893
+ while (node || path30.length) {
149803
149894
  if (!node) {
149804
- node = path29.pop();
149805
- parent = path29[path29.length - 1];
149895
+ node = path30.pop();
149896
+ parent = path30[path30.length - 1];
149806
149897
  i = indexes.pop();
149807
149898
  goingUp = true;
149808
149899
  }
@@ -149810,13 +149901,13 @@ var RBush = class {
149810
149901
  const index = findItem(item, node.children, equalsFn);
149811
149902
  if (index !== -1) {
149812
149903
  node.children.splice(index, 1);
149813
- path29.push(node);
149814
- this._condense(path29);
149904
+ path30.push(node);
149905
+ this._condense(path30);
149815
149906
  return this;
149816
149907
  }
149817
149908
  }
149818
149909
  if (!goingUp && !node.leaf && contains(node, bbox)) {
149819
- path29.push(node);
149910
+ path30.push(node);
149820
149911
  indexes.push(i);
149821
149912
  i = 0;
149822
149913
  parent = node;
@@ -149887,10 +149978,10 @@ var RBush = class {
149887
149978
  calcBBox(node, this.toBBox);
149888
149979
  return node;
149889
149980
  }
149890
- _chooseSubtree(bbox, node, level, path29) {
149981
+ _chooseSubtree(bbox, node, level, path30) {
149891
149982
  while (true) {
149892
- path29.push(node);
149893
- if (node.leaf || path29.length - 1 === level)
149983
+ path30.push(node);
149984
+ if (node.leaf || path30.length - 1 === level)
149894
149985
  break;
149895
149986
  let minArea = Infinity;
149896
149987
  let minEnlargement = Infinity;
@@ -149999,21 +150090,21 @@ var RBush = class {
149999
150090
  }
150000
150091
  return margin;
150001
150092
  }
150002
- _adjustParentBBoxes(bbox, path29, level) {
150093
+ _adjustParentBBoxes(bbox, path30, level) {
150003
150094
  for (let i = level;i >= 0; i--) {
150004
- extend(path29[i], bbox);
150095
+ extend(path30[i], bbox);
150005
150096
  }
150006
150097
  }
150007
- _condense(path29) {
150008
- for (let i = path29.length - 1, siblings;i >= 0; i--) {
150009
- if (path29[i].children.length === 0) {
150098
+ _condense(path30) {
150099
+ for (let i = path30.length - 1, siblings;i >= 0; i--) {
150100
+ if (path30[i].children.length === 0) {
150010
150101
  if (i > 0) {
150011
- siblings = path29[i - 1].children;
150012
- siblings.splice(siblings.indexOf(path29[i]), 1);
150102
+ siblings = path30[i - 1].children;
150103
+ siblings.splice(siblings.indexOf(path30[i]), 1);
150013
150104
  } else
150014
150105
  this.clear();
150015
150106
  } else
150016
- calcBBox(path29[i], this.toBBox);
150107
+ calcBBox(path30[i], this.toBBox);
150017
150108
  }
150018
150109
  }
150019
150110
  };
@@ -151158,7 +151249,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
151158
151249
  this.capacityPaths = capacityPaths;
151159
151250
  this.colorMap = colorMap ?? {};
151160
151251
  this.unprocessedNodeIds = [
151161
- ...new Set(capacityPaths.flatMap((path29) => path29.nodeIds))
151252
+ ...new Set(capacityPaths.flatMap((path30) => path30.nodeIds))
151162
151253
  ];
151163
151254
  this.nodePortSegments = /* @__PURE__ */ new Map;
151164
151255
  }
@@ -151169,17 +151260,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
151169
151260
  return;
151170
151261
  }
151171
151262
  const pathsGoingThroughNode = [];
151172
- for (const path29 of this.capacityPaths) {
151173
- const indexOfNodeInPath = path29.nodeIds.indexOf(nodeId);
151263
+ for (const path30 of this.capacityPaths) {
151264
+ const indexOfNodeInPath = path30.nodeIds.indexOf(nodeId);
151174
151265
  if (indexOfNodeInPath !== -1) {
151175
- pathsGoingThroughNode.push({ path: path29, indexOfNodeInPath });
151266
+ pathsGoingThroughNode.push({ path: path30, indexOfNodeInPath });
151176
151267
  }
151177
151268
  }
151178
151269
  const node = this.nodeMap.get(nodeId);
151179
151270
  const nodePortSegments = [];
151180
- for (const { path: path29, indexOfNodeInPath } of pathsGoingThroughNode) {
151181
- const entryNodeId = path29.nodeIds[indexOfNodeInPath - 1];
151182
- const exitNodeId = path29.nodeIds[indexOfNodeInPath + 1];
151271
+ for (const { path: path30, indexOfNodeInPath } of pathsGoingThroughNode) {
151272
+ const entryNodeId = path30.nodeIds[indexOfNodeInPath - 1];
151273
+ const exitNodeId = path30.nodeIds[indexOfNodeInPath + 1];
151183
151274
  for (const adjNodeId of [entryNodeId, exitNodeId]) {
151184
151275
  const adjNode = this.nodeMap.get(adjNodeId);
151185
151276
  if (!adjNode)
@@ -151192,7 +151283,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
151192
151283
  capacityMeshNodeId: nodeId,
151193
151284
  start: segment2.start,
151194
151285
  end: segment2.end,
151195
- connectionNames: [path29.connectionName],
151286
+ connectionNames: [path30.connectionName],
151196
151287
  availableZ: mutuallyAvailableZ
151197
151288
  };
151198
151289
  nodePortSegments.push(portSegment);
@@ -151998,37 +152089,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
151998
152089
  return neighbors;
151999
152090
  }
152000
152091
  getNodePath(node) {
152001
- const path29 = [];
152092
+ const path30 = [];
152002
152093
  while (node) {
152003
- path29.push(node);
152094
+ path30.push(node);
152004
152095
  node = node.parent;
152005
152096
  }
152006
- return path29;
152097
+ return path30;
152007
152098
  }
152008
152099
  getViasInNodePath(node) {
152009
- const path29 = this.getNodePath(node);
152100
+ const path30 = this.getNodePath(node);
152010
152101
  const vias = [];
152011
- for (let i = 0;i < path29.length - 1; i++) {
152012
- if (path29[i].z !== path29[i + 1].z) {
152013
- vias.push({ x: path29[i].x, y: path29[i].y });
152102
+ for (let i = 0;i < path30.length - 1; i++) {
152103
+ if (path30[i].z !== path30[i + 1].z) {
152104
+ vias.push({ x: path30[i].x, y: path30[i].y });
152014
152105
  }
152015
152106
  }
152016
152107
  return vias;
152017
152108
  }
152018
152109
  setSolvedPath(node) {
152019
- const path29 = this.getNodePath(node);
152020
- path29.reverse();
152110
+ const path30 = this.getNodePath(node);
152111
+ path30.reverse();
152021
152112
  const vias = [];
152022
- for (let i = 0;i < path29.length - 1; i++) {
152023
- if (path29[i].z !== path29[i + 1].z) {
152024
- vias.push({ x: path29[i].x, y: path29[i].y });
152113
+ for (let i = 0;i < path30.length - 1; i++) {
152114
+ if (path30[i].z !== path30[i + 1].z) {
152115
+ vias.push({ x: path30[i].x, y: path30[i].y });
152025
152116
  }
152026
152117
  }
152027
152118
  this.solvedPath = {
152028
152119
  connectionName: this.connectionName,
152029
152120
  traceThickness: this.traceThickness,
152030
152121
  viaDiameter: this.viaDiameter,
152031
- route: path29.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
152122
+ route: path30.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
152032
152123
  vias
152033
152124
  };
152034
152125
  }
@@ -152767,14 +152858,14 @@ function computeDumbbellPaths({
152767
152858
  const u3 = (dx2 * d1y - dy2 * d1x) / det;
152768
152859
  return t3 > 0 && t3 < 1 && u3 > 0 && u3 < 1;
152769
152860
  };
152770
- const doPathsIntersect = (path1, path29) => {
152861
+ const doPathsIntersect = (path1, path210) => {
152771
152862
  const segments1 = [];
152772
152863
  for (let i = 0;i < path1.length - 1; i++) {
152773
152864
  segments1.push({ start: path1[i], end: path1[i + 1] });
152774
152865
  }
152775
152866
  const segments2 = [];
152776
- for (let i = 0;i < path29.length - 1; i++) {
152777
- segments2.push({ start: path29[i], end: path29[i + 1] });
152867
+ for (let i = 0;i < path210.length - 1; i++) {
152868
+ segments2.push({ start: path210[i], end: path210[i + 1] });
152778
152869
  }
152779
152870
  for (const seg1 of segments1) {
152780
152871
  for (const seg2 of segments2) {
@@ -152836,12 +152927,12 @@ function computeDumbbellPaths({
152836
152927
  specialType: circleCenter === A3 ? "A" : "B"
152837
152928
  };
152838
152929
  };
152839
- const subdivideOptimalPath = (path29, numSubdivisions) => {
152840
- if (path29.length < 2)
152841
- return path29;
152842
- const result = [path29[0]];
152843
- for (let i = 0;i < path29.length - 1; i++) {
152844
- const segment2 = { start: path29[i], end: path29[i + 1] };
152930
+ const subdivideOptimalPath = (path30, numSubdivisions) => {
152931
+ if (path30.length < 2)
152932
+ return path30;
152933
+ const result = [path30[0]];
152934
+ for (let i = 0;i < path30.length - 1; i++) {
152935
+ const segment2 = { start: path30[i], end: path30[i + 1] };
152845
152936
  const segmentMidpoint = {
152846
152937
  x: (segment2.start.x + segment2.end.x) / 2,
152847
152938
  y: (segment2.start.y + segment2.end.y) / 2
@@ -152903,7 +152994,7 @@ function computeDumbbellPaths({
152903
152994
  }
152904
152995
  subdivisionPoints.forEach((p) => result.push(p));
152905
152996
  }
152906
- result.push(path29[i + 1]);
152997
+ result.push(path30[i + 1]);
152907
152998
  }
152908
152999
  if (result.length > 1) {
152909
153000
  const filteredResult = [result[0]];
@@ -153138,13 +153229,13 @@ function computeDumbbellPaths({
153138
153229
  ].map((l, index) => ({ ...l, index }));
153139
153230
  };
153140
153231
  const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
153141
- const path29 = jLine.points;
153142
- if (path29.length < 2)
153143
- return path29;
153232
+ const path30 = jLine.points;
153233
+ if (path30.length < 2)
153234
+ return path30;
153144
153235
  const minDistThreshold = r3 + m2;
153145
- const result = [path29[0]];
153146
- for (let i = 0;i < path29.length - 1; i++) {
153147
- const segment2 = { start: path29[i], end: path29[i + 1] };
153236
+ const result = [path30[0]];
153237
+ for (let i = 0;i < path30.length - 1; i++) {
153238
+ const segment2 = { start: path30[i], end: path30[i + 1] };
153148
153239
  const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
153149
153240
  if (distToOpposite < minDistThreshold) {
153150
153241
  const closestPt = closestPointOnSegment(segment2, oppositePoint);
@@ -153213,26 +153304,26 @@ function computeDumbbellPaths({
153213
153304
  return { index: 0, path: [] };
153214
153305
  }
153215
153306
  const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
153216
- const path29 = [...optimalPath2.path];
153217
- const firstPoint = path29[0];
153218
- const dist3 = distance3(firstPoint, path29[2]);
153219
- const dist4 = distance3(firstPoint, path29[3]);
153307
+ const path30 = [...optimalPath2.path];
153308
+ const firstPoint = path30[0];
153309
+ const dist3 = distance3(firstPoint, path30[2]);
153310
+ const dist4 = distance3(firstPoint, path30[3]);
153220
153311
  const closerIdx = dist3 < dist4 ? 2 : 3;
153221
- if (dist3 < distance3(firstPoint, path29[1]) || dist4 < distance3(firstPoint, path29[1])) {
153222
- path29.splice(1, closerIdx - 1);
153312
+ if (dist3 < distance3(firstPoint, path30[1]) || dist4 < distance3(firstPoint, path30[1])) {
153313
+ path30.splice(1, closerIdx - 1);
153223
153314
  }
153224
- const lastPoint = path29[path29.length - 1];
153225
- const distM3 = distance3(lastPoint, path29[path29.length - 3]);
153226
- const distM4 = distance3(lastPoint, path29[path29.length - 4]);
153227
- const closerLastIdx = distM3 < distM4 ? path29.length - 3 : path29.length - 4;
153228
- if (distM3 < distance3(lastPoint, path29[path29.length - 2]) || distM4 < distance3(lastPoint, path29[path29.length - 2])) {
153229
- path29.splice(closerLastIdx + 1, path29.length - closerLastIdx - 2);
153315
+ const lastPoint = path30[path30.length - 1];
153316
+ const distM3 = distance3(lastPoint, path30[path30.length - 3]);
153317
+ const distM4 = distance3(lastPoint, path30[path30.length - 4]);
153318
+ const closerLastIdx = distM3 < distM4 ? path30.length - 3 : path30.length - 4;
153319
+ if (distM3 < distance3(lastPoint, path30[path30.length - 2]) || distM4 < distance3(lastPoint, path30[path30.length - 2])) {
153320
+ path30.splice(closerLastIdx + 1, path30.length - closerLastIdx - 2);
153230
153321
  }
153231
153322
  return {
153232
153323
  index: optimalPath2.index,
153233
- path: path29,
153234
- startsAt: path29[0] === C2 ? "C" : "D",
153235
- goesTo: path29[path29.length - 1] === C2 ? "C" : "D"
153324
+ path: path30,
153325
+ startsAt: path30[0] === C2 ? "C" : "D",
153326
+ goesTo: path30[path30.length - 1] === C2 ? "C" : "D"
153236
153327
  };
153237
153328
  };
153238
153329
  const optimalPath = findOptimalPath();
@@ -154652,9 +154743,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
154652
154743
  let closestIntersection = null;
154653
154744
  let intersectedSegmentZ = null;
154654
154745
  const checkIntersectionsWithPathMap = (pathMap) => {
154655
- for (const path29 of pathMap.values()) {
154656
- for (let i = 0;i < path29.length - 1; i++) {
154657
- const segment2 = [path29[i], path29[i + 1]];
154746
+ for (const path30 of pathMap.values()) {
154747
+ for (let i = 0;i < path30.length - 1; i++) {
154748
+ const segment2 = [path30[i], path30[i + 1]];
154658
154749
  if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
154659
154750
  continue;
154660
154751
  }
@@ -154784,11 +154875,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
154784
154875
  });
154785
154876
  }
154786
154877
  const drawPath = (pathMap, labelPrefix) => {
154787
- for (const [connectionName, path29] of pathMap.entries()) {
154878
+ for (const [connectionName, path30] of pathMap.entries()) {
154788
154879
  const color = colorMap[connectionName] ?? "black";
154789
- for (let i = 0;i < path29.length - 1; i++) {
154790
- const p12 = path29[i];
154791
- const p2 = path29[i + 1];
154880
+ for (let i = 0;i < path30.length - 1; i++) {
154881
+ const p12 = path30[i];
154882
+ const p2 = path30[i + 1];
154792
154883
  if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
154793
154884
  graphics.circles.push({
154794
154885
  center: { x: p12.x, y: p12.y },
@@ -155386,10 +155477,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
155386
155477
  const allSegments = [];
155387
155478
  const viaPoints = /* @__PURE__ */ new Map;
155388
155479
  for (const polyLine of polyLines) {
155389
- const path29 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
155390
- for (let i = 0;i < path29.length - 1; i++) {
155391
- const p12 = path29[i];
155392
- const p2 = path29[i + 1];
155480
+ const path30 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
155481
+ for (let i = 0;i < path30.length - 1; i++) {
155482
+ const p12 = path30[i];
155483
+ const p2 = path30[i + 1];
155393
155484
  const layer = p12.z2;
155394
155485
  allSegments.push({
155395
155486
  start: { x: p12.x, y: p12.y },
@@ -155407,7 +155498,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
155407
155498
  }
155408
155499
  }
155409
155500
  }
155410
- const lastPoint = path29[path29.length - 1];
155501
+ const lastPoint = path30[path30.length - 1];
155411
155502
  if (lastPoint.z1 !== lastPoint.z2) {
155412
155503
  const key = pointKey2(lastPoint);
155413
155504
  if (!viaPoints.has(key)) {
@@ -155706,14 +155797,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
155706
155797
  const polyLineVias = [];
155707
155798
  for (let i = 0;i < polyLines.length; i++) {
155708
155799
  const polyLine = polyLines[i];
155709
- const path29 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
155800
+ const path30 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
155710
155801
  const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
155711
- for (let i22 = 0;i22 < path29.length - 1; i22++) {
155712
- const segment2 = [path29[i22], path29[i22 + 1]];
155802
+ for (let i22 = 0;i22 < path30.length - 1; i22++) {
155803
+ const segment2 = [path30[i22], path30[i22 + 1]];
155713
155804
  segmentsByLayer.get(segment2[0].z2).push(segment2);
155714
155805
  }
155715
155806
  polyLineSegmentsByLayer.push(segmentsByLayer);
155716
- polyLineVias.push(path29.filter((p) => p.z1 !== p.z2));
155807
+ polyLineVias.push(path30.filter((p) => p.z1 !== p.z2));
155717
155808
  }
155718
155809
  for (let i = 0;i < polyLines.length; i++) {
155719
155810
  const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
@@ -157142,7 +157233,7 @@ var HighDensitySolver = class extends BaseSolver {
157142
157233
  if (this.failedSolvers.length > 0) {
157143
157234
  this.solved = false;
157144
157235
  this.failed = true;
157145
- this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs30) => fs30.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
157236
+ this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs31) => fs31.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
157146
157237
  return;
157147
157238
  }
157148
157239
  this.solved = true;
@@ -159923,13 +160014,13 @@ var CapacityPathingSolver = class extends BaseSolver {
159923
160014
  return this.getDistanceBetweenNodes(node, endGoal);
159924
160015
  }
159925
160016
  getBacktrackedPath(candidate) {
159926
- const path29 = [];
160017
+ const path30 = [];
159927
160018
  let currentCandidate = candidate;
159928
160019
  while (currentCandidate) {
159929
- path29.push(currentCandidate.node);
160020
+ path30.push(currentCandidate.node);
159930
160021
  currentCandidate = currentCandidate.prevCandidate;
159931
160022
  }
159932
- return path29;
160023
+ return path30;
159933
160024
  }
159934
160025
  getNeighboringNodes(node) {
159935
160026
  return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
@@ -159937,12 +160028,12 @@ var CapacityPathingSolver = class extends BaseSolver {
159937
160028
  getCapacityPaths() {
159938
160029
  const capacityPaths = [];
159939
160030
  for (const connection of this.connectionsWithNodes) {
159940
- const path29 = connection.path;
159941
- if (path29) {
160031
+ const path30 = connection.path;
160032
+ if (path30) {
159942
160033
  capacityPaths.push({
159943
160034
  capacityPathId: connection.connection.name,
159944
160035
  connectionName: connection.connection.name,
159945
- nodeIds: path29.map((node) => node.capacityMeshNodeId)
160036
+ nodeIds: path30.map((node) => node.capacityMeshNodeId)
159946
160037
  });
159947
160038
  }
159948
160039
  }
@@ -160627,10 +160718,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160627
160718
  return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
160628
160719
  }
160629
160720
  getBacktrackedPath(candidate) {
160630
- const path29 = [];
160721
+ const path30 = [];
160631
160722
  let currentCandidate = candidate;
160632
160723
  while (currentCandidate) {
160633
- path29.push(currentCandidate.node);
160724
+ path30.push(currentCandidate.node);
160634
160725
  if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
160635
160726
  currentCandidate = currentCandidate.prevCandidate;
160636
160727
  } else {
@@ -160638,7 +160729,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160638
160729
  break;
160639
160730
  }
160640
160731
  }
160641
- return path29.reverse();
160732
+ return path30.reverse();
160642
160733
  }
160643
160734
  getNeighboringNodes(node) {
160644
160735
  if (!this.nodeMap.has(node.capacityMeshNodeId))
@@ -160653,8 +160744,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160653
160744
  doesNodeHaveCapacityForTrace(node, prevNode) {
160654
160745
  return true;
160655
160746
  }
160656
- reduceCapacityAlongPath(path29) {
160657
- for (const pathNode of path29) {
160747
+ reduceCapacityAlongPath(path30) {
160748
+ for (const pathNode of path30) {
160658
160749
  if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
160659
160750
  const nodeId = pathNode.capacityMeshNodeId;
160660
160751
  const nodeInSection = this.nodeMap.get(nodeId);
@@ -160783,9 +160874,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160783
160874
  this.queuedNodes = null;
160784
160875
  }
160785
160876
  _handleGoalReached(currentCandidate, currentTerminal, endNode) {
160786
- const path29 = this.getBacktrackedPath(currentCandidate);
160787
- currentTerminal.path = path29;
160788
- this.reduceCapacityAlongPath(path29);
160877
+ const path30 = this.getBacktrackedPath(currentCandidate);
160878
+ currentTerminal.path = path30;
160879
+ this.reduceCapacityAlongPath(path30);
160789
160880
  this.currentConnectionIndex++;
160790
160881
  this.candidates = null;
160791
160882
  this.visitedNodes = null;
@@ -160834,10 +160925,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160834
160925
  const connectionColor = this.colorMap[connectionName] ?? "purple";
160835
160926
  topCandidates.forEach((candidate, index) => {
160836
160927
  const opacity = 0.8 * (1 - index / 5);
160837
- const path29 = this.getBacktrackedPath(candidate);
160838
- if (path29.length > 0) {
160928
+ const path30 = this.getBacktrackedPath(candidate);
160929
+ if (path30.length > 0) {
160839
160930
  baseGraphics.lines.push({
160840
- points: path29.map(({ center: { x, y } }) => ({ x, y })),
160931
+ points: path30.map(({ center: { x, y } }) => ({ x, y })),
160841
160932
  strokeColor: safeTransparentize(connectionColor, 1 - opacity),
160842
160933
  strokeWidth: 0.05
160843
160934
  });
@@ -161526,12 +161617,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
161526
161617
  getCapacityPaths() {
161527
161618
  const capacityPaths = [];
161528
161619
  for (const connection of this.connectionsWithNodes) {
161529
- const path29 = connection.path;
161530
- if (path29) {
161620
+ const path30 = connection.path;
161621
+ if (path30) {
161531
161622
  capacityPaths.push({
161532
161623
  capacityPathId: connection.connection.name,
161533
161624
  connectionName: connection.connection.name,
161534
- nodeIds: path29.map((node) => node.capacityMeshNodeId)
161625
+ nodeIds: path30.map((node) => node.capacityMeshNodeId)
161535
161626
  });
161536
161627
  }
161537
161628
  }
@@ -162552,22 +162643,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
162552
162643
  return null;
162553
162644
  }
162554
162645
  const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
162555
- for (const path29 of possiblePaths) {
162556
- const fullPath = path29.map((p) => ({ x: p.x, y: p.y, z: start.z }));
162646
+ for (const path30 of possiblePaths) {
162647
+ const fullPath = path30.map((p) => ({ x: p.x, y: p.y, z: start.z }));
162557
162648
  if (this.isValidPath(fullPath)) {
162558
162649
  return fullPath;
162559
162650
  }
162560
162651
  }
162561
162652
  return null;
162562
162653
  }
162563
- addPathToResult(path29) {
162564
- if (path29.length === 0)
162654
+ addPathToResult(path30) {
162655
+ if (path30.length === 0)
162565
162656
  return;
162566
- for (let i = 0;i < path29.length; i++) {
162567
- if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path29[i])) {
162657
+ for (let i = 0;i < path30.length; i++) {
162658
+ if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path30[i])) {
162568
162659
  continue;
162569
162660
  }
162570
- this.newRoute.push(path29[i]);
162661
+ this.newRoute.push(path30[i]);
162571
162662
  }
162572
162663
  this.currentStepSize = this.maxStepSize;
162573
162664
  }
@@ -189974,7 +190065,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
189974
190065
  for (let i = 0;i < portsWithPosition.length - 1; i++) {
189975
190066
  const start = portsWithPosition[i];
189976
190067
  const end = portsWithPosition[i + 1];
189977
- const path29 = calculateElbow({
190068
+ const path30 = calculateElbow({
189978
190069
  x: start.position.x,
189979
190070
  y: start.position.y,
189980
190071
  facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
@@ -189983,8 +190074,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
189983
190074
  y: end.position.y,
189984
190075
  facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
189985
190076
  });
189986
- for (let j4 = 0;j4 < path29.length - 1; j4++) {
189987
- elbowEdges.push({ from: path29[j4], to: path29[j4 + 1] });
190077
+ for (let j4 = 0;j4 < path30.length - 1; j4++) {
190078
+ elbowEdges.push({ from: path30[j4], to: path30[j4 + 1] });
189988
190079
  }
189989
190080
  }
189990
190081
  const doesSegmentIntersectRect = (edge, rect) => {
@@ -196172,8 +196263,8 @@ react/cjs/react-jsx-runtime.development.js:
196172
196263
  */
196173
196264
 
196174
196265
  // lib/import/import-component-from-jlcpcb.ts
196175
- import fs30 from "node:fs/promises";
196176
- import path29 from "node:path";
196266
+ import fs31 from "node:fs/promises";
196267
+ import path30 from "node:path";
196177
196268
  var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
196178
196269
  const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
196179
196270
  const tsx = await convertRawEasyToTsx(component);
@@ -196181,10 +196272,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
196181
196272
  if (!fileName) {
196182
196273
  throw new Error("Could not determine file name of converted component");
196183
196274
  }
196184
- const importsDir = path29.join(projectDir, "imports");
196185
- await fs30.mkdir(importsDir, { recursive: true });
196186
- const filePath = path29.join(importsDir, `${fileName}.tsx`);
196187
- await fs30.writeFile(filePath, tsx);
196275
+ const importsDir = path30.join(projectDir, "imports");
196276
+ await fs31.mkdir(importsDir, { recursive: true });
196277
+ const filePath = path30.join(importsDir, `${fileName}.tsx`);
196278
+ await fs31.writeFile(filePath, tsx);
196188
196279
  return { filePath };
196189
196280
  };
196190
196281
 
@@ -196286,12 +196377,12 @@ var registerRemove = (program3) => {
196286
196377
  };
196287
196378
 
196288
196379
  // cli/build/register.ts
196289
- import path38 from "node:path";
196290
- import fs39 from "node:fs";
196380
+ import path39 from "node:path";
196381
+ import fs40 from "node:fs";
196291
196382
 
196292
196383
  // cli/build/build-file.ts
196293
- import path30 from "node:path";
196294
- import fs31 from "node:fs";
196384
+ import path31 from "node:path";
196385
+ import fs32 from "node:fs";
196295
196386
 
196296
196387
  // lib/shared/circuit-json-diagnostics.ts
196297
196388
  function analyzeCircuitJson(circuitJson) {
@@ -196323,9 +196414,9 @@ var buildFile = async (input, output, projectDir, options) => {
196323
196414
  filePath: input,
196324
196415
  platformConfig: options?.platformConfig
196325
196416
  });
196326
- fs31.mkdirSync(path30.dirname(output), { recursive: true });
196327
- fs31.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
196328
- console.log(`Circuit JSON written to ${path30.relative(projectDir, output)}`);
196417
+ fs32.mkdirSync(path31.dirname(output), { recursive: true });
196418
+ fs32.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
196419
+ console.log(`Circuit JSON written to ${path31.relative(projectDir, output)}`);
196329
196420
  const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
196330
196421
  if (!options?.ignoreWarnings) {
196331
196422
  for (const warn of warnings) {
@@ -196363,7 +196454,7 @@ var logTypeReexportHint = (error, entryFilePath) => {
196363
196454
  if (!match)
196364
196455
  return;
196365
196456
  const [, exportName, fromSpecifier] = match;
196366
- const entryFileName = path30.basename(entryFilePath);
196457
+ const entryFileName = path31.basename(entryFilePath);
196367
196458
  console.error([
196368
196459
  "",
196369
196460
  `It looks like "${entryFileName}" re-exports the type-only symbol "${exportName}" from "${fromSpecifier}" without the "type" modifier.`,
@@ -196376,20 +196467,20 @@ var logTypeReexportHint = (error, entryFilePath) => {
196376
196467
  };
196377
196468
 
196378
196469
  // cli/build/get-build-entrypoints.ts
196379
- import fs32 from "node:fs";
196380
- import path31 from "node:path";
196470
+ import fs33 from "node:fs";
196471
+ import path32 from "node:path";
196381
196472
  var isSubPath2 = (maybeChild, maybeParent) => {
196382
- const relative9 = path31.relative(maybeParent, maybeChild);
196383
- return relative9 === "" || !relative9.startsWith("..") && !path31.isAbsolute(relative9);
196473
+ const relative9 = path32.relative(maybeParent, maybeChild);
196474
+ return relative9 === "" || !relative9.startsWith("..") && !path32.isAbsolute(relative9);
196384
196475
  };
196385
196476
  var findProjectRoot = (startDir) => {
196386
196477
  let currentDir = startDir;
196387
- while (currentDir !== path31.dirname(currentDir)) {
196388
- const packageJsonPath = path31.join(currentDir, "package.json");
196389
- if (fs32.existsSync(packageJsonPath)) {
196478
+ while (currentDir !== path32.dirname(currentDir)) {
196479
+ const packageJsonPath = path32.join(currentDir, "package.json");
196480
+ if (fs33.existsSync(packageJsonPath)) {
196390
196481
  return currentDir;
196391
196482
  }
196392
- currentDir = path31.dirname(currentDir);
196483
+ currentDir = path32.dirname(currentDir);
196393
196484
  }
196394
196485
  return startDir;
196395
196486
  };
@@ -196397,7 +196488,7 @@ async function getBuildEntrypoints({
196397
196488
  fileOrDir,
196398
196489
  rootDir = process.cwd()
196399
196490
  }) {
196400
- const resolvedRoot = path31.resolve(rootDir);
196491
+ const resolvedRoot = path32.resolve(rootDir);
196401
196492
  const includeBoardFiles = getBoardFilePatterns(resolvedRoot);
196402
196493
  const buildFromProjectDir = async () => {
196403
196494
  const files = findBoardFiles({ projectDir: resolvedRoot });
@@ -196429,8 +196520,8 @@ async function getBuildEntrypoints({
196429
196520
  };
196430
196521
  };
196431
196522
  if (fileOrDir) {
196432
- const resolved = path31.resolve(resolvedRoot, fileOrDir);
196433
- if (fs32.existsSync(resolved) && fs32.statSync(resolved).isDirectory()) {
196523
+ const resolved = path32.resolve(resolvedRoot, fileOrDir);
196524
+ if (fs33.existsSync(resolved) && fs33.statSync(resolved).isDirectory()) {
196434
196525
  const circuitFiles = findBoardFiles({
196435
196526
  projectDir: resolvedRoot,
196436
196527
  filePaths: [resolved]
@@ -196443,7 +196534,7 @@ async function getBuildEntrypoints({
196443
196534
  circuitFiles
196444
196535
  };
196445
196536
  }
196446
- const fileDir = path31.dirname(resolved);
196537
+ const fileDir = path32.dirname(resolved);
196447
196538
  const projectDir = findProjectRoot(fileDir);
196448
196539
  return { projectDir, circuitFiles: [resolved] };
196449
196540
  }
@@ -196479,8 +196570,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
196479
196570
  };
196480
196571
 
196481
196572
  // cli/build/build-preview-images.ts
196482
- import fs33 from "node:fs";
196483
- import path32 from "node:path";
196573
+ import fs34 from "node:fs";
196574
+ import path33 from "node:path";
196484
196575
  import {
196485
196576
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
196486
196577
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
@@ -196525,10 +196616,10 @@ var generatePreviewAssets = async ({
196525
196616
  outputDir,
196526
196617
  distDir
196527
196618
  }) => {
196528
- const prefixRelative = path32.relative(distDir, outputDir) || ".";
196619
+ const prefixRelative = path33.relative(distDir, outputDir) || ".";
196529
196620
  const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
196530
196621
  try {
196531
- const circuitJsonRaw = fs33.readFileSync(build.outputPath, "utf-8");
196622
+ const circuitJsonRaw = fs34.readFileSync(build.outputPath, "utf-8");
196532
196623
  const circuitJson = JSON.parse(circuitJsonRaw);
196533
196624
  console.log(`${prefix}Generating PCB SVG...`);
196534
196625
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
@@ -196544,12 +196635,12 @@ var generatePreviewAssets = async ({
196544
196635
  camPos: [10, 10, 10],
196545
196636
  lookAt: [0, 0, 0]
196546
196637
  });
196547
- fs33.mkdirSync(outputDir, { recursive: true });
196548
- fs33.writeFileSync(path32.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
196638
+ fs34.mkdirSync(outputDir, { recursive: true });
196639
+ fs34.writeFileSync(path33.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
196549
196640
  console.log(`${prefix}Written pcb.svg`);
196550
- fs33.writeFileSync(path32.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
196641
+ fs34.writeFileSync(path33.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
196551
196642
  console.log(`${prefix}Written schematic.svg`);
196552
- fs33.writeFileSync(path32.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
196643
+ fs34.writeFileSync(path33.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
196553
196644
  console.log(`${prefix}Written 3d.png`);
196554
196645
  } catch (error) {
196555
196646
  console.error(`${prefix}Failed to generate preview images:`, error);
@@ -196562,14 +196653,14 @@ var buildPreviewImages = async ({
196562
196653
  allImages
196563
196654
  }) => {
196564
196655
  const successfulBuilds = builtFiles.filter((file) => file.ok);
196565
- const normalizedMainEntrypoint = mainEntrypoint ? path32.resolve(mainEntrypoint) : undefined;
196656
+ const normalizedMainEntrypoint = mainEntrypoint ? path33.resolve(mainEntrypoint) : undefined;
196566
196657
  if (allImages) {
196567
196658
  if (successfulBuilds.length === 0) {
196568
196659
  console.warn("No successful build output available for preview image generation.");
196569
196660
  return;
196570
196661
  }
196571
196662
  for (const build of successfulBuilds) {
196572
- const outputDir = path32.dirname(build.outputPath);
196663
+ const outputDir = path33.dirname(build.outputPath);
196573
196664
  await generatePreviewAssets({
196574
196665
  build,
196575
196666
  outputDir,
@@ -196580,7 +196671,7 @@ var buildPreviewImages = async ({
196580
196671
  }
196581
196672
  const previewBuild = (() => {
196582
196673
  if (normalizedMainEntrypoint) {
196583
- const match = successfulBuilds.find((built) => path32.resolve(built.sourcePath) === normalizedMainEntrypoint);
196674
+ const match = successfulBuilds.find((built) => path33.resolve(built.sourcePath) === normalizedMainEntrypoint);
196584
196675
  if (match)
196585
196676
  return match;
196586
196677
  }
@@ -196598,8 +196689,8 @@ var buildPreviewImages = async ({
196598
196689
  };
196599
196690
 
196600
196691
  // cli/build/generate-kicad-project.ts
196601
- import fs34 from "node:fs";
196602
- import path33 from "node:path";
196692
+ import fs35 from "node:fs";
196693
+ import path34 from "node:path";
196603
196694
  var createKicadProContent = ({
196604
196695
  projectName,
196605
196696
  schematicFileName,
@@ -196639,10 +196730,10 @@ var generateKicadProject = async ({
196639
196730
  boardFileName
196640
196731
  });
196641
196732
  if (writeFiles) {
196642
- fs34.mkdirSync(outputDir, { recursive: true });
196643
- fs34.writeFileSync(path33.join(outputDir, schematicFileName), schContent);
196644
- fs34.writeFileSync(path33.join(outputDir, boardFileName), pcbContent);
196645
- fs34.writeFileSync(path33.join(outputDir, projectFileName), proContent);
196733
+ fs35.mkdirSync(outputDir, { recursive: true });
196734
+ fs35.writeFileSync(path34.join(outputDir, schematicFileName), schContent);
196735
+ fs35.writeFileSync(path34.join(outputDir, boardFileName), pcbContent);
196736
+ fs35.writeFileSync(path34.join(outputDir, projectFileName), proContent);
196646
196737
  }
196647
196738
  return {
196648
196739
  pcbContent,
@@ -196654,8 +196745,8 @@ var generateKicadProject = async ({
196654
196745
  };
196655
196746
 
196656
196747
  // cli/build/generate-kicad-footprint-library.ts
196657
- import fs35 from "node:fs";
196658
- import path34 from "node:path";
196748
+ import fs36 from "node:fs";
196749
+ import path35 from "node:path";
196659
196750
  var sanitizeLibraryAndFootprintName = (libraryLink) => {
196660
196751
  if (!libraryLink) {
196661
196752
  return {
@@ -196714,8 +196805,8 @@ var generateKicadFootprintLibrary = async ({
196714
196805
  projects,
196715
196806
  distDir
196716
196807
  }) => {
196717
- const libraryRoot = path34.join(distDir, "kicad-footprints");
196718
- fs35.mkdirSync(libraryRoot, { recursive: true });
196808
+ const libraryRoot = path35.join(distDir, "kicad-footprints");
196809
+ fs36.mkdirSync(libraryRoot, { recursive: true });
196719
196810
  const uniqueFootprints = new Map;
196720
196811
  for (const project of projects) {
196721
196812
  try {
@@ -196738,10 +196829,10 @@ var generateKicadFootprintLibrary = async ({
196738
196829
  const libraryNames = new Set;
196739
196830
  for (const entry of uniqueFootprints.values()) {
196740
196831
  libraryNames.add(entry.libraryName);
196741
- const libraryDir = path34.join(libraryRoot, `${entry.libraryName}.pretty`);
196742
- fs35.mkdirSync(libraryDir, { recursive: true });
196743
- const footprintPath = path34.join(libraryDir, `${entry.footprintName}.kicad_mod`);
196744
- fs35.writeFileSync(footprintPath, `${entry.content}
196832
+ const libraryDir = path35.join(libraryRoot, `${entry.libraryName}.pretty`);
196833
+ fs36.mkdirSync(libraryDir, { recursive: true });
196834
+ const footprintPath = path35.join(libraryDir, `${entry.footprintName}.kicad_mod`);
196835
+ fs36.writeFileSync(footprintPath, `${entry.content}
196745
196836
  `);
196746
196837
  }
196747
196838
  if (libraryNames.size > 0) {
@@ -196751,13 +196842,13 @@ ${libTableEntries.join(`
196751
196842
  `)}
196752
196843
  )
196753
196844
  `;
196754
- fs35.writeFileSync(path34.join(libraryRoot, "fp-lib-table"), libTableContent);
196845
+ fs36.writeFileSync(path35.join(libraryRoot, "fp-lib-table"), libTableContent);
196755
196846
  }
196756
196847
  };
196757
196848
 
196758
196849
  // cli/build/transpile/index.ts
196759
- import path36 from "node:path";
196760
- import fs37 from "node:fs";
196850
+ import path37 from "node:path";
196851
+ import fs38 from "node:fs";
196761
196852
  import { rollup } from "rollup";
196762
196853
  import typescript from "@rollup/plugin-typescript";
196763
196854
  import resolve12 from "@rollup/plugin-node-resolve";
@@ -196766,8 +196857,8 @@ import json from "@rollup/plugin-json";
196766
196857
  import dts from "rollup-plugin-dts";
196767
196858
 
196768
196859
  // cli/build/transpile/static-asset-plugin.ts
196769
- import fs36 from "node:fs";
196770
- import path35 from "node:path";
196860
+ import fs37 from "node:fs";
196861
+ import path36 from "node:path";
196771
196862
  import { createHash } from "node:crypto";
196772
196863
  var STATIC_ASSET_EXTENSIONS = new Set([
196773
196864
  ".glb",
@@ -196798,20 +196889,20 @@ var createStaticAssetPlugin = ({
196798
196889
  return {
196799
196890
  name: "tsci-static-assets",
196800
196891
  resolveId(source, importer) {
196801
- const ext = path35.extname(source).toLowerCase();
196892
+ const ext = path36.extname(source).toLowerCase();
196802
196893
  if (!STATIC_ASSET_EXTENSIONS.has(ext))
196803
196894
  return null;
196804
- if (path35.isAbsolute(source)) {
196805
- return fs36.existsSync(source) ? { id: source, external: true } : null;
196895
+ if (path36.isAbsolute(source)) {
196896
+ return fs37.existsSync(source) ? { id: source, external: true } : null;
196806
196897
  }
196807
196898
  if (importer) {
196808
- const resolvedFromImporter = path35.resolve(path35.dirname(importer), source);
196809
- if (fs36.existsSync(resolvedFromImporter)) {
196899
+ const resolvedFromImporter = path36.resolve(path36.dirname(importer), source);
196900
+ if (fs37.existsSync(resolvedFromImporter)) {
196810
196901
  return { id: resolvedFromImporter, external: true };
196811
196902
  }
196812
196903
  }
196813
- const resolvedFromProject = path35.resolve(resolvedBaseUrl, source);
196814
- if (fs36.existsSync(resolvedFromProject)) {
196904
+ const resolvedFromProject = path36.resolve(resolvedBaseUrl, source);
196905
+ if (fs37.existsSync(resolvedFromProject)) {
196815
196906
  return { id: resolvedFromProject, external: true };
196816
196907
  }
196817
196908
  for (const [pattern, targets] of Object.entries(resolvedPathMappings)) {
@@ -196821,8 +196912,8 @@ var createStaticAssetPlugin = ({
196821
196912
  const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
196822
196913
  for (const target of targets) {
196823
196914
  const targetPath = isWildcard ? target.replace("*", wildcard) : target;
196824
- const resolvedTarget = path35.resolve(resolvedBaseUrl, targetPath);
196825
- if (fs36.existsSync(resolvedTarget)) {
196915
+ const resolvedTarget = path36.resolve(resolvedBaseUrl, targetPath);
196916
+ if (fs37.existsSync(resolvedTarget)) {
196826
196917
  return { id: resolvedTarget, external: true };
196827
196918
  }
196828
196919
  }
@@ -196845,17 +196936,17 @@ var createStaticAssetPlugin = ({
196845
196936
  if (chunk.type !== "chunk")
196846
196937
  continue;
196847
196938
  for (const importedId of chunk.imports) {
196848
- const ext = path35.extname(importedId).toLowerCase();
196939
+ const ext = path36.extname(importedId).toLowerCase();
196849
196940
  if (!STATIC_ASSET_EXTENSIONS.has(ext))
196850
196941
  continue;
196851
196942
  if (!copiedAssets.has(importedId)) {
196852
- const assetDir = path35.join(outputDir, "assets");
196853
- fs36.mkdirSync(assetDir, { recursive: true });
196854
- const fileBuffer = fs36.readFileSync(importedId);
196943
+ const assetDir = path36.join(outputDir, "assets");
196944
+ fs37.mkdirSync(assetDir, { recursive: true });
196945
+ const fileBuffer = fs37.readFileSync(importedId);
196855
196946
  const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
196856
- const fileName = `${path35.basename(importedId, ext)}-${hash}${ext}`;
196857
- const outputFilePath = path35.join(assetDir, fileName);
196858
- fs36.writeFileSync(outputFilePath, fileBuffer);
196947
+ const fileName = `${path36.basename(importedId, ext)}-${hash}${ext}`;
196948
+ const outputFilePath = path36.join(assetDir, fileName);
196949
+ fs37.writeFileSync(outputFilePath, fileBuffer);
196859
196950
  copiedAssets.set(importedId, `./assets/${fileName}`);
196860
196951
  assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
196861
196952
  }
@@ -196877,17 +196968,17 @@ function escapeRegExp(string) {
196877
196968
 
196878
196969
  // cli/build/transpile/index.ts
196879
196970
  var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
196880
- if (id2.startsWith(".") || id2.startsWith("/") || path36.isAbsolute(id2)) {
196971
+ if (id2.startsWith(".") || id2.startsWith("/") || path37.isAbsolute(id2)) {
196881
196972
  return false;
196882
196973
  }
196883
196974
  let baseUrl = projectDir;
196884
196975
  let pathMappings = {};
196885
- if (tsconfigPath && fs37.existsSync(tsconfigPath)) {
196976
+ if (tsconfigPath && fs38.existsSync(tsconfigPath)) {
196886
196977
  try {
196887
- const tsconfigContent = fs37.readFileSync(tsconfigPath, "utf-8");
196978
+ const tsconfigContent = fs38.readFileSync(tsconfigPath, "utf-8");
196888
196979
  const tsconfig = JSON.parse(tsconfigContent);
196889
196980
  if (tsconfig.compilerOptions?.baseUrl) {
196890
- baseUrl = path36.resolve(path36.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
196981
+ baseUrl = path37.resolve(path37.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
196891
196982
  }
196892
196983
  if (tsconfig.compilerOptions?.paths) {
196893
196984
  pathMappings = tsconfig.compilerOptions.paths;
@@ -196901,17 +196992,17 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
196901
196992
  }
196902
196993
  }
196903
196994
  const potentialPaths = [
196904
- path36.join(baseUrl, id2),
196905
- path36.join(baseUrl, `${id2}.ts`),
196906
- path36.join(baseUrl, `${id2}.tsx`),
196907
- path36.join(baseUrl, `${id2}.js`),
196908
- path36.join(baseUrl, `${id2}.jsx`),
196909
- path36.join(baseUrl, id2, "index.ts"),
196910
- path36.join(baseUrl, id2, "index.tsx"),
196911
- path36.join(baseUrl, id2, "index.js"),
196912
- path36.join(baseUrl, id2, "index.jsx")
196995
+ path37.join(baseUrl, id2),
196996
+ path37.join(baseUrl, `${id2}.ts`),
196997
+ path37.join(baseUrl, `${id2}.tsx`),
196998
+ path37.join(baseUrl, `${id2}.js`),
196999
+ path37.join(baseUrl, `${id2}.jsx`),
197000
+ path37.join(baseUrl, id2, "index.ts"),
197001
+ path37.join(baseUrl, id2, "index.tsx"),
197002
+ path37.join(baseUrl, id2, "index.js"),
197003
+ path37.join(baseUrl, id2, "index.jsx")
196913
197004
  ];
196914
- if (potentialPaths.some((p) => fs37.existsSync(p))) {
197005
+ if (potentialPaths.some((p) => fs38.existsSync(p))) {
196915
197006
  return false;
196916
197007
  }
196917
197008
  return true;
@@ -196922,17 +197013,17 @@ var transpileFile = async ({
196922
197013
  projectDir
196923
197014
  }) => {
196924
197015
  try {
196925
- fs37.mkdirSync(outputDir, { recursive: true });
196926
- const tsconfigPath = path36.join(projectDir, "tsconfig.json");
196927
- const hasTsConfig = fs37.existsSync(tsconfigPath);
197016
+ fs38.mkdirSync(outputDir, { recursive: true });
197017
+ const tsconfigPath = path37.join(projectDir, "tsconfig.json");
197018
+ const hasTsConfig = fs38.existsSync(tsconfigPath);
196928
197019
  let tsconfigBaseUrl = projectDir;
196929
197020
  let tsconfigPathMappings;
196930
197021
  if (hasTsConfig) {
196931
197022
  try {
196932
- const tsconfigContent = fs37.readFileSync(tsconfigPath, "utf-8");
197023
+ const tsconfigContent = fs38.readFileSync(tsconfigPath, "utf-8");
196933
197024
  const tsconfig = JSON.parse(tsconfigContent);
196934
197025
  if (tsconfig.compilerOptions?.baseUrl) {
196935
- tsconfigBaseUrl = path36.resolve(path36.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
197026
+ tsconfigBaseUrl = path37.resolve(path37.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
196936
197027
  }
196937
197028
  if (tsconfig.compilerOptions?.paths) {
196938
197029
  tsconfigPathMappings = tsconfig.compilerOptions.paths;
@@ -196987,27 +197078,27 @@ var transpileFile = async ({
196987
197078
  external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
196988
197079
  plugins: getPlugins()
196989
197080
  });
196990
- const esmOutputPath = path36.join(outputDir, "index.js");
197081
+ const esmOutputPath = path37.join(outputDir, "index.js");
196991
197082
  await esmBundle.write({
196992
197083
  file: esmOutputPath,
196993
197084
  format: "es",
196994
197085
  sourcemap: false
196995
197086
  });
196996
- console.log(`ESM bundle written to ${path36.relative(projectDir, esmOutputPath)}`);
197087
+ console.log(`ESM bundle written to ${path37.relative(projectDir, esmOutputPath)}`);
196997
197088
  console.log("Building CommonJS bundle...");
196998
197089
  const cjsBundle = await rollup({
196999
197090
  input,
197000
197091
  external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
197001
197092
  plugins: getPlugins()
197002
197093
  });
197003
- const cjsOutputPath = path36.join(outputDir, "index.cjs");
197094
+ const cjsOutputPath = path37.join(outputDir, "index.cjs");
197004
197095
  console.log("Writing CJS bundle to:", cjsOutputPath);
197005
197096
  await cjsBundle.write({
197006
197097
  file: cjsOutputPath,
197007
197098
  format: "cjs",
197008
197099
  sourcemap: false
197009
197100
  });
197010
- console.log(`CommonJS bundle written to ${path36.relative(projectDir, cjsOutputPath)}`);
197101
+ console.log(`CommonJS bundle written to ${path37.relative(projectDir, cjsOutputPath)}`);
197011
197102
  console.log("Generating type declarations...");
197012
197103
  const dtsBundle = await rollup({
197013
197104
  input,
@@ -197032,9 +197123,9 @@ var transpileFile = async ({
197032
197123
  dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
197033
197124
  dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
197034
197125
  dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
197035
- const dtsOutputPath = path36.join(outputDir, "index.d.ts");
197036
- fs37.writeFileSync(dtsOutputPath, dtsContent);
197037
- console.log(`Type declarations written to ${path36.relative(projectDir, dtsOutputPath)}`);
197126
+ const dtsOutputPath = path37.join(outputDir, "index.d.ts");
197127
+ fs38.writeFileSync(dtsOutputPath, dtsContent);
197128
+ console.log(`Type declarations written to ${path37.relative(projectDir, dtsOutputPath)}`);
197038
197129
  console.log(kleur_default.green("Transpilation complete!"));
197039
197130
  return true;
197040
197131
  } catch (err) {
@@ -197047,17 +197138,17 @@ var transpileFile = async ({
197047
197138
  };
197048
197139
 
197049
197140
  // cli/utils/validate-main-in-dist.ts
197050
- import fs38 from "node:fs";
197051
- import path37 from "node:path";
197141
+ import fs39 from "node:fs";
197142
+ import path38 from "node:path";
197052
197143
  var validateMainInDist = (projectDir, distDir) => {
197053
- const packageJsonPath = path37.join(projectDir, "package.json");
197054
- if (!fs38.existsSync(packageJsonPath))
197144
+ const packageJsonPath = path38.join(projectDir, "package.json");
197145
+ if (!fs39.existsSync(packageJsonPath))
197055
197146
  return;
197056
- const packageJson = JSON.parse(fs38.readFileSync(packageJsonPath, "utf-8"));
197147
+ const packageJson = JSON.parse(fs39.readFileSync(packageJsonPath, "utf-8"));
197057
197148
  if (typeof packageJson.main !== "string")
197058
197149
  return;
197059
- const resolvedMainPath = path37.resolve(projectDir, packageJson.main);
197060
- const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path37.sep}`);
197150
+ const resolvedMainPath = path38.resolve(projectDir, packageJson.main);
197151
+ const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path38.sep}`);
197061
197152
  if (!isMainInDist) {
197062
197153
  throw new Error('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
197063
197154
  }
@@ -197082,8 +197173,8 @@ var registerBuild = (program3) => {
197082
197173
  }
197083
197174
  return config;
197084
197175
  })();
197085
- const distDir = path38.join(projectDir, "dist");
197086
- fs39.mkdirSync(distDir, { recursive: true });
197176
+ const distDir = path39.join(projectDir, "dist");
197177
+ fs40.mkdirSync(distDir, { recursive: true });
197087
197178
  console.log(`Building ${circuitFiles.length} file(s)...`);
197088
197179
  let hasErrors = false;
197089
197180
  const staticFileReferences = [];
@@ -197091,10 +197182,10 @@ var registerBuild = (program3) => {
197091
197182
  const kicadProjects = [];
197092
197183
  const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
197093
197184
  for (const filePath of circuitFiles) {
197094
- const relative9 = path38.relative(projectDir, filePath);
197185
+ const relative9 = path39.relative(projectDir, filePath);
197095
197186
  console.log(`Building ${relative9}...`);
197096
197187
  const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
197097
- const outputPath = path38.join(distDir, outputDirName, "circuit.json");
197188
+ const outputPath = path39.join(distDir, outputDirName, "circuit.json");
197098
197189
  const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
197099
197190
  ignoreErrors: options?.ignoreErrors,
197100
197191
  ignoreWarnings: options?.ignoreWarnings,
@@ -197108,17 +197199,17 @@ var registerBuild = (program3) => {
197108
197199
  if (!buildOutcome.ok) {
197109
197200
  hasErrors = true;
197110
197201
  } else if (options?.site) {
197111
- const normalizedSourcePath = relative9.split(path38.sep).join("/");
197112
- const relativeOutputPath = path38.join(outputDirName, "circuit.json");
197113
- const normalizedOutputPath = relativeOutputPath.split(path38.sep).join("/");
197202
+ const normalizedSourcePath = relative9.split(path39.sep).join("/");
197203
+ const relativeOutputPath = path39.join(outputDirName, "circuit.json");
197204
+ const normalizedOutputPath = relativeOutputPath.split(path39.sep).join("/");
197114
197205
  staticFileReferences.push({
197115
197206
  filePath: normalizedSourcePath,
197116
197207
  fileStaticAssetUrl: `./${normalizedOutputPath}`
197117
197208
  });
197118
197209
  }
197119
197210
  if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
197120
- const projectOutputDir = path38.join(distDir, outputDirName, "kicad");
197121
- const projectName = path38.basename(outputDirName);
197211
+ const projectOutputDir = path39.join(distDir, outputDirName, "kicad");
197212
+ const projectName = path39.basename(outputDirName);
197122
197213
  const project = await generateKicadProject({
197123
197214
  circuitJson: buildOutcome.circuitJson,
197124
197215
  outputDir: projectOutputDir,
@@ -197167,8 +197258,8 @@ var registerBuild = (program3) => {
197167
197258
  files: staticFileReferences,
197168
197259
  standaloneScriptSrc: "./standalone.min.js"
197169
197260
  });
197170
- fs39.writeFileSync(path38.join(distDir, "index.html"), indexHtml);
197171
- fs39.writeFileSync(path38.join(distDir, "standalone.min.js"), standalone_min_default);
197261
+ fs40.writeFileSync(path39.join(distDir, "index.html"), indexHtml);
197262
+ fs40.writeFileSync(path39.join(distDir, "standalone.min.js"), standalone_min_default);
197172
197263
  }
197173
197264
  if (options?.kicadFootprintLibrary) {
197174
197265
  if (kicadProjects.length === 0) {
@@ -197191,8 +197282,8 @@ var registerBuild = (program3) => {
197191
197282
  };
197192
197283
 
197193
197284
  // lib/shared/snapshot-project.ts
197194
- import fs41 from "node:fs";
197195
- import path39 from "node:path";
197285
+ import fs42 from "node:fs";
197286
+ import path40 from "node:path";
197196
197287
  import looksSame2 from "looks-same";
197197
197288
  import {
197198
197289
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
@@ -197203,7 +197294,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
197203
197294
 
197204
197295
  // lib/shared/compare-images.ts
197205
197296
  import looksSame from "looks-same";
197206
- import fs40 from "node:fs/promises";
197297
+ import fs41 from "node:fs/promises";
197207
197298
  var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
197208
197299
  const { equal: equal2 } = await looksSame(buffer1, buffer2, {
197209
197300
  strict: false,
@@ -197219,7 +197310,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
197219
197310
  tolerance: 2
197220
197311
  });
197221
197312
  } else {
197222
- await fs40.writeFile(diffPath, buffer2);
197313
+ await fs41.writeFile(diffPath, buffer2);
197223
197314
  }
197224
197315
  }
197225
197316
  return { equal: equal2 };
@@ -197244,7 +197335,7 @@ var snapshotProject = async ({
197244
197335
  ...DEFAULT_IGNORED_PATTERNS,
197245
197336
  ...ignored.map(normalizeIgnorePattern)
197246
197337
  ];
197247
- const resolvedPaths = filePaths.map((f) => path39.resolve(projectDir, f));
197338
+ const resolvedPaths = filePaths.map((f) => path40.resolve(projectDir, f));
197248
197339
  const boardFiles = findBoardFiles({
197249
197340
  projectDir,
197250
197341
  ignore,
@@ -197258,7 +197349,7 @@ var snapshotProject = async ({
197258
197349
  const mismatches = [];
197259
197350
  let didUpdate = false;
197260
197351
  for (const file of boardFiles) {
197261
- const relativeFilePath = path39.relative(projectDir, file);
197352
+ const relativeFilePath = path40.relative(projectDir, file);
197262
197353
  let circuitJson;
197263
197354
  let pcbSvg;
197264
197355
  let schSvg;
@@ -197312,17 +197403,17 @@ var snapshotProject = async ({
197312
197403
  } catch (error) {
197313
197404
  const errorMessage = error instanceof Error ? error.message : String(error);
197314
197405
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
197315
- const fileDir = path39.dirname(file);
197316
- const relativeDir = path39.relative(projectDir, fileDir);
197317
- const snapDir2 = snapshotsDirName ? path39.join(projectDir, snapshotsDirName, relativeDir) : path39.join(fileDir, "__snapshots__");
197318
- const base2 = path39.basename(file).replace(/\.tsx$/, "");
197319
- const snap3dPath = path39.join(snapDir2, `${base2}-3d.snap.png`);
197320
- const existing3dSnapshot = fs41.existsSync(snap3dPath);
197406
+ const fileDir = path40.dirname(file);
197407
+ const relativeDir = path40.relative(projectDir, fileDir);
197408
+ const snapDir2 = snapshotsDirName ? path40.join(projectDir, snapshotsDirName, relativeDir) : path40.join(fileDir, "__snapshots__");
197409
+ const base2 = path40.basename(file).replace(/\.tsx$/, "");
197410
+ const snap3dPath = path40.join(snapDir2, `${base2}-3d.snap.png`);
197411
+ const existing3dSnapshot = fs42.existsSync(snap3dPath);
197321
197412
  if (existing3dSnapshot) {
197322
197413
  onError(kleur_default.red(`
197323
197414
  ❌ Failed to generate 3D snapshot for ${relativeFilePath}:
197324
197415
  `) + kleur_default.red(` No pcb_board found in circuit JSON
197325
- `) + kleur_default.red(` Existing snapshot: ${path39.relative(projectDir, snap3dPath)}
197416
+ `) + kleur_default.red(` Existing snapshot: ${path40.relative(projectDir, snap3dPath)}
197326
197417
  `));
197327
197418
  return onExit(1);
197328
197419
  } else {
@@ -197338,9 +197429,9 @@ var snapshotProject = async ({
197338
197429
  }
197339
197430
  }
197340
197431
  }
197341
- const snapDir = snapshotsDirName ? path39.join(projectDir, snapshotsDirName, path39.relative(projectDir, path39.dirname(file))) : path39.join(path39.dirname(file), "__snapshots__");
197342
- fs41.mkdirSync(snapDir, { recursive: true });
197343
- const base = path39.basename(file).replace(/\.tsx$/, "");
197432
+ const snapDir = snapshotsDirName ? path40.join(projectDir, snapshotsDirName, path40.relative(projectDir, path40.dirname(file))) : path40.join(path40.dirname(file), "__snapshots__");
197433
+ fs42.mkdirSync(snapDir, { recursive: true });
197434
+ const base = path40.basename(file).replace(/\.tsx$/, "");
197344
197435
  const snapshots = [];
197345
197436
  if (pcbOnly || !schematicOnly) {
197346
197437
  snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
@@ -197358,31 +197449,31 @@ var snapshotProject = async ({
197358
197449
  for (const snapshot of snapshots) {
197359
197450
  const { type } = snapshot;
197360
197451
  const is3d = type === "3d";
197361
- const snapPath = path39.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
197362
- const existing = fs41.existsSync(snapPath);
197452
+ const snapPath = path40.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
197453
+ const existing = fs42.existsSync(snapPath);
197363
197454
  const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
197364
197455
  const newContentForFile = snapshot.content;
197365
197456
  if (!existing) {
197366
- fs41.writeFileSync(snapPath, newContentForFile);
197367
- console.log("✅", kleur_default.gray(path39.relative(projectDir, snapPath)));
197457
+ fs42.writeFileSync(snapPath, newContentForFile);
197458
+ console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
197368
197459
  didUpdate = true;
197369
197460
  continue;
197370
197461
  }
197371
- const oldContentBuffer = fs41.readFileSync(snapPath);
197462
+ const oldContentBuffer = fs42.readFileSync(snapPath);
197372
197463
  const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
197373
197464
  const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
197374
197465
  if (update) {
197375
197466
  if (!forceUpdate && equal2) {
197376
- console.log("✅", kleur_default.gray(path39.relative(projectDir, snapPath)));
197467
+ console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
197377
197468
  } else {
197378
- fs41.writeFileSync(snapPath, newContentForFile);
197379
- console.log("✅", kleur_default.gray(path39.relative(projectDir, snapPath)));
197469
+ fs42.writeFileSync(snapPath, newContentForFile);
197470
+ console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
197380
197471
  didUpdate = true;
197381
197472
  }
197382
197473
  } else if (!equal2) {
197383
197474
  mismatches.push(`${snapPath} (diff: ${diffPath})`);
197384
197475
  } else {
197385
- console.log("✅", kleur_default.gray(path39.relative(projectDir, snapPath)));
197476
+ console.log("✅", kleur_default.gray(path40.relative(projectDir, snapPath)));
197386
197477
  }
197387
197478
  }
197388
197479
  }
@@ -197421,22 +197512,22 @@ var registerSnapshot = (program3) => {
197421
197512
  };
197422
197513
 
197423
197514
  // lib/shared/setup-github-actions.ts
197424
- import fs42 from "node:fs";
197425
- import path40 from "node:path";
197515
+ import fs43 from "node:fs";
197516
+ import path41 from "node:path";
197426
197517
  var setupGithubActions = (projectDir = process.cwd()) => {
197427
197518
  const findGitRoot = (startDir) => {
197428
- let dir = path40.resolve(startDir);
197429
- while (dir !== path40.parse(dir).root) {
197430
- if (fs42.existsSync(path40.join(dir, ".git"))) {
197519
+ let dir = path41.resolve(startDir);
197520
+ while (dir !== path41.parse(dir).root) {
197521
+ if (fs43.existsSync(path41.join(dir, ".git"))) {
197431
197522
  return dir;
197432
197523
  }
197433
- dir = path40.dirname(dir);
197524
+ dir = path41.dirname(dir);
197434
197525
  }
197435
197526
  return null;
197436
197527
  };
197437
197528
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
197438
- const workflowsDir = path40.join(gitRoot, ".github", "workflows");
197439
- fs42.mkdirSync(workflowsDir, { recursive: true });
197529
+ const workflowsDir = path41.join(gitRoot, ".github", "workflows");
197530
+ fs43.mkdirSync(workflowsDir, { recursive: true });
197440
197531
  const buildWorkflow = `name: tscircuit Build
197441
197532
 
197442
197533
  on:
@@ -197475,8 +197566,8 @@ jobs:
197475
197566
  - run: bun install
197476
197567
  - run: bunx tsci snapshot
197477
197568
  `;
197478
- writeFileIfNotExists(path40.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
197479
- writeFileIfNotExists(path40.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
197569
+ writeFileIfNotExists(path41.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
197570
+ writeFileIfNotExists(path41.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
197480
197571
  };
197481
197572
 
197482
197573
  // cli/setup/register.ts
@@ -197502,8 +197593,8 @@ var registerSetup = (program3) => {
197502
197593
  };
197503
197594
 
197504
197595
  // cli/convert/register.ts
197505
- import fs43 from "node:fs/promises";
197506
- import path41 from "node:path";
197596
+ import fs44 from "node:fs/promises";
197597
+ import path42 from "node:path";
197507
197598
  import { parseKicadModToCircuitJson } from "kicad-component-converter";
197508
197599
 
197509
197600
  // node_modules/@tscircuit/mm/dist/index.js
@@ -197623,15 +197714,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
197623
197714
  var registerConvert = (program3) => {
197624
197715
  program3.command("convert").description("Convert a .kicad_mod footprint to a tscircuit component").argument("<file>", "Path to the .kicad_mod file").option("-o, --output <path>", "Output TSX file path").option("-n, --name <component>", "Component name for export").action(async (file, options) => {
197625
197716
  try {
197626
- const inputPath = path41.resolve(file);
197627
- const modContent = await fs43.readFile(inputPath, "utf-8");
197717
+ const inputPath = path42.resolve(file);
197718
+ const modContent = await fs44.readFile(inputPath, "utf-8");
197628
197719
  const circuitJson = await parseKicadModToCircuitJson(modContent);
197629
- const componentName = options.name ?? path41.basename(inputPath, ".kicad_mod");
197720
+ const componentName = options.name ?? path42.basename(inputPath, ".kicad_mod");
197630
197721
  const tsx = convertCircuitJsonToTscircuit(circuitJson, {
197631
197722
  componentName
197632
197723
  });
197633
- const outputPath = options.output ? path41.resolve(options.output) : path41.join(path41.dirname(inputPath), `${componentName}.tsx`);
197634
- await fs43.writeFile(outputPath, tsx);
197724
+ const outputPath = options.output ? path42.resolve(options.output) : path42.join(path42.dirname(inputPath), `${componentName}.tsx`);
197725
+ await fs44.writeFile(outputPath, tsx);
197635
197726
  console.log(kleur_default.green(`Converted ${outputPath}`));
197636
197727
  } catch (error) {
197637
197728
  console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
@@ -197726,12 +197817,12 @@ var registerSimulate = (program3) => {
197726
197817
  };
197727
197818
 
197728
197819
  // lib/shared/install-project-dependencies.ts
197729
- import fs45 from "node:fs";
197730
- import path43 from "node:path";
197820
+ import fs46 from "node:fs";
197821
+ import path44 from "node:path";
197731
197822
 
197732
197823
  // lib/shared/collect-tsci-dependencies.ts
197733
- import fs44 from "node:fs";
197734
- import path42 from "node:path";
197824
+ import fs45 from "node:fs";
197825
+ import path43 from "node:path";
197735
197826
  var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
197736
197827
  var DEFAULT_IGNORES = [
197737
197828
  "**/node_modules/**",
@@ -197746,7 +197837,7 @@ function collectTsciDependencies({
197746
197837
  patterns = DEFAULT_PATTERNS,
197747
197838
  ignore = DEFAULT_IGNORES
197748
197839
  } = {}) {
197749
- const searchRoot = path42.resolve(cwd);
197840
+ const searchRoot = path43.resolve(cwd);
197750
197841
  const files = globbySync(patterns, {
197751
197842
  cwd: searchRoot,
197752
197843
  absolute: true,
@@ -197756,7 +197847,7 @@ function collectTsciDependencies({
197756
197847
  const dependencies2 = new Set;
197757
197848
  for (const filePath of files) {
197758
197849
  try {
197759
- const fileContents = fs44.readFileSync(filePath, "utf-8");
197850
+ const fileContents = fs45.readFileSync(filePath, "utf-8");
197760
197851
  let match;
197761
197852
  while (true) {
197762
197853
  match = IMPORT_PATTERN.exec(fileContents);
@@ -197773,26 +197864,26 @@ function collectTsciDependencies({
197773
197864
  async function installProjectDependencies({
197774
197865
  cwd = process.cwd()
197775
197866
  } = {}) {
197776
- const projectRoot = path43.resolve(cwd);
197777
- const packageJsonPath = path43.join(projectRoot, "package.json");
197778
- const npmrcPath = path43.join(projectRoot, ".npmrc");
197867
+ const projectRoot = path44.resolve(cwd);
197868
+ const packageJsonPath = path44.join(projectRoot, "package.json");
197869
+ const npmrcPath = path44.join(projectRoot, ".npmrc");
197779
197870
  const packageManager = getPackageManager();
197780
- if (!fs45.existsSync(projectRoot)) {
197871
+ if (!fs46.existsSync(projectRoot)) {
197781
197872
  throw new Error(`Directory not found: ${projectRoot}`);
197782
197873
  }
197783
197874
  let packageJsonCreated = false;
197784
- if (!fs45.existsSync(packageJsonPath)) {
197875
+ if (!fs46.existsSync(packageJsonPath)) {
197785
197876
  console.log("No package.json found. Generating a new one.");
197786
197877
  generatePackageJson(projectRoot);
197787
197878
  packageJsonCreated = true;
197788
197879
  } else {
197789
197880
  console.log("Found existing package.json.");
197790
197881
  }
197791
- if (!fs45.existsSync(npmrcPath)) {
197882
+ if (!fs46.existsSync(npmrcPath)) {
197792
197883
  console.log("Creating .npmrc with tscircuit registry configuration.");
197793
- fs45.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
197884
+ fs46.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
197794
197885
  }
197795
- const packageJson = JSON.parse(fs45.readFileSync(packageJsonPath, "utf-8"));
197886
+ const packageJson = JSON.parse(fs46.readFileSync(packageJsonPath, "utf-8"));
197796
197887
  if (packageJsonCreated) {
197797
197888
  const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
197798
197889
  if (tsciDependencies.length > 0) {
@@ -197807,7 +197898,7 @@ async function installProjectDependencies({
197807
197898
  console.log("No @tsci dependencies detected in circuit files.");
197808
197899
  }
197809
197900
  }
197810
- fs45.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
197901
+ fs46.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
197811
197902
  `);
197812
197903
  console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
197813
197904
  try {
@@ -197837,14 +197928,14 @@ var registerInstall = (program3) => {
197837
197928
  };
197838
197929
 
197839
197930
  // cli/transpile/register.ts
197840
- import path44 from "node:path";
197931
+ import path45 from "node:path";
197841
197932
  var registerTranspile = (program3) => {
197842
197933
  program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
197843
197934
  try {
197844
197935
  const { projectDir, circuitFiles, mainEntrypoint } = await getBuildEntrypoints({
197845
197936
  fileOrDir: file
197846
197937
  });
197847
- const distDir = path44.join(projectDir, "dist");
197938
+ const distDir = path45.join(projectDir, "dist");
197848
197939
  validateMainInDist(projectDir, distDir);
197849
197940
  console.log("Transpiling entry file...");
197850
197941
  const entryFile = mainEntrypoint || circuitFiles[0];