@tscircuit/cli 0.1.496 → 0.1.498

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 +1060 -561
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -59656,14 +59656,14 @@ var require__stream_transform = __commonJS((exports2, module2) => {
59656
59656
  util.inherits = require_inherits();
59657
59657
  util.inherits(Transform, Duplex);
59658
59658
  function afterTransform(er, data) {
59659
- var ts3 = this._transformState;
59660
- ts3.transforming = false;
59661
- var cb = ts3.writecb;
59659
+ var ts4 = this._transformState;
59660
+ ts4.transforming = false;
59661
+ var cb = ts4.writecb;
59662
59662
  if (!cb) {
59663
59663
  return this.emit("error", new Error("write callback called multiple times"));
59664
59664
  }
59665
- ts3.writechunk = null;
59666
- ts3.writecb = null;
59665
+ ts4.writechunk = null;
59666
+ ts4.writecb = null;
59667
59667
  if (data != null)
59668
59668
  this.push(data);
59669
59669
  cb(er);
@@ -59713,23 +59713,23 @@ var require__stream_transform = __commonJS((exports2, module2) => {
59713
59713
  throw new Error("_transform() is not implemented");
59714
59714
  };
59715
59715
  Transform.prototype._write = function(chunk, encoding, cb) {
59716
- var ts3 = this._transformState;
59717
- ts3.writecb = cb;
59718
- ts3.writechunk = chunk;
59719
- ts3.writeencoding = encoding;
59720
- if (!ts3.transforming) {
59716
+ var ts4 = this._transformState;
59717
+ ts4.writecb = cb;
59718
+ ts4.writechunk = chunk;
59719
+ ts4.writeencoding = encoding;
59720
+ if (!ts4.transforming) {
59721
59721
  var rs = this._readableState;
59722
- if (ts3.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
59722
+ if (ts4.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
59723
59723
  this._read(rs.highWaterMark);
59724
59724
  }
59725
59725
  };
59726
59726
  Transform.prototype._read = function(n) {
59727
- var ts3 = this._transformState;
59728
- if (ts3.writechunk !== null && ts3.writecb && !ts3.transforming) {
59729
- ts3.transforming = true;
59730
- this._transform(ts3.writechunk, ts3.writeencoding, ts3.afterTransform);
59727
+ var ts4 = this._transformState;
59728
+ if (ts4.writechunk !== null && ts4.writecb && !ts4.transforming) {
59729
+ ts4.transforming = true;
59730
+ this._transform(ts4.writechunk, ts4.writeencoding, ts4.afterTransform);
59731
59731
  } else {
59732
- ts3.needTransform = true;
59732
+ ts4.needTransform = true;
59733
59733
  }
59734
59734
  };
59735
59735
  Transform.prototype._destroy = function(err, cb) {
@@ -60005,8 +60005,8 @@ var require_lib3 = __commonJS((exports2, module2) => {
60005
60005
  return this;
60006
60006
  }
60007
60007
  var p = this.constructor;
60008
- return this.then(resolve9, reject2);
60009
- function resolve9(value) {
60008
+ return this.then(resolve10, reject2);
60009
+ function resolve10(value) {
60010
60010
  function yes() {
60011
60011
  return value;
60012
60012
  }
@@ -60159,8 +60159,8 @@ var require_lib3 = __commonJS((exports2, module2) => {
60159
60159
  }
60160
60160
  return out;
60161
60161
  }
60162
- Promise2.resolve = resolve8;
60163
- function resolve8(value) {
60162
+ Promise2.resolve = resolve9;
60163
+ function resolve9(value) {
60164
60164
  if (value instanceof this) {
60165
60165
  return value;
60166
60166
  }
@@ -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(path21) {
60590
- var parts = path21.split("/");
60589
+ exports2.resolve = function(path22) {
60590
+ var parts = path22.split("/");
60591
60591
  var result = [];
60592
60592
  for (var index = 0;index < parts.length; index++) {
60593
60593
  var part = parts[index];
@@ -60659,10 +60659,10 @@ var require_utils6 = __commonJS((exports2) => {
60659
60659
  var promise = external.Promise.resolve(inputData).then(function(data) {
60660
60660
  var isBlob = support.blob && (data instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(data)) !== -1);
60661
60661
  if (isBlob && typeof FileReader !== "undefined") {
60662
- return new external.Promise(function(resolve8, reject) {
60662
+ return new external.Promise(function(resolve9, reject) {
60663
60663
  var reader = new FileReader;
60664
60664
  reader.onload = function(e) {
60665
- resolve8(e.target.result);
60665
+ resolve9(e.target.result);
60666
60666
  };
60667
60667
  reader.onerror = function(e) {
60668
60668
  reject(e.target.error);
@@ -61126,7 +61126,7 @@ var require_StreamHelper = __commonJS((exports2, module2) => {
61126
61126
  }
61127
61127
  }
61128
61128
  function accumulate(helper, updateCallback) {
61129
- return new external.Promise(function(resolve8, reject) {
61129
+ return new external.Promise(function(resolve9, reject) {
61130
61130
  var dataArray = [];
61131
61131
  var { _internalType: chunkType, _outputType: resultType, _mimeType: mimeType } = helper;
61132
61132
  helper.on("data", function(data, meta) {
@@ -61140,7 +61140,7 @@ var require_StreamHelper = __commonJS((exports2, module2) => {
61140
61140
  }).on("end", function() {
61141
61141
  try {
61142
61142
  var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType);
61143
- resolve8(result);
61143
+ resolve9(result);
61144
61144
  } catch (e) {
61145
61145
  reject(e);
61146
61146
  }
@@ -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(path21) {
66041
- if (path21.slice(-1) === "/") {
66042
- path21 = path21.substring(0, path21.length - 1);
66040
+ var parentFolder = function(path22) {
66041
+ if (path22.slice(-1) === "/") {
66042
+ path22 = path22.substring(0, path22.length - 1);
66043
66043
  }
66044
- var lastSlash = path21.lastIndexOf("/");
66045
- return lastSlash > 0 ? path21.substring(0, lastSlash) : "";
66044
+ var lastSlash = path22.lastIndexOf("/");
66045
+ return lastSlash > 0 ? path22.substring(0, lastSlash) : "";
66046
66046
  };
66047
- var forceTrailingSlash = function(path21) {
66048
- if (path21.slice(-1) !== "/") {
66049
- path21 += "/";
66047
+ var forceTrailingSlash = function(path22) {
66048
+ if (path22.slice(-1) !== "/") {
66049
+ path22 += "/";
66050
66050
  }
66051
- return path21;
66051
+ return path22;
66052
66052
  };
66053
66053
  var folderAdd = function(name, createFolders) {
66054
66054
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
@@ -66716,7 +66716,7 @@ var require_load2 = __commonJS((exports2, module2) => {
66716
66716
  var Crc32Probe = require_Crc32Probe();
66717
66717
  var nodejsUtils = require_nodejsUtils();
66718
66718
  function checkEntryCRC32(zipEntry) {
66719
- return new external.Promise(function(resolve8, reject) {
66719
+ return new external.Promise(function(resolve9, reject) {
66720
66720
  var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe);
66721
66721
  worker.on("error", function(e) {
66722
66722
  reject(e);
@@ -66724,7 +66724,7 @@ var require_load2 = __commonJS((exports2, module2) => {
66724
66724
  if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) {
66725
66725
  reject(new Error("Corrupted zip : CRC32 mismatch"));
66726
66726
  } else {
66727
- resolve8();
66727
+ resolve9();
66728
66728
  }
66729
66729
  }).resume();
66730
66730
  });
@@ -67088,7 +67088,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
67088
67088
  var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target, mod));
67089
67089
  var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
67090
67090
  var __async = (__this, __arguments, generator) => {
67091
- return new Promise((resolve10, reject) => {
67091
+ return new Promise((resolve11, reject) => {
67092
67092
  var fulfilled = (value) => {
67093
67093
  try {
67094
67094
  step(generator.next(value));
@@ -67103,7 +67103,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
67103
67103
  reject(e);
67104
67104
  }
67105
67105
  };
67106
- var step = (x) => x.done ? resolve10(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
67106
+ var step = (x) => x.done ? resolve11(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
67107
67107
  step((generator = generator.apply(__this, __arguments)).next());
67108
67108
  });
67109
67109
  };
@@ -67127,7 +67127,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
67127
67127
  });
67128
67128
  };
67129
67129
  traverse(program3, []);
67130
- return allCommandPaths.filter((path24) => path24 !== "");
67130
+ return allCommandPaths.filter((path25) => path25 !== "");
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((path24) => normalizeCommandName(path24));
67138
+ const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path25) => normalizeCommandName(path25));
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 fs24 = __require("fs");
67425
+ var fs25 = __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
- fs24.lstatSync(base);
67490
+ fs25.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 = fs24.lstatSync(base);
67508
+ var stat4 = fs25.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
- fs24.statSync(base);
67524
- linkTarget = fs24.readlinkSync(base);
67523
+ fs25.statSync(base);
67524
+ linkTarget = fs25.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
- fs24.lstat(base, function(err) {
67561
+ fs25.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 fs24.lstat(base, gotStat);
67589
+ return fs25.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
- fs24.stat(base, function(err2) {
67606
+ fs25.stat(base, function(err2) {
67607
67607
  if (err2)
67608
67608
  return cb(err2);
67609
- fs24.readlink(base, function(err3, target) {
67609
+ fs25.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 fs24 = __require("fs");
67640
- var origRealpath = fs24.realpath;
67641
- var origRealpathSync = fs24.realpathSync;
67639
+ var fs25 = __require("fs");
67640
+ var origRealpath = fs25.realpath;
67641
+ var origRealpathSync = fs25.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
- fs24.realpath = realpath2;
67680
- fs24.realpathSync = realpathSync;
67679
+ fs25.realpath = realpath2;
67680
+ fs25.realpathSync = realpathSync;
67681
67681
  }
67682
67682
  function unmonkeypatch() {
67683
- fs24.realpath = origRealpath;
67684
- fs24.realpathSync = origRealpathSync;
67683
+ fs25.realpath = origRealpath;
67684
+ fs25.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 path24 = require_path2();
67911
- minimatch.sep = path24.sep;
67910
+ var path25 = require_path2();
67911
+ minimatch.sep = path25.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 (path24.sep !== "/") {
68403
- f = f.split(path24.sep).join("/");
68402
+ if (path25.sep !== "/") {
68403
+ f = f.split(path25.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 fs24 = __require("fs");
68494
- var path24 = __require("path");
68493
+ var fs25 = __require("fs");
68494
+ var path25 = __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 || fs24;
68548
+ self2.fs = options.fs || fs25;
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 = path24.resolve(cwd);
68557
+ self2.cwd = path25.resolve(cwd);
68558
68558
  else {
68559
- self2.cwd = path24.resolve(options.cwd);
68559
+ self2.cwd = path25.resolve(options.cwd);
68560
68560
  self2.changedCwd = self2.cwd !== cwd;
68561
68561
  }
68562
- self2.root = options.root || path24.resolve(self2.cwd, "/");
68563
- self2.root = path24.resolve(self2.root);
68562
+ self2.root = options.root || path25.resolve(self2.cwd, "/");
68563
+ self2.root = path25.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 = path24.join(self2.root, f);
68646
+ abs = path25.join(self2.root, f);
68647
68647
  } else if (isAbsolute3(f) || f === "") {
68648
68648
  abs = f;
68649
68649
  } else if (self2.changedCwd) {
68650
- abs = path24.resolve(self2.cwd, f);
68650
+ abs = path25.resolve(self2.cwd, f);
68651
68651
  } else {
68652
- abs = path24.resolve(f);
68652
+ abs = path25.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 path24 = __require("path");
68683
+ var path25 = __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 = path24.join(this.root, e);
68813
+ e = path25.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 = path24.join(this.root, prefix);
68962
+ prefix = path25.join(this.root, prefix);
68963
68963
  } else {
68964
- prefix = path24.resolve(this.root, prefix);
68964
+ prefix = path25.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 path24 = __require("path");
69151
+ var path25 = __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 = path24.join(this.root, e);
69434
+ e = path25.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 = path24.join(this.root, prefix);
69621
+ prefix = path25.join(this.root, prefix);
69622
69622
  } else {
69623
- prefix = path24.resolve(this.root, prefix);
69623
+ prefix = path25.resolve(this.root, prefix);
69624
69624
  if (trail)
69625
69625
  prefix += "/";
69626
69626
  }
@@ -69697,8 +69697,8 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69697
69697
  "node_modules/glob-promise/lib/index.js"(exports3, module22) {
69698
69698
  var glob2 = require_glob();
69699
69699
  var promise = function(pattern, options) {
69700
- return new Promise((resolve10, reject) => {
69701
- glob2(pattern, options, (err, files) => err === null ? resolve10(files) : reject(err));
69700
+ return new Promise((resolve11, reject) => {
69701
+ glob2(pattern, options, (err, files) => err === null ? resolve11(files) : reject(err));
69702
69702
  });
69703
69703
  };
69704
69704
  module22.exports = promise;
@@ -69804,7 +69804,7 @@ export default {
69804
69804
  }
69805
69805
  case "export-pathlist": {
69806
69806
  return `export default [
69807
- ` + Object.keys(vfs).map((path24) => ` "${path24}"`).join(`,
69807
+ ` + Object.keys(vfs).map((path25) => ` "${path25}"`).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.495";
72390
+ var version = "0.1.497";
72391
72391
  var package_default = {
72392
72392
  name: "@tscircuit/cli",
72393
72393
  version,
@@ -72648,9 +72648,9 @@ export default () => (
72648
72648
  };
72649
72649
 
72650
72650
  // cli/dev/register.ts
72651
- import * as fs20 from "node:fs";
72651
+ import * as fs21 from "node:fs";
72652
72652
  import * as net from "node:net";
72653
- import * as path20 from "node:path";
72653
+ import * as path21 from "node:path";
72654
72654
 
72655
72655
  // lib/dependency-analysis/installNodeModuleTypesForSnippet.ts
72656
72656
  import * as fs8 from "node:fs";
@@ -74370,8 +74370,8 @@ class EventsWatcher extends EventEmitter {
74370
74370
  }
74371
74371
 
74372
74372
  // cli/dev/DevServer.ts
74373
- import path18 from "node:path";
74374
- import fs18 from "node:fs";
74373
+ import path19 from "node:path";
74374
+ import fs19 from "node:fs";
74375
74375
 
74376
74376
  // node_modules/chokidar/esm/index.js
74377
74377
  import { stat as statcb } from "fs";
@@ -77094,6 +77094,265 @@ async function addPackage(componentPath, projectDir = process.cwd()) {
77094
77094
 
77095
77095
  // cli/dev/DevServer.ts
77096
77096
  import Debug2 from "debug";
77097
+
77098
+ // lib/dependency-analysis/getNodeModuleDependencies.ts
77099
+ import * as ts3 from "typescript";
77100
+ import * as path18 from "path";
77101
+ import * as fs18 from "fs";
77102
+ function getLocalPackages(projectDir) {
77103
+ const packageJsonPath = path18.join(projectDir, "package.json");
77104
+ const localPackages = new Set;
77105
+ if (!fs18.existsSync(packageJsonPath)) {
77106
+ return localPackages;
77107
+ }
77108
+ try {
77109
+ const packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf-8"));
77110
+ const allDeps = {
77111
+ ...packageJson.dependencies,
77112
+ ...packageJson.devDependencies,
77113
+ ...packageJson.peerDependencies
77114
+ };
77115
+ for (const [packageName, version2] of Object.entries(allDeps)) {
77116
+ if (typeof version2 !== "string")
77117
+ continue;
77118
+ const isLocalPackage = version2.startsWith("file:") || version2.startsWith("link:") || version2.includes(".yalc");
77119
+ if (isLocalPackage) {
77120
+ localPackages.add(packageName);
77121
+ }
77122
+ }
77123
+ } catch (error) {
77124
+ console.warn("Failed to parse package.json for local packages:", error);
77125
+ }
77126
+ return localPackages;
77127
+ }
77128
+ function getNodeModuleImports(filePath) {
77129
+ const absolutePath = path18.resolve(filePath);
77130
+ if (!fs18.existsSync(absolutePath)) {
77131
+ return [];
77132
+ }
77133
+ const content = fs18.readFileSync(absolutePath, "utf-8");
77134
+ const sourceFile = ts3.createSourceFile(absolutePath, content, ts3.ScriptTarget.Latest, true);
77135
+ const imports = new Set;
77136
+ function visit(node) {
77137
+ if (ts3.isImportDeclaration(node) || ts3.isExportDeclaration(node)) {
77138
+ const moduleSpecifier = node.moduleSpecifier;
77139
+ if (moduleSpecifier && ts3.isStringLiteral(moduleSpecifier)) {
77140
+ const importPath = moduleSpecifier.text;
77141
+ if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
77142
+ imports.add(importPath);
77143
+ }
77144
+ }
77145
+ }
77146
+ if (ts3.isCallExpression(node) && node.expression.kind === ts3.SyntaxKind.ImportKeyword) {
77147
+ const argument = node.arguments[0];
77148
+ if (argument && ts3.isStringLiteral(argument)) {
77149
+ const importPath = argument.text;
77150
+ if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
77151
+ imports.add(importPath);
77152
+ }
77153
+ }
77154
+ }
77155
+ if (ts3.isCallExpression(node) && ts3.isIdentifier(node.expression) && node.expression.text === "require") {
77156
+ const argument = node.arguments[0];
77157
+ if (argument && ts3.isStringLiteral(argument)) {
77158
+ const importPath = argument.text;
77159
+ if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
77160
+ imports.add(importPath);
77161
+ }
77162
+ }
77163
+ }
77164
+ ts3.forEachChild(node, visit);
77165
+ }
77166
+ visit(sourceFile);
77167
+ return Array.from(imports);
77168
+ }
77169
+ function getPackageNameFromImport(importPath) {
77170
+ if (importPath.startsWith("@")) {
77171
+ const parts = importPath.split("/");
77172
+ return `${parts[0]}/${parts[1]}`;
77173
+ }
77174
+ return importPath.split("/")[0];
77175
+ }
77176
+ function resolveNodeModuleImport(importPath, projectDir) {
77177
+ const packageName = getPackageNameFromImport(importPath);
77178
+ const packageDir = path18.join(projectDir, "node_modules", packageName);
77179
+ if (!fs18.existsSync(packageDir)) {
77180
+ return [];
77181
+ }
77182
+ const packageJsonPath = path18.join(packageDir, "package.json");
77183
+ if (!fs18.existsSync(packageJsonPath)) {
77184
+ return [];
77185
+ }
77186
+ const packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf-8"));
77187
+ const resolvedFiles = [];
77188
+ if (importPath !== packageName) {
77189
+ const subpath = importPath.slice(packageName.length + 1);
77190
+ const possiblePaths = [
77191
+ path18.join(packageDir, subpath),
77192
+ path18.join(packageDir, `${subpath}.js`),
77193
+ path18.join(packageDir, `${subpath}.mjs`),
77194
+ path18.join(packageDir, `${subpath}.ts`),
77195
+ path18.join(packageDir, `${subpath}.tsx`),
77196
+ path18.join(packageDir, subpath, "index.js"),
77197
+ path18.join(packageDir, subpath, "index.mjs"),
77198
+ path18.join(packageDir, subpath, "index.ts"),
77199
+ path18.join(packageDir, subpath, "index.tsx")
77200
+ ];
77201
+ for (const p of possiblePaths) {
77202
+ if (fs18.existsSync(p) && fs18.statSync(p).isFile()) {
77203
+ resolvedFiles.push(p);
77204
+ break;
77205
+ }
77206
+ }
77207
+ }
77208
+ const entryPoints = [
77209
+ packageJson.main,
77210
+ packageJson.module,
77211
+ packageJson.exports?.["."]?.default,
77212
+ packageJson.exports?.["."]?.import,
77213
+ packageJson.exports?.["."]?.require
77214
+ ].filter(Boolean);
77215
+ for (const entry of entryPoints) {
77216
+ const entryPath = path18.join(packageDir, entry);
77217
+ if (fs18.existsSync(entryPath) && fs18.statSync(entryPath).isFile()) {
77218
+ resolvedFiles.push(entryPath);
77219
+ }
77220
+ }
77221
+ return resolvedFiles;
77222
+ }
77223
+ function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth = 10) {
77224
+ const visited = new Set;
77225
+ const nodeModuleFiles = new Map;
77226
+ function processFile(filePath, depth) {
77227
+ if (depth > maxDepth || visited.has(filePath)) {
77228
+ return;
77229
+ }
77230
+ visited.add(filePath);
77231
+ const imports = getNodeModuleImports(filePath);
77232
+ for (const importPath of imports) {
77233
+ if (!nodeModuleFiles.has(importPath)) {
77234
+ const resolvedFiles = resolveNodeModuleImport(importPath, projectDir);
77235
+ if (resolvedFiles.length > 0) {
77236
+ nodeModuleFiles.set(importPath, resolvedFiles);
77237
+ for (const resolvedFile of resolvedFiles) {
77238
+ processFile(resolvedFile, depth + 1);
77239
+ }
77240
+ }
77241
+ }
77242
+ }
77243
+ const localDeps = getLocalDependencies(filePath);
77244
+ for (const localDep of localDeps) {
77245
+ processFile(localDep, depth);
77246
+ }
77247
+ }
77248
+ function getLocalDependencies(filePath) {
77249
+ const absolutePath = path18.resolve(filePath);
77250
+ const baseDir = path18.dirname(absolutePath);
77251
+ if (!fs18.existsSync(absolutePath)) {
77252
+ return [];
77253
+ }
77254
+ const content = fs18.readFileSync(absolutePath, "utf-8");
77255
+ const sourceFile = ts3.createSourceFile(absolutePath, content, ts3.ScriptTarget.Latest, true);
77256
+ const dependencies2 = [];
77257
+ function visit(node) {
77258
+ if (ts3.isImportDeclaration(node) || ts3.isExportDeclaration(node)) {
77259
+ const moduleSpecifier = node.moduleSpecifier;
77260
+ if (moduleSpecifier && ts3.isStringLiteral(moduleSpecifier)) {
77261
+ const importPath = moduleSpecifier.text;
77262
+ if (importPath.startsWith(".")) {
77263
+ const resolved = resolveLocalImport(importPath, baseDir);
77264
+ if (resolved)
77265
+ dependencies2.push(resolved);
77266
+ }
77267
+ }
77268
+ }
77269
+ ts3.forEachChild(node, visit);
77270
+ }
77271
+ visit(sourceFile);
77272
+ return dependencies2;
77273
+ }
77274
+ function resolveLocalImport(importPath, baseDir) {
77275
+ const extensions = [".tsx", ".ts", ".jsx", ".js", ".mjs"];
77276
+ const resolvedPath = path18.resolve(baseDir, importPath);
77277
+ if (fs18.existsSync(resolvedPath) && fs18.statSync(resolvedPath).isFile()) {
77278
+ return resolvedPath;
77279
+ }
77280
+ for (const ext of extensions) {
77281
+ const pathWithExt = resolvedPath + ext;
77282
+ if (fs18.existsSync(pathWithExt)) {
77283
+ return pathWithExt;
77284
+ }
77285
+ }
77286
+ if (fs18.existsSync(resolvedPath) && fs18.statSync(resolvedPath).isDirectory()) {
77287
+ for (const ext of extensions) {
77288
+ const indexPath = path18.join(resolvedPath, `index${ext}`);
77289
+ if (fs18.existsSync(indexPath)) {
77290
+ return indexPath;
77291
+ }
77292
+ }
77293
+ }
77294
+ return null;
77295
+ }
77296
+ processFile(entryFilePath, 0);
77297
+ return nodeModuleFiles;
77298
+ }
77299
+ var EXCLUDED_PACKAGE_DIRECTORIES = new Set([
77300
+ "node_modules",
77301
+ ".git",
77302
+ ".next",
77303
+ "dist",
77304
+ "build",
77305
+ ".turbo",
77306
+ "coverage",
77307
+ ".cache",
77308
+ "tmp",
77309
+ "temp"
77310
+ ]);
77311
+ function collectLocalPackageFiles(packageDir) {
77312
+ const files = [];
77313
+ function walkDirectory(dir) {
77314
+ if (!fs18.existsSync(dir))
77315
+ return;
77316
+ const entries = fs18.readdirSync(dir, { withFileTypes: true });
77317
+ for (const entry of entries) {
77318
+ const fullPath = path18.join(dir, entry.name);
77319
+ if (entry.isDirectory()) {
77320
+ if (EXCLUDED_PACKAGE_DIRECTORIES.has(entry.name)) {
77321
+ continue;
77322
+ }
77323
+ walkDirectory(fullPath);
77324
+ } else if (entry.isFile()) {
77325
+ files.push(fullPath);
77326
+ }
77327
+ }
77328
+ }
77329
+ walkDirectory(packageDir);
77330
+ return files;
77331
+ }
77332
+ function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
77333
+ const localPackages = getLocalPackages(projectDir);
77334
+ if (localPackages.size === 0) {
77335
+ return [];
77336
+ }
77337
+ const dependencies2 = collectAllNodeModuleDependencies(entryFilePath, projectDir);
77338
+ const processedPackages = new Set;
77339
+ const allFiles = new Set;
77340
+ for (const [importPath] of dependencies2.entries()) {
77341
+ const packageName = getPackageNameFromImport(importPath);
77342
+ if (!localPackages.has(packageName) || processedPackages.has(packageName)) {
77343
+ continue;
77344
+ }
77345
+ processedPackages.add(packageName);
77346
+ const packageDir = path18.join(projectDir, "node_modules", packageName);
77347
+ if (fs18.existsSync(packageDir)) {
77348
+ const packageFiles = collectLocalPackageFiles(packageDir);
77349
+ packageFiles.forEach((file) => allFiles.add(file));
77350
+ }
77351
+ }
77352
+ return Array.from(allFiles);
77353
+ }
77354
+
77355
+ // cli/dev/DevServer.ts
77097
77356
  var debug2 = Debug2("tscircuit:devserver");
77098
77357
  var BINARY_FILE_EXTENSIONS = new Set([".glb", ".png", ".jpeg", ".jpg"]);
77099
77358
 
@@ -77107,6 +77366,7 @@ class DevServer {
77107
77366
  fsKy;
77108
77367
  filesystemWatcher;
77109
77368
  typesHandler;
77369
+ uploadedNodeModules = new Set;
77110
77370
  constructor({
77111
77371
  port,
77112
77372
  componentFilePath,
@@ -77114,7 +77374,7 @@ class DevServer {
77114
77374
  }) {
77115
77375
  this.port = port;
77116
77376
  this.componentFilePath = componentFilePath;
77117
- this.projectDir = projectDir ?? path18.dirname(componentFilePath);
77377
+ this.projectDir = projectDir ?? path19.dirname(componentFilePath);
77118
77378
  const projectConfig = loadProjectConfig(this.projectDir);
77119
77379
  this.ignoredFiles = projectConfig?.ignoredFiles ?? [];
77120
77380
  this.fsKy = distribution_default.create({
@@ -77125,7 +77385,7 @@ class DevServer {
77125
77385
  async start() {
77126
77386
  const { server } = await createHttpServer({
77127
77387
  port: this.port,
77128
- defaultMainComponentPath: path18.relative(this.projectDir, this.componentFilePath)
77388
+ defaultMainComponentPath: path19.relative(this.projectDir, this.componentFilePath)
77129
77389
  });
77130
77390
  this.httpServer = server;
77131
77391
  this.eventsWatcher = new EventsWatcher(`http://localhost:${this.port}`);
@@ -77137,7 +77397,7 @@ class DevServer {
77137
77397
  this.filesystemWatcher = watch(this.projectDir, {
77138
77398
  persistent: true,
77139
77399
  ignoreInitial: true,
77140
- ignored: (p) => shouldIgnorePath(path18.relative(this.projectDir, p), this.ignoredFiles)
77400
+ ignored: (p) => shouldIgnorePath(path19.relative(this.projectDir, p), this.ignoredFiles)
77141
77401
  });
77142
77402
  this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
77143
77403
  this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
@@ -77153,27 +77413,27 @@ class DevServer {
77153
77413
  const { file } = await this.fsKy.get("api/files/get", {
77154
77414
  searchParams: { file_path: ev.file_path }
77155
77415
  }).json();
77156
- const fullPath = path18.join(this.projectDir, ev.file_path);
77157
- const dirPath = path18.dirname(fullPath);
77158
- if (!fs18.existsSync(dirPath)) {
77159
- fs18.mkdirSync(dirPath, { recursive: true });
77416
+ const fullPath = path19.join(this.projectDir, ev.file_path);
77417
+ const dirPath = path19.dirname(fullPath);
77418
+ if (!fs19.existsSync(dirPath)) {
77419
+ fs19.mkdirSync(dirPath, { recursive: true });
77160
77420
  }
77161
77421
  if (file.binary_content_b64) {
77162
77422
  const decodedContent = Buffer.from(file.binary_content_b64, "base64");
77163
- fs18.writeFileSync(fullPath, decodedContent);
77423
+ fs19.writeFileSync(fullPath, decodedContent);
77164
77424
  } else {
77165
- fs18.writeFileSync(fullPath, file.text_content ?? "", "utf-8");
77425
+ fs19.writeFileSync(fullPath, file.text_content ?? "", "utf-8");
77166
77426
  }
77167
77427
  }
77168
77428
  async handleFileDeletedEventFromServer(ev) {
77169
- const fullPath = path18.join(this.projectDir, ev.file_path);
77170
- if (fs18.existsSync(fullPath)) {
77429
+ const fullPath = path19.join(this.projectDir, ev.file_path);
77430
+ if (fs19.existsSync(fullPath)) {
77171
77431
  debug2(`Deleting file ${ev.file_path} from filesystem`);
77172
- fs18.unlinkSync(fullPath);
77432
+ fs19.unlinkSync(fullPath);
77173
77433
  }
77174
77434
  }
77175
77435
  async handleFileChangedOnFilesystem(absoluteFilePath) {
77176
- const relativeFilePath = path18.relative(this.projectDir, absoluteFilePath);
77436
+ const relativeFilePath = path19.relative(this.projectDir, absoluteFilePath);
77177
77437
  if (relativeFilePath.includes("manual-edits.json"))
77178
77438
  return;
77179
77439
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
@@ -77188,9 +77448,30 @@ class DevServer {
77188
77448
  ...filePayload
77189
77449
  }
77190
77450
  }).json();
77451
+ await this.checkAndUploadNewNodeModules(absoluteFilePath);
77452
+ }
77453
+ async checkAndUploadNewNodeModules(filePath) {
77454
+ const ext = path19.extname(filePath).toLowerCase();
77455
+ const isSourceFile = [".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext);
77456
+ if (!isSourceFile)
77457
+ return;
77458
+ try {
77459
+ const nodeModuleFiles = getAllNodeModuleFilePaths(filePath, this.projectDir);
77460
+ const newFiles = nodeModuleFiles.filter((file) => {
77461
+ const relativePath = path19.relative(this.projectDir, file);
77462
+ return !this.uploadedNodeModules.has(relativePath);
77463
+ });
77464
+ if (newFiles.length === 0)
77465
+ return;
77466
+ console.log(kleur_default.blue(`Uploading ${newFiles.length} new node_modules files...`));
77467
+ await this.uploadNodeModuleFiles(newFiles);
77468
+ console.log(kleur_default.green("New node modules uploaded"));
77469
+ } catch (error) {
77470
+ debug2("Error checking for new node modules:", error);
77471
+ }
77191
77472
  }
77192
77473
  async handleFileRemovedFromFilesystem(absoluteFilePath) {
77193
- const relativeFilePath = path18.relative(this.projectDir, absoluteFilePath);
77474
+ const relativeFilePath = path19.relative(this.projectDir, absoluteFilePath);
77194
77475
  if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
77195
77476
  return;
77196
77477
  if (!relativeFilePath || relativeFilePath.trim() === "") {
@@ -77228,8 +77509,8 @@ class DevServer {
77228
77509
  debug2(`Successfully deleted file ${relativeFilePath} from server`);
77229
77510
  }
77230
77511
  async handleFileRename(oldPath, newPath) {
77231
- const oldRelativePath = path18.relative(this.projectDir, oldPath);
77232
- const newRelativePath = path18.relative(this.projectDir, newPath);
77512
+ const oldRelativePath = path19.relative(this.projectDir, oldPath);
77513
+ const newRelativePath = path19.relative(this.projectDir, newPath);
77233
77514
  if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
77234
77515
  return;
77235
77516
  await this.handleFileRemovedFromFilesystem(oldPath);
@@ -77249,7 +77530,7 @@ class DevServer {
77249
77530
  });
77250
77531
  const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
77251
77532
  for (const filePath of filePaths) {
77252
- const relativeFilePath = path18.relative(this.projectDir, filePath);
77533
+ const relativeFilePath = path19.relative(this.projectDir, filePath);
77253
77534
  const filePayload = this.createFileUploadPayload(filePath, relativeFilePath);
77254
77535
  await this.fsKy.post("api/files/upsert", {
77255
77536
  json: {
@@ -77259,6 +77540,7 @@ class DevServer {
77259
77540
  }
77260
77541
  });
77261
77542
  }
77543
+ await this.uploadInitialNodeModules();
77262
77544
  await this.fsKy.post("api/events/create", {
77263
77545
  json: {
77264
77546
  event_type: "INITIAL_FILES_UPLOADED",
@@ -77267,6 +77549,33 @@ class DevServer {
77267
77549
  throwHttpErrors: false
77268
77550
  });
77269
77551
  }
77552
+ async uploadInitialNodeModules() {
77553
+ try {
77554
+ console.log(kleur_default.blue("Analyzing node_modules dependencies..."));
77555
+ const nodeModuleFiles = getAllNodeModuleFilePaths(this.componentFilePath, this.projectDir);
77556
+ console.log(kleur_default.blue(`Found ${nodeModuleFiles.length} node_modules files to upload`));
77557
+ if (nodeModuleFiles.length > 0) {
77558
+ await this.uploadNodeModuleFiles(nodeModuleFiles);
77559
+ }
77560
+ console.log(kleur_default.green("Node modules uploaded successfully"));
77561
+ } catch (error) {
77562
+ console.warn(kleur_default.yellow("Warning: Failed to upload some node_modules files:"), error);
77563
+ }
77564
+ }
77565
+ async uploadNodeModuleFiles(files) {
77566
+ for (const nodeModuleFile of files) {
77567
+ const relativeFilePath = path19.relative(this.projectDir, nodeModuleFile);
77568
+ this.uploadedNodeModules.add(relativeFilePath);
77569
+ const filePayload = this.createFileUploadPayload(nodeModuleFile, relativeFilePath);
77570
+ await this.fsKy.post("api/files/upsert", {
77571
+ json: {
77572
+ file_path: relativeFilePath,
77573
+ initiator: "filesystem_change",
77574
+ ...filePayload
77575
+ }
77576
+ });
77577
+ }
77578
+ }
77270
77579
  async saveSnippet() {
77271
77580
  const postEvent = async (event, message) => this.fsKy.post("api/events/create", {
77272
77581
  json: { event_type: event, ...message ? { message } : {} },
@@ -77290,12 +77599,12 @@ class DevServer {
77290
77599
  await this.filesystemWatcher?.close();
77291
77600
  }
77292
77601
  createFileUploadPayload(absoluteFilePath, relativeFilePath) {
77293
- const ext = path18.extname(relativeFilePath).toLowerCase();
77602
+ const ext = path19.extname(relativeFilePath).toLowerCase();
77294
77603
  if (BINARY_FILE_EXTENSIONS.has(ext)) {
77295
- const fileBuffer = fs18.readFileSync(absoluteFilePath);
77604
+ const fileBuffer = fs19.readFileSync(absoluteFilePath);
77296
77605
  return { binary_content_b64: fileBuffer.toString("base64") };
77297
77606
  }
77298
- return { text_content: fs18.readFileSync(absoluteFilePath, "utf-8") };
77607
+ return { text_content: fs19.readFileSync(absoluteFilePath, "utf-8") };
77299
77608
  }
77300
77609
  async handleInstallPackage(full_package_name) {
77301
77610
  const postEvent = async (event, message) => {
@@ -77323,11 +77632,11 @@ var getVersion = () => {
77323
77632
  };
77324
77633
 
77325
77634
  // lib/shared/find-board-files.ts
77326
- import fs19 from "node:fs";
77327
- import path19 from "node:path";
77635
+ import fs20 from "node:fs";
77636
+ import path20 from "node:path";
77328
77637
  var isSubPath = (maybeChild, maybeParent) => {
77329
- const relative5 = path19.relative(maybeParent, maybeChild);
77330
- return relative5 === "" || !relative5.startsWith("..") && !path19.isAbsolute(relative5);
77638
+ const relative5 = path20.relative(maybeParent, maybeChild);
77639
+ return relative5 === "" || !relative5.startsWith("..") && !path20.isAbsolute(relative5);
77331
77640
  };
77332
77641
  var isGlobPattern = (str) => {
77333
77642
  return /[*?[\]{}]/.test(str);
@@ -77337,13 +77646,13 @@ var findBoardFiles = ({
77337
77646
  ignore = DEFAULT_IGNORED_PATTERNS,
77338
77647
  filePaths = []
77339
77648
  } = {}) => {
77340
- const resolvedProjectDir = path19.resolve(projectDir);
77649
+ const resolvedProjectDir = path20.resolve(projectDir);
77341
77650
  const boardFilePatterns = getBoardFilePatterns(resolvedProjectDir);
77342
77651
  const relativeBoardFiles = globbySync(boardFilePatterns, {
77343
77652
  cwd: resolvedProjectDir,
77344
77653
  ignore
77345
77654
  });
77346
- const absoluteBoardFiles = relativeBoardFiles.map((f) => path19.join(resolvedProjectDir, f));
77655
+ const absoluteBoardFiles = relativeBoardFiles.map((f) => path20.join(resolvedProjectDir, f));
77347
77656
  const boardFileSet = new Set;
77348
77657
  if (filePaths.length > 0) {
77349
77658
  for (const inputPath of filePaths) {
@@ -77357,13 +77666,13 @@ var findBoardFiles = ({
77357
77666
  boardFileSet.add(match);
77358
77667
  }
77359
77668
  } else {
77360
- const targetPath = path19.resolve(resolvedProjectDir, inputPath);
77361
- if (!fs19.existsSync(targetPath)) {
77669
+ const targetPath = path20.resolve(resolvedProjectDir, inputPath);
77670
+ if (!fs20.existsSync(targetPath)) {
77362
77671
  continue;
77363
77672
  }
77364
- const stat4 = fs19.statSync(targetPath);
77673
+ const stat4 = fs20.statSync(targetPath);
77365
77674
  if (stat4.isDirectory()) {
77366
- const resolvedDir = path19.resolve(targetPath);
77675
+ const resolvedDir = path20.resolve(targetPath);
77367
77676
  if (isSubPath(resolvedDir, resolvedProjectDir)) {
77368
77677
  for (const boardFile of absoluteBoardFiles) {
77369
77678
  if (isSubPath(boardFile, resolvedDir)) {
@@ -77374,7 +77683,7 @@ var findBoardFiles = ({
77374
77683
  const externalMatches = globbySync(boardFilePatterns, {
77375
77684
  cwd: resolvedDir,
77376
77685
  ignore
77377
- }).map((f) => path19.join(resolvedDir, f));
77686
+ }).map((f) => path20.join(resolvedDir, f));
77378
77687
  for (const match of externalMatches) {
77379
77688
  boardFileSet.add(match);
77380
77689
  }
@@ -77394,7 +77703,7 @@ var findBoardFiles = ({
77394
77703
 
77395
77704
  // cli/dev/register.ts
77396
77705
  var findSelectableTsxFiles = (projectDir) => {
77397
- const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs20.existsSync(file)).sort();
77706
+ const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs21.existsSync(file)).sort();
77398
77707
  if (boardFiles.length > 0) {
77399
77708
  return boardFiles;
77400
77709
  }
@@ -77402,18 +77711,18 @@ var findSelectableTsxFiles = (projectDir) => {
77402
77711
  cwd: projectDir,
77403
77712
  ignore: DEFAULT_IGNORED_PATTERNS
77404
77713
  });
77405
- return files.map((file) => path20.resolve(projectDir, file)).filter((file) => fs20.existsSync(file)).sort();
77714
+ return files.map((file) => path21.resolve(projectDir, file)).filter((file) => fs21.existsSync(file)).sort();
77406
77715
  };
77407
77716
  var registerDev = (program3) => {
77408
77717
  program3.command("dev").description("Start development server for a package").argument("[file]", "Path to the package file").option("-p, --port <number>", "Port to run server on", "3020").action(async (file, options) => {
77409
77718
  let port = parseInt(options.port);
77410
77719
  const startTime = Date.now();
77411
77720
  const isPortAvailable = (port2) => {
77412
- return new Promise((resolve8) => {
77721
+ return new Promise((resolve9) => {
77413
77722
  const server2 = net.createServer();
77414
- server2.once("error", () => resolve8(false));
77723
+ server2.once("error", () => resolve9(false));
77415
77724
  server2.once("listening", () => {
77416
- server2.close(() => resolve8(true));
77725
+ server2.close(() => resolve9(true));
77417
77726
  });
77418
77727
  server2.listen(port2);
77419
77728
  });
@@ -77424,7 +77733,7 @@ var registerDev = (program3) => {
77424
77733
  }
77425
77734
  let absolutePath;
77426
77735
  if (file) {
77427
- absolutePath = path20.resolve(file);
77736
+ absolutePath = path21.resolve(file);
77428
77737
  if (!absolutePath.endsWith(".tsx") && !absolutePath.endsWith(".ts")) {
77429
77738
  console.error("Error: Only .tsx files are supported");
77430
77739
  return;
@@ -77433,7 +77742,7 @@ var registerDev = (program3) => {
77433
77742
  const entrypointPath = await getEntrypoint({
77434
77743
  onError: () => {}
77435
77744
  });
77436
- if (entrypointPath && fs20.existsSync(entrypointPath)) {
77745
+ if (entrypointPath && fs21.existsSync(entrypointPath)) {
77437
77746
  absolutePath = entrypointPath;
77438
77747
  console.log("Found entrypoint at:", entrypointPath);
77439
77748
  } else {
@@ -77443,7 +77752,7 @@ var registerDev = (program3) => {
77443
77752
  return;
77444
77753
  }
77445
77754
  absolutePath = availableFiles[0];
77446
- console.log("Selected file:", path20.relative(process.cwd(), absolutePath));
77755
+ console.log("Selected file:", path21.relative(process.cwd(), absolutePath));
77447
77756
  }
77448
77757
  }
77449
77758
  try {
@@ -77464,7 +77773,7 @@ var registerDev = (program3) => {
77464
77773
 
77465
77774
  ${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
77466
77775
  console.log(`
77467
- ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path20.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
77776
+ ${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("\\", "/"))}`)) : ""}
77468
77777
 
77469
77778
  `);
77470
77779
  console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
@@ -77496,10 +77805,10 @@ function createDelay({ clearTimeout: defaultClear, setTimeout: defaultSet } = {}
77496
77805
  signal.removeEventListener("abort", signalListener);
77497
77806
  }
77498
77807
  };
77499
- const delayPromise = new Promise((resolve8, reject) => {
77808
+ const delayPromise = new Promise((resolve9, reject) => {
77500
77809
  settle = () => {
77501
77810
  cleanup();
77502
- resolve8(value);
77811
+ resolve9(value);
77503
77812
  };
77504
77813
  rejectFunction = reject;
77505
77814
  timeoutId = (defaultSet ?? setTimeout)(settle, milliseconds);
@@ -77599,25 +77908,25 @@ var registerConfigPrint = (program3) => {
77599
77908
  };
77600
77909
 
77601
77910
  // cli/clone/register.ts
77602
- import * as fs23 from "node:fs";
77603
- import * as path23 from "node:path";
77911
+ import * as fs24 from "node:fs";
77912
+ import * as path24 from "node:path";
77604
77913
 
77605
77914
  // cli/clone/clone-bug-report.ts
77606
77915
  var import_jszip = __toESM2(require_lib4(), 1);
77607
- import * as fs22 from "node:fs";
77608
- import * as path22 from "node:path";
77916
+ import * as fs23 from "node:fs";
77917
+ import * as path23 from "node:path";
77609
77918
 
77610
77919
  // cli/clone/handle-existing-directory.ts
77611
77920
  var import_prompts6 = __toESM2(require_prompts3(), 1);
77612
- import * as fs21 from "node:fs";
77613
- import * as path21 from "node:path";
77921
+ import * as fs22 from "node:fs";
77922
+ import * as path22 from "node:path";
77614
77923
  var handleExistingDirectory = async (dirPath) => {
77615
- if (!fs21.existsSync(dirPath))
77924
+ if (!fs22.existsSync(dirPath))
77616
77925
  return;
77617
77926
  const response = await import_prompts6.default({
77618
77927
  type: "select",
77619
77928
  name: "action",
77620
- message: `Directory "${path21.basename(dirPath)}" already exists. What would you like to do?`,
77929
+ message: `Directory "${path22.basename(dirPath)}" already exists. What would you like to do?`,
77621
77930
  choices: [
77622
77931
  { title: "Merge files into existing directory", value: "merge" },
77623
77932
  {
@@ -77632,7 +77941,7 @@ var handleExistingDirectory = async (dirPath) => {
77632
77941
  process.exit(0);
77633
77942
  }
77634
77943
  if (response.action === "delete") {
77635
- fs21.rmSync(dirPath, { recursive: true, force: true });
77944
+ fs22.rmSync(dirPath, { recursive: true, force: true });
77636
77945
  console.log(`Deleted existing directory: ${dirPath}`);
77637
77946
  } else if (response.action === "merge") {
77638
77947
  console.log(`Merging files into existing directory: ${dirPath}`);
@@ -77658,12 +77967,12 @@ var getCommonDirectoryPrefix = (paths) => {
77658
77967
  return commonSegments.join("/");
77659
77968
  };
77660
77969
  var sanitizeRelativePath = (relativePath) => {
77661
- const normalizedPath = path22.normalize(relativePath);
77970
+ const normalizedPath = path23.normalize(relativePath);
77662
77971
  if (!normalizedPath)
77663
77972
  return null;
77664
- if (path22.isAbsolute(normalizedPath))
77973
+ if (path23.isAbsolute(normalizedPath))
77665
77974
  return null;
77666
- const segments = normalizedPath.split(path22.sep);
77975
+ const segments = normalizedPath.split(path23.sep);
77667
77976
  if (segments.some((segment) => segment === ".." || segment === "")) {
77668
77977
  return null;
77669
77978
  }
@@ -77678,7 +77987,7 @@ var cloneBugReport = async ({
77678
77987
  console.error("Bug report ID must not be empty.");
77679
77988
  process.exit(1);
77680
77989
  }
77681
- const dirPath = path22.resolve(`bug-report-${trimmedBugReportId}`);
77990
+ const dirPath = path23.resolve(`bug-report-${trimmedBugReportId}`);
77682
77991
  await handleExistingDirectory(dirPath);
77683
77992
  const ky2 = getRegistryApiKy();
77684
77993
  let zipBuffer;
@@ -77696,7 +78005,7 @@ var cloneBugReport = async ({
77696
78005
  }
77697
78006
  process.exit(1);
77698
78007
  }
77699
- fs22.mkdirSync(dirPath, { recursive: true });
78008
+ fs23.mkdirSync(dirPath, { recursive: true });
77700
78009
  const zip = await import_jszip.default.loadAsync(zipBuffer);
77701
78010
  const fileEntries = Object.entries(zip.files).filter(([, entry]) => !entry.dir);
77702
78011
  const commonPrefix = getCommonDirectoryPrefix(fileEntries.map(([fileName]) => fileName));
@@ -77708,15 +78017,15 @@ var cloneBugReport = async ({
77708
78017
  console.warn(`Skipping potentially unsafe path: ${fileName}`);
77709
78018
  continue;
77710
78019
  }
77711
- const fullPath = path22.join(dirPath, sanitizedRelativePath);
77712
- fs22.mkdirSync(path22.dirname(fullPath), { recursive: true });
78020
+ const fullPath = path23.join(dirPath, sanitizedRelativePath);
78021
+ fs23.mkdirSync(path23.dirname(fullPath), { recursive: true });
77713
78022
  const fileContent = await entry.async("nodebuffer");
77714
- fs22.writeFileSync(fullPath, fileContent);
78023
+ fs23.writeFileSync(fullPath, fileContent);
77715
78024
  }
77716
- fs22.writeFileSync(path22.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
78025
+ fs23.writeFileSync(path23.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
77717
78026
  generateTsConfig(dirPath);
77718
78027
  await setupTsciProject(dirPath);
77719
- const relativeDirPath = path22.relative(originalCwd, dirPath);
78028
+ const relativeDirPath = path23.relative(originalCwd, dirPath);
77720
78029
  console.log(kleur_default.green(`
77721
78030
  Successfully cloned bug report to:`));
77722
78031
  console.log(` ${dirPath}/
@@ -77755,7 +78064,7 @@ var registerClone = (program3) => {
77755
78064
  const [, author, packageName] = match;
77756
78065
  console.log(`Cloning ${author}/${packageName}...`);
77757
78066
  const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
77758
- const dirPath = userSettingToIncludeAuthor ? path23.resolve(`${author}.${packageName}`) : path23.resolve(packageName);
78067
+ const dirPath = userSettingToIncludeAuthor ? path24.resolve(`${author}.${packageName}`) : path24.resolve(packageName);
77759
78068
  await handleExistingDirectory(dirPath);
77760
78069
  const ky2 = getRegistryApiKy();
77761
78070
  let packageFileList = {
@@ -77776,13 +78085,13 @@ var registerClone = (program3) => {
77776
78085
  console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
77777
78086
  process.exit(1);
77778
78087
  }
77779
- fs23.mkdirSync(dirPath, { recursive: true });
78088
+ fs24.mkdirSync(dirPath, { recursive: true });
77780
78089
  for (const fileInfo of packageFileList.package_files) {
77781
78090
  const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
77782
78091
  if (!filePath)
77783
78092
  continue;
77784
- const fullPath = path23.join(dirPath, filePath);
77785
- fs23.mkdirSync(path23.dirname(fullPath), { recursive: true });
78093
+ const fullPath = path24.join(dirPath, filePath);
78094
+ fs24.mkdirSync(path24.dirname(fullPath), { recursive: true });
77786
78095
  try {
77787
78096
  const fileContent = await ky2.get("package_files/get", {
77788
78097
  searchParams: {
@@ -77791,15 +78100,15 @@ var registerClone = (program3) => {
77791
78100
  file_path: fileInfo.file_path
77792
78101
  }
77793
78102
  }).json();
77794
- fs23.writeFileSync(fullPath, fileContent.package_file.content_text);
78103
+ fs24.writeFileSync(fullPath, fileContent.package_file.content_text);
77795
78104
  } catch (error) {
77796
78105
  console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
77797
78106
  }
77798
78107
  }
77799
- fs23.writeFileSync(path23.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
78108
+ fs24.writeFileSync(path24.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
77800
78109
  generateTsConfig(dirPath);
77801
78110
  await setupTsciProject(dirPath);
77802
- const relativeDirPath = path23.relative(originalCwd, dirPath);
78111
+ const relativeDirPath = path24.relative(originalCwd, dirPath);
77803
78112
  console.log(kleur_default.green(`
77804
78113
  Successfully cloned to:`));
77805
78114
  console.log(` ${dirPath}/
@@ -77815,8 +78124,8 @@ Successfully cloned to:`));
77815
78124
  var import_perfect_cli = __toESM2(require_dist7(), 1);
77816
78125
 
77817
78126
  // lib/shared/export-snippet.ts
77818
- import fs25 from "node:fs";
77819
- import path25 from "node:path";
78127
+ import fs26 from "node:fs";
78128
+ import path26 from "node:path";
77820
78129
  import { promisify as promisify3 } from "node:util";
77821
78130
 
77822
78131
  // node_modules/circuit-json-to-readable-netlist/dist/index.js
@@ -78995,9 +79304,9 @@ var stringifyDsnJson = (dsnJson) => {
78995
79304
  const stringifyCoordinates = (coordinates) => {
78996
79305
  return coordinates.join(" ");
78997
79306
  };
78998
- const stringifyPath = (path24, level) => {
79307
+ const stringifyPath = (path25, level) => {
78999
79308
  const padding = indent.repeat(level);
79000
- return `${padding}(path ${path24.layer} ${path24.width} ${stringifyCoordinates(path24.coordinates)})`;
79309
+ return `${padding}(path ${path25.layer} ${path25.width} ${stringifyCoordinates(path25.coordinates)})`;
79001
79310
  };
79002
79311
  result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
79003
79312
  `;
@@ -82177,8 +82486,8 @@ var SymbolInstancesProject = class _SymbolInstancesProject extends SxClass {
82177
82486
  }
82178
82487
  getString() {
82179
82488
  const lines = [`(project ${quoteSExprString(this.name)}`];
82180
- for (const path24 of this.paths) {
82181
- lines.push(path24.getStringIndented());
82489
+ for (const path25 of this.paths) {
82490
+ lines.push(path25.getStringIndented());
82182
82491
  }
82183
82492
  lines.push(")");
82184
82493
  return lines.join(`
@@ -82200,11 +82509,11 @@ var SymbolInstancePath = class _SymbolInstancePath extends SxClass {
82200
82509
  static fromSexprPrimitives(primitiveSexprs) {
82201
82510
  const [pathPrimitive, ...rest] = primitiveSexprs;
82202
82511
  const value = toStringValue(pathPrimitive) ?? "";
82203
- const path24 = new _SymbolInstancePath(value);
82512
+ const path25 = new _SymbolInstancePath(value);
82204
82513
  const { propertyMap } = SxClass.parsePrimitivesToClassProperties(rest, this.token);
82205
- path24._sxReference = propertyMap.reference;
82206
- path24._sxUnit = propertyMap.unit;
82207
- return path24;
82514
+ path25._sxReference = propertyMap.reference;
82515
+ path25._sxUnit = propertyMap.unit;
82516
+ return path25;
82208
82517
  }
82209
82518
  get reference() {
82210
82519
  return this._sxReference?.value;
@@ -83251,8 +83560,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
83251
83560
  if (value === undefined) {
83252
83561
  throw new Error("sheet_instances path requires a string identifier");
83253
83562
  }
83254
- const path24 = new _SheetInstancesRootPath;
83255
- path24._value = value;
83563
+ const path25 = new _SheetInstancesRootPath;
83564
+ path25._value = value;
83256
83565
  const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_instances_path");
83257
83566
  const unsupportedSingularTokens = Object.keys(propertyMap).filter((token) => !SUPPORTED_ARRAY_TOKENS2.has(token));
83258
83567
  if (unsupportedSingularTokens.length > 0) {
@@ -83266,8 +83575,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
83266
83575
  if (!pages.length && propertyMap.page) {
83267
83576
  pages.push(propertyMap.page);
83268
83577
  }
83269
- path24._pages = pages;
83270
- return path24;
83578
+ path25._pages = pages;
83579
+ return path25;
83271
83580
  }
83272
83581
  get value() {
83273
83582
  return this._value;
@@ -83415,8 +83724,8 @@ var SheetInstancesProject = class _SheetInstancesProject extends SxClass {
83415
83724
  }
83416
83725
  getString() {
83417
83726
  const lines = [`(project ${quoteSExprString(this.name)}`];
83418
- for (const path24 of this.paths) {
83419
- lines.push(path24.getStringIndented());
83727
+ for (const path25 of this.paths) {
83728
+ lines.push(path25.getStringIndented());
83420
83729
  }
83421
83730
  lines.push(")");
83422
83731
  return lines.join(`
@@ -83440,10 +83749,10 @@ var SheetInstancePath = class _SheetInstancePath extends SxClass {
83440
83749
  if (value === undefined) {
83441
83750
  throw new Error("sheet instance path value must be a string");
83442
83751
  }
83443
- const path24 = new _SheetInstancePath(value);
83752
+ const path25 = new _SheetInstancePath(value);
83444
83753
  const { arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_path");
83445
- path24.pages = arrayPropertyMap.page ?? [];
83446
- return path24;
83754
+ path25.pages = arrayPropertyMap.page ?? [];
83755
+ return path25;
83447
83756
  }
83448
83757
  getChildren() {
83449
83758
  return [...this.pages];
@@ -88681,20 +88990,20 @@ var FootprintModel = class _FootprintModel extends SxClass {
88681
88990
  _offset;
88682
88991
  _scale;
88683
88992
  _rotate;
88684
- constructor(path24) {
88993
+ constructor(path25) {
88685
88994
  super();
88686
- this._path = path24;
88995
+ this._path = path25;
88687
88996
  }
88688
88997
  static fromSexprPrimitives(primitiveSexprs) {
88689
88998
  if (primitiveSexprs.length === 0) {
88690
88999
  throw new Error("model requires a path argument");
88691
89000
  }
88692
89001
  const [rawPath, ...rest] = primitiveSexprs;
88693
- const path24 = toStringValue(rawPath);
88694
- if (path24 === undefined) {
89002
+ const path25 = toStringValue(rawPath);
89003
+ if (path25 === undefined) {
88695
89004
  throw new Error("model path must be a string value");
88696
89005
  }
88697
- const model = new _FootprintModel(path24);
89006
+ const model = new _FootprintModel(path25);
88698
89007
  for (const primitive of rest) {
88699
89008
  if (!Array.isArray(primitive) || primitive.length === 0) {
88700
89009
  throw new Error(`model encountered invalid child expression: ${JSON.stringify(primitive)}`);
@@ -92912,6 +93221,9 @@ var KicadPcb = class _KicadPcb extends SxClass {
92912
93221
  }
92913
93222
  };
92914
93223
  SxClass.register(KicadPcb);
93224
+ var parseKicadSexpr = (sexpr) => {
93225
+ return SxClass.parse(sexpr);
93226
+ };
92915
93227
 
92916
93228
  // node_modules/circuit-json-to-kicad/dist/index.js
92917
93229
  import { cju } from "@tscircuit/circuit-json-util";
@@ -93379,10 +93691,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
93379
93691
  }
93380
93692
  const instances = new SymbolInstances;
93381
93693
  const project = new SymbolInstancesProject("");
93382
- const path24 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
93383
- path24.reference = reference;
93384
- path24.unit = 1;
93385
- project.paths.push(path24);
93694
+ const path25 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
93695
+ path25.reference = reference;
93696
+ path25.unit = 1;
93697
+ project.paths.push(path25);
93386
93698
  instances.projects.push(project);
93387
93699
  symbol._sxInstances = instances;
93388
93700
  symbols3.push(symbol);
@@ -93590,11 +93902,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
93590
93902
  throw new Error("KicadSch instance not initialized in context");
93591
93903
  }
93592
93904
  const sheetInstances = new SheetInstances;
93593
- const path24 = new SheetInstancesRootPath;
93594
- path24.value = "/";
93905
+ const path25 = new SheetInstancesRootPath;
93906
+ path25.value = "/";
93595
93907
  const page = new SheetInstancesRootPage("1");
93596
- path24.pages = [page];
93597
- sheetInstances.paths = [path24];
93908
+ path25.pages = [page];
93909
+ sheetInstances.paths = [path25];
93598
93910
  kicadSch.sheetInstances = sheetInstances;
93599
93911
  kicadSch.embeddedFonts = new EmbeddedFonts(false);
93600
93912
  this.finished = true;
@@ -93949,12 +94261,12 @@ var AddGraphicsStage = class extends ConverterStage {
93949
94261
  throw new Error("PCB transformation matrix not initialized in context");
93950
94262
  }
93951
94263
  const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
93952
- for (const path24 of pcbSilkscreenPaths) {
93953
- if (!path24.route || path24.route.length < 2)
94264
+ for (const path25 of pcbSilkscreenPaths) {
94265
+ if (!path25.route || path25.route.length < 2)
93954
94266
  continue;
93955
- for (let i = 0;i < path24.route.length - 1; i++) {
93956
- const startPoint = path24.route[i];
93957
- const endPoint = path24.route[i + 1];
94267
+ for (let i = 0;i < path25.route.length - 1; i++) {
94268
+ const startPoint = path25.route[i];
94269
+ const endPoint = path25.route[i + 1];
93958
94270
  if (!startPoint || !endPoint)
93959
94271
  continue;
93960
94272
  const transformedStart = applyToPoint62(c2kMatPcb, {
@@ -93969,12 +94281,12 @@ var AddGraphicsStage = class extends ConverterStage {
93969
94281
  top: "F.SilkS",
93970
94282
  bottom: "B.SilkS"
93971
94283
  };
93972
- const kicadLayer = layerMap[path24.layer] || path24.layer || "F.SilkS";
94284
+ const kicadLayer = layerMap[path25.layer] || path25.layer || "F.SilkS";
93973
94285
  const grLine = new GrLine({
93974
94286
  start: { x: transformedStart.x, y: transformedStart.y },
93975
94287
  end: { x: transformedEnd.x, y: transformedEnd.y },
93976
94288
  layer: kicadLayer,
93977
- width: path24.stroke_width || 0.15
94289
+ width: path25.stroke_width || 0.15
93978
94290
  });
93979
94291
  const graphicLines = kicadPcb.graphicLines;
93980
94292
  graphicLines.push(grLine);
@@ -94082,8 +94394,8 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
94082
94394
 
94083
94395
  // lib/shared/generate-circuit-json.tsx
94084
94396
  var import_make_vfs2 = __toESM2(require_dist8(), 1);
94085
- import path24 from "node:path";
94086
- import fs24 from "node:fs";
94397
+ import path25 from "node:path";
94398
+ import fs25 from "node:fs";
94087
94399
  import { pathToFileURL } from "node:url";
94088
94400
  import Debug11 from "debug";
94089
94401
 
@@ -94102,10 +94414,10 @@ var abbreviateStringifyObject = (obj) => {
94102
94414
  };
94103
94415
 
94104
94416
  // lib/shared/importFromUserLand.ts
94105
- import { resolve as resolve10 } from "node:path";
94417
+ import { resolve as resolve11 } from "node:path";
94106
94418
  async function importFromUserLand(moduleName) {
94107
94419
  try {
94108
- const resolvedPath = import.meta.resolve(moduleName, resolve10(process.cwd(), "dummy.js"));
94420
+ const resolvedPath = import.meta.resolve(moduleName, resolve11(process.cwd(), "dummy.js"));
94109
94421
  return await import(resolvedPath);
94110
94422
  } catch (error) {
94111
94423
  try {
@@ -94145,12 +94457,12 @@ async function generateCircuitJson({
94145
94457
  const runner = new userLandTscircuit.RootCircuit({
94146
94458
  platform: platformConfig
94147
94459
  });
94148
- const absoluteFilePath = path24.isAbsolute(filePath) ? filePath : path24.resolve(process.cwd(), filePath);
94149
- const projectDir = path24.dirname(absoluteFilePath);
94460
+ const absoluteFilePath = path25.isAbsolute(filePath) ? filePath : path25.resolve(process.cwd(), filePath);
94461
+ const projectDir = path25.dirname(absoluteFilePath);
94150
94462
  const resolvedOutputDir = outputDir ?? projectDir;
94151
- const relativeComponentPath = path24.relative(projectDir, absoluteFilePath);
94152
- const baseFileName = outputFileName || path24.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
94153
- const outputPath = path24.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
94463
+ const relativeComponentPath = path25.relative(projectDir, absoluteFilePath);
94464
+ const baseFileName = outputFileName || path25.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
94465
+ const outputPath = path25.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
94154
94466
  debug11(`Project directory: ${projectDir}`);
94155
94467
  debug11(`Relative component path: ${relativeComponentPath}`);
94156
94468
  debug11(`Output path: ${outputPath}`);
@@ -94167,7 +94479,7 @@ async function generateCircuitJson({
94167
94479
  return false;
94168
94480
  if (normalizedFilePath.match(/^\.[^/]/))
94169
94481
  return false;
94170
- if (!ALLOWED_FILE_EXTENSIONS.includes(path24.extname(normalizedFilePath)))
94482
+ if (!ALLOWED_FILE_EXTENSIONS.includes(path25.extname(normalizedFilePath)))
94171
94483
  return false;
94172
94484
  return true;
94173
94485
  },
@@ -94185,7 +94497,7 @@ async function generateCircuitJson({
94185
94497
  const circuitJson = await runner.getCircuitJson();
94186
94498
  if (saveToFile) {
94187
94499
  debug11(`Saving circuit JSON to ${outputPath}`);
94188
- fs24.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
94500
+ fs25.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
94189
94501
  }
94190
94502
  return {
94191
94503
  circuitJson,
@@ -94194,7 +94506,7 @@ async function generateCircuitJson({
94194
94506
  }
94195
94507
 
94196
94508
  // lib/shared/export-snippet.ts
94197
- var writeFileAsync = promisify3(fs25.writeFile);
94509
+ var writeFileAsync = promisify3(fs26.writeFile);
94198
94510
  var ALLOWED_FORMATS = [
94199
94511
  "json",
94200
94512
  "circuit-json",
@@ -94237,10 +94549,10 @@ var exportSnippet = async ({
94237
94549
  onError(`Invalid format: ${format}`);
94238
94550
  return onExit(1);
94239
94551
  }
94240
- const projectDir = path25.dirname(filePath);
94241
- const outputBaseName = path25.basename(filePath).replace(/\.[^.]+$/, "");
94552
+ const projectDir = path26.dirname(filePath);
94553
+ const outputBaseName = path26.basename(filePath).replace(/\.[^.]+$/, "");
94242
94554
  const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
94243
- const outputDestination = path25.join(projectDir, outputPath ?? outputFileName);
94555
+ const outputDestination = path26.join(projectDir, outputPath ?? outputFileName);
94244
94556
  const circuitData = await generateCircuitJson({
94245
94557
  filePath,
94246
94558
  saveToFile: format === "circuit-json",
@@ -94424,20 +94736,20 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
94424
94736
  };
94425
94737
 
94426
94738
  // lib/eecircuit-engine/run-simulation.ts
94427
- import { promises as fs26, existsSync as existsSync9 } from "node:fs";
94428
- import path26 from "node:path";
94739
+ import { promises as fs27, existsSync as existsSync10 } from "node:fs";
94740
+ import path27 from "node:path";
94429
94741
  import os2 from "node:os";
94430
94742
  var sim = null;
94431
94743
  var fetchSimulation = async () => {
94432
- const tempFilePath = path26.join(os2.tmpdir(), "eecircuit-engine-1.5.2.mjs");
94433
- if (!existsSync9(tempFilePath)) {
94744
+ const tempFilePath = path27.join(os2.tmpdir(), "eecircuit-engine-1.5.2.mjs");
94745
+ if (!existsSync10(tempFilePath)) {
94434
94746
  const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
94435
94747
  const response = await fetch(url);
94436
94748
  if (!response.ok) {
94437
94749
  throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
94438
94750
  }
94439
94751
  const scriptContent = await response.text();
94440
- await fs26.writeFile(tempFilePath, scriptContent);
94752
+ await fs27.writeFile(tempFilePath, scriptContent);
94441
94753
  }
94442
94754
  const module2 = await import(tempFilePath);
94443
94755
  return module2.Simulation;
@@ -94464,7 +94776,7 @@ var initializeSimulation = async () => {
94464
94776
  }
94465
94777
  throw new Error("Simulation engine initialization timed out.");
94466
94778
  }
94467
- await new Promise((resolve11) => setTimeout(resolve11, 200));
94779
+ await new Promise((resolve12) => setTimeout(resolve12, 200));
94468
94780
  }
94469
94781
  };
94470
94782
  var runSimulation = async (spiceString) => {
@@ -94526,8 +94838,8 @@ var resultToCsv = (result) => {
94526
94838
  };
94527
94839
 
94528
94840
  // cli/export/register.ts
94529
- import path27 from "node:path";
94530
- import { promises as fs27 } from "node:fs";
94841
+ import path28 from "node:path";
94842
+ import { promises as fs28 } from "node:fs";
94531
94843
  var registerExport = (program3) => {
94532
94844
  program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", "Output format").option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
94533
94845
  const formatOption = options.format ?? "json";
@@ -94539,12 +94851,12 @@ var registerExport = (program3) => {
94539
94851
  });
94540
94852
  if (circuitJson) {
94541
94853
  const spiceString = getSpiceWithPaddedSim(circuitJson);
94542
- const outputSpicePath = options.output ?? path27.join(path27.dirname(file), `${path27.basename(file, path27.extname(file))}.spice.cir`);
94543
- await fs27.writeFile(outputSpicePath, spiceString);
94854
+ const outputSpicePath = options.output ?? path28.join(path28.dirname(file), `${path28.basename(file, path28.extname(file))}.spice.cir`);
94855
+ await fs28.writeFile(outputSpicePath, spiceString);
94544
94856
  const { result } = await runSimulation(spiceString);
94545
94857
  const csvContent = resultToCsv(result);
94546
94858
  const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
94547
- await fs27.writeFile(outputCsvPath, csvContent);
94859
+ await fs28.writeFile(outputCsvPath, csvContent);
94548
94860
  console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
94549
94861
  }
94550
94862
  return;
@@ -94776,14 +95088,14 @@ class KeyStore {
94776
95088
  }
94777
95089
  }
94778
95090
  function createKey(key) {
94779
- let path28 = null;
95091
+ let path29 = null;
94780
95092
  let id = null;
94781
95093
  let src = null;
94782
95094
  let weight = 1;
94783
95095
  let getFn = null;
94784
95096
  if (isString2(key) || isArray(key)) {
94785
95097
  src = key;
94786
- path28 = createKeyPath(key);
95098
+ path29 = createKeyPath(key);
94787
95099
  id = createKeyId(key);
94788
95100
  } else {
94789
95101
  if (!hasOwn.call(key, "name")) {
@@ -94797,11 +95109,11 @@ function createKey(key) {
94797
95109
  throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
94798
95110
  }
94799
95111
  }
94800
- path28 = createKeyPath(name);
95112
+ path29 = createKeyPath(name);
94801
95113
  id = createKeyId(name);
94802
95114
  getFn = key.getFn;
94803
95115
  }
94804
- return { path: path28, id, weight, src, getFn };
95116
+ return { path: path29, id, weight, src, getFn };
94805
95117
  }
94806
95118
  function createKeyPath(key) {
94807
95119
  return isArray(key) ? key : key.split(".");
@@ -94809,34 +95121,34 @@ function createKeyPath(key) {
94809
95121
  function createKeyId(key) {
94810
95122
  return isArray(key) ? key.join(".") : key;
94811
95123
  }
94812
- function get(obj, path28) {
95124
+ function get(obj, path29) {
94813
95125
  let list = [];
94814
95126
  let arr = false;
94815
- const deepGet = (obj2, path29, index) => {
95127
+ const deepGet = (obj2, path30, index) => {
94816
95128
  if (!isDefined(obj2)) {
94817
95129
  return;
94818
95130
  }
94819
- if (!path29[index]) {
95131
+ if (!path30[index]) {
94820
95132
  list.push(obj2);
94821
95133
  } else {
94822
- let key = path29[index];
95134
+ let key = path30[index];
94823
95135
  const value = obj2[key];
94824
95136
  if (!isDefined(value)) {
94825
95137
  return;
94826
95138
  }
94827
- if (index === path29.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
95139
+ if (index === path30.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
94828
95140
  list.push(toString(value));
94829
95141
  } else if (isArray(value)) {
94830
95142
  arr = true;
94831
95143
  for (let i = 0, len = value.length;i < len; i += 1) {
94832
- deepGet(value[i], path29, index + 1);
95144
+ deepGet(value[i], path30, index + 1);
94833
95145
  }
94834
- } else if (path29.length) {
94835
- deepGet(value, path29, index + 1);
95146
+ } else if (path30.length) {
95147
+ deepGet(value, path30, index + 1);
94836
95148
  }
94837
95149
  }
94838
95150
  };
94839
- deepGet(obj, isString2(path28) ? path28.split(".") : path28, 0);
95151
+ deepGet(obj, isString2(path29) ? path29.split(".") : path29, 0);
94840
95152
  return arr ? list : list[0];
94841
95153
  }
94842
95154
  var MatchOptions = {
@@ -96028,8 +96340,8 @@ var registerSearch = (program3) => {
96028
96340
  }
96029
96341
  if (kicadResults.length) {
96030
96342
  console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
96031
- kicadResults.forEach((path28, idx) => {
96032
- console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path28.replace(".kicad_mod", "").replace(".pretty", "")}`);
96343
+ kicadResults.forEach((path29, idx) => {
96344
+ console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path29.replace(".kicad_mod", "").replace(".pretty", "")}`);
96033
96345
  });
96034
96346
  }
96035
96347
  if (!onlyKicad && results.packages.length) {
@@ -96912,10 +97224,10 @@ var require_svgson_umd = __commonJS2({
96912
97224
  for (var _len = arguments.length, args = new Array(_len), _key = 0;_key < _len; _key++) {
96913
97225
  args[_key] = arguments[_key];
96914
97226
  }
96915
- return new Promise(function(resolve11, reject) {
97227
+ return new Promise(function(resolve12, reject) {
96916
97228
  try {
96917
97229
  var res = svgsonSync.apply(undefined, args);
96918
- resolve11(res);
97230
+ resolve12(res);
96919
97231
  } catch (e3) {
96920
97232
  reject(e3);
96921
97233
  }
@@ -101175,8 +101487,8 @@ Vo.x = 0.35;
101175
101487
  Vo.anchor = "middle_left";
101176
101488
  var Qx = Hx;
101177
101489
  var Kx = { paths: { path11: { type: "path", points: [{ x: -0.39, y: -0.1 }, { x: 0.05, y: -0.11 }], color: "primary", fill: false }, "path12-1": { type: "path", points: [{ x: 0.3, y: 0.53 }, { x: 0.3, y: 0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.31, y: -0.53 }, { x: 0.31, y: -0.01 }], color: "primary", fill: false }, path2: { type: "path", points: [{ x: 0.09, y: 0.11 }, { x: 0.31, y: 0.11 }], color: "primary", fill: false }, "path2-8-3-7": { type: "path", points: [{ x: 0.09, y: 0.15 }, { x: 0.09, y: 0.07 }], color: "primary", fill: false }, "path2-5": { type: "path", points: [{ x: 0.09, y: -0.1 }, { x: 0.31, y: -0.1 }], color: "primary", fill: false }, "path2-8-3": { type: "path", points: [{ x: 0.09, y: -0.08 }, { x: 0.09, y: -0.15 }], color: "primary", fill: false }, "path2-8-3-2": { type: "path", points: [{ x: 0.09, y: 0.03 }, { x: 0.09, y: -0.04 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: 0.27, y: -0.04 }, { x: 0.27, y: 0.03 }, { x: 0.2, y: 0 }, { x: 0.27, y: -0.04 }], color: "primary", fill: true }, "path2-0": { type: "path", points: [{ x: 0.09, y: 0 }, { x: 0.31, y: -0.01 }], color: "primary", fill: false }, "path12-1-0": { type: "path", points: [{ x: 0.05, y: 0.11 }, { x: 0.05, y: -0.11 }], color: "primary", fill: false } }, texts: { top1: { type: "text", text: "{REF}", x: -0.13, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: 0.06, y: -0.42 } }, refblocks: { top1: { x: 0.3, y: 0.55 }, bottom1: { x: 0.31, y: -0.55 }, left1: { x: -0.42, y: -0.1 } }, bounds: { minX: -0.45, maxX: 0.45, minY: -0.58, maxY: 0.58, width: 0.89, height: 1.16, centerX: 0, centerY: 0 }, circles: { path1: { type: "circle", x: 0.16, y: 0, radius: 0.29, color: "primary", fill: false } } };
101178
- var { paths: bd, texts: ts3, bounds: Ze, refblocks: jo, circles: _d } = Kx;
101179
- var Qe = s({ primitives: [...Object.values(bd), ...Object.values(_d), { ...ts3.top1, anchor: "middle_right", x: 0 }, { ...ts3.bottom1, anchor: "middle_right", x: 0 }], ports: [{ ...jo.top1, labels: ["1", "drain"] }, { ...jo.bottom1, labels: ["2", "source"] }, { ...jo.left1, labels: ["3", "gate"] }], size: { width: Ze.width, height: Ze.height }, center: { x: Ze.centerX, y: Ze.centerY } });
101490
+ var { paths: bd, texts: ts4, bounds: Ze, refblocks: jo, circles: _d } = Kx;
101491
+ var Qe = s({ primitives: [...Object.values(bd), ...Object.values(_d), { ...ts4.top1, anchor: "middle_right", x: 0 }, { ...ts4.bottom1, anchor: "middle_right", x: 0 }], ports: [{ ...jo.top1, labels: ["1", "drain"] }, { ...jo.bottom1, labels: ["2", "source"] }, { ...jo.left1, labels: ["3", "gate"] }], size: { width: Ze.width, height: Ze.height }, center: { x: Ze.centerX, y: Ze.centerY } });
101180
101492
  var es = r(Qe);
101181
101493
  var rs = es.primitives.filter((t2) => t2.type === "text");
101182
101494
  var ko = rs.find((t2) => t2.text === "{VAL}");
@@ -101207,7 +101519,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
101207
101519
  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();
101208
101520
  var ms = r(U, "down");
101209
101521
  var ns = r(U, "left");
101210
- var fs28 = r(U, "up");
101522
+ var fs29 = r(U, "up");
101211
101523
  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 } } };
101212
101524
  var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
101213
101525
  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();
@@ -101776,7 +102088,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
101776
102088
  sb.anchor = "middle_left";
101777
102089
  mb.anchor = "middle_right";
101778
102090
  var B1 = Cl;
101779
- 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: fs28, 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 };
102091
+ 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 };
101780
102092
  var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
101781
102093
  function doesLineIntersectLine([a12, a22], [b12, b22], {
101782
102094
  lineThickness = 0
@@ -103076,14 +103388,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
103076
103388
  prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
103077
103389
  actScopeDepth = prevActScopeDepth;
103078
103390
  }
103079
- function recursivelyFlushAsyncActWork(returnValue, resolve11, reject) {
103391
+ function recursivelyFlushAsyncActWork(returnValue, resolve12, reject) {
103080
103392
  var queue = ReactSharedInternals.actQueue;
103081
103393
  if (queue !== null)
103082
103394
  if (queue.length !== 0)
103083
103395
  try {
103084
103396
  flushActQueue(queue);
103085
103397
  enqueueTask(function() {
103086
- return recursivelyFlushAsyncActWork(returnValue, resolve11, reject);
103398
+ return recursivelyFlushAsyncActWork(returnValue, resolve12, reject);
103087
103399
  });
103088
103400
  return;
103089
103401
  } catch (error) {
@@ -103091,7 +103403,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
103091
103403
  }
103092
103404
  else
103093
103405
  ReactSharedInternals.actQueue = null;
103094
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve11(returnValue);
103406
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve12(returnValue);
103095
103407
  }
103096
103408
  function flushActQueue(queue) {
103097
103409
  if (!isFlushing) {
@@ -103267,14 +103579,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
103267
103579
  didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
103268
103580
  });
103269
103581
  return {
103270
- then: function(resolve11, reject) {
103582
+ then: function(resolve12, reject) {
103271
103583
  didAwaitActCall = true;
103272
103584
  thenable.then(function(returnValue) {
103273
103585
  popActScope(prevActQueue, prevActScopeDepth);
103274
103586
  if (prevActScopeDepth === 0) {
103275
103587
  try {
103276
103588
  flushActQueue(queue), enqueueTask(function() {
103277
- return recursivelyFlushAsyncActWork(returnValue, resolve11, reject);
103589
+ return recursivelyFlushAsyncActWork(returnValue, resolve12, reject);
103278
103590
  });
103279
103591
  } catch (error$0) {
103280
103592
  ReactSharedInternals.thrownErrors.push(error$0);
@@ -103285,7 +103597,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
103285
103597
  reject(_thrownError);
103286
103598
  }
103287
103599
  } else
103288
- resolve11(returnValue);
103600
+ resolve12(returnValue);
103289
103601
  }, function(error) {
103290
103602
  popActScope(prevActQueue, prevActScopeDepth);
103291
103603
  0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
@@ -103301,11 +103613,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
103301
103613
  if (0 < ReactSharedInternals.thrownErrors.length)
103302
103614
  throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
103303
103615
  return {
103304
- then: function(resolve11, reject) {
103616
+ then: function(resolve12, reject) {
103305
103617
  didAwaitActCall = true;
103306
103618
  prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
103307
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve11, reject);
103308
- })) : resolve11(returnValue$jscomp$0);
103619
+ return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve12, reject);
103620
+ })) : resolve12(returnValue$jscomp$0);
103309
103621
  }
103310
103622
  };
103311
103623
  };
@@ -103806,11 +104118,11 @@ var require_react_reconciler_development = __commonJS2({
103806
104118
  fiber = fiber.next, id2--;
103807
104119
  return fiber;
103808
104120
  }
103809
- function copyWithSetImpl(obj, path28, index, value) {
103810
- if (index >= path28.length)
104121
+ function copyWithSetImpl(obj, path29, index, value) {
104122
+ if (index >= path29.length)
103811
104123
  return value;
103812
- var key = path28[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
103813
- updated[key] = copyWithSetImpl(obj[key], path28, index + 1, value);
104124
+ var key = path29[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
104125
+ updated[key] = copyWithSetImpl(obj[key], path29, index + 1, value);
103814
104126
  return updated;
103815
104127
  }
103816
104128
  function copyWithRename(obj, oldPath, newPath) {
@@ -103830,11 +104142,11 @@ var require_react_reconciler_development = __commonJS2({
103830
104142
  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);
103831
104143
  return updated;
103832
104144
  }
103833
- function copyWithDeleteImpl(obj, path28, index) {
103834
- var key = path28[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
103835
- if (index + 1 === path28.length)
104145
+ function copyWithDeleteImpl(obj, path29, index) {
104146
+ var key = path29[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
104147
+ if (index + 1 === path29.length)
103836
104148
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
103837
- updated[key] = copyWithDeleteImpl(obj[key], path28, index + 1);
104149
+ updated[key] = copyWithDeleteImpl(obj[key], path29, index + 1);
103838
104150
  return updated;
103839
104151
  }
103840
104152
  function shouldSuspendImpl() {
@@ -105546,8 +105858,8 @@ It can also happen if the client has a browser extension installed which messes
105546
105858
  currentEntangledActionThenable = {
105547
105859
  status: "pending",
105548
105860
  value: undefined,
105549
- then: function(resolve11) {
105550
- entangledListeners.push(resolve11);
105861
+ then: function(resolve12) {
105862
+ entangledListeners.push(resolve12);
105551
105863
  }
105552
105864
  };
105553
105865
  }
@@ -105571,8 +105883,8 @@ It can also happen if the client has a browser extension installed which messes
105571
105883
  status: "pending",
105572
105884
  value: null,
105573
105885
  reason: null,
105574
- then: function(resolve11) {
105575
- listeners.push(resolve11);
105886
+ then: function(resolve12) {
105887
+ listeners.push(resolve12);
105576
105888
  }
105577
105889
  };
105578
105890
  thenable.then(function() {
@@ -112865,29 +113177,29 @@ Check the top-level render call using <` + componentName2 + ">.");
112865
113177
  var didWarnAboutNestedUpdates = false;
112866
113178
  var didWarnAboutFindNodeInStrictMode = {};
112867
113179
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
112868
- overrideHookState = function(fiber, id2, path28, value) {
113180
+ overrideHookState = function(fiber, id2, path29, value) {
112869
113181
  id2 = findHook(fiber, id2);
112870
- id2 !== null && (path28 = copyWithSetImpl(id2.memoizedState, path28, 0, value), id2.memoizedState = path28, id2.baseState = path28, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path28 = enqueueConcurrentRenderForLane(fiber, 2), path28 !== null && scheduleUpdateOnFiber(path28, fiber, 2));
113182
+ 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));
112871
113183
  };
112872
- overrideHookStateDeletePath = function(fiber, id2, path28) {
113184
+ overrideHookStateDeletePath = function(fiber, id2, path29) {
112873
113185
  id2 = findHook(fiber, id2);
112874
- id2 !== null && (path28 = copyWithDeleteImpl(id2.memoizedState, path28, 0), id2.memoizedState = path28, id2.baseState = path28, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path28 = enqueueConcurrentRenderForLane(fiber, 2), path28 !== null && scheduleUpdateOnFiber(path28, fiber, 2));
113186
+ 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));
112875
113187
  };
112876
113188
  overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
112877
113189
  id2 = findHook(fiber, id2);
112878
113190
  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));
112879
113191
  };
112880
- overrideProps = function(fiber, path28, value) {
112881
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path28, 0, value);
113192
+ overrideProps = function(fiber, path29, value) {
113193
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path29, 0, value);
112882
113194
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
112883
- path28 = enqueueConcurrentRenderForLane(fiber, 2);
112884
- path28 !== null && scheduleUpdateOnFiber(path28, fiber, 2);
113195
+ path29 = enqueueConcurrentRenderForLane(fiber, 2);
113196
+ path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2);
112885
113197
  };
112886
- overridePropsDeletePath = function(fiber, path28) {
112887
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path28, 0);
113198
+ overridePropsDeletePath = function(fiber, path29) {
113199
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path29, 0);
112888
113200
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
112889
- path28 = enqueueConcurrentRenderForLane(fiber, 2);
112890
- path28 !== null && scheduleUpdateOnFiber(path28, fiber, 2);
113201
+ path29 = enqueueConcurrentRenderForLane(fiber, 2);
113202
+ path29 !== null && scheduleUpdateOnFiber(path29, fiber, 2);
112891
113203
  };
112892
113204
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
112893
113205
  fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
@@ -128224,10 +128536,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128224
128536
  var setErrorHandler = null;
128225
128537
  var setSuspenseHandler = null;
128226
128538
  {
128227
- var copyWithDeleteImpl = function(obj, path28, index2) {
128228
- var key = path28[index2];
128539
+ var copyWithDeleteImpl = function(obj, path29, index2) {
128540
+ var key = path29[index2];
128229
128541
  var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
128230
- if (index2 + 1 === path28.length) {
128542
+ if (index2 + 1 === path29.length) {
128231
128543
  if (isArray2(updated)) {
128232
128544
  updated.splice(key, 1);
128233
128545
  } else {
@@ -128235,11 +128547,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128235
128547
  }
128236
128548
  return updated;
128237
128549
  }
128238
- updated[key] = copyWithDeleteImpl(obj[key], path28, index2 + 1);
128550
+ updated[key] = copyWithDeleteImpl(obj[key], path29, index2 + 1);
128239
128551
  return updated;
128240
128552
  };
128241
- var copyWithDelete = function(obj, path28) {
128242
- return copyWithDeleteImpl(obj, path28, 0);
128553
+ var copyWithDelete = function(obj, path29) {
128554
+ return copyWithDeleteImpl(obj, path29, 0);
128243
128555
  };
128244
128556
  var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
128245
128557
  var oldKey = oldPath[index2];
@@ -128271,17 +128583,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128271
128583
  }
128272
128584
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
128273
128585
  };
128274
- var copyWithSetImpl = function(obj, path28, index2, value) {
128275
- if (index2 >= path28.length) {
128586
+ var copyWithSetImpl = function(obj, path29, index2, value) {
128587
+ if (index2 >= path29.length) {
128276
128588
  return value;
128277
128589
  }
128278
- var key = path28[index2];
128590
+ var key = path29[index2];
128279
128591
  var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
128280
- updated[key] = copyWithSetImpl(obj[key], path28, index2 + 1, value);
128592
+ updated[key] = copyWithSetImpl(obj[key], path29, index2 + 1, value);
128281
128593
  return updated;
128282
128594
  };
128283
- var copyWithSet = function(obj, path28, value) {
128284
- return copyWithSetImpl(obj, path28, 0, value);
128595
+ var copyWithSet = function(obj, path29, value) {
128596
+ return copyWithSetImpl(obj, path29, 0, value);
128285
128597
  };
128286
128598
  var findHook = function(fiber, id2) {
128287
128599
  var currentHook2 = fiber.memoizedState;
@@ -128291,10 +128603,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128291
128603
  }
128292
128604
  return currentHook2;
128293
128605
  };
128294
- overrideHookState = function(fiber, id2, path28, value) {
128606
+ overrideHookState = function(fiber, id2, path29, value) {
128295
128607
  var hook = findHook(fiber, id2);
128296
128608
  if (hook !== null) {
128297
- var newState = copyWithSet(hook.memoizedState, path28, value);
128609
+ var newState = copyWithSet(hook.memoizedState, path29, value);
128298
128610
  hook.memoizedState = newState;
128299
128611
  hook.baseState = newState;
128300
128612
  fiber.memoizedProps = assign2({}, fiber.memoizedProps);
@@ -128304,10 +128616,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128304
128616
  }
128305
128617
  }
128306
128618
  };
128307
- overrideHookStateDeletePath = function(fiber, id2, path28) {
128619
+ overrideHookStateDeletePath = function(fiber, id2, path29) {
128308
128620
  var hook = findHook(fiber, id2);
128309
128621
  if (hook !== null) {
128310
- var newState = copyWithDelete(hook.memoizedState, path28);
128622
+ var newState = copyWithDelete(hook.memoizedState, path29);
128311
128623
  hook.memoizedState = newState;
128312
128624
  hook.baseState = newState;
128313
128625
  fiber.memoizedProps = assign2({}, fiber.memoizedProps);
@@ -128330,8 +128642,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128330
128642
  }
128331
128643
  }
128332
128644
  };
128333
- overrideProps = function(fiber, path28, value) {
128334
- fiber.pendingProps = copyWithSet(fiber.memoizedProps, path28, value);
128645
+ overrideProps = function(fiber, path29, value) {
128646
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path29, value);
128335
128647
  if (fiber.alternate) {
128336
128648
  fiber.alternate.pendingProps = fiber.pendingProps;
128337
128649
  }
@@ -128340,8 +128652,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
128340
128652
  scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
128341
128653
  }
128342
128654
  };
128343
- overridePropsDeletePath = function(fiber, path28) {
128344
- fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path28);
128655
+ overridePropsDeletePath = function(fiber, path29) {
128656
+ fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path29);
128345
128657
  if (fiber.alternate) {
128346
128658
  fiber.alternate.pendingProps = fiber.pendingProps;
128347
128659
  }
@@ -134392,7 +134704,7 @@ var parsePin = (pinString) => {
134392
134704
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
134393
134705
  const labelColor = colorMatch ? colorMatch[0] : "";
134394
134706
  const pathMatch = pinString.match(/\^\^([^~]+)/);
134395
- const path28 = pathMatch ? pathMatch[1] : "";
134707
+ const path29 = pathMatch ? pathMatch[1] : "";
134396
134708
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
134397
134709
  const arrow = arrowMatch ? arrowMatch[1] : "";
134398
134710
  const r3 = Number.parseFloat(rotation2);
@@ -134406,7 +134718,7 @@ var parsePin = (pinString) => {
134406
134718
  rotation: Number.isNaN(r3) ? 0 : r3,
134407
134719
  label,
134408
134720
  labelColor,
134409
- path: path28,
134721
+ path: path29,
134410
134722
  arrow
134411
134723
  };
134412
134724
  };
@@ -134846,15 +135158,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
134846
135158
  }
134847
135159
  }
134848
135160
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
134849
- const path28 = [];
135161
+ const path29 = [];
134850
135162
  for (let i = 0;i <= numPoints; i++) {
134851
135163
  const t3 = i / numPoints;
134852
135164
  const angle2 = startAngle + t3 * (endAngle - startAngle);
134853
135165
  const x = centerX + radius * Math.cos(angle2);
134854
135166
  const y = centerY + radius * Math.sin(angle2);
134855
- path28.push({ x, y });
135167
+ path29.push({ x, y });
134856
135168
  }
134857
- return path28;
135169
+ return path29;
134858
135170
  }
134859
135171
  var __defProp4 = Object.defineProperty;
134860
135172
  var __export22 = (target, all) => {
@@ -136272,7 +136584,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
136272
136584
  };
136273
136585
  };
136274
136586
  var silkscreenPin = ({
136275
- fs: fs29,
136587
+ fs: fs30,
136276
136588
  pn: pn2,
136277
136589
  anchor_x,
136278
136590
  anchor_y,
@@ -136315,7 +136627,7 @@ var silkscreenPin = ({
136315
136627
  type: "pcb_silkscreen_text",
136316
136628
  pcb_silkscreen_text_id: "silkscreen_text_1",
136317
136629
  font: "tscircuit2024",
136318
- font_size: fs29,
136630
+ font_size: fs30,
136319
136631
  pcb_component_id: "pcb_component_1",
136320
136632
  text: `{PIN${pn2}}`,
136321
136633
  layer,
@@ -143931,17 +144243,17 @@ var ObstacleList = class {
143931
144243
  return obstacles;
143932
144244
  }
143933
144245
  };
143934
- function removePathLoops(path28) {
143935
- if (path28.length < 4)
143936
- return path28;
143937
- const result = [{ ...path28[0] }];
143938
- let currentLayer = path28[0].layer;
143939
- for (let i = 1;i < path28.length; i++) {
143940
- const currentSegment = { start: path28[i - 1], end: path28[i] };
143941
- const isVia = path28[i].route_type === "via" || path28[i - 1].route_type === "via";
143942
- if (path28[i].layer !== currentLayer || isVia) {
143943
- result.push({ ...path28[i] });
143944
- currentLayer = path28[i].layer;
144246
+ function removePathLoops(path29) {
144247
+ if (path29.length < 4)
144248
+ return path29;
144249
+ const result = [{ ...path29[0] }];
144250
+ let currentLayer = path29[0].layer;
144251
+ for (let i = 1;i < path29.length; i++) {
144252
+ const currentSegment = { start: path29[i - 1], end: path29[i] };
144253
+ const isVia = path29[i].route_type === "via" || path29[i - 1].route_type === "via";
144254
+ if (path29[i].layer !== currentLayer || isVia) {
144255
+ result.push({ ...path29[i] });
144256
+ currentLayer = path29[i].layer;
143945
144257
  continue;
143946
144258
  }
143947
144259
  let intersectionFound = false;
@@ -143970,8 +144282,8 @@ function removePathLoops(path28) {
143970
144282
  result.push(intersectionPoint);
143971
144283
  }
143972
144284
  const lastPoint = result[result.length - 1];
143973
- if (lastPoint.x !== path28[i].x || lastPoint.y !== path28[i].y) {
143974
- result.push(path28[i]);
144285
+ if (lastPoint.x !== path29[i].x || lastPoint.y !== path29[i].y) {
144286
+ result.push(path29[i]);
143975
144287
  }
143976
144288
  }
143977
144289
  return result;
@@ -144460,10 +144772,10 @@ var GeneralizedAstarAutorouter = class {
144460
144772
  });
144461
144773
  }
144462
144774
  if (current2.parent) {
144463
- const path28 = [];
144775
+ const path29 = [];
144464
144776
  let p = current2;
144465
144777
  while (p) {
144466
- path28.unshift(p);
144778
+ path29.unshift(p);
144467
144779
  p = p.parent;
144468
144780
  }
144469
144781
  debugSolution.push({
@@ -144471,7 +144783,7 @@ var GeneralizedAstarAutorouter = class {
144471
144783
  pcb_component_id: "",
144472
144784
  pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
144473
144785
  layer: "top",
144474
- route: path28,
144786
+ route: path29,
144475
144787
  stroke_width: 0.01
144476
144788
  });
144477
144789
  }
@@ -149393,13 +149705,13 @@ var RBush = class {
149393
149705
  return this;
149394
149706
  let node = this.data;
149395
149707
  const bbox = this.toBBox(item);
149396
- const path28 = [];
149708
+ const path29 = [];
149397
149709
  const indexes = [];
149398
149710
  let i, parent, goingUp;
149399
- while (node || path28.length) {
149711
+ while (node || path29.length) {
149400
149712
  if (!node) {
149401
- node = path28.pop();
149402
- parent = path28[path28.length - 1];
149713
+ node = path29.pop();
149714
+ parent = path29[path29.length - 1];
149403
149715
  i = indexes.pop();
149404
149716
  goingUp = true;
149405
149717
  }
@@ -149407,13 +149719,13 @@ var RBush = class {
149407
149719
  const index = findItem(item, node.children, equalsFn);
149408
149720
  if (index !== -1) {
149409
149721
  node.children.splice(index, 1);
149410
- path28.push(node);
149411
- this._condense(path28);
149722
+ path29.push(node);
149723
+ this._condense(path29);
149412
149724
  return this;
149413
149725
  }
149414
149726
  }
149415
149727
  if (!goingUp && !node.leaf && contains(node, bbox)) {
149416
- path28.push(node);
149728
+ path29.push(node);
149417
149729
  indexes.push(i);
149418
149730
  i = 0;
149419
149731
  parent = node;
@@ -149484,10 +149796,10 @@ var RBush = class {
149484
149796
  calcBBox(node, this.toBBox);
149485
149797
  return node;
149486
149798
  }
149487
- _chooseSubtree(bbox, node, level, path28) {
149799
+ _chooseSubtree(bbox, node, level, path29) {
149488
149800
  while (true) {
149489
- path28.push(node);
149490
- if (node.leaf || path28.length - 1 === level)
149801
+ path29.push(node);
149802
+ if (node.leaf || path29.length - 1 === level)
149491
149803
  break;
149492
149804
  let minArea = Infinity;
149493
149805
  let minEnlargement = Infinity;
@@ -149596,21 +149908,21 @@ var RBush = class {
149596
149908
  }
149597
149909
  return margin;
149598
149910
  }
149599
- _adjustParentBBoxes(bbox, path28, level) {
149911
+ _adjustParentBBoxes(bbox, path29, level) {
149600
149912
  for (let i = level;i >= 0; i--) {
149601
- extend(path28[i], bbox);
149913
+ extend(path29[i], bbox);
149602
149914
  }
149603
149915
  }
149604
- _condense(path28) {
149605
- for (let i = path28.length - 1, siblings;i >= 0; i--) {
149606
- if (path28[i].children.length === 0) {
149916
+ _condense(path29) {
149917
+ for (let i = path29.length - 1, siblings;i >= 0; i--) {
149918
+ if (path29[i].children.length === 0) {
149607
149919
  if (i > 0) {
149608
- siblings = path28[i - 1].children;
149609
- siblings.splice(siblings.indexOf(path28[i]), 1);
149920
+ siblings = path29[i - 1].children;
149921
+ siblings.splice(siblings.indexOf(path29[i]), 1);
149610
149922
  } else
149611
149923
  this.clear();
149612
149924
  } else
149613
- calcBBox(path28[i], this.toBBox);
149925
+ calcBBox(path29[i], this.toBBox);
149614
149926
  }
149615
149927
  }
149616
149928
  };
@@ -150755,7 +151067,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
150755
151067
  this.capacityPaths = capacityPaths;
150756
151068
  this.colorMap = colorMap ?? {};
150757
151069
  this.unprocessedNodeIds = [
150758
- ...new Set(capacityPaths.flatMap((path28) => path28.nodeIds))
151070
+ ...new Set(capacityPaths.flatMap((path29) => path29.nodeIds))
150759
151071
  ];
150760
151072
  this.nodePortSegments = /* @__PURE__ */ new Map;
150761
151073
  }
@@ -150766,17 +151078,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
150766
151078
  return;
150767
151079
  }
150768
151080
  const pathsGoingThroughNode = [];
150769
- for (const path28 of this.capacityPaths) {
150770
- const indexOfNodeInPath = path28.nodeIds.indexOf(nodeId);
151081
+ for (const path29 of this.capacityPaths) {
151082
+ const indexOfNodeInPath = path29.nodeIds.indexOf(nodeId);
150771
151083
  if (indexOfNodeInPath !== -1) {
150772
- pathsGoingThroughNode.push({ path: path28, indexOfNodeInPath });
151084
+ pathsGoingThroughNode.push({ path: path29, indexOfNodeInPath });
150773
151085
  }
150774
151086
  }
150775
151087
  const node = this.nodeMap.get(nodeId);
150776
151088
  const nodePortSegments = [];
150777
- for (const { path: path28, indexOfNodeInPath } of pathsGoingThroughNode) {
150778
- const entryNodeId = path28.nodeIds[indexOfNodeInPath - 1];
150779
- const exitNodeId = path28.nodeIds[indexOfNodeInPath + 1];
151089
+ for (const { path: path29, indexOfNodeInPath } of pathsGoingThroughNode) {
151090
+ const entryNodeId = path29.nodeIds[indexOfNodeInPath - 1];
151091
+ const exitNodeId = path29.nodeIds[indexOfNodeInPath + 1];
150780
151092
  for (const adjNodeId of [entryNodeId, exitNodeId]) {
150781
151093
  const adjNode = this.nodeMap.get(adjNodeId);
150782
151094
  if (!adjNode)
@@ -150789,7 +151101,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
150789
151101
  capacityMeshNodeId: nodeId,
150790
151102
  start: segment2.start,
150791
151103
  end: segment2.end,
150792
- connectionNames: [path28.connectionName],
151104
+ connectionNames: [path29.connectionName],
150793
151105
  availableZ: mutuallyAvailableZ
150794
151106
  };
150795
151107
  nodePortSegments.push(portSegment);
@@ -151595,37 +151907,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
151595
151907
  return neighbors;
151596
151908
  }
151597
151909
  getNodePath(node) {
151598
- const path28 = [];
151910
+ const path29 = [];
151599
151911
  while (node) {
151600
- path28.push(node);
151912
+ path29.push(node);
151601
151913
  node = node.parent;
151602
151914
  }
151603
- return path28;
151915
+ return path29;
151604
151916
  }
151605
151917
  getViasInNodePath(node) {
151606
- const path28 = this.getNodePath(node);
151918
+ const path29 = this.getNodePath(node);
151607
151919
  const vias = [];
151608
- for (let i = 0;i < path28.length - 1; i++) {
151609
- if (path28[i].z !== path28[i + 1].z) {
151610
- vias.push({ x: path28[i].x, y: path28[i].y });
151920
+ for (let i = 0;i < path29.length - 1; i++) {
151921
+ if (path29[i].z !== path29[i + 1].z) {
151922
+ vias.push({ x: path29[i].x, y: path29[i].y });
151611
151923
  }
151612
151924
  }
151613
151925
  return vias;
151614
151926
  }
151615
151927
  setSolvedPath(node) {
151616
- const path28 = this.getNodePath(node);
151617
- path28.reverse();
151928
+ const path29 = this.getNodePath(node);
151929
+ path29.reverse();
151618
151930
  const vias = [];
151619
- for (let i = 0;i < path28.length - 1; i++) {
151620
- if (path28[i].z !== path28[i + 1].z) {
151621
- vias.push({ x: path28[i].x, y: path28[i].y });
151931
+ for (let i = 0;i < path29.length - 1; i++) {
151932
+ if (path29[i].z !== path29[i + 1].z) {
151933
+ vias.push({ x: path29[i].x, y: path29[i].y });
151622
151934
  }
151623
151935
  }
151624
151936
  this.solvedPath = {
151625
151937
  connectionName: this.connectionName,
151626
151938
  traceThickness: this.traceThickness,
151627
151939
  viaDiameter: this.viaDiameter,
151628
- route: path28.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
151940
+ route: path29.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
151629
151941
  vias
151630
151942
  };
151631
151943
  }
@@ -152364,14 +152676,14 @@ function computeDumbbellPaths({
152364
152676
  const u3 = (dx2 * d1y - dy2 * d1x) / det;
152365
152677
  return t3 > 0 && t3 < 1 && u3 > 0 && u3 < 1;
152366
152678
  };
152367
- const doPathsIntersect = (path1, path28) => {
152679
+ const doPathsIntersect = (path1, path29) => {
152368
152680
  const segments1 = [];
152369
152681
  for (let i = 0;i < path1.length - 1; i++) {
152370
152682
  segments1.push({ start: path1[i], end: path1[i + 1] });
152371
152683
  }
152372
152684
  const segments2 = [];
152373
- for (let i = 0;i < path28.length - 1; i++) {
152374
- segments2.push({ start: path28[i], end: path28[i + 1] });
152685
+ for (let i = 0;i < path29.length - 1; i++) {
152686
+ segments2.push({ start: path29[i], end: path29[i + 1] });
152375
152687
  }
152376
152688
  for (const seg1 of segments1) {
152377
152689
  for (const seg2 of segments2) {
@@ -152433,12 +152745,12 @@ function computeDumbbellPaths({
152433
152745
  specialType: circleCenter === A3 ? "A" : "B"
152434
152746
  };
152435
152747
  };
152436
- const subdivideOptimalPath = (path28, numSubdivisions) => {
152437
- if (path28.length < 2)
152438
- return path28;
152439
- const result = [path28[0]];
152440
- for (let i = 0;i < path28.length - 1; i++) {
152441
- const segment2 = { start: path28[i], end: path28[i + 1] };
152748
+ const subdivideOptimalPath = (path29, numSubdivisions) => {
152749
+ if (path29.length < 2)
152750
+ return path29;
152751
+ const result = [path29[0]];
152752
+ for (let i = 0;i < path29.length - 1; i++) {
152753
+ const segment2 = { start: path29[i], end: path29[i + 1] };
152442
152754
  const segmentMidpoint = {
152443
152755
  x: (segment2.start.x + segment2.end.x) / 2,
152444
152756
  y: (segment2.start.y + segment2.end.y) / 2
@@ -152500,7 +152812,7 @@ function computeDumbbellPaths({
152500
152812
  }
152501
152813
  subdivisionPoints.forEach((p) => result.push(p));
152502
152814
  }
152503
- result.push(path28[i + 1]);
152815
+ result.push(path29[i + 1]);
152504
152816
  }
152505
152817
  if (result.length > 1) {
152506
152818
  const filteredResult = [result[0]];
@@ -152735,13 +153047,13 @@ function computeDumbbellPaths({
152735
153047
  ].map((l, index) => ({ ...l, index }));
152736
153048
  };
152737
153049
  const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
152738
- const path28 = jLine.points;
152739
- if (path28.length < 2)
152740
- return path28;
153050
+ const path29 = jLine.points;
153051
+ if (path29.length < 2)
153052
+ return path29;
152741
153053
  const minDistThreshold = r3 + m2;
152742
- const result = [path28[0]];
152743
- for (let i = 0;i < path28.length - 1; i++) {
152744
- const segment2 = { start: path28[i], end: path28[i + 1] };
153054
+ const result = [path29[0]];
153055
+ for (let i = 0;i < path29.length - 1; i++) {
153056
+ const segment2 = { start: path29[i], end: path29[i + 1] };
152745
153057
  const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
152746
153058
  if (distToOpposite < minDistThreshold) {
152747
153059
  const closestPt = closestPointOnSegment(segment2, oppositePoint);
@@ -152791,18 +153103,18 @@ function computeDumbbellPaths({
152791
153103
  const paths = getPaths();
152792
153104
  const validPaths = [];
152793
153105
  for (let i = 0;i < paths.length; i++) {
152794
- const path29 = paths[i];
152795
- const firstSeg = { start: path29[0], end: path29[1] };
153106
+ const path210 = paths[i];
153107
+ const firstSeg = { start: path210[0], end: path210[1] };
152796
153108
  const lastSeg = {
152797
- start: path29[path29.length - 2],
152798
- end: path29[path29.length - 1]
153109
+ start: path210[path210.length - 2],
153110
+ end: path210[path210.length - 1]
152799
153111
  };
152800
- const midSeg = { start: path29[3], end: path29[4] };
153112
+ const midSeg = { start: path210[3], end: path210[4] };
152801
153113
  if (!intersect2(firstSeg, lastSeg) && !intersect2(firstSeg, midSeg) && !intersect2(lastSeg, midSeg)) {
152802
153114
  validPaths.push({
152803
153115
  index: i + 1,
152804
- path: path29,
152805
- length: pathLength(path29)
153116
+ path: path210,
153117
+ length: pathLength(path210)
152806
153118
  });
152807
153119
  }
152808
153120
  }
@@ -152810,26 +153122,26 @@ function computeDumbbellPaths({
152810
153122
  return { index: 0, path: [] };
152811
153123
  }
152812
153124
  const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
152813
- const path28 = [...optimalPath2.path];
152814
- const firstPoint = path28[0];
152815
- const dist3 = distance3(firstPoint, path28[2]);
152816
- const dist4 = distance3(firstPoint, path28[3]);
153125
+ const path29 = [...optimalPath2.path];
153126
+ const firstPoint = path29[0];
153127
+ const dist3 = distance3(firstPoint, path29[2]);
153128
+ const dist4 = distance3(firstPoint, path29[3]);
152817
153129
  const closerIdx = dist3 < dist4 ? 2 : 3;
152818
- if (dist3 < distance3(firstPoint, path28[1]) || dist4 < distance3(firstPoint, path28[1])) {
152819
- path28.splice(1, closerIdx - 1);
153130
+ if (dist3 < distance3(firstPoint, path29[1]) || dist4 < distance3(firstPoint, path29[1])) {
153131
+ path29.splice(1, closerIdx - 1);
152820
153132
  }
152821
- const lastPoint = path28[path28.length - 1];
152822
- const distM3 = distance3(lastPoint, path28[path28.length - 3]);
152823
- const distM4 = distance3(lastPoint, path28[path28.length - 4]);
152824
- const closerLastIdx = distM3 < distM4 ? path28.length - 3 : path28.length - 4;
152825
- if (distM3 < distance3(lastPoint, path28[path28.length - 2]) || distM4 < distance3(lastPoint, path28[path28.length - 2])) {
152826
- path28.splice(closerLastIdx + 1, path28.length - closerLastIdx - 2);
153133
+ const lastPoint = path29[path29.length - 1];
153134
+ const distM3 = distance3(lastPoint, path29[path29.length - 3]);
153135
+ const distM4 = distance3(lastPoint, path29[path29.length - 4]);
153136
+ const closerLastIdx = distM3 < distM4 ? path29.length - 3 : path29.length - 4;
153137
+ if (distM3 < distance3(lastPoint, path29[path29.length - 2]) || distM4 < distance3(lastPoint, path29[path29.length - 2])) {
153138
+ path29.splice(closerLastIdx + 1, path29.length - closerLastIdx - 2);
152827
153139
  }
152828
153140
  return {
152829
153141
  index: optimalPath2.index,
152830
- path: path28,
152831
- startsAt: path28[0] === C2 ? "C" : "D",
152832
- goesTo: path28[path28.length - 1] === C2 ? "C" : "D"
153142
+ path: path29,
153143
+ startsAt: path29[0] === C2 ? "C" : "D",
153144
+ goesTo: path29[path29.length - 1] === C2 ? "C" : "D"
152833
153145
  };
152834
153146
  };
152835
153147
  const optimalPath = findOptimalPath();
@@ -154249,9 +154561,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
154249
154561
  let closestIntersection = null;
154250
154562
  let intersectedSegmentZ = null;
154251
154563
  const checkIntersectionsWithPathMap = (pathMap) => {
154252
- for (const path28 of pathMap.values()) {
154253
- for (let i = 0;i < path28.length - 1; i++) {
154254
- const segment2 = [path28[i], path28[i + 1]];
154564
+ for (const path29 of pathMap.values()) {
154565
+ for (let i = 0;i < path29.length - 1; i++) {
154566
+ const segment2 = [path29[i], path29[i + 1]];
154255
154567
  if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
154256
154568
  continue;
154257
154569
  }
@@ -154381,11 +154693,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
154381
154693
  });
154382
154694
  }
154383
154695
  const drawPath = (pathMap, labelPrefix) => {
154384
- for (const [connectionName, path28] of pathMap.entries()) {
154696
+ for (const [connectionName, path29] of pathMap.entries()) {
154385
154697
  const color = colorMap[connectionName] ?? "black";
154386
- for (let i = 0;i < path28.length - 1; i++) {
154387
- const p12 = path28[i];
154388
- const p2 = path28[i + 1];
154698
+ for (let i = 0;i < path29.length - 1; i++) {
154699
+ const p12 = path29[i];
154700
+ const p2 = path29[i + 1];
154389
154701
  if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
154390
154702
  graphics.circles.push({
154391
154703
  center: { x: p12.x, y: p12.y },
@@ -154983,10 +155295,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
154983
155295
  const allSegments = [];
154984
155296
  const viaPoints = /* @__PURE__ */ new Map;
154985
155297
  for (const polyLine of polyLines) {
154986
- const path28 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
154987
- for (let i = 0;i < path28.length - 1; i++) {
154988
- const p12 = path28[i];
154989
- const p2 = path28[i + 1];
155298
+ const path29 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
155299
+ for (let i = 0;i < path29.length - 1; i++) {
155300
+ const p12 = path29[i];
155301
+ const p2 = path29[i + 1];
154990
155302
  const layer = p12.z2;
154991
155303
  allSegments.push({
154992
155304
  start: { x: p12.x, y: p12.y },
@@ -155004,7 +155316,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
155004
155316
  }
155005
155317
  }
155006
155318
  }
155007
- const lastPoint = path28[path28.length - 1];
155319
+ const lastPoint = path29[path29.length - 1];
155008
155320
  if (lastPoint.z1 !== lastPoint.z2) {
155009
155321
  const key = pointKey2(lastPoint);
155010
155322
  if (!viaPoints.has(key)) {
@@ -155303,14 +155615,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
155303
155615
  const polyLineVias = [];
155304
155616
  for (let i = 0;i < polyLines.length; i++) {
155305
155617
  const polyLine = polyLines[i];
155306
- const path28 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
155618
+ const path29 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
155307
155619
  const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
155308
- for (let i22 = 0;i22 < path28.length - 1; i22++) {
155309
- const segment2 = [path28[i22], path28[i22 + 1]];
155620
+ for (let i22 = 0;i22 < path29.length - 1; i22++) {
155621
+ const segment2 = [path29[i22], path29[i22 + 1]];
155310
155622
  segmentsByLayer.get(segment2[0].z2).push(segment2);
155311
155623
  }
155312
155624
  polyLineSegmentsByLayer.push(segmentsByLayer);
155313
- polyLineVias.push(path28.filter((p) => p.z1 !== p.z2));
155625
+ polyLineVias.push(path29.filter((p) => p.z1 !== p.z2));
155314
155626
  }
155315
155627
  for (let i = 0;i < polyLines.length; i++) {
155316
155628
  const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
@@ -156739,7 +157051,7 @@ var HighDensitySolver = class extends BaseSolver {
156739
157051
  if (this.failedSolvers.length > 0) {
156740
157052
  this.solved = false;
156741
157053
  this.failed = true;
156742
- this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs29) => fs29.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
157054
+ this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs30) => fs30.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
156743
157055
  return;
156744
157056
  }
156745
157057
  this.solved = true;
@@ -159520,13 +159832,13 @@ var CapacityPathingSolver = class extends BaseSolver {
159520
159832
  return this.getDistanceBetweenNodes(node, endGoal);
159521
159833
  }
159522
159834
  getBacktrackedPath(candidate) {
159523
- const path28 = [];
159835
+ const path29 = [];
159524
159836
  let currentCandidate = candidate;
159525
159837
  while (currentCandidate) {
159526
- path28.push(currentCandidate.node);
159838
+ path29.push(currentCandidate.node);
159527
159839
  currentCandidate = currentCandidate.prevCandidate;
159528
159840
  }
159529
- return path28;
159841
+ return path29;
159530
159842
  }
159531
159843
  getNeighboringNodes(node) {
159532
159844
  return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
@@ -159534,12 +159846,12 @@ var CapacityPathingSolver = class extends BaseSolver {
159534
159846
  getCapacityPaths() {
159535
159847
  const capacityPaths = [];
159536
159848
  for (const connection of this.connectionsWithNodes) {
159537
- const path28 = connection.path;
159538
- if (path28) {
159849
+ const path29 = connection.path;
159850
+ if (path29) {
159539
159851
  capacityPaths.push({
159540
159852
  capacityPathId: connection.connection.name,
159541
159853
  connectionName: connection.connection.name,
159542
- nodeIds: path28.map((node) => node.capacityMeshNodeId)
159854
+ nodeIds: path29.map((node) => node.capacityMeshNodeId)
159543
159855
  });
159544
159856
  }
159545
159857
  }
@@ -160224,10 +160536,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160224
160536
  return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
160225
160537
  }
160226
160538
  getBacktrackedPath(candidate) {
160227
- const path28 = [];
160539
+ const path29 = [];
160228
160540
  let currentCandidate = candidate;
160229
160541
  while (currentCandidate) {
160230
- path28.push(currentCandidate.node);
160542
+ path29.push(currentCandidate.node);
160231
160543
  if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
160232
160544
  currentCandidate = currentCandidate.prevCandidate;
160233
160545
  } else {
@@ -160235,7 +160547,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160235
160547
  break;
160236
160548
  }
160237
160549
  }
160238
- return path28.reverse();
160550
+ return path29.reverse();
160239
160551
  }
160240
160552
  getNeighboringNodes(node) {
160241
160553
  if (!this.nodeMap.has(node.capacityMeshNodeId))
@@ -160250,8 +160562,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160250
160562
  doesNodeHaveCapacityForTrace(node, prevNode) {
160251
160563
  return true;
160252
160564
  }
160253
- reduceCapacityAlongPath(path28) {
160254
- for (const pathNode of path28) {
160565
+ reduceCapacityAlongPath(path29) {
160566
+ for (const pathNode of path29) {
160255
160567
  if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
160256
160568
  const nodeId = pathNode.capacityMeshNodeId;
160257
160569
  const nodeInSection = this.nodeMap.get(nodeId);
@@ -160380,9 +160692,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160380
160692
  this.queuedNodes = null;
160381
160693
  }
160382
160694
  _handleGoalReached(currentCandidate, currentTerminal, endNode) {
160383
- const path28 = this.getBacktrackedPath(currentCandidate);
160384
- currentTerminal.path = path28;
160385
- this.reduceCapacityAlongPath(path28);
160695
+ const path29 = this.getBacktrackedPath(currentCandidate);
160696
+ currentTerminal.path = path29;
160697
+ this.reduceCapacityAlongPath(path29);
160386
160698
  this.currentConnectionIndex++;
160387
160699
  this.candidates = null;
160388
160700
  this.visitedNodes = null;
@@ -160431,10 +160743,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
160431
160743
  const connectionColor = this.colorMap[connectionName] ?? "purple";
160432
160744
  topCandidates.forEach((candidate, index) => {
160433
160745
  const opacity = 0.8 * (1 - index / 5);
160434
- const path28 = this.getBacktrackedPath(candidate);
160435
- if (path28.length > 0) {
160746
+ const path29 = this.getBacktrackedPath(candidate);
160747
+ if (path29.length > 0) {
160436
160748
  baseGraphics.lines.push({
160437
- points: path28.map(({ center: { x, y } }) => ({ x, y })),
160749
+ points: path29.map(({ center: { x, y } }) => ({ x, y })),
160438
160750
  strokeColor: safeTransparentize(connectionColor, 1 - opacity),
160439
160751
  strokeWidth: 0.05
160440
160752
  });
@@ -161123,12 +161435,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
161123
161435
  getCapacityPaths() {
161124
161436
  const capacityPaths = [];
161125
161437
  for (const connection of this.connectionsWithNodes) {
161126
- const path28 = connection.path;
161127
- if (path28) {
161438
+ const path29 = connection.path;
161439
+ if (path29) {
161128
161440
  capacityPaths.push({
161129
161441
  capacityPathId: connection.connection.name,
161130
161442
  connectionName: connection.connection.name,
161131
- nodeIds: path28.map((node) => node.capacityMeshNodeId)
161443
+ nodeIds: path29.map((node) => node.capacityMeshNodeId)
161132
161444
  });
161133
161445
  }
161134
161446
  }
@@ -162149,22 +162461,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
162149
162461
  return null;
162150
162462
  }
162151
162463
  const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
162152
- for (const path28 of possiblePaths) {
162153
- const fullPath = path28.map((p) => ({ x: p.x, y: p.y, z: start.z }));
162464
+ for (const path29 of possiblePaths) {
162465
+ const fullPath = path29.map((p) => ({ x: p.x, y: p.y, z: start.z }));
162154
162466
  if (this.isValidPath(fullPath)) {
162155
162467
  return fullPath;
162156
162468
  }
162157
162469
  }
162158
162470
  return null;
162159
162471
  }
162160
- addPathToResult(path28) {
162161
- if (path28.length === 0)
162472
+ addPathToResult(path29) {
162473
+ if (path29.length === 0)
162162
162474
  return;
162163
- for (let i = 0;i < path28.length; i++) {
162164
- if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path28[i])) {
162475
+ for (let i = 0;i < path29.length; i++) {
162476
+ if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path29[i])) {
162165
162477
  continue;
162166
162478
  }
162167
- this.newRoute.push(path28[i]);
162479
+ this.newRoute.push(path29[i]);
162168
162480
  }
162169
162481
  this.currentStepSize = this.maxStepSize;
162170
162482
  }
@@ -189571,7 +189883,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
189571
189883
  for (let i = 0;i < portsWithPosition.length - 1; i++) {
189572
189884
  const start = portsWithPosition[i];
189573
189885
  const end = portsWithPosition[i + 1];
189574
- const path28 = calculateElbow({
189886
+ const path29 = calculateElbow({
189575
189887
  x: start.position.x,
189576
189888
  y: start.position.y,
189577
189889
  facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
@@ -189580,8 +189892,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
189580
189892
  y: end.position.y,
189581
189893
  facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
189582
189894
  });
189583
- for (let j4 = 0;j4 < path28.length - 1; j4++) {
189584
- elbowEdges.push({ from: path28[j4], to: path28[j4 + 1] });
189895
+ for (let j4 = 0;j4 < path29.length - 1; j4++) {
189896
+ elbowEdges.push({ from: path29[j4], to: path29[j4 + 1] });
189585
189897
  }
189586
189898
  }
189587
189899
  const doesSegmentIntersectRect = (edge, rect) => {
@@ -192441,7 +192753,7 @@ var Group = class extends NormalComponent {
192441
192753
  });
192442
192754
  throw err;
192443
192755
  }
192444
- await new Promise((resolve11) => setTimeout(resolve11, 100));
192756
+ await new Promise((resolve12) => setTimeout(resolve12, 100));
192445
192757
  }
192446
192758
  }
192447
192759
  async _runLocalAutorouting() {
@@ -192474,10 +192786,10 @@ var Group = class extends NormalComponent {
192474
192786
  targetMinCapacity: this.props.autorouter?.targetMinCapacity
192475
192787
  });
192476
192788
  }
192477
- const routingPromise = new Promise((resolve11, reject) => {
192789
+ const routingPromise = new Promise((resolve12, reject) => {
192478
192790
  autorouter.on("complete", (event) => {
192479
192791
  debug622(`[${this.getString()}] local autorouting complete`);
192480
- resolve11(event.traces);
192792
+ resolve12(event.traces);
192481
192793
  });
192482
192794
  autorouter.on("error", (event) => {
192483
192795
  debug622(`[${this.getString()}] local autorouting error: ${event.error.message}`);
@@ -195769,8 +196081,8 @@ react/cjs/react-jsx-runtime.development.js:
195769
196081
  */
195770
196082
 
195771
196083
  // lib/import/import-component-from-jlcpcb.ts
195772
- import fs29 from "node:fs/promises";
195773
- import path28 from "node:path";
196084
+ import fs30 from "node:fs/promises";
196085
+ import path29 from "node:path";
195774
196086
  var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
195775
196087
  const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
195776
196088
  const tsx = await convertRawEasyToTsx(component);
@@ -195778,10 +196090,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
195778
196090
  if (!fileName) {
195779
196091
  throw new Error("Could not determine file name of converted component");
195780
196092
  }
195781
- const importsDir = path28.join(projectDir, "imports");
195782
- await fs29.mkdir(importsDir, { recursive: true });
195783
- const filePath = path28.join(importsDir, `${fileName}.tsx`);
195784
- await fs29.writeFile(filePath, tsx);
196093
+ const importsDir = path29.join(projectDir, "imports");
196094
+ await fs30.mkdir(importsDir, { recursive: true });
196095
+ const filePath = path29.join(importsDir, `${fileName}.tsx`);
196096
+ await fs30.writeFile(filePath, tsx);
195785
196097
  return { filePath };
195786
196098
  };
195787
196099
 
@@ -195882,12 +196194,12 @@ var registerRemove = (program3) => {
195882
196194
  };
195883
196195
 
195884
196196
  // cli/build/register.ts
195885
- import path33 from "node:path";
195886
- import fs34 from "node:fs";
196197
+ import path36 from "node:path";
196198
+ import fs37 from "node:fs";
195887
196199
 
195888
196200
  // cli/build/build-file.ts
195889
- import path29 from "node:path";
195890
- import fs30 from "node:fs";
196201
+ import path30 from "node:path";
196202
+ import fs31 from "node:fs";
195891
196203
 
195892
196204
  // lib/shared/circuit-json-diagnostics.ts
195893
196205
  function analyzeCircuitJson(circuitJson) {
@@ -195919,9 +196231,9 @@ var buildFile = async (input, output, projectDir, options) => {
195919
196231
  filePath: input,
195920
196232
  platformConfig: options?.platformConfig
195921
196233
  });
195922
- fs30.mkdirSync(path29.dirname(output), { recursive: true });
195923
- fs30.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
195924
- console.log(`Circuit JSON written to ${path29.relative(projectDir, output)}`);
196234
+ fs31.mkdirSync(path30.dirname(output), { recursive: true });
196235
+ fs31.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
196236
+ console.log(`Circuit JSON written to ${path30.relative(projectDir, output)}`);
195925
196237
  const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
195926
196238
  if (!options?.ignoreWarnings) {
195927
196239
  for (const warn of warnings) {
@@ -195938,28 +196250,31 @@ var buildFile = async (input, output, projectDir, options) => {
195938
196250
  }
195939
196251
  if (errors.length > 0 && !options?.ignoreErrors) {
195940
196252
  console.error(kleur_default.red(`Build failed with ${errors.length} error(s). Use --ignore-errors to continue.`));
195941
- return false;
196253
+ return { ok: false };
195942
196254
  } else {
195943
- return true;
196255
+ return {
196256
+ ok: true,
196257
+ circuitJson: result.circuitJson
196258
+ };
195944
196259
  }
195945
196260
  } catch (err) {
195946
196261
  console.error(`Build failed: ${err}`);
195947
- return false;
196262
+ return { ok: false };
195948
196263
  }
195949
196264
  };
195950
196265
 
195951
196266
  // cli/build/get-build-entrypoints.ts
195952
- import fs31 from "node:fs";
195953
- import path30 from "node:path";
196267
+ import fs32 from "node:fs";
196268
+ import path31 from "node:path";
195954
196269
  var isSubPath2 = (maybeChild, maybeParent) => {
195955
- const relative9 = path30.relative(maybeParent, maybeChild);
195956
- return relative9 === "" || !relative9.startsWith("..") && !path30.isAbsolute(relative9);
196270
+ const relative9 = path31.relative(maybeParent, maybeChild);
196271
+ return relative9 === "" || !relative9.startsWith("..") && !path31.isAbsolute(relative9);
195957
196272
  };
195958
196273
  async function getBuildEntrypoints({
195959
196274
  fileOrDir,
195960
196275
  rootDir = process.cwd()
195961
196276
  }) {
195962
- const resolvedRoot = path30.resolve(rootDir);
196277
+ const resolvedRoot = path31.resolve(rootDir);
195963
196278
  const includeBoardFiles = getBoardFilePatterns(resolvedRoot);
195964
196279
  const buildFromProjectDir = async () => {
195965
196280
  const files = findBoardFiles({ projectDir: resolvedRoot });
@@ -195991,8 +196306,8 @@ async function getBuildEntrypoints({
195991
196306
  };
195992
196307
  };
195993
196308
  if (fileOrDir) {
195994
- const resolved = path30.resolve(resolvedRoot, fileOrDir);
195995
- if (fs31.existsSync(resolved) && fs31.statSync(resolved).isDirectory()) {
196309
+ const resolved = path31.resolve(resolvedRoot, fileOrDir);
196310
+ if (fs32.existsSync(resolved) && fs32.statSync(resolved).isDirectory()) {
195996
196311
  const circuitFiles = findBoardFiles({
195997
196312
  projectDir: resolvedRoot,
195998
196313
  filePaths: [resolved]
@@ -196005,7 +196320,7 @@ async function getBuildEntrypoints({
196005
196320
  circuitFiles
196006
196321
  };
196007
196322
  }
196008
- return { projectDir: path30.dirname(resolved), circuitFiles: [resolved] };
196323
+ return { projectDir: path31.dirname(resolved), circuitFiles: [resolved] };
196009
196324
  }
196010
196325
  return buildFromProjectDir();
196011
196326
  }
@@ -196039,8 +196354,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
196039
196354
  };
196040
196355
 
196041
196356
  // cli/build/build-preview-images.ts
196042
- import fs32 from "node:fs";
196043
- import path31 from "node:path";
196357
+ import fs33 from "node:fs";
196358
+ import path32 from "node:path";
196044
196359
  import {
196045
196360
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
196046
196361
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
@@ -196085,10 +196400,10 @@ var generatePreviewAssets = async ({
196085
196400
  outputDir,
196086
196401
  distDir
196087
196402
  }) => {
196088
- const prefixRelative = path31.relative(distDir, outputDir) || ".";
196403
+ const prefixRelative = path32.relative(distDir, outputDir) || ".";
196089
196404
  const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
196090
196405
  try {
196091
- const circuitJsonRaw = fs32.readFileSync(build.outputPath, "utf-8");
196406
+ const circuitJsonRaw = fs33.readFileSync(build.outputPath, "utf-8");
196092
196407
  const circuitJson = JSON.parse(circuitJsonRaw);
196093
196408
  console.log(`${prefix}Generating PCB SVG...`);
196094
196409
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
@@ -196104,12 +196419,12 @@ var generatePreviewAssets = async ({
196104
196419
  camPos: [10, 10, 10],
196105
196420
  lookAt: [0, 0, 0]
196106
196421
  });
196107
- fs32.mkdirSync(outputDir, { recursive: true });
196108
- fs32.writeFileSync(path31.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
196422
+ fs33.mkdirSync(outputDir, { recursive: true });
196423
+ fs33.writeFileSync(path32.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
196109
196424
  console.log(`${prefix}Written pcb.svg`);
196110
- fs32.writeFileSync(path31.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
196425
+ fs33.writeFileSync(path32.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
196111
196426
  console.log(`${prefix}Written schematic.svg`);
196112
- fs32.writeFileSync(path31.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
196427
+ fs33.writeFileSync(path32.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
196113
196428
  console.log(`${prefix}Written 3d.png`);
196114
196429
  } catch (error) {
196115
196430
  console.error(`${prefix}Failed to generate preview images:`, error);
@@ -196122,14 +196437,14 @@ var buildPreviewImages = async ({
196122
196437
  allImages
196123
196438
  }) => {
196124
196439
  const successfulBuilds = builtFiles.filter((file) => file.ok);
196125
- const normalizedMainEntrypoint = mainEntrypoint ? path31.resolve(mainEntrypoint) : undefined;
196440
+ const normalizedMainEntrypoint = mainEntrypoint ? path32.resolve(mainEntrypoint) : undefined;
196126
196441
  if (allImages) {
196127
196442
  if (successfulBuilds.length === 0) {
196128
196443
  console.warn("No successful build output available for preview image generation.");
196129
196444
  return;
196130
196445
  }
196131
196446
  for (const build of successfulBuilds) {
196132
- const outputDir = path31.dirname(build.outputPath);
196447
+ const outputDir = path32.dirname(build.outputPath);
196133
196448
  await generatePreviewAssets({
196134
196449
  build,
196135
196450
  outputDir,
@@ -196140,7 +196455,7 @@ var buildPreviewImages = async ({
196140
196455
  }
196141
196456
  const previewBuild = (() => {
196142
196457
  if (normalizedMainEntrypoint) {
196143
- const match = successfulBuilds.find((built) => path31.resolve(built.sourcePath) === normalizedMainEntrypoint);
196458
+ const match = successfulBuilds.find((built) => path32.resolve(built.sourcePath) === normalizedMainEntrypoint);
196144
196459
  if (match)
196145
196460
  return match;
196146
196461
  }
@@ -196157,12 +196472,170 @@ var buildPreviewImages = async ({
196157
196472
  });
196158
196473
  };
196159
196474
 
196475
+ // cli/build/generate-kicad-project.ts
196476
+ import fs34 from "node:fs";
196477
+ import path33 from "node:path";
196478
+ var createKicadProContent = ({
196479
+ projectName,
196480
+ schematicFileName,
196481
+ boardFileName
196482
+ }) => JSON.stringify({
196483
+ head: {
196484
+ version: 1,
196485
+ generator: "tsci"
196486
+ },
196487
+ project: {
196488
+ name: projectName,
196489
+ files: {
196490
+ schematic: schematicFileName,
196491
+ board: boardFileName
196492
+ }
196493
+ }
196494
+ }, null, 2);
196495
+ var generateKicadProject = async ({
196496
+ circuitJson,
196497
+ outputDir,
196498
+ projectName,
196499
+ writeFiles
196500
+ }) => {
196501
+ const schConverter = new CircuitJsonToKicadSchConverter(circuitJson);
196502
+ schConverter.runUntilFinished();
196503
+ const schContent = schConverter.getOutputString();
196504
+ const pcbConverter = new CircuitJsonToKicadPcbConverter(circuitJson);
196505
+ pcbConverter.runUntilFinished();
196506
+ const pcbContent = pcbConverter.getOutputString();
196507
+ const sanitizedProjectName = projectName.trim().length > 0 ? projectName.trim() : "project";
196508
+ const schematicFileName = `${sanitizedProjectName}.kicad_sch`;
196509
+ const boardFileName = `${sanitizedProjectName}.kicad_pcb`;
196510
+ const projectFileName = `${sanitizedProjectName}.kicad_pro`;
196511
+ const proContent = createKicadProContent({
196512
+ projectName: sanitizedProjectName,
196513
+ schematicFileName,
196514
+ boardFileName
196515
+ });
196516
+ if (writeFiles) {
196517
+ fs34.mkdirSync(outputDir, { recursive: true });
196518
+ fs34.writeFileSync(path33.join(outputDir, schematicFileName), schContent);
196519
+ fs34.writeFileSync(path33.join(outputDir, boardFileName), pcbContent);
196520
+ fs34.writeFileSync(path33.join(outputDir, projectFileName), proContent);
196521
+ }
196522
+ return {
196523
+ pcbContent,
196524
+ schContent,
196525
+ proContent,
196526
+ outputDir,
196527
+ projectName: sanitizedProjectName
196528
+ };
196529
+ };
196530
+
196531
+ // cli/build/generate-kicad-footprint-library.ts
196532
+ import fs35 from "node:fs";
196533
+ import path34 from "node:path";
196534
+ var sanitizeLibraryAndFootprintName = (libraryLink) => {
196535
+ if (!libraryLink) {
196536
+ return {
196537
+ libraryName: "generated",
196538
+ footprintName: "footprint"
196539
+ };
196540
+ }
196541
+ if (!libraryLink.includes(":")) {
196542
+ return {
196543
+ libraryName: "generated",
196544
+ footprintName: libraryLink.replace(/[\\\/]/g, "-") || "footprint"
196545
+ };
196546
+ }
196547
+ const [rawLibraryName, rawFootprintName] = libraryLink.split(":", 2);
196548
+ const libraryName = rawLibraryName?.replace(/[\\\/]/g, "-").trim() || "generated";
196549
+ const footprintName = rawFootprintName?.replace(/[\\\/]/g, "-").trim() || "footprint";
196550
+ return {
196551
+ libraryName,
196552
+ footprintName
196553
+ };
196554
+ };
196555
+ var sanitizeFootprint = (footprint) => {
196556
+ const { libraryName, footprintName } = sanitizeLibraryAndFootprintName(footprint.libraryLink);
196557
+ footprint.libraryLink = footprintName;
196558
+ footprint.position = At.from([0, 0, 0]);
196559
+ footprint.locked = false;
196560
+ footprint.placed = false;
196561
+ footprint.uuid = undefined;
196562
+ footprint.path = undefined;
196563
+ footprint.sheetfile = undefined;
196564
+ footprint.sheetname = undefined;
196565
+ footprint.properties = [];
196566
+ const texts = footprint.fpTexts ?? [];
196567
+ for (const text of texts) {
196568
+ text.uuid = undefined;
196569
+ if (text.type === "reference") {
196570
+ text.text = "REF**";
196571
+ } else if (text.type === "value" && text.text.trim().length === 0) {
196572
+ text.text = footprintName;
196573
+ }
196574
+ }
196575
+ footprint.fpTexts = texts;
196576
+ const pads = footprint.fpPads ?? [];
196577
+ for (const pad2 of pads) {
196578
+ pad2.uuid = undefined;
196579
+ pad2.net = undefined;
196580
+ }
196581
+ footprint.fpPads = pads;
196582
+ return {
196583
+ libraryName,
196584
+ footprintName,
196585
+ content: footprint.getString()
196586
+ };
196587
+ };
196588
+ var generateKicadFootprintLibrary = async ({
196589
+ projects,
196590
+ distDir
196591
+ }) => {
196592
+ const libraryRoot = path34.join(distDir, "kicad-footprints");
196593
+ fs35.mkdirSync(libraryRoot, { recursive: true });
196594
+ const uniqueFootprints = new Map;
196595
+ for (const project of projects) {
196596
+ try {
196597
+ const parsed = parseKicadSexpr(project.pcbContent);
196598
+ const pcb = parsed.find((node) => node instanceof KicadPcb);
196599
+ if (!pcb)
196600
+ continue;
196601
+ const footprints = pcb.footprints ?? [];
196602
+ for (const footprint of footprints) {
196603
+ const sanitized = sanitizeFootprint(footprint);
196604
+ const key = `${sanitized.libraryName}::${sanitized.footprintName}`;
196605
+ if (!uniqueFootprints.has(key)) {
196606
+ uniqueFootprints.set(key, sanitized);
196607
+ }
196608
+ }
196609
+ } catch (error) {
196610
+ console.warn(`Failed to parse KiCad PCB content for footprint extraction from ${project.sourcePath}:`, error);
196611
+ }
196612
+ }
196613
+ const libraryNames = new Set;
196614
+ for (const entry of uniqueFootprints.values()) {
196615
+ libraryNames.add(entry.libraryName);
196616
+ const libraryDir = path34.join(libraryRoot, `${entry.libraryName}.pretty`);
196617
+ fs35.mkdirSync(libraryDir, { recursive: true });
196618
+ const footprintPath = path34.join(libraryDir, `${entry.footprintName}.kicad_mod`);
196619
+ fs35.writeFileSync(footprintPath, `${entry.content}
196620
+ `);
196621
+ }
196622
+ if (libraryNames.size > 0) {
196623
+ const libTableEntries = Array.from(libraryNames).sort().map((name) => ` (lib (name ${name}) (type KiCad) (uri \${KIPRJMOD}/kicad-footprints/${name}.pretty) (options "") (descr "Generated by tsci build"))`);
196624
+ const libTableContent = `(fp_lib_table
196625
+ ${libTableEntries.join(`
196626
+ `)}
196627
+ )
196628
+ `;
196629
+ fs35.writeFileSync(path34.join(libraryRoot, "fp-lib-table"), libTableContent);
196630
+ }
196631
+ };
196632
+
196160
196633
  // cli/build/transpile.ts
196161
- import path32 from "node:path";
196162
- import fs33 from "node:fs";
196634
+ import path35 from "node:path";
196635
+ import fs36 from "node:fs";
196163
196636
  import { rollup } from "rollup";
196164
196637
  import typescript from "@rollup/plugin-typescript";
196165
- import resolve11 from "@rollup/plugin-node-resolve";
196638
+ import resolve12 from "@rollup/plugin-node-resolve";
196166
196639
  import commonjs from "@rollup/plugin-commonjs";
196167
196640
  import json from "@rollup/plugin-json";
196168
196641
  import dts from "rollup-plugin-dts";
@@ -196172,7 +196645,7 @@ var transpileFile = async ({
196172
196645
  projectDir
196173
196646
  }) => {
196174
196647
  try {
196175
- fs33.mkdirSync(outputDir, { recursive: true });
196648
+ fs36.mkdirSync(outputDir, { recursive: true });
196176
196649
  console.log("Building ESM bundle...");
196177
196650
  const esmBundle = await rollup({
196178
196651
  input,
@@ -196180,7 +196653,7 @@ var transpileFile = async ({
196180
196653
  return !id2.startsWith(".") && !id2.startsWith("/");
196181
196654
  },
196182
196655
  plugins: [
196183
- resolve11({
196656
+ resolve12({
196184
196657
  extensions: [".ts", ".tsx", ".js", ".jsx"]
196185
196658
  }),
196186
196659
  commonjs(),
@@ -196202,11 +196675,11 @@ var transpileFile = async ({
196202
196675
  ]
196203
196676
  });
196204
196677
  await esmBundle.write({
196205
- file: path32.join(outputDir, "index.js"),
196678
+ file: path35.join(outputDir, "index.js"),
196206
196679
  format: "es",
196207
196680
  sourcemap: false
196208
196681
  });
196209
- console.log(`ESM bundle written to ${path32.relative(projectDir, path32.join(outputDir, "index.js"))}`);
196682
+ console.log(`ESM bundle written to ${path35.relative(projectDir, path35.join(outputDir, "index.js"))}`);
196210
196683
  console.log("Building CommonJS bundle...");
196211
196684
  const cjsBundle = await rollup({
196212
196685
  input,
@@ -196214,7 +196687,7 @@ var transpileFile = async ({
196214
196687
  return !id2.startsWith(".") && !id2.startsWith("/");
196215
196688
  },
196216
196689
  plugins: [
196217
- resolve11({
196690
+ resolve12({
196218
196691
  extensions: [".ts", ".tsx", ".js", ".jsx"]
196219
196692
  }),
196220
196693
  commonjs(),
@@ -196236,11 +196709,11 @@ var transpileFile = async ({
196236
196709
  ]
196237
196710
  });
196238
196711
  await cjsBundle.write({
196239
- file: path32.join(outputDir, "index.cjs"),
196712
+ file: path35.join(outputDir, "index.cjs"),
196240
196713
  format: "cjs",
196241
196714
  sourcemap: false
196242
196715
  });
196243
- console.log(`CommonJS bundle written to ${path32.relative(projectDir, path32.join(outputDir, "index.cjs"))}`);
196716
+ console.log(`CommonJS bundle written to ${path35.relative(projectDir, path35.join(outputDir, "index.cjs"))}`);
196244
196717
  console.log("Generating type declarations...");
196245
196718
  const dtsBundle = await rollup({
196246
196719
  input,
@@ -196260,8 +196733,8 @@ var transpileFile = async ({
196260
196733
  dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
196261
196734
  dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
196262
196735
  dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
196263
- fs33.writeFileSync(path32.join(outputDir, "index.d.ts"), dtsContent);
196264
- console.log(`Type declarations written to ${path32.relative(projectDir, path32.join(outputDir, "index.d.ts"))}`);
196736
+ fs36.writeFileSync(path35.join(outputDir, "index.d.ts"), dtsContent);
196737
+ console.log(`Type declarations written to ${path35.relative(projectDir, path35.join(outputDir, "index.d.ts"))}`);
196265
196738
  console.log(kleur_default.green("Transpilation complete!"));
196266
196739
  return true;
196267
196740
  } catch (err) {
@@ -196275,7 +196748,7 @@ var transpileFile = async ({
196275
196748
 
196276
196749
  // cli/build/register.ts
196277
196750
  var registerBuild = (program3) => {
196278
- program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").action(async (file, options) => {
196751
+ program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad", "Generate KiCad project directories for each successful build output").option("--kicad-footprint-library", "Generate a KiCad footprint library from all successful build outputs").action(async (file, options) => {
196279
196752
  try {
196280
196753
  const { projectDir, circuitFiles, mainEntrypoint } = await getBuildEntrypoints({
196281
196754
  fileOrDir: file
@@ -196292,18 +196765,20 @@ var registerBuild = (program3) => {
196292
196765
  }
196293
196766
  return config;
196294
196767
  })();
196295
- const distDir = path33.join(projectDir, "dist");
196296
- fs34.mkdirSync(distDir, { recursive: true });
196768
+ const distDir = path36.join(projectDir, "dist");
196769
+ fs37.mkdirSync(distDir, { recursive: true });
196297
196770
  console.log(`Building ${circuitFiles.length} file(s)...`);
196298
196771
  let hasErrors = false;
196299
196772
  const staticFileReferences = [];
196300
196773
  const builtFiles = [];
196774
+ const kicadProjects = [];
196775
+ const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
196301
196776
  for (const filePath of circuitFiles) {
196302
- const relative9 = path33.relative(projectDir, filePath);
196777
+ const relative9 = path36.relative(projectDir, filePath);
196303
196778
  console.log(`Building ${relative9}...`);
196304
196779
  const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
196305
- const outputPath = path33.join(distDir, outputDirName, "circuit.json");
196306
- const ok = await buildFile(filePath, outputPath, projectDir, {
196780
+ const outputPath = path36.join(distDir, outputDirName, "circuit.json");
196781
+ const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
196307
196782
  ignoreErrors: options?.ignoreErrors,
196308
196783
  ignoreWarnings: options?.ignoreWarnings,
196309
196784
  platformConfig: platformConfig2
@@ -196311,19 +196786,33 @@ var registerBuild = (program3) => {
196311
196786
  builtFiles.push({
196312
196787
  sourcePath: filePath,
196313
196788
  outputPath,
196314
- ok
196789
+ ok: buildOutcome.ok
196315
196790
  });
196316
- if (!ok) {
196791
+ if (!buildOutcome.ok) {
196317
196792
  hasErrors = true;
196318
196793
  } else if (options?.site) {
196319
- const normalizedSourcePath = relative9.split(path33.sep).join("/");
196320
- const relativeOutputPath = path33.join(outputDirName, "circuit.json");
196321
- const normalizedOutputPath = relativeOutputPath.split(path33.sep).join("/");
196794
+ const normalizedSourcePath = relative9.split(path36.sep).join("/");
196795
+ const relativeOutputPath = path36.join(outputDirName, "circuit.json");
196796
+ const normalizedOutputPath = relativeOutputPath.split(path36.sep).join("/");
196322
196797
  staticFileReferences.push({
196323
196798
  filePath: normalizedSourcePath,
196324
196799
  fileStaticAssetUrl: `./${normalizedOutputPath}`
196325
196800
  });
196326
196801
  }
196802
+ if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
196803
+ const projectOutputDir = path36.join(distDir, outputDirName, "kicad");
196804
+ const projectName = path36.basename(outputDirName);
196805
+ const project = await generateKicadProject({
196806
+ circuitJson: buildOutcome.circuitJson,
196807
+ outputDir: projectOutputDir,
196808
+ projectName,
196809
+ writeFiles: Boolean(options?.kicad)
196810
+ });
196811
+ kicadProjects.push({
196812
+ ...project,
196813
+ sourcePath: filePath
196814
+ });
196815
+ }
196327
196816
  }
196328
196817
  if (hasErrors && !options?.ignoreErrors) {
196329
196818
  process.exit(1);
@@ -196360,8 +196849,18 @@ var registerBuild = (program3) => {
196360
196849
  files: staticFileReferences,
196361
196850
  standaloneScriptSrc: "./standalone.min.js"
196362
196851
  });
196363
- fs34.writeFileSync(path33.join(distDir, "index.html"), indexHtml);
196364
- fs34.writeFileSync(path33.join(distDir, "standalone.min.js"), standalone_min_default);
196852
+ fs37.writeFileSync(path36.join(distDir, "index.html"), indexHtml);
196853
+ fs37.writeFileSync(path36.join(distDir, "standalone.min.js"), standalone_min_default);
196854
+ }
196855
+ if (options?.kicadFootprintLibrary) {
196856
+ if (kicadProjects.length === 0) {
196857
+ console.warn("No successful build output available for KiCad footprint library generation.");
196858
+ } else {
196859
+ await generateKicadFootprintLibrary({
196860
+ projects: kicadProjects,
196861
+ distDir
196862
+ });
196863
+ }
196365
196864
  }
196366
196865
  console.log("Build complete!");
196367
196866
  process.exit(0);
@@ -196374,8 +196873,8 @@ var registerBuild = (program3) => {
196374
196873
  };
196375
196874
 
196376
196875
  // lib/shared/snapshot-project.ts
196377
- import fs36 from "node:fs";
196378
- import path34 from "node:path";
196876
+ import fs39 from "node:fs";
196877
+ import path37 from "node:path";
196379
196878
  import looksSame2 from "looks-same";
196380
196879
  import {
196381
196880
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
@@ -196386,7 +196885,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
196386
196885
 
196387
196886
  // lib/shared/compare-images.ts
196388
196887
  import looksSame from "looks-same";
196389
- import fs35 from "node:fs/promises";
196888
+ import fs38 from "node:fs/promises";
196390
196889
  var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
196391
196890
  const { equal: equal2 } = await looksSame(buffer1, buffer2, {
196392
196891
  strict: false,
@@ -196402,7 +196901,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
196402
196901
  tolerance: 2
196403
196902
  });
196404
196903
  } else {
196405
- await fs35.writeFile(diffPath, buffer2);
196904
+ await fs38.writeFile(diffPath, buffer2);
196406
196905
  }
196407
196906
  }
196408
196907
  return { equal: equal2 };
@@ -196427,7 +196926,7 @@ var snapshotProject = async ({
196427
196926
  ...DEFAULT_IGNORED_PATTERNS,
196428
196927
  ...ignored.map(normalizeIgnorePattern)
196429
196928
  ];
196430
- const resolvedPaths = filePaths.map((f) => path34.resolve(projectDir, f));
196929
+ const resolvedPaths = filePaths.map((f) => path37.resolve(projectDir, f));
196431
196930
  const boardFiles = findBoardFiles({
196432
196931
  projectDir,
196433
196932
  ignore,
@@ -196441,7 +196940,7 @@ var snapshotProject = async ({
196441
196940
  const mismatches = [];
196442
196941
  let didUpdate = false;
196443
196942
  for (const file of boardFiles) {
196444
- const relativeFilePath = path34.relative(projectDir, file);
196943
+ const relativeFilePath = path37.relative(projectDir, file);
196445
196944
  let circuitJson;
196446
196945
  let pcbSvg;
196447
196946
  let schSvg;
@@ -196495,17 +196994,17 @@ var snapshotProject = async ({
196495
196994
  } catch (error) {
196496
196995
  const errorMessage = error instanceof Error ? error.message : String(error);
196497
196996
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
196498
- const fileDir = path34.dirname(file);
196499
- const relativeDir = path34.relative(projectDir, fileDir);
196500
- const snapDir2 = snapshotsDirName ? path34.join(projectDir, snapshotsDirName, relativeDir) : path34.join(fileDir, "__snapshots__");
196501
- const base2 = path34.basename(file).replace(/\.tsx$/, "");
196502
- const snap3dPath = path34.join(snapDir2, `${base2}-3d.snap.png`);
196503
- const existing3dSnapshot = fs36.existsSync(snap3dPath);
196997
+ const fileDir = path37.dirname(file);
196998
+ const relativeDir = path37.relative(projectDir, fileDir);
196999
+ const snapDir2 = snapshotsDirName ? path37.join(projectDir, snapshotsDirName, relativeDir) : path37.join(fileDir, "__snapshots__");
197000
+ const base2 = path37.basename(file).replace(/\.tsx$/, "");
197001
+ const snap3dPath = path37.join(snapDir2, `${base2}-3d.snap.png`);
197002
+ const existing3dSnapshot = fs39.existsSync(snap3dPath);
196504
197003
  if (existing3dSnapshot) {
196505
197004
  onError(kleur_default.red(`
196506
197005
  ❌ Failed to generate 3D snapshot for ${relativeFilePath}:
196507
197006
  `) + kleur_default.red(` No pcb_board found in circuit JSON
196508
- `) + kleur_default.red(` Existing snapshot: ${path34.relative(projectDir, snap3dPath)}
197007
+ `) + kleur_default.red(` Existing snapshot: ${path37.relative(projectDir, snap3dPath)}
196509
197008
  `));
196510
197009
  return onExit(1);
196511
197010
  } else {
@@ -196521,9 +197020,9 @@ var snapshotProject = async ({
196521
197020
  }
196522
197021
  }
196523
197022
  }
196524
- const snapDir = snapshotsDirName ? path34.join(projectDir, snapshotsDirName, path34.relative(projectDir, path34.dirname(file))) : path34.join(path34.dirname(file), "__snapshots__");
196525
- fs36.mkdirSync(snapDir, { recursive: true });
196526
- const base = path34.basename(file).replace(/\.tsx$/, "");
197023
+ const snapDir = snapshotsDirName ? path37.join(projectDir, snapshotsDirName, path37.relative(projectDir, path37.dirname(file))) : path37.join(path37.dirname(file), "__snapshots__");
197024
+ fs39.mkdirSync(snapDir, { recursive: true });
197025
+ const base = path37.basename(file).replace(/\.tsx$/, "");
196527
197026
  const snapshots = [];
196528
197027
  if (pcbOnly || !schematicOnly) {
196529
197028
  snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
@@ -196541,31 +197040,31 @@ var snapshotProject = async ({
196541
197040
  for (const snapshot of snapshots) {
196542
197041
  const { type } = snapshot;
196543
197042
  const is3d = type === "3d";
196544
- const snapPath = path34.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
196545
- const existing = fs36.existsSync(snapPath);
197043
+ const snapPath = path37.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
197044
+ const existing = fs39.existsSync(snapPath);
196546
197045
  const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
196547
197046
  const newContentForFile = snapshot.content;
196548
197047
  if (!existing) {
196549
- fs36.writeFileSync(snapPath, newContentForFile);
196550
- console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
197048
+ fs39.writeFileSync(snapPath, newContentForFile);
197049
+ console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
196551
197050
  didUpdate = true;
196552
197051
  continue;
196553
197052
  }
196554
- const oldContentBuffer = fs36.readFileSync(snapPath);
197053
+ const oldContentBuffer = fs39.readFileSync(snapPath);
196555
197054
  const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
196556
197055
  const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
196557
197056
  if (update) {
196558
197057
  if (!forceUpdate && equal2) {
196559
- console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
197058
+ console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
196560
197059
  } else {
196561
- fs36.writeFileSync(snapPath, newContentForFile);
196562
- console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
197060
+ fs39.writeFileSync(snapPath, newContentForFile);
197061
+ console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
196563
197062
  didUpdate = true;
196564
197063
  }
196565
197064
  } else if (!equal2) {
196566
197065
  mismatches.push(`${snapPath} (diff: ${diffPath})`);
196567
197066
  } else {
196568
- console.log("✅", kleur_default.gray(path34.relative(projectDir, snapPath)));
197067
+ console.log("✅", kleur_default.gray(path37.relative(projectDir, snapPath)));
196569
197068
  }
196570
197069
  }
196571
197070
  }
@@ -196604,22 +197103,22 @@ var registerSnapshot = (program3) => {
196604
197103
  };
196605
197104
 
196606
197105
  // lib/shared/setup-github-actions.ts
196607
- import fs37 from "node:fs";
196608
- import path35 from "node:path";
197106
+ import fs40 from "node:fs";
197107
+ import path38 from "node:path";
196609
197108
  var setupGithubActions = (projectDir = process.cwd()) => {
196610
197109
  const findGitRoot = (startDir) => {
196611
- let dir = path35.resolve(startDir);
196612
- while (dir !== path35.parse(dir).root) {
196613
- if (fs37.existsSync(path35.join(dir, ".git"))) {
197110
+ let dir = path38.resolve(startDir);
197111
+ while (dir !== path38.parse(dir).root) {
197112
+ if (fs40.existsSync(path38.join(dir, ".git"))) {
196614
197113
  return dir;
196615
197114
  }
196616
- dir = path35.dirname(dir);
197115
+ dir = path38.dirname(dir);
196617
197116
  }
196618
197117
  return null;
196619
197118
  };
196620
197119
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
196621
- const workflowsDir = path35.join(gitRoot, ".github", "workflows");
196622
- fs37.mkdirSync(workflowsDir, { recursive: true });
197120
+ const workflowsDir = path38.join(gitRoot, ".github", "workflows");
197121
+ fs40.mkdirSync(workflowsDir, { recursive: true });
196623
197122
  const buildWorkflow = `name: tscircuit Build
196624
197123
 
196625
197124
  on:
@@ -196658,8 +197157,8 @@ jobs:
196658
197157
  - run: bun install
196659
197158
  - run: bunx tsci snapshot
196660
197159
  `;
196661
- writeFileIfNotExists(path35.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
196662
- writeFileIfNotExists(path35.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
197160
+ writeFileIfNotExists(path38.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
197161
+ writeFileIfNotExists(path38.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
196663
197162
  };
196664
197163
 
196665
197164
  // cli/setup/register.ts
@@ -196685,8 +197184,8 @@ var registerSetup = (program3) => {
196685
197184
  };
196686
197185
 
196687
197186
  // cli/convert/register.ts
196688
- import fs38 from "node:fs/promises";
196689
- import path36 from "node:path";
197187
+ import fs41 from "node:fs/promises";
197188
+ import path39 from "node:path";
196690
197189
  import { parseKicadModToCircuitJson } from "kicad-component-converter";
196691
197190
 
196692
197191
  // node_modules/@tscircuit/mm/dist/index.js
@@ -196806,15 +197305,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
196806
197305
  var registerConvert = (program3) => {
196807
197306
  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) => {
196808
197307
  try {
196809
- const inputPath = path36.resolve(file);
196810
- const modContent = await fs38.readFile(inputPath, "utf-8");
197308
+ const inputPath = path39.resolve(file);
197309
+ const modContent = await fs41.readFile(inputPath, "utf-8");
196811
197310
  const circuitJson = await parseKicadModToCircuitJson(modContent);
196812
- const componentName = options.name ?? path36.basename(inputPath, ".kicad_mod");
197311
+ const componentName = options.name ?? path39.basename(inputPath, ".kicad_mod");
196813
197312
  const tsx = convertCircuitJsonToTscircuit(circuitJson, {
196814
197313
  componentName
196815
197314
  });
196816
- const outputPath = options.output ? path36.resolve(options.output) : path36.join(path36.dirname(inputPath), `${componentName}.tsx`);
196817
- await fs38.writeFile(outputPath, tsx);
197315
+ const outputPath = options.output ? path39.resolve(options.output) : path39.join(path39.dirname(inputPath), `${componentName}.tsx`);
197316
+ await fs41.writeFile(outputPath, tsx);
196818
197317
  console.log(kleur_default.green(`Converted ${outputPath}`));
196819
197318
  } catch (error) {
196820
197319
  console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
@@ -196909,12 +197408,12 @@ var registerSimulate = (program3) => {
196909
197408
  };
196910
197409
 
196911
197410
  // lib/shared/install-project-dependencies.ts
196912
- import fs40 from "node:fs";
196913
- import path38 from "node:path";
197411
+ import fs43 from "node:fs";
197412
+ import path41 from "node:path";
196914
197413
 
196915
197414
  // lib/shared/collect-tsci-dependencies.ts
196916
- import fs39 from "node:fs";
196917
- import path37 from "node:path";
197415
+ import fs42 from "node:fs";
197416
+ import path40 from "node:path";
196918
197417
  var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
196919
197418
  var DEFAULT_IGNORES = [
196920
197419
  "**/node_modules/**",
@@ -196929,7 +197428,7 @@ function collectTsciDependencies({
196929
197428
  patterns = DEFAULT_PATTERNS,
196930
197429
  ignore = DEFAULT_IGNORES
196931
197430
  } = {}) {
196932
- const searchRoot = path37.resolve(cwd);
197431
+ const searchRoot = path40.resolve(cwd);
196933
197432
  const files = globbySync(patterns, {
196934
197433
  cwd: searchRoot,
196935
197434
  absolute: true,
@@ -196939,7 +197438,7 @@ function collectTsciDependencies({
196939
197438
  const dependencies2 = new Set;
196940
197439
  for (const filePath of files) {
196941
197440
  try {
196942
- const fileContents = fs39.readFileSync(filePath, "utf-8");
197441
+ const fileContents = fs42.readFileSync(filePath, "utf-8");
196943
197442
  let match;
196944
197443
  while (true) {
196945
197444
  match = IMPORT_PATTERN.exec(fileContents);
@@ -196956,26 +197455,26 @@ function collectTsciDependencies({
196956
197455
  async function installProjectDependencies({
196957
197456
  cwd = process.cwd()
196958
197457
  } = {}) {
196959
- const projectRoot = path38.resolve(cwd);
196960
- const packageJsonPath = path38.join(projectRoot, "package.json");
196961
- const npmrcPath = path38.join(projectRoot, ".npmrc");
197458
+ const projectRoot = path41.resolve(cwd);
197459
+ const packageJsonPath = path41.join(projectRoot, "package.json");
197460
+ const npmrcPath = path41.join(projectRoot, ".npmrc");
196962
197461
  const packageManager = getPackageManager();
196963
- if (!fs40.existsSync(projectRoot)) {
197462
+ if (!fs43.existsSync(projectRoot)) {
196964
197463
  throw new Error(`Directory not found: ${projectRoot}`);
196965
197464
  }
196966
197465
  let packageJsonCreated = false;
196967
- if (!fs40.existsSync(packageJsonPath)) {
197466
+ if (!fs43.existsSync(packageJsonPath)) {
196968
197467
  console.log("No package.json found. Generating a new one.");
196969
197468
  generatePackageJson(projectRoot);
196970
197469
  packageJsonCreated = true;
196971
197470
  } else {
196972
197471
  console.log("Found existing package.json.");
196973
197472
  }
196974
- if (!fs40.existsSync(npmrcPath)) {
197473
+ if (!fs43.existsSync(npmrcPath)) {
196975
197474
  console.log("Creating .npmrc with tscircuit registry configuration.");
196976
- fs40.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
197475
+ fs43.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
196977
197476
  }
196978
- const packageJson = JSON.parse(fs40.readFileSync(packageJsonPath, "utf-8"));
197477
+ const packageJson = JSON.parse(fs43.readFileSync(packageJsonPath, "utf-8"));
196979
197478
  if (packageJsonCreated) {
196980
197479
  const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
196981
197480
  if (tsciDependencies.length > 0) {
@@ -196990,7 +197489,7 @@ async function installProjectDependencies({
196990
197489
  console.log("No @tsci dependencies detected in circuit files.");
196991
197490
  }
196992
197491
  }
196993
- fs40.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
197492
+ fs43.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
196994
197493
  `);
196995
197494
  console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
196996
197495
  try {