easyeda 0.0.61 → 0.0.62

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.
@@ -11,6 +11,7 @@ __export(dist_exports, {
11
11
  any_circuit_element: () => any_circuit_element,
12
12
  any_soup_element: () => any_soup_element,
13
13
  any_source_component: () => any_source_component,
14
+ battery_capacity: () => battery_capacity,
14
15
  cad_component: () => cad_component,
15
16
  capacitance: () => capacitance,
16
17
  current: () => current,
@@ -59,6 +60,11 @@ __export(dist_exports, {
59
60
  route_hint_point: () => route_hint_point,
60
61
  schematic_box: () => schematic_box,
61
62
  schematic_component: () => schematic_component,
63
+ schematic_debug_line: () => schematic_debug_line,
64
+ schematic_debug_object: () => schematic_debug_object,
65
+ schematic_debug_object_base: () => schematic_debug_object_base,
66
+ schematic_debug_point: () => schematic_debug_point,
67
+ schematic_debug_rect: () => schematic_debug_rect,
62
68
  schematic_error: () => schematic_error,
63
69
  schematic_line: () => schematic_line,
64
70
  schematic_net_label: () => schematic_net_label,
@@ -73,11 +79,13 @@ __export(dist_exports, {
73
79
  source_led: () => source_led,
74
80
  source_net: () => source_net,
75
81
  source_port: () => source_port,
82
+ source_simple_battery: () => source_simple_battery,
76
83
  source_simple_bug: () => source_simple_bug,
77
84
  source_simple_capacitor: () => source_simple_capacitor,
78
85
  source_simple_chip: () => source_simple_chip,
79
86
  source_simple_diode: () => source_simple_diode,
80
87
  source_simple_ground: () => source_simple_ground,
88
+ source_simple_inductor: () => source_simple_inductor,
81
89
  source_simple_power_source: () => source_simple_power_source,
82
90
  source_simple_resistor: () => source_simple_resistor,
83
91
  source_trace: () => source_trace,
@@ -134,8 +142,8 @@ import { z as z13 } from "zod";
134
142
  import { z as z14 } from "zod";
135
143
  import { z as z15 } from "zod";
136
144
  import { z as z16 } from "zod";
137
- import { z as z17 } from "zod";
138
145
  import { z as z18 } from "zod";
146
+ import { z as z17 } from "zod";
139
147
  import { z as z19 } from "zod";
140
148
  import { z as z20 } from "zod";
141
149
  import { z as z21 } from "zod";
@@ -176,6 +184,8 @@ import { z as z55 } from "zod";
176
184
  import { z as z56 } from "zod";
177
185
  import { z as z57 } from "zod";
178
186
  import { z as z58 } from "zod";
187
+ import { z as z59 } from "zod";
188
+ import { z as z60 } from "zod";
179
189
  var unitMappings = {
180
190
  Hz: {
181
191
  baseUnit: "Hz",
@@ -272,7 +282,8 @@ var unitMappings = {
272
282
  IN: 25.4,
273
283
  FT: 304.8,
274
284
  yd: 914.4,
275
- mi: 1609344
285
+ mi: 1609344,
286
+ mil: 0.0254
276
287
  }
277
288
  }
278
289
  };
@@ -343,6 +354,17 @@ var rotation = z.string().or(z.number()).transform((arg) => {
343
354
  }
344
355
  return Number.parseFloat(arg);
345
356
  });
357
+ var battery_capacity = z.number().or(z.string().endsWith("mAh")).transform((v) => {
358
+ if (typeof v === "string") {
359
+ const valString = v.replace("mAh", "");
360
+ const num = Number.parseFloat(valString);
361
+ if (Number.isNaN(num)) {
362
+ throw new Error("Invalid capacity");
363
+ }
364
+ return num;
365
+ }
366
+ return v;
367
+ }).describe("Battery capacity in mAh");
346
368
  var point = z2.object({
347
369
  x: distance,
348
370
  y: distance
@@ -375,7 +397,8 @@ var source_component_base = z7.object({
375
397
  source_component_id: z7.string(),
376
398
  name: z7.string(),
377
399
  manufacturer_part_number: z7.string().optional(),
378
- supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional()
400
+ supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional(),
401
+ display_value: z7.string().optional()
379
402
  });
380
403
  var source_simple_capacitor = source_component_base.extend({
381
404
  ftype: z8.literal("simple_capacitor"),
@@ -408,7 +431,11 @@ var source_simple_power_source = source_component_base.extend({
408
431
  ftype: z16.literal("simple_power_source"),
409
432
  voltage
410
433
  });
411
- var any_source_component = z17.union([
434
+ var source_simple_battery = source_component_base.extend({
435
+ ftype: z17.literal("simple_battery"),
436
+ capacity: battery_capacity
437
+ });
438
+ var any_source_component = z18.union([
412
439
  source_simple_resistor,
413
440
  source_simple_capacitor,
414
441
  source_simple_diode,
@@ -416,161 +443,191 @@ var any_source_component = z17.union([
416
443
  source_simple_chip,
417
444
  source_simple_bug,
418
445
  source_led,
419
- source_simple_power_source
446
+ source_simple_power_source,
447
+ source_simple_battery,
448
+ source_simple_inductor
420
449
  ]);
421
- var source_port = z18.object({
422
- type: z18.literal("source_port"),
423
- pin_number: z18.number().optional(),
424
- port_hints: z18.array(z18.string()).optional(),
425
- name: z18.string(),
426
- source_port_id: z18.string(),
427
- source_component_id: z18.string()
428
- });
429
- var source_trace = z19.object({
430
- type: z19.literal("source_trace"),
431
- source_trace_id: z19.string(),
432
- connected_source_port_ids: z19.array(z19.string()),
433
- connected_source_net_ids: z19.array(z19.string())
434
- });
435
- var source_group = z20.object({
436
- type: z20.literal("source_group"),
437
- source_group_id: z20.string(),
438
- name: z20.string().optional()
439
- });
440
- var source_net = z21.object({
441
- type: z21.literal("source_net"),
442
- source_net_id: z21.string(),
443
- name: z21.string(),
444
- member_source_group_ids: z21.array(z21.string()),
445
- is_power: z21.boolean().optional(),
446
- is_ground: z21.boolean().optional(),
447
- is_digital_signal: z21.boolean().optional(),
448
- is_analog_signal: z21.boolean().optional(),
449
- trace_width: z21.number().optional()
450
- });
451
- var schematic_box = z22.object({
452
- type: z22.literal("schematic_box"),
453
- schematic_component_id: z22.string(),
450
+ var source_port = z19.object({
451
+ type: z19.literal("source_port"),
452
+ pin_number: z19.number().optional(),
453
+ port_hints: z19.array(z19.string()).optional(),
454
+ name: z19.string(),
455
+ source_port_id: z19.string(),
456
+ source_component_id: z19.string()
457
+ });
458
+ var source_trace = z20.object({
459
+ type: z20.literal("source_trace"),
460
+ source_trace_id: z20.string(),
461
+ connected_source_port_ids: z20.array(z20.string()),
462
+ connected_source_net_ids: z20.array(z20.string())
463
+ });
464
+ var source_group = z21.object({
465
+ type: z21.literal("source_group"),
466
+ source_group_id: z21.string(),
467
+ name: z21.string().optional()
468
+ });
469
+ var source_net = z22.object({
470
+ type: z22.literal("source_net"),
471
+ source_net_id: z22.string(),
472
+ name: z22.string(),
473
+ member_source_group_ids: z22.array(z22.string()),
474
+ is_power: z22.boolean().optional(),
475
+ is_ground: z22.boolean().optional(),
476
+ is_digital_signal: z22.boolean().optional(),
477
+ is_analog_signal: z22.boolean().optional(),
478
+ trace_width: z22.number().optional()
479
+ });
480
+ var schematic_box = z23.object({
481
+ type: z23.literal("schematic_box"),
482
+ schematic_component_id: z23.string(),
454
483
  width: distance,
455
484
  height: distance,
456
485
  x: distance,
457
486
  y: distance
458
487
  }).describe("Draws a box on the schematic");
459
- var schematic_path = z23.object({
460
- type: z23.literal("schematic_path"),
461
- schematic_component_id: z23.string(),
462
- fill_color: z23.enum(["red", "blue"]).optional(),
463
- is_filled: z23.boolean().optional(),
464
- points: z23.array(point)
488
+ var schematic_path = z24.object({
489
+ type: z24.literal("schematic_path"),
490
+ schematic_component_id: z24.string(),
491
+ fill_color: z24.enum(["red", "blue"]).optional(),
492
+ is_filled: z24.boolean().optional(),
493
+ points: z24.array(point)
465
494
  });
466
- var schematic_pin_styles = z24.record(
467
- z24.object({
495
+ var schematic_pin_styles = z25.record(
496
+ z25.object({
468
497
  left_margin: length.optional(),
469
498
  right_margin: length.optional(),
470
499
  top_margin: length.optional(),
471
500
  bottom_margin: length.optional()
472
501
  })
473
502
  );
474
- var schematic_component = z24.object({
475
- type: z24.literal("schematic_component"),
503
+ var schematic_component = z25.object({
504
+ type: z25.literal("schematic_component"),
476
505
  rotation: rotation.default(0),
477
506
  size,
478
507
  center: point,
479
- source_component_id: z24.string(),
480
- schematic_component_id: z24.string(),
508
+ source_component_id: z25.string(),
509
+ schematic_component_id: z25.string(),
481
510
  pin_spacing: length.optional(),
482
511
  pin_styles: schematic_pin_styles.optional(),
483
512
  box_width: length.optional(),
484
- symbol_name: z24.string().optional(),
485
- port_arrangement: z24.union([
486
- z24.object({
487
- left_size: z24.number(),
488
- right_size: z24.number(),
489
- top_size: z24.number().optional(),
490
- bottom_size: z24.number().optional()
513
+ symbol_name: z25.string().optional(),
514
+ port_arrangement: z25.union([
515
+ z25.object({
516
+ left_size: z25.number(),
517
+ right_size: z25.number(),
518
+ top_size: z25.number().optional(),
519
+ bottom_size: z25.number().optional()
491
520
  }),
492
- z24.object({
493
- left_side: z24.object({
494
- pins: z24.array(z24.number()),
495
- direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
521
+ z25.object({
522
+ left_side: z25.object({
523
+ pins: z25.array(z25.number()),
524
+ direction: z25.enum(["top-to-bottom", "bottom-to-top"]).optional()
496
525
  }).optional(),
497
- right_side: z24.object({
498
- pins: z24.array(z24.number()),
499
- direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
526
+ right_side: z25.object({
527
+ pins: z25.array(z25.number()),
528
+ direction: z25.enum(["top-to-bottom", "bottom-to-top"]).optional()
500
529
  }).optional(),
501
- top_side: z24.object({
502
- pins: z24.array(z24.number()),
503
- direction: z24.enum(["left-to-right", "right-to-left"]).optional()
530
+ top_side: z25.object({
531
+ pins: z25.array(z25.number()),
532
+ direction: z25.enum(["left-to-right", "right-to-left"]).optional()
504
533
  }).optional(),
505
- bottom_side: z24.object({
506
- pins: z24.array(z24.number()),
507
- direction: z24.enum(["left-to-right", "right-to-left"]).optional()
534
+ bottom_side: z25.object({
535
+ pins: z25.array(z25.number()),
536
+ direction: z25.enum(["left-to-right", "right-to-left"]).optional()
508
537
  }).optional()
509
538
  })
510
539
  ]).optional(),
511
- port_labels: z24.record(z24.string()).optional()
540
+ port_labels: z25.record(z25.string()).optional()
512
541
  });
513
- var schematic_line = z25.object({
514
- type: z25.literal("schematic_line"),
515
- schematic_component_id: z25.string(),
542
+ var schematic_line = z26.object({
543
+ type: z26.literal("schematic_line"),
544
+ schematic_component_id: z26.string(),
516
545
  x1: distance,
517
546
  x2: distance,
518
547
  y1: distance,
519
548
  y2: distance
520
549
  });
521
- var schematic_trace = z26.object({
522
- type: z26.literal("schematic_trace"),
523
- schematic_trace_id: z26.string(),
524
- source_trace_id: z26.string(),
525
- edges: z26.array(
526
- z26.object({
527
- from: z26.object({
528
- x: z26.number(),
529
- y: z26.number()
550
+ var schematic_trace = z27.object({
551
+ type: z27.literal("schematic_trace"),
552
+ schematic_trace_id: z27.string(),
553
+ source_trace_id: z27.string(),
554
+ edges: z27.array(
555
+ z27.object({
556
+ from: z27.object({
557
+ x: z27.number(),
558
+ y: z27.number()
530
559
  }),
531
- to: z26.object({
532
- x: z26.number(),
533
- y: z26.number()
560
+ to: z27.object({
561
+ x: z27.number(),
562
+ y: z27.number()
534
563
  }),
535
- from_schematic_port_id: z26.string().optional(),
536
- to_schematic_port_id: z26.string().optional()
564
+ from_schematic_port_id: z27.string().optional(),
565
+ to_schematic_port_id: z27.string().optional()
537
566
  })
538
567
  )
539
568
  });
540
- var schematic_text = z27.object({
541
- type: z27.literal("schematic_text"),
542
- schematic_component_id: z27.string(),
543
- schematic_text_id: z27.string(),
544
- text: z27.string(),
545
- position: z27.object({
569
+ var schematic_text = z28.object({
570
+ type: z28.literal("schematic_text"),
571
+ schematic_component_id: z28.string(),
572
+ schematic_text_id: z28.string(),
573
+ text: z28.string(),
574
+ position: z28.object({
546
575
  x: distance,
547
576
  y: distance
548
577
  }),
549
- rotation: z27.number().default(0),
550
- anchor: z27.enum(["center", "left", "right", "top", "bottom"]).default("center")
551
- });
552
- var schematic_port = z28.object({
553
- type: z28.literal("schematic_port"),
554
- schematic_port_id: z28.string(),
555
- source_port_id: z28.string(),
556
- schematic_component_id: z28.string().optional(),
578
+ rotation: z28.number().default(0),
579
+ anchor: z28.enum(["center", "left", "right", "top", "bottom"]).default("center"),
580
+ color: z28.string().default("#000000")
581
+ });
582
+ var schematic_port = z29.object({
583
+ type: z29.literal("schematic_port"),
584
+ schematic_port_id: z29.string(),
585
+ source_port_id: z29.string(),
586
+ schematic_component_id: z29.string().optional(),
557
587
  center: point,
558
- facing_direction: z28.enum(["up", "down", "left", "right"]).optional()
588
+ facing_direction: z29.enum(["up", "down", "left", "right"]).optional(),
589
+ distance_from_component_edge: z29.number().optional(),
590
+ side_of_component: z29.enum(["top", "bottom", "left", "right"]).optional(),
591
+ true_ccw_index: z29.number().optional(),
592
+ pin_number: z29.number().optional()
559
593
  }).describe("Defines a port on a schematic component");
560
- var schematic_net_label = z29.object({
561
- type: z29.literal("schematic_net_label"),
562
- source_net_id: z29.string(),
594
+ var schematic_net_label = z30.object({
595
+ type: z30.literal("schematic_net_label"),
596
+ source_net_id: z30.string(),
563
597
  center: point,
564
- anchor_side: z29.enum(["top", "bottom", "left", "right"]),
565
- text: z29.string()
598
+ anchor_side: z30.enum(["top", "bottom", "left", "right"]),
599
+ text: z30.string()
566
600
  });
567
- var schematic_error = z30.object({
568
- schematic_error_id: z30.string(),
569
- type: z30.literal("schematic_error"),
601
+ var schematic_error = z31.object({
602
+ schematic_error_id: z31.string(),
603
+ type: z31.literal("schematic_error"),
570
604
  // eventually each error type should be broken out into a dir of files
571
- error_type: z30.literal("schematic_port_not_found"),
572
- message: z30.string()
605
+ error_type: z31.literal("schematic_port_not_found"),
606
+ message: z31.string()
573
607
  }).describe("Defines a schematic error on the schematic");
608
+ var schematic_debug_object_base = z32.object({
609
+ type: z32.literal("schematic_debug_object"),
610
+ label: z32.string().optional()
611
+ });
612
+ var schematic_debug_rect = schematic_debug_object_base.extend({
613
+ shape: z32.literal("rect"),
614
+ center: point,
615
+ size
616
+ });
617
+ var schematic_debug_line = schematic_debug_object_base.extend({
618
+ shape: z32.literal("line"),
619
+ start: point,
620
+ end: point
621
+ });
622
+ var schematic_debug_point = schematic_debug_object_base.extend({
623
+ shape: z32.literal("point"),
624
+ center: point
625
+ });
626
+ var schematic_debug_object = z32.discriminatedUnion("shape", [
627
+ schematic_debug_rect,
628
+ schematic_debug_line,
629
+ schematic_debug_point
630
+ ]);
574
631
  var all_layers = [
575
632
  "top",
576
633
  "bottom",
@@ -581,9 +638,9 @@ var all_layers = [
581
638
  "inner5",
582
639
  "inner6"
583
640
  ];
584
- var layer_string = z31.enum(all_layers);
641
+ var layer_string = z33.enum(all_layers);
585
642
  var layer_ref = layer_string.or(
586
- z31.object({
643
+ z33.object({
587
644
  name: layer_string
588
645
  })
589
646
  ).transform((layer) => {
@@ -592,27 +649,27 @@ var layer_ref = layer_string.or(
592
649
  }
593
650
  return layer.name;
594
651
  });
595
- var visible_layer = z31.enum(["top", "bottom"]);
596
- var pcb_route_hint = z32.object({
652
+ var visible_layer = z33.enum(["top", "bottom"]);
653
+ var pcb_route_hint = z34.object({
597
654
  x: distance,
598
655
  y: distance,
599
- via: z32.boolean().optional(),
656
+ via: z34.boolean().optional(),
600
657
  via_to_layer: layer_ref.optional()
601
658
  });
602
- var pcb_route_hints = z32.array(pcb_route_hint);
603
- var route_hint_point = z33.object({
659
+ var pcb_route_hints = z34.array(pcb_route_hint);
660
+ var route_hint_point = z35.object({
604
661
  x: distance,
605
662
  y: distance,
606
- via: z33.boolean().optional(),
663
+ via: z35.boolean().optional(),
607
664
  to_layer: layer_ref.optional(),
608
665
  trace_width: distance.optional()
609
666
  });
610
667
  var expectTypesMatch = (shouldBe) => {
611
668
  };
612
- var pcb_component = z34.object({
613
- type: z34.literal("pcb_component"),
669
+ var pcb_component = z36.object({
670
+ type: z36.literal("pcb_component"),
614
671
  pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
615
- source_component_id: z34.string(),
672
+ source_component_id: z36.string(),
616
673
  center: point,
617
674
  layer: layer_ref,
618
675
  rotation,
@@ -620,11 +677,11 @@ var pcb_component = z34.object({
620
677
  height: length
621
678
  }).describe("Defines a component on the PCB");
622
679
  expectTypesMatch(true);
623
- var pcb_hole_circle_or_square = z35.object({
624
- type: z35.literal("pcb_hole"),
680
+ var pcb_hole_circle_or_square = z37.object({
681
+ type: z37.literal("pcb_hole"),
625
682
  pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
626
- hole_shape: z35.enum(["circle", "square"]),
627
- hole_diameter: z35.number(),
683
+ hole_shape: z37.enum(["circle", "square"]),
684
+ hole_diameter: z37.number(),
628
685
  x: distance,
629
686
  y: distance
630
687
  });
@@ -632,12 +689,12 @@ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
632
689
  "Defines a circular or square hole on the PCB"
633
690
  );
634
691
  expectTypesMatch(true);
635
- var pcb_hole_oval = z35.object({
636
- type: z35.literal("pcb_hole"),
692
+ var pcb_hole_oval = z37.object({
693
+ type: z37.literal("pcb_hole"),
637
694
  pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
638
- hole_shape: z35.literal("oval"),
639
- hole_width: z35.number(),
640
- hole_height: z35.number(),
695
+ hole_shape: z37.literal("oval"),
696
+ hole_width: z37.number(),
697
+ hole_height: z37.number(),
641
698
  x: distance,
642
699
  y: distance
643
700
  });
@@ -646,35 +703,35 @@ var pcb_hole_oval_shape = pcb_hole_oval.describe(
646
703
  );
647
704
  expectTypesMatch(true);
648
705
  var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
649
- var pcb_plated_hole_circle = z36.object({
650
- type: z36.literal("pcb_plated_hole"),
651
- shape: z36.literal("circle"),
652
- outer_diameter: z36.number(),
653
- hole_diameter: z36.number(),
706
+ var pcb_plated_hole_circle = z38.object({
707
+ type: z38.literal("pcb_plated_hole"),
708
+ shape: z38.literal("circle"),
709
+ outer_diameter: z38.number(),
710
+ hole_diameter: z38.number(),
654
711
  x: distance,
655
712
  y: distance,
656
- layers: z36.array(layer_ref),
657
- port_hints: z36.array(z36.string()).optional(),
658
- pcb_component_id: z36.string().optional(),
659
- pcb_port_id: z36.string().optional(),
713
+ layers: z38.array(layer_ref),
714
+ port_hints: z38.array(z38.string()).optional(),
715
+ pcb_component_id: z38.string().optional(),
716
+ pcb_port_id: z38.string().optional(),
660
717
  pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
661
718
  });
662
- var pcb_plated_hole_oval = z36.object({
663
- type: z36.literal("pcb_plated_hole"),
664
- shape: z36.enum(["oval", "pill"]),
665
- outer_width: z36.number(),
666
- outer_height: z36.number(),
667
- hole_width: z36.number(),
668
- hole_height: z36.number(),
719
+ var pcb_plated_hole_oval = z38.object({
720
+ type: z38.literal("pcb_plated_hole"),
721
+ shape: z38.enum(["oval", "pill"]),
722
+ outer_width: z38.number(),
723
+ outer_height: z38.number(),
724
+ hole_width: z38.number(),
725
+ hole_height: z38.number(),
669
726
  x: distance,
670
727
  y: distance,
671
- layers: z36.array(layer_ref),
672
- port_hints: z36.array(z36.string()).optional(),
673
- pcb_component_id: z36.string().optional(),
674
- pcb_port_id: z36.string().optional(),
728
+ layers: z38.array(layer_ref),
729
+ port_hints: z38.array(z38.string()).optional(),
730
+ pcb_component_id: z38.string().optional(),
731
+ pcb_port_id: z38.string().optional(),
675
732
  pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
676
733
  });
677
- var pcb_plated_hole = z36.union([
734
+ var pcb_plated_hole = z38.union([
678
735
  pcb_plated_hole_circle,
679
736
  pcb_plated_hole_oval
680
737
  ]);
@@ -682,154 +739,154 @@ expectTypesMatch(
682
739
  true
683
740
  );
684
741
  expectTypesMatch(true);
685
- var pcb_port = z37.object({
686
- type: z37.literal("pcb_port"),
742
+ var pcb_port = z39.object({
743
+ type: z39.literal("pcb_port"),
687
744
  pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
688
- source_port_id: z37.string(),
689
- pcb_component_id: z37.string(),
745
+ source_port_id: z39.string(),
746
+ pcb_component_id: z39.string(),
690
747
  x: distance,
691
748
  y: distance,
692
- layers: z37.array(layer_ref)
749
+ layers: z39.array(layer_ref)
693
750
  }).describe("Defines a port on the PCB");
694
751
  expectTypesMatch(true);
695
- var pcb_smtpad_circle = z38.object({
696
- type: z38.literal("pcb_smtpad"),
697
- shape: z38.literal("circle"),
752
+ var pcb_smtpad_circle = z40.object({
753
+ type: z40.literal("pcb_smtpad"),
754
+ shape: z40.literal("circle"),
698
755
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
699
756
  x: distance,
700
757
  y: distance,
701
- radius: z38.number(),
758
+ radius: z40.number(),
702
759
  layer: layer_ref,
703
- port_hints: z38.array(z38.string()).optional(),
704
- pcb_component_id: z38.string().optional(),
705
- pcb_port_id: z38.string().optional()
760
+ port_hints: z40.array(z40.string()).optional(),
761
+ pcb_component_id: z40.string().optional(),
762
+ pcb_port_id: z40.string().optional()
706
763
  });
707
- var pcb_smtpad_rect = z38.object({
708
- type: z38.literal("pcb_smtpad"),
709
- shape: z38.literal("rect"),
764
+ var pcb_smtpad_rect = z40.object({
765
+ type: z40.literal("pcb_smtpad"),
766
+ shape: z40.literal("rect"),
710
767
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
711
768
  x: distance,
712
769
  y: distance,
713
- width: z38.number(),
714
- height: z38.number(),
770
+ width: z40.number(),
771
+ height: z40.number(),
715
772
  layer: layer_ref,
716
- port_hints: z38.array(z38.string()).optional(),
717
- pcb_component_id: z38.string().optional(),
718
- pcb_port_id: z38.string().optional()
773
+ port_hints: z40.array(z40.string()).optional(),
774
+ pcb_component_id: z40.string().optional(),
775
+ pcb_port_id: z40.string().optional()
719
776
  });
720
- var pcb_smtpad = z38.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
777
+ var pcb_smtpad = z40.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
721
778
  expectTypesMatch(true);
722
779
  expectTypesMatch(true);
723
- var pcb_solder_paste_circle = z39.object({
724
- type: z39.literal("pcb_solder_paste"),
725
- shape: z39.literal("circle"),
780
+ var pcb_solder_paste_circle = z41.object({
781
+ type: z41.literal("pcb_solder_paste"),
782
+ shape: z41.literal("circle"),
726
783
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
727
784
  x: distance,
728
785
  y: distance,
729
- radius: z39.number(),
786
+ radius: z41.number(),
730
787
  layer: layer_ref,
731
- pcb_component_id: z39.string().optional(),
732
- pcb_smtpad_id: z39.string().optional()
788
+ pcb_component_id: z41.string().optional(),
789
+ pcb_smtpad_id: z41.string().optional()
733
790
  });
734
- var pcb_solder_paste_rect = z39.object({
735
- type: z39.literal("pcb_solder_paste"),
736
- shape: z39.literal("rect"),
791
+ var pcb_solder_paste_rect = z41.object({
792
+ type: z41.literal("pcb_solder_paste"),
793
+ shape: z41.literal("rect"),
737
794
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
738
795
  x: distance,
739
796
  y: distance,
740
- width: z39.number(),
741
- height: z39.number(),
797
+ width: z41.number(),
798
+ height: z41.number(),
742
799
  layer: layer_ref,
743
- pcb_component_id: z39.string().optional(),
744
- pcb_smtpad_id: z39.string().optional()
800
+ pcb_component_id: z41.string().optional(),
801
+ pcb_smtpad_id: z41.string().optional()
745
802
  });
746
- var pcb_solder_paste = z39.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
803
+ var pcb_solder_paste = z41.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
747
804
  expectTypesMatch(true);
748
805
  expectTypesMatch(true);
749
- var pcb_text = z40.object({
750
- type: z40.literal("pcb_text"),
806
+ var pcb_text = z42.object({
807
+ type: z42.literal("pcb_text"),
751
808
  pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
752
- text: z40.string(),
809
+ text: z42.string(),
753
810
  center: point,
754
811
  layer: layer_ref,
755
812
  width: length,
756
813
  height: length,
757
- lines: z40.number(),
758
- align: z40.enum(["bottom-left"])
814
+ lines: z42.number(),
815
+ align: z42.enum(["bottom-left"])
759
816
  }).describe("Defines text on the PCB");
760
817
  expectTypesMatch(true);
761
- var pcb_trace_route_point_wire = z41.object({
762
- route_type: z41.literal("wire"),
818
+ var pcb_trace_route_point_wire = z43.object({
819
+ route_type: z43.literal("wire"),
763
820
  x: distance,
764
821
  y: distance,
765
822
  width: distance,
766
- start_pcb_port_id: z41.string().optional(),
767
- end_pcb_port_id: z41.string().optional(),
823
+ start_pcb_port_id: z43.string().optional(),
824
+ end_pcb_port_id: z43.string().optional(),
768
825
  layer: layer_ref
769
826
  });
770
- var pcb_trace_route_point_via = z41.object({
771
- route_type: z41.literal("via"),
827
+ var pcb_trace_route_point_via = z43.object({
828
+ route_type: z43.literal("via"),
772
829
  x: distance,
773
830
  y: distance,
774
- from_layer: z41.string(),
775
- to_layer: z41.string()
831
+ from_layer: z43.string(),
832
+ to_layer: z43.string()
776
833
  });
777
- var pcb_trace_route_point = z41.union([
834
+ var pcb_trace_route_point = z43.union([
778
835
  pcb_trace_route_point_wire,
779
836
  pcb_trace_route_point_via
780
837
  ]);
781
- var pcb_trace = z41.object({
782
- type: z41.literal("pcb_trace"),
783
- source_trace_id: z41.string().optional(),
784
- pcb_component_id: z41.string().optional(),
838
+ var pcb_trace = z43.object({
839
+ type: z43.literal("pcb_trace"),
840
+ source_trace_id: z43.string().optional(),
841
+ pcb_component_id: z43.string().optional(),
785
842
  pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
786
- route_thickness_mode: z41.enum(["constant", "interpolated"]).default("constant").optional(),
787
- route_order_index: z41.number().optional(),
788
- should_round_corners: z41.boolean().optional(),
789
- route: z41.array(
790
- z41.union([
791
- z41.object({
792
- route_type: z41.literal("wire"),
843
+ route_thickness_mode: z43.enum(["constant", "interpolated"]).default("constant").optional(),
844
+ route_order_index: z43.number().optional(),
845
+ should_round_corners: z43.boolean().optional(),
846
+ route: z43.array(
847
+ z43.union([
848
+ z43.object({
849
+ route_type: z43.literal("wire"),
793
850
  x: distance,
794
851
  y: distance,
795
852
  width: distance,
796
- start_pcb_port_id: z41.string().optional(),
797
- end_pcb_port_id: z41.string().optional(),
853
+ start_pcb_port_id: z43.string().optional(),
854
+ end_pcb_port_id: z43.string().optional(),
798
855
  layer: layer_ref
799
856
  }),
800
- z41.object({
801
- route_type: z41.literal("via"),
857
+ z43.object({
858
+ route_type: z43.literal("via"),
802
859
  x: distance,
803
860
  y: distance,
804
- from_layer: z41.string(),
805
- to_layer: z41.string()
861
+ from_layer: z43.string(),
862
+ to_layer: z43.string()
806
863
  })
807
864
  ])
808
865
  )
809
866
  }).describe("Defines a trace on the PCB");
810
867
  expectTypesMatch(true);
811
868
  expectTypesMatch(true);
812
- var pcb_trace_error = z42.object({
813
- type: z42.literal("pcb_trace_error"),
869
+ var pcb_trace_error = z44.object({
870
+ type: z44.literal("pcb_trace_error"),
814
871
  pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
815
- error_type: z42.literal("pcb_trace_error"),
816
- message: z42.string(),
872
+ error_type: z44.literal("pcb_trace_error"),
873
+ message: z44.string(),
817
874
  center: point.optional(),
818
- pcb_trace_id: z42.string(),
819
- source_trace_id: z42.string(),
820
- pcb_component_ids: z42.array(z42.string()),
821
- pcb_port_ids: z42.array(z42.string())
875
+ pcb_trace_id: z44.string(),
876
+ source_trace_id: z44.string(),
877
+ pcb_component_ids: z44.array(z44.string()),
878
+ pcb_port_ids: z44.array(z44.string())
822
879
  }).describe("Defines a trace error on the PCB");
823
880
  expectTypesMatch(true);
824
- var pcb_port_not_matched_error = z43.object({
825
- type: z43.literal("pcb_port_not_matched_error"),
881
+ var pcb_port_not_matched_error = z45.object({
882
+ type: z45.literal("pcb_port_not_matched_error"),
826
883
  pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
827
- message: z43.string(),
828
- pcb_component_ids: z43.array(z43.string())
884
+ message: z45.string(),
885
+ pcb_component_ids: z45.array(z45.string())
829
886
  }).describe("Defines a trace error on the PCB where a port is not matched");
830
887
  expectTypesMatch(true);
831
- var pcb_via = z44.object({
832
- type: z44.literal("pcb_via"),
888
+ var pcb_via = z46.object({
889
+ type: z46.literal("pcb_via"),
833
890
  pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
834
891
  x: distance,
835
892
  y: distance,
@@ -839,39 +896,39 @@ var pcb_via = z44.object({
839
896
  from_layer: layer_ref.optional(),
840
897
  /** @deprecated */
841
898
  to_layer: layer_ref.optional(),
842
- layers: z44.array(layer_ref),
843
- pcb_trace_id: z44.string().optional()
899
+ layers: z46.array(layer_ref),
900
+ pcb_trace_id: z46.string().optional()
844
901
  }).describe("Defines a via on the PCB");
845
902
  expectTypesMatch(true);
846
- var pcb_board = z45.object({
847
- type: z45.literal("pcb_board"),
903
+ var pcb_board = z47.object({
904
+ type: z47.literal("pcb_board"),
848
905
  pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
849
906
  width: length,
850
907
  height: length,
851
908
  center: point,
852
909
  thickness: length.optional().default(1.4),
853
- num_layers: z45.number().optional().default(4),
854
- outline: z45.array(point).optional()
910
+ num_layers: z47.number().optional().default(4),
911
+ outline: z47.array(point).optional()
855
912
  }).describe("Defines the board outline of the PCB");
856
913
  expectTypesMatch(true);
857
- var pcb_placement_error = z46.object({
858
- type: z46.literal("pcb_placement_error"),
914
+ var pcb_placement_error = z48.object({
915
+ type: z48.literal("pcb_placement_error"),
859
916
  pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
860
- message: z46.string()
917
+ message: z48.string()
861
918
  }).describe("Defines a placement error on the PCB");
862
919
  expectTypesMatch(true);
863
- var pcb_trace_hint = z47.object({
864
- type: z47.literal("pcb_trace_hint"),
920
+ var pcb_trace_hint = z49.object({
921
+ type: z49.literal("pcb_trace_hint"),
865
922
  pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
866
- pcb_port_id: z47.string(),
867
- pcb_component_id: z47.string(),
868
- route: z47.array(route_hint_point)
923
+ pcb_port_id: z49.string(),
924
+ pcb_component_id: z49.string(),
925
+ route: z49.array(route_hint_point)
869
926
  }).describe("A hint that can be used during generation of a PCB trace");
870
927
  expectTypesMatch(true);
871
- var pcb_silkscreen_line = z48.object({
872
- type: z48.literal("pcb_silkscreen_line"),
928
+ var pcb_silkscreen_line = z50.object({
929
+ type: z50.literal("pcb_silkscreen_line"),
873
930
  pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
874
- pcb_component_id: z48.string(),
931
+ pcb_component_id: z50.string(),
875
932
  stroke_width: distance.default("0.1mm"),
876
933
  x1: distance,
877
934
  y1: distance,
@@ -880,131 +937,131 @@ var pcb_silkscreen_line = z48.object({
880
937
  layer: visible_layer
881
938
  }).describe("Defines a silkscreen line on the PCB");
882
939
  expectTypesMatch(true);
883
- var pcb_silkscreen_path = z49.object({
884
- type: z49.literal("pcb_silkscreen_path"),
940
+ var pcb_silkscreen_path = z51.object({
941
+ type: z51.literal("pcb_silkscreen_path"),
885
942
  pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
886
- pcb_component_id: z49.string(),
943
+ pcb_component_id: z51.string(),
887
944
  layer: visible_layer,
888
- route: z49.array(point),
945
+ route: z51.array(point),
889
946
  stroke_width: length
890
947
  }).describe("Defines a silkscreen path on the PCB");
891
948
  expectTypesMatch(true);
892
- var pcb_silkscreen_text = z50.object({
893
- type: z50.literal("pcb_silkscreen_text"),
949
+ var pcb_silkscreen_text = z52.object({
950
+ type: z52.literal("pcb_silkscreen_text"),
894
951
  pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
895
- font: z50.literal("tscircuit2024").default("tscircuit2024"),
952
+ font: z52.literal("tscircuit2024").default("tscircuit2024"),
896
953
  font_size: distance.default("0.2mm"),
897
- pcb_component_id: z50.string(),
898
- text: z50.string(),
954
+ pcb_component_id: z52.string(),
955
+ text: z52.string(),
899
956
  layer: layer_ref,
900
- is_mirrored: z50.boolean().default(false).optional(),
957
+ is_mirrored: z52.boolean().default(false).optional(),
901
958
  anchor_position: point.default({ x: 0, y: 0 }),
902
- anchor_alignment: z50.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
959
+ anchor_alignment: z52.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
903
960
  }).describe("Defines silkscreen text on the PCB");
904
961
  expectTypesMatch(true);
905
- var pcb_silkscreen_rect = z51.object({
906
- type: z51.literal("pcb_silkscreen_rect"),
962
+ var pcb_silkscreen_rect = z53.object({
963
+ type: z53.literal("pcb_silkscreen_rect"),
907
964
  pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
908
- pcb_component_id: z51.string(),
965
+ pcb_component_id: z53.string(),
909
966
  center: point,
910
967
  width: length,
911
968
  height: length,
912
969
  layer: layer_ref
913
970
  }).describe("Defines a silkscreen rect on the PCB");
914
971
  expectTypesMatch(true);
915
- var pcb_silkscreen_circle = z52.object({
916
- type: z52.literal("pcb_silkscreen_circle"),
972
+ var pcb_silkscreen_circle = z54.object({
973
+ type: z54.literal("pcb_silkscreen_circle"),
917
974
  pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
918
975
  "pcb_silkscreen_circle"
919
976
  ),
920
- pcb_component_id: z52.string(),
977
+ pcb_component_id: z54.string(),
921
978
  center: point,
922
979
  radius: length,
923
980
  layer: visible_layer
924
981
  }).describe("Defines a silkscreen circle on the PCB");
925
982
  expectTypesMatch(true);
926
- var pcb_silkscreen_oval = z53.object({
927
- type: z53.literal("pcb_silkscreen_oval"),
983
+ var pcb_silkscreen_oval = z55.object({
984
+ type: z55.literal("pcb_silkscreen_oval"),
928
985
  pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
929
- pcb_component_id: z53.string(),
986
+ pcb_component_id: z55.string(),
930
987
  center: point,
931
988
  radius_x: distance,
932
989
  radius_y: distance,
933
990
  layer: visible_layer
934
991
  }).describe("Defines a silkscreen oval on the PCB");
935
992
  expectTypesMatch(true);
936
- var pcb_fabrication_note_text = z54.object({
937
- type: z54.literal("pcb_fabrication_note_text"),
993
+ var pcb_fabrication_note_text = z56.object({
994
+ type: z56.literal("pcb_fabrication_note_text"),
938
995
  pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
939
996
  "pcb_fabrication_note_text"
940
997
  ),
941
- font: z54.literal("tscircuit2024").default("tscircuit2024"),
998
+ font: z56.literal("tscircuit2024").default("tscircuit2024"),
942
999
  font_size: distance.default("1mm"),
943
- pcb_component_id: z54.string(),
944
- text: z54.string(),
1000
+ pcb_component_id: z56.string(),
1001
+ text: z56.string(),
945
1002
  layer: visible_layer,
946
1003
  anchor_position: point.default({ x: 0, y: 0 }),
947
- anchor_alignment: z54.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
948
- color: z54.string().optional()
1004
+ anchor_alignment: z56.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
1005
+ color: z56.string().optional()
949
1006
  }).describe(
950
1007
  "Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
951
1008
  );
952
1009
  expectTypesMatch(true);
953
- var pcb_fabrication_note_path = z55.object({
954
- type: z55.literal("pcb_fabrication_note_path"),
1010
+ var pcb_fabrication_note_path = z57.object({
1011
+ type: z57.literal("pcb_fabrication_note_path"),
955
1012
  pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
956
1013
  "pcb_fabrication_note_path"
957
1014
  ),
958
- pcb_component_id: z55.string(),
1015
+ pcb_component_id: z57.string(),
959
1016
  layer: layer_ref,
960
- route: z55.array(point),
1017
+ route: z57.array(point),
961
1018
  stroke_width: length,
962
- color: z55.string().optional()
1019
+ color: z57.string().optional()
963
1020
  }).describe(
964
1021
  "Defines a fabrication path on the PCB for fabricators or assemblers"
965
1022
  );
966
1023
  expectTypesMatch(true);
967
- var pcb_keepout = z56.object({
968
- type: z56.literal("pcb_keepout"),
969
- shape: z56.literal("rect"),
1024
+ var pcb_keepout = z58.object({
1025
+ type: z58.literal("pcb_keepout"),
1026
+ shape: z58.literal("rect"),
970
1027
  center: point,
971
1028
  width: distance,
972
1029
  height: distance,
973
- pcb_keepout_id: z56.string(),
974
- layers: z56.array(z56.string()),
1030
+ pcb_keepout_id: z58.string(),
1031
+ layers: z58.array(z58.string()),
975
1032
  // Specify layers where the keepout applies
976
- description: z56.string().optional()
1033
+ description: z58.string().optional()
977
1034
  // Optional description of the keepout
978
1035
  }).or(
979
- z56.object({
980
- type: z56.literal("pcb_keepout"),
981
- shape: z56.literal("circle"),
1036
+ z58.object({
1037
+ type: z58.literal("pcb_keepout"),
1038
+ shape: z58.literal("circle"),
982
1039
  center: point,
983
1040
  radius: distance,
984
- pcb_keepout_id: z56.string(),
985
- layers: z56.array(z56.string()),
1041
+ pcb_keepout_id: z58.string(),
1042
+ layers: z58.array(z58.string()),
986
1043
  // Specify layers where the keepout applies
987
- description: z56.string().optional()
1044
+ description: z58.string().optional()
988
1045
  // Optional description of the keepout
989
1046
  })
990
1047
  );
991
- var cad_component = z57.object({
992
- type: z57.literal("cad_component"),
993
- cad_component_id: z57.string(),
994
- pcb_component_id: z57.string(),
995
- source_component_id: z57.string(),
1048
+ var cad_component = z59.object({
1049
+ type: z59.literal("cad_component"),
1050
+ cad_component_id: z59.string(),
1051
+ pcb_component_id: z59.string(),
1052
+ source_component_id: z59.string(),
996
1053
  position: point3,
997
1054
  rotation: point3.optional(),
998
1055
  size: point3.optional(),
999
1056
  layer: layer_ref.optional(),
1000
1057
  // These are all ways to generate/load the 3d model
1001
- footprinter_string: z57.string().optional(),
1002
- model_obj_url: z57.string().optional(),
1003
- model_stl_url: z57.string().optional(),
1004
- model_3mf_url: z57.string().optional(),
1005
- model_jscad: z57.any().optional()
1058
+ footprinter_string: z59.string().optional(),
1059
+ model_obj_url: z59.string().optional(),
1060
+ model_stl_url: z59.string().optional(),
1061
+ model_3mf_url: z59.string().optional(),
1062
+ model_jscad: z59.any().optional()
1006
1063
  }).describe("Defines a component on the PCB");
1007
- var any_circuit_element = z58.union([
1064
+ var any_circuit_element = z60.union([
1008
1065
  source_trace,
1009
1066
  source_port,
1010
1067
  any_source_component,
@@ -1017,6 +1074,7 @@ var any_circuit_element = z58.union([
1017
1074
  source_simple_diode,
1018
1075
  source_simple_resistor,
1019
1076
  source_simple_power_source,
1077
+ source_simple_battery,
1020
1078
  pcb_component,
1021
1079
  pcb_hole,
1022
1080
  pcb_plated_hole,
@@ -1049,6 +1107,7 @@ var any_circuit_element = z58.union([
1049
1107
  schematic_path,
1050
1108
  schematic_error,
1051
1109
  schematic_net_label,
1110
+ schematic_debug_object,
1052
1111
  cad_component
1053
1112
  ]);
1054
1113
  var any_soup_element = any_circuit_element;
@@ -1490,6 +1549,80 @@ import { mm as mm2 } from "@tscircuit/mm";
1490
1549
  // lib/utils/easyeda-unit-to-mm.ts
1491
1550
  var mil10ToMm = (value) => value * 10 * 0.0254;
1492
1551
 
1552
+ // lib/normalize-pin-labels.ts
1553
+ var normalizePinLabels = (inputPinLabels) => {
1554
+ const unqInputPinLabels = inputPinLabels.map((labels) => [...new Set(labels)]);
1555
+ const result = unqInputPinLabels.map(() => []);
1556
+ const desiredNumbers = unqInputPinLabels.map(() => null);
1557
+ for (let i = 0; i < unqInputPinLabels.length; i++) {
1558
+ for (const label of unqInputPinLabels[i]) {
1559
+ if (/^\d+$/.test(label)) {
1560
+ desiredNumbers[i] = Number.parseInt(label);
1561
+ break;
1562
+ }
1563
+ }
1564
+ }
1565
+ let highestPinNumber = 0;
1566
+ const alreadyAcceptedDesiredNumbers = /* @__PURE__ */ new Set();
1567
+ for (let i = 0; i < desiredNumbers.length; i++) {
1568
+ const desiredNumber = desiredNumbers[i];
1569
+ if (desiredNumber === null || desiredNumber < 1) {
1570
+ continue;
1571
+ }
1572
+ if (!alreadyAcceptedDesiredNumbers.has(desiredNumber)) {
1573
+ alreadyAcceptedDesiredNumbers.add(desiredNumber);
1574
+ result[i].push(`pin${desiredNumber}`);
1575
+ highestPinNumber = Math.max(highestPinNumber, desiredNumber);
1576
+ continue;
1577
+ }
1578
+ let existingAltsForPin = 0;
1579
+ for (const label of result[i]) {
1580
+ if (label.startsWith(`pin${desiredNumber}_alt`)) {
1581
+ existingAltsForPin++;
1582
+ }
1583
+ }
1584
+ result[i].push(`pin${desiredNumber}_alt${existingAltsForPin + 1}`);
1585
+ }
1586
+ for (let i = 0; i < result.length; i++) {
1587
+ const firstLabel = result[i][0];
1588
+ if (firstLabel?.includes("_alt")) {
1589
+ highestPinNumber++;
1590
+ result[i].unshift(`pin${highestPinNumber}`);
1591
+ }
1592
+ }
1593
+ for (let i = 0; i < result.length; i++) {
1594
+ if (result[i].length === 0) {
1595
+ highestPinNumber++;
1596
+ result[i].push(`pin${highestPinNumber}`);
1597
+ }
1598
+ }
1599
+ const totalLabelCounts = {};
1600
+ for (const inputLabels of unqInputPinLabels) {
1601
+ for (const label of inputLabels) {
1602
+ if (/^\d+$/.test(label)) {
1603
+ continue;
1604
+ }
1605
+ totalLabelCounts[label] = (totalLabelCounts[label] ?? 0) + 1;
1606
+ }
1607
+ }
1608
+ const incrementalLabelCounts = {};
1609
+ for (let i = 0; i < unqInputPinLabels.length; i++) {
1610
+ const inputLabels = unqInputPinLabels[i];
1611
+ for (const label of inputLabels) {
1612
+ if (/^\d+$/.test(label)) {
1613
+ continue;
1614
+ }
1615
+ if (totalLabelCounts[label] === 1) {
1616
+ result[i].push(label);
1617
+ } else {
1618
+ incrementalLabelCounts[label] = (incrementalLabelCounts[label] ?? 0) + 1;
1619
+ result[i].push(`${label}${incrementalLabelCounts[label]}`);
1620
+ }
1621
+ }
1622
+ }
1623
+ return result;
1624
+ };
1625
+
1493
1626
  // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
1494
1627
  var mil2mm = (mil) => {
1495
1628
  if (typeof mil === "number") return mm2(`${mil}mil`);
@@ -1572,13 +1705,30 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1572
1705
  layer: "top"
1573
1706
  });
1574
1707
  soupElements.push(source_component, pcb_component2);
1575
- easyEdaJson.packageDetail.dataStr.shape.filter((shape) => shape.type === "PAD").forEach((pad, index) => {
1576
- const portNumber = pad.number.toString();
1708
+ const pads = easyEdaJson.packageDetail.dataStr.shape.filter(
1709
+ (shape) => shape.type === "PAD"
1710
+ );
1711
+ const pins = easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN");
1712
+ const pinLabelSets = pads.map((pad) => {
1713
+ const labels = [];
1714
+ if (pad.number) labels.push(pad.number.toString());
1715
+ const pin = pins.find((p) => p.pinNumber === pad.number);
1716
+ if (pin) labels.push(pin.label);
1717
+ return labels;
1718
+ });
1719
+ const normalizedPinLabels = normalizePinLabels(pinLabelSets);
1720
+ pads.forEach((pad, index) => {
1721
+ const portHints = normalizedPinLabels[index];
1722
+ const pinNumber = Number.parseInt(
1723
+ portHints.find((hint) => hint.match(/pin\d+/)).replace("pin", "")
1724
+ );
1577
1725
  soupElements.push({
1578
1726
  type: "source_port",
1579
1727
  source_port_id: `source_port_${index + 1}`,
1580
1728
  source_component_id: "source_component_1",
1581
- name: portNumber
1729
+ name: `pin${pinNumber}`,
1730
+ pin_number: pinNumber,
1731
+ port_hints: portHints.filter((hint) => hint !== `pin${pinNumber}`)
1582
1732
  });
1583
1733
  if (pad.holeRadius !== void 0 && mil2mm(pad.holeRadius) !== 0) {
1584
1734
  const commonPlatedHoleProps = {
@@ -1587,7 +1737,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1587
1737
  x: mil2mm(pad.center.x),
1588
1738
  y: mil2mm(pad.center.y),
1589
1739
  layers: ["top"],
1590
- port_hints: [portNumber],
1740
+ port_hints: [`pin${pinNumber}`],
1591
1741
  pcb_component_id: "pcb_component_1",
1592
1742
  pcb_port_id: `pcb_port_${index + 1}`
1593
1743
  };
@@ -1640,15 +1790,20 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1640
1790
  if (!soupShape) {
1641
1791
  throw new Error(`unknown pad.shape: "${pad.shape}"`);
1642
1792
  }
1793
+ const rectSize = { width: mil2mm(pad.width), height: mil2mm(pad.height) };
1794
+ if (pad.rotation === 90 || pad.rotation === 270) {
1795
+ rectSize.width = mil2mm(pad.height);
1796
+ rectSize.height = mil2mm(pad.width);
1797
+ }
1643
1798
  const parsedPcbSmtpad = pcb_smtpad.parse({
1644
1799
  type: "pcb_smtpad",
1645
1800
  pcb_smtpad_id: `pcb_smtpad_${index + 1}`,
1646
1801
  shape: soupShape,
1647
1802
  x: mil2mm(pad.center.x),
1648
1803
  y: mil2mm(pad.center.y),
1649
- ...soupShape === "rect" ? { width: mil2mm(pad.width), height: mil2mm(pad.height) } : { radius: Math.min(mil2mm(pad.width), mil2mm(pad.height)) / 2 },
1804
+ ...soupShape === "rect" ? rectSize : { radius: Math.min(mil2mm(pad.width), mil2mm(pad.height)) / 2 },
1650
1805
  layer: "top",
1651
- port_hints: [portNumber],
1806
+ port_hints: [`pin${pinNumber}`],
1652
1807
  pcb_component_id: "pcb_component_1",
1653
1808
  pcb_port_id: `pcb_port_${index + 1}`
1654
1809
  });
@@ -1751,14 +1906,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber) {
1751
1906
  }
1752
1907
 
1753
1908
  // lib/schemas/easy-eda-json-schema.ts
1754
- import { z as z61 } from "zod";
1909
+ import { z as z63 } from "zod";
1755
1910
 
1756
1911
  // lib/schemas/package-detail-shape-schema.ts
1757
- import { z as z59 } from "zod";
1758
- var tenthmil = z59.union([z59.number(), z59.string()]).optional().transform(
1912
+ import { z as z61 } from "zod";
1913
+ var tenthmil = z61.union([z61.number(), z61.string()]).optional().transform(
1759
1914
  (n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
1760
- ).pipe(z59.string());
1761
- var PointSchema = z59.any().transform((p) => {
1915
+ ).pipe(z61.string());
1916
+ var PointSchema = z61.any().transform((p) => {
1762
1917
  if (Array.isArray(p)) {
1763
1918
  const [x, y] = p;
1764
1919
  return { x, y };
@@ -1767,87 +1922,87 @@ var PointSchema = z59.any().transform((p) => {
1767
1922
  }
1768
1923
  throw new Error(`Invalid point: ${p}`);
1769
1924
  }).pipe(
1770
- z59.object({
1771
- x: z59.number(),
1772
- y: z59.number()
1925
+ z61.object({
1926
+ x: z61.number(),
1927
+ y: z61.number()
1773
1928
  })
1774
1929
  );
1775
- var BaseShapeSchema = z59.object({
1776
- type: z59.string(),
1777
- id: z59.string().optional(),
1778
- layer: z59.coerce.number().optional()
1930
+ var BaseShapeSchema = z61.object({
1931
+ type: z61.string(),
1932
+ id: z61.string().optional(),
1933
+ layer: z61.coerce.number().optional()
1779
1934
  });
1780
1935
  var TrackSchema = BaseShapeSchema.extend({
1781
- type: z59.literal("TRACK"),
1782
- width: z59.coerce.number(),
1783
- points: z59.array(PointSchema)
1936
+ type: z61.literal("TRACK"),
1937
+ width: z61.coerce.number(),
1938
+ points: z61.array(PointSchema)
1784
1939
  });
1785
1940
  var PadSchema = BaseShapeSchema.extend({
1786
- type: z59.literal("PAD"),
1787
- shape: z59.enum(["RECT", "ELLIPSE", "OVAL"]),
1788
- center: z59.object({
1941
+ type: z61.literal("PAD"),
1942
+ shape: z61.enum(["RECT", "ELLIPSE", "OVAL"]),
1943
+ center: z61.object({
1789
1944
  x: tenthmil,
1790
1945
  y: tenthmil
1791
1946
  }),
1792
1947
  width: tenthmil,
1793
1948
  height: tenthmil,
1794
- layermask: z59.number(),
1795
- net: z59.union([z59.string(), z59.number()]).optional(),
1796
- number: z59.union([z59.string(), z59.number()]),
1949
+ layermask: z61.number(),
1950
+ net: z61.union([z61.string(), z61.number()]).optional(),
1951
+ number: z61.union([z61.string(), z61.number()]),
1797
1952
  holeRadius: tenthmil,
1798
- points: z59.array(PointSchema).optional(),
1799
- rotation: z59.number().optional(),
1800
- plated: z59.boolean()
1953
+ points: z61.array(PointSchema).optional(),
1954
+ rotation: z61.number().optional(),
1955
+ plated: z61.boolean()
1801
1956
  });
1802
1957
  var ArcSchema = BaseShapeSchema.extend({
1803
- type: z59.literal("ARC"),
1804
- width: z59.number(),
1958
+ type: z61.literal("ARC"),
1959
+ width: z61.number(),
1805
1960
  start: PointSchema,
1806
1961
  end: PointSchema,
1807
- radiusX: z59.number(),
1808
- radiusY: z59.number(),
1809
- largeArc: z59.boolean(),
1810
- sweepDirection: z59.enum(["CW", "CCW"])
1962
+ radiusX: z61.number(),
1963
+ radiusY: z61.number(),
1964
+ largeArc: z61.boolean(),
1965
+ sweepDirection: z61.enum(["CW", "CCW"])
1811
1966
  });
1812
1967
  var CircleSchema = BaseShapeSchema.extend({
1813
- type: z59.literal("CIRCLE"),
1968
+ type: z61.literal("CIRCLE"),
1814
1969
  center: PointSchema,
1815
- radius: z59.number(),
1816
- width: z59.number()
1970
+ radius: z61.number(),
1971
+ width: z61.number()
1817
1972
  });
1818
1973
  var SolidRegionSchema = BaseShapeSchema.extend({
1819
- type: z59.literal("SOLIDREGION"),
1820
- layermask: z59.number(),
1821
- points: z59.array(PointSchema),
1822
- fillStyle: z59.string()
1974
+ type: z61.literal("SOLIDREGION"),
1975
+ layermask: z61.number(),
1976
+ points: z61.array(PointSchema),
1977
+ fillStyle: z61.string()
1823
1978
  });
1824
1979
  var SVGNodeSchema = BaseShapeSchema.extend({
1825
- type: z59.literal("SVGNODE"),
1826
- svgData: z59.object({
1827
- gId: z59.string(),
1828
- nodeName: z59.string(),
1829
- nodeType: z59.number(),
1830
- layerid: z59.string(),
1831
- attrs: z59.record(z59.string(), z59.string()),
1832
- childNodes: z59.array(z59.unknown())
1980
+ type: z61.literal("SVGNODE"),
1981
+ svgData: z61.object({
1982
+ gId: z61.string(),
1983
+ nodeName: z61.string(),
1984
+ nodeType: z61.number(),
1985
+ layerid: z61.string(),
1986
+ attrs: z61.record(z61.string(), z61.string()),
1987
+ childNodes: z61.array(z61.unknown())
1833
1988
  })
1834
1989
  });
1835
1990
  var HoleSchema = BaseShapeSchema.extend({
1836
- type: z59.literal("HOLE"),
1991
+ type: z61.literal("HOLE"),
1837
1992
  center: PointSchema,
1838
- radius: z59.number()
1993
+ radius: z61.number()
1839
1994
  });
1840
1995
  var RectSchema = BaseShapeSchema.extend({
1841
- type: z59.literal("RECT"),
1996
+ type: z61.literal("RECT"),
1842
1997
  x: tenthmil,
1843
1998
  y: tenthmil,
1844
1999
  width: tenthmil,
1845
2000
  height: tenthmil,
1846
- lineWidth: z59.number(),
1847
- fillStyle: z59.string(),
1848
- rotation: z59.number().optional()
2001
+ lineWidth: z61.number(),
2002
+ fillStyle: z61.string(),
2003
+ rotation: z61.number().optional()
1849
2004
  });
1850
- var PackageDetailShapeSchema = z59.discriminatedUnion("type", [
2005
+ var PackageDetailShapeSchema = z61.discriminatedUnion("type", [
1851
2006
  TrackSchema,
1852
2007
  PadSchema,
1853
2008
  ArcSchema,
@@ -1867,9 +2022,9 @@ var pairs = (arr) => {
1867
2022
  var parsePoints = (pointsStr) => pairs(
1868
2023
  pointsStr.trim().split(" ").map((n) => Number(n))
1869
2024
  );
1870
- var ShapeItemSchema = z59.object({
1871
- type: z59.string(),
1872
- data: z59.string()
2025
+ var ShapeItemSchema = z61.object({
2026
+ type: z61.string(),
2027
+ data: z61.string()
1873
2028
  }).transform((shape) => {
1874
2029
  const [firstParam, ...restParams] = shape.data.split("~");
1875
2030
  const lastParam = restParams.pop();
@@ -2009,23 +2164,23 @@ var ShapeItemSchema = z59.object({
2009
2164
  return BaseShapeSchema.parse({ type: shape.type });
2010
2165
  }
2011
2166
  }).pipe(PackageDetailShapeSchema);
2012
- var ShapesArraySchema = z59.array(ShapeItemSchema);
2167
+ var ShapesArraySchema = z61.array(ShapeItemSchema);
2013
2168
 
2014
2169
  // lib/schemas/single-letter-shape-schema.ts
2015
- import { z as z60 } from "zod";
2170
+ import { z as z62 } from "zod";
2016
2171
  import "@tscircuit/mm";
2017
- var PointSchema2 = z60.object({
2018
- x: z60.number(),
2019
- y: z60.number()
2172
+ var PointSchema2 = z62.object({
2173
+ x: z62.number(),
2174
+ y: z62.number()
2020
2175
  });
2021
- var RectangleShapeOutputSchema = z60.object({
2022
- type: z60.literal("RECTANGLE"),
2176
+ var RectangleShapeOutputSchema = z62.object({
2177
+ type: z62.literal("RECTANGLE"),
2023
2178
  position: PointSchema2,
2024
- width: z60.number(),
2025
- height: z60.number(),
2026
- color: z60.string(),
2027
- lineWidth: z60.number(),
2028
- id: z60.string()
2179
+ width: z62.number(),
2180
+ height: z62.number(),
2181
+ color: z62.string(),
2182
+ lineWidth: z62.number(),
2183
+ id: z62.string()
2029
2184
  });
2030
2185
  var parseRectangle = (str) => {
2031
2186
  const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
@@ -2039,15 +2194,15 @@ var parseRectangle = (str) => {
2039
2194
  id
2040
2195
  };
2041
2196
  };
2042
- var RectangleShapeSchema = z60.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
2043
- var EllipseShapeOutputSchema = z60.object({
2044
- type: z60.literal("ELLIPSE"),
2197
+ var RectangleShapeSchema = z62.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
2198
+ var EllipseShapeOutputSchema = z62.object({
2199
+ type: z62.literal("ELLIPSE"),
2045
2200
  center: PointSchema2,
2046
- radiusX: z60.number(),
2047
- radiusY: z60.number(),
2048
- color: z60.string(),
2049
- lineWidth: z60.number(),
2050
- id: z60.string()
2201
+ radiusX: z62.number(),
2202
+ radiusY: z62.number(),
2203
+ color: z62.string(),
2204
+ lineWidth: z62.number(),
2205
+ id: z62.string()
2051
2206
  });
2052
2207
  var parseEllipse = (str) => {
2053
2208
  const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
@@ -2061,19 +2216,19 @@ var parseEllipse = (str) => {
2061
2216
  id
2062
2217
  };
2063
2218
  };
2064
- var EllipseShapeSchema = z60.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
2065
- var PinShapeOutputSchema = z60.object({
2066
- type: z60.literal("PIN"),
2067
- visibility: z60.enum(["show", "hide"]),
2068
- pinNumber: z60.union([z60.string(), z60.number()]),
2069
- x: z60.number(),
2070
- y: z60.number(),
2071
- rotation: z60.number(),
2072
- id: z60.string(),
2073
- label: z60.string(),
2074
- labelColor: z60.string(),
2075
- path: z60.string(),
2076
- arrow: z60.string()
2219
+ var EllipseShapeSchema = z62.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
2220
+ var PinShapeOutputSchema = z62.object({
2221
+ type: z62.literal("PIN"),
2222
+ visibility: z62.enum(["show", "hide"]),
2223
+ pinNumber: z62.union([z62.string(), z62.number()]),
2224
+ x: z62.number(),
2225
+ y: z62.number(),
2226
+ rotation: z62.number(),
2227
+ id: z62.string(),
2228
+ label: z62.string(),
2229
+ labelColor: z62.string(),
2230
+ path: z62.string(),
2231
+ arrow: z62.string()
2077
2232
  });
2078
2233
  var parsePin = (pinString) => {
2079
2234
  const parts = pinString.split("~");
@@ -2100,13 +2255,13 @@ var parsePin = (pinString) => {
2100
2255
  arrow
2101
2256
  };
2102
2257
  };
2103
- var PinShapeSchema = z60.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
2104
- var PolylineShapeOutputSchema = z60.object({
2105
- type: z60.literal("POLYLINE"),
2106
- points: z60.array(PointSchema2),
2107
- color: z60.string(),
2108
- lineWidth: z60.number(),
2109
- id: z60.string()
2258
+ var PinShapeSchema = z62.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
2259
+ var PolylineShapeOutputSchema = z62.object({
2260
+ type: z62.literal("POLYLINE"),
2261
+ points: z62.array(PointSchema2),
2262
+ color: z62.string(),
2263
+ lineWidth: z62.number(),
2264
+ id: z62.string()
2110
2265
  });
2111
2266
  var parsePoints2 = (pointsStr) => {
2112
2267
  return pointsStr.split(" ").reduce((acc, value, index) => {
@@ -2129,14 +2284,14 @@ var parsePolyline = (str) => {
2129
2284
  id
2130
2285
  };
2131
2286
  };
2132
- var PolylineShapeSchema = z60.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
2133
- var PolygonShapeOutputSchema = z60.object({
2134
- type: z60.literal("POLYGON"),
2135
- points: z60.array(PointSchema2),
2136
- fillColor: z60.string(),
2137
- lineWidth: z60.number(),
2138
- lineColor: z60.string(),
2139
- id: z60.string()
2287
+ var PolylineShapeSchema = z62.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
2288
+ var PolygonShapeOutputSchema = z62.object({
2289
+ type: z62.literal("POLYGON"),
2290
+ points: z62.array(PointSchema2),
2291
+ fillColor: z62.string(),
2292
+ lineWidth: z62.number(),
2293
+ lineColor: z62.string(),
2294
+ id: z62.string()
2140
2295
  });
2141
2296
  var parsePolygon = (str) => {
2142
2297
  const [, ...rest] = str.split("~");
@@ -2150,14 +2305,14 @@ var parsePolygon = (str) => {
2150
2305
  id
2151
2306
  };
2152
2307
  };
2153
- var PolygonShapeSchema = z60.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
2154
- var PathShapeOutputSchema = z60.object({
2155
- type: z60.literal("PATH"),
2156
- pathData: z60.string(),
2157
- fillColor: z60.string(),
2158
- strokeWidth: z60.number(),
2159
- strokeColor: z60.string(),
2160
- id: z60.string()
2308
+ var PolygonShapeSchema = z62.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
2309
+ var PathShapeOutputSchema = z62.object({
2310
+ type: z62.literal("PATH"),
2311
+ pathData: z62.string(),
2312
+ fillColor: z62.string(),
2313
+ strokeWidth: z62.number(),
2314
+ strokeColor: z62.string(),
2315
+ id: z62.string()
2161
2316
  });
2162
2317
  var parsePath = (str) => {
2163
2318
  const [, pathData, fillColor, strokeWidth, strokeColor, , id] = str.split("~");
@@ -2170,24 +2325,24 @@ var parsePath = (str) => {
2170
2325
  id
2171
2326
  };
2172
2327
  };
2173
- var PathShapeSchema = z60.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
2174
- var TextShapeOutputSchema = z60.object({
2175
- type: z60.literal("TEXT"),
2176
- alignment: z60.enum(["L", "C", "R"]),
2177
- x: z60.number(),
2178
- y: z60.number(),
2179
- rotation: z60.number(),
2180
- fontColor: z60.string(),
2181
- backgroundColor: z60.string().optional(),
2182
- fontSize: z60.string(),
2183
- fontWeight: z60.enum(["normal", "bold"]).optional().default("normal"),
2184
- fontStyle: z60.enum(["normal", "italic"]).optional().default("normal"),
2185
- fontDecoration: z60.enum(["", "underline"]),
2186
- content: z60.string(),
2187
- textType: z60.string(),
2188
- visibility: z60.enum(["0", "1"]),
2189
- mirror: z60.string(),
2190
- id: z60.string()
2328
+ var PathShapeSchema = z62.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
2329
+ var TextShapeOutputSchema = z62.object({
2330
+ type: z62.literal("TEXT"),
2331
+ alignment: z62.enum(["L", "C", "R"]),
2332
+ x: z62.number(),
2333
+ y: z62.number(),
2334
+ rotation: z62.number(),
2335
+ fontColor: z62.string(),
2336
+ backgroundColor: z62.string().optional(),
2337
+ fontSize: z62.string(),
2338
+ fontWeight: z62.enum(["normal", "bold"]).optional().default("normal"),
2339
+ fontStyle: z62.enum(["normal", "italic"]).optional().default("normal"),
2340
+ fontDecoration: z62.enum(["", "underline"]),
2341
+ content: z62.string(),
2342
+ textType: z62.string(),
2343
+ visibility: z62.enum(["0", "1"]),
2344
+ mirror: z62.string(),
2345
+ id: z62.string()
2191
2346
  });
2192
2347
  var parseText = (str) => {
2193
2348
  const [
@@ -2227,8 +2382,8 @@ var parseText = (str) => {
2227
2382
  id
2228
2383
  };
2229
2384
  };
2230
- var TextShapeSchema = z60.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema);
2231
- var SingleLetterShapeSchema = z60.string().transform((x) => {
2385
+ var TextShapeSchema = z62.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema);
2386
+ var SingleLetterShapeSchema = z62.string().transform((x) => {
2232
2387
  if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
2233
2388
  if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
2234
2389
  if (x.startsWith("P~")) return PinShapeSchema.parse(x);
@@ -2238,7 +2393,7 @@ var SingleLetterShapeSchema = z60.string().transform((x) => {
2238
2393
  if (x.startsWith("T~")) return TextShapeSchema.parse(x);
2239
2394
  throw new Error(`Invalid shape type: ${x}`);
2240
2395
  }).pipe(
2241
- z60.union([
2396
+ z62.union([
2242
2397
  RectangleShapeOutputSchema,
2243
2398
  EllipseShapeOutputSchema,
2244
2399
  PinShapeOutputSchema,
@@ -2250,81 +2405,81 @@ var SingleLetterShapeSchema = z60.string().transform((x) => {
2250
2405
  );
2251
2406
 
2252
2407
  // lib/schemas/easy-eda-json-schema.ts
2253
- var maybeNumber = z61.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(z61.number().nullable().optional());
2254
- var SzlcscSchema = z61.object({
2255
- id: z61.number(),
2256
- number: z61.string(),
2257
- step: z61.number().optional(),
2258
- min: z61.number().optional(),
2259
- price: z61.number().optional(),
2260
- stock: z61.number().optional(),
2261
- url: z61.string().url().optional(),
2262
- image: z61.string().optional().optional()
2263
- });
2264
- var LcscSchema = z61.object({
2265
- id: z61.number(),
2266
- number: z61.string(),
2267
- step: z61.number().optional(),
2268
- min: z61.number().optional(),
2269
- price: z61.number().optional(),
2270
- stock: z61.number().optional(),
2271
- url: z61.string().url().optional()
2272
- });
2273
- var OwnerSchema = z61.object({
2274
- uuid: z61.string(),
2275
- username: z61.string(),
2276
- nickname: z61.string(),
2277
- avatar: z61.string()
2278
- });
2279
- var HeadSchema = z61.object({
2280
- docType: z61.string(),
2281
- editorVersion: z61.string(),
2282
- c_para: z61.record(z61.string(), z61.string()),
2283
- x: z61.number(),
2284
- y: z61.number(),
2285
- puuid: z61.string().optional(),
2286
- uuid: z61.string(),
2287
- utime: z61.number(),
2288
- importFlag: z61.number().optional(),
2289
- c_spiceCmd: z61.any().optional(),
2290
- hasIdFlag: z61.boolean()
2291
- });
2292
- var BBoxSchema = z61.object({
2293
- x: z61.number(),
2294
- y: z61.number(),
2295
- width: z61.number(),
2296
- height: z61.number()
2297
- });
2298
- var LayerItemSchema = z61.object({
2299
- name: z61.string(),
2300
- color: z61.string(),
2301
- visible: z61.boolean(),
2302
- active: z61.boolean(),
2303
- config: z61.boolean(),
2304
- transparency: z61.boolean()
2305
- });
2306
- var ObjectItemSchema = z61.object({
2307
- name: z61.string(),
2308
- visible: z61.boolean(),
2309
- locked: z61.boolean()
2310
- });
2311
- var DataStrSchema = z61.object({
2408
+ var maybeNumber = z63.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(z63.number().nullable().optional());
2409
+ var SzlcscSchema = z63.object({
2410
+ id: z63.number(),
2411
+ number: z63.string(),
2412
+ step: z63.number().optional(),
2413
+ min: z63.number().optional(),
2414
+ price: z63.number().optional(),
2415
+ stock: z63.number().optional(),
2416
+ url: z63.string().url().optional(),
2417
+ image: z63.string().optional().optional()
2418
+ });
2419
+ var LcscSchema = z63.object({
2420
+ id: z63.number(),
2421
+ number: z63.string(),
2422
+ step: z63.number().optional(),
2423
+ min: z63.number().optional(),
2424
+ price: z63.number().optional(),
2425
+ stock: z63.number().optional(),
2426
+ url: z63.string().url().optional()
2427
+ });
2428
+ var OwnerSchema = z63.object({
2429
+ uuid: z63.string(),
2430
+ username: z63.string(),
2431
+ nickname: z63.string(),
2432
+ avatar: z63.string()
2433
+ });
2434
+ var HeadSchema = z63.object({
2435
+ docType: z63.string(),
2436
+ editorVersion: z63.string(),
2437
+ c_para: z63.record(z63.string(), z63.string()),
2438
+ x: z63.number(),
2439
+ y: z63.number(),
2440
+ puuid: z63.string().optional(),
2441
+ uuid: z63.string(),
2442
+ utime: z63.number(),
2443
+ importFlag: z63.number().optional(),
2444
+ c_spiceCmd: z63.any().optional(),
2445
+ hasIdFlag: z63.boolean()
2446
+ });
2447
+ var BBoxSchema = z63.object({
2448
+ x: z63.number(),
2449
+ y: z63.number(),
2450
+ width: z63.number(),
2451
+ height: z63.number()
2452
+ });
2453
+ var LayerItemSchema = z63.object({
2454
+ name: z63.string(),
2455
+ color: z63.string(),
2456
+ visible: z63.boolean(),
2457
+ active: z63.boolean(),
2458
+ config: z63.boolean(),
2459
+ transparency: z63.boolean()
2460
+ });
2461
+ var ObjectItemSchema = z63.object({
2462
+ name: z63.string(),
2463
+ visible: z63.boolean(),
2464
+ locked: z63.boolean()
2465
+ });
2466
+ var DataStrSchema = z63.object({
2312
2467
  head: HeadSchema,
2313
- canvas: z61.string(),
2314
- shape: z61.array(SingleLetterShapeSchema),
2468
+ canvas: z63.string(),
2469
+ shape: z63.array(SingleLetterShapeSchema),
2315
2470
  BBox: BBoxSchema,
2316
- colors: z61.array(z61.unknown())
2471
+ colors: z63.array(z63.unknown())
2317
2472
  });
2318
- var PackageDetailDataStrSchema = z61.object({
2473
+ var PackageDetailDataStrSchema = z63.object({
2319
2474
  head: HeadSchema,
2320
- canvas: z61.string(),
2321
- shape: z61.array(z61.string()).transform(
2475
+ canvas: z63.string(),
2476
+ shape: z63.array(z63.string()).transform(
2322
2477
  (shapes) => shapes.map((shape) => {
2323
2478
  const [type, ...data] = shape.split("~");
2324
2479
  return ShapeItemSchema.parse({ type, data: data.join("~") });
2325
2480
  })
2326
- ).pipe(z61.array(PackageDetailShapeSchema)),
2327
- layers: z61.array(z61.string()).transform(
2481
+ ).pipe(z63.array(PackageDetailShapeSchema)),
2482
+ layers: z63.array(z63.string()).transform(
2328
2483
  (layers) => layers.map((layer) => {
2329
2484
  const [name, color, visible, active, config, transparency] = layer.split("~");
2330
2485
  return LayerItemSchema.parse({
@@ -2337,7 +2492,7 @@ var PackageDetailDataStrSchema = z61.object({
2337
2492
  });
2338
2493
  })
2339
2494
  ),
2340
- objects: z61.array(z61.string()).transform(
2495
+ objects: z63.array(z63.string()).transform(
2341
2496
  (objects) => objects.map((obj) => {
2342
2497
  const [name, visible, locked] = obj.split("~");
2343
2498
  return ObjectItemSchema.parse({
@@ -2348,37 +2503,37 @@ var PackageDetailDataStrSchema = z61.object({
2348
2503
  })
2349
2504
  ),
2350
2505
  BBox: BBoxSchema,
2351
- netColors: z61.array(z61.unknown()).optional()
2506
+ netColors: z63.array(z63.unknown()).optional()
2352
2507
  });
2353
- var PackageDetailSchema = z61.object({
2354
- uuid: z61.string(),
2355
- title: z61.string(),
2356
- docType: z61.number(),
2357
- updateTime: z61.number(),
2508
+ var PackageDetailSchema = z63.object({
2509
+ uuid: z63.string(),
2510
+ title: z63.string(),
2511
+ docType: z63.number(),
2512
+ updateTime: z63.number(),
2358
2513
  owner: OwnerSchema,
2359
- datastrid: z61.string(),
2360
- writable: z61.boolean(),
2514
+ datastrid: z63.string(),
2515
+ writable: z63.boolean(),
2361
2516
  dataStr: PackageDetailDataStrSchema
2362
2517
  });
2363
- var EasyEdaJsonSchema = z61.object({
2364
- uuid: z61.string(),
2365
- title: z61.string(),
2366
- description: z61.string(),
2367
- docType: z61.number(),
2368
- type: z61.number(),
2518
+ var EasyEdaJsonSchema = z63.object({
2519
+ uuid: z63.string(),
2520
+ title: z63.string(),
2521
+ description: z63.string(),
2522
+ docType: z63.number(),
2523
+ type: z63.number(),
2369
2524
  szlcsc: SzlcscSchema,
2370
2525
  lcsc: LcscSchema,
2371
2526
  owner: OwnerSchema,
2372
- tags: z61.array(z61.string()),
2373
- updateTime: z61.number(),
2374
- updated_at: z61.string(),
2527
+ tags: z63.array(z63.string()),
2528
+ updateTime: z63.number(),
2529
+ updated_at: z63.string(),
2375
2530
  dataStr: DataStrSchema,
2376
- verify: z61.boolean(),
2377
- SMT: z61.boolean().optional(),
2378
- datastrid: z61.string(),
2379
- jlcOnSale: z61.number().optional(),
2380
- writable: z61.boolean(),
2381
- isFavorite: z61.boolean(),
2531
+ verify: z63.boolean(),
2532
+ SMT: z63.boolean().optional(),
2533
+ datastrid: z63.string(),
2534
+ jlcOnSale: z63.number().optional(),
2535
+ writable: z63.boolean(),
2536
+ isFavorite: z63.boolean(),
2382
2537
  packageDetail: PackageDetailSchema
2383
2538
  });
2384
2539
 
@@ -2438,7 +2593,6 @@ var generateFootprintTsx = (circuitJson) => {
2438
2593
  var soupTypescriptComponentTemplate = ({
2439
2594
  pinLabels,
2440
2595
  componentName,
2441
- schPinArrangement,
2442
2596
  objUrl,
2443
2597
  circuitJson,
2444
2598
  supplierPartNumbers
@@ -2466,7 +2620,6 @@ export const ${componentName} = (props: Props) => {
2466
2620
  }}` : ""}
2467
2621
  pinLabels={pinLabels}
2468
2622
  schPinSpacing={0.75}
2469
- schPortArrangement={${JSON.stringify(schPinArrangement, null, " ")}}
2470
2623
  supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
2471
2624
  footprint={${footprintTsx}}
2472
2625
  />
@@ -2505,39 +2658,10 @@ var convertBetterEasyToTsx = async ({
2505
2658
  const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
2506
2659
  const pn = normalizeManufacturerPartNumber(rawPn);
2507
2660
  const [cad_component2] = su_default(circuitJson).cad_component.list();
2508
- const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
2509
- const hasStringPinNumbers = pins.some(
2510
- (pin) => typeof pin.pinNumber === "string"
2511
- );
2512
- let modifiedPins = pins;
2513
- if (hasStringPinNumbers) {
2514
- modifiedPins = pins.map((pin, idx) => {
2515
- const originalPinNumber = pin.pinNumber.toString();
2516
- const newPinNumber = idx + 1;
2517
- return {
2518
- ...pin,
2519
- pinNumber: newPinNumber,
2520
- label: pin.label
2521
- };
2522
- });
2523
- }
2524
- const leftPins = modifiedPins.filter((pin) => pin.rotation === 180);
2525
- const rightPins = modifiedPins.filter((pin) => pin.rotation === 0);
2526
- const schPinArrangement = {
2527
- leftSide: {
2528
- direction: "top-to-bottom",
2529
- pins: leftPins.map((pin) => Number(pin.pinNumber))
2530
- },
2531
- rightSide: {
2532
- direction: "bottom-to-top",
2533
- pins: rightPins.map((pin) => Number(pin.pinNumber)).reverse()
2534
- }
2535
- };
2661
+ const sourcePorts = su_default(circuitJson).source_port.list();
2536
2662
  const pinLabels = {};
2537
- for (const pin of modifiedPins) {
2538
- const isPinLabelNumeric = /^\d+$/.test(pin.label);
2539
- const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
2540
- pinLabels[pin.pinNumber] = label;
2663
+ for (const sourcePort of sourcePorts) {
2664
+ pinLabels[sourcePort.name] = sourcePort.port_hints ?? [];
2541
2665
  }
2542
2666
  let modelObjUrl;
2543
2667
  if (cad_component2.model_obj_url) {
@@ -2554,7 +2678,6 @@ var convertBetterEasyToTsx = async ({
2554
2678
  return soupTypescriptComponentTemplate({
2555
2679
  componentName: pn,
2556
2680
  pinLabels,
2557
- schPinArrangement,
2558
2681
  objUrl: modelObjUrl,
2559
2682
  circuitJson,
2560
2683
  supplierPartNumbers
@@ -2661,4 +2784,4 @@ export {
2661
2784
  convertRawEasyToTsx,
2662
2785
  convertEasyEdaJsonToVariousFormats
2663
2786
  };
2664
- //# sourceMappingURL=chunk-MRLBLBCQ.js.map
2787
+ //# sourceMappingURL=chunk-H6ZXXBFR.js.map