easyeda 0.0.31 → 0.0.32

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.
@@ -1,62 +1,15 @@
1
- "use strict";
2
- var __create = Object.create;
3
1
  var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
2
  var __export = (target, all) => {
9
3
  for (var name in all)
10
4
  __defProp(target, name, { get: all[name], enumerable: true });
11
5
  };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // lib/index.ts
31
- var lib_exports = {};
32
- __export(lib_exports, {
33
- BBoxSchema: () => BBoxSchema,
34
- DataStrSchema: () => DataStrSchema,
35
- EasyEdaJsonSchema: () => EasyEdaJsonSchema,
36
- HeadSchema: () => HeadSchema,
37
- LayerItemSchema: () => LayerItemSchema,
38
- LcscSchema: () => LcscSchema,
39
- ObjectItemSchema: () => ObjectItemSchema,
40
- OwnerSchema: () => OwnerSchema,
41
- PackageDetailDataStrSchema: () => PackageDetailDataStrSchema,
42
- PackageDetailSchema: () => PackageDetailSchema,
43
- SzlcscSchema: () => SzlcscSchema,
44
- convertEasyEdaJsonToCircuitJson: () => convertEasyEdaJsonToCircuitJson,
45
- convertEasyEdaJsonToTscircuitSoupJson: () => convertEasyEdaJsonToTscircuitSoupJson,
46
- convertEasyEdaJsonToVariousFormats: () => convertEasyEdaJsonToVariousFormats,
47
- convertRawEasyEdaToTs: () => convertRawEasyEdaToTs,
48
- fetchEasyEDAComponent: () => fetchEasyEDAComponent,
49
- maybeNumber: () => maybeNumber,
50
- normalizeManufacturerPartNumber: () => normalizeManufacturerPartNumber
51
- });
52
- module.exports = __toCommonJS(lib_exports);
53
6
 
54
7
  // lib/schemas/package-detail-shape-schema.ts
55
- var import_zod = require("zod");
56
- var tenthmil = import_zod.z.union([import_zod.z.number(), import_zod.z.string()]).optional().transform(
8
+ import { z } from "zod";
9
+ var tenthmil = z.union([z.number(), z.string()]).optional().transform(
57
10
  (n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
58
- ).pipe(import_zod.z.string());
59
- var PointSchema = import_zod.z.any().transform((p) => {
11
+ ).pipe(z.string());
12
+ var PointSchema = z.any().transform((p) => {
60
13
  if (Array.isArray(p)) {
61
14
  const [x, y] = p;
62
15
  return { x, y };
@@ -65,87 +18,87 @@ var PointSchema = import_zod.z.any().transform((p) => {
65
18
  }
66
19
  throw new Error(`Invalid point: ${p}`);
67
20
  }).pipe(
68
- import_zod.z.object({
69
- x: import_zod.z.number(),
70
- y: import_zod.z.number()
21
+ z.object({
22
+ x: z.number(),
23
+ y: z.number()
71
24
  })
72
25
  );
73
- var BaseShapeSchema = import_zod.z.object({
74
- type: import_zod.z.string(),
75
- id: import_zod.z.string().optional(),
76
- layer: import_zod.z.coerce.number().optional()
26
+ var BaseShapeSchema = z.object({
27
+ type: z.string(),
28
+ id: z.string().optional(),
29
+ layer: z.coerce.number().optional()
77
30
  });
78
31
  var TrackSchema = BaseShapeSchema.extend({
79
- type: import_zod.z.literal("TRACK"),
80
- width: import_zod.z.coerce.number(),
81
- points: import_zod.z.array(PointSchema)
32
+ type: z.literal("TRACK"),
33
+ width: z.coerce.number(),
34
+ points: z.array(PointSchema)
82
35
  });
83
36
  var PadSchema = BaseShapeSchema.extend({
84
- type: import_zod.z.literal("PAD"),
85
- shape: import_zod.z.enum(["RECT", "ELLIPSE", "OVAL"]),
86
- center: import_zod.z.object({
37
+ type: z.literal("PAD"),
38
+ shape: z.enum(["RECT", "ELLIPSE", "OVAL"]),
39
+ center: z.object({
87
40
  x: tenthmil,
88
41
  y: tenthmil
89
42
  }),
90
43
  width: tenthmil,
91
44
  height: tenthmil,
92
- layermask: import_zod.z.number(),
93
- net: import_zod.z.union([import_zod.z.string(), import_zod.z.number()]).optional(),
94
- number: import_zod.z.number(),
45
+ layermask: z.number(),
46
+ net: z.union([z.string(), z.number()]).optional(),
47
+ number: z.number(),
95
48
  holeRadius: tenthmil,
96
- points: import_zod.z.array(PointSchema).optional(),
97
- rotation: import_zod.z.number().optional(),
98
- plated: import_zod.z.boolean()
49
+ points: z.array(PointSchema).optional(),
50
+ rotation: z.number().optional(),
51
+ plated: z.boolean()
99
52
  });
100
53
  var ArcSchema = BaseShapeSchema.extend({
101
- type: import_zod.z.literal("ARC"),
102
- width: import_zod.z.number(),
54
+ type: z.literal("ARC"),
55
+ width: z.number(),
103
56
  start: PointSchema,
104
57
  end: PointSchema,
105
- radiusX: import_zod.z.number(),
106
- radiusY: import_zod.z.number(),
107
- largeArc: import_zod.z.boolean(),
108
- sweepDirection: import_zod.z.enum(["CW", "CCW"])
58
+ radiusX: z.number(),
59
+ radiusY: z.number(),
60
+ largeArc: z.boolean(),
61
+ sweepDirection: z.enum(["CW", "CCW"])
109
62
  });
110
63
  var CircleSchema = BaseShapeSchema.extend({
111
- type: import_zod.z.literal("CIRCLE"),
64
+ type: z.literal("CIRCLE"),
112
65
  center: PointSchema,
113
- radius: import_zod.z.number(),
114
- width: import_zod.z.number()
66
+ radius: z.number(),
67
+ width: z.number()
115
68
  });
116
69
  var SolidRegionSchema = BaseShapeSchema.extend({
117
- type: import_zod.z.literal("SOLIDREGION"),
118
- layermask: import_zod.z.number(),
119
- points: import_zod.z.array(PointSchema),
120
- fillStyle: import_zod.z.string()
70
+ type: z.literal("SOLIDREGION"),
71
+ layermask: z.number(),
72
+ points: z.array(PointSchema),
73
+ fillStyle: z.string()
121
74
  });
122
75
  var SVGNodeSchema = BaseShapeSchema.extend({
123
- type: import_zod.z.literal("SVGNODE"),
124
- svgData: import_zod.z.object({
125
- gId: import_zod.z.string(),
126
- nodeName: import_zod.z.string(),
127
- nodeType: import_zod.z.number(),
128
- layerid: import_zod.z.string(),
129
- attrs: import_zod.z.record(import_zod.z.string(), import_zod.z.string()),
130
- childNodes: import_zod.z.array(import_zod.z.unknown())
76
+ type: z.literal("SVGNODE"),
77
+ svgData: z.object({
78
+ gId: z.string(),
79
+ nodeName: z.string(),
80
+ nodeType: z.number(),
81
+ layerid: z.string(),
82
+ attrs: z.record(z.string(), z.string()),
83
+ childNodes: z.array(z.unknown())
131
84
  })
132
85
  });
133
86
  var HoleSchema = BaseShapeSchema.extend({
134
- type: import_zod.z.literal("HOLE"),
87
+ type: z.literal("HOLE"),
135
88
  center: PointSchema,
136
- radius: import_zod.z.number()
89
+ radius: z.number()
137
90
  });
138
91
  var RectSchema = BaseShapeSchema.extend({
139
- type: import_zod.z.literal("RECT"),
92
+ type: z.literal("RECT"),
140
93
  x: tenthmil,
141
94
  y: tenthmil,
142
95
  width: tenthmil,
143
96
  height: tenthmil,
144
- lineWidth: import_zod.z.number(),
145
- fillStyle: import_zod.z.string(),
146
- rotation: import_zod.z.number().optional()
97
+ lineWidth: z.number(),
98
+ fillStyle: z.string(),
99
+ rotation: z.number().optional()
147
100
  });
148
- var PackageDetailShapeSchema = import_zod.z.discriminatedUnion("type", [
101
+ var PackageDetailShapeSchema = z.discriminatedUnion("type", [
149
102
  TrackSchema,
150
103
  PadSchema,
151
104
  ArcSchema,
@@ -165,9 +118,9 @@ var pairs = (arr) => {
165
118
  var parsePoints = (pointsStr) => pairs(
166
119
  pointsStr.trim().split(" ").map((n) => Number(n))
167
120
  );
168
- var ShapeItemSchema = import_zod.z.object({
169
- type: import_zod.z.string(),
170
- data: import_zod.z.string()
121
+ var ShapeItemSchema = z.object({
122
+ type: z.string(),
123
+ data: z.string()
171
124
  }).transform((shape) => {
172
125
  const [firstParam, ...restParams] = shape.data.split("~");
173
126
  const lastParam = restParams.pop();
@@ -303,10 +256,10 @@ var ShapeItemSchema = import_zod.z.object({
303
256
  return BaseShapeSchema.parse({ type: shape.type });
304
257
  }
305
258
  }).pipe(PackageDetailShapeSchema);
306
- var ShapesArraySchema = import_zod.z.array(ShapeItemSchema);
259
+ var ShapesArraySchema = z.array(ShapeItemSchema);
307
260
 
308
261
  // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
309
- var import_zod60 = require("zod");
262
+ import "zod";
310
263
 
311
264
  // node_modules/circuit-json/dist/index.mjs
312
265
  var dist_exports = {};
@@ -390,14 +343,14 @@ __export(dist_exports, {
390
343
  visible_layer: () => visible_layer,
391
344
  voltage: () => voltage
392
345
  });
393
- var import_zod2 = require("zod");
394
- var import_zod3 = require("zod");
395
- var import_zod4 = require("zod");
396
- var import_zod5 = require("zod");
397
- var import_zod6 = require("zod");
346
+ import { z as z2 } from "zod";
347
+ import { z as z22 } from "zod";
348
+ import { z as z3 } from "zod";
349
+ import { z as z4 } from "zod";
350
+ import { z as z5 } from "zod";
398
351
 
399
352
  // node_modules/nanoid/index.js
400
- var import_node_crypto = require("crypto");
353
+ import { webcrypto as crypto } from "node:crypto";
401
354
 
402
355
  // node_modules/nanoid/url-alphabet/index.js
403
356
  var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
@@ -409,10 +362,10 @@ var poolOffset;
409
362
  function fillPool(bytes) {
410
363
  if (!pool || pool.length < bytes) {
411
364
  pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
412
- import_node_crypto.webcrypto.getRandomValues(pool);
365
+ crypto.getRandomValues(pool);
413
366
  poolOffset = 0;
414
367
  } else if (poolOffset + bytes > pool.length) {
415
- import_node_crypto.webcrypto.getRandomValues(pool);
368
+ crypto.getRandomValues(pool);
416
369
  poolOffset = 0;
417
370
  }
418
371
  poolOffset += bytes;
@@ -427,59 +380,59 @@ function nanoid(size2 = 21) {
427
380
  }
428
381
 
429
382
  // node_modules/circuit-json/dist/index.mjs
430
- var import_zod7 = require("zod");
431
- var import_zod8 = require("zod");
432
- var import_zod9 = require("zod");
433
- var import_zod10 = require("zod");
434
- var import_zod11 = require("zod");
435
- var import_zod12 = require("zod");
436
- var import_zod13 = require("zod");
437
- var import_zod14 = require("zod");
438
- var import_zod15 = require("zod");
439
- var import_zod16 = require("zod");
440
- var import_zod17 = require("zod");
441
- var import_zod18 = require("zod");
442
- var import_zod19 = require("zod");
443
- var import_zod20 = require("zod");
444
- var import_zod21 = require("zod");
445
- var import_zod22 = require("zod");
446
- var import_zod23 = require("zod");
447
- var import_zod24 = require("zod");
448
- var import_zod25 = require("zod");
449
- var import_zod26 = require("zod");
450
- var import_zod27 = require("zod");
451
- var import_zod28 = require("zod");
452
- var import_zod29 = require("zod");
453
- var import_zod30 = require("zod");
454
- var import_zod31 = require("zod");
455
- var import_zod32 = require("zod");
456
- var import_zod33 = require("zod");
457
- var import_zod34 = require("zod");
458
- var import_zod35 = require("zod");
459
- var import_zod36 = require("zod");
460
- var import_zod37 = require("zod");
461
- var import_zod38 = require("zod");
462
- var import_zod39 = require("zod");
463
- var import_zod40 = require("zod");
464
- var import_zod41 = require("zod");
465
- var import_zod42 = require("zod");
466
- var import_zod43 = require("zod");
467
- var import_zod44 = require("zod");
468
- var import_zod45 = require("zod");
469
- var import_zod46 = require("zod");
470
- var import_zod47 = require("zod");
471
- var import_zod48 = require("zod");
472
- var import_zod49 = require("zod");
473
- var import_zod50 = require("zod");
474
- var import_zod51 = require("zod");
475
- var import_zod52 = require("zod");
476
- var import_zod53 = require("zod");
477
- var import_zod54 = require("zod");
478
- var import_zod55 = require("zod");
479
- var import_zod56 = require("zod");
480
- var import_zod57 = require("zod");
481
- var import_zod58 = require("zod");
482
- var import_zod59 = require("zod");
383
+ import { z as z8 } from "zod";
384
+ import { z as z6 } from "zod";
385
+ import { z as z7 } from "zod";
386
+ import { z as z9 } from "zod";
387
+ import { z as z10 } from "zod";
388
+ import { z as z11 } from "zod";
389
+ import { z as z12 } from "zod";
390
+ import { z as z13 } from "zod";
391
+ import { z as z14 } from "zod";
392
+ import { z as z15 } from "zod";
393
+ import { z as z16 } from "zod";
394
+ import { z as z17 } from "zod";
395
+ import { z as z18 } from "zod";
396
+ import { z as z19 } from "zod";
397
+ import { z as z20 } from "zod";
398
+ import { z as z21 } from "zod";
399
+ import { z as z222 } from "zod";
400
+ import { z as z23 } from "zod";
401
+ import { z as z24 } from "zod";
402
+ import { z as z25 } from "zod";
403
+ import { z as z26 } from "zod";
404
+ import { z as z27 } from "zod";
405
+ import { z as z28 } from "zod";
406
+ import { z as z29 } from "zod";
407
+ import { z as z30 } from "zod";
408
+ import { z as z31 } from "zod";
409
+ import { z as z32 } from "zod";
410
+ import { z as z33 } from "zod";
411
+ import { z as z34 } from "zod";
412
+ import { z as z35 } from "zod";
413
+ import { z as z36 } from "zod";
414
+ import { z as z37 } from "zod";
415
+ import { z as z38 } from "zod";
416
+ import { z as z39 } from "zod";
417
+ import { z as z40 } from "zod";
418
+ import { z as z41 } from "zod";
419
+ import { z as z42 } from "zod";
420
+ import { z as z43 } from "zod";
421
+ import { z as z44 } from "zod";
422
+ import { z as z45 } from "zod";
423
+ import { z as z46 } from "zod";
424
+ import { z as z47 } from "zod";
425
+ import { z as z48 } from "zod";
426
+ import { z as z49 } from "zod";
427
+ import { z as z50 } from "zod";
428
+ import { z as z51 } from "zod";
429
+ import { z as z52 } from "zod";
430
+ import { z as z53 } from "zod";
431
+ import { z as z54 } from "zod";
432
+ import { z as z55 } from "zod";
433
+ import { z as z56 } from "zod";
434
+ import { z as z57 } from "zod";
435
+ import { z as z58 } from "zod";
483
436
  var unitMappings = {
484
437
  Hz: {
485
438
  baseUnit: "Hz",
@@ -629,15 +582,15 @@ var parseAndConvertSiUnit = (v) => {
629
582
  value: conversionFactor * Number.parseFloat(value)
630
583
  };
631
584
  };
632
- var resistance = import_zod2.z.string().or(import_zod2.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
633
- var capacitance = import_zod2.z.string().or(import_zod2.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
634
- var inductance = import_zod2.z.string().or(import_zod2.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
635
- var voltage = import_zod2.z.string().or(import_zod2.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
636
- var length = import_zod2.z.string().or(import_zod2.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
585
+ var resistance = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
586
+ var capacitance = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
587
+ var inductance = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
588
+ var voltage = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
589
+ var length = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
637
590
  var distance = length;
638
- var current = import_zod2.z.string().or(import_zod2.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
639
- var time = import_zod2.z.string().or(import_zod2.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
640
- var rotation = import_zod2.z.string().or(import_zod2.z.number()).transform((arg) => {
591
+ var current = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
592
+ var time = z2.string().or(z2.number()).transform((v) => parseAndConvertSiUnit(v).value);
593
+ var rotation = z2.string().or(z2.number()).transform((arg) => {
641
594
  if (typeof arg === "number") return arg;
642
595
  if (arg.endsWith("deg")) {
643
596
  return Number.parseFloat(arg.split("deg")[0]);
@@ -647,25 +600,25 @@ var rotation = import_zod2.z.string().or(import_zod2.z.number()).transform((arg)
647
600
  }
648
601
  return Number.parseFloat(arg);
649
602
  });
650
- var point = import_zod3.z.object({
603
+ var point = z22.object({
651
604
  x: distance,
652
605
  y: distance
653
606
  });
654
607
  var position = point;
655
- var point3 = import_zod4.z.object({
608
+ var point3 = z3.object({
656
609
  x: distance,
657
610
  y: distance,
658
611
  z: distance
659
612
  });
660
613
  var position3 = point3;
661
- var size = import_zod5.z.object({
662
- width: import_zod5.z.number(),
663
- height: import_zod5.z.number()
614
+ var size = z4.object({
615
+ width: z4.number(),
616
+ height: z4.number()
664
617
  });
665
618
  var getZodPrefixedIdWithDefault = (prefix) => {
666
- return import_zod6.z.string().optional().default(() => `${prefix}_${nanoid(10)}`);
619
+ return z5.string().optional().default(() => `${prefix}_${nanoid(10)}`);
667
620
  };
668
- var supplier_name = import_zod8.z.enum([
621
+ var supplier_name = z6.enum([
669
622
  "jlcpcb",
670
623
  "macrofab",
671
624
  "pcbway",
@@ -673,46 +626,46 @@ var supplier_name = import_zod8.z.enum([
673
626
  "mouser",
674
627
  "lcsc"
675
628
  ]);
676
- var source_component_base = import_zod9.z.object({
677
- type: import_zod9.z.literal("source_component"),
678
- ftype: import_zod9.z.string().optional(),
679
- source_component_id: import_zod9.z.string(),
680
- name: import_zod9.z.string(),
681
- manufacturer_part_number: import_zod9.z.string().optional(),
682
- supplier_part_numbers: import_zod9.z.record(supplier_name, import_zod9.z.array(import_zod9.z.string())).optional()
629
+ var source_component_base = z7.object({
630
+ type: z7.literal("source_component"),
631
+ ftype: z7.string().optional(),
632
+ source_component_id: z7.string(),
633
+ name: z7.string(),
634
+ manufacturer_part_number: z7.string().optional(),
635
+ supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional()
683
636
  });
684
637
  var source_simple_capacitor = source_component_base.extend({
685
- ftype: import_zod7.z.literal("simple_capacitor"),
638
+ ftype: z8.literal("simple_capacitor"),
686
639
  capacitance
687
640
  });
688
641
  var source_simple_resistor = source_component_base.extend({
689
- ftype: import_zod10.z.literal("simple_resistor"),
642
+ ftype: z9.literal("simple_resistor"),
690
643
  resistance
691
644
  });
692
645
  var source_simple_diode = source_component_base.extend({
693
- ftype: import_zod11.z.literal("simple_diode")
646
+ ftype: z10.literal("simple_diode")
694
647
  });
695
648
  var source_simple_ground = source_component_base.extend({
696
- ftype: import_zod12.z.literal("simple_ground")
649
+ ftype: z11.literal("simple_ground")
697
650
  });
698
651
  var source_simple_bug = source_component_base.extend({
699
- ftype: import_zod13.z.literal("simple_bug")
652
+ ftype: z12.literal("simple_bug")
700
653
  }).describe("@deprecated");
701
654
  var source_simple_chip = source_component_base.extend({
702
- ftype: import_zod14.z.literal("simple_chip")
655
+ ftype: z13.literal("simple_chip")
703
656
  });
704
657
  var source_simple_inductor = source_component_base.extend({
705
- ftype: import_zod15.z.literal("simple_inductor"),
658
+ ftype: z14.literal("simple_inductor"),
706
659
  inductance
707
660
  });
708
661
  var source_led = source_simple_diode.extend({
709
- ftype: import_zod16.z.literal("led")
662
+ ftype: z15.literal("led")
710
663
  });
711
664
  var source_simple_power_source = source_component_base.extend({
712
- ftype: import_zod17.z.literal("simple_power_source"),
665
+ ftype: z16.literal("simple_power_source"),
713
666
  voltage
714
667
  });
715
- var any_source_component = import_zod18.z.union([
668
+ var any_source_component = z17.union([
716
669
  source_simple_resistor,
717
670
  source_simple_capacitor,
718
671
  source_simple_diode,
@@ -722,158 +675,158 @@ var any_source_component = import_zod18.z.union([
722
675
  source_led,
723
676
  source_simple_power_source
724
677
  ]);
725
- var source_port = import_zod19.z.object({
726
- type: import_zod19.z.literal("source_port"),
727
- pin_number: import_zod19.z.number().optional(),
728
- port_hints: import_zod19.z.array(import_zod19.z.string()).optional(),
729
- name: import_zod19.z.string(),
730
- source_port_id: import_zod19.z.string(),
731
- source_component_id: import_zod19.z.string()
732
- });
733
- var source_trace = import_zod20.z.object({
734
- type: import_zod20.z.literal("source_trace"),
735
- source_trace_id: import_zod20.z.string(),
736
- connected_source_port_ids: import_zod20.z.array(import_zod20.z.string()),
737
- connected_source_net_ids: import_zod20.z.array(import_zod20.z.string())
738
- });
739
- var source_group = import_zod21.z.object({
740
- type: import_zod21.z.literal("source_group"),
741
- source_group_id: import_zod21.z.string(),
742
- name: import_zod21.z.string().optional()
743
- });
744
- var source_net = import_zod22.z.object({
745
- type: import_zod22.z.literal("source_net"),
746
- source_net_id: import_zod22.z.string(),
747
- name: import_zod22.z.string(),
748
- member_source_group_ids: import_zod22.z.array(import_zod22.z.string()),
749
- is_power: import_zod22.z.boolean().optional(),
750
- is_ground: import_zod22.z.boolean().optional(),
751
- is_digital_signal: import_zod22.z.boolean().optional(),
752
- is_analog_signal: import_zod22.z.boolean().optional(),
753
- trace_width: import_zod22.z.number().optional()
754
- });
755
- var schematic_box = import_zod23.z.object({
756
- type: import_zod23.z.literal("schematic_box"),
757
- schematic_component_id: import_zod23.z.string(),
678
+ var source_port = z18.object({
679
+ type: z18.literal("source_port"),
680
+ pin_number: z18.number().optional(),
681
+ port_hints: z18.array(z18.string()).optional(),
682
+ name: z18.string(),
683
+ source_port_id: z18.string(),
684
+ source_component_id: z18.string()
685
+ });
686
+ var source_trace = z19.object({
687
+ type: z19.literal("source_trace"),
688
+ source_trace_id: z19.string(),
689
+ connected_source_port_ids: z19.array(z19.string()),
690
+ connected_source_net_ids: z19.array(z19.string())
691
+ });
692
+ var source_group = z20.object({
693
+ type: z20.literal("source_group"),
694
+ source_group_id: z20.string(),
695
+ name: z20.string().optional()
696
+ });
697
+ var source_net = z21.object({
698
+ type: z21.literal("source_net"),
699
+ source_net_id: z21.string(),
700
+ name: z21.string(),
701
+ member_source_group_ids: z21.array(z21.string()),
702
+ is_power: z21.boolean().optional(),
703
+ is_ground: z21.boolean().optional(),
704
+ is_digital_signal: z21.boolean().optional(),
705
+ is_analog_signal: z21.boolean().optional(),
706
+ trace_width: z21.number().optional()
707
+ });
708
+ var schematic_box = z222.object({
709
+ type: z222.literal("schematic_box"),
710
+ schematic_component_id: z222.string(),
758
711
  width: distance,
759
712
  height: distance,
760
713
  x: distance,
761
714
  y: distance
762
715
  }).describe("Draws a box on the schematic");
763
- var schematic_path = import_zod24.z.object({
764
- type: import_zod24.z.literal("schematic_path"),
765
- schematic_component_id: import_zod24.z.string(),
766
- fill_color: import_zod24.z.enum(["red", "blue"]).optional(),
767
- is_filled: import_zod24.z.boolean().optional(),
768
- points: import_zod24.z.array(point)
769
- });
770
- var schematic_pin_styles = import_zod25.z.record(
771
- import_zod25.z.object({
716
+ var schematic_path = z23.object({
717
+ type: z23.literal("schematic_path"),
718
+ schematic_component_id: z23.string(),
719
+ fill_color: z23.enum(["red", "blue"]).optional(),
720
+ is_filled: z23.boolean().optional(),
721
+ points: z23.array(point)
722
+ });
723
+ var schematic_pin_styles = z24.record(
724
+ z24.object({
772
725
  left_margin: length.optional(),
773
726
  right_margin: length.optional(),
774
727
  top_margin: length.optional(),
775
728
  bottom_margin: length.optional()
776
729
  })
777
730
  );
778
- var schematic_component = import_zod25.z.object({
779
- type: import_zod25.z.literal("schematic_component"),
731
+ var schematic_component = z24.object({
732
+ type: z24.literal("schematic_component"),
780
733
  rotation: rotation.default(0),
781
734
  size,
782
735
  center: point,
783
- source_component_id: import_zod25.z.string(),
784
- schematic_component_id: import_zod25.z.string(),
736
+ source_component_id: z24.string(),
737
+ schematic_component_id: z24.string(),
785
738
  pin_spacing: length.optional(),
786
739
  pin_styles: schematic_pin_styles.optional(),
787
740
  box_width: length.optional(),
788
- symbol_name: import_zod25.z.string().optional(),
789
- port_arrangement: import_zod25.z.union([
790
- import_zod25.z.object({
791
- left_size: import_zod25.z.number(),
792
- right_size: import_zod25.z.number(),
793
- top_size: import_zod25.z.number().optional(),
794
- bottom_size: import_zod25.z.number().optional()
741
+ symbol_name: z24.string().optional(),
742
+ port_arrangement: z24.union([
743
+ z24.object({
744
+ left_size: z24.number(),
745
+ right_size: z24.number(),
746
+ top_size: z24.number().optional(),
747
+ bottom_size: z24.number().optional()
795
748
  }),
796
- import_zod25.z.object({
797
- left_side: import_zod25.z.object({
798
- pins: import_zod25.z.array(import_zod25.z.number()),
799
- direction: import_zod25.z.enum(["top-to-bottom", "bottom-to-top"]).optional()
749
+ z24.object({
750
+ left_side: z24.object({
751
+ pins: z24.array(z24.number()),
752
+ direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
800
753
  }).optional(),
801
- right_side: import_zod25.z.object({
802
- pins: import_zod25.z.array(import_zod25.z.number()),
803
- direction: import_zod25.z.enum(["top-to-bottom", "bottom-to-top"]).optional()
754
+ right_side: z24.object({
755
+ pins: z24.array(z24.number()),
756
+ direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
804
757
  }).optional(),
805
- top_side: import_zod25.z.object({
806
- pins: import_zod25.z.array(import_zod25.z.number()),
807
- direction: import_zod25.z.enum(["left-to-right", "right-to-left"]).optional()
758
+ top_side: z24.object({
759
+ pins: z24.array(z24.number()),
760
+ direction: z24.enum(["left-to-right", "right-to-left"]).optional()
808
761
  }).optional(),
809
- bottom_side: import_zod25.z.object({
810
- pins: import_zod25.z.array(import_zod25.z.number()),
811
- direction: import_zod25.z.enum(["left-to-right", "right-to-left"]).optional()
762
+ bottom_side: z24.object({
763
+ pins: z24.array(z24.number()),
764
+ direction: z24.enum(["left-to-right", "right-to-left"]).optional()
812
765
  }).optional()
813
766
  })
814
767
  ]).optional(),
815
- port_labels: import_zod25.z.record(import_zod25.z.string()).optional()
768
+ port_labels: z24.record(z24.string()).optional()
816
769
  });
817
- var schematic_line = import_zod26.z.object({
818
- type: import_zod26.z.literal("schematic_line"),
819
- schematic_component_id: import_zod26.z.string(),
770
+ var schematic_line = z25.object({
771
+ type: z25.literal("schematic_line"),
772
+ schematic_component_id: z25.string(),
820
773
  x1: distance,
821
774
  x2: distance,
822
775
  y1: distance,
823
776
  y2: distance
824
777
  });
825
- var schematic_trace = import_zod27.z.object({
826
- type: import_zod27.z.literal("schematic_trace"),
827
- schematic_trace_id: import_zod27.z.string(),
828
- source_trace_id: import_zod27.z.string(),
829
- edges: import_zod27.z.array(
830
- import_zod27.z.object({
831
- from: import_zod27.z.object({
832
- x: import_zod27.z.number(),
833
- y: import_zod27.z.number()
778
+ var schematic_trace = z26.object({
779
+ type: z26.literal("schematic_trace"),
780
+ schematic_trace_id: z26.string(),
781
+ source_trace_id: z26.string(),
782
+ edges: z26.array(
783
+ z26.object({
784
+ from: z26.object({
785
+ x: z26.number(),
786
+ y: z26.number()
834
787
  }),
835
- to: import_zod27.z.object({
836
- x: import_zod27.z.number(),
837
- y: import_zod27.z.number()
788
+ to: z26.object({
789
+ x: z26.number(),
790
+ y: z26.number()
838
791
  }),
839
- from_schematic_port_id: import_zod27.z.string().optional(),
840
- to_schematic_port_id: import_zod27.z.string().optional()
792
+ from_schematic_port_id: z26.string().optional(),
793
+ to_schematic_port_id: z26.string().optional()
841
794
  })
842
795
  )
843
796
  });
844
- var schematic_text = import_zod28.z.object({
845
- type: import_zod28.z.literal("schematic_text"),
846
- schematic_component_id: import_zod28.z.string(),
847
- schematic_text_id: import_zod28.z.string(),
848
- text: import_zod28.z.string(),
849
- position: import_zod28.z.object({
797
+ var schematic_text = z27.object({
798
+ type: z27.literal("schematic_text"),
799
+ schematic_component_id: z27.string(),
800
+ schematic_text_id: z27.string(),
801
+ text: z27.string(),
802
+ position: z27.object({
850
803
  x: distance,
851
804
  y: distance
852
805
  }),
853
- rotation: import_zod28.z.number().default(0),
854
- anchor: import_zod28.z.enum(["center", "left", "right", "top", "bottom"]).default("center")
855
- });
856
- var schematic_port = import_zod29.z.object({
857
- type: import_zod29.z.literal("schematic_port"),
858
- schematic_port_id: import_zod29.z.string(),
859
- source_port_id: import_zod29.z.string(),
860
- schematic_component_id: import_zod29.z.string().optional(),
806
+ rotation: z27.number().default(0),
807
+ anchor: z27.enum(["center", "left", "right", "top", "bottom"]).default("center")
808
+ });
809
+ var schematic_port = z28.object({
810
+ type: z28.literal("schematic_port"),
811
+ schematic_port_id: z28.string(),
812
+ source_port_id: z28.string(),
813
+ schematic_component_id: z28.string().optional(),
861
814
  center: point,
862
- facing_direction: import_zod29.z.enum(["up", "down", "left", "right"]).optional()
815
+ facing_direction: z28.enum(["up", "down", "left", "right"]).optional()
863
816
  }).describe("Defines a port on a schematic component");
864
- var schematic_net_label = import_zod30.z.object({
865
- type: import_zod30.z.literal("schematic_net_label"),
866
- source_net_id: import_zod30.z.string(),
817
+ var schematic_net_label = z29.object({
818
+ type: z29.literal("schematic_net_label"),
819
+ source_net_id: z29.string(),
867
820
  center: point,
868
- anchor_side: import_zod30.z.enum(["top", "bottom", "left", "right"]),
869
- text: import_zod30.z.string()
821
+ anchor_side: z29.enum(["top", "bottom", "left", "right"]),
822
+ text: z29.string()
870
823
  });
871
- var schematic_error = import_zod31.z.object({
872
- schematic_error_id: import_zod31.z.string(),
873
- type: import_zod31.z.literal("schematic_error"),
824
+ var schematic_error = z30.object({
825
+ schematic_error_id: z30.string(),
826
+ type: z30.literal("schematic_error"),
874
827
  // eventually each error type should be broken out into a dir of files
875
- error_type: import_zod31.z.literal("schematic_port_not_found"),
876
- message: import_zod31.z.string()
828
+ error_type: z30.literal("schematic_port_not_found"),
829
+ message: z30.string()
877
830
  }).describe("Defines a schematic error on the schematic");
878
831
  var all_layers = [
879
832
  "top",
@@ -885,9 +838,9 @@ var all_layers = [
885
838
  "inner5",
886
839
  "inner6"
887
840
  ];
888
- var layer_string = import_zod32.z.enum(all_layers);
841
+ var layer_string = z31.enum(all_layers);
889
842
  var layer_ref = layer_string.or(
890
- import_zod32.z.object({
843
+ z31.object({
891
844
  name: layer_string
892
845
  })
893
846
  ).transform((layer) => {
@@ -896,27 +849,27 @@ var layer_ref = layer_string.or(
896
849
  }
897
850
  return layer.name;
898
851
  });
899
- var visible_layer = import_zod32.z.enum(["top", "bottom"]);
900
- var pcb_route_hint = import_zod33.z.object({
852
+ var visible_layer = z31.enum(["top", "bottom"]);
853
+ var pcb_route_hint = z32.object({
901
854
  x: distance,
902
855
  y: distance,
903
- via: import_zod33.z.boolean().optional(),
856
+ via: z32.boolean().optional(),
904
857
  via_to_layer: layer_ref.optional()
905
858
  });
906
- var pcb_route_hints = import_zod33.z.array(pcb_route_hint);
907
- var route_hint_point = import_zod34.z.object({
859
+ var pcb_route_hints = z32.array(pcb_route_hint);
860
+ var route_hint_point = z33.object({
908
861
  x: distance,
909
862
  y: distance,
910
- via: import_zod34.z.boolean().optional(),
863
+ via: z33.boolean().optional(),
911
864
  to_layer: layer_ref.optional(),
912
865
  trace_width: distance.optional()
913
866
  });
914
867
  var expectTypesMatch = (shouldBe) => {
915
868
  };
916
- var pcb_component = import_zod35.z.object({
917
- type: import_zod35.z.literal("pcb_component"),
869
+ var pcb_component = z34.object({
870
+ type: z34.literal("pcb_component"),
918
871
  pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
919
- source_component_id: import_zod35.z.string(),
872
+ source_component_id: z34.string(),
920
873
  center: point,
921
874
  layer: layer_ref,
922
875
  rotation,
@@ -924,11 +877,11 @@ var pcb_component = import_zod35.z.object({
924
877
  height: length
925
878
  }).describe("Defines a component on the PCB");
926
879
  expectTypesMatch(true);
927
- var pcb_hole_circle_or_square = import_zod36.z.object({
928
- type: import_zod36.z.literal("pcb_hole"),
880
+ var pcb_hole_circle_or_square = z35.object({
881
+ type: z35.literal("pcb_hole"),
929
882
  pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
930
- hole_shape: import_zod36.z.enum(["circle", "square"]),
931
- hole_diameter: import_zod36.z.number(),
883
+ hole_shape: z35.enum(["circle", "square"]),
884
+ hole_diameter: z35.number(),
932
885
  x: distance,
933
886
  y: distance
934
887
  });
@@ -936,12 +889,12 @@ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
936
889
  "Defines a circular or square hole on the PCB"
937
890
  );
938
891
  expectTypesMatch(true);
939
- var pcb_hole_oval = import_zod36.z.object({
940
- type: import_zod36.z.literal("pcb_hole"),
892
+ var pcb_hole_oval = z35.object({
893
+ type: z35.literal("pcb_hole"),
941
894
  pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
942
- hole_shape: import_zod36.z.literal("oval"),
943
- hole_width: import_zod36.z.number(),
944
- hole_height: import_zod36.z.number(),
895
+ hole_shape: z35.literal("oval"),
896
+ hole_width: z35.number(),
897
+ hole_height: z35.number(),
945
898
  x: distance,
946
899
  y: distance
947
900
  });
@@ -950,35 +903,35 @@ var pcb_hole_oval_shape = pcb_hole_oval.describe(
950
903
  );
951
904
  expectTypesMatch(true);
952
905
  var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
953
- var pcb_plated_hole_circle = import_zod37.z.object({
954
- type: import_zod37.z.literal("pcb_plated_hole"),
955
- shape: import_zod37.z.literal("circle"),
956
- outer_diameter: import_zod37.z.number(),
957
- hole_diameter: import_zod37.z.number(),
906
+ var pcb_plated_hole_circle = z36.object({
907
+ type: z36.literal("pcb_plated_hole"),
908
+ shape: z36.literal("circle"),
909
+ outer_diameter: z36.number(),
910
+ hole_diameter: z36.number(),
958
911
  x: distance,
959
912
  y: distance,
960
- layers: import_zod37.z.array(layer_ref),
961
- port_hints: import_zod37.z.array(import_zod37.z.string()).optional(),
962
- pcb_component_id: import_zod37.z.string().optional(),
963
- pcb_port_id: import_zod37.z.string().optional(),
913
+ layers: z36.array(layer_ref),
914
+ port_hints: z36.array(z36.string()).optional(),
915
+ pcb_component_id: z36.string().optional(),
916
+ pcb_port_id: z36.string().optional(),
964
917
  pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
965
918
  });
966
- var pcb_plated_hole_oval = import_zod37.z.object({
967
- type: import_zod37.z.literal("pcb_plated_hole"),
968
- shape: import_zod37.z.enum(["oval", "pill"]),
969
- outer_width: import_zod37.z.number(),
970
- outer_height: import_zod37.z.number(),
971
- hole_width: import_zod37.z.number(),
972
- hole_height: import_zod37.z.number(),
919
+ var pcb_plated_hole_oval = z36.object({
920
+ type: z36.literal("pcb_plated_hole"),
921
+ shape: z36.enum(["oval", "pill"]),
922
+ outer_width: z36.number(),
923
+ outer_height: z36.number(),
924
+ hole_width: z36.number(),
925
+ hole_height: z36.number(),
973
926
  x: distance,
974
927
  y: distance,
975
- layers: import_zod37.z.array(layer_ref),
976
- port_hints: import_zod37.z.array(import_zod37.z.string()).optional(),
977
- pcb_component_id: import_zod37.z.string().optional(),
978
- pcb_port_id: import_zod37.z.string().optional(),
928
+ layers: z36.array(layer_ref),
929
+ port_hints: z36.array(z36.string()).optional(),
930
+ pcb_component_id: z36.string().optional(),
931
+ pcb_port_id: z36.string().optional(),
979
932
  pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
980
933
  });
981
- var pcb_plated_hole = import_zod37.z.union([
934
+ var pcb_plated_hole = z36.union([
982
935
  pcb_plated_hole_circle,
983
936
  pcb_plated_hole_oval
984
937
  ]);
@@ -986,154 +939,154 @@ expectTypesMatch(
986
939
  true
987
940
  );
988
941
  expectTypesMatch(true);
989
- var pcb_port = import_zod38.z.object({
990
- type: import_zod38.z.literal("pcb_port"),
942
+ var pcb_port = z37.object({
943
+ type: z37.literal("pcb_port"),
991
944
  pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
992
- source_port_id: import_zod38.z.string(),
993
- pcb_component_id: import_zod38.z.string(),
945
+ source_port_id: z37.string(),
946
+ pcb_component_id: z37.string(),
994
947
  x: distance,
995
948
  y: distance,
996
- layers: import_zod38.z.array(layer_ref)
949
+ layers: z37.array(layer_ref)
997
950
  }).describe("Defines a port on the PCB");
998
951
  expectTypesMatch(true);
999
- var pcb_smtpad_circle = import_zod39.z.object({
1000
- type: import_zod39.z.literal("pcb_smtpad"),
1001
- shape: import_zod39.z.literal("circle"),
952
+ var pcb_smtpad_circle = z38.object({
953
+ type: z38.literal("pcb_smtpad"),
954
+ shape: z38.literal("circle"),
1002
955
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
1003
956
  x: distance,
1004
957
  y: distance,
1005
- radius: import_zod39.z.number(),
958
+ radius: z38.number(),
1006
959
  layer: layer_ref,
1007
- port_hints: import_zod39.z.array(import_zod39.z.string()).optional(),
1008
- pcb_component_id: import_zod39.z.string().optional(),
1009
- pcb_port_id: import_zod39.z.string().optional()
960
+ port_hints: z38.array(z38.string()).optional(),
961
+ pcb_component_id: z38.string().optional(),
962
+ pcb_port_id: z38.string().optional()
1010
963
  });
1011
- var pcb_smtpad_rect = import_zod39.z.object({
1012
- type: import_zod39.z.literal("pcb_smtpad"),
1013
- shape: import_zod39.z.literal("rect"),
964
+ var pcb_smtpad_rect = z38.object({
965
+ type: z38.literal("pcb_smtpad"),
966
+ shape: z38.literal("rect"),
1014
967
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
1015
968
  x: distance,
1016
969
  y: distance,
1017
- width: import_zod39.z.number(),
1018
- height: import_zod39.z.number(),
970
+ width: z38.number(),
971
+ height: z38.number(),
1019
972
  layer: layer_ref,
1020
- port_hints: import_zod39.z.array(import_zod39.z.string()).optional(),
1021
- pcb_component_id: import_zod39.z.string().optional(),
1022
- pcb_port_id: import_zod39.z.string().optional()
973
+ port_hints: z38.array(z38.string()).optional(),
974
+ pcb_component_id: z38.string().optional(),
975
+ pcb_port_id: z38.string().optional()
1023
976
  });
1024
- var pcb_smtpad = import_zod39.z.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
977
+ var pcb_smtpad = z38.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
1025
978
  expectTypesMatch(true);
1026
979
  expectTypesMatch(true);
1027
- var pcb_solder_paste_circle = import_zod40.z.object({
1028
- type: import_zod40.z.literal("pcb_solder_paste"),
1029
- shape: import_zod40.z.literal("circle"),
980
+ var pcb_solder_paste_circle = z39.object({
981
+ type: z39.literal("pcb_solder_paste"),
982
+ shape: z39.literal("circle"),
1030
983
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
1031
984
  x: distance,
1032
985
  y: distance,
1033
- radius: import_zod40.z.number(),
986
+ radius: z39.number(),
1034
987
  layer: layer_ref,
1035
- pcb_component_id: import_zod40.z.string().optional(),
1036
- pcb_smtpad_id: import_zod40.z.string().optional()
988
+ pcb_component_id: z39.string().optional(),
989
+ pcb_smtpad_id: z39.string().optional()
1037
990
  });
1038
- var pcb_solder_paste_rect = import_zod40.z.object({
1039
- type: import_zod40.z.literal("pcb_solder_paste"),
1040
- shape: import_zod40.z.literal("rect"),
991
+ var pcb_solder_paste_rect = z39.object({
992
+ type: z39.literal("pcb_solder_paste"),
993
+ shape: z39.literal("rect"),
1041
994
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
1042
995
  x: distance,
1043
996
  y: distance,
1044
- width: import_zod40.z.number(),
1045
- height: import_zod40.z.number(),
997
+ width: z39.number(),
998
+ height: z39.number(),
1046
999
  layer: layer_ref,
1047
- pcb_component_id: import_zod40.z.string().optional(),
1048
- pcb_smtpad_id: import_zod40.z.string().optional()
1000
+ pcb_component_id: z39.string().optional(),
1001
+ pcb_smtpad_id: z39.string().optional()
1049
1002
  });
1050
- var pcb_solder_paste = import_zod40.z.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
1003
+ var pcb_solder_paste = z39.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
1051
1004
  expectTypesMatch(true);
1052
1005
  expectTypesMatch(true);
1053
- var pcb_text = import_zod41.z.object({
1054
- type: import_zod41.z.literal("pcb_text"),
1006
+ var pcb_text = z40.object({
1007
+ type: z40.literal("pcb_text"),
1055
1008
  pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
1056
- text: import_zod41.z.string(),
1009
+ text: z40.string(),
1057
1010
  center: point,
1058
1011
  layer: layer_ref,
1059
1012
  width: length,
1060
1013
  height: length,
1061
- lines: import_zod41.z.number(),
1062
- align: import_zod41.z.enum(["bottom-left"])
1014
+ lines: z40.number(),
1015
+ align: z40.enum(["bottom-left"])
1063
1016
  }).describe("Defines text on the PCB");
1064
1017
  expectTypesMatch(true);
1065
- var pcb_trace_route_point_wire = import_zod42.z.object({
1066
- route_type: import_zod42.z.literal("wire"),
1018
+ var pcb_trace_route_point_wire = z41.object({
1019
+ route_type: z41.literal("wire"),
1067
1020
  x: distance,
1068
1021
  y: distance,
1069
1022
  width: distance,
1070
- start_pcb_port_id: import_zod42.z.string().optional(),
1071
- end_pcb_port_id: import_zod42.z.string().optional(),
1023
+ start_pcb_port_id: z41.string().optional(),
1024
+ end_pcb_port_id: z41.string().optional(),
1072
1025
  layer: layer_ref
1073
1026
  });
1074
- var pcb_trace_route_point_via = import_zod42.z.object({
1075
- route_type: import_zod42.z.literal("via"),
1027
+ var pcb_trace_route_point_via = z41.object({
1028
+ route_type: z41.literal("via"),
1076
1029
  x: distance,
1077
1030
  y: distance,
1078
- from_layer: import_zod42.z.string(),
1079
- to_layer: import_zod42.z.string()
1031
+ from_layer: z41.string(),
1032
+ to_layer: z41.string()
1080
1033
  });
1081
- var pcb_trace_route_point = import_zod42.z.union([
1034
+ var pcb_trace_route_point = z41.union([
1082
1035
  pcb_trace_route_point_wire,
1083
1036
  pcb_trace_route_point_via
1084
1037
  ]);
1085
- var pcb_trace = import_zod42.z.object({
1086
- type: import_zod42.z.literal("pcb_trace"),
1087
- source_trace_id: import_zod42.z.string().optional(),
1088
- pcb_component_id: import_zod42.z.string().optional(),
1038
+ var pcb_trace = z41.object({
1039
+ type: z41.literal("pcb_trace"),
1040
+ source_trace_id: z41.string().optional(),
1041
+ pcb_component_id: z41.string().optional(),
1089
1042
  pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
1090
- route_thickness_mode: import_zod42.z.enum(["constant", "interpolated"]).default("constant").optional(),
1091
- route_order_index: import_zod42.z.number().optional(),
1092
- should_round_corners: import_zod42.z.boolean().optional(),
1093
- route: import_zod42.z.array(
1094
- import_zod42.z.union([
1095
- import_zod42.z.object({
1096
- route_type: import_zod42.z.literal("wire"),
1043
+ route_thickness_mode: z41.enum(["constant", "interpolated"]).default("constant").optional(),
1044
+ route_order_index: z41.number().optional(),
1045
+ should_round_corners: z41.boolean().optional(),
1046
+ route: z41.array(
1047
+ z41.union([
1048
+ z41.object({
1049
+ route_type: z41.literal("wire"),
1097
1050
  x: distance,
1098
1051
  y: distance,
1099
1052
  width: distance,
1100
- start_pcb_port_id: import_zod42.z.string().optional(),
1101
- end_pcb_port_id: import_zod42.z.string().optional(),
1053
+ start_pcb_port_id: z41.string().optional(),
1054
+ end_pcb_port_id: z41.string().optional(),
1102
1055
  layer: layer_ref
1103
1056
  }),
1104
- import_zod42.z.object({
1105
- route_type: import_zod42.z.literal("via"),
1057
+ z41.object({
1058
+ route_type: z41.literal("via"),
1106
1059
  x: distance,
1107
1060
  y: distance,
1108
- from_layer: import_zod42.z.string(),
1109
- to_layer: import_zod42.z.string()
1061
+ from_layer: z41.string(),
1062
+ to_layer: z41.string()
1110
1063
  })
1111
1064
  ])
1112
1065
  )
1113
1066
  }).describe("Defines a trace on the PCB");
1114
1067
  expectTypesMatch(true);
1115
1068
  expectTypesMatch(true);
1116
- var pcb_trace_error = import_zod43.z.object({
1117
- type: import_zod43.z.literal("pcb_trace_error"),
1069
+ var pcb_trace_error = z42.object({
1070
+ type: z42.literal("pcb_trace_error"),
1118
1071
  pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
1119
- error_type: import_zod43.z.literal("pcb_trace_error"),
1120
- message: import_zod43.z.string(),
1072
+ error_type: z42.literal("pcb_trace_error"),
1073
+ message: z42.string(),
1121
1074
  center: point.optional(),
1122
- pcb_trace_id: import_zod43.z.string(),
1123
- source_trace_id: import_zod43.z.string(),
1124
- pcb_component_ids: import_zod43.z.array(import_zod43.z.string()),
1125
- pcb_port_ids: import_zod43.z.array(import_zod43.z.string())
1075
+ pcb_trace_id: z42.string(),
1076
+ source_trace_id: z42.string(),
1077
+ pcb_component_ids: z42.array(z42.string()),
1078
+ pcb_port_ids: z42.array(z42.string())
1126
1079
  }).describe("Defines a trace error on the PCB");
1127
1080
  expectTypesMatch(true);
1128
- var pcb_port_not_matched_error = import_zod44.z.object({
1129
- type: import_zod44.z.literal("pcb_port_not_matched_error"),
1081
+ var pcb_port_not_matched_error = z43.object({
1082
+ type: z43.literal("pcb_port_not_matched_error"),
1130
1083
  pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
1131
- message: import_zod44.z.string(),
1132
- pcb_component_ids: import_zod44.z.array(import_zod44.z.string())
1084
+ message: z43.string(),
1085
+ pcb_component_ids: z43.array(z43.string())
1133
1086
  }).describe("Defines a trace error on the PCB where a port is not matched");
1134
1087
  expectTypesMatch(true);
1135
- var pcb_via = import_zod45.z.object({
1136
- type: import_zod45.z.literal("pcb_via"),
1088
+ var pcb_via = z44.object({
1089
+ type: z44.literal("pcb_via"),
1137
1090
  pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
1138
1091
  x: distance,
1139
1092
  y: distance,
@@ -1143,39 +1096,39 @@ var pcb_via = import_zod45.z.object({
1143
1096
  from_layer: layer_ref.optional(),
1144
1097
  /** @deprecated */
1145
1098
  to_layer: layer_ref.optional(),
1146
- layers: import_zod45.z.array(layer_ref),
1147
- pcb_trace_id: import_zod45.z.string().optional()
1099
+ layers: z44.array(layer_ref),
1100
+ pcb_trace_id: z44.string().optional()
1148
1101
  }).describe("Defines a via on the PCB");
1149
1102
  expectTypesMatch(true);
1150
- var pcb_board = import_zod46.z.object({
1151
- type: import_zod46.z.literal("pcb_board"),
1103
+ var pcb_board = z45.object({
1104
+ type: z45.literal("pcb_board"),
1152
1105
  pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
1153
1106
  width: length,
1154
1107
  height: length,
1155
1108
  center: point,
1156
1109
  thickness: length.optional().default(1.4),
1157
- num_layers: import_zod46.z.number().optional().default(4),
1158
- outline: import_zod46.z.array(point).optional()
1110
+ num_layers: z45.number().optional().default(4),
1111
+ outline: z45.array(point).optional()
1159
1112
  }).describe("Defines the board outline of the PCB");
1160
1113
  expectTypesMatch(true);
1161
- var pcb_placement_error = import_zod47.z.object({
1162
- type: import_zod47.z.literal("pcb_placement_error"),
1114
+ var pcb_placement_error = z46.object({
1115
+ type: z46.literal("pcb_placement_error"),
1163
1116
  pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
1164
- message: import_zod47.z.string()
1117
+ message: z46.string()
1165
1118
  }).describe("Defines a placement error on the PCB");
1166
1119
  expectTypesMatch(true);
1167
- var pcb_trace_hint = import_zod48.z.object({
1168
- type: import_zod48.z.literal("pcb_trace_hint"),
1120
+ var pcb_trace_hint = z47.object({
1121
+ type: z47.literal("pcb_trace_hint"),
1169
1122
  pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
1170
- pcb_port_id: import_zod48.z.string(),
1171
- pcb_component_id: import_zod48.z.string(),
1172
- route: import_zod48.z.array(route_hint_point)
1123
+ pcb_port_id: z47.string(),
1124
+ pcb_component_id: z47.string(),
1125
+ route: z47.array(route_hint_point)
1173
1126
  }).describe("A hint that can be used during generation of a PCB trace");
1174
1127
  expectTypesMatch(true);
1175
- var pcb_silkscreen_line = import_zod49.z.object({
1176
- type: import_zod49.z.literal("pcb_silkscreen_line"),
1128
+ var pcb_silkscreen_line = z48.object({
1129
+ type: z48.literal("pcb_silkscreen_line"),
1177
1130
  pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
1178
- pcb_component_id: import_zod49.z.string(),
1131
+ pcb_component_id: z48.string(),
1179
1132
  stroke_width: distance.default("0.1mm"),
1180
1133
  x1: distance,
1181
1134
  y1: distance,
@@ -1184,131 +1137,131 @@ var pcb_silkscreen_line = import_zod49.z.object({
1184
1137
  layer: visible_layer
1185
1138
  }).describe("Defines a silkscreen line on the PCB");
1186
1139
  expectTypesMatch(true);
1187
- var pcb_silkscreen_path = import_zod50.z.object({
1188
- type: import_zod50.z.literal("pcb_silkscreen_path"),
1140
+ var pcb_silkscreen_path = z49.object({
1141
+ type: z49.literal("pcb_silkscreen_path"),
1189
1142
  pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
1190
- pcb_component_id: import_zod50.z.string(),
1143
+ pcb_component_id: z49.string(),
1191
1144
  layer: visible_layer,
1192
- route: import_zod50.z.array(point),
1145
+ route: z49.array(point),
1193
1146
  stroke_width: length
1194
1147
  }).describe("Defines a silkscreen path on the PCB");
1195
1148
  expectTypesMatch(true);
1196
- var pcb_silkscreen_text = import_zod51.z.object({
1197
- type: import_zod51.z.literal("pcb_silkscreen_text"),
1149
+ var pcb_silkscreen_text = z50.object({
1150
+ type: z50.literal("pcb_silkscreen_text"),
1198
1151
  pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
1199
- font: import_zod51.z.literal("tscircuit2024").default("tscircuit2024"),
1152
+ font: z50.literal("tscircuit2024").default("tscircuit2024"),
1200
1153
  font_size: distance.default("0.2mm"),
1201
- pcb_component_id: import_zod51.z.string(),
1202
- text: import_zod51.z.string(),
1154
+ pcb_component_id: z50.string(),
1155
+ text: z50.string(),
1203
1156
  layer: layer_ref,
1204
- is_mirrored: import_zod51.z.boolean().default(false).optional(),
1157
+ is_mirrored: z50.boolean().default(false).optional(),
1205
1158
  anchor_position: point.default({ x: 0, y: 0 }),
1206
- anchor_alignment: import_zod51.z.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
1159
+ anchor_alignment: z50.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
1207
1160
  }).describe("Defines silkscreen text on the PCB");
1208
1161
  expectTypesMatch(true);
1209
- var pcb_silkscreen_rect = import_zod52.z.object({
1210
- type: import_zod52.z.literal("pcb_silkscreen_rect"),
1162
+ var pcb_silkscreen_rect = z51.object({
1163
+ type: z51.literal("pcb_silkscreen_rect"),
1211
1164
  pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
1212
- pcb_component_id: import_zod52.z.string(),
1165
+ pcb_component_id: z51.string(),
1213
1166
  center: point,
1214
1167
  width: length,
1215
1168
  height: length,
1216
1169
  layer: layer_ref
1217
1170
  }).describe("Defines a silkscreen rect on the PCB");
1218
1171
  expectTypesMatch(true);
1219
- var pcb_silkscreen_circle = import_zod53.z.object({
1220
- type: import_zod53.z.literal("pcb_silkscreen_circle"),
1172
+ var pcb_silkscreen_circle = z52.object({
1173
+ type: z52.literal("pcb_silkscreen_circle"),
1221
1174
  pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
1222
1175
  "pcb_silkscreen_circle"
1223
1176
  ),
1224
- pcb_component_id: import_zod53.z.string(),
1177
+ pcb_component_id: z52.string(),
1225
1178
  center: point,
1226
1179
  radius: length,
1227
1180
  layer: visible_layer
1228
1181
  }).describe("Defines a silkscreen circle on the PCB");
1229
1182
  expectTypesMatch(true);
1230
- var pcb_silkscreen_oval = import_zod54.z.object({
1231
- type: import_zod54.z.literal("pcb_silkscreen_oval"),
1183
+ var pcb_silkscreen_oval = z53.object({
1184
+ type: z53.literal("pcb_silkscreen_oval"),
1232
1185
  pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
1233
- pcb_component_id: import_zod54.z.string(),
1186
+ pcb_component_id: z53.string(),
1234
1187
  center: point,
1235
1188
  radius_x: distance,
1236
1189
  radius_y: distance,
1237
1190
  layer: visible_layer
1238
1191
  }).describe("Defines a silkscreen oval on the PCB");
1239
1192
  expectTypesMatch(true);
1240
- var pcb_fabrication_note_text = import_zod55.z.object({
1241
- type: import_zod55.z.literal("pcb_fabrication_note_text"),
1193
+ var pcb_fabrication_note_text = z54.object({
1194
+ type: z54.literal("pcb_fabrication_note_text"),
1242
1195
  pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
1243
1196
  "pcb_fabrication_note_text"
1244
1197
  ),
1245
- font: import_zod55.z.literal("tscircuit2024").default("tscircuit2024"),
1198
+ font: z54.literal("tscircuit2024").default("tscircuit2024"),
1246
1199
  font_size: distance.default("1mm"),
1247
- pcb_component_id: import_zod55.z.string(),
1248
- text: import_zod55.z.string(),
1200
+ pcb_component_id: z54.string(),
1201
+ text: z54.string(),
1249
1202
  layer: visible_layer,
1250
1203
  anchor_position: point.default({ x: 0, y: 0 }),
1251
- anchor_alignment: import_zod55.z.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
1252
- color: import_zod55.z.string().optional()
1204
+ anchor_alignment: z54.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
1205
+ color: z54.string().optional()
1253
1206
  }).describe(
1254
1207
  "Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
1255
1208
  );
1256
1209
  expectTypesMatch(true);
1257
- var pcb_fabrication_note_path = import_zod56.z.object({
1258
- type: import_zod56.z.literal("pcb_fabrication_note_path"),
1210
+ var pcb_fabrication_note_path = z55.object({
1211
+ type: z55.literal("pcb_fabrication_note_path"),
1259
1212
  pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
1260
1213
  "pcb_fabrication_note_path"
1261
1214
  ),
1262
- pcb_component_id: import_zod56.z.string(),
1215
+ pcb_component_id: z55.string(),
1263
1216
  layer: layer_ref,
1264
- route: import_zod56.z.array(point),
1217
+ route: z55.array(point),
1265
1218
  stroke_width: length,
1266
- color: import_zod56.z.string().optional()
1219
+ color: z55.string().optional()
1267
1220
  }).describe(
1268
1221
  "Defines a fabrication path on the PCB for fabricators or assemblers"
1269
1222
  );
1270
1223
  expectTypesMatch(true);
1271
- var pcb_keepout = import_zod57.z.object({
1272
- type: import_zod57.z.literal("pcb_keepout"),
1273
- shape: import_zod57.z.literal("rect"),
1224
+ var pcb_keepout = z56.object({
1225
+ type: z56.literal("pcb_keepout"),
1226
+ shape: z56.literal("rect"),
1274
1227
  center: point,
1275
1228
  width: distance,
1276
1229
  height: distance,
1277
- pcb_keepout_id: import_zod57.z.string(),
1278
- layers: import_zod57.z.array(import_zod57.z.string()),
1230
+ pcb_keepout_id: z56.string(),
1231
+ layers: z56.array(z56.string()),
1279
1232
  // Specify layers where the keepout applies
1280
- description: import_zod57.z.string().optional()
1233
+ description: z56.string().optional()
1281
1234
  // Optional description of the keepout
1282
1235
  }).or(
1283
- import_zod57.z.object({
1284
- type: import_zod57.z.literal("pcb_keepout"),
1285
- shape: import_zod57.z.literal("circle"),
1236
+ z56.object({
1237
+ type: z56.literal("pcb_keepout"),
1238
+ shape: z56.literal("circle"),
1286
1239
  center: point,
1287
1240
  radius: distance,
1288
- pcb_keepout_id: import_zod57.z.string(),
1289
- layers: import_zod57.z.array(import_zod57.z.string()),
1241
+ pcb_keepout_id: z56.string(),
1242
+ layers: z56.array(z56.string()),
1290
1243
  // Specify layers where the keepout applies
1291
- description: import_zod57.z.string().optional()
1244
+ description: z56.string().optional()
1292
1245
  // Optional description of the keepout
1293
1246
  })
1294
1247
  );
1295
- var cad_component = import_zod58.z.object({
1296
- type: import_zod58.z.literal("cad_component"),
1297
- cad_component_id: import_zod58.z.string(),
1298
- pcb_component_id: import_zod58.z.string(),
1299
- source_component_id: import_zod58.z.string(),
1248
+ var cad_component = z57.object({
1249
+ type: z57.literal("cad_component"),
1250
+ cad_component_id: z57.string(),
1251
+ pcb_component_id: z57.string(),
1252
+ source_component_id: z57.string(),
1300
1253
  position: point3,
1301
1254
  rotation: point3.optional(),
1302
1255
  size: point3.optional(),
1303
1256
  layer: layer_ref.optional(),
1304
1257
  // These are all ways to generate/load the 3d model
1305
- footprinter_string: import_zod58.z.string().optional(),
1306
- model_obj_url: import_zod58.z.string().optional(),
1307
- model_stl_url: import_zod58.z.string().optional(),
1308
- model_3mf_url: import_zod58.z.string().optional(),
1309
- model_jscad: import_zod58.z.any().optional()
1258
+ footprinter_string: z57.string().optional(),
1259
+ model_obj_url: z57.string().optional(),
1260
+ model_stl_url: z57.string().optional(),
1261
+ model_3mf_url: z57.string().optional(),
1262
+ model_jscad: z57.any().optional()
1310
1263
  }).describe("Defines a component on the PCB");
1311
- var any_circuit_element = import_zod59.z.union([
1264
+ var any_circuit_element = z58.union([
1312
1265
  source_trace,
1313
1266
  source_port,
1314
1267
  any_source_component,
@@ -1403,7 +1356,7 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
1403
1356
  }
1404
1357
 
1405
1358
  // node_modules/@tscircuit/soup-util/dist/index.js
1406
- var import_transformation_matrix = require("transformation-matrix");
1359
+ import { applyToPoint, decomposeTSR } from "transformation-matrix";
1407
1360
  var su = (soup, options = {}) => {
1408
1361
  let internalStore = soup._internal_store;
1409
1362
  if (!internalStore) {
@@ -1539,18 +1492,18 @@ su.unparsed = su;
1539
1492
  var su_default = su;
1540
1493
  var transformPCBElement = (elm, matrix) => {
1541
1494
  if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
1542
- const { x, y } = (0, import_transformation_matrix.applyToPoint)(matrix, { x: elm.x, y: elm.y });
1495
+ const { x, y } = applyToPoint(matrix, { x: elm.x, y: elm.y });
1543
1496
  elm.x = x;
1544
1497
  elm.y = y;
1545
1498
  } else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
1546
- elm.center = (0, import_transformation_matrix.applyToPoint)(matrix, elm.center);
1499
+ elm.center = applyToPoint(matrix, elm.center);
1547
1500
  } else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text") {
1548
- elm.anchor_position = (0, import_transformation_matrix.applyToPoint)(matrix, elm.anchor_position);
1501
+ elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
1549
1502
  } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_component") {
1550
- elm.center = (0, import_transformation_matrix.applyToPoint)(matrix, elm.center);
1503
+ elm.center = applyToPoint(matrix, elm.center);
1551
1504
  } else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path") {
1552
1505
  elm.route = elm.route.map((rp) => {
1553
- const tp = (0, import_transformation_matrix.applyToPoint)(matrix, rp);
1506
+ const tp = applyToPoint(matrix, rp);
1554
1507
  rp.x = tp.x;
1555
1508
  rp.y = tp.y;
1556
1509
  return rp;
@@ -1558,14 +1511,14 @@ var transformPCBElement = (elm, matrix) => {
1558
1511
  } else if (elm.type === "pcb_silkscreen_line") {
1559
1512
  const p1 = { x: elm.x1, y: elm.y1 };
1560
1513
  const p2 = { x: elm.x2, y: elm.y2 };
1561
- const p1t = (0, import_transformation_matrix.applyToPoint)(matrix, p1);
1562
- const p2t = (0, import_transformation_matrix.applyToPoint)(matrix, p2);
1514
+ const p1t = applyToPoint(matrix, p1);
1515
+ const p2t = applyToPoint(matrix, p2);
1563
1516
  elm.x1 = p1t.x;
1564
1517
  elm.y1 = p1t.y;
1565
1518
  elm.x2 = p2t.x;
1566
1519
  elm.y2 = p2t.y;
1567
1520
  } else if (elm.type === "cad_component") {
1568
- const newPos = (0, import_transformation_matrix.applyToPoint)(matrix, {
1521
+ const newPos = applyToPoint(matrix, {
1569
1522
  x: elm.position.x,
1570
1523
  y: elm.position.y
1571
1524
  });
@@ -1575,7 +1528,7 @@ var transformPCBElement = (elm, matrix) => {
1575
1528
  return elm;
1576
1529
  };
1577
1530
  var transformPCBElements = (elms, matrix) => {
1578
- const tsr = (0, import_transformation_matrix.decomposeTSR)(matrix);
1531
+ const tsr = decomposeTSR(matrix);
1579
1532
  const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
1580
1533
  let transformedElms = elms.map((elm) => transformPCBElement(elm, matrix));
1581
1534
  if (flipPadWidthHeight) {
@@ -1591,18 +1544,18 @@ var transformPCBElements = (elms, matrix) => {
1591
1544
  };
1592
1545
 
1593
1546
  // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
1594
- var import_transformation_matrix2 = require("transformation-matrix");
1547
+ import { scale, translate } from "transformation-matrix";
1595
1548
 
1596
1549
  // lib/compute-center-offset.ts
1597
- var import_mm = require("@tscircuit/mm");
1550
+ import { mm } from "@tscircuit/mm";
1598
1551
  var computeCenterOffset = (easyeda) => {
1599
1552
  const pads = easyeda.packageDetail.dataStr.shape.filter(
1600
1553
  (shape) => shape.type === "PAD"
1601
1554
  );
1602
- const minX = Math.min(...pads.map((pad) => (0, import_mm.mm)(pad.center.x)));
1603
- const maxX = Math.max(...pads.map((pad) => (0, import_mm.mm)(pad.center.x)));
1604
- const minY = Math.min(...pads.map((pad) => (0, import_mm.mm)(pad.center.y)));
1605
- const maxY = Math.max(...pads.map((pad) => (0, import_mm.mm)(pad.center.y)));
1555
+ const minX = Math.min(...pads.map((pad) => mm(pad.center.x)));
1556
+ const maxX = Math.max(...pads.map((pad) => mm(pad.center.x)));
1557
+ const minY = Math.min(...pads.map((pad) => mm(pad.center.y)));
1558
+ const maxY = Math.max(...pads.map((pad) => mm(pad.center.y)));
1606
1559
  const centerX = (minX + maxX) / 2;
1607
1560
  const centerY = (minY + maxY) / 2;
1608
1561
  return {
@@ -1612,7 +1565,7 @@ var computeCenterOffset = (easyeda) => {
1612
1565
  };
1613
1566
 
1614
1567
  // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
1615
- var import_mm2 = require("@tscircuit/mm");
1568
+ import { mm as mm2 } from "@tscircuit/mm";
1616
1569
  var handleSilkscreenPath = (track, index) => {
1617
1570
  return pcb_silkscreen_path.parse({
1618
1571
  type: "pcb_silkscreen_path",
@@ -1676,17 +1629,17 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1676
1629
  source_component_id: "source_component_1",
1677
1630
  name: portNumber
1678
1631
  });
1679
- if (pad.holeRadius !== void 0 && (0, import_mm2.mm)(pad.holeRadius) !== 0) {
1632
+ if (pad.holeRadius !== void 0 && mm2(pad.holeRadius) !== 0) {
1680
1633
  soupElements.push(
1681
1634
  pcb_plated_hole.parse({
1682
1635
  type: "pcb_plated_hole",
1683
1636
  pcb_plated_hole_id: `pcb_plated_hole_${index + 1}`,
1684
1637
  shape: "circle",
1685
- x: (0, import_mm2.mm)(pad.center.x),
1686
- y: (0, import_mm2.mm)(pad.center.y),
1687
- hole_diameter: (0, import_mm2.mm)(pad.holeRadius) * 2,
1688
- outer_diameter: (0, import_mm2.mm)(pad.width),
1689
- radius: (0, import_mm2.mm)(pad.holeRadius),
1638
+ x: mm2(pad.center.x),
1639
+ y: mm2(pad.center.y),
1640
+ hole_diameter: mm2(pad.holeRadius) * 2,
1641
+ outer_diameter: mm2(pad.width),
1642
+ radius: mm2(pad.holeRadius),
1690
1643
  port_hints: [portNumber],
1691
1644
  pcb_component_id: "pcb_component_1",
1692
1645
  pcb_port_id: `pcb_port_${index + 1}`,
@@ -1710,9 +1663,9 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1710
1663
  type: "pcb_smtpad",
1711
1664
  pcb_smtpad_id: `pcb_smtpad_${index + 1}`,
1712
1665
  shape: soupShape,
1713
- x: (0, import_mm2.mm)(pad.center.x),
1714
- y: (0, import_mm2.mm)(pad.center.y),
1715
- ...soupShape === "rect" ? { width: (0, import_mm2.mm)(pad.width), height: (0, import_mm2.mm)(pad.height) } : { radius: Math.min((0, import_mm2.mm)(pad.width), (0, import_mm2.mm)(pad.height)) / 2 },
1666
+ x: mm2(pad.center.x),
1667
+ y: mm2(pad.center.y),
1668
+ ...soupShape === "rect" ? { width: mm2(pad.width), height: mm2(pad.height) } : { radius: Math.min(mm2(pad.width), mm2(pad.height)) / 2 },
1716
1669
  layer: "top",
1717
1670
  port_hints: [portNumber],
1718
1671
  pcb_component_id: "pcb_component_1",
@@ -1728,7 +1681,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1728
1681
  soupElements.push(handleSilkscreenArc(shape, index));
1729
1682
  }
1730
1683
  });
1731
- transformPCBElements(soupElements, (0, import_transformation_matrix2.scale)(1, -1));
1684
+ transformPCBElements(soupElements, scale(1, -1));
1732
1685
  const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
1733
1686
  (a) => Boolean(a.type === "SVGNODE" && a.svgData.attrs?.uuid)
1734
1687
  );
@@ -1751,7 +1704,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1751
1704
  if (shouldRecenter) {
1752
1705
  transformPCBElements(
1753
1706
  soupElements,
1754
- (0, import_transformation_matrix2.translate)(-centerOffset.x, centerOffset.y)
1707
+ translate(-centerOffset.x, centerOffset.y)
1755
1708
  );
1756
1709
  }
1757
1710
  return soupElements;
@@ -1807,22 +1760,22 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber) {
1807
1760
  }
1808
1761
 
1809
1762
  // lib/schemas/easy-eda-json-schema.ts
1810
- var import_zod62 = require("zod");
1763
+ import { z as z61 } from "zod";
1811
1764
 
1812
1765
  // lib/schemas/single-letter-shape-schema.ts
1813
- var import_zod61 = require("zod");
1814
- var PointSchema2 = import_zod61.z.object({
1815
- x: import_zod61.z.number(),
1816
- y: import_zod61.z.number()
1766
+ import { z as z60 } from "zod";
1767
+ var PointSchema2 = z60.object({
1768
+ x: z60.number(),
1769
+ y: z60.number()
1817
1770
  });
1818
- var RectangleShapeOutputSchema = import_zod61.z.object({
1819
- type: import_zod61.z.literal("RECTANGLE"),
1771
+ var RectangleShapeOutputSchema = z60.object({
1772
+ type: z60.literal("RECTANGLE"),
1820
1773
  position: PointSchema2,
1821
- width: import_zod61.z.number(),
1822
- height: import_zod61.z.number(),
1823
- color: import_zod61.z.string(),
1824
- lineWidth: import_zod61.z.number(),
1825
- id: import_zod61.z.string()
1774
+ width: z60.number(),
1775
+ height: z60.number(),
1776
+ color: z60.string(),
1777
+ lineWidth: z60.number(),
1778
+ id: z60.string()
1826
1779
  });
1827
1780
  var parseRectangle = (str) => {
1828
1781
  const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
@@ -1836,15 +1789,15 @@ var parseRectangle = (str) => {
1836
1789
  id
1837
1790
  };
1838
1791
  };
1839
- var RectangleShapeSchema = import_zod61.z.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
1840
- var EllipseShapeOutputSchema = import_zod61.z.object({
1841
- type: import_zod61.z.literal("ELLIPSE"),
1792
+ var RectangleShapeSchema = z60.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
1793
+ var EllipseShapeOutputSchema = z60.object({
1794
+ type: z60.literal("ELLIPSE"),
1842
1795
  center: PointSchema2,
1843
- radiusX: import_zod61.z.number(),
1844
- radiusY: import_zod61.z.number(),
1845
- color: import_zod61.z.string(),
1846
- lineWidth: import_zod61.z.number(),
1847
- id: import_zod61.z.string()
1796
+ radiusX: z60.number(),
1797
+ radiusY: z60.number(),
1798
+ color: z60.string(),
1799
+ lineWidth: z60.number(),
1800
+ id: z60.string()
1848
1801
  });
1849
1802
  var parseEllipse = (str) => {
1850
1803
  const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
@@ -1858,19 +1811,19 @@ var parseEllipse = (str) => {
1858
1811
  id
1859
1812
  };
1860
1813
  };
1861
- var EllipseShapeSchema = import_zod61.z.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
1862
- var PinShapeOutputSchema = import_zod61.z.object({
1863
- type: import_zod61.z.literal("PIN"),
1864
- visibility: import_zod61.z.enum(["show", "hide"]),
1865
- pinNumber: import_zod61.z.number(),
1866
- x: import_zod61.z.number(),
1867
- y: import_zod61.z.number(),
1868
- rotation: import_zod61.z.number(),
1869
- id: import_zod61.z.string(),
1870
- label: import_zod61.z.string(),
1871
- labelColor: import_zod61.z.string(),
1872
- path: import_zod61.z.string(),
1873
- arrow: import_zod61.z.string()
1814
+ var EllipseShapeSchema = z60.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
1815
+ var PinShapeOutputSchema = z60.object({
1816
+ type: z60.literal("PIN"),
1817
+ visibility: z60.enum(["show", "hide"]),
1818
+ pinNumber: z60.number(),
1819
+ x: z60.number(),
1820
+ y: z60.number(),
1821
+ rotation: z60.number(),
1822
+ id: z60.string(),
1823
+ label: z60.string(),
1824
+ labelColor: z60.string(),
1825
+ path: z60.string(),
1826
+ arrow: z60.string()
1874
1827
  });
1875
1828
  var parsePin = (pinString) => {
1876
1829
  const parts = pinString.split("~");
@@ -1897,13 +1850,13 @@ var parsePin = (pinString) => {
1897
1850
  arrow
1898
1851
  };
1899
1852
  };
1900
- var PinShapeSchema = import_zod61.z.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
1901
- var PolylineShapeOutputSchema = import_zod61.z.object({
1902
- type: import_zod61.z.literal("POLYLINE"),
1903
- points: import_zod61.z.array(PointSchema2),
1904
- color: import_zod61.z.string(),
1905
- lineWidth: import_zod61.z.number(),
1906
- id: import_zod61.z.string()
1853
+ var PinShapeSchema = z60.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
1854
+ var PolylineShapeOutputSchema = z60.object({
1855
+ type: z60.literal("POLYLINE"),
1856
+ points: z60.array(PointSchema2),
1857
+ color: z60.string(),
1858
+ lineWidth: z60.number(),
1859
+ id: z60.string()
1907
1860
  });
1908
1861
  var parsePoints2 = (pointsStr) => {
1909
1862
  return pointsStr.split(" ").reduce((acc, value, index) => {
@@ -1926,14 +1879,14 @@ var parsePolyline = (str) => {
1926
1879
  id
1927
1880
  };
1928
1881
  };
1929
- var PolylineShapeSchema = import_zod61.z.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
1930
- var PolygonShapeOutputSchema = import_zod61.z.object({
1931
- type: import_zod61.z.literal("POLYGON"),
1932
- points: import_zod61.z.array(PointSchema2),
1933
- fillColor: import_zod61.z.string(),
1934
- lineWidth: import_zod61.z.number(),
1935
- lineColor: import_zod61.z.string(),
1936
- id: import_zod61.z.string()
1882
+ var PolylineShapeSchema = z60.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
1883
+ var PolygonShapeOutputSchema = z60.object({
1884
+ type: z60.literal("POLYGON"),
1885
+ points: z60.array(PointSchema2),
1886
+ fillColor: z60.string(),
1887
+ lineWidth: z60.number(),
1888
+ lineColor: z60.string(),
1889
+ id: z60.string()
1937
1890
  });
1938
1891
  var parsePolygon = (str) => {
1939
1892
  const [, ...rest] = str.split("~");
@@ -1947,8 +1900,8 @@ var parsePolygon = (str) => {
1947
1900
  id
1948
1901
  };
1949
1902
  };
1950
- var PolygonShapeSchema = import_zod61.z.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
1951
- var SingleLetterShapeSchema = import_zod61.z.string().transform((x) => {
1903
+ var PolygonShapeSchema = z60.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
1904
+ var SingleLetterShapeSchema = z60.string().transform((x) => {
1952
1905
  if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
1953
1906
  if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
1954
1907
  if (x.startsWith("P~")) return PinShapeSchema.parse(x);
@@ -1956,7 +1909,7 @@ var SingleLetterShapeSchema = import_zod61.z.string().transform((x) => {
1956
1909
  if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
1957
1910
  throw new Error(`Invalid shape type: ${x}`);
1958
1911
  }).pipe(
1959
- import_zod61.z.union([
1912
+ z60.union([
1960
1913
  RectangleShapeOutputSchema,
1961
1914
  EllipseShapeOutputSchema,
1962
1915
  PinShapeOutputSchema,
@@ -1966,81 +1919,81 @@ var SingleLetterShapeSchema = import_zod61.z.string().transform((x) => {
1966
1919
  );
1967
1920
 
1968
1921
  // lib/schemas/easy-eda-json-schema.ts
1969
- var maybeNumber = import_zod62.z.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(import_zod62.z.number().nullable().optional());
1970
- var SzlcscSchema = import_zod62.z.object({
1971
- id: import_zod62.z.number(),
1972
- number: import_zod62.z.string(),
1973
- step: import_zod62.z.number().optional(),
1974
- min: import_zod62.z.number().optional(),
1975
- price: import_zod62.z.number().optional(),
1976
- stock: import_zod62.z.number().optional(),
1977
- url: import_zod62.z.string().url().optional(),
1978
- image: import_zod62.z.string().optional().optional()
1979
- });
1980
- var LcscSchema = import_zod62.z.object({
1981
- id: import_zod62.z.number(),
1982
- number: import_zod62.z.string(),
1983
- step: import_zod62.z.number().optional(),
1984
- min: import_zod62.z.number().optional(),
1985
- price: import_zod62.z.number().optional(),
1986
- stock: import_zod62.z.number().optional(),
1987
- url: import_zod62.z.string().url().optional()
1988
- });
1989
- var OwnerSchema = import_zod62.z.object({
1990
- uuid: import_zod62.z.string(),
1991
- username: import_zod62.z.string(),
1992
- nickname: import_zod62.z.string(),
1993
- avatar: import_zod62.z.string()
1994
- });
1995
- var HeadSchema = import_zod62.z.object({
1996
- docType: import_zod62.z.string(),
1997
- editorVersion: import_zod62.z.string(),
1998
- c_para: import_zod62.z.record(import_zod62.z.string(), import_zod62.z.string()),
1999
- x: import_zod62.z.number(),
2000
- y: import_zod62.z.number(),
2001
- puuid: import_zod62.z.string().optional(),
2002
- uuid: import_zod62.z.string(),
2003
- utime: import_zod62.z.number(),
2004
- importFlag: import_zod62.z.number(),
2005
- c_spiceCmd: import_zod62.z.any().optional(),
2006
- hasIdFlag: import_zod62.z.boolean()
2007
- });
2008
- var BBoxSchema = import_zod62.z.object({
2009
- x: import_zod62.z.number(),
2010
- y: import_zod62.z.number(),
2011
- width: import_zod62.z.number(),
2012
- height: import_zod62.z.number()
2013
- });
2014
- var LayerItemSchema = import_zod62.z.object({
2015
- name: import_zod62.z.string(),
2016
- color: import_zod62.z.string(),
2017
- visible: import_zod62.z.boolean(),
2018
- active: import_zod62.z.boolean(),
2019
- config: import_zod62.z.boolean(),
2020
- transparency: import_zod62.z.boolean()
2021
- });
2022
- var ObjectItemSchema = import_zod62.z.object({
2023
- name: import_zod62.z.string(),
2024
- visible: import_zod62.z.boolean(),
2025
- locked: import_zod62.z.boolean()
2026
- });
2027
- var DataStrSchema = import_zod62.z.object({
1922
+ var maybeNumber = z61.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(z61.number().nullable().optional());
1923
+ var SzlcscSchema = z61.object({
1924
+ id: z61.number(),
1925
+ number: z61.string(),
1926
+ step: z61.number().optional(),
1927
+ min: z61.number().optional(),
1928
+ price: z61.number().optional(),
1929
+ stock: z61.number().optional(),
1930
+ url: z61.string().url().optional(),
1931
+ image: z61.string().optional().optional()
1932
+ });
1933
+ var LcscSchema = z61.object({
1934
+ id: z61.number(),
1935
+ number: z61.string(),
1936
+ step: z61.number().optional(),
1937
+ min: z61.number().optional(),
1938
+ price: z61.number().optional(),
1939
+ stock: z61.number().optional(),
1940
+ url: z61.string().url().optional()
1941
+ });
1942
+ var OwnerSchema = z61.object({
1943
+ uuid: z61.string(),
1944
+ username: z61.string(),
1945
+ nickname: z61.string(),
1946
+ avatar: z61.string()
1947
+ });
1948
+ var HeadSchema = z61.object({
1949
+ docType: z61.string(),
1950
+ editorVersion: z61.string(),
1951
+ c_para: z61.record(z61.string(), z61.string()),
1952
+ x: z61.number(),
1953
+ y: z61.number(),
1954
+ puuid: z61.string().optional(),
1955
+ uuid: z61.string(),
1956
+ utime: z61.number(),
1957
+ importFlag: z61.number(),
1958
+ c_spiceCmd: z61.any().optional(),
1959
+ hasIdFlag: z61.boolean()
1960
+ });
1961
+ var BBoxSchema = z61.object({
1962
+ x: z61.number(),
1963
+ y: z61.number(),
1964
+ width: z61.number(),
1965
+ height: z61.number()
1966
+ });
1967
+ var LayerItemSchema = z61.object({
1968
+ name: z61.string(),
1969
+ color: z61.string(),
1970
+ visible: z61.boolean(),
1971
+ active: z61.boolean(),
1972
+ config: z61.boolean(),
1973
+ transparency: z61.boolean()
1974
+ });
1975
+ var ObjectItemSchema = z61.object({
1976
+ name: z61.string(),
1977
+ visible: z61.boolean(),
1978
+ locked: z61.boolean()
1979
+ });
1980
+ var DataStrSchema = z61.object({
2028
1981
  head: HeadSchema,
2029
- canvas: import_zod62.z.string(),
2030
- shape: import_zod62.z.array(SingleLetterShapeSchema),
1982
+ canvas: z61.string(),
1983
+ shape: z61.array(SingleLetterShapeSchema),
2031
1984
  BBox: BBoxSchema,
2032
- colors: import_zod62.z.array(import_zod62.z.unknown())
1985
+ colors: z61.array(z61.unknown())
2033
1986
  });
2034
- var PackageDetailDataStrSchema = import_zod62.z.object({
1987
+ var PackageDetailDataStrSchema = z61.object({
2035
1988
  head: HeadSchema,
2036
- canvas: import_zod62.z.string(),
2037
- shape: import_zod62.z.array(import_zod62.z.string()).transform(
1989
+ canvas: z61.string(),
1990
+ shape: z61.array(z61.string()).transform(
2038
1991
  (shapes) => shapes.map((shape) => {
2039
1992
  const [type, ...data] = shape.split("~");
2040
1993
  return ShapeItemSchema.parse({ type, data: data.join("~") });
2041
1994
  })
2042
- ).pipe(import_zod62.z.array(PackageDetailShapeSchema)),
2043
- layers: import_zod62.z.array(import_zod62.z.string()).transform(
1995
+ ).pipe(z61.array(PackageDetailShapeSchema)),
1996
+ layers: z61.array(z61.string()).transform(
2044
1997
  (layers) => layers.map((layer) => {
2045
1998
  const [name, color, visible, active, config, transparency] = layer.split("~");
2046
1999
  return LayerItemSchema.parse({
@@ -2053,7 +2006,7 @@ var PackageDetailDataStrSchema = import_zod62.z.object({
2053
2006
  });
2054
2007
  })
2055
2008
  ),
2056
- objects: import_zod62.z.array(import_zod62.z.string()).transform(
2009
+ objects: z61.array(z61.string()).transform(
2057
2010
  (objects) => objects.map((obj) => {
2058
2011
  const [name, visible, locked] = obj.split("~");
2059
2012
  return ObjectItemSchema.parse({
@@ -2064,43 +2017,43 @@ var PackageDetailDataStrSchema = import_zod62.z.object({
2064
2017
  })
2065
2018
  ),
2066
2019
  BBox: BBoxSchema,
2067
- netColors: import_zod62.z.array(import_zod62.z.unknown()).optional()
2020
+ netColors: z61.array(z61.unknown()).optional()
2068
2021
  });
2069
- var PackageDetailSchema = import_zod62.z.object({
2070
- uuid: import_zod62.z.string(),
2071
- title: import_zod62.z.string(),
2072
- docType: import_zod62.z.number(),
2073
- updateTime: import_zod62.z.number(),
2022
+ var PackageDetailSchema = z61.object({
2023
+ uuid: z61.string(),
2024
+ title: z61.string(),
2025
+ docType: z61.number(),
2026
+ updateTime: z61.number(),
2074
2027
  owner: OwnerSchema,
2075
- datastrid: import_zod62.z.string(),
2076
- writable: import_zod62.z.boolean(),
2028
+ datastrid: z61.string(),
2029
+ writable: z61.boolean(),
2077
2030
  dataStr: PackageDetailDataStrSchema
2078
2031
  });
2079
- var EasyEdaJsonSchema = import_zod62.z.object({
2080
- uuid: import_zod62.z.string(),
2081
- title: import_zod62.z.string(),
2082
- description: import_zod62.z.string(),
2083
- docType: import_zod62.z.number(),
2084
- type: import_zod62.z.number(),
2032
+ var EasyEdaJsonSchema = z61.object({
2033
+ uuid: z61.string(),
2034
+ title: z61.string(),
2035
+ description: z61.string(),
2036
+ docType: z61.number(),
2037
+ type: z61.number(),
2085
2038
  szlcsc: SzlcscSchema,
2086
2039
  lcsc: LcscSchema,
2087
2040
  owner: OwnerSchema,
2088
- tags: import_zod62.z.array(import_zod62.z.string()),
2089
- updateTime: import_zod62.z.number(),
2090
- updated_at: import_zod62.z.string(),
2041
+ tags: z61.array(z61.string()),
2042
+ updateTime: z61.number(),
2043
+ updated_at: z61.string(),
2091
2044
  dataStr: DataStrSchema,
2092
- verify: import_zod62.z.boolean(),
2093
- SMT: import_zod62.z.boolean().optional(),
2094
- datastrid: import_zod62.z.string(),
2095
- jlcOnSale: import_zod62.z.number().optional(),
2096
- writable: import_zod62.z.boolean(),
2097
- isFavorite: import_zod62.z.boolean(),
2045
+ verify: z61.boolean(),
2046
+ SMT: z61.boolean().optional(),
2047
+ datastrid: z61.string(),
2048
+ jlcOnSale: z61.number().optional(),
2049
+ writable: z61.boolean(),
2050
+ isFavorite: z61.boolean(),
2098
2051
  packageDetail: PackageDetailSchema
2099
2052
  });
2100
2053
 
2101
2054
  // lib/generate-footprint-tsx.ts
2102
- var import_zod63 = require("zod");
2103
- var import_mm3 = require("@tscircuit/mm");
2055
+ import "zod";
2056
+ import { mm as mm3 } from "@tscircuit/mm";
2104
2057
  var generateFootprintTsx = (easyEdaJson) => {
2105
2058
  const pads = easyEdaJson.packageDetail.dataStr.shape.filter(
2106
2059
  (shape) => shape.type === "PAD"
@@ -2110,16 +2063,16 @@ var generateFootprintTsx = (easyEdaJson) => {
2110
2063
  const centerY = centerOffset.y;
2111
2064
  const footprintElements = pads.map((pad) => {
2112
2065
  const { center, width, height, holeRadius, number } = pad;
2113
- const isPlatedHole = holeRadius !== void 0 && (0, import_mm3.mm)(holeRadius) > 0;
2114
- const normalizedX = (0, import_mm3.mm)(center.x) - centerX;
2115
- const normalizedY = (0, import_mm3.mm)(center.y) - centerY;
2066
+ const isPlatedHole = holeRadius !== void 0 && mm3(holeRadius) > 0;
2067
+ const normalizedX = mm3(center.x) - centerX;
2068
+ const normalizedY = mm3(center.y) - centerY;
2116
2069
  if (isPlatedHole) {
2117
2070
  return `
2118
2071
  <platedhole
2119
2072
  pcbX="${normalizedX.toFixed(2)}mm"
2120
2073
  pcbY="${normalizedY.toFixed(2)}mm"
2121
- hole_diameter="${(0, import_mm3.mm)(holeRadius) * 2}mm"
2122
- outer_diameter="${(0, import_mm3.mm)(width)}mm"
2074
+ hole_diameter="${mm3(holeRadius) * 2}mm"
2075
+ outer_diameter="${mm3(width)}mm"
2123
2076
  portHints={["${number}"]}
2124
2077
  />`.replace(/\n/, "");
2125
2078
  } else {
@@ -2127,8 +2080,8 @@ var generateFootprintTsx = (easyEdaJson) => {
2127
2080
  <smtpad
2128
2081
  pcbX="${normalizedX.toFixed(2)}mm"
2129
2082
  pcbY="${normalizedY.toFixed(2)}mm"
2130
- width="${(0, import_mm3.mm)(width)}mm"
2131
- height="${(0, import_mm3.mm)(height)}mm"
2083
+ width="${mm3(width)}mm"
2084
+ height="${mm3(height)}mm"
2132
2085
  shape="rect"
2133
2086
  portHints={["${number}"]}
2134
2087
  />`.replace(/\n/, "");
@@ -2256,8 +2209,8 @@ var checkModelObjUrlValidity = async (url) => {
2256
2209
  };
2257
2210
 
2258
2211
  // lib/convert-easyeda-json-to-various-formats.ts
2259
- var import_promises = __toESM(require("fs/promises"), 1);
2260
- var path = __toESM(require("path"), 1);
2212
+ import fs from "fs/promises";
2213
+ import * as path from "path";
2261
2214
  var convertEasyEdaJsonToVariousFormats = async ({
2262
2215
  jlcpcbPartNumberOrFilepath,
2263
2216
  outputFilename,
@@ -2266,7 +2219,7 @@ var convertEasyEdaJsonToVariousFormats = async ({
2266
2219
  let rawEasyEdaJson;
2267
2220
  if (jlcpcbPartNumberOrFilepath.includes(".") || jlcpcbPartNumberOrFilepath.includes("/")) {
2268
2221
  rawEasyEdaJson = JSON.parse(
2269
- await import_promises.default.readFile(jlcpcbPartNumberOrFilepath, "utf-8")
2222
+ await fs.readFile(jlcpcbPartNumberOrFilepath, "utf-8")
2270
2223
  );
2271
2224
  } else {
2272
2225
  rawEasyEdaJson = await fetchEasyEDAComponent(jlcpcbPartNumberOrFilepath);
@@ -2292,7 +2245,7 @@ var convertEasyEdaJsonToVariousFormats = async ({
2292
2245
  process.exit(1);
2293
2246
  }
2294
2247
  if (outputFilename.endsWith(".raweasy.json")) {
2295
- await import_promises.default.writeFile(outputFilename, JSON.stringify(rawEasyEdaJson, null, 2));
2248
+ await fs.writeFile(outputFilename, JSON.stringify(rawEasyEdaJson, null, 2));
2296
2249
  console.log(`Saved raw EasyEDA JSON: ${outputFilename}`);
2297
2250
  return;
2298
2251
  }
@@ -2300,16 +2253,16 @@ var convertEasyEdaJsonToVariousFormats = async ({
2300
2253
  const betterEasy = EasyEdaJsonSchema.parse(rawEasyEdaJson);
2301
2254
  const tscircuitSoup = convertEasyEdaJsonToTscircuitSoupJson(betterEasy);
2302
2255
  if (outputFilename.endsWith(".soup.json")) {
2303
- await import_promises.default.writeFile(outputFilename, JSON.stringify(tscircuitSoup, null, 2));
2256
+ await fs.writeFile(outputFilename, JSON.stringify(tscircuitSoup, null, 2));
2304
2257
  console.log(`Converted to tscircuit soup JSON: ${outputFilename}`);
2305
2258
  } else if (outputFilename.endsWith(".kicad_mod")) {
2306
2259
  console.log("Conversion to KiCad footprint not yet implemented");
2307
2260
  } else if (outputFilename.endsWith(".bettereasy.json")) {
2308
- await import_promises.default.writeFile(outputFilename, JSON.stringify(betterEasy, null, 2));
2261
+ await fs.writeFile(outputFilename, JSON.stringify(betterEasy, null, 2));
2309
2262
  console.log(`Saved better EasyEDA JSON: ${outputFilename}`);
2310
2263
  } else if (outputFilename.endsWith(".tsx") || outputFilename.endsWith(".ts")) {
2311
2264
  const tsComp = await convertRawEasyEdaToTs(rawEasyEdaJson);
2312
- await import_promises.default.writeFile(outputFilename, tsComp);
2265
+ await fs.writeFile(outputFilename, tsComp);
2313
2266
  console.log(`Saved TypeScript component: ${outputFilename}`);
2314
2267
  } else {
2315
2268
  console.error("Unsupported output format");
@@ -2318,25 +2271,25 @@ var convertEasyEdaJsonToVariousFormats = async ({
2318
2271
  console.error("Error:", error.message);
2319
2272
  }
2320
2273
  };
2321
- // Annotate the CommonJS export names for ESM import in node:
2322
- 0 && (module.exports = {
2323
- BBoxSchema,
2324
- DataStrSchema,
2325
- EasyEdaJsonSchema,
2274
+
2275
+ export {
2276
+ convertEasyEdaJsonToCircuitJson,
2277
+ convertEasyEdaJsonToTscircuitSoupJson,
2278
+ fetchEasyEDAComponent,
2279
+ maybeNumber,
2280
+ SzlcscSchema,
2281
+ LcscSchema,
2282
+ OwnerSchema,
2326
2283
  HeadSchema,
2284
+ BBoxSchema,
2327
2285
  LayerItemSchema,
2328
- LcscSchema,
2329
2286
  ObjectItemSchema,
2330
- OwnerSchema,
2287
+ DataStrSchema,
2331
2288
  PackageDetailDataStrSchema,
2332
2289
  PackageDetailSchema,
2333
- SzlcscSchema,
2334
- convertEasyEdaJsonToCircuitJson,
2335
- convertEasyEdaJsonToTscircuitSoupJson,
2336
- convertEasyEdaJsonToVariousFormats,
2290
+ EasyEdaJsonSchema,
2291
+ normalizeManufacturerPartNumber,
2337
2292
  convertRawEasyEdaToTs,
2338
- fetchEasyEDAComponent,
2339
- maybeNumber,
2340
- normalizeManufacturerPartNumber
2341
- });
2342
- //# sourceMappingURL=index.cjs.map
2293
+ convertEasyEdaJsonToVariousFormats
2294
+ };
2295
+ //# sourceMappingURL=chunk-3ZPJFTXV.js.map