@tscircuit/cli 0.1.2256 → 0.1.2257

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/main.js CHANGED
@@ -172569,7 +172569,7 @@ var import_perfect_cli = __toESM3(require_dist3(), 1);
172569
172569
  // lib/getVersion.ts
172570
172570
  import { createRequire as createRequire2 } from "node:module";
172571
172571
  // package.json
172572
- var version = "0.1.2255";
172572
+ var version = "0.1.2256";
172573
172573
  var package_default = {
172574
172574
  name: "@tscircuit/cli",
172575
172575
  version,
@@ -172588,7 +172588,7 @@ var package_default = {
172588
172588
  "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.26.tgz",
172589
172589
  "@tscircuit/circuit-json-placement-analysis": "^0.0.15",
172590
172590
  "@tscircuit/circuit-json-routing-analysis": "^0.0.8",
172591
- "@tscircuit/circuit-json-schematic-placement-analysis": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/0.0.33.tgz",
172591
+ "@tscircuit/circuit-json-schematic-placement-analysis": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/0.0.46.tgz",
172592
172592
  "@tscircuit/circuit-json-util": "^0.0.120",
172593
172593
  "@tscircuit/eval": "0.0.1569",
172594
172594
  "@tscircuit/fake-snippets": "^0.0.182",
@@ -349717,7 +349717,7 @@ var registerCheckRoutingDifficulty = (program) => {
349717
349717
  });
349718
349718
  };
349719
349719
 
349720
- // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/MosfetGateNetworkPlacementSolver/MosfetGateNetworkPlacementSolver.ts
349720
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ParallelDiodeResistorPlacementSolver/ParallelDiodeResistorPlacementSolver.ts
349721
349721
  import { BaseSolver as BaseSolver5 } from "@tscircuit/solver-utils";
349722
349722
 
349723
349723
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/format.ts
@@ -349882,8 +349882,519 @@ function append2(map, key, value) {
349882
349882
  map.set(key, [value]);
349883
349883
  }
349884
349884
 
349885
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ParallelDiodeResistorPlacementSolver/ParallelDiodeResistorPlacementSolver.ts
349886
+ class ParallelDiodeResistorPlacementSolver extends BaseSolver5 {
349887
+ params;
349888
+ banks = [];
349889
+ bankIndex = 0;
349890
+ constructor(params2) {
349891
+ super();
349892
+ this.params = params2;
349893
+ const index = new PlacementNetworkIndex(params2.ctx);
349894
+ const byNets = new Map;
349895
+ for (const component of index.components.values()) {
349896
+ const diode = component.ftype === "simple_diode" || component.ftype === "simple_led";
349897
+ if (!diode && component.ftype !== "simple_resistor")
349898
+ continue;
349899
+ const id = component.source_component_id;
349900
+ const box = index.placement(id);
349901
+ const nets = index.twoTerminalNets(id)?.sort();
349902
+ const ports = index.portsByComponent.get(id);
349903
+ if (!box || !nets || !ports)
349904
+ continue;
349905
+ const pins = nets.map((net) => {
349906
+ const port = ports.find((p) => index.connected(p.source_port_id) === net);
349907
+ return port && index.port(port);
349908
+ });
349909
+ const [first, second] = pins;
349910
+ const member = { diode, box };
349911
+ if (first && second && !ports.some((port) => port.do_not_connect) && pins.every((pin) => pin?.schematic_sheet_id === box.schematicSheetId)) {
349912
+ member.pins = [first, second];
349913
+ member.axis = pinAxis(first, second);
349914
+ }
349915
+ const key = JSON.stringify(nets);
349916
+ const scopes = byNets.get(key) ?? [];
349917
+ const bank = scopes.find((items) => index.sameLocalScope(items[0].box, box));
349918
+ if (bank)
349919
+ bank.push(member);
349920
+ else {
349921
+ const items = [member];
349922
+ scopes.push(items);
349923
+ this.banks.push(items);
349924
+ }
349925
+ byNets.set(key, scopes);
349926
+ }
349927
+ this.solved = this.banks.length === 0;
349928
+ }
349929
+ _step() {
349930
+ const bank = this.banks[this.bankIndex++];
349931
+ this.solved = this.bankIndex >= this.banks.length;
349932
+ if (bank.length !== 2)
349933
+ return;
349934
+ const diode = bank.find((member) => member.diode);
349935
+ const resistor = bank.find((member) => !member.diode);
349936
+ if (!diode?.pins || !diode.axis || !resistor?.pins || !resistor.axis)
349937
+ return;
349938
+ const a = diode.box;
349939
+ const b = resistor.box;
349940
+ if (Math.abs(a.schX - b.schX) < (a.width + b.width) / 2 && Math.abs(a.schY - b.schY) < (a.height + b.height) / 2)
349941
+ return;
349942
+ let reason;
349943
+ if (diode.axis !== resistor.axis)
349944
+ reason = "different_axes";
349945
+ else {
349946
+ const coordinate = diode.axis === "horizontal" ? "x" : "y";
349947
+ const d = diode.pins.map((pin) => pin.center[coordinate]);
349948
+ const r = resistor.pins.map((pin) => pin.center[coordinate]);
349949
+ if ((d[1] - d[0]) * (r[1] - r[0]) < 0)
349950
+ reason = "crossed_connections";
349951
+ else {
349952
+ const overlap = Math.min(Math.max(...d), Math.max(...r)) - Math.max(Math.min(...d), Math.min(...r));
349953
+ if (overlap > 0.01)
349954
+ return;
349955
+ reason = "staggered";
349956
+ }
349957
+ }
349958
+ this.params.issues.push({
349959
+ lineItemType: "ParallelDiodeResistorNotAligned",
349960
+ diodeSchematicBox: a,
349961
+ resistorSchematicBox: b,
349962
+ reason,
349963
+ message: `Draw ${a.sourceComponentName || "the diode"} and ${b.sourceComponentName || "the resistor"} as adjacent parallel rows or columns with their shared nets at matching ends. Preserve every pin connection and diode polarity, leave room for labels, and reroute the affected wires.`
349964
+ });
349965
+ }
349966
+ static issueToString(issue) {
349967
+ const attrs = [];
349968
+ addAttr(attrs, "diodeComponentName", issue.diodeSchematicBox.sourceComponentName);
349969
+ addAttr(attrs, "resistorComponentName", issue.resistorSchematicBox.sourceComponentName);
349970
+ addAttr(attrs, "reason", issue.reason);
349971
+ addAttr(attrs, "message", issue.message);
349972
+ return `<ParallelDiodeResistorNotAligned ${attrs.join(" ")} />`;
349973
+ }
349974
+ }
349975
+ function pinAxis(first, second) {
349976
+ const directions = new Set([first.facing_direction, second.facing_direction]);
349977
+ if (directions.has("left") && directions.has("right") && Math.abs(first.center.y - second.center.y) < 0.01 && Math.abs(first.center.x - second.center.x) > 0.01)
349978
+ return "horizontal";
349979
+ if (directions.has("up") && directions.has("down") && Math.abs(first.center.x - second.center.x) < 0.01 && Math.abs(first.center.y - second.center.y) > 0.01)
349980
+ return "vertical";
349981
+ }
349982
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/RailPathVisibilitySolver/RailPathVisibilitySolver.ts
349983
+ import { BaseSolver as BaseSolver6 } from "@tscircuit/solver-utils";
349984
+ var distance49 = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
349985
+ var EPS6 = 0.001;
349986
+
349987
+ class RailPathVisibilitySolver extends BaseSolver6 {
349988
+ index;
349989
+ nodes = new Map;
349990
+ starts = [];
349991
+ currentIndex = 0;
349992
+ issues;
349993
+ maxSpan;
349994
+ maxLength;
349995
+ constructor({
349996
+ ctx,
349997
+ issues,
349998
+ maxSpan = 8,
349999
+ maxLength = 16
350000
+ }) {
350001
+ super();
350002
+ this.index = new PlacementNetworkIndex(ctx);
350003
+ this.issues = issues;
350004
+ if (!Number.isFinite(maxSpan) || maxSpan < 0 || !Number.isFinite(maxLength) || maxLength < 0)
350005
+ throw new Error("Rail visibility thresholds must be finite and nonnegative");
350006
+ this.maxSpan = maxSpan;
350007
+ this.maxLength = maxLength;
350008
+ const index = this.index;
350009
+ const node = (point, net, sheet) => {
350010
+ const id = JSON.stringify([
350011
+ sheet,
350012
+ net,
350013
+ Math.round(point.x / EPS6),
350014
+ Math.round(point.y / EPS6)
350015
+ ]);
350016
+ if (!this.nodes.has(id))
350017
+ this.nodes.set(id, { point, net, sheet, links: [] });
350018
+ return id;
350019
+ };
350020
+ const link = (a, b, extra) => {
350021
+ const first = this.nodes.get(a), second = this.nodes.get(b);
350022
+ const length = distance49(first.point, second.point);
350023
+ first.links.push({ to: b, length, ...extra });
350024
+ second.links.push({ to: a, length, ...extra });
350025
+ };
350026
+ const portNodes = new Map;
350027
+ for (const [componentId, ports] of index.portsByComponent) {
350028
+ for (const port of ports) {
350029
+ const placed = index.port(port);
350030
+ if (!placed)
350031
+ continue;
350032
+ const id = node(placed.center, index.connected(port.source_port_id), placed.schematic_sheet_id);
350033
+ portNodes.set(port.source_port_id, id);
350034
+ if (ports.length > 2)
350035
+ this.starts.push({
350036
+ portId: port.source_port_id,
350037
+ componentId,
350038
+ nodeId: id
350039
+ });
350040
+ }
350041
+ }
350042
+ for (const element of ctx.circuitJson) {
350043
+ if (element.type !== "schematic_net_label" || !element.source_net_id || !element.anchor_position)
350044
+ continue;
350045
+ const net = index.connected(element.source_net_id);
350046
+ if (!index.isRail(net) || index.powerNets.has(net) && index.groundNets.has(net))
350047
+ continue;
350048
+ const id = node(element.anchor_position, net, element.schematic_sheet_id);
350049
+ this.nodes.get(id).terminal = index.groundNets.has(net) ? "ground" : "power";
350050
+ }
350051
+ const segments = [];
350052
+ for (const element of ctx.circuitJson) {
350053
+ if (element.type !== "schematic_trace")
350054
+ continue;
350055
+ const net = traceNet(element, ctx.circuitJson, index);
350056
+ if (!net)
350057
+ continue;
350058
+ for (const edge of element.edges) {
350059
+ segments.push({
350060
+ from: node(edge.from, net, element.schematic_sheet_id),
350061
+ to: node(edge.to, net, element.schematic_sheet_id),
350062
+ traceId: element.schematic_trace_id
350063
+ });
350064
+ }
350065
+ }
350066
+ for (const segment of segments) {
350067
+ const a = this.nodes.get(segment.from), b = this.nodes.get(segment.to);
350068
+ const length = distance49(a.point, b.point);
350069
+ if (length < EPS6)
350070
+ continue;
350071
+ const onSegment = [...this.nodes].filter(([, n]) => n.net === a.net && n.sheet === a.sheet && pointOnSegment(n.point, a.point, b.point)).sort(([, p], [, q]) => distance49(a.point, p.point) - distance49(a.point, q.point));
350072
+ for (let i = 1;i < onSegment.length; i++)
350073
+ link(onSegment[i - 1][0], onSegment[i][0], {
350074
+ traceId: segment.traceId
350075
+ });
350076
+ }
350077
+ for (const [id, component] of index.components) {
350078
+ if (!["simple_resistor", "simple_capacitor", "simple_inductor"].includes(component.ftype))
350079
+ continue;
350080
+ const ports = index.portsByComponent.get(id);
350081
+ if (ports?.length !== 2 || !index.twoTerminalNets(id))
350082
+ continue;
350083
+ const a = portNodes.get(ports[0].source_port_id), b = portNodes.get(ports[1].source_port_id);
350084
+ if (a && b)
350085
+ link(a, b, { componentId: id });
350086
+ }
350087
+ this.solved = this.starts.length === 0;
350088
+ }
350089
+ _step() {
350090
+ const start = this.starts[this.currentIndex++];
350091
+ this.solved = this.currentIndex >= this.starts.length;
350092
+ if (!start)
350093
+ return;
350094
+ const sourcePort = this.index.portsByComponent.get(start.componentId)?.find((port) => port.source_port_id === start.portId);
350095
+ const placedPort = sourcePort ? this.index.port(sourcePort) : undefined;
350096
+ const sourcePortName = placedPort?.display_pin_label || sourcePort?.name || (placedPort?.pin_number !== undefined ? `pin${placedPort.pin_number}` : "connected pin");
350097
+ const host = this.index.placement(start.componentId);
350098
+ if (!host)
350099
+ return;
350100
+ const queue = [
350101
+ { id: start.nodeId, length: 0, hops: 0, path: [start.nodeId], links: [] }
350102
+ ];
350103
+ const bestLengths = new Map([[`${start.nodeId}:0`, 0]]);
350104
+ while (queue.length) {
350105
+ queue.sort((a, b) => a.length - b.length);
350106
+ const state = queue.shift();
350107
+ const key = `${state.id}:${state.hops}`;
350108
+ if (state.length !== bestLengths.get(key))
350109
+ continue;
350110
+ const current = this.nodes.get(state.id);
350111
+ if (current.terminal) {
350112
+ const points = state.path.map((id) => this.nodes.get(id).point);
350113
+ const xs = points.map((p) => p.x), ys = points.map((p) => p.y);
350114
+ const bounds = {
350115
+ left: Math.min(...xs),
350116
+ right: Math.max(...xs),
350117
+ bottom: Math.min(...ys),
350118
+ top: Math.max(...ys)
350119
+ };
350120
+ const span = Math.max(bounds.right - bounds.left, bounds.top - bounds.bottom);
350121
+ if (span <= this.maxSpan && state.length <= this.maxLength)
350122
+ return;
350123
+ const componentIds = [
350124
+ ...new Set(state.links.flatMap((l) => l.componentId ? [l.componentId] : []))
350125
+ ];
350126
+ this.issues.push({
350127
+ lineItemType: "RailPathTooSpreadOut",
350128
+ hostSchematicBox: host,
350129
+ sourcePortId: start.portId,
350130
+ sourcePortName,
350131
+ railType: current.terminal,
350132
+ supportSchematicBoxes: componentIds.flatMap((id) => {
350133
+ const placement = this.index.placement(id);
350134
+ return placement ? [placement] : [];
350135
+ }),
350136
+ schematicTraceIds: [
350137
+ ...new Set(state.links.flatMap((l) => l.traceId ? [l.traceId] : []))
350138
+ ],
350139
+ pathPoints: points,
350140
+ pathBounds: bounds,
350141
+ pathLength: state.length,
350142
+ pathSpan: span,
350143
+ maxRecommendedSpan: this.maxSpan,
350144
+ maxRecommendedPathLength: this.maxLength,
350145
+ message: `Visible path from ${host.sourceComponentName || "component"}.${sourcePortName} to ${current.terminal} spans ${span.toFixed(2)} schematic units; move the connected support elements closer together near the pin and recompute their schematic traces.`
350146
+ });
350147
+ return;
350148
+ }
350149
+ for (const edge of current.links) {
350150
+ if (state.path.includes(edge.to))
350151
+ continue;
350152
+ if (edge.componentId) {
350153
+ const placement = this.index.placement(edge.componentId);
350154
+ if (state.hops >= 3 || !placement || !this.index.sameLocalScope(host, placement))
350155
+ continue;
350156
+ }
350157
+ const length = state.length + edge.length;
350158
+ const hops = state.hops + (edge.componentId ? 1 : 0);
350159
+ const nextKey = `${edge.to}:${hops}`;
350160
+ if (length >= (bestLengths.get(nextKey) ?? Infinity))
350161
+ continue;
350162
+ bestLengths.set(nextKey, length);
350163
+ queue.push({
350164
+ id: edge.to,
350165
+ length,
350166
+ hops,
350167
+ path: [...state.path, edge.to],
350168
+ links: [...state.links, edge]
350169
+ });
350170
+ }
350171
+ }
350172
+ }
350173
+ static issueToString(issue) {
350174
+ const attrs = [];
350175
+ addAttr(attrs, "hostName", issue.hostSchematicBox.sourceComponentName);
350176
+ addAttr(attrs, "pinName", issue.sourcePortName);
350177
+ addAttr(attrs, "railType", issue.railType);
350178
+ addAttr(attrs, "pathSpan", issue.pathSpan);
350179
+ addAttr(attrs, "pathLength", issue.pathLength);
350180
+ addAttr(attrs, "message", issue.message);
350181
+ return `<RailPathTooSpreadOut ${attrs.join(" ")} />`;
350182
+ }
350183
+ }
350184
+ function traceNet(trace, circuitJson, index) {
350185
+ if (trace.subcircuit_connectivity_map_key)
350186
+ return index.connected(`connectivity:${trace.subcircuit_connectivity_map_key}`);
350187
+ const source = circuitJson.find((e) => e.type === "source_trace" && e.source_trace_id === trace.source_trace_id);
350188
+ if (source?.type !== "source_trace")
350189
+ return;
350190
+ const ids = [
350191
+ ...source.connected_source_port_ids,
350192
+ ...source.connected_source_net_ids
350193
+ ];
350194
+ return ids[0] ? index.connected(ids[0]) : undefined;
350195
+ }
350196
+ function pointOnSegment(p, a, b) {
350197
+ const dx = b.x - a.x, dy = b.y - a.y, length = distance49(a, b);
350198
+ if (length < EPS6)
350199
+ return distance49(a, p) < EPS6;
350200
+ const projection = ((p.x - a.x) * dx + (p.y - a.y) * dy) / length;
350201
+ const perpendicular = Math.abs((p.x - a.x) * dy - (p.y - a.y) * dx) / length;
350202
+ return perpendicular < EPS6 && projection >= -EPS6 && projection <= length + EPS6;
350203
+ }
350204
+
350205
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ChipPinPairCapacitorPlacementSolver/ChipPinPairCapacitorPlacementSolver.ts
350206
+ import { BaseSolver as BaseSolver7 } from "@tscircuit/solver-utils";
350207
+ class ChipPinPairCapacitorPlacementSolver extends BaseSolver7 {
350208
+ params;
350209
+ index;
350210
+ capacitorIds;
350211
+ unpopulated = new Set;
350212
+ currentIndex = 0;
350213
+ constructor(params2) {
350214
+ super();
350215
+ this.params = params2;
350216
+ this.index = new PlacementNetworkIndex(params2.ctx);
350217
+ for (const element of params2.ctx.circuitJson)
350218
+ if (element.type === "pcb_component" && element.do_not_place)
350219
+ this.unpopulated.add(element.source_component_id);
350220
+ this.capacitorIds = [...this.index.components.values()].filter((component) => component.ftype === "simple_capacitor").map((component) => component.source_component_id);
350221
+ this.solved = this.capacitorIds.length === 0;
350222
+ }
350223
+ _step() {
350224
+ const capacitorId = this.capacitorIds[this.currentIndex++];
350225
+ this.solved = this.currentIndex >= this.capacitorIds.length;
350226
+ if (!capacitorId || this.unpopulated.has(capacitorId))
350227
+ return;
350228
+ const index = this.index;
350229
+ const component = index.components.get(capacitorId);
350230
+ const capacitor = index.placement(capacitorId);
350231
+ const capacitorPorts = index.portsByComponent.get(capacitorId) ?? [];
350232
+ const nets = index.twoTerminalNets(capacitorId);
350233
+ if (component?.ftype !== "simple_capacitor" || !Number.isFinite(component.capacitance) || component.capacitance <= 0 || !capacitor || !nets || nets.some((net) => index.isRail(net)) || capacitorPorts.some((port) => port.do_not_connect || hasSupplyRole(port)))
350234
+ return;
350235
+ const peers = nets.map((net) => {
350236
+ const members = index.portsByNet.get(net) ?? [];
350237
+ if (members.length !== 2)
350238
+ return;
350239
+ return members.find((port) => port.source_component_id !== capacitorId);
350240
+ });
350241
+ const [first, second] = peers;
350242
+ if (!first || !second || first.source_component_id !== second.source_component_id || first.do_not_connect || second.do_not_connect || hasSupplyRole(first) || hasSupplyRole(second))
350243
+ return;
350244
+ const hostId = first.source_component_id;
350245
+ const host = index.placement(hostId);
350246
+ if (index.components.get(hostId)?.ftype !== "simple_chip" || this.unpopulated.has(hostId) || !host || !index.sameLocalScope(host, capacitor))
350247
+ return;
350248
+ const chipPorts = [first, second];
350249
+ const pins = chipPorts.map((port) => index.port(port));
350250
+ const capPins = capacitorPorts.map((port) => index.port(port));
350251
+ if ([...pins, ...capPins].some((pin) => !pin || pin.schematic_sheet_id !== host.schematicSheetId || !Number.isFinite(pin.center.x) || !Number.isFinite(pin.center.y)) || [host, capacitor].some((box) => ![box.schX, box.schY, box.width, box.height].every(Number.isFinite) || box.width <= 0 || box.height <= 0))
350252
+ return;
350253
+ const firstPin = pins[0], secondPin = pins[1];
350254
+ const side = firstPin.facing_direction;
350255
+ if (!side || side !== secondPin.facing_direction)
350256
+ return;
350257
+ const horizontal = side === "left" || side === "right";
350258
+ const sign = side === "left" || side === "down" ? -1 : 1;
350259
+ const pinSpan = Math.hypot(firstPin.center.x - secondPin.center.x, firstPin.center.y - secondPin.center.y);
350260
+ if (pinSpan < 0.01)
350261
+ return;
350262
+ const oppositeDistance = -sign * (horizontal ? capacitor.schX - host.schX : capacitor.schY - host.schY);
350263
+ const halfBodies = horizontal ? (host.width + capacitor.width) / 2 : (host.height + capacitor.height) / 2;
350264
+ if (oppositeDistance <= halfBodies + 0.2)
350265
+ return;
350266
+ const maxPinDistance = Math.max(...pins.map((pin, i) => Math.hypot(pin.center.x - capPins[i].center.x, pin.center.y - capPins[i].center.y)));
350267
+ const maxRecommendedPinDistance = Math.max(4, 3 * Math.max(capacitor.width, capacitor.height), 2 * pinSpan);
350268
+ if (maxPinDistance <= maxRecommendedPinDistance)
350269
+ return;
350270
+ this.params.issues.push({
350271
+ lineItemType: "CapacitorSeparatedFromChipPins",
350272
+ hostSchematicBox: host,
350273
+ capacitorSchematicBox: capacitor,
350274
+ chipSourcePortIds: [
350275
+ chipPorts[0].source_port_id,
350276
+ chipPorts[1].source_port_id
350277
+ ],
350278
+ maxPinDistance,
350279
+ maxRecommendedPinDistance,
350280
+ message: `Place ${capacitor.sourceComponentName || "component"} beside its two connected pins on the ${side} side of ${host.sourceComponentName || "component"} so their connections can be read together. Preserve pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`
350281
+ });
350282
+ }
350283
+ static issueToString(issue) {
350284
+ const attrs = [];
350285
+ addAttr(attrs, "hostComponentName", issue.hostSchematicBox.sourceComponentName);
350286
+ addAttr(attrs, "capacitorName", issue.capacitorSchematicBox.sourceComponentName);
350287
+ addAttr(attrs, "maxPinDistance", issue.maxPinDistance);
350288
+ addAttr(attrs, "maxRecommendedPinDistance", issue.maxRecommendedPinDistance);
350289
+ addAttr(attrs, "message", issue.message);
350290
+ return `<CapacitorSeparatedFromChipPins ${attrs.join(" ")} />`;
350291
+ }
350292
+ }
350293
+ function hasSupplyRole(port) {
350294
+ return Boolean(port.requires_power || port.provides_power || port.requires_ground || port.provides_ground || port.requires_voltage !== undefined || port.provides_voltage !== undefined);
350295
+ }
350296
+
350297
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/PiFilterPlacementSolver/PiFilterPlacementSolver.ts
350298
+ import { BaseSolver as BaseSolver8 } from "@tscircuit/solver-utils";
350299
+ class PiFilterPlacementSolver extends BaseSolver8 {
350300
+ params;
350301
+ index;
350302
+ inductorIds;
350303
+ unpopulated = new Set;
350304
+ currentIndex = 0;
350305
+ constructor(params2) {
350306
+ super();
350307
+ this.params = params2;
350308
+ this.index = new PlacementNetworkIndex(params2.ctx);
350309
+ for (const e of params2.ctx.circuitJson)
350310
+ if (e.type === "pcb_component" && e.do_not_place)
350311
+ this.unpopulated.add(e.source_component_id);
350312
+ for (const e of params2.ctx.circuitJson)
350313
+ if (e.type === "pcb_component" && !e.do_not_place)
350314
+ this.unpopulated.delete(e.source_component_id);
350315
+ this.inductorIds = [...this.index.components.values()].filter((c) => c.ftype === "simple_inductor" && !this.unpopulated.has(c.source_component_id)).map((c) => c.source_component_id);
350316
+ this.solved = this.inductorIds.length === 0;
350317
+ }
350318
+ _step() {
350319
+ const id = this.inductorIds[this.currentIndex++];
350320
+ this.solved = this.currentIndex >= this.inductorIds.length;
350321
+ if (!id)
350322
+ return;
350323
+ const index = this.index;
350324
+ const inductor = this.localPart(id);
350325
+ const nets = index.twoTerminalNets(id);
350326
+ if (!inductor || !nets || nets.some((net) => index.isRail(net)))
350327
+ return;
350328
+ const branches = nets.map((net) => {
350329
+ const peers = index.portsByNet.get(net) ?? [];
350330
+ if (peers.some((p) => p.source_component_id !== id && !this.unpopulated.has(p.source_component_id) && index.components.get(p.source_component_id)?.ftype === "simple_inductor"))
350331
+ return;
350332
+ const capacitors = peers.filter((p) => {
350333
+ const c = index.components.get(p.source_component_id);
350334
+ const capNets = index.twoTerminalNets(p.source_component_id);
350335
+ return c?.ftype === "simple_capacitor" && !this.unpopulated.has(p.source_component_id) && capNets?.some((n) => n !== net && index.groundNets.has(n));
350336
+ });
350337
+ if (capacitors.length !== 1)
350338
+ return;
350339
+ const capacitorPort = capacitors[0];
350340
+ const component = index.components.get(capacitorPort.source_component_id);
350341
+ if (component.ftype !== "simple_capacitor" || !Number.isFinite(component.capacitance) || component.capacitance <= 0)
350342
+ return;
350343
+ const capacitor = this.localPart(capacitorPort.source_component_id);
350344
+ if (!capacitor || !index.sameLocalScope(inductor.placement, capacitor.placement))
350345
+ return;
350346
+ const capPin = index.port(capacitorPort);
350347
+ const seriesPin = index.port(inductor.ports.find((p) => index.connected(p.source_port_id) === net));
350348
+ return {
350349
+ placement: capacitor.placement,
350350
+ ground: index.twoTerminalNets(capacitorPort.source_component_id).find((n) => n !== net),
350351
+ distance: Math.hypot(capPin.center.x - seriesPin.center.x, capPin.center.y - seriesPin.center.y)
350352
+ };
350353
+ });
350354
+ const [first, second] = branches;
350355
+ if (!first || !second || first.ground !== second.ground)
350356
+ return;
350357
+ const placements = [inductor.placement, first.placement, second.placement];
350358
+ const maxRecommendedSignalPinDistance = Math.max(4, ...placements.map((p) => 3 * Math.max(p.width, p.height)));
350359
+ const maxSignalPinDistance = Math.max(first.distance, second.distance);
350360
+ if (maxSignalPinDistance <= maxRecommendedSignalPinDistance)
350361
+ return;
350362
+ const name = (p) => p.sourceComponentName || "component";
350363
+ this.params.issues.push({
350364
+ lineItemType: "PiFilterComponentsNotGrouped",
350365
+ inductorSchematicBox: inductor.placement,
350366
+ firstCapacitorSchematicBox: first.placement,
350367
+ secondCapacitorSchematicBox: second.placement,
350368
+ maxSignalPinDistance,
350369
+ maxRecommendedSignalPinDistance,
350370
+ message: `Group ${name(first.placement)} and ${name(second.placement)} beside the connected ends of ${name(inductor.placement)} so the series path and both grounded branches of the pi filter can be read together. Preserve pin connections, allow room for labels, and reroute affected traces.`
350371
+ });
350372
+ }
350373
+ localPart(id) {
350374
+ const placement = this.index.placement(id);
350375
+ const ports = this.index.portsByComponent.get(id);
350376
+ if (!placement || ports?.length !== 2 || ports.some((p) => {
350377
+ const pin = this.index.port(p);
350378
+ return p.do_not_connect || !pin || pin.schematic_sheet_id !== placement.schematicSheetId || !Number.isFinite(pin.center.x) || !Number.isFinite(pin.center.y);
350379
+ }))
350380
+ return;
350381
+ return { placement, ports };
350382
+ }
350383
+ static issueToString(issue) {
350384
+ const attrs = [];
350385
+ addAttr(attrs, "inductorName", issue.inductorSchematicBox.sourceComponentName);
350386
+ addAttr(attrs, "firstCapacitorName", issue.firstCapacitorSchematicBox.sourceComponentName);
350387
+ addAttr(attrs, "secondCapacitorName", issue.secondCapacitorSchematicBox.sourceComponentName);
350388
+ addAttr(attrs, "maxSignalPinDistance", issue.maxSignalPinDistance);
350389
+ addAttr(attrs, "maxRecommendedSignalPinDistance", issue.maxRecommendedSignalPinDistance);
350390
+ addAttr(attrs, "message", issue.message);
350391
+ return `<PiFilterComponentsNotGrouped ${attrs.join(" ")} />`;
350392
+ }
350393
+ }
350394
+
349885
350395
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/MosfetGateNetworkPlacementSolver/MosfetGateNetworkPlacementSolver.ts
349886
- class MosfetGateNetworkPlacementSolver extends BaseSolver5 {
350396
+ import { BaseSolver as BaseSolver9 } from "@tscircuit/solver-utils";
350397
+ class MosfetGateNetworkPlacementSolver extends BaseSolver9 {
349887
350398
  params;
349888
350399
  index;
349889
350400
  mosfetIds;
@@ -349951,7 +350462,7 @@ class MosfetGateNetworkPlacementSolver extends BaseSolver5 {
349951
350462
  gateSourceResistorSchematicBox: gateSourceResistor,
349952
350463
  maxBodyGap,
349953
350464
  maxRecommendedBodyGap,
349954
- message: `Group ${seriesGateResistor.sourceComponentName ?? seriesGateResistor.sourceComponentId} and ${gateSourceResistor.sourceComponentName ?? gateSourceResistor.sourceComponentId} beside ${mosfet.sourceComponentName ?? id}'s gate/source pins so the gate-drive branch can be read together. Preserve all pin connections, leave room for labels, and reroute affected traces.`
350465
+ message: `Group ${seriesGateResistor.sourceComponentName || "component"} and ${gateSourceResistor.sourceComponentName || "component"} beside ${mosfet.sourceComponentName || "component"}'s gate/source pins so the gate-drive branch can be read together. Preserve all pin connections, leave room for labels, and reroute affected traces.`
349955
350466
  });
349956
350467
  }
349957
350468
  mosfetPorts(id) {
@@ -349988,8 +350499,8 @@ function bodyGap(a, b) {
349988
350499
  }
349989
350500
 
349990
350501
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/RelayFlybackDiodePlacementSolver/RelayFlybackDiodePlacementSolver.ts
349991
- import { BaseSolver as BaseSolver6 } from "@tscircuit/solver-utils";
349992
- class RelayFlybackDiodePlacementSolver extends BaseSolver6 {
350502
+ import { BaseSolver as BaseSolver10 } from "@tscircuit/solver-utils";
350503
+ class RelayFlybackDiodePlacementSolver extends BaseSolver10 {
349993
350504
  params;
349994
350505
  index;
349995
350506
  relayIds;
@@ -350052,7 +350563,7 @@ class RelayFlybackDiodePlacementSolver extends BaseSolver6 {
350052
350563
  diodeSchematicBox: diode,
350053
350564
  coilSourcePortIds: [coil[0].source_port_id, coil[1].source_port_id],
350054
350565
  distanceFromCoilPins,
350055
- message: `Place ${diode.sourceComponentName ?? diodeId} beside ${relay.sourceComponentName ?? relayId}'s coil pins so the flyback protection loop can be read together. Preserve diode polarity and all pin connections; leave room for labels and reroute affected traces.`
350566
+ message: `Place ${diode.sourceComponentName || "component"} beside ${relay.sourceComponentName || "component"}'s coil pins so the flyback protection loop can be read together. Preserve diode polarity and all pin connections; leave room for labels and reroute affected traces.`
350056
350567
  });
350057
350568
  }
350058
350569
  hasWireAtPin(pin) {
@@ -350118,10 +350629,10 @@ function hasHint(port, pattern) {
350118
350629
  }
350119
350630
 
350120
350631
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/CurrentSenseShuntPlacementSolver/CurrentSenseShuntPlacementSolver.ts
350121
- import { BaseSolver as BaseSolver7 } from "@tscircuit/solver-utils";
350632
+ import { BaseSolver as BaseSolver11 } from "@tscircuit/solver-utils";
350122
350633
  var EPSILON3 = 0.01;
350123
350634
 
350124
- class CurrentSenseShuntPlacementSolver extends BaseSolver7 {
350635
+ class CurrentSenseShuntPlacementSolver extends BaseSolver11 {
350125
350636
  params;
350126
350637
  index;
350127
350638
  hostIds;
@@ -350208,7 +350719,7 @@ class CurrentSenseShuntPlacementSolver extends BaseSolver7 {
350208
350719
  positiveInputSourcePortId: inputs[0].source_port_id,
350209
350720
  negativeInputSourcePortId: inputs[1].source_port_id,
350210
350721
  inputBandGap,
350211
- message: `Place ${shunt.sourceComponentName ?? shuntId} near ${host.sourceComponentName ?? hostId}.${inputs[0].name}/${inputs[1].name}, so both sense connections can be read together. Move or rotate the shunt as needed; preserve all pin connections and leave room for labels.`
350722
+ message: `Place ${shunt.sourceComponentName || "component"} near ${host.sourceComponentName || "component"}.${inputs[0].name}/${inputs[1].name}, so both sense connections can be read together. Move or rotate the shunt as needed; preserve all pin connections and leave room for labels.`
350212
350723
  });
350213
350724
  }
350214
350725
  hasVisibleConnection(from, to, net) {
@@ -350271,8 +350782,8 @@ function onSegment4(point, from, to) {
350271
350782
  }
350272
350783
 
350273
350784
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/VoltageDividerPlacementSolver/VoltageDividerPlacementSolver.ts
350274
- import { BaseSolver as BaseSolver8 } from "@tscircuit/solver-utils";
350275
- class VoltageDividerPlacementSolver extends BaseSolver8 {
350785
+ import { BaseSolver as BaseSolver12 } from "@tscircuit/solver-utils";
350786
+ class VoltageDividerPlacementSolver extends BaseSolver12 {
350276
350787
  params;
350277
350788
  index;
350278
350789
  positiveNets = new Set;
@@ -350334,7 +350845,7 @@ class VoltageDividerPlacementSolver extends BaseSolver8 {
350334
350845
  supplyTapSourcePortId: supplyTap.bottom.source_port_id,
350335
350846
  groundTapSourcePortId: groundTap.top.source_port_id,
350336
350847
  reversedBodyGap,
350337
- message: `Place ${supply.sourceComponentName ?? supplyId} above ${ground.sourceComponentName ?? groundId}, close enough to read their shared divider tap. Preserve all connections and leave room for labels; exact alignment is not required.`
350848
+ message: `Place ${supply.sourceComponentName || "component"} above ${ground.sourceComponentName || "component"}, close enough to read their shared divider tap. Preserve all connections and leave room for labels; exact alignment is not required.`
350338
350849
  });
350339
350850
  }
350340
350851
  isResistor(id) {
@@ -350368,8 +350879,8 @@ class VoltageDividerPlacementSolver extends BaseSolver8 {
350368
350879
  }
350369
350880
 
350370
350881
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/RegulatorInputOutputCapacitorPlacementSolver/RegulatorInputOutputCapacitorPlacementSolver.ts
350371
- import { BaseSolver as BaseSolver9 } from "@tscircuit/solver-utils";
350372
- class RegulatorInputOutputCapacitorPlacementSolver extends BaseSolver9 {
350882
+ import { BaseSolver as BaseSolver13 } from "@tscircuit/solver-utils";
350883
+ class RegulatorInputOutputCapacitorPlacementSolver extends BaseSolver13 {
350373
350884
  params;
350374
350885
  index;
350375
350886
  hostIds;
@@ -350431,7 +350942,7 @@ class RegulatorInputOutputCapacitorPlacementSolver extends BaseSolver9 {
350431
350942
  };
350432
350943
  if (!beyondOppositeSide(inputCap, 1) || !beyondOppositeSide(outputCap, -1))
350433
350944
  return;
350434
- const name = host.sourceComponentName ?? hostId;
350945
+ const name = host.sourceComponentName || "component";
350435
350946
  this.params.issues.push({
350436
350947
  lineItemType: "RegulatorCapacitorsOnWrongSides",
350437
350948
  regulatorSchematicBox: host,
@@ -350489,7 +351000,7 @@ function portRole(port) {
350489
351000
  }
350490
351001
 
350491
351002
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ConnectorPlacementSolver/ConnectorPlacementSolver.ts
350492
- import { BaseSolver as BaseSolver10 } from "@tscircuit/solver-utils";
351003
+ import { BaseSolver as BaseSolver14 } from "@tscircuit/solver-utils";
350493
351004
 
350494
351005
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/geometry.ts
350495
351006
  function centeredRect(cx, cy, w, h) {
@@ -350515,11 +351026,11 @@ var directions = {
350515
351026
  down: { x: 0, y: -1 }
350516
351027
  };
350517
351028
  var dot3 = (a, b) => a.x * b.x + a.y * b.y;
350518
- var distance49 = (a, b) => Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
350519
- var near = (a, b) => distance49(a, b) <= EPSILON4;
351029
+ var distance50 = (a, b) => Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
351030
+ var near = (a, b) => distance50(a, b) <= EPSILON4;
350520
351031
  var round = (value) => Math.round(value * 100) / 100;
350521
351032
 
350522
- class ConnectorPlacementSolver extends BaseSolver10 {
351033
+ class ConnectorPlacementSolver extends BaseSolver14 {
350523
351034
  params;
350524
351035
  constructor(params2) {
350525
351036
  super();
@@ -350603,10 +351114,10 @@ class ConnectorPlacementSolver extends BaseSolver10 {
350603
351114
  x: pin.center.x + delta.x,
350604
351115
  y: pin.center.y + delta.y
350605
351116
  });
350606
- if (connections.some((c) => distance49(movedPin(c.pin), c.peer.center) > distance49(c.pin.center, c.peer.center) + EPSILON4))
351117
+ if (connections.some((c) => distance50(movedPin(c.pin), c.peer.center) > distance50(c.pin.center, c.peer.center) + EPSILON4))
350607
351118
  continue;
350608
- const before = connections.reduce((sum, c) => sum + distance49(c.pin.center, c.peer.center), 0);
350609
- const after = connections.reduce((sum, c) => sum + distance49(movedPin(c.pin), c.peer.center), 0);
351119
+ const before = connections.reduce((sum, c) => sum + distance50(c.pin.center, c.peer.center), 0);
351120
+ const after = connections.reduce((sum, c) => sum + distance50(movedPin(c.pin), c.peer.center), 0);
350610
351121
  if (before - after < 4 || after > before * 0.75)
350611
351122
  continue;
350612
351123
  const obstacles = ctx.componentPlacements.filter((p) => p.schematicSheetId === connector.schematicSheetId && p.schematicComponentId !== connector.schematicComponentId);
@@ -350638,7 +351149,7 @@ class ConnectorPlacementSolver extends BaseSolver10 {
350638
351149
  c.component
350639
351150
  ])).values()
350640
351151
  ];
350641
- const name = connector.sourceComponentName ?? connector.schematicComponentId;
351152
+ const name = connector.sourceComponentName || "component";
350642
351153
  issues.push({
350643
351154
  lineItemType: "ConnectorPositionCausesTraceDetours",
350644
351155
  connectorSchematicBox: connector,
@@ -350653,7 +351164,7 @@ class ConnectorPlacementSolver extends BaseSolver10 {
350653
351164
  deltaSchY: round(delta.y),
350654
351165
  currentTotalSignalDistance: round(before),
350655
351166
  suggestedTotalSignalDistance: round(after),
350656
- message: `Move ${name} to schX=${target.x}, schY=${target.y} so its signal pins face ${connectedComponents.map((p) => p.sourceComponentName ?? p.schematicComponentId).join(", ")}. Preserve rotation and pin assignments; reroute the connections and attached rail labels.`
351167
+ message: `Move ${name} to schX=${target.x}, schY=${target.y} so its signal pins face ${connectedComponents.map((p) => p.sourceComponentName || "component").join(", ")}. Preserve rotation and pin assignments; reroute the connections and attached rail labels.`
350657
351168
  });
350658
351169
  }
350659
351170
  this.solved = true;
@@ -350661,7 +351172,7 @@ class ConnectorPlacementSolver extends BaseSolver10 {
350661
351172
  static issueToString(issue) {
350662
351173
  const attrs = [];
350663
351174
  addAttr(attrs, "connectorComponentName", issue.connectorSchematicBox.sourceComponentName);
350664
- addAttr(attrs, "connectedComponents", issue.connectedComponents.map((p) => p.sourceComponentName ?? p.schematicComponentId).join(","));
351175
+ addAttr(attrs, "connectedComponents", issue.connectedComponents.map((p) => p.sourceComponentName || "component").join(","));
350665
351176
  for (const key of [
350666
351177
  "evaluatedSignalCount",
350667
351178
  "newSchX",
@@ -350705,8 +351216,8 @@ function segmentCrossesBox(a, b, box) {
350705
351216
  }
350706
351217
 
350707
351218
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/LowSideTransistorPlacementSolver/LowSideTransistorPlacementSolver.ts
350708
- import { BaseSolver as BaseSolver11 } from "@tscircuit/solver-utils";
350709
- class LowSideTransistorPlacementSolver extends BaseSolver11 {
351219
+ import { BaseSolver as BaseSolver15 } from "@tscircuit/solver-utils";
351220
+ class LowSideTransistorPlacementSolver extends BaseSolver15 {
350710
351221
  index;
350711
351222
  positiveNets = new Set;
350712
351223
  transistorIds;
@@ -350795,8 +351306,8 @@ class LowSideTransistorPlacementSolver extends BaseSolver11 {
350795
351306
  placementProblems.push("emitter_not_down");
350796
351307
  if (placementProblems.length === 0)
350797
351308
  return;
350798
- const name = transistor.sourceComponentName ?? id;
350799
- const loadName = load2.sourceComponentName ?? loadId;
351309
+ const name = transistor.sourceComponentName || "component";
351310
+ const loadName = load2.sourceComponentName || "component";
350800
351311
  this.issues.push({
350801
351312
  lineItemType: "LowSideTransistorNotAlignedWithLoad",
350802
351313
  transistorSchematicBox: transistor,
@@ -350808,7 +351319,7 @@ class LowSideTransistorPlacementSolver extends BaseSolver11 {
350808
351319
  collectorFacingDirection,
350809
351320
  emitterFacingDirection,
350810
351321
  placementProblems,
350811
- message: `Arrange ${name} below ${loadName}, with its collector facing up toward the load and emitter facing down toward ground; place ${baseResistor.sourceComponentName ?? resistorId} beside the base. Preserve all pin connections and reroute affected traces.`
351322
+ message: `Arrange ${name} below ${loadName}, with its collector facing up toward the load and emitter facing down toward ground; place ${baseResistor.sourceComponentName || "component"} beside the base. Preserve all pin connections and reroute affected traces.`
350812
351323
  });
350813
351324
  }
350814
351325
  static issueToString(issue) {
@@ -350826,8 +351337,8 @@ class LowSideTransistorPlacementSolver extends BaseSolver11 {
350826
351337
  }
350827
351338
 
350828
351339
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/UsbSeriesResistorPlacementSolver/UsbSeriesResistorPlacementSolver.ts
350829
- import { BaseSolver as BaseSolver12 } from "@tscircuit/solver-utils";
350830
- class UsbSeriesResistorPlacementSolver extends BaseSolver12 {
351340
+ import { BaseSolver as BaseSolver16 } from "@tscircuit/solver-utils";
351341
+ class UsbSeriesResistorPlacementSolver extends BaseSolver16 {
350831
351342
  params;
350832
351343
  index;
350833
351344
  hostIds;
@@ -350877,8 +351388,8 @@ class UsbSeriesResistorPlacementSolver extends BaseSolver12 {
350877
351388
  if (bodyGap < Math.max(alongA, alongB) || across >= (acrossA + acrossB) / 2 - 0.01)
350878
351389
  return;
350879
351390
  this.reportedPairs.add(pairKey);
350880
- const positiveName = a.sourceComponentName ?? positive.id;
350881
- const negativeName = b.sourceComponentName ?? negative.id;
351391
+ const positiveName = a.sourceComponentName || "component";
351392
+ const negativeName = b.sourceComponentName || "component";
350882
351393
  this.params.issues.push({
350883
351394
  lineItemType: "UsbSeriesResistorsNotAligned",
350884
351395
  positiveResistorSchematicBox: a,
@@ -350947,7 +351458,7 @@ function usbRole(port) {
350947
351458
  }
350948
351459
 
350949
351460
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/CapacitorOrientationSolver/CapacitorOrientationSolver.ts
350950
- import { BaseSolver as BaseSolver13 } from "@tscircuit/solver-utils";
351461
+ import { BaseSolver as BaseSolver17 } from "@tscircuit/solver-utils";
350951
351462
 
350952
351463
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/graphics.ts
350953
351464
  import { mergeGraphics as mergeGraphics2 } from "graphics-debug";
@@ -350982,7 +351493,7 @@ function visualizeCircuitJson(circuitJson) {
350982
351493
  }
350983
351494
 
350984
351495
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/CapacitorOrientationSolver/CapacitorOrientationSolver.ts
350985
- class CapacitorOrientationSolver extends BaseSolver13 {
351496
+ class CapacitorOrientationSolver extends BaseSolver17 {
350986
351497
  static EPSILON = 0.01;
350987
351498
  static ORIENTATION_MESSAGE = 'Use schOrientation="vertical" on this capacitor to fix the symbol orientation';
350988
351499
  ctx;
@@ -351127,10 +351638,10 @@ class CapacitorOrientationSolver extends BaseSolver13 {
351127
351638
  }
351128
351639
 
351129
351640
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/DecouplingCapacitorGroupingSolver/DecouplingCapacitorGroupingSolver.ts
351130
- import { BaseSolver as BaseSolver14 } from "@tscircuit/solver-utils";
351131
- class DecouplingCapacitorGroupingSolver extends BaseSolver14 {
351641
+ import { BaseSolver as BaseSolver18 } from "@tscircuit/solver-utils";
351642
+ class DecouplingCapacitorGroupingSolver extends BaseSolver18 {
351132
351643
  params;
351133
- static MIN_BODY_GAP = 4;
351644
+ static MIN_BODY_GAP = 1;
351134
351645
  banks = [];
351135
351646
  netNames = new Map;
351136
351647
  bankIndex = 0;
@@ -351189,19 +351700,28 @@ class DecouplingCapacitorGroupingSolver extends BaseSolver14 {
351189
351700
  this.solved = this.bankIndex >= this.banks.length;
351190
351701
  if (bank.capacitors.length < 2)
351191
351702
  return;
351192
- const maxRecommendedBodyGap = Math.max(DecouplingCapacitorGroupingSolver.MIN_BODY_GAP, ...bank.capacitors.map((box) => 3 * Math.max(box.width, box.height)));
351703
+ const maxRecommendedBodyGap = Math.max(DecouplingCapacitorGroupingSolver.MIN_BODY_GAP, ...bank.capacitors.map((box) => Math.max(box.width, box.height)));
351193
351704
  let maxBodyGap = 0;
351194
- for (let i = 0;i < bank.capacitors.length; i++) {
351195
- for (const b of bank.capacitors.slice(i + 1)) {
351196
- const a = bank.capacitors[i];
351197
- const gap = Math.hypot(Math.max(0, Math.abs(a.schX - b.schX) - (a.width + b.width) / 2), Math.max(0, Math.abs(a.schY - b.schY) - (a.height + b.height) / 2));
351198
- maxBodyGap = Math.max(maxBodyGap, gap);
351705
+ const pending = bank.capacitors.slice(1).map((box) => ({
351706
+ box,
351707
+ gap: DecouplingCapacitorGroupingSolver.bodyGap(bank.capacitors[0], box)
351708
+ }));
351709
+ while (pending.length > 0) {
351710
+ let closest = 0;
351711
+ for (let i = 1;i < pending.length; i++) {
351712
+ if (pending[i].gap < pending[closest].gap)
351713
+ closest = i;
351714
+ }
351715
+ const next = pending.splice(closest, 1)[0];
351716
+ maxBodyGap = Math.max(maxBodyGap, next.gap);
351717
+ for (const candidate of pending) {
351718
+ candidate.gap = Math.min(candidate.gap, DecouplingCapacitorGroupingSolver.bodyGap(next.box, candidate.box));
351199
351719
  }
351200
351720
  }
351201
351721
  if (maxBodyGap <= maxRecommendedBodyGap + 0.000001)
351202
351722
  return;
351203
- const railName = this.netNames.get(bank.power) ?? bank.power;
351204
- const groundName = this.netNames.get(bank.ground) ?? bank.ground;
351723
+ const railName = this.netNames.get(bank.power) ?? "power";
351724
+ const groundName = this.netNames.get(bank.ground) ?? "ground";
351205
351725
  this.params.issues.push({
351206
351726
  lineItemType: "DecouplingCapacitorsNotCloseTogether",
351207
351727
  railName,
@@ -351212,11 +351732,14 @@ class DecouplingCapacitorGroupingSolver extends BaseSolver14 {
351212
351732
  message: `Group the decoupling capacitors between ${railName} and ${groundName} closer together in this schematic block. Preserve their net connections.`
351213
351733
  });
351214
351734
  }
351735
+ static bodyGap(a, b) {
351736
+ return Math.hypot(Math.max(0, Math.abs(a.schX - b.schX) - (a.width + b.width) / 2), Math.max(0, Math.abs(a.schY - b.schY) - (a.height + b.height) / 2));
351737
+ }
351215
351738
  static issueToString(issue) {
351216
351739
  const attrs = [];
351217
351740
  addAttr(attrs, "rail", issue.railName);
351218
351741
  addAttr(attrs, "ground", issue.groundName);
351219
- addAttr(attrs, "capacitorNames", issue.capacitorSchematicBoxes.map((box) => box.sourceComponentName ?? box.schematicComponentId).join(", "));
351742
+ addAttr(attrs, "capacitorNames", issue.capacitorSchematicBoxes.map((box) => box.sourceComponentName || "component").join(", "));
351220
351743
  addAttr(attrs, "maxBodyGap", issue.maxBodyGap);
351221
351744
  addAttr(attrs, "maxRecommendedBodyGap", issue.maxRecommendedBodyGap);
351222
351745
  addAttr(attrs, "message", issue.message);
@@ -351260,8 +351783,8 @@ function getNetLabelBounds(label) {
351260
351783
  }
351261
351784
 
351262
351785
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ComponentNetLabelCollisionSolver/ComponentNetLabelCollisionSolver.ts
351263
- import { BaseSolver as BaseSolver15 } from "@tscircuit/solver-utils";
351264
- class ComponentNetLabelCollisionSolver extends BaseSolver15 {
351786
+ import { BaseSolver as BaseSolver19 } from "@tscircuit/solver-utils";
351787
+ class ComponentNetLabelCollisionSolver extends BaseSolver19 {
351265
351788
  params;
351266
351789
  placements;
351267
351790
  netLabelsByComponentId;
@@ -351525,7 +352048,7 @@ class ComponentNetLabelCollisionSolver extends BaseSolver15 {
351525
352048
  if (!comp || Math.abs(newX - comp.schX) < 0.000000001)
351526
352049
  continue;
351527
352050
  result.set(compId, {
351528
- componentName: comp.sourceComponentName ?? compId,
352051
+ componentName: comp.sourceComponentName || "component",
351529
352052
  newSchX: Math.round(newX * 100) / 100,
351530
352053
  newSchY: Math.round(comp.schY * 100) / 100
351531
352054
  });
@@ -351585,8 +352108,8 @@ class ComponentNetLabelCollisionSolver extends BaseSolver15 {
351585
352108
  }
351586
352109
 
351587
352110
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ComponentPinAlignmentSolver/ComponentPinAlignmentSolver.ts
351588
- import { BaseSolver as BaseSolver16 } from "@tscircuit/solver-utils";
351589
- class ComponentPinAlignmentSolver extends BaseSolver16 {
352111
+ import { BaseSolver as BaseSolver20 } from "@tscircuit/solver-utils";
352112
+ class ComponentPinAlignmentSolver extends BaseSolver20 {
351590
352113
  static ALIGNMENT_EPSILON = 0.01;
351591
352114
  ctx;
351592
352115
  out;
@@ -351683,7 +352206,7 @@ class ComponentPinAlignmentSolver extends BaseSolver16 {
351683
352206
  if (!bestCandidate || bestCandidate.pairs.length < 2 || bestCandidate.pairs.length <= currentlyAlignedPinCount) {
351684
352207
  return;
351685
352208
  }
351686
- const targetName = rightPlacement.sourceComponentName ?? rightPlacement.schematicComponentId ?? "component";
352209
+ const targetName = rightPlacement.sourceComponentName || "component";
351687
352210
  const deltaSchY = bestCandidate.deltaSchY;
351688
352211
  const newSchY = rightPlacement.schY + deltaSchY;
351689
352212
  return {
@@ -351720,8 +352243,8 @@ class ComponentPinAlignmentSolver extends BaseSolver16 {
351720
352243
  }
351721
352244
 
351722
352245
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/CrystalLoadCapacitorPlacementSolver/CrystalLoadCapacitorPlacementSolver.ts
351723
- import { BaseSolver as BaseSolver17 } from "@tscircuit/solver-utils";
351724
- class CrystalLoadCapacitorPlacementSolver extends BaseSolver17 {
352246
+ import { BaseSolver as BaseSolver21 } from "@tscircuit/solver-utils";
352247
+ class CrystalLoadCapacitorPlacementSolver extends BaseSolver21 {
351725
352248
  static ALIGNMENT_TOLERANCE = 0.1;
351726
352249
  issues;
351727
352250
  networks;
@@ -351876,14 +352399,14 @@ class CrystalLoadCapacitorPlacementSolver extends BaseSolver17 {
351876
352399
  return `<CrystalNotCenteredOverLoadCapacitors ${attrs.join(" ")} />`;
351877
352400
  }
351878
352401
  }
351879
- var pairDistance = (pair, crystal) => distance50(pair.firstConnection.capacitor, crystal) + distance50(pair.secondConnection.capacitor, crystal);
351880
- var distance50 = (first, second) => Math.hypot(first.schX - second.schX, first.schY - second.schY);
352402
+ var pairDistance = (pair, crystal) => distance51(pair.firstConnection.capacitor, crystal) + distance51(pair.secondConnection.capacitor, crystal);
352403
+ var distance51 = (first, second) => Math.hypot(first.schX - second.schX, first.schY - second.schY);
351881
352404
  var round2 = (value) => Math.round(value * 100) / 100;
351882
352405
 
351883
352406
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/DiodeResistorAlignmentSolver/DiodeResistorAlignmentSolver.ts
351884
- import { BaseSolver as BaseSolver18 } from "@tscircuit/solver-utils";
352407
+ import { BaseSolver as BaseSolver22 } from "@tscircuit/solver-utils";
351885
352408
  import { getSourcePortConnectivityMapFromCircuitJson as getSourcePortConnectivityMapFromCircuitJson2 } from "circuit-json-to-connectivity-map";
351886
- class DiodeResistorAlignmentSolver extends BaseSolver18 {
352409
+ class DiodeResistorAlignmentSolver extends BaseSolver22 {
351887
352410
  static DIODE_FTYPES = new Set(["simple_led", "simple_diode"]);
351888
352411
  ctx;
351889
352412
  out;
@@ -351949,8 +352472,8 @@ class DiodeResistorAlignmentSolver extends BaseSolver18 {
351949
352472
  return;
351950
352473
  if (!this.sourceConnectivity.areIdsConnected(diodePort.source_port_id, resistorPort.source_port_id))
351951
352474
  return;
351952
- const diodeName = diodeBox.sourceComponentName ?? diodeCompId;
351953
- const resistorName = resistorBox.sourceComponentName ?? resistorCompId;
352475
+ const diodeName = diodeBox.sourceComponentName || "component";
352476
+ const resistorName = resistorBox.sourceComponentName || "component";
351954
352477
  const diodePin = diodePort?.display_pin_label ?? diodePort?.pin_number?.toString();
351955
352478
  const resistorPin = resistorPort?.display_pin_label ?? resistorPort?.pin_number?.toString();
351956
352479
  const diodeFacing = diodePort?.facing_direction;
@@ -352049,8 +352572,8 @@ class DiodeResistorAlignmentSolver extends BaseSolver18 {
352049
352572
  }
352050
352573
 
352051
352574
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/FeedbackNetworkPlacementSolver/FeedbackNetworkPlacementSolver.ts
352052
- import { BaseSolver as BaseSolver19 } from "@tscircuit/solver-utils";
352053
- class FeedbackNetworkPlacementSolver extends BaseSolver19 {
352575
+ import { BaseSolver as BaseSolver23 } from "@tscircuit/solver-utils";
352576
+ class FeedbackNetworkPlacementSolver extends BaseSolver23 {
352054
352577
  static MIN_BODY_GAP = 4;
352055
352578
  index;
352056
352579
  amplifierIds;
@@ -352110,7 +352633,7 @@ class FeedbackNetworkPlacementSolver extends BaseSolver19 {
352110
352633
  });
352111
352634
  if (distantComponents.length === 0)
352112
352635
  return;
352113
- const names = distantComponents.map(({ schematicBox }) => schematicBox.sourceComponentName ?? schematicBox.sourceComponentId).join(", ");
352636
+ const names = distantComponents.map(({ schematicBox }) => schematicBox.sourceComponentName || "component").join(", ");
352114
352637
  this.issues.push({
352115
352638
  lineItemType: "FeedbackNetworkNotCompact",
352116
352639
  amplifierSchematicBox: amplifier,
@@ -352118,14 +352641,14 @@ class FeedbackNetworkPlacementSolver extends BaseSolver19 {
352118
352641
  distantComponents,
352119
352642
  outputSourcePortId: output.source_port_id,
352120
352643
  invertingInputSourcePortId: input.source_port_id,
352121
- message: `consider grouping ${names} closer to ${amplifier.sourceComponentName ?? id}, with a compact feedback return path above or below the amplifier`
352644
+ message: `consider grouping ${names} closer to ${amplifier.sourceComponentName || "component"}, with a compact feedback return path above or below the amplifier`
352122
352645
  });
352123
352646
  }
352124
352647
  static issueToString(issue) {
352125
352648
  const attrs = [];
352126
352649
  addAttr(attrs, "amplifierName", issue.amplifierSchematicBox.sourceComponentName);
352127
- addAttr(attrs, "feedbackComponentNames", issue.feedbackComponents.map((box) => box.sourceComponentName ?? box.sourceComponentId).join(", "));
352128
- addAttr(attrs, "distantComponentNames", issue.distantComponents.map(({ schematicBox }) => schematicBox.sourceComponentName ?? schematicBox.sourceComponentId).join(", "));
352650
+ addAttr(attrs, "feedbackComponentNames", issue.feedbackComponents.map((box) => box.sourceComponentName || "component").join(", "));
352651
+ addAttr(attrs, "distantComponentNames", issue.distantComponents.map(({ schematicBox }) => schematicBox.sourceComponentName || "component").join(", "));
352129
352652
  addAttr(attrs, "message", issue.message);
352130
352653
  return `<FeedbackNetworkNotCompact ${attrs.join(" ")} />`;
352131
352654
  }
@@ -352135,7 +352658,7 @@ function distanceBetweenBoxes(a, b) {
352135
352658
  }
352136
352659
 
352137
352660
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/PullResistorPlacementSolver/PullResistorPlacementSolver.ts
352138
- import { BaseSolver as BaseSolver20 } from "@tscircuit/solver-utils";
352661
+ import { BaseSolver as BaseSolver24 } from "@tscircuit/solver-utils";
352139
352662
 
352140
352663
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/switch-pull-resistor-pairs.ts
352141
352664
  function getSwitchPullResistorPairs(index) {
@@ -352199,7 +352722,7 @@ function getHorizontalPushbuttonComponentIds(index) {
352199
352722
  }
352200
352723
 
352201
352724
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/PullResistorPlacementSolver/PullResistorPlacementSolver.ts
352202
- class PullResistorPlacementSolver extends BaseSolver20 {
352725
+ class PullResistorPlacementSolver extends BaseSolver24 {
352203
352726
  static MIN_WRONG_SIDE_GAP = 1.5;
352204
352727
  index;
352205
352728
  resistorIds;
@@ -352281,7 +352804,7 @@ class PullResistorPlacementSolver extends BaseSolver20 {
352281
352804
  preferredSide,
352282
352805
  wrongSideGap,
352283
352806
  maxRecommendedWrongSideGap: PullResistorPlacementSolver.MIN_WRONG_SIDE_GAP,
352284
- message: `consider placing ${resistor.sourceComponentName ?? id} ${preferredSide} ${host.sourceComponentName ?? signalPort.source_component_id}.${signalPort.name} so the pull-${pullDirection} branch reads toward ${pullDirection === "up" ? "power" : "ground"}`
352807
+ message: `consider placing ${resistor.sourceComponentName || "component"} ${preferredSide} ${host.sourceComponentName || "component"}.${signalPort.name} so the pull-${pullDirection} branch reads toward ${pullDirection === "up" ? "power" : "ground"}`
352285
352808
  });
352286
352809
  }
352287
352810
  static issueToString(issue) {
@@ -352299,8 +352822,8 @@ class PullResistorPlacementSolver extends BaseSolver20 {
352299
352822
  }
352300
352823
 
352301
352824
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentRailOrientationSolver/TwoPinComponentRailOrientationSolver.ts
352302
- import { BaseSolver as BaseSolver21 } from "@tscircuit/solver-utils";
352303
- class TwoPinComponentRailOrientationSolver extends BaseSolver21 {
352825
+ import { BaseSolver as BaseSolver25 } from "@tscircuit/solver-utils";
352826
+ class TwoPinComponentRailOrientationSolver extends BaseSolver25 {
352304
352827
  static EPSILON = 0.01;
352305
352828
  index;
352306
352829
  powerNets;
@@ -352365,7 +352888,10 @@ class TwoPinComponentRailOrientationSolver extends BaseSolver21 {
352365
352888
  const otherPort = index.port(otherSourcePort);
352366
352889
  if (!railPort || !otherPort)
352367
352890
  return;
352368
- const invertedRails = this.positiveVoltageNets.has(rail) && this.groundNets.has(index.connected(otherSourcePort.source_port_id)) && Math.abs(railPort.center.x - otherPort.center.x) <= TwoPinComponentRailOrientationSolver.EPSILON && railPort.center.y < otherPort.center.y - TwoPinComponentRailOrientationSolver.EPSILON && railPort.facing_direction === "down" && otherPort.facing_direction === "up";
352891
+ const otherNet = index.connected(otherSourcePort.source_port_id);
352892
+ const otherIsGround = this.groundNets.has(otherNet);
352893
+ const isSupplyToSignalResistor = sourceComponent?.ftype === "simple_resistor" && !this.powerNets.has(otherNet) && !otherIsGround;
352894
+ const invertedRails = this.positiveVoltageNets.has(rail) && (otherIsGround || isSupplyToSignalResistor) && Math.abs(railPort.center.x - otherPort.center.x) <= TwoPinComponentRailOrientationSolver.EPSILON && railPort.center.y < otherPort.center.y - TwoPinComponentRailOrientationSolver.EPSILON && railPort.facing_direction === "down" && otherPort.facing_direction === "up";
352369
352895
  if (invertedRails) {
352370
352896
  this.issues.push({
352371
352897
  lineItemType: "TwoPinComponentHasInvertedRails",
@@ -352375,7 +352901,7 @@ class TwoPinComponentRailOrientationSolver extends BaseSolver21 {
352375
352901
  railType: "power",
352376
352902
  deltaSchRotation: 180,
352377
352903
  suggestedRailFacingDirection: "up",
352378
- message: `rotate ${component.sourceComponentName ?? id} by 180° so its positive-supply pin faces up and its ground pin faces down; preserve pin connections and reroute attached traces`
352904
+ message: `rotate ${component.sourceComponentName || "component"} by 180° so its positive-supply pin faces up and its ${otherIsGround ? "ground" : "signal"} pin faces down; preserve pin connections and reroute attached traces`
352379
352905
  });
352380
352906
  return;
352381
352907
  }
@@ -352394,7 +352920,7 @@ class TwoPinComponentRailOrientationSolver extends BaseSolver21 {
352394
352920
  railType,
352395
352921
  deltaSchRotation,
352396
352922
  suggestedRailFacingDirection,
352397
- message: `rotate ${component.sourceComponentName ?? id} by ${deltaSchRotation}° so its ${railType}-connected pin faces ${suggestedRailFacingDirection} and the component is vertical`
352923
+ message: `rotate ${component.sourceComponentName || "component"} by ${deltaSchRotation}° so its ${railType}-connected pin faces ${suggestedRailFacingDirection} and the component is vertical`
352398
352924
  });
352399
352925
  }
352400
352926
  static issueToString(issue) {
@@ -352409,32 +352935,220 @@ class TwoPinComponentRailOrientationSolver extends BaseSolver21 {
352409
352935
  }
352410
352936
  }
352411
352937
 
352938
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/schematic-box-labels.ts
352939
+ var PIN_LABEL_EDGE_PADDING = 0.1;
352940
+ var PIN_LABEL_TEXT_HEIGHT = 0.15;
352941
+ var INNER_LABEL_COLLISION_PADDING = 0.02;
352942
+ var COLLISION_COMPARISON_EPSILON = 0.000000001;
352943
+ function getSchematicBoxLabelRects(box, ports, getLabelLength) {
352944
+ const bounds = {
352945
+ left: box.schX - box.width / 2,
352946
+ right: box.schX + box.width / 2,
352947
+ top: box.schY + box.height / 2,
352948
+ bottom: box.schY - box.height / 2
352949
+ };
352950
+ const rects = [];
352951
+ for (const port of ports) {
352952
+ if (!port.side_of_component)
352953
+ continue;
352954
+ if (!port.display_pin_label)
352955
+ continue;
352956
+ const labelLength = getLabelLength(port);
352957
+ const halfTextHeight = PIN_LABEL_TEXT_HEIGHT / 2;
352958
+ switch (port.side_of_component) {
352959
+ case "left": {
352960
+ const xMin = bounds.left + PIN_LABEL_EDGE_PADDING;
352961
+ rects.push({
352962
+ side: port.side_of_component,
352963
+ xMin,
352964
+ xMax: xMin + labelLength,
352965
+ yMin: port.center.y - halfTextHeight,
352966
+ yMax: port.center.y + halfTextHeight
352967
+ });
352968
+ break;
352969
+ }
352970
+ case "right": {
352971
+ const xMax = bounds.right - PIN_LABEL_EDGE_PADDING;
352972
+ rects.push({
352973
+ side: port.side_of_component,
352974
+ xMin: xMax - labelLength,
352975
+ xMax,
352976
+ yMin: port.center.y - halfTextHeight,
352977
+ yMax: port.center.y + halfTextHeight
352978
+ });
352979
+ break;
352980
+ }
352981
+ case "top": {
352982
+ const yMax = bounds.top - PIN_LABEL_EDGE_PADDING;
352983
+ rects.push({
352984
+ side: port.side_of_component,
352985
+ xMin: port.center.x - halfTextHeight,
352986
+ xMax: port.center.x + halfTextHeight,
352987
+ yMin: yMax - labelLength,
352988
+ yMax
352989
+ });
352990
+ break;
352991
+ }
352992
+ case "bottom": {
352993
+ const yMin = bounds.bottom + PIN_LABEL_EDGE_PADDING;
352994
+ rects.push({
352995
+ side: port.side_of_component,
352996
+ xMin: port.center.x - halfTextHeight,
352997
+ xMax: port.center.x + halfTextHeight,
352998
+ yMin,
352999
+ yMax: yMin + labelLength
353000
+ });
353001
+ break;
353002
+ }
353003
+ }
353004
+ }
353005
+ return rects;
353006
+ }
353007
+ function schematicLabelRectsOverlap(a, b, padding = INNER_LABEL_COLLISION_PADDING) {
353008
+ return schematicLabelIntervalsOverlap(a.xMin, a.xMax, b.xMin, b.xMax, padding) && schematicLabelIntervalsOverlap(a.yMin, a.yMax, b.yMin, b.yMax, padding);
353009
+ }
353010
+ function schematicLabelIntervalsOverlap(aMin, aMax, bMin, bMax, padding = INNER_LABEL_COLLISION_PADDING) {
353011
+ return Math.min(aMax, bMax) - Math.max(aMin, bMin) + padding > COLLISION_COMPARISON_EPSILON;
353012
+ }
353013
+
352412
353014
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/schematic-box-components.ts
352413
353015
  function getSchematicBoxComponentIds(circuitJson) {
352414
353016
  return new Set(circuitJson.flatMap((element) => element.type === "schematic_component" && element.is_box_with_pins !== false && !element.symbol_name && !element.schematic_symbol_id ? [element.schematic_component_id] : []));
352415
353017
  }
352416
353018
 
353019
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/schematic-text-geometry.ts
353020
+ var rectPolygon = (bounds) => [
353021
+ { x: bounds.left, y: bounds.bottom },
353022
+ { x: bounds.right, y: bounds.bottom },
353023
+ { x: bounds.right, y: bounds.top },
353024
+ { x: bounds.left, y: bounds.top }
353025
+ ];
353026
+ var advance = (character) => {
353027
+ if (/\s/.test(character))
353028
+ return 0.28;
353029
+ if (/[ilI.,:;!'|]/.test(character))
353030
+ return 0.25;
353031
+ if (/[MW@%]/.test(character))
353032
+ return 0.9;
353033
+ if (/[mw]/.test(character))
353034
+ return 0.8;
353035
+ if (/[A-Z]/.test(character))
353036
+ return 0.67;
353037
+ return 0.56;
353038
+ };
353039
+ var widthInEm = (text) => Array.from(text).reduce((width, character) => width + advance(character), 0);
353040
+ var getSchematicTextWidth = (text, fontSize) => widthInEm(text) * fontSize;
353041
+ function getSchematicTextPolygons(text) {
353042
+ const size = text.font_size;
353043
+ if (!Number.isFinite(size) || size <= 0 || !Number.isFinite(text.rotation) || !Number.isFinite(text.position.x) || !Number.isFinite(text.position.y))
353044
+ return [];
353045
+ const anchor = text.anchor;
353046
+ const horizontal = anchor.includes("left") ? 0 : anchor.includes("right") ? 1 : 0.5;
353047
+ const top = anchor.includes("top") ? 0 : anchor.includes("bottom") ? size : size / 2;
353048
+ const radians = -text.rotation * Math.PI / 180;
353049
+ const cos = Math.cos(radians);
353050
+ const sin = Math.sin(radians);
353051
+ return text.text.split(`
353052
+ `).flatMap((line, index) => {
353053
+ const visible = line.trim();
353054
+ if (!visible)
353055
+ return [];
353056
+ const leading = line.length - line.trimStart().length;
353057
+ const left = (widthInEm(line.slice(0, leading)) - widthInEm(line) * horizontal) * size;
353058
+ const polygon = rectPolygon({
353059
+ left,
353060
+ right: left + widthInEm(visible) * size,
353061
+ top: top - index * size - size * 0.05,
353062
+ bottom: top - (index + 1) * size + size * 0.05
353063
+ });
353064
+ return [
353065
+ polygon.map(({ x, y }) => ({
353066
+ x: text.position.x + x * cos - y * sin,
353067
+ y: text.position.y + x * sin + y * cos
353068
+ }))
353069
+ ];
353070
+ });
353071
+ }
353072
+ function polygonsOverlap(a, b) {
353073
+ for (const polygon of [a, b]) {
353074
+ for (let i = 0;i < polygon.length; i++) {
353075
+ const p = polygon[i];
353076
+ const q = polygon[(i + 1) % polygon.length];
353077
+ const length = Math.hypot(q.x - p.x, q.y - p.y);
353078
+ if (length < 0.000000001)
353079
+ continue;
353080
+ const nx = -(q.y - p.y) / length;
353081
+ const ny = (q.x - p.x) / length;
353082
+ const project = (points) => points.map(({ x, y }) => x * nx + y * ny);
353083
+ const pa = project(a);
353084
+ const pb = project(b);
353085
+ if (Math.min(Math.max(...pa), Math.max(...pb)) - Math.max(Math.min(...pa), Math.min(...pb)) <= 0.000001)
353086
+ return false;
353087
+ }
353088
+ }
353089
+ return true;
353090
+ }
353091
+ function traceSegmentPolygon(from, to) {
353092
+ const length = Math.hypot(to.x - from.x, to.y - from.y);
353093
+ if (length < 0.000000001)
353094
+ return;
353095
+ const dx = -(to.y - from.y) / length * 0.01;
353096
+ const dy = (to.x - from.x) / length * 0.01;
353097
+ return [
353098
+ { x: from.x + dx, y: from.y + dy },
353099
+ { x: to.x + dx, y: to.y + dy },
353100
+ { x: to.x - dx, y: to.y - dy },
353101
+ { x: from.x - dx, y: from.y - dy }
353102
+ ];
353103
+ }
353104
+ function segmentCrossesPolygon(from, to, polygon) {
353105
+ if (Math.hypot(to.x - from.x, to.y - from.y) < 0.000000001)
353106
+ return false;
353107
+ let low = 0;
353108
+ let high = 1;
353109
+ for (let i = 0;i < polygon.length; i++) {
353110
+ const p = polygon[i];
353111
+ const q = polygon[(i + 1) % polygon.length];
353112
+ const length = Math.hypot(q.x - p.x, q.y - p.y);
353113
+ if (length < 0.000000001)
353114
+ continue;
353115
+ const nx = -(q.y - p.y) / length;
353116
+ const ny = (q.x - p.x) / length;
353117
+ const start = (from.x - p.x) * nx + (from.y - p.y) * ny - 0.000001;
353118
+ const end = (to.x - p.x) * nx + (to.y - p.y) * ny - 0.000001;
353119
+ if (start <= 0 && end <= 0)
353120
+ return false;
353121
+ if (start <= 0)
353122
+ low = Math.max(low, -start / (end - start));
353123
+ if (end <= 0)
353124
+ high = Math.min(high, -start / (end - start));
353125
+ if (high <= low)
353126
+ return false;
353127
+ }
353128
+ return high > low;
353129
+ }
353130
+ var polygonBounds = (polygons) => {
353131
+ const points = polygons.flat();
353132
+ return {
353133
+ left: Math.min(...points.map((p) => p.x)),
353134
+ right: Math.max(...points.map((p) => p.x)),
353135
+ top: Math.max(...points.map((p) => p.y)),
353136
+ bottom: Math.min(...points.map((p) => p.y))
353137
+ };
353138
+ };
353139
+
352417
353140
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicBoxInnerLabelCollisionSolver/SchematicBoxInnerLabelCollisionSolver.ts
352418
- import { BaseSolver as BaseSolver22 } from "@tscircuit/solver-utils";
352419
- class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
353141
+ import { BaseSolver as BaseSolver26 } from "@tscircuit/solver-utils";
353142
+ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver26 {
352420
353143
  params;
352421
- MESSAGE = "Inner labels are colliding. Increase the schWidth or schHeight.";
352422
- PIN_LABEL_EDGE_PADDING = 0.1;
352423
- PIN_LABEL_TEXT_HEIGHT = 0.15;
352424
- PIN_NAME_CHARACTER_WIDTH = 0.095;
352425
- FALLBACK_CHARACTER_WIDTH = 0.13;
352426
- INNER_LABEL_COLLISION_PADDING = 0.02;
352427
- COLLISION_COMPARISON_EPSILON = 0.000000001;
352428
353144
  entries;
352429
353145
  placementById;
352430
- sourcePortById;
352431
353146
  currentIndex = 0;
352432
353147
  constructor(params2) {
352433
353148
  super();
352434
353149
  this.params = params2;
352435
353150
  const { circuitJson, componentPlacements } = params2.ctx;
352436
353151
  this.placementById = this.getPlacementBySchematicComponentId(componentPlacements);
352437
- this.sourcePortById = this.getSourcePortById(circuitJson);
352438
353152
  const boxIds = getSchematicBoxComponentIds(circuitJson);
352439
353153
  this.entries = Array.from(this.getPortsBySchematicComponentId(circuitJson)).filter(([id]) => boxIds.has(id));
352440
353154
  this.solved = this.entries.length === 0;
@@ -352450,8 +353164,7 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
352450
353164
  const schematicBox = this.placementById.get(schematicComponentId);
352451
353165
  if (!schematicBox)
352452
353166
  return;
352453
- const bounds = this.getCenteredRectBounds(schematicBox);
352454
- const labelRects = this.getLabelRects(bounds, ports, this.sourcePortById);
353167
+ const labelRects = getSchematicBoxLabelRects(schematicBox, ports, (port) => getSchematicTextWidth(port.display_pin_label, 0.15));
352455
353168
  if (labelRects.length === 0)
352456
353169
  return;
352457
353170
  const collisionSummary = this.getCollisionSummary(labelRects);
@@ -352461,7 +353174,7 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
352461
353174
  lineItemType: "SchematicBoxInnerLabelCollision",
352462
353175
  schematicBox,
352463
353176
  overlappingSides: collisionSummary.overlappingSides,
352464
- message: this.MESSAGE
353177
+ message: this.getMessage(collisionSummary.overlappingSides)
352465
353178
  });
352466
353179
  }
352467
353180
  static issueToString(issue) {
@@ -352473,37 +353186,16 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
352473
353186
  addAttr(attrs, "overlappingSides", issue.overlappingSides.join(","));
352474
353187
  return `<SchematicBoxInnerLabelCollision ${attrs.join(" ")} />`;
352475
353188
  }
353189
+ getMessage(sides) {
353190
+ const dimension = sides.every((side) => side === "left" || side === "right") ? "schWidth" : sides.every((side) => side === "top" || side === "bottom") ? "schHeight" : "schWidth or schHeight";
353191
+ return `Inner labels are colliding. Increase the ${dimension}.`;
353192
+ }
352476
353193
  isSchematicPort(el) {
352477
353194
  return el.type === "schematic_port";
352478
353195
  }
352479
- isSourcePort(el) {
352480
- return el.type === "source_port";
352481
- }
352482
353196
  isSchematicSide(side) {
352483
353197
  return side === "left" || side === "right" || side === "top" || side === "bottom";
352484
353198
  }
352485
- isPinNameLabel(label, sourcePort) {
352486
- if (!sourcePort)
352487
- return false;
352488
- return label === sourcePort.name || label === String(sourcePort.pin_number) || (sourcePort.port_hints ?? []).includes(label);
352489
- }
352490
- estimateLabelLength(label, sourcePort) {
352491
- return Array.from(label).length * (this.isPinNameLabel(label, sourcePort) ? this.PIN_NAME_CHARACTER_WIDTH : this.FALLBACK_CHARACTER_WIDTH);
352492
- }
352493
- hasCollision(requiredGrowth) {
352494
- return requiredGrowth > this.COLLISION_COMPARISON_EPSILON;
352495
- }
352496
- getCenteredRectBounds(box) {
352497
- return {
352498
- left: box.schX - box.width / 2,
352499
- right: box.schX + box.width / 2,
352500
- top: box.schY + box.height / 2,
352501
- bottom: box.schY - box.height / 2
352502
- };
352503
- }
352504
- getSourcePortById(circuitJson) {
352505
- return new Map(circuitJson.filter((el) => this.isSourcePort(el)).map((sp) => [sp.source_port_id, sp]));
352506
- }
352507
353199
  getPlacementBySchematicComponentId(componentPlacements) {
352508
353200
  return new Map(componentPlacements.filter((p) => p.schematicComponentId).map((p) => [p.schematicComponentId, p]));
352509
353201
  }
@@ -352522,64 +353214,6 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
352522
353214
  }
352523
353215
  return map;
352524
353216
  }
352525
- getLabelRects(bounds, ports, sourcePortById) {
352526
- const rects = [];
352527
- for (const port of ports) {
352528
- if (!this.isSchematicSide(port.side_of_component))
352529
- continue;
352530
- if (!port.display_pin_label)
352531
- continue;
352532
- const labelLength = this.estimateLabelLength(port.display_pin_label, sourcePortById.get(port.source_port_id));
352533
- const halfTextHeight = this.PIN_LABEL_TEXT_HEIGHT / 2;
352534
- switch (port.side_of_component) {
352535
- case "left": {
352536
- const xMin = bounds.left + this.PIN_LABEL_EDGE_PADDING;
352537
- rects.push({
352538
- side: port.side_of_component,
352539
- xMin,
352540
- xMax: xMin + labelLength,
352541
- yMin: port.center.y - halfTextHeight,
352542
- yMax: port.center.y + halfTextHeight
352543
- });
352544
- break;
352545
- }
352546
- case "right": {
352547
- const xMax = bounds.right - this.PIN_LABEL_EDGE_PADDING;
352548
- rects.push({
352549
- side: port.side_of_component,
352550
- xMin: xMax - labelLength,
352551
- xMax,
352552
- yMin: port.center.y - halfTextHeight,
352553
- yMax: port.center.y + halfTextHeight
352554
- });
352555
- break;
352556
- }
352557
- case "top": {
352558
- const yMax = bounds.top - this.PIN_LABEL_EDGE_PADDING;
352559
- rects.push({
352560
- side: port.side_of_component,
352561
- xMin: port.center.x - halfTextHeight,
352562
- xMax: port.center.x + halfTextHeight,
352563
- yMin: yMax - labelLength,
352564
- yMax
352565
- });
352566
- break;
352567
- }
352568
- case "bottom": {
352569
- const yMin = bounds.bottom + this.PIN_LABEL_EDGE_PADDING;
352570
- rects.push({
352571
- side: port.side_of_component,
352572
- xMin: port.center.x - halfTextHeight,
352573
- xMax: port.center.x + halfTextHeight,
352574
- yMin,
352575
- yMax: yMin + labelLength
352576
- });
352577
- break;
352578
- }
352579
- }
352580
- }
352581
- return rects;
352582
- }
352583
353217
  getCollisionSummary(rects) {
352584
353218
  const overlappingSides = new Set;
352585
353219
  for (let i = 0;i < rects.length; i++) {
@@ -352588,7 +353222,7 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
352588
353222
  const b = rects[j];
352589
353223
  if (a.side === b.side)
352590
353224
  continue;
352591
- if (!this.rectsOverlap(a, b))
353225
+ if (!schematicLabelRectsOverlap(a, b))
352592
353226
  continue;
352593
353227
  overlappingSides.add(a.side);
352594
353228
  overlappingSides.add(b.side);
@@ -352598,9 +353232,6 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
352598
353232
  overlappingSides: this.sortSides(Array.from(overlappingSides))
352599
353233
  };
352600
353234
  }
352601
- rectsOverlap(a, b) {
352602
- return this.hasCollision(Math.min(a.xMax, b.xMax) - Math.max(a.xMin, b.xMin) + this.INNER_LABEL_COLLISION_PADDING) && this.hasCollision(Math.min(a.yMax, b.yMax) - Math.max(a.yMin, b.yMin) + this.INNER_LABEL_COLLISION_PADDING);
352603
- }
352604
353235
  sortSides(sides) {
352605
353236
  const order = {
352606
353237
  left: 0,
@@ -352613,8 +353244,8 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver22 {
352613
353244
  }
352614
353245
 
352615
353246
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicBoxOverlapSolver/SchematicBoxOverlapSolver.ts
352616
- import { BaseSolver as BaseSolver23 } from "@tscircuit/solver-utils";
352617
- class SchematicBoxOverlapSolver extends BaseSolver23 {
353247
+ import { BaseSolver as BaseSolver27 } from "@tscircuit/solver-utils";
353248
+ class SchematicBoxOverlapSolver extends BaseSolver27 {
352618
353249
  params;
352619
353250
  placements;
352620
353251
  firstIndex = 0;
@@ -352732,20 +353363,158 @@ class SchematicBoxOverlapSolver extends BaseSolver23 {
352732
353363
  }
352733
353364
  }
352734
353365
 
353366
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/schematic-box-graphics.ts
353367
+ function getSchematicBoxGraphicBounds(circuitJson, componentId) {
353368
+ let bounds;
353369
+ for (const element of circuitJson) {
353370
+ if (element.type !== "schematic_path" && element.type !== "schematic_circle" && element.type !== "schematic_rect" || element.schematic_component_id !== componentId)
353371
+ continue;
353372
+ const stroke = (element.stroke_width ?? 0.02) / 2;
353373
+ let current;
353374
+ if (element.type === "schematic_path") {
353375
+ if (!element.points.length)
353376
+ continue;
353377
+ current = {
353378
+ xMin: Math.min(...element.points.map((p) => p.x)),
353379
+ xMax: Math.max(...element.points.map((p) => p.x)),
353380
+ yMin: Math.min(...element.points.map((p) => p.y)),
353381
+ yMax: Math.max(...element.points.map((p) => p.y))
353382
+ };
353383
+ } else {
353384
+ const angle = element.type === "schematic_rect" ? (element.rotation ?? 0) * Math.PI / 180 : 0;
353385
+ const width = element.type === "schematic_circle" ? 2 * element.radius : element.width;
353386
+ const height = element.type === "schematic_circle" ? 2 * element.radius : element.height;
353387
+ const halfWidth = (Math.abs(width * Math.cos(angle)) + Math.abs(height * Math.sin(angle))) / 2;
353388
+ const halfHeight = (Math.abs(width * Math.sin(angle)) + Math.abs(height * Math.cos(angle))) / 2;
353389
+ current = {
353390
+ xMin: element.center.x - halfWidth,
353391
+ xMax: element.center.x + halfWidth,
353392
+ yMin: element.center.y - halfHeight,
353393
+ yMax: element.center.y + halfHeight
353394
+ };
353395
+ }
353396
+ current.xMin -= stroke;
353397
+ current.xMax += stroke;
353398
+ current.yMin -= stroke;
353399
+ current.yMax += stroke;
353400
+ bounds = bounds ? {
353401
+ xMin: Math.min(bounds.xMin, current.xMin),
353402
+ xMax: Math.max(bounds.xMax, current.xMax),
353403
+ yMin: Math.min(bounds.yMin, current.yMin),
353404
+ yMax: Math.max(bounds.yMax, current.yMax)
353405
+ } : current;
353406
+ }
353407
+ return bounds;
353408
+ }
353409
+
353410
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/schematic-box-resize.ts
353411
+ var MINIMUM_RESIZE_LABEL_BANK_GAP = 0.2;
353412
+ var getPinLabelLength = (port) => Array.from(port.display_pin_label ?? "").length * 0.095;
353413
+ function getSafeSchematicBoxResize(box, ports, pinSpacing, proposed, minimumReduction = 0, graphics) {
353414
+ if (!Number.isFinite(pinSpacing) || pinSpacing <= 0)
353415
+ return;
353416
+ if (ports.some((port) => !port.side_of_component))
353417
+ return;
353418
+ if (!contentsFit(box, ports, INNER_LABEL_COLLISION_PADDING, graphics))
353419
+ return;
353420
+ let minWidth = 0;
353421
+ let minHeight = 0;
353422
+ for (const port of ports) {
353423
+ if (port.side_of_component === "left" || port.side_of_component === "right") {
353424
+ minHeight = Math.max(minHeight, 2 * (Math.abs(port.center.y - box.schY) + pinSpacing));
353425
+ } else {
353426
+ minWidth = Math.max(minWidth, 2 * (Math.abs(port.center.x - box.schX) + pinSpacing));
353427
+ }
353428
+ }
353429
+ const width = proposed.width === undefined ? box.width : Math.max(proposed.width, minWidth, getContentLimitedDimension(box, ports, "width", graphics));
353430
+ const height = proposed.height === undefined ? box.height : Math.max(proposed.height, minHeight, getContentLimitedDimension(box, ports, "height", graphics));
353431
+ const isUsefulReduction = (reduction) => reduction > 0.000000001 && reduction >= minimumReduction - 0.000000001;
353432
+ const suggestedWidth = isUsefulReduction(box.width - width) ? width : undefined;
353433
+ const suggestedHeight = isUsefulReduction(box.height - height) ? height : undefined;
353434
+ if (suggestedWidth === undefined && suggestedHeight === undefined)
353435
+ return;
353436
+ const candidates = [
353437
+ { width: suggestedWidth, height: suggestedHeight }
353438
+ ];
353439
+ if (suggestedWidth !== undefined && suggestedHeight !== undefined) {
353440
+ candidates.push({ width: suggestedWidth }, { height: suggestedHeight });
353441
+ }
353442
+ const area = (candidate) => (candidate.width ?? box.width) * (candidate.height ?? box.height);
353443
+ candidates.sort((a, b) => area(a) - area(b));
353444
+ return candidates.find((candidate) => contentsFit({
353445
+ ...box,
353446
+ width: candidate.width ?? box.width,
353447
+ height: candidate.height ?? box.height
353448
+ }, ports, MINIMUM_RESIZE_LABEL_BANK_GAP, graphics));
353449
+ }
353450
+ function getContentLimitedDimension(box, ports, dimension, graphics) {
353451
+ const current = box[dimension];
353452
+ const center = dimension === "width" ? box.schX : box.schY;
353453
+ const minKey = dimension === "width" ? "xMin" : "yMin";
353454
+ const maxKey = dimension === "width" ? "xMax" : "yMax";
353455
+ const otherMinKey = dimension === "width" ? "yMin" : "xMin";
353456
+ const otherMaxKey = dimension === "width" ? "yMax" : "xMax";
353457
+ const speed = (label) => {
353458
+ if (dimension === "width") {
353459
+ return label.side === "left" ? -0.5 : label.side === "right" ? 0.5 : 0;
353460
+ }
353461
+ return label.side === "bottom" ? -0.5 : label.side === "top" ? 0.5 : 0;
353462
+ };
353463
+ let minimum = 0;
353464
+ const constrainGap = (gap, rate, requiredGap = 0) => {
353465
+ if (rate > 0)
353466
+ minimum = Math.max(minimum, current + (requiredGap - gap) / rate);
353467
+ };
353468
+ const labels = getSchematicBoxLabelRects(box, ports, getPinLabelLength);
353469
+ if (graphics)
353470
+ labels.push(graphics);
353471
+ for (let i = 0;i < labels.length; i++) {
353472
+ const a = labels[i];
353473
+ constrainGap(a[minKey] - (center - current / 2), speed(a) + 0.5);
353474
+ constrainGap(center + current / 2 - a[maxKey], 0.5 - speed(a));
353475
+ for (let j = i + 1;j < labels.length; j++) {
353476
+ const b = labels[j];
353477
+ const requiredGap = a.side && b.side && a.side !== b.side ? MINIMUM_RESIZE_LABEL_BANK_GAP : INNER_LABEL_COLLISION_PADDING;
353478
+ if (!schematicLabelIntervalsOverlap(a[otherMinKey], a[otherMaxKey], b[otherMinKey], b[otherMaxKey], requiredGap))
353479
+ continue;
353480
+ const [first, second] = a[maxKey] <= b[minKey] ? [a, b] : [b, a];
353481
+ constrainGap(second[minKey] - first[maxKey], speed(second) - speed(first), requiredGap);
353482
+ }
353483
+ }
353484
+ return minimum;
353485
+ }
353486
+ function contentsFit(resized, ports, labelBankGap = INNER_LABEL_COLLISION_PADDING, graphics) {
353487
+ if (!Number.isFinite(resized.width) || !Number.isFinite(resized.height))
353488
+ return false;
353489
+ const labels = getSchematicBoxLabelRects(resized, ports, getPinLabelLength);
353490
+ if (graphics)
353491
+ labels.push(graphics);
353492
+ for (let i = 0;i < labels.length; i++) {
353493
+ const a = labels[i];
353494
+ if (a.xMin < resized.schX - resized.width / 2 - 0.000000001 || a.xMax > resized.schX + resized.width / 2 + 0.000000001 || a.yMin < resized.schY - resized.height / 2 - 0.000000001 || a.yMax > resized.schY + resized.height / 2 + 0.000000001)
353495
+ return false;
353496
+ for (let j = i + 1;j < labels.length; j++) {
353497
+ const b = labels[j];
353498
+ const gap = a.side && b.side && a.side !== b.side ? labelBankGap : INNER_LABEL_COLLISION_PADDING;
353499
+ if (schematicLabelRectsOverlap(a, b, gap))
353500
+ return false;
353501
+ }
353502
+ }
353503
+ return true;
353504
+ }
353505
+
352735
353506
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicBoxTooWideSolver/SchematicBoxTooWideSolver.ts
352736
- import { BaseSolver as BaseSolver24 } from "@tscircuit/solver-utils";
352737
- class SchematicBoxTooWideSolver extends BaseSolver24 {
353507
+ import { BaseSolver as BaseSolver28 } from "@tscircuit/solver-utils";
353508
+ class SchematicBoxTooWideSolver extends BaseSolver28 {
352738
353509
  params;
352739
353510
  SCHEMATIC_BOX_TOO_WIDE_MESSAGE = "Shrink schematic box width";
352740
353511
  PIN_HEADER_MAX_ALLOWED_GAP = 0.1;
352741
353512
  GENERIC_MAX_ALLOWED_GAP = 1;
352742
353513
  PIN_LABEL_EDGE_PADDING = 0.1;
352743
- PIN_NAME_CHARACTER_WIDTH = 0.095;
352744
- FALLBACK_CHARACTER_WIDTH = 0.13;
352745
353514
  GAP_COMPARISON_EPSILON = 0.000000001;
352746
353515
  entries;
352747
353516
  placementById;
352748
- sourcePortById;
353517
+ schematicComponentById;
352749
353518
  sourceComponentById;
352750
353519
  currentIndex = 0;
352751
353520
  constructor(params2) {
@@ -352753,7 +353522,7 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352753
353522
  this.params = params2;
352754
353523
  const { circuitJson, componentPlacements } = params2.ctx;
352755
353524
  this.placementById = this.getPlacementBySchematicComponentId(componentPlacements);
352756
- this.sourcePortById = this.getSourcePortById(circuitJson);
353525
+ this.schematicComponentById = new Map(circuitJson.filter((element) => element.type === "schematic_component").map((component) => [component.schematic_component_id, component]));
352757
353526
  this.sourceComponentById = this.getSourceComponentById(circuitJson);
352758
353527
  const boxIds = getSchematicBoxComponentIds(circuitJson);
352759
353528
  this.entries = Array.from(this.getPortsBySchematicComponentId(circuitJson)).filter(([id]) => boxIds.has(id));
@@ -352770,12 +353539,9 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352770
353539
  const schematicBox = this.placementById.get(schematicComponentId);
352771
353540
  if (!schematicBox)
352772
353541
  return;
352773
- const sourceComponent = schematicBox.sourceComponentId ? this.sourceComponentById.get(schematicBox.sourceComponentId) : undefined;
352774
- if (sourceComponent?.ftype === "simple_connector" && sourceComponent.standard === "usb_c")
352775
- return;
352776
353542
  const bounds = this.getCenteredRectBounds(schematicBox);
352777
- const leftCol = this.getLabelColumn("left", ports, this.sourcePortById);
352778
- const rightCol = this.getLabelColumn("right", ports, this.sourcePortById);
353543
+ const leftCol = this.getLabelColumn("left", ports);
353544
+ const rightCol = this.getLabelColumn("right", ports);
352779
353545
  const ftype = this.getSourceComponentFtype(schematicBox, this.sourceComponentById);
352780
353546
  let measuredSpace;
352781
353547
  if (leftCol && rightCol) {
@@ -352790,11 +353556,18 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352790
353556
  const maxAllowed = ftype === "simple_pin_header" ? this.PIN_HEADER_MAX_ALLOWED_GAP : this.GENERIC_MAX_ALLOWED_GAP;
352791
353557
  if (!this.exceedsMaxAllowedGap(measuredSpace, maxAllowed))
352792
353558
  return;
352793
- const suggestedSchWidth = this.getSuggestedWidth({
353559
+ const proposedWidth = this.getSuggestedWidth({
352794
353560
  measuredInnerLabelHorizontalEmptySpace: measuredSpace,
352795
353561
  maxAllowedInnerLabelHorizontalEmptySpace: maxAllowed,
352796
353562
  currentWidth: schematicBox.width
352797
353563
  });
353564
+ const pinSpacing = this.schematicComponentById.get(schematicComponentId)?.pin_spacing;
353565
+ if (pinSpacing === undefined)
353566
+ return;
353567
+ const resize = getSafeSchematicBoxResize(schematicBox, ports, pinSpacing, { width: proposedWidth }, 0, getSchematicBoxGraphicBounds(this.params.ctx.circuitJson, schematicComponentId));
353568
+ if (resize?.width === undefined)
353569
+ return;
353570
+ const suggestedSchWidth = resize.width;
352798
353571
  if (ftype === "simple_pin_header") {
352799
353572
  this.params.issues.push({
352800
353573
  lineItemType: "PinHeaderSchematicBoxTooWide",
@@ -352828,30 +353601,15 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352828
353601
  isSchematicPort(el) {
352829
353602
  return el.type === "schematic_port";
352830
353603
  }
352831
- isSourcePort(el) {
352832
- return el.type === "source_port";
352833
- }
352834
- isHorizontalSide(side) {
352835
- return side === "left" || side === "right";
352836
- }
352837
353604
  getSourceComponentWithFtype(el) {
352838
353605
  if (el.type !== "source_component" || !("source_component_id" in el) || typeof el.source_component_id !== "string")
352839
353606
  return null;
352840
353607
  return {
352841
353608
  type: "source_component",
352842
353609
  source_component_id: el.source_component_id,
352843
- standard: "standard" in el && typeof el.standard === "string" ? el.standard : undefined,
352844
353610
  ftype: "ftype" in el && typeof el.ftype === "string" ? el.ftype : undefined
352845
353611
  };
352846
353612
  }
352847
- isPinNameLabel(label, sourcePort) {
352848
- if (!sourcePort)
352849
- return false;
352850
- return label === sourcePort.name || label === String(sourcePort.pin_number) || (sourcePort.port_hints ?? []).includes(label);
352851
- }
352852
- estimateLabelWidth(label, sourcePort) {
352853
- return Array.from(label).length * (this.isPinNameLabel(label, sourcePort) ? this.PIN_NAME_CHARACTER_WIDTH : this.FALLBACK_CHARACTER_WIDTH);
352854
- }
352855
353613
  exceedsMaxAllowedGap(measured, maxAllowed) {
352856
353614
  return measured - maxAllowed > this.GAP_COMPARISON_EPSILON;
352857
353615
  }
@@ -352863,9 +353621,6 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352863
353621
  bottom: box.schY - box.height / 2
352864
353622
  };
352865
353623
  }
352866
- getSourcePortById(circuitJson) {
352867
- return new Map(circuitJson.filter((el) => this.isSourcePort(el)).map((sp) => [sp.source_port_id, sp]));
352868
- }
352869
353624
  getSourceComponentById(circuitJson) {
352870
353625
  return new Map(circuitJson.flatMap((el) => {
352871
353626
  const sc = this.getSourceComponentWithFtype(el);
@@ -352880,8 +353635,6 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352880
353635
  for (const port of circuitJson.filter((el) => this.isSchematicPort(el))) {
352881
353636
  if (!port.schematic_component_id)
352882
353637
  continue;
352883
- if (!this.isHorizontalSide(port.side_of_component))
352884
- continue;
352885
353638
  const ports = map.get(port.schematic_component_id);
352886
353639
  if (ports)
352887
353640
  ports.push(port);
@@ -352893,10 +353646,8 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352893
353646
  getSourceComponentFtype(schematicBox, sourceComponentById) {
352894
353647
  return schematicBox.sourceComponentId ? sourceComponentById.get(schematicBox.sourceComponentId)?.ftype : undefined;
352895
353648
  }
352896
- getLabelColumn(side, ports, sourcePortById) {
352897
- const widths = ports.filter((p) => p.side_of_component === side).flatMap((p) => p.display_pin_label ? [
352898
- this.estimateLabelWidth(p.display_pin_label, sourcePortById.get(p.source_port_id))
352899
- ] : []);
353649
+ getLabelColumn(side, ports) {
353650
+ const widths = ports.filter((p) => p.side_of_component === side).flatMap((p) => p.display_pin_label ? [getPinLabelLength(p)] : []);
352900
353651
  if (widths.length === 0)
352901
353652
  return null;
352902
353653
  return {
@@ -352914,12 +353665,10 @@ class SchematicBoxTooWideSolver extends BaseSolver24 {
352914
353665
  }
352915
353666
 
352916
353667
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicPinPaddingToEdgeSolver/SchematicPinPaddingToEdgeSolver.ts
352917
- import { BaseSolver as BaseSolver25 } from "@tscircuit/solver-utils";
352918
- class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
353668
+ import { BaseSolver as BaseSolver29 } from "@tscircuit/solver-utils";
353669
+ class SchematicPinPaddingToEdgeSolver extends BaseSolver29 {
352919
353670
  params;
352920
353671
  MESSAGE = "Move schematic pins closer to the box edge or change the schematic box";
352921
- PIN_NAME_CHARACTER_WIDTH = 0.095;
352922
- FALLBACK_CHARACTER_WIDTH = 0.13;
352923
353672
  GAP_COMPARISON_EPSILON = 0.000000001;
352924
353673
  entries;
352925
353674
  placementById;
@@ -352951,7 +353700,7 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
352951
353700
  const pinSpacing = this.getPinSpacing(schematicBox, this.schematicComponentById);
352952
353701
  if (pinSpacing === null)
352953
353702
  return;
352954
- const maxLabelLengthBySide = this.getMaxLabelLengthBySide(ports, this.sourcePortById);
353703
+ const maxLabelLengthBySide = this.getMaxLabelLengthBySide(ports);
352955
353704
  const portsBySide = new Map;
352956
353705
  for (const port of ports) {
352957
353706
  if (!this.isSchematicSide(port.side_of_component))
@@ -352960,7 +353709,6 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
352960
353709
  sidePorts.push(port);
352961
353710
  portsBySide.set(port.side_of_component, sidePorts);
352962
353711
  }
352963
- const useLabelAwareMaxPadding = this.hasPinsOnAllSides(portsBySide);
352964
353712
  const candidates = [];
352965
353713
  for (const [pinSide, sidePorts] of portsBySide) {
352966
353714
  if (sidePorts.length === 1)
@@ -352970,7 +353718,7 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
352970
353718
  if (!outerPin)
352971
353719
  continue;
352972
353720
  const measuredPadding = this.getPinPaddingToEdge(schematicBox, outerPin, edgeSide);
352973
- const maxAllowedPadding = useLabelAwareMaxPadding ? this.getMaxAllowedPinPadding(pinSpacing, edgeSide, maxLabelLengthBySide) : pinSpacing;
353721
+ const maxAllowedPadding = Math.max(pinSpacing, this.getMaxAllowedPinPadding(pinSpacing, edgeSide, maxLabelLengthBySide));
352974
353722
  if (!this.exceedsMaxAllowedGap(measuredPadding, maxAllowedPadding + pinSpacing))
352975
353723
  continue;
352976
353724
  candidates.push({
@@ -352986,16 +353734,23 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
352986
353734
  if (!candidates.length)
352987
353735
  return;
352988
353736
  const details = candidates.map((candidate) => this.createIssue(candidate));
352989
- const representative = details.reduce((a, b) => b.excessPadding > a.excessPadding ? b : a);
352990
353737
  const widths = details.flatMap((detail) => detail.suggestedSchWidth === undefined ? [] : [detail.suggestedSchWidth]);
352991
353738
  const heights = details.flatMap((detail) => detail.suggestedSchHeight === undefined ? [] : [detail.suggestedSchHeight]);
353739
+ const resize = getSafeSchematicBoxResize(schematicBox, ports, pinSpacing, {
353740
+ width: widths.length ? Math.max(...widths) : undefined,
353741
+ height: heights.length ? Math.max(...heights) : undefined
353742
+ }, 2 * pinSpacing, getSchematicBoxGraphicBounds(this.params.ctx.circuitJson, schematicComponentId));
353743
+ if (!resize)
353744
+ return;
353745
+ const applicableDetails = details.filter((detail) => resize.width !== undefined && detail.suggestedSchWidth !== undefined || resize.height !== undefined && detail.suggestedSchHeight !== undefined);
353746
+ const representative = applicableDetails.reduce((a, b) => b.excessPadding > a.excessPadding ? b : a);
352992
353747
  const dimensions = [
352993
- widths.length ? "width" : "",
352994
- heights.length ? "height" : ""
353748
+ resize.width === undefined ? "" : "width",
353749
+ resize.height === undefined ? "" : "height"
352995
353750
  ].filter(Boolean).join(" and ");
352996
353751
  this.params.issues.push({
352997
353752
  ...representative,
352998
- paddingDetails: details.map(({
353753
+ paddingDetails: applicableDetails.map(({
352999
353754
  pinSide,
353000
353755
  edgeSide,
353001
353756
  pinName,
@@ -353010,8 +353765,8 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
353010
353765
  maxAllowedPadding,
353011
353766
  excessPadding
353012
353767
  })),
353013
- suggestedSchWidth: widths.length ? Math.max(...widths) : undefined,
353014
- suggestedSchHeight: heights.length ? Math.max(...heights) : undefined,
353768
+ suggestedSchWidth: resize.width,
353769
+ suggestedSchHeight: resize.height,
353015
353770
  message: `${this.MESSAGE} ${dimensions}`
353016
353771
  });
353017
353772
  }
@@ -353054,14 +353809,6 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
353054
353809
  isSchematicSide(side) {
353055
353810
  return this.isHorizontalSide(side) || this.isVerticalSide(side);
353056
353811
  }
353057
- isPinNameLabel(label, sourcePort) {
353058
- if (!sourcePort)
353059
- return false;
353060
- return label === sourcePort.name || label === String(sourcePort.pin_number) || (sourcePort.port_hints ?? []).includes(label);
353061
- }
353062
- estimateLabelWidth(label, sourcePort) {
353063
- return Array.from(label).length * (this.isPinNameLabel(label, sourcePort) ? this.PIN_NAME_CHARACTER_WIDTH : this.FALLBACK_CHARACTER_WIDTH);
353064
- }
353065
353812
  exceedsMaxAllowedGap(measured, maxAllowed) {
353066
353813
  return measured - maxAllowed > this.GAP_COMPARISON_EPSILON;
353067
353814
  }
@@ -353087,8 +353834,6 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
353087
353834
  for (const port of circuitJson.filter((el) => this.isSchematicPort(el))) {
353088
353835
  if (!port.schematic_component_id)
353089
353836
  continue;
353090
- if (!this.isSchematicSide(port.side_of_component))
353091
- continue;
353092
353837
  const ports = map.get(port.schematic_component_id);
353093
353838
  if (ports)
353094
353839
  ports.push(port);
@@ -353113,7 +353858,7 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
353113
353858
  return String(sp.pin_number);
353114
353859
  return;
353115
353860
  }
353116
- getMaxLabelLengthBySide(ports, sourcePortById) {
353861
+ getMaxLabelLengthBySide(ports) {
353117
353862
  const result = {
353118
353863
  left: 0,
353119
353864
  right: 0,
@@ -353125,7 +353870,7 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
353125
353870
  continue;
353126
353871
  if (!port.display_pin_label)
353127
353872
  continue;
353128
- result[port.side_of_component] = Math.max(result[port.side_of_component], this.estimateLabelWidth(port.display_pin_label, sourcePortById.get(port.source_port_id)));
353873
+ result[port.side_of_component] = Math.max(result[port.side_of_component], getPinLabelLength(port));
353129
353874
  }
353130
353875
  return result;
353131
353876
  }
@@ -353159,9 +353904,6 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver25 {
353159
353904
  getBoxEdgeSidesForPinSide(pinSide) {
353160
353905
  return this.isHorizontalSide(pinSide) ? ["top", "bottom"] : ["left", "right"];
353161
353906
  }
353162
- hasPinsOnAllSides(portsBySide) {
353163
- return portsBySide.has("left") && portsBySide.has("right") && portsBySide.has("top") && portsBySide.has("bottom");
353164
- }
353165
353907
  getMaxAllowedPinPadding(spacing, edgeSide, maxLabelLengthBySide) {
353166
353908
  const sides = this.isHorizontalSide(edgeSide) ? ["left", "right"] : ["top", "bottom"];
353167
353909
  return (maxLabelLengthBySide[sides[0]] + maxLabelLengthBySide[sides[1]] + spacing) / 2;
@@ -353266,8 +354008,8 @@ var schematicBoxToPlacement = (schematicBox, circuitJson, schematicSheetNameById
353266
354008
  const placement = {
353267
354009
  lineItemType: "SchematicBoxPlacement",
353268
354010
  positionAnchor: "center",
353269
- schX: schematicBox.x,
353270
- schY: schematicBox.y,
354011
+ schX: schematicBox.x + schematicBox.width / 2,
354012
+ schY: schematicBox.y + schematicBox.height / 2,
353271
354013
  width: schematicBox.width,
353272
354014
  height: schematicBox.height,
353273
354015
  ...getSourceComponentMetadata(schematicBox, circuitJson),
@@ -353284,7 +354026,7 @@ var schematicBoxToPlacement = (schematicBox, circuitJson, schematicSheetNameById
353284
354026
  return placement;
353285
354027
  };
353286
354028
  var buildSolverContext = (circuitJson) => {
353287
- const schematicBoxes = circuitJson.filter(isSchematicBox);
354029
+ const schematicBoxes = circuitJson.filter(isSchematicBox).filter((box) => box.schematic_component_id || box.schematic_symbol_id);
353288
354030
  const schematicSheetNameById = getSchematicSheetNamesById(circuitJson);
353289
354031
  const schematicComponentIds = new Set(circuitJson.filter(isSchematicComponent).map((sc) => sc.schematic_component_id));
353290
354032
  const componentPlacements = [
@@ -353295,8 +354037,8 @@ var buildSolverContext = (circuitJson) => {
353295
354037
  };
353296
354038
 
353297
354039
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SwitchPullResistorPlacementSolver/SwitchPullResistorPlacementSolver.ts
353298
- import { BaseSolver as BaseSolver26 } from "@tscircuit/solver-utils";
353299
- class SwitchPullResistorPlacementSolver extends BaseSolver26 {
354040
+ import { BaseSolver as BaseSolver30 } from "@tscircuit/solver-utils";
354041
+ class SwitchPullResistorPlacementSolver extends BaseSolver30 {
353300
354042
  params;
353301
354043
  constructor(params2) {
353302
354044
  super();
@@ -353365,130 +354107,8 @@ function getTraceName(circuitJson, trace) {
353365
354107
 
353366
354108
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TraceSimplificationSolver/TraceSimplificationSolver.ts
353367
354109
  import { calculateElbow as calculateElbow3 } from "calculate-elbow/lib";
353368
-
353369
- // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/schematic-text-geometry.ts
353370
- var rectPolygon = (bounds) => [
353371
- { x: bounds.left, y: bounds.bottom },
353372
- { x: bounds.right, y: bounds.bottom },
353373
- { x: bounds.right, y: bounds.top },
353374
- { x: bounds.left, y: bounds.top }
353375
- ];
353376
- var advance = (character) => {
353377
- if (/\s/.test(character))
353378
- return 0.28;
353379
- if (/[ilI.,:;!'|]/.test(character))
353380
- return 0.25;
353381
- if (/[MW@%]/.test(character))
353382
- return 0.9;
353383
- if (/[mw]/.test(character))
353384
- return 0.8;
353385
- if (/[A-Z]/.test(character))
353386
- return 0.67;
353387
- return 0.56;
353388
- };
353389
- var widthInEm = (text) => Array.from(text).reduce((width, character) => width + advance(character), 0);
353390
- function getSchematicTextPolygons(text) {
353391
- const size = text.font_size;
353392
- if (!Number.isFinite(size) || size <= 0 || !Number.isFinite(text.rotation) || !Number.isFinite(text.position.x) || !Number.isFinite(text.position.y))
353393
- return [];
353394
- const anchor = text.anchor;
353395
- const horizontal = anchor.includes("left") ? 0 : anchor.includes("right") ? 1 : 0.5;
353396
- const top = anchor.includes("top") ? 0 : anchor.includes("bottom") ? size : size / 2;
353397
- const radians = -text.rotation * Math.PI / 180;
353398
- const cos = Math.cos(radians);
353399
- const sin = Math.sin(radians);
353400
- return text.text.split(`
353401
- `).flatMap((line, index) => {
353402
- const visible = line.trim();
353403
- if (!visible)
353404
- return [];
353405
- const leading = line.length - line.trimStart().length;
353406
- const left = (widthInEm(line.slice(0, leading)) - widthInEm(line) * horizontal) * size;
353407
- const polygon = rectPolygon({
353408
- left,
353409
- right: left + widthInEm(visible) * size,
353410
- top: top - index * size - size * 0.05,
353411
- bottom: top - (index + 1) * size + size * 0.05
353412
- });
353413
- return [
353414
- polygon.map(({ x, y }) => ({
353415
- x: text.position.x + x * cos - y * sin,
353416
- y: text.position.y + x * sin + y * cos
353417
- }))
353418
- ];
353419
- });
353420
- }
353421
- function polygonsOverlap(a, b) {
353422
- for (const polygon of [a, b]) {
353423
- for (let i = 0;i < polygon.length; i++) {
353424
- const p = polygon[i];
353425
- const q = polygon[(i + 1) % polygon.length];
353426
- const length = Math.hypot(q.x - p.x, q.y - p.y);
353427
- if (length < 0.000000001)
353428
- continue;
353429
- const nx = -(q.y - p.y) / length;
353430
- const ny = (q.x - p.x) / length;
353431
- const project = (points) => points.map(({ x, y }) => x * nx + y * ny);
353432
- const pa = project(a);
353433
- const pb = project(b);
353434
- if (Math.min(Math.max(...pa), Math.max(...pb)) - Math.max(Math.min(...pa), Math.min(...pb)) <= 0.000001)
353435
- return false;
353436
- }
353437
- }
353438
- return true;
353439
- }
353440
- function traceSegmentPolygon(from, to) {
353441
- const length = Math.hypot(to.x - from.x, to.y - from.y);
353442
- if (length < 0.000000001)
353443
- return;
353444
- const dx = -(to.y - from.y) / length * 0.01;
353445
- const dy = (to.x - from.x) / length * 0.01;
353446
- return [
353447
- { x: from.x + dx, y: from.y + dy },
353448
- { x: to.x + dx, y: to.y + dy },
353449
- { x: to.x - dx, y: to.y - dy },
353450
- { x: from.x - dx, y: from.y - dy }
353451
- ];
353452
- }
353453
- function segmentCrossesPolygon(from, to, polygon) {
353454
- if (Math.hypot(to.x - from.x, to.y - from.y) < 0.000000001)
353455
- return false;
353456
- let low = 0;
353457
- let high = 1;
353458
- for (let i = 0;i < polygon.length; i++) {
353459
- const p = polygon[i];
353460
- const q = polygon[(i + 1) % polygon.length];
353461
- const length = Math.hypot(q.x - p.x, q.y - p.y);
353462
- if (length < 0.000000001)
353463
- continue;
353464
- const nx = -(q.y - p.y) / length;
353465
- const ny = (q.x - p.x) / length;
353466
- const start = (from.x - p.x) * nx + (from.y - p.y) * ny - 0.000001;
353467
- const end = (to.x - p.x) * nx + (to.y - p.y) * ny - 0.000001;
353468
- if (start <= 0 && end <= 0)
353469
- return false;
353470
- if (start <= 0)
353471
- low = Math.max(low, -start / (end - start));
353472
- if (end <= 0)
353473
- high = Math.min(high, -start / (end - start));
353474
- if (high <= low)
353475
- return false;
353476
- }
353477
- return high > low;
353478
- }
353479
- var polygonBounds = (polygons) => {
353480
- const points = polygons.flat();
353481
- return {
353482
- left: Math.min(...points.map((p) => p.x)),
353483
- right: Math.max(...points.map((p) => p.x)),
353484
- top: Math.max(...points.map((p) => p.y)),
353485
- bottom: Math.min(...points.map((p) => p.y))
353486
- };
353487
- };
353488
-
353489
- // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TraceSimplificationSolver/TraceSimplificationSolver.ts
353490
- import { BaseSolver as BaseSolver27 } from "@tscircuit/solver-utils";
353491
- class TraceSimplificationSolver extends BaseSolver27 {
354110
+ import { BaseSolver as BaseSolver31 } from "@tscircuit/solver-utils";
354111
+ class TraceSimplificationSolver extends BaseSolver31 {
353492
354112
  static EPSILON = 0.01;
353493
354113
  ctx;
353494
354114
  out;
@@ -353804,7 +354424,7 @@ class TraceSimplificationSolver extends BaseSolver27 {
353804
354424
  });
353805
354425
  }
353806
354426
  makeIssue(trace, candidate) {
353807
- const targetName = candidate.target.sourceComponentName ?? candidate.target.schematicComponentId ?? "component";
354427
+ const targetName = candidate.target.sourceComponentName || "component";
353808
354428
  const direction = this.getMoveDirection(candidate.deltaSchX, candidate.deltaSchY);
353809
354429
  const distance = Math.abs(candidate.deltaSchX || candidate.deltaSchY);
353810
354430
  const newSchX = candidate.target.schX + candidate.deltaSchX;
@@ -353846,7 +354466,7 @@ class TraceSimplificationSolver extends BaseSolver27 {
353846
354466
  }
353847
354467
 
353848
354468
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentOrientationSolver/TwoPinComponentOrientationSolver.ts
353849
- import { BaseSolver as BaseSolver28 } from "@tscircuit/solver-utils";
354469
+ import { BaseSolver as BaseSolver32 } from "@tscircuit/solver-utils";
353850
354470
 
353851
354471
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentOrientationSolver/getPowerOrGroundConnectionIds.ts
353852
354472
  import {
@@ -353885,7 +354505,7 @@ function getPowerOrGroundConnectionIds(circuitJson) {
353885
354505
  }
353886
354506
 
353887
354507
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentOrientationSolver/TwoPinComponentOrientationSolver.ts
353888
- class TwoPinComponentOrientationSolver extends BaseSolver28 {
354508
+ class TwoPinComponentOrientationSolver extends BaseSolver32 {
353889
354509
  static EPSILON = 0.01;
353890
354510
  ctx;
353891
354511
  out;
@@ -354096,8 +354716,8 @@ class TwoPinComponentOrientationSolver extends BaseSolver28 {
354096
354716
  return improvement > existingImprovement || improvement === existingImprovement && candidate.traceLength > existing.traceLength;
354097
354717
  }
354098
354718
  makeIssue(candidate) {
354099
- const targetName = candidate.targetPlacement.sourceComponentName ?? candidate.targetPlacement.schematicComponentId ?? "component";
354100
- const connectedName = candidate.connectedPlacement.sourceComponentName ?? candidate.connectedPlacement.schematicComponentId ?? "connected component";
354719
+ const targetName = candidate.targetPlacement.sourceComponentName || "component";
354720
+ const connectedName = candidate.connectedPlacement.sourceComponentName || "component";
354101
354721
  const targetPin = candidate.targetPort.pin_number ? `pin${candidate.targetPort.pin_number}` : candidate.targetPort.display_pin_label;
354102
354722
  return {
354103
354723
  lineItemType: "TwoPinComponentCouldBeFlipped",
@@ -354131,8 +354751,8 @@ class TwoPinComponentOrientationSolver extends BaseSolver28 {
354131
354751
  }
354132
354752
 
354133
354753
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/VerboseNetLabelSolver/VerboseNetLabelSolver.ts
354134
- import { BaseSolver as BaseSolver29 } from "@tscircuit/solver-utils";
354135
- class VerboseNetLabelSolver extends BaseSolver29 {
354754
+ import { BaseSolver as BaseSolver33 } from "@tscircuit/solver-utils";
354755
+ class VerboseNetLabelSolver extends BaseSolver33 {
354136
354756
  params;
354137
354757
  VERBOSE_NET_LABEL_MESSAGE = "Create trace with schDisplayLabel";
354138
354758
  netLabels;
@@ -354241,8 +354861,8 @@ class VerboseNetLabelSolver extends BaseSolver29 {
354241
354861
  }
354242
354862
 
354243
354863
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicTextClearanceSolver/SchematicTextClearanceSolver.ts
354244
- import { BaseSolver as BaseSolver30 } from "@tscircuit/solver-utils";
354245
- class SchematicTextClearanceSolver extends BaseSolver30 {
354864
+ import { BaseSolver as BaseSolver34 } from "@tscircuit/solver-utils";
354865
+ class SchematicTextClearanceSolver extends BaseSolver34 {
354246
354866
  params;
354247
354867
  texts;
354248
354868
  obstacles;
@@ -354258,7 +354878,7 @@ class SchematicTextClearanceSolver extends BaseSolver30 {
354258
354878
  this.texts = ctx.circuitJson.flatMap((element) => {
354259
354879
  if (element.type !== "schematic_text")
354260
354880
  return [];
354261
- if (element.schematic_component_id || element.schematic_symbol_id || "source_trace_id" in element && element.source_trace_id)
354881
+ if (element.schematic_component_id || element.schematic_symbol_id)
354262
354882
  return [];
354263
354883
  const polygons = getSchematicTextPolygons(element);
354264
354884
  if (!polygons.length)
@@ -354280,6 +354900,7 @@ class SchematicTextClearanceSolver extends BaseSolver30 {
354280
354900
  return [
354281
354901
  {
354282
354902
  text: element,
354903
+ isTraceLabel: Boolean("source_trace_id" in element && element.source_trace_id),
354283
354904
  polygons,
354284
354905
  sheetId,
354285
354906
  object: {
@@ -354327,8 +354948,9 @@ class SchematicTextClearanceSolver extends BaseSolver30 {
354327
354948
  const targets = [...this.obstacles, ...this.texts.slice(this.index + 1)];
354328
354949
  const collisions = targets.filter((target) => this.collides(text, target));
354329
354950
  if (collisions.length) {
354330
- const suggestedMove = this.findClearPosition(text);
354951
+ const suggestedMove = text.isTraceLabel ? undefined : this.findClearPosition(text);
354331
354952
  for (const target of collisions) {
354953
+ const targetName = target.object.componentName ?? target.object.text;
354332
354954
  this.params.issues.push({
354333
354955
  lineItemType: "SchematicTextCollision",
354334
354956
  schematicSheetId: text.sheetId,
@@ -354339,7 +354961,7 @@ class SchematicTextClearanceSolver extends BaseSolver30 {
354339
354961
  textBounds: polygonBounds(text.polygons),
354340
354962
  collidingObjectBounds: polygonBounds(target.polygons),
354341
354963
  suggestedMove,
354342
- message: `Text "${text.text.text}" overlaps ${target.object.type} ${target.object.componentName ?? target.object.id}; reposition the text to leave its visible area clear.`
354964
+ message: `Text "${text.text.text}" overlaps ${target.object.type}${targetName ? ` ${targetName}` : ""}; ${text.isTraceLabel ? "adjust the owning trace's label placement or remove stale duplicates to leave the visible text area clear." : "reposition the text to leave its visible area clear."}`
354343
354965
  });
354344
354966
  }
354345
354967
  }
@@ -354381,10 +355003,9 @@ class SchematicTextClearanceSolver extends BaseSolver30 {
354381
355003
  }
354382
355004
  static issueToString(issue) {
354383
355005
  const attrs = [];
354384
- addAttr(attrs, "schematicTextId", issue.schematicTextId);
354385
355006
  addAttr(attrs, "text", issue.text);
354386
355007
  addAttr(attrs, "collidingObjectType", issue.collidingObject.type);
354387
- addAttr(attrs, "collidingObjectId", issue.collidingObject.id);
355008
+ addAttr(attrs, "collidingText", issue.collidingObject.text);
354388
355009
  addAttr(attrs, "newSchX", issue.suggestedMove?.newSchX);
354389
355010
  addAttr(attrs, "newSchY", issue.suggestedMove?.newSchY);
354390
355011
  addAttr(attrs, "message", issue.message);
@@ -354393,8 +355014,8 @@ class SchematicTextClearanceSolver extends BaseSolver30 {
354393
355014
  }
354394
355015
 
354395
355016
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ResetNetworkGroupingSolver/ResetNetworkGroupingSolver.ts
354396
- import { BaseSolver as BaseSolver31 } from "@tscircuit/solver-utils";
354397
- class ResetNetworkGroupingSolver extends BaseSolver31 {
355017
+ import { BaseSolver as BaseSolver35 } from "@tscircuit/solver-utils";
355018
+ class ResetNetworkGroupingSolver extends BaseSolver35 {
354398
355019
  params;
354399
355020
  static MIN_DISTANCE = 6;
354400
355021
  networks;
@@ -354411,9 +355032,9 @@ class ResetNetworkGroupingSolver extends BaseSolver31 {
354411
355032
  const threshold = Math.max(ResetNetworkGroupingSolver.MIN_DISTANCE, ...rcMembers.map((p) => 3 * Math.max(p.width, p.height)));
354412
355033
  const distances = rcMembers.map((p) => Math.hypot(Math.max(0, Math.abs(p.schX - network.pinPosition.x) - p.width / 2), Math.max(0, Math.abs(p.schY - network.pinPosition.y) - p.height / 2)));
354413
355034
  if (distances.some((distance) => distance > threshold)) {
354414
- const hostName = network.host.sourceComponentName ?? network.host.schematicComponentId;
355035
+ const hostName = network.host.sourceComponentName || "component";
354415
355036
  const resetPin = resetPinName(network.pin);
354416
- const memberNames = rcMembers.map((p) => p.sourceComponentName ?? p.schematicComponentId).join(", ");
355037
+ const memberNames = rcMembers.map((p) => p.sourceComponentName || "component").join(", ");
354417
355038
  this.params.issues.push({
354418
355039
  lineItemType: "ResetNetworkNotGrouped",
354419
355040
  hostSchematicBox: network.host,
@@ -354538,7 +355159,7 @@ class ResetNetworkGroupingSolver extends BaseSolver31 {
354538
355159
  const attrs = [];
354539
355160
  addAttr(attrs, "hostComponentName", issue.hostSchematicBox.sourceComponentName);
354540
355161
  addAttr(attrs, "resetPin", issue.resetPinName);
354541
- addAttr(attrs, "supportNetworkComponents", issue.supportNetworkComponents.map((p) => p.sourceComponentName ?? p.schematicComponentId).join(","));
355162
+ addAttr(attrs, "supportNetworkComponents", issue.supportNetworkComponents.map((p) => p.sourceComponentName || "component").join(","));
354542
355163
  addAttr(attrs, "maxDistanceFromResetPin", issue.maxDistanceFromResetPin);
354543
355164
  addAttr(attrs, "maxRecommendedDistance", issue.maxRecommendedDistance);
354544
355165
  addAttr(attrs, "message", issue.message);
@@ -354549,6 +355170,9 @@ var resetPinName = (port) => [port.name, ...port.port_hints ?? []].find((name) =
354549
355170
 
354550
355171
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicPlacementPipeline/SchematicPlacementPipeline.ts
354551
355172
  var solversByIssueType = {
355173
+ RailPathTooSpreadOut: [RailPathVisibilitySolver],
355174
+ CapacitorSeparatedFromChipPins: [ChipPinPairCapacitorPlacementSolver],
355175
+ PiFilterComponentsNotGrouped: [PiFilterPlacementSolver],
354552
355176
  MosfetGateNetworkNotGrouped: [MosfetGateNetworkPlacementSolver],
354553
355177
  FlybackDiodeSeparatedFromRelayCoil: [RelayFlybackDiodePlacementSolver],
354554
355178
  ComponentOverlap: [SchematicBoxOverlapSolver],
@@ -354563,6 +355187,7 @@ var solversByIssueType = {
354563
355187
  SchematicBoxInnerLabelCollision: [SchematicBoxInnerLabelCollisionSolver],
354564
355188
  SchematicPinPaddingToEdgeTooLarge: [SchematicPinPaddingToEdgeSolver],
354565
355189
  DiodeResistorNotAligned: [DiodeResistorAlignmentSolver],
355190
+ ParallelDiodeResistorNotAligned: [ParallelDiodeResistorPlacementSolver],
354566
355191
  ComponentPinsWouldAlignWithVerticalShift: [ComponentPinAlignmentSolver],
354567
355192
  TraceCanBeSimplifiedByMovingComponent: [TraceSimplificationSolver],
354568
355193
  CrystalNotCenteredOverLoadCapacitors: [CrystalLoadCapacitorPlacementSolver],
@@ -354596,6 +355221,9 @@ class SchematicPlacementPipeline extends BasePipelineSolver2 {
354596
355221
  ctx;
354597
355222
  issues = [];
354598
355223
  pipelineDef = [
355224
+ definePipelineStep3("ParallelDiodeResistorPlacementSolver", ParallelDiodeResistorPlacementSolver, (p) => [
355225
+ { ctx: p.ctx, issues: p.issues }
355226
+ ]),
354599
355227
  definePipelineStep3("SchematicTextClearanceSolver", SchematicTextClearanceSolver, (p) => [
354600
355228
  { ctx: p.ctx, issues: p.issues }
354601
355229
  ]),
@@ -354674,13 +355302,29 @@ class SchematicPlacementPipeline extends BasePipelineSolver2 {
354674
355302
  definePipelineStep3("RelayFlybackDiodePlacementSolver", RelayFlybackDiodePlacementSolver, (p) => [
354675
355303
  { ctx: p.ctx, issues: p.issues }
354676
355304
  ]),
355305
+ definePipelineStep3("PiFilterPlacementSolver", PiFilterPlacementSolver, (p) => [
355306
+ { ctx: p.ctx, issues: p.issues }
355307
+ ]),
354677
355308
  definePipelineStep3("MosfetGateNetworkPlacementSolver", MosfetGateNetworkPlacementSolver, (p) => [
354678
355309
  { ctx: p.ctx, issues: p.issues }
355310
+ ]),
355311
+ definePipelineStep3("ChipPinPairCapacitorPlacementSolver", ChipPinPairCapacitorPlacementSolver, (p) => [
355312
+ { ctx: p.ctx, issues: p.issues }
355313
+ ]),
355314
+ definePipelineStep3("RailPathVisibilitySolver", RailPathVisibilitySolver, (p) => [
355315
+ {
355316
+ ctx: p.ctx,
355317
+ issues: p.issues,
355318
+ maxSpan: p.railPathVisibility?.maxSpan,
355319
+ maxLength: p.railPathVisibility?.maxPathLength
355320
+ }
354679
355321
  ])
354680
355322
  ];
354681
355323
  selectedIssueTypes;
355324
+ railPathVisibility;
354682
355325
  constructor(circuitJson, options = {}) {
354683
355326
  super(circuitJson);
355327
+ this.railPathVisibility = options.railPathVisibility;
354684
355328
  if (options.issueTypes !== undefined) {
354685
355329
  this.selectedIssueTypes = new Set(options.issueTypes);
354686
355330
  const selectedSolvers = new Set(options.issueTypes.flatMap((type) => solversByIssueType[type]));
@@ -354736,6 +355380,15 @@ var getRelevantPlacementsForIssues = ({
354736
355380
  };
354737
355381
  for (const issue of issues) {
354738
355382
  switch (issue.lineItemType) {
355383
+ case "CapacitorSeparatedFromChipPins":
355384
+ addPlacement(issue.hostSchematicBox);
355385
+ addPlacement(issue.capacitorSchematicBox);
355386
+ break;
355387
+ case "PiFilterComponentsNotGrouped":
355388
+ addPlacement(issue.inductorSchematicBox);
355389
+ addPlacement(issue.firstCapacitorSchematicBox);
355390
+ addPlacement(issue.secondCapacitorSchematicBox);
355391
+ break;
354739
355392
  case "MosfetGateNetworkNotGrouped":
354740
355393
  addPlacement(issue.mosfetSchematicBox);
354741
355394
  addPlacement(issue.seriesGateResistorSchematicBox);
@@ -354811,6 +355464,7 @@ var getRelevantPlacementsForIssues = ({
354811
355464
  addComponentName(getComponentNameFromPin(pin), issue.schematicSheetId);
354812
355465
  }
354813
355466
  break;
355467
+ case "ParallelDiodeResistorNotAligned":
354814
355468
  case "DiodeResistorNotAligned":
354815
355469
  addPlacement(issue.diodeSchematicBox);
354816
355470
  addPlacement(issue.resistorSchematicBox);
@@ -354848,6 +355502,11 @@ var getRelevantPlacementsForIssues = ({
354848
355502
  case "TwoPinComponentHasInvertedRails":
354849
355503
  addPlacement(issue.schematicBox);
354850
355504
  break;
355505
+ case "RailPathTooSpreadOut":
355506
+ addPlacement(issue.hostSchematicBox);
355507
+ for (const placement of issue.supportSchematicBoxes)
355508
+ addPlacement(placement);
355509
+ break;
354851
355510
  case "PullResistorOnWrongSide":
354852
355511
  addPlacement(issue.resistorSchematicBox);
354853
355512
  addPlacement(issue.hostSchematicBox);
@@ -354945,6 +355604,7 @@ class SchematicPlacementAnalysis {
354945
355604
  SchematicBoxInnerLabelCollision: 0,
354946
355605
  SchematicPinPaddingToEdgeTooLarge: 0,
354947
355606
  DiodeResistorNotAligned: 0,
355607
+ ParallelDiodeResistorNotAligned: 0,
354948
355608
  ComponentPinsWouldAlignWithVerticalShift: 0,
354949
355609
  TraceCanBeSimplifiedByMovingComponent: 0,
354950
355610
  CrystalNotCenteredOverLoadCapacitors: 0,
@@ -354965,7 +355625,10 @@ class SchematicPlacementAnalysis {
354965
355625
  RegulatorCapacitorsOnWrongSides: 0,
354966
355626
  VoltageDividerSupplyResistorBelowGroundResistor: 0,
354967
355627
  CurrentSenseShuntSeparatedFromInputs: 0,
354968
- MosfetGateNetworkNotGrouped: 0
355628
+ PiFilterComponentsNotGrouped: 0,
355629
+ MosfetGateNetworkNotGrouped: 0,
355630
+ CapacitorSeparatedFromChipPins: 0,
355631
+ RailPathTooSpreadOut: 0
354969
355632
  };
354970
355633
  for (const issue of this.getIssues(filter))
354971
355634
  counts[issue.lineItemType]++;
@@ -354986,6 +355649,10 @@ class SchematicPlacementAnalysis {
354986
355649
  }
354987
355650
  schematicIssuesToString(issue) {
354988
355651
  switch (issue.lineItemType) {
355652
+ case "CapacitorSeparatedFromChipPins":
355653
+ return ChipPinPairCapacitorPlacementSolver.issueToString(issue);
355654
+ case "PiFilterComponentsNotGrouped":
355655
+ return PiFilterPlacementSolver.issueToString(issue);
354989
355656
  case "MosfetGateNetworkNotGrouped":
354990
355657
  return MosfetGateNetworkPlacementSolver.issueToString(issue);
354991
355658
  case "CurrentSenseShuntSeparatedFromInputs":
@@ -355005,6 +355672,8 @@ class SchematicPlacementAnalysis {
355005
355672
  return SchematicBoxInnerLabelCollisionSolver.issueToString(issue);
355006
355673
  case "SchematicPinPaddingToEdgeTooLarge":
355007
355674
  return SchematicPinPaddingToEdgeSolver.issueToString(issue);
355675
+ case "ParallelDiodeResistorNotAligned":
355676
+ return ParallelDiodeResistorPlacementSolver.issueToString(issue);
355008
355677
  case "DiodeResistorNotAligned":
355009
355678
  return DiodeResistorAlignmentSolver.issueToString(issue);
355010
355679
  case "ComponentPinsWouldAlignWithVerticalShift":
@@ -355020,6 +355689,8 @@ class SchematicPlacementAnalysis {
355020
355689
  case "TwoPinComponentShouldBeVertical":
355021
355690
  case "TwoPinComponentHasInvertedRails":
355022
355691
  return TwoPinComponentRailOrientationSolver.issueToString(issue);
355692
+ case "RailPathTooSpreadOut":
355693
+ return RailPathVisibilitySolver.issueToString(issue);
355023
355694
  case "PullResistorOnWrongSide":
355024
355695
  return PullResistorPlacementSolver.issueToString(issue);
355025
355696
  case "NetLabelCollision":
@@ -374640,7 +375311,7 @@ __export5(dist_exports, {
374640
375311
  circle_shape: () => circle_shape,
374641
375312
  circuit_json_footprint_load_error: () => circuit_json_footprint_load_error2,
374642
375313
  current: () => current2,
374643
- distance: () => distance51,
375314
+ distance: () => distance54,
374644
375315
  duration_ms: () => duration_ms,
374645
375316
  experiment_type: () => experiment_type,
374646
375317
  external_footprint_load_error: () => external_footprint_load_error2,
@@ -379129,7 +379800,7 @@ var inductance2 = external_exports2.string().or(external_exports2.number()).tran
379129
379800
  var voltage5 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v, "V").value);
379130
379801
  var length67 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v).value);
379131
379802
  var frequency7 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v, "Hz").value);
379132
- var distance51 = length67;
379803
+ var distance54 = length67;
379133
379804
  var current2 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v, "A").value);
379134
379805
  var duration_ms = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v).value);
379135
379806
  var time = duration_ms;
@@ -379170,16 +379841,16 @@ expectStringUnionsMatch('T2 has extra: "c"');
379170
379841
  expectStringUnionsMatch('T1 has extra: "d", T2 has extra: "c"');
379171
379842
  expectStringUnionsMatch(true);
379172
379843
  var point9 = external_exports2.object({
379173
- x: distance51,
379174
- y: distance51
379844
+ x: distance54,
379845
+ y: distance54
379175
379846
  });
379176
379847
  var position = point9;
379177
379848
  expectTypesMatch2(true);
379178
379849
  expectTypesMatch2(true);
379179
379850
  var point33 = external_exports2.object({
379180
- x: distance51,
379181
- y: distance51,
379182
- z: distance51
379851
+ x: distance54,
379852
+ y: distance54,
379853
+ z: distance54
379183
379854
  });
379184
379855
  var position3 = point33;
379185
379856
  expectTypesMatch2(true);
@@ -379188,8 +379859,8 @@ var size = external_exports2.object({
379188
379859
  height: external_exports2.number()
379189
379860
  });
379190
379861
  expectTypesMatch2(true);
379191
- var finite_distance = distance51.pipe(external_exports2.number().finite());
379192
- var positive_distance = distance51.pipe(external_exports2.number().finite().positive());
379862
+ var finite_distance = distance54.pipe(external_exports2.number().finite());
379863
+ var positive_distance = distance54.pipe(external_exports2.number().finite().positive());
379193
379864
  var circle_shape = external_exports2.object({
379194
379865
  shape: external_exports2.literal("circle"),
379195
379866
  x: finite_distance,
@@ -379284,7 +379955,7 @@ var kicadAt2 = point9.extend({
379284
379955
  expectTypesMatch2(true);
379285
379956
  var kicadFont2 = external_exports2.object({
379286
379957
  size: point9.optional(),
379287
- thickness: distance51.optional()
379958
+ thickness: distance54.optional()
379288
379959
  });
379289
379960
  expectTypesMatch2(true);
379290
379961
  var kicadEffects2 = external_exports2.object({
@@ -379320,7 +379991,7 @@ var kicadFootprintPad2 = external_exports2.object({
379320
379991
  shape: external_exports2.string().optional(),
379321
379992
  at: kicadAt2.optional(),
379322
379993
  size: point9.optional(),
379323
- drill: distance51.optional(),
379994
+ drill: distance54.optional(),
379324
379995
  layers: external_exports2.array(external_exports2.string()).optional(),
379325
379996
  removeUnusedLayers: external_exports2.boolean().optional(),
379326
379997
  uuid: external_exports2.string().optional()
@@ -379351,7 +380022,7 @@ var kicadSymbolPinNumbers2 = external_exports2.object({
379351
380022
  });
379352
380023
  expectTypesMatch2(true);
379353
380024
  var kicadSymbolPinNames2 = external_exports2.object({
379354
- offset: distance51.optional(),
380025
+ offset: distance54.optional(),
379355
380026
  hide: external_exports2.boolean().optional()
379356
380027
  });
379357
380028
  expectTypesMatch2(true);
@@ -379425,7 +380096,7 @@ var source_simple_capacitor = source_component_base.extend({
379425
380096
  capacitance: capacitance4,
379426
380097
  max_voltage_rating: voltage5.optional(),
379427
380098
  display_capacitance: external_exports2.string().optional(),
379428
- max_decoupling_trace_length: distance51.optional()
380099
+ max_decoupling_trace_length: distance54.optional()
379429
380100
  });
379430
380101
  expectTypesMatch2(true);
379431
380102
  var source_simple_resistor = source_component_base.extend({
@@ -380021,11 +380692,11 @@ var schematic_box = external_exports2.object({
380021
380692
  schematic_sheet_id: external_exports2.string().optional(),
380022
380693
  schematic_component_id: external_exports2.string().optional(),
380023
380694
  schematic_symbol_id: external_exports2.string().optional(),
380024
- width: distance51,
380025
- height: distance51,
380695
+ width: distance54,
380696
+ height: distance54,
380026
380697
  is_dashed: external_exports2.boolean().default(false),
380027
- x: distance51,
380028
- y: distance51,
380698
+ x: distance54,
380699
+ y: distance54,
380029
380700
  subcircuit_id: external_exports2.string().optional()
380030
380701
  }).describe("Draws a box on the schematic");
380031
380702
  expectTypesMatch2(true);
@@ -380038,10 +380709,10 @@ var schematic_path = external_exports2.object({
380038
380709
  fill_color: external_exports2.string().optional(),
380039
380710
  is_filled: external_exports2.boolean().optional(),
380040
380711
  is_dashed: external_exports2.boolean().default(false),
380041
- stroke_width: distance51.nullable().optional(),
380712
+ stroke_width: distance54.nullable().optional(),
380042
380713
  stroke_color: external_exports2.string().optional(),
380043
- dash_length: distance51.optional(),
380044
- dash_gap: distance51.optional(),
380714
+ dash_length: distance54.optional(),
380715
+ dash_gap: distance54.optional(),
380045
380716
  points: external_exports2.array(point9),
380046
380717
  subcircuit_id: external_exports2.string().optional()
380047
380718
  });
@@ -380120,15 +380791,15 @@ var schematic_line = external_exports2.object({
380120
380791
  schematic_sheet_id: external_exports2.string().optional(),
380121
380792
  schematic_component_id: external_exports2.string().optional(),
380122
380793
  schematic_symbol_id: external_exports2.string().optional(),
380123
- x1: distance51,
380124
- y1: distance51,
380125
- x2: distance51,
380126
- y2: distance51,
380127
- stroke_width: distance51.nullable().optional(),
380794
+ x1: distance54,
380795
+ y1: distance54,
380796
+ x2: distance54,
380797
+ y2: distance54,
380798
+ stroke_width: distance54.nullable().optional(),
380128
380799
  color: external_exports2.string().default("#000000"),
380129
380800
  is_dashed: external_exports2.boolean().default(false),
380130
- dash_length: distance51.optional(),
380131
- dash_gap: distance51.optional(),
380801
+ dash_length: distance54.optional(),
380802
+ dash_gap: distance54.optional(),
380132
380803
  subcircuit_id: external_exports2.string().optional()
380133
380804
  }).describe("Draws a styled line on the schematic");
380134
380805
  expectTypesMatch2(true);
@@ -380139,10 +380810,10 @@ var schematic_rect = external_exports2.object({
380139
380810
  schematic_component_id: external_exports2.string().optional(),
380140
380811
  schematic_symbol_id: external_exports2.string().optional(),
380141
380812
  center: point9,
380142
- width: distance51,
380143
- height: distance51,
380813
+ width: distance54,
380814
+ height: distance54,
380144
380815
  rotation: rotation11.default(0),
380145
- stroke_width: distance51.nullable().optional(),
380816
+ stroke_width: distance54.nullable().optional(),
380146
380817
  color: external_exports2.string().default("#000000"),
380147
380818
  is_filled: external_exports2.boolean().default(false),
380148
380819
  fill_color: external_exports2.string().optional(),
@@ -380157,8 +380828,8 @@ var schematic_circle = external_exports2.object({
380157
380828
  schematic_component_id: external_exports2.string().optional(),
380158
380829
  schematic_symbol_id: external_exports2.string().optional(),
380159
380830
  center: point9,
380160
- radius: distance51,
380161
- stroke_width: distance51.nullable().optional(),
380831
+ radius: distance54,
380832
+ stroke_width: distance54.nullable().optional(),
380162
380833
  color: external_exports2.string().default("#000000"),
380163
380834
  is_filled: external_exports2.boolean().default(false),
380164
380835
  fill_color: external_exports2.string().optional(),
@@ -380173,11 +380844,11 @@ var schematic_arc = external_exports2.object({
380173
380844
  schematic_component_id: external_exports2.string().optional(),
380174
380845
  schematic_symbol_id: external_exports2.string().optional(),
380175
380846
  center: point9,
380176
- radius: distance51,
380847
+ radius: distance54,
380177
380848
  start_angle_degrees: rotation11,
380178
380849
  end_angle_degrees: rotation11,
380179
380850
  direction: external_exports2.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
380180
- stroke_width: distance51.nullable().optional(),
380851
+ stroke_width: distance54.nullable().optional(),
380181
380852
  color: external_exports2.string().default("#000000"),
380182
380853
  is_dashed: external_exports2.boolean().default(false),
380183
380854
  subcircuit_id: external_exports2.string().optional()
@@ -380233,8 +380904,8 @@ var schematic_text = external_exports2.object({
380233
380904
  display_superscript: external_exports2.string().optional(),
380234
380905
  font_size: external_exports2.number().default(0.18),
380235
380906
  position: external_exports2.object({
380236
- x: distance51,
380237
- y: distance51
380907
+ x: distance54,
380908
+ y: distance54
380238
380909
  }),
380239
380910
  rotation: external_exports2.number().default(0),
380240
380911
  anchor: external_exports2.union([fivePointAnchor2.describe("legacy"), ninePointAnchor2]).default("center"),
@@ -380385,7 +381056,7 @@ var schematic_element_outside_sheet_warning = external_exports2.object({
380385
381056
  schematic_element_id: external_exports2.string()
380386
381057
  }).describe("Warning emitted when a schematic component, net label, or trace extends outside its schematic sheet");
380387
381058
  expectTypesMatch2(true);
380388
- var positiveFiniteDistance = distance51.pipe(external_exports2.number().positive().finite());
381059
+ var positiveFiniteDistance = distance54.pipe(external_exports2.number().positive().finite());
380389
381060
  var schematic_graphic = external_exports2.object({
380390
381061
  type: external_exports2.literal("schematic_graphic"),
380391
381062
  schematic_graphic_id: getZodPrefixedIdWithDefault("schematic_graphic"),
@@ -380424,10 +381095,10 @@ var schematic_table = external_exports2.object({
380424
381095
  schematic_table_id: getZodPrefixedIdWithDefault("schematic_table"),
380425
381096
  schematic_sheet_id: external_exports2.string().optional(),
380426
381097
  anchor_position: point9,
380427
- column_widths: external_exports2.array(distance51),
380428
- row_heights: external_exports2.array(distance51),
380429
- cell_padding: distance51.optional(),
380430
- border_width: distance51.optional(),
381098
+ column_widths: external_exports2.array(distance54),
381099
+ row_heights: external_exports2.array(distance54),
381100
+ cell_padding: distance54.optional(),
381101
+ border_width: distance54.optional(),
380431
381102
  subcircuit_id: external_exports2.string().optional(),
380432
381103
  schematic_component_id: external_exports2.string().optional(),
380433
381104
  anchor: ninePointAnchor2.optional()
@@ -380444,11 +381115,11 @@ var schematic_table_cell = external_exports2.object({
380444
381115
  end_column_index: external_exports2.number(),
380445
381116
  text: external_exports2.string().optional(),
380446
381117
  center: point9,
380447
- width: distance51,
380448
- height: distance51,
381118
+ width: distance54,
381119
+ height: distance54,
380449
381120
  horizontal_align: external_exports2.enum(["left", "center", "right"]).optional(),
380450
381121
  vertical_align: external_exports2.enum(["top", "middle", "bottom"]).optional(),
380451
- font_size: distance51.optional(),
381122
+ font_size: distance54.optional(),
380452
381123
  subcircuit_id: external_exports2.string().optional()
380453
381124
  }).describe("Defines a cell within a schematic_table");
380454
381125
  expectTypesMatch2(true);
@@ -380473,8 +381144,8 @@ var schematic_missing_sheet_warning = external_exports2.object({
380473
381144
  }).describe("Circuit-wide warning emitted when a schematic has no schematic sheet. Display as a banner without attaching it to a component or drawing a target outline or leader line.");
380474
381145
  expectTypesMatch2(true);
380475
381146
  var point_with_bulge = external_exports2.object({
380476
- x: distance51,
380477
- y: distance51,
381147
+ x: distance54,
381148
+ y: distance54,
380478
381149
  bulge: external_exports2.number().optional()
380479
381150
  });
380480
381151
  expectTypesMatch2(true);
@@ -380565,8 +381236,8 @@ var getRotationBetweenPcbPin1Locations3 = (from, to) => {
380565
381236
  return null;
380566
381237
  };
380567
381238
  var pcb_route_hint = external_exports2.object({
380568
- x: distance51,
380569
- y: distance51,
381239
+ x: distance54,
381240
+ y: distance54,
380570
381241
  via: external_exports2.boolean().optional(),
380571
381242
  via_to_layer: layer_ref2.optional()
380572
381243
  });
@@ -380574,11 +381245,11 @@ var pcb_route_hints = external_exports2.array(pcb_route_hint);
380574
381245
  expectTypesMatch2(true);
380575
381246
  expectTypesMatch2(true);
380576
381247
  var route_hint_point8 = external_exports2.object({
380577
- x: distance51,
380578
- y: distance51,
381248
+ x: distance54,
381249
+ y: distance54,
380579
381250
  via: external_exports2.boolean().optional(),
380580
381251
  to_layer: layer_ref2.optional(),
380581
- trace_width: distance51.optional()
381252
+ trace_width: distance54.optional()
380582
381253
  });
380583
381254
  expectTypesMatch2(true);
380584
381255
  var manufacturing_drc_properties = external_exports2.object({
@@ -380664,8 +381335,8 @@ var pcb_hole_circle = external_exports2.object({
380664
381335
  pcb_component_id: external_exports2.string().optional(),
380665
381336
  hole_shape: external_exports2.literal("circle"),
380666
381337
  hole_diameter: external_exports2.number(),
380667
- x: distance51,
380668
- y: distance51,
381338
+ x: distance54,
381339
+ y: distance54,
380669
381340
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380670
381341
  soldermask_margin: external_exports2.number().optional()
380671
381342
  });
@@ -380680,8 +381351,8 @@ var pcb_hole_rect = external_exports2.object({
380680
381351
  hole_shape: external_exports2.literal("rect"),
380681
381352
  hole_width: external_exports2.number(),
380682
381353
  hole_height: external_exports2.number(),
380683
- x: distance51,
380684
- y: distance51,
381354
+ x: distance54,
381355
+ y: distance54,
380685
381356
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380686
381357
  soldermask_margin: external_exports2.number().optional()
380687
381358
  });
@@ -380695,8 +381366,8 @@ var pcb_hole_circle_or_square = external_exports2.object({
380695
381366
  pcb_component_id: external_exports2.string().optional(),
380696
381367
  hole_shape: external_exports2.enum(["circle", "square"]),
380697
381368
  hole_diameter: external_exports2.number(),
380698
- x: distance51,
380699
- y: distance51,
381369
+ x: distance54,
381370
+ y: distance54,
380700
381371
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380701
381372
  soldermask_margin: external_exports2.number().optional()
380702
381373
  });
@@ -380711,8 +381382,8 @@ var pcb_hole_oval = external_exports2.object({
380711
381382
  hole_shape: external_exports2.literal("oval"),
380712
381383
  hole_width: external_exports2.number(),
380713
381384
  hole_height: external_exports2.number(),
380714
- x: distance51,
380715
- y: distance51,
381385
+ x: distance54,
381386
+ y: distance54,
380716
381387
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380717
381388
  soldermask_margin: external_exports2.number().optional()
380718
381389
  });
@@ -380727,8 +381398,8 @@ var pcb_hole_pill = external_exports2.object({
380727
381398
  hole_shape: external_exports2.literal("pill"),
380728
381399
  hole_width: external_exports2.number(),
380729
381400
  hole_height: external_exports2.number(),
380730
- x: distance51,
380731
- y: distance51,
381401
+ x: distance54,
381402
+ y: distance54,
380732
381403
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380733
381404
  soldermask_margin: external_exports2.number().optional()
380734
381405
  });
@@ -380743,8 +381414,8 @@ var pcb_hole_rotated_pill = external_exports2.object({
380743
381414
  hole_shape: external_exports2.literal("rotated_pill"),
380744
381415
  hole_width: external_exports2.number(),
380745
381416
  hole_height: external_exports2.number(),
380746
- x: distance51,
380747
- y: distance51,
381417
+ x: distance54,
381418
+ y: distance54,
380748
381419
  ccw_rotation: rotation11,
380749
381420
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380750
381421
  soldermask_margin: external_exports2.number().optional()
@@ -380760,8 +381431,8 @@ var pcb_plated_hole_circle = external_exports2.object({
380760
381431
  outer_diameter: external_exports2.number(),
380761
381432
  hole_diameter: external_exports2.number(),
380762
381433
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380763
- x: distance51,
380764
- y: distance51,
381434
+ x: distance54,
381435
+ y: distance54,
380765
381436
  layers: external_exports2.array(layer_ref2),
380766
381437
  port_hints: external_exports2.array(external_exports2.string()).optional(),
380767
381438
  pcb_component_id: external_exports2.string().optional(),
@@ -380779,8 +381450,8 @@ var pcb_plated_hole_oval = external_exports2.object({
380779
381450
  hole_width: external_exports2.number(),
380780
381451
  hole_height: external_exports2.number(),
380781
381452
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380782
- x: distance51,
380783
- y: distance51,
381453
+ x: distance54,
381454
+ y: distance54,
380784
381455
  ccw_rotation: rotation11,
380785
381456
  layers: external_exports2.array(layer_ref2),
380786
381457
  port_hints: external_exports2.array(external_exports2.string()).optional(),
@@ -380800,11 +381471,11 @@ var pcb_circular_hole_with_rect_pad = external_exports2.object({
380800
381471
  rect_pad_width: external_exports2.number(),
380801
381472
  rect_pad_height: external_exports2.number(),
380802
381473
  rect_border_radius: external_exports2.number().optional(),
380803
- hole_offset_x: distance51.default(0),
380804
- hole_offset_y: distance51.default(0),
381474
+ hole_offset_x: distance54.default(0),
381475
+ hole_offset_y: distance54.default(0),
380805
381476
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380806
- x: distance51,
380807
- y: distance51,
381477
+ x: distance54,
381478
+ y: distance54,
380808
381479
  layers: external_exports2.array(layer_ref2),
380809
381480
  port_hints: external_exports2.array(external_exports2.string()).optional(),
380810
381481
  pcb_component_id: external_exports2.string().optional(),
@@ -380825,11 +381496,11 @@ var pcb_pill_hole_with_rect_pad = external_exports2.object({
380825
381496
  rect_pad_width: external_exports2.number(),
380826
381497
  rect_pad_height: external_exports2.number(),
380827
381498
  rect_border_radius: external_exports2.number().optional(),
380828
- hole_offset_x: distance51.default(0),
380829
- hole_offset_y: distance51.default(0),
381499
+ hole_offset_x: distance54.default(0),
381500
+ hole_offset_y: distance54.default(0),
380830
381501
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380831
- x: distance51,
380832
- y: distance51,
381502
+ x: distance54,
381503
+ y: distance54,
380833
381504
  layers: external_exports2.array(layer_ref2),
380834
381505
  port_hints: external_exports2.array(external_exports2.string()).optional(),
380835
381506
  pcb_component_id: external_exports2.string().optional(),
@@ -380851,11 +381522,11 @@ var pcb_rotated_pill_hole_with_rect_pad = external_exports2.object({
380851
381522
  rect_pad_height: external_exports2.number(),
380852
381523
  rect_border_radius: external_exports2.number().optional(),
380853
381524
  rect_ccw_rotation: rotation11,
380854
- hole_offset_x: distance51.default(0),
380855
- hole_offset_y: distance51.default(0),
381525
+ hole_offset_x: distance54.default(0),
381526
+ hole_offset_y: distance54.default(0),
380856
381527
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380857
- x: distance51,
380858
- y: distance51,
381528
+ x: distance54,
381529
+ y: distance54,
380859
381530
  layers: external_exports2.array(layer_ref2),
380860
381531
  port_hints: external_exports2.array(external_exports2.string()).optional(),
380861
381532
  pcb_component_id: external_exports2.string().optional(),
@@ -380873,14 +381544,14 @@ var pcb_hole_with_polygon_pad = external_exports2.object({
380873
381544
  hole_width: external_exports2.number().optional(),
380874
381545
  hole_height: external_exports2.number().optional(),
380875
381546
  pad_outline: external_exports2.array(external_exports2.object({
380876
- x: distance51,
380877
- y: distance51
381547
+ x: distance54,
381548
+ y: distance54
380878
381549
  })).min(3),
380879
- hole_offset_x: distance51.default(0),
380880
- hole_offset_y: distance51.default(0),
381550
+ hole_offset_x: distance54.default(0),
381551
+ hole_offset_y: distance54.default(0),
380881
381552
  is_covered_with_solder_mask: external_exports2.boolean().optional(),
380882
- x: distance51,
380883
- y: distance51,
381553
+ x: distance54,
381554
+ y: distance54,
380884
381555
  layers: external_exports2.array(layer_ref2),
380885
381556
  port_hints: external_exports2.array(external_exports2.string()).optional(),
380886
381557
  pcb_component_id: external_exports2.string().optional(),
@@ -380910,8 +381581,8 @@ var pcb_port = external_exports2.object({
380910
381581
  subcircuit_id: external_exports2.string().optional(),
380911
381582
  source_port_id: external_exports2.string(),
380912
381583
  pcb_component_id: external_exports2.string().optional(),
380913
- x: distance51,
380914
- y: distance51,
381584
+ x: distance54,
381585
+ y: distance54,
380915
381586
  layers: external_exports2.array(layer_ref2),
380916
381587
  is_board_pinout: external_exports2.boolean().optional()
380917
381588
  }).describe("Defines a port on the PCB");
@@ -380922,8 +381593,8 @@ var pcb_smtpad_circle = external_exports2.object({
380922
381593
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
380923
381594
  pcb_group_id: external_exports2.string().optional(),
380924
381595
  subcircuit_id: external_exports2.string().optional(),
380925
- x: distance51,
380926
- y: distance51,
381596
+ x: distance54,
381597
+ y: distance54,
380927
381598
  radius: external_exports2.number(),
380928
381599
  layer: layer_ref2,
380929
381600
  port_hints: external_exports2.array(external_exports2.string()).optional(),
@@ -380939,8 +381610,8 @@ var pcb_smtpad_rect = external_exports2.object({
380939
381610
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
380940
381611
  pcb_group_id: external_exports2.string().optional(),
380941
381612
  subcircuit_id: external_exports2.string().optional(),
380942
- x: distance51,
380943
- y: distance51,
381613
+ x: distance54,
381614
+ y: distance54,
380944
381615
  width: external_exports2.number(),
380945
381616
  height: external_exports2.number(),
380946
381617
  rect_border_radius: external_exports2.number().optional(),
@@ -380963,8 +381634,8 @@ var pcb_smtpad_rotated_rect = external_exports2.object({
380963
381634
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
380964
381635
  pcb_group_id: external_exports2.string().optional(),
380965
381636
  subcircuit_id: external_exports2.string().optional(),
380966
- x: distance51,
380967
- y: distance51,
381637
+ x: distance54,
381638
+ y: distance54,
380968
381639
  width: external_exports2.number(),
380969
381640
  height: external_exports2.number(),
380970
381641
  rect_border_radius: external_exports2.number().optional(),
@@ -380988,8 +381659,8 @@ var pcb_smtpad_pill = external_exports2.object({
380988
381659
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
380989
381660
  pcb_group_id: external_exports2.string().optional(),
380990
381661
  subcircuit_id: external_exports2.string().optional(),
380991
- x: distance51,
380992
- y: distance51,
381662
+ x: distance54,
381663
+ y: distance54,
380993
381664
  width: external_exports2.number(),
380994
381665
  height: external_exports2.number(),
380995
381666
  radius: external_exports2.number(),
@@ -381007,8 +381678,8 @@ var pcb_smtpad_rotated_pill = external_exports2.object({
381007
381678
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
381008
381679
  pcb_group_id: external_exports2.string().optional(),
381009
381680
  subcircuit_id: external_exports2.string().optional(),
381010
- x: distance51,
381011
- y: distance51,
381681
+ x: distance54,
381682
+ y: distance54,
381012
381683
  width: external_exports2.number(),
381013
381684
  height: external_exports2.number(),
381014
381685
  radius: external_exports2.number(),
@@ -381056,8 +381727,8 @@ var pcb_solder_paste_circle = external_exports2.object({
381056
381727
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
381057
381728
  pcb_group_id: external_exports2.string().optional(),
381058
381729
  subcircuit_id: external_exports2.string().optional(),
381059
- x: distance51,
381060
- y: distance51,
381730
+ x: distance54,
381731
+ y: distance54,
381061
381732
  radius: external_exports2.number(),
381062
381733
  layer: layer_ref2,
381063
381734
  pcb_component_id: external_exports2.string().optional(),
@@ -381069,8 +381740,8 @@ var pcb_solder_paste_rect = external_exports2.object({
381069
381740
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
381070
381741
  pcb_group_id: external_exports2.string().optional(),
381071
381742
  subcircuit_id: external_exports2.string().optional(),
381072
- x: distance51,
381073
- y: distance51,
381743
+ x: distance54,
381744
+ y: distance54,
381074
381745
  width: external_exports2.number(),
381075
381746
  height: external_exports2.number(),
381076
381747
  layer: layer_ref2,
@@ -381083,8 +381754,8 @@ var pcb_solder_paste_pill = external_exports2.object({
381083
381754
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
381084
381755
  pcb_group_id: external_exports2.string().optional(),
381085
381756
  subcircuit_id: external_exports2.string().optional(),
381086
- x: distance51,
381087
- y: distance51,
381757
+ x: distance54,
381758
+ y: distance54,
381088
381759
  width: external_exports2.number(),
381089
381760
  height: external_exports2.number(),
381090
381761
  radius: external_exports2.number(),
@@ -381098,11 +381769,11 @@ var pcb_solder_paste_rotated_rect = external_exports2.object({
381098
381769
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
381099
381770
  pcb_group_id: external_exports2.string().optional(),
381100
381771
  subcircuit_id: external_exports2.string().optional(),
381101
- x: distance51,
381102
- y: distance51,
381772
+ x: distance54,
381773
+ y: distance54,
381103
381774
  width: external_exports2.number(),
381104
381775
  height: external_exports2.number(),
381105
- ccw_rotation: distance51,
381776
+ ccw_rotation: distance54,
381106
381777
  layer: layer_ref2,
381107
381778
  pcb_component_id: external_exports2.string().optional(),
381108
381779
  pcb_smtpad_id: external_exports2.string().optional()
@@ -381113,8 +381784,8 @@ var pcb_solder_paste_rotated_pill = external_exports2.object({
381113
381784
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
381114
381785
  pcb_group_id: external_exports2.string().optional(),
381115
381786
  subcircuit_id: external_exports2.string().optional(),
381116
- x: distance51,
381117
- y: distance51,
381787
+ x: distance54,
381788
+ y: distance54,
381118
381789
  width: external_exports2.number(),
381119
381790
  height: external_exports2.number(),
381120
381791
  radius: external_exports2.number(),
@@ -381129,8 +381800,8 @@ var pcb_solder_paste_oval = external_exports2.object({
381129
381800
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
381130
381801
  pcb_group_id: external_exports2.string().optional(),
381131
381802
  subcircuit_id: external_exports2.string().optional(),
381132
- x: distance51,
381133
- y: distance51,
381803
+ x: distance54,
381804
+ y: distance54,
381134
381805
  width: external_exports2.number(),
381135
381806
  height: external_exports2.number(),
381136
381807
  layer: layer_ref2,
@@ -381180,12 +381851,12 @@ var pcb_text = external_exports2.object({
381180
381851
  align: external_exports2.enum(["bottom-left"])
381181
381852
  }).describe("Defines text on the PCB");
381182
381853
  expectTypesMatch2(true);
381183
- var positive_width = distance51.pipe(external_exports2.number().finite().positive());
381854
+ var positive_width = distance54.pipe(external_exports2.number().finite().positive());
381184
381855
  var pcb_trace_route_point_wire = external_exports2.object({
381185
381856
  route_type: external_exports2.literal("wire"),
381186
- x: distance51,
381187
- y: distance51,
381188
- width: distance51,
381857
+ x: distance54,
381858
+ y: distance54,
381859
+ width: distance54,
381189
381860
  start_width: positive_width.optional(),
381190
381861
  end_width: positive_width.optional(),
381191
381862
  width_interpolation_mode: external_exports2.enum(["linear", "quadratic"]).optional(),
@@ -381224,12 +381895,12 @@ var pcb_trace_route_point_wire = external_exports2.object({
381224
381895
  });
381225
381896
  var pcb_trace_route_point_via = external_exports2.object({
381226
381897
  route_type: external_exports2.literal("via"),
381227
- x: distance51,
381228
- y: distance51,
381898
+ x: distance54,
381899
+ y: distance54,
381229
381900
  copper_pour_id: external_exports2.string().optional(),
381230
381901
  is_inside_copper_pour: external_exports2.boolean().optional(),
381231
- hole_diameter: distance51.optional(),
381232
- outer_diameter: distance51.optional(),
381902
+ hole_diameter: distance54.optional(),
381903
+ outer_diameter: distance54.optional(),
381233
381904
  tented_on_top: external_exports2.boolean().optional(),
381234
381905
  tented_on_bottom: external_exports2.boolean().optional(),
381235
381906
  from_layer: layer_ref2,
@@ -381239,7 +381910,7 @@ var pcb_trace_route_point_through_pad = external_exports2.object({
381239
381910
  route_type: external_exports2.literal("through_pad"),
381240
381911
  start: point9,
381241
381912
  end: point9,
381242
- width: distance51,
381913
+ width: distance54,
381243
381914
  start_layer: layer_ref2,
381244
381915
  end_layer: layer_ref2,
381245
381916
  pcb_smtpad_id: external_exports2.string().optional(),
@@ -381304,8 +381975,8 @@ var pcb_trace_too_long_error = external_exports2.object({
381304
381975
  pcb_trace_id: external_exports2.string(),
381305
381976
  source_net_id: external_exports2.string().optional(),
381306
381977
  source_trace_id: external_exports2.string().optional(),
381307
- actual_trace_length: distance51,
381308
- maximum_trace_length: distance51,
381978
+ actual_trace_length: distance54,
381979
+ maximum_trace_length: distance54,
381309
381980
  subcircuit_id: external_exports2.string().optional()
381310
381981
  }).describe("Error emitted when a PCB trace is longer than its maximum allowed length");
381311
381982
  expectTypesMatch2(true);
@@ -381329,8 +382000,8 @@ var pcb_trace_too_long_warning = external_exports2.object({
381329
382000
  pcb_trace_id: external_exports2.string(),
381330
382001
  source_net_id: external_exports2.string().optional(),
381331
382002
  source_trace_id: external_exports2.string().optional(),
381332
- actual_trace_length: distance51,
381333
- maximum_trace_length: distance51,
382003
+ actual_trace_length: distance54,
382004
+ maximum_trace_length: distance54,
381334
382005
  subcircuit_id: external_exports2.string().optional()
381335
382006
  }).describe("Warning emitted when a PCB trace is longer than its maximum allowed length");
381336
382007
  expectTypesMatch2(true);
@@ -381400,10 +382071,10 @@ var pcb_via = external_exports2.object({
381400
382071
  pcb_group_id: external_exports2.string().optional(),
381401
382072
  subcircuit_id: external_exports2.string().optional(),
381402
382073
  subcircuit_connectivity_map_key: external_exports2.string().optional(),
381403
- x: distance51,
381404
- y: distance51,
381405
- outer_diameter: distance51.default("0.6mm"),
381406
- hole_diameter: distance51.default("0.25mm"),
382074
+ x: distance54,
382075
+ y: distance54,
382076
+ outer_diameter: distance54.default("0.6mm"),
382077
+ hole_diameter: distance54.default("0.25mm"),
381407
382078
  topmost_drill_layer: layer_ref2.optional(),
381408
382079
  bottommost_drill_layer: layer_ref2.optional(),
381409
382080
  through_hole: external_exports2.boolean().optional(),
@@ -381570,11 +382241,11 @@ var pcb_silkscreen_line = external_exports2.object({
381570
382241
  pcb_component_id: external_exports2.string(),
381571
382242
  pcb_group_id: external_exports2.string().optional(),
381572
382243
  subcircuit_id: external_exports2.string().optional(),
381573
- stroke_width: distance51.default("0.1mm"),
381574
- x1: distance51,
381575
- y1: distance51,
381576
- x2: distance51,
381577
- y2: distance51,
382244
+ stroke_width: distance54.default("0.1mm"),
382245
+ x1: distance54,
382246
+ y1: distance54,
382247
+ x2: distance54,
382248
+ y2: distance54,
381578
382249
  layer: visible_layer
381579
382250
  }).describe("Defines a silkscreen line on the PCB");
381580
382251
  expectTypesMatch2(true);
@@ -381595,7 +382266,7 @@ var pcb_silkscreen_text = external_exports2.object({
381595
382266
  pcb_group_id: external_exports2.string().optional(),
381596
382267
  subcircuit_id: external_exports2.string().optional(),
381597
382268
  font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
381598
- font_size: distance51.default("0.2mm"),
382269
+ font_size: distance54.default("0.2mm"),
381599
382270
  pcb_component_id: external_exports2.string(),
381600
382271
  text: external_exports2.string(),
381601
382272
  is_knockout: external_exports2.boolean().default(false).optional(),
@@ -381623,7 +382294,7 @@ var pcb_copper_text = external_exports2.object({
381623
382294
  pcb_group_id: external_exports2.string().optional(),
381624
382295
  subcircuit_id: external_exports2.string().optional(),
381625
382296
  font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
381626
- font_size: distance51.default("0.2mm"),
382297
+ font_size: distance54.default("0.2mm"),
381627
382298
  pcb_component_id: external_exports2.string(),
381628
382299
  text: external_exports2.string(),
381629
382300
  is_knockout: external_exports2.boolean().default(false).optional(),
@@ -381683,8 +382354,8 @@ var pcb_silkscreen_oval = external_exports2.object({
381683
382354
  pcb_group_id: external_exports2.string().optional(),
381684
382355
  subcircuit_id: external_exports2.string().optional(),
381685
382356
  center: point9,
381686
- radius_x: distance51,
381687
- radius_y: distance51,
382357
+ radius_x: distance54,
382358
+ radius_y: distance54,
381688
382359
  layer: visible_layer,
381689
382360
  ccw_rotation: rotation11.optional()
381690
382361
  }).describe("Defines a silkscreen oval on the PCB");
@@ -381724,7 +382395,7 @@ var pcb_fabrication_note_text2 = external_exports2.object({
381724
382395
  subcircuit_id: external_exports2.string().optional(),
381725
382396
  pcb_group_id: external_exports2.string().optional(),
381726
382397
  font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
381727
- font_size: distance51.default("1mm"),
382398
+ font_size: distance54.default("1mm"),
381728
382399
  pcb_component_id: external_exports2.string(),
381729
382400
  text: external_exports2.string(),
381730
382401
  ccw_rotation: external_exports2.number().optional(),
@@ -381794,7 +382465,7 @@ var pcb_note_text2 = external_exports2.object({
381794
382465
  subcircuit_id: external_exports2.string().optional(),
381795
382466
  name: external_exports2.string().optional(),
381796
382467
  font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
381797
- font_size: distance51.default("1mm"),
382468
+ font_size: distance54.default("1mm"),
381798
382469
  text: external_exports2.string().optional(),
381799
382470
  anchor_position: point9.default({ x: 0, y: 0 }),
381800
382471
  anchor_alignment: external_exports2.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
@@ -381845,12 +382516,12 @@ var pcb_note_line2 = external_exports2.object({
381845
382516
  subcircuit_id: external_exports2.string().optional(),
381846
382517
  name: external_exports2.string().optional(),
381847
382518
  text: external_exports2.string().optional(),
381848
- x1: distance51,
381849
- y1: distance51,
381850
- x2: distance51,
381851
- y2: distance51,
382519
+ x1: distance54,
382520
+ y1: distance54,
382521
+ x2: distance54,
382522
+ y2: distance54,
381852
382523
  layer: visible_layer.default("top"),
381853
- stroke_width: distance51.default("0.1mm"),
382524
+ stroke_width: distance54.default("0.1mm"),
381854
382525
  color: external_exports2.string().optional(),
381855
382526
  is_dashed: external_exports2.boolean().optional()
381856
382527
  }).describe("Defines a straight documentation note line on the PCB");
@@ -381916,8 +382587,8 @@ var pcb_keepout2 = external_exports2.object({
381916
382587
  pcb_group_id: external_exports2.string().optional(),
381917
382588
  subcircuit_id: external_exports2.string().optional(),
381918
382589
  center: point9,
381919
- width: distance51,
381920
- height: distance51,
382590
+ width: distance54,
382591
+ height: distance54,
381921
382592
  pcb_keepout_id: external_exports2.string(),
381922
382593
  layers: external_exports2.array(external_exports2.string()),
381923
382594
  description: external_exports2.string().optional(),
@@ -381931,7 +382602,7 @@ var pcb_keepout2 = external_exports2.object({
381931
382602
  pcb_group_id: external_exports2.string().optional(),
381932
382603
  subcircuit_id: external_exports2.string().optional(),
381933
382604
  center: point9,
381934
- radius: distance51,
382605
+ radius: distance54,
381935
382606
  pcb_keepout_id: external_exports2.string(),
381936
382607
  layers: external_exports2.array(external_exports2.string()),
381937
382608
  description: external_exports2.string().optional(),
@@ -382154,8 +382825,8 @@ var pcb_breakout_point = external_exports2.object({
382154
382825
  source_port_id: external_exports2.string().optional(),
382155
382826
  source_net_id: external_exports2.string().optional(),
382156
382827
  layer: layer_ref2.optional(),
382157
- x: distance51,
382158
- y: distance51
382828
+ x: distance54,
382829
+ y: distance54
382159
382830
  }).describe("Defines a routing target within a pcb_group for a source_trace or source_net");
382160
382831
  expectTypesMatch2(true);
382161
382832
  var pcb_ground_plane = external_exports2.object({
@@ -382183,9 +382854,9 @@ var pcb_thermal_spoke = external_exports2.object({
382183
382854
  pcb_ground_plane_id: external_exports2.string(),
382184
382855
  shape: external_exports2.string(),
382185
382856
  spoke_count: external_exports2.number(),
382186
- spoke_thickness: distance51,
382187
- spoke_inner_diameter: distance51,
382188
- spoke_outer_diameter: distance51,
382857
+ spoke_thickness: distance54,
382858
+ spoke_inner_diameter: distance54,
382859
+ spoke_outer_diameter: distance54,
382189
382860
  pcb_plated_hole_id: external_exports2.string().optional(),
382190
382861
  subcircuit_id: external_exports2.string().optional()
382191
382862
  }).describe("Pattern for connecting a ground plane to a plated hole");
@@ -382267,8 +382938,8 @@ var pcb_via_clearance_error = base_circuit_json_error.extend({
382267
382938
  pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
382268
382939
  error_type: external_exports2.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
382269
382940
  pcb_via_ids: external_exports2.array(external_exports2.string()).min(2),
382270
- minimum_clearance: distance51.optional(),
382271
- actual_clearance: distance51.optional(),
382941
+ minimum_clearance: distance54.optional(),
382942
+ actual_clearance: distance54.optional(),
382272
382943
  pcb_center: external_exports2.object({
382273
382944
  x: external_exports2.number().optional(),
382274
382945
  y: external_exports2.number().optional()
@@ -382282,8 +382953,8 @@ var pcb_via_trace_clearance_error = base_circuit_json_error.extend({
382282
382953
  error_type: external_exports2.literal("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),
382283
382954
  pcb_via_id: external_exports2.string(),
382284
382955
  pcb_trace_id: external_exports2.string(),
382285
- minimum_clearance: distance51.optional(),
382286
- actual_clearance: distance51.optional(),
382956
+ minimum_clearance: distance54.optional(),
382957
+ actual_clearance: distance54.optional(),
382287
382958
  center: external_exports2.object({
382288
382959
  x: external_exports2.number().optional(),
382289
382960
  y: external_exports2.number().optional()
@@ -382296,8 +382967,8 @@ var pcb_pad_pad_clearance_error = base_circuit_json_error.extend({
382296
382967
  pcb_pad_pad_clearance_error_id: getZodPrefixedIdWithDefault("pcb_pad_pad_clearance_error"),
382297
382968
  error_type: external_exports2.literal("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),
382298
382969
  pcb_pad_ids: external_exports2.array(external_exports2.string()).min(2),
382299
- minimum_clearance: distance51.optional(),
382300
- actual_clearance: distance51.optional(),
382970
+ minimum_clearance: distance54.optional(),
382971
+ actual_clearance: distance54.optional(),
382301
382972
  center: external_exports2.object({
382302
382973
  x: external_exports2.number().optional(),
382303
382974
  y: external_exports2.number().optional()
@@ -382311,8 +382982,8 @@ var pcb_pad_trace_clearance_error = base_circuit_json_error.extend({
382311
382982
  error_type: external_exports2.literal("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),
382312
382983
  pcb_pad_id: external_exports2.string(),
382313
382984
  pcb_trace_id: external_exports2.string(),
382314
- minimum_clearance: distance51.optional(),
382315
- actual_clearance: distance51.optional(),
382985
+ minimum_clearance: distance54.optional(),
382986
+ actual_clearance: distance54.optional(),
382316
382987
  center: external_exports2.object({
382317
382988
  x: external_exports2.number().optional(),
382318
382989
  y: external_exports2.number().optional()
@@ -394126,7 +394797,7 @@ __export6(dist_exports2, {
394126
394797
  circle_shape: () => circle_shape2,
394127
394798
  circuit_json_footprint_load_error: () => circuit_json_footprint_load_error3,
394128
394799
  current: () => current3,
394129
- distance: () => distance54,
394800
+ distance: () => distance55,
394130
394801
  duration_ms: () => duration_ms2,
394131
394802
  experiment_type: () => experiment_type2,
394132
394803
  external_footprint_load_error: () => external_footprint_load_error3,
@@ -394693,7 +395364,7 @@ var inductance3 = z56.string().or(z56.number()).transform((v) => parseAndConvert
394693
395364
  var voltage6 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v, "V").value);
394694
395365
  var length68 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v).value);
394695
395366
  var frequency8 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v, "Hz").value);
394696
- var distance54 = length68;
395367
+ var distance55 = length68;
394697
395368
  var current3 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v, "A").value);
394698
395369
  var duration_ms2 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v).value);
394699
395370
  var time2 = duration_ms2;
@@ -394734,16 +395405,16 @@ expectStringUnionsMatch2('T2 has extra: "c"');
394734
395405
  expectStringUnionsMatch2('T1 has extra: "d", T2 has extra: "c"');
394735
395406
  expectStringUnionsMatch2(true);
394736
395407
  var point10 = z211.object({
394737
- x: distance54,
394738
- y: distance54
395408
+ x: distance55,
395409
+ y: distance55
394739
395410
  });
394740
395411
  var position2 = point10;
394741
395412
  expectTypesMatch3(true);
394742
395413
  expectTypesMatch3(true);
394743
395414
  var point34 = z311.object({
394744
- x: distance54,
394745
- y: distance54,
394746
- z: distance54
395415
+ x: distance55,
395416
+ y: distance55,
395417
+ z: distance55
394747
395418
  });
394748
395419
  var position32 = point34;
394749
395420
  expectTypesMatch3(true);
@@ -394752,8 +395423,8 @@ var size2 = z411.object({
394752
395423
  height: z411.number()
394753
395424
  });
394754
395425
  expectTypesMatch3(true);
394755
- var finite_distance2 = distance54.pipe(z57.number().finite());
394756
- var positive_distance2 = distance54.pipe(z57.number().finite().positive());
395426
+ var finite_distance2 = distance55.pipe(z57.number().finite());
395427
+ var positive_distance2 = distance55.pipe(z57.number().finite().positive());
394757
395428
  var circle_shape2 = z57.object({
394758
395429
  shape: z57.literal("circle"),
394759
395430
  x: finite_distance2,
@@ -394848,7 +395519,7 @@ var kicadAt3 = point10.extend({
394848
395519
  expectTypesMatch3(true);
394849
395520
  var kicadFont3 = z103.object({
394850
395521
  size: point10.optional(),
394851
- thickness: distance54.optional()
395522
+ thickness: distance55.optional()
394852
395523
  });
394853
395524
  expectTypesMatch3(true);
394854
395525
  var kicadEffects3 = z103.object({
@@ -394884,7 +395555,7 @@ var kicadFootprintPad3 = z103.object({
394884
395555
  shape: z103.string().optional(),
394885
395556
  at: kicadAt3.optional(),
394886
395557
  size: point10.optional(),
394887
- drill: distance54.optional(),
395558
+ drill: distance55.optional(),
394888
395559
  layers: z103.array(z103.string()).optional(),
394889
395560
  removeUnusedLayers: z103.boolean().optional(),
394890
395561
  uuid: z103.string().optional()
@@ -394915,7 +395586,7 @@ var kicadSymbolPinNumbers3 = z113.object({
394915
395586
  });
394916
395587
  expectTypesMatch3(true);
394917
395588
  var kicadSymbolPinNames3 = z113.object({
394918
- offset: distance54.optional(),
395589
+ offset: distance55.optional(),
394919
395590
  hide: z113.boolean().optional()
394920
395591
  });
394921
395592
  expectTypesMatch3(true);
@@ -394989,7 +395660,7 @@ var source_simple_capacitor2 = source_component_base2.extend({
394989
395660
  capacitance: capacitance5,
394990
395661
  max_voltage_rating: voltage6.optional(),
394991
395662
  display_capacitance: z153.string().optional(),
394992
- max_decoupling_trace_length: distance54.optional()
395663
+ max_decoupling_trace_length: distance55.optional()
394993
395664
  });
394994
395665
  expectTypesMatch3(true);
394995
395666
  var source_simple_resistor2 = source_component_base2.extend({
@@ -395585,11 +396256,11 @@ var schematic_box2 = z76.object({
395585
396256
  schematic_sheet_id: z76.string().optional(),
395586
396257
  schematic_component_id: z76.string().optional(),
395587
396258
  schematic_symbol_id: z76.string().optional(),
395588
- width: distance54,
395589
- height: distance54,
396259
+ width: distance55,
396260
+ height: distance55,
395590
396261
  is_dashed: z76.boolean().default(false),
395591
- x: distance54,
395592
- y: distance54,
396262
+ x: distance55,
396263
+ y: distance55,
395593
396264
  subcircuit_id: z76.string().optional()
395594
396265
  }).describe("Draws a box on the schematic");
395595
396266
  expectTypesMatch3(true);
@@ -395602,10 +396273,10 @@ var schematic_path2 = z77.object({
395602
396273
  fill_color: z77.string().optional(),
395603
396274
  is_filled: z77.boolean().optional(),
395604
396275
  is_dashed: z77.boolean().default(false),
395605
- stroke_width: distance54.nullable().optional(),
396276
+ stroke_width: distance55.nullable().optional(),
395606
396277
  stroke_color: z77.string().optional(),
395607
- dash_length: distance54.optional(),
395608
- dash_gap: distance54.optional(),
396278
+ dash_length: distance55.optional(),
396279
+ dash_gap: distance55.optional(),
395609
396280
  points: z77.array(point10),
395610
396281
  subcircuit_id: z77.string().optional()
395611
396282
  });
@@ -395684,15 +396355,15 @@ var schematic_line2 = z80.object({
395684
396355
  schematic_sheet_id: z80.string().optional(),
395685
396356
  schematic_component_id: z80.string().optional(),
395686
396357
  schematic_symbol_id: z80.string().optional(),
395687
- x1: distance54,
395688
- y1: distance54,
395689
- x2: distance54,
395690
- y2: distance54,
395691
- stroke_width: distance54.nullable().optional(),
396358
+ x1: distance55,
396359
+ y1: distance55,
396360
+ x2: distance55,
396361
+ y2: distance55,
396362
+ stroke_width: distance55.nullable().optional(),
395692
396363
  color: z80.string().default("#000000"),
395693
396364
  is_dashed: z80.boolean().default(false),
395694
- dash_length: distance54.optional(),
395695
- dash_gap: distance54.optional(),
396365
+ dash_length: distance55.optional(),
396366
+ dash_gap: distance55.optional(),
395696
396367
  subcircuit_id: z80.string().optional()
395697
396368
  }).describe("Draws a styled line on the schematic");
395698
396369
  expectTypesMatch3(true);
@@ -395703,10 +396374,10 @@ var schematic_rect2 = z81.object({
395703
396374
  schematic_component_id: z81.string().optional(),
395704
396375
  schematic_symbol_id: z81.string().optional(),
395705
396376
  center: point10,
395706
- width: distance54,
395707
- height: distance54,
396377
+ width: distance55,
396378
+ height: distance55,
395708
396379
  rotation: rotation12.default(0),
395709
- stroke_width: distance54.nullable().optional(),
396380
+ stroke_width: distance55.nullable().optional(),
395710
396381
  color: z81.string().default("#000000"),
395711
396382
  is_filled: z81.boolean().default(false),
395712
396383
  fill_color: z81.string().optional(),
@@ -395721,8 +396392,8 @@ var schematic_circle2 = z822.object({
395721
396392
  schematic_component_id: z822.string().optional(),
395722
396393
  schematic_symbol_id: z822.string().optional(),
395723
396394
  center: point10,
395724
- radius: distance54,
395725
- stroke_width: distance54.nullable().optional(),
396395
+ radius: distance55,
396396
+ stroke_width: distance55.nullable().optional(),
395726
396397
  color: z822.string().default("#000000"),
395727
396398
  is_filled: z822.boolean().default(false),
395728
396399
  fill_color: z822.string().optional(),
@@ -395737,11 +396408,11 @@ var schematic_arc2 = z832.object({
395737
396408
  schematic_component_id: z832.string().optional(),
395738
396409
  schematic_symbol_id: z832.string().optional(),
395739
396410
  center: point10,
395740
- radius: distance54,
396411
+ radius: distance55,
395741
396412
  start_angle_degrees: rotation12,
395742
396413
  end_angle_degrees: rotation12,
395743
396414
  direction: z832.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
395744
- stroke_width: distance54.nullable().optional(),
396415
+ stroke_width: distance55.nullable().optional(),
395745
396416
  color: z832.string().default("#000000"),
395746
396417
  is_dashed: z832.boolean().default(false),
395747
396418
  subcircuit_id: z832.string().optional()
@@ -395797,8 +396468,8 @@ var schematic_text2 = z87.object({
395797
396468
  display_superscript: z87.string().optional(),
395798
396469
  font_size: z87.number().default(0.18),
395799
396470
  position: z87.object({
395800
- x: distance54,
395801
- y: distance54
396471
+ x: distance55,
396472
+ y: distance55
395802
396473
  }),
395803
396474
  rotation: z87.number().default(0),
395804
396475
  anchor: z87.union([fivePointAnchor3.describe("legacy"), ninePointAnchor3]).default("center"),
@@ -395949,7 +396620,7 @@ var schematic_element_outside_sheet_warning2 = z97.object({
395949
396620
  schematic_element_id: z97.string()
395950
396621
  }).describe("Warning emitted when a schematic component, net label, or trace extends outside its schematic sheet");
395951
396622
  expectTypesMatch3(true);
395952
- var positiveFiniteDistance2 = distance54.pipe(z98.number().positive().finite());
396623
+ var positiveFiniteDistance2 = distance55.pipe(z98.number().positive().finite());
395953
396624
  var schematic_graphic2 = z98.object({
395954
396625
  type: z98.literal("schematic_graphic"),
395955
396626
  schematic_graphic_id: getZodPrefixedIdWithDefault2("schematic_graphic"),
@@ -395988,10 +396659,10 @@ var schematic_table2 = z100.object({
395988
396659
  schematic_table_id: getZodPrefixedIdWithDefault2("schematic_table"),
395989
396660
  schematic_sheet_id: z100.string().optional(),
395990
396661
  anchor_position: point10,
395991
- column_widths: z100.array(distance54),
395992
- row_heights: z100.array(distance54),
395993
- cell_padding: distance54.optional(),
395994
- border_width: distance54.optional(),
396662
+ column_widths: z100.array(distance55),
396663
+ row_heights: z100.array(distance55),
396664
+ cell_padding: distance55.optional(),
396665
+ border_width: distance55.optional(),
395995
396666
  subcircuit_id: z100.string().optional(),
395996
396667
  schematic_component_id: z100.string().optional(),
395997
396668
  anchor: ninePointAnchor3.optional()
@@ -396008,11 +396679,11 @@ var schematic_table_cell2 = z101.object({
396008
396679
  end_column_index: z101.number(),
396009
396680
  text: z101.string().optional(),
396010
396681
  center: point10,
396011
- width: distance54,
396012
- height: distance54,
396682
+ width: distance55,
396683
+ height: distance55,
396013
396684
  horizontal_align: z101.enum(["left", "center", "right"]).optional(),
396014
396685
  vertical_align: z101.enum(["top", "middle", "bottom"]).optional(),
396015
- font_size: distance54.optional(),
396686
+ font_size: distance55.optional(),
396016
396687
  subcircuit_id: z101.string().optional()
396017
396688
  }).describe("Defines a cell within a schematic_table");
396018
396689
  expectTypesMatch3(true);
@@ -396037,8 +396708,8 @@ var schematic_missing_sheet_warning2 = z1032.object({
396037
396708
  }).describe("Circuit-wide warning emitted when a schematic has no schematic sheet. Display as a banner without attaching it to a component or drawing a target outline or leader line.");
396038
396709
  expectTypesMatch3(true);
396039
396710
  var point_with_bulge2 = z104.object({
396040
- x: distance54,
396041
- y: distance54,
396711
+ x: distance55,
396712
+ y: distance55,
396042
396713
  bulge: z104.number().optional()
396043
396714
  });
396044
396715
  expectTypesMatch3(true);
@@ -396129,8 +396800,8 @@ var getRotationBetweenPcbPin1Locations4 = (from, to) => {
396129
396800
  return null;
396130
396801
  };
396131
396802
  var pcb_route_hint2 = z107.object({
396132
- x: distance54,
396133
- y: distance54,
396803
+ x: distance55,
396804
+ y: distance55,
396134
396805
  via: z107.boolean().optional(),
396135
396806
  via_to_layer: layer_ref3.optional()
396136
396807
  });
@@ -396138,11 +396809,11 @@ var pcb_route_hints2 = z107.array(pcb_route_hint2);
396138
396809
  expectTypesMatch3(true);
396139
396810
  expectTypesMatch3(true);
396140
396811
  var route_hint_point9 = z108.object({
396141
- x: distance54,
396142
- y: distance54,
396812
+ x: distance55,
396813
+ y: distance55,
396143
396814
  via: z108.boolean().optional(),
396144
396815
  to_layer: layer_ref3.optional(),
396145
- trace_width: distance54.optional()
396816
+ trace_width: distance55.optional()
396146
396817
  });
396147
396818
  expectTypesMatch3(true);
396148
396819
  var manufacturing_drc_properties2 = z109.object({
@@ -396228,8 +396899,8 @@ var pcb_hole_circle2 = z1122.object({
396228
396899
  pcb_component_id: z1122.string().optional(),
396229
396900
  hole_shape: z1122.literal("circle"),
396230
396901
  hole_diameter: z1122.number(),
396231
- x: distance54,
396232
- y: distance54,
396902
+ x: distance55,
396903
+ y: distance55,
396233
396904
  is_covered_with_solder_mask: z1122.boolean().optional(),
396234
396905
  soldermask_margin: z1122.number().optional()
396235
396906
  });
@@ -396244,8 +396915,8 @@ var pcb_hole_rect2 = z1122.object({
396244
396915
  hole_shape: z1122.literal("rect"),
396245
396916
  hole_width: z1122.number(),
396246
396917
  hole_height: z1122.number(),
396247
- x: distance54,
396248
- y: distance54,
396918
+ x: distance55,
396919
+ y: distance55,
396249
396920
  is_covered_with_solder_mask: z1122.boolean().optional(),
396250
396921
  soldermask_margin: z1122.number().optional()
396251
396922
  });
@@ -396259,8 +396930,8 @@ var pcb_hole_circle_or_square2 = z1122.object({
396259
396930
  pcb_component_id: z1122.string().optional(),
396260
396931
  hole_shape: z1122.enum(["circle", "square"]),
396261
396932
  hole_diameter: z1122.number(),
396262
- x: distance54,
396263
- y: distance54,
396933
+ x: distance55,
396934
+ y: distance55,
396264
396935
  is_covered_with_solder_mask: z1122.boolean().optional(),
396265
396936
  soldermask_margin: z1122.number().optional()
396266
396937
  });
@@ -396275,8 +396946,8 @@ var pcb_hole_oval2 = z1122.object({
396275
396946
  hole_shape: z1122.literal("oval"),
396276
396947
  hole_width: z1122.number(),
396277
396948
  hole_height: z1122.number(),
396278
- x: distance54,
396279
- y: distance54,
396949
+ x: distance55,
396950
+ y: distance55,
396280
396951
  is_covered_with_solder_mask: z1122.boolean().optional(),
396281
396952
  soldermask_margin: z1122.number().optional()
396282
396953
  });
@@ -396291,8 +396962,8 @@ var pcb_hole_pill2 = z1122.object({
396291
396962
  hole_shape: z1122.literal("pill"),
396292
396963
  hole_width: z1122.number(),
396293
396964
  hole_height: z1122.number(),
396294
- x: distance54,
396295
- y: distance54,
396965
+ x: distance55,
396966
+ y: distance55,
396296
396967
  is_covered_with_solder_mask: z1122.boolean().optional(),
396297
396968
  soldermask_margin: z1122.number().optional()
396298
396969
  });
@@ -396307,8 +396978,8 @@ var pcb_hole_rotated_pill2 = z1122.object({
396307
396978
  hole_shape: z1122.literal("rotated_pill"),
396308
396979
  hole_width: z1122.number(),
396309
396980
  hole_height: z1122.number(),
396310
- x: distance54,
396311
- y: distance54,
396981
+ x: distance55,
396982
+ y: distance55,
396312
396983
  ccw_rotation: rotation12,
396313
396984
  is_covered_with_solder_mask: z1122.boolean().optional(),
396314
396985
  soldermask_margin: z1122.number().optional()
@@ -396324,8 +396995,8 @@ var pcb_plated_hole_circle2 = z1132.object({
396324
396995
  outer_diameter: z1132.number(),
396325
396996
  hole_diameter: z1132.number(),
396326
396997
  is_covered_with_solder_mask: z1132.boolean().optional(),
396327
- x: distance54,
396328
- y: distance54,
396998
+ x: distance55,
396999
+ y: distance55,
396329
397000
  layers: z1132.array(layer_ref3),
396330
397001
  port_hints: z1132.array(z1132.string()).optional(),
396331
397002
  pcb_component_id: z1132.string().optional(),
@@ -396343,8 +397014,8 @@ var pcb_plated_hole_oval2 = z1132.object({
396343
397014
  hole_width: z1132.number(),
396344
397015
  hole_height: z1132.number(),
396345
397016
  is_covered_with_solder_mask: z1132.boolean().optional(),
396346
- x: distance54,
396347
- y: distance54,
397017
+ x: distance55,
397018
+ y: distance55,
396348
397019
  ccw_rotation: rotation12,
396349
397020
  layers: z1132.array(layer_ref3),
396350
397021
  port_hints: z1132.array(z1132.string()).optional(),
@@ -396364,11 +397035,11 @@ var pcb_circular_hole_with_rect_pad2 = z1132.object({
396364
397035
  rect_pad_width: z1132.number(),
396365
397036
  rect_pad_height: z1132.number(),
396366
397037
  rect_border_radius: z1132.number().optional(),
396367
- hole_offset_x: distance54.default(0),
396368
- hole_offset_y: distance54.default(0),
397038
+ hole_offset_x: distance55.default(0),
397039
+ hole_offset_y: distance55.default(0),
396369
397040
  is_covered_with_solder_mask: z1132.boolean().optional(),
396370
- x: distance54,
396371
- y: distance54,
397041
+ x: distance55,
397042
+ y: distance55,
396372
397043
  layers: z1132.array(layer_ref3),
396373
397044
  port_hints: z1132.array(z1132.string()).optional(),
396374
397045
  pcb_component_id: z1132.string().optional(),
@@ -396389,11 +397060,11 @@ var pcb_pill_hole_with_rect_pad2 = z1132.object({
396389
397060
  rect_pad_width: z1132.number(),
396390
397061
  rect_pad_height: z1132.number(),
396391
397062
  rect_border_radius: z1132.number().optional(),
396392
- hole_offset_x: distance54.default(0),
396393
- hole_offset_y: distance54.default(0),
397063
+ hole_offset_x: distance55.default(0),
397064
+ hole_offset_y: distance55.default(0),
396394
397065
  is_covered_with_solder_mask: z1132.boolean().optional(),
396395
- x: distance54,
396396
- y: distance54,
397066
+ x: distance55,
397067
+ y: distance55,
396397
397068
  layers: z1132.array(layer_ref3),
396398
397069
  port_hints: z1132.array(z1132.string()).optional(),
396399
397070
  pcb_component_id: z1132.string().optional(),
@@ -396415,11 +397086,11 @@ var pcb_rotated_pill_hole_with_rect_pad2 = z1132.object({
396415
397086
  rect_pad_height: z1132.number(),
396416
397087
  rect_border_radius: z1132.number().optional(),
396417
397088
  rect_ccw_rotation: rotation12,
396418
- hole_offset_x: distance54.default(0),
396419
- hole_offset_y: distance54.default(0),
397089
+ hole_offset_x: distance55.default(0),
397090
+ hole_offset_y: distance55.default(0),
396420
397091
  is_covered_with_solder_mask: z1132.boolean().optional(),
396421
- x: distance54,
396422
- y: distance54,
397092
+ x: distance55,
397093
+ y: distance55,
396423
397094
  layers: z1132.array(layer_ref3),
396424
397095
  port_hints: z1132.array(z1132.string()).optional(),
396425
397096
  pcb_component_id: z1132.string().optional(),
@@ -396437,14 +397108,14 @@ var pcb_hole_with_polygon_pad2 = z1132.object({
396437
397108
  hole_width: z1132.number().optional(),
396438
397109
  hole_height: z1132.number().optional(),
396439
397110
  pad_outline: z1132.array(z1132.object({
396440
- x: distance54,
396441
- y: distance54
397111
+ x: distance55,
397112
+ y: distance55
396442
397113
  })).min(3),
396443
- hole_offset_x: distance54.default(0),
396444
- hole_offset_y: distance54.default(0),
397114
+ hole_offset_x: distance55.default(0),
397115
+ hole_offset_y: distance55.default(0),
396445
397116
  is_covered_with_solder_mask: z1132.boolean().optional(),
396446
- x: distance54,
396447
- y: distance54,
397117
+ x: distance55,
397118
+ y: distance55,
396448
397119
  layers: z1132.array(layer_ref3),
396449
397120
  port_hints: z1132.array(z1132.string()).optional(),
396450
397121
  pcb_component_id: z1132.string().optional(),
@@ -396474,8 +397145,8 @@ var pcb_port2 = z114.object({
396474
397145
  subcircuit_id: z114.string().optional(),
396475
397146
  source_port_id: z114.string(),
396476
397147
  pcb_component_id: z114.string().optional(),
396477
- x: distance54,
396478
- y: distance54,
397148
+ x: distance55,
397149
+ y: distance55,
396479
397150
  layers: z114.array(layer_ref3),
396480
397151
  is_board_pinout: z114.boolean().optional()
396481
397152
  }).describe("Defines a port on the PCB");
@@ -396486,8 +397157,8 @@ var pcb_smtpad_circle2 = z115.object({
396486
397157
  pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
396487
397158
  pcb_group_id: z115.string().optional(),
396488
397159
  subcircuit_id: z115.string().optional(),
396489
- x: distance54,
396490
- y: distance54,
397160
+ x: distance55,
397161
+ y: distance55,
396491
397162
  radius: z115.number(),
396492
397163
  layer: layer_ref3,
396493
397164
  port_hints: z115.array(z115.string()).optional(),
@@ -396503,8 +397174,8 @@ var pcb_smtpad_rect2 = z115.object({
396503
397174
  pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
396504
397175
  pcb_group_id: z115.string().optional(),
396505
397176
  subcircuit_id: z115.string().optional(),
396506
- x: distance54,
396507
- y: distance54,
397177
+ x: distance55,
397178
+ y: distance55,
396508
397179
  width: z115.number(),
396509
397180
  height: z115.number(),
396510
397181
  rect_border_radius: z115.number().optional(),
@@ -396527,8 +397198,8 @@ var pcb_smtpad_rotated_rect2 = z115.object({
396527
397198
  pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
396528
397199
  pcb_group_id: z115.string().optional(),
396529
397200
  subcircuit_id: z115.string().optional(),
396530
- x: distance54,
396531
- y: distance54,
397201
+ x: distance55,
397202
+ y: distance55,
396532
397203
  width: z115.number(),
396533
397204
  height: z115.number(),
396534
397205
  rect_border_radius: z115.number().optional(),
@@ -396552,8 +397223,8 @@ var pcb_smtpad_pill2 = z115.object({
396552
397223
  pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
396553
397224
  pcb_group_id: z115.string().optional(),
396554
397225
  subcircuit_id: z115.string().optional(),
396555
- x: distance54,
396556
- y: distance54,
397226
+ x: distance55,
397227
+ y: distance55,
396557
397228
  width: z115.number(),
396558
397229
  height: z115.number(),
396559
397230
  radius: z115.number(),
@@ -396571,8 +397242,8 @@ var pcb_smtpad_rotated_pill2 = z115.object({
396571
397242
  pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
396572
397243
  pcb_group_id: z115.string().optional(),
396573
397244
  subcircuit_id: z115.string().optional(),
396574
- x: distance54,
396575
- y: distance54,
397245
+ x: distance55,
397246
+ y: distance55,
396576
397247
  width: z115.number(),
396577
397248
  height: z115.number(),
396578
397249
  radius: z115.number(),
@@ -396620,8 +397291,8 @@ var pcb_solder_paste_circle2 = z116.object({
396620
397291
  pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
396621
397292
  pcb_group_id: z116.string().optional(),
396622
397293
  subcircuit_id: z116.string().optional(),
396623
- x: distance54,
396624
- y: distance54,
397294
+ x: distance55,
397295
+ y: distance55,
396625
397296
  radius: z116.number(),
396626
397297
  layer: layer_ref3,
396627
397298
  pcb_component_id: z116.string().optional(),
@@ -396633,8 +397304,8 @@ var pcb_solder_paste_rect2 = z116.object({
396633
397304
  pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
396634
397305
  pcb_group_id: z116.string().optional(),
396635
397306
  subcircuit_id: z116.string().optional(),
396636
- x: distance54,
396637
- y: distance54,
397307
+ x: distance55,
397308
+ y: distance55,
396638
397309
  width: z116.number(),
396639
397310
  height: z116.number(),
396640
397311
  layer: layer_ref3,
@@ -396647,8 +397318,8 @@ var pcb_solder_paste_pill2 = z116.object({
396647
397318
  pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
396648
397319
  pcb_group_id: z116.string().optional(),
396649
397320
  subcircuit_id: z116.string().optional(),
396650
- x: distance54,
396651
- y: distance54,
397321
+ x: distance55,
397322
+ y: distance55,
396652
397323
  width: z116.number(),
396653
397324
  height: z116.number(),
396654
397325
  radius: z116.number(),
@@ -396662,11 +397333,11 @@ var pcb_solder_paste_rotated_rect2 = z116.object({
396662
397333
  pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
396663
397334
  pcb_group_id: z116.string().optional(),
396664
397335
  subcircuit_id: z116.string().optional(),
396665
- x: distance54,
396666
- y: distance54,
397336
+ x: distance55,
397337
+ y: distance55,
396667
397338
  width: z116.number(),
396668
397339
  height: z116.number(),
396669
- ccw_rotation: distance54,
397340
+ ccw_rotation: distance55,
396670
397341
  layer: layer_ref3,
396671
397342
  pcb_component_id: z116.string().optional(),
396672
397343
  pcb_smtpad_id: z116.string().optional()
@@ -396677,8 +397348,8 @@ var pcb_solder_paste_rotated_pill2 = z116.object({
396677
397348
  pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
396678
397349
  pcb_group_id: z116.string().optional(),
396679
397350
  subcircuit_id: z116.string().optional(),
396680
- x: distance54,
396681
- y: distance54,
397351
+ x: distance55,
397352
+ y: distance55,
396682
397353
  width: z116.number(),
396683
397354
  height: z116.number(),
396684
397355
  radius: z116.number(),
@@ -396693,8 +397364,8 @@ var pcb_solder_paste_oval2 = z116.object({
396693
397364
  pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
396694
397365
  pcb_group_id: z116.string().optional(),
396695
397366
  subcircuit_id: z116.string().optional(),
396696
- x: distance54,
396697
- y: distance54,
397367
+ x: distance55,
397368
+ y: distance55,
396698
397369
  width: z116.number(),
396699
397370
  height: z116.number(),
396700
397371
  layer: layer_ref3,
@@ -396744,12 +397415,12 @@ var pcb_text2 = z118.object({
396744
397415
  align: z118.enum(["bottom-left"])
396745
397416
  }).describe("Defines text on the PCB");
396746
397417
  expectTypesMatch3(true);
396747
- var positive_width2 = distance54.pipe(z119.number().finite().positive());
397418
+ var positive_width2 = distance55.pipe(z119.number().finite().positive());
396748
397419
  var pcb_trace_route_point_wire2 = z119.object({
396749
397420
  route_type: z119.literal("wire"),
396750
- x: distance54,
396751
- y: distance54,
396752
- width: distance54,
397421
+ x: distance55,
397422
+ y: distance55,
397423
+ width: distance55,
396753
397424
  start_width: positive_width2.optional(),
396754
397425
  end_width: positive_width2.optional(),
396755
397426
  width_interpolation_mode: z119.enum(["linear", "quadratic"]).optional(),
@@ -396788,12 +397459,12 @@ var pcb_trace_route_point_wire2 = z119.object({
396788
397459
  });
396789
397460
  var pcb_trace_route_point_via2 = z119.object({
396790
397461
  route_type: z119.literal("via"),
396791
- x: distance54,
396792
- y: distance54,
397462
+ x: distance55,
397463
+ y: distance55,
396793
397464
  copper_pour_id: z119.string().optional(),
396794
397465
  is_inside_copper_pour: z119.boolean().optional(),
396795
- hole_diameter: distance54.optional(),
396796
- outer_diameter: distance54.optional(),
397466
+ hole_diameter: distance55.optional(),
397467
+ outer_diameter: distance55.optional(),
396797
397468
  tented_on_top: z119.boolean().optional(),
396798
397469
  tented_on_bottom: z119.boolean().optional(),
396799
397470
  from_layer: layer_ref3,
@@ -396803,7 +397474,7 @@ var pcb_trace_route_point_through_pad2 = z119.object({
396803
397474
  route_type: z119.literal("through_pad"),
396804
397475
  start: point10,
396805
397476
  end: point10,
396806
- width: distance54,
397477
+ width: distance55,
396807
397478
  start_layer: layer_ref3,
396808
397479
  end_layer: layer_ref3,
396809
397480
  pcb_smtpad_id: z119.string().optional(),
@@ -396868,8 +397539,8 @@ var pcb_trace_too_long_error2 = z121.object({
396868
397539
  pcb_trace_id: z121.string(),
396869
397540
  source_net_id: z121.string().optional(),
396870
397541
  source_trace_id: z121.string().optional(),
396871
- actual_trace_length: distance54,
396872
- maximum_trace_length: distance54,
397542
+ actual_trace_length: distance55,
397543
+ maximum_trace_length: distance55,
396873
397544
  subcircuit_id: z121.string().optional()
396874
397545
  }).describe("Error emitted when a PCB trace is longer than its maximum allowed length");
396875
397546
  expectTypesMatch3(true);
@@ -396893,8 +397564,8 @@ var pcb_trace_too_long_warning2 = z1232.object({
396893
397564
  pcb_trace_id: z1232.string(),
396894
397565
  source_net_id: z1232.string().optional(),
396895
397566
  source_trace_id: z1232.string().optional(),
396896
- actual_trace_length: distance54,
396897
- maximum_trace_length: distance54,
397567
+ actual_trace_length: distance55,
397568
+ maximum_trace_length: distance55,
396898
397569
  subcircuit_id: z1232.string().optional()
396899
397570
  }).describe("Warning emitted when a PCB trace is longer than its maximum allowed length");
396900
397571
  expectTypesMatch3(true);
@@ -396964,10 +397635,10 @@ var pcb_via2 = z130.object({
396964
397635
  pcb_group_id: z130.string().optional(),
396965
397636
  subcircuit_id: z130.string().optional(),
396966
397637
  subcircuit_connectivity_map_key: z130.string().optional(),
396967
- x: distance54,
396968
- y: distance54,
396969
- outer_diameter: distance54.default("0.6mm"),
396970
- hole_diameter: distance54.default("0.25mm"),
397638
+ x: distance55,
397639
+ y: distance55,
397640
+ outer_diameter: distance55.default("0.6mm"),
397641
+ hole_diameter: distance55.default("0.25mm"),
396971
397642
  topmost_drill_layer: layer_ref3.optional(),
396972
397643
  bottommost_drill_layer: layer_ref3.optional(),
396973
397644
  through_hole: z130.boolean().optional(),
@@ -397134,11 +397805,11 @@ var pcb_silkscreen_line2 = z139.object({
397134
397805
  pcb_component_id: z139.string(),
397135
397806
  pcb_group_id: z139.string().optional(),
397136
397807
  subcircuit_id: z139.string().optional(),
397137
- stroke_width: distance54.default("0.1mm"),
397138
- x1: distance54,
397139
- y1: distance54,
397140
- x2: distance54,
397141
- y2: distance54,
397808
+ stroke_width: distance55.default("0.1mm"),
397809
+ x1: distance55,
397810
+ y1: distance55,
397811
+ x2: distance55,
397812
+ y2: distance55,
397142
397813
  layer: visible_layer2
397143
397814
  }).describe("Defines a silkscreen line on the PCB");
397144
397815
  expectTypesMatch3(true);
@@ -397159,7 +397830,7 @@ var pcb_silkscreen_text2 = z141.object({
397159
397830
  pcb_group_id: z141.string().optional(),
397160
397831
  subcircuit_id: z141.string().optional(),
397161
397832
  font: z141.literal("tscircuit2024").default("tscircuit2024"),
397162
- font_size: distance54.default("0.2mm"),
397833
+ font_size: distance55.default("0.2mm"),
397163
397834
  pcb_component_id: z141.string(),
397164
397835
  text: z141.string(),
397165
397836
  is_knockout: z141.boolean().default(false).optional(),
@@ -397187,7 +397858,7 @@ var pcb_copper_text2 = z1422.object({
397187
397858
  pcb_group_id: z1422.string().optional(),
397188
397859
  subcircuit_id: z1422.string().optional(),
397189
397860
  font: z1422.literal("tscircuit2024").default("tscircuit2024"),
397190
- font_size: distance54.default("0.2mm"),
397861
+ font_size: distance55.default("0.2mm"),
397191
397862
  pcb_component_id: z1422.string(),
397192
397863
  text: z1422.string(),
397193
397864
  is_knockout: z1422.boolean().default(false).optional(),
@@ -397247,8 +397918,8 @@ var pcb_silkscreen_oval2 = z145.object({
397247
397918
  pcb_group_id: z145.string().optional(),
397248
397919
  subcircuit_id: z145.string().optional(),
397249
397920
  center: point10,
397250
- radius_x: distance54,
397251
- radius_y: distance54,
397921
+ radius_x: distance55,
397922
+ radius_y: distance55,
397252
397923
  layer: visible_layer2,
397253
397924
  ccw_rotation: rotation12.optional()
397254
397925
  }).describe("Defines a silkscreen oval on the PCB");
@@ -397288,7 +397959,7 @@ var pcb_fabrication_note_text3 = z148.object({
397288
397959
  subcircuit_id: z148.string().optional(),
397289
397960
  pcb_group_id: z148.string().optional(),
397290
397961
  font: z148.literal("tscircuit2024").default("tscircuit2024"),
397291
- font_size: distance54.default("1mm"),
397962
+ font_size: distance55.default("1mm"),
397292
397963
  pcb_component_id: z148.string(),
397293
397964
  text: z148.string(),
397294
397965
  ccw_rotation: z148.number().optional(),
@@ -397358,7 +398029,7 @@ var pcb_note_text3 = z1522.object({
397358
398029
  subcircuit_id: z1522.string().optional(),
397359
398030
  name: z1522.string().optional(),
397360
398031
  font: z1522.literal("tscircuit2024").default("tscircuit2024"),
397361
- font_size: distance54.default("1mm"),
398032
+ font_size: distance55.default("1mm"),
397362
398033
  text: z1522.string().optional(),
397363
398034
  anchor_position: point10.default({ x: 0, y: 0 }),
397364
398035
  anchor_alignment: z1522.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
@@ -397409,12 +398080,12 @@ var pcb_note_line3 = z155.object({
397409
398080
  subcircuit_id: z155.string().optional(),
397410
398081
  name: z155.string().optional(),
397411
398082
  text: z155.string().optional(),
397412
- x1: distance54,
397413
- y1: distance54,
397414
- x2: distance54,
397415
- y2: distance54,
398083
+ x1: distance55,
398084
+ y1: distance55,
398085
+ x2: distance55,
398086
+ y2: distance55,
397416
398087
  layer: visible_layer2.default("top"),
397417
- stroke_width: distance54.default("0.1mm"),
398088
+ stroke_width: distance55.default("0.1mm"),
397418
398089
  color: z155.string().optional(),
397419
398090
  is_dashed: z155.boolean().optional()
397420
398091
  }).describe("Defines a straight documentation note line on the PCB");
@@ -397480,8 +398151,8 @@ var pcb_keepout3 = z159.object({
397480
398151
  pcb_group_id: z159.string().optional(),
397481
398152
  subcircuit_id: z159.string().optional(),
397482
398153
  center: point10,
397483
- width: distance54,
397484
- height: distance54,
398154
+ width: distance55,
398155
+ height: distance55,
397485
398156
  pcb_keepout_id: z159.string(),
397486
398157
  layers: z159.array(z159.string()),
397487
398158
  description: z159.string().optional(),
@@ -397495,7 +398166,7 @@ var pcb_keepout3 = z159.object({
397495
398166
  pcb_group_id: z159.string().optional(),
397496
398167
  subcircuit_id: z159.string().optional(),
397497
398168
  center: point10,
397498
- radius: distance54,
398169
+ radius: distance55,
397499
398170
  pcb_keepout_id: z159.string(),
397500
398171
  layers: z159.array(z159.string()),
397501
398172
  description: z159.string().optional(),
@@ -397718,8 +398389,8 @@ var pcb_breakout_point2 = z1732.object({
397718
398389
  source_port_id: z1732.string().optional(),
397719
398390
  source_net_id: z1732.string().optional(),
397720
398391
  layer: layer_ref3.optional(),
397721
- x: distance54,
397722
- y: distance54
398392
+ x: distance55,
398393
+ y: distance55
397723
398394
  }).describe("Defines a routing target within a pcb_group for a source_trace or source_net");
397724
398395
  expectTypesMatch3(true);
397725
398396
  var pcb_ground_plane2 = z174.object({
@@ -397747,9 +398418,9 @@ var pcb_thermal_spoke2 = z176.object({
397747
398418
  pcb_ground_plane_id: z176.string(),
397748
398419
  shape: z176.string(),
397749
398420
  spoke_count: z176.number(),
397750
- spoke_thickness: distance54,
397751
- spoke_inner_diameter: distance54,
397752
- spoke_outer_diameter: distance54,
398421
+ spoke_thickness: distance55,
398422
+ spoke_inner_diameter: distance55,
398423
+ spoke_outer_diameter: distance55,
397753
398424
  pcb_plated_hole_id: z176.string().optional(),
397754
398425
  subcircuit_id: z176.string().optional()
397755
398426
  }).describe("Pattern for connecting a ground plane to a plated hole");
@@ -397831,8 +398502,8 @@ var pcb_via_clearance_error2 = base_circuit_json_error2.extend({
397831
398502
  pcb_error_id: getZodPrefixedIdWithDefault2("pcb_error"),
397832
398503
  error_type: z181.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
397833
398504
  pcb_via_ids: z181.array(z181.string()).min(2),
397834
- minimum_clearance: distance54.optional(),
397835
- actual_clearance: distance54.optional(),
398505
+ minimum_clearance: distance55.optional(),
398506
+ actual_clearance: distance55.optional(),
397836
398507
  pcb_center: z181.object({
397837
398508
  x: z181.number().optional(),
397838
398509
  y: z181.number().optional()
@@ -397846,8 +398517,8 @@ var pcb_via_trace_clearance_error2 = base_circuit_json_error2.extend({
397846
398517
  error_type: z1822.literal("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),
397847
398518
  pcb_via_id: z1822.string(),
397848
398519
  pcb_trace_id: z1822.string(),
397849
- minimum_clearance: distance54.optional(),
397850
- actual_clearance: distance54.optional(),
398520
+ minimum_clearance: distance55.optional(),
398521
+ actual_clearance: distance55.optional(),
397851
398522
  center: z1822.object({
397852
398523
  x: z1822.number().optional(),
397853
398524
  y: z1822.number().optional()
@@ -397860,8 +398531,8 @@ var pcb_pad_pad_clearance_error2 = base_circuit_json_error2.extend({
397860
398531
  pcb_pad_pad_clearance_error_id: getZodPrefixedIdWithDefault2("pcb_pad_pad_clearance_error"),
397861
398532
  error_type: z1832.literal("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),
397862
398533
  pcb_pad_ids: z1832.array(z1832.string()).min(2),
397863
- minimum_clearance: distance54.optional(),
397864
- actual_clearance: distance54.optional(),
398534
+ minimum_clearance: distance55.optional(),
398535
+ actual_clearance: distance55.optional(),
397865
398536
  center: z1832.object({
397866
398537
  x: z1832.number().optional(),
397867
398538
  y: z1832.number().optional()
@@ -397875,8 +398546,8 @@ var pcb_pad_trace_clearance_error2 = base_circuit_json_error2.extend({
397875
398546
  error_type: z184.literal("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),
397876
398547
  pcb_pad_id: z184.string(),
397877
398548
  pcb_trace_id: z184.string(),
397878
- minimum_clearance: distance54.optional(),
397879
- actual_clearance: distance54.optional(),
398549
+ minimum_clearance: distance55.optional(),
398550
+ actual_clearance: distance55.optional(),
397880
398551
  center: z184.object({
397881
398552
  x: z184.number().optional(),
397882
398553
  y: z184.number().optional()