easyeda 0.0.30 → 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.
@@ -0,0 +1,2295 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // lib/schemas/package-detail-shape-schema.ts
8
+ import { z } from "zod";
9
+ var tenthmil = z.union([z.number(), z.string()]).optional().transform(
10
+ (n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
11
+ ).pipe(z.string());
12
+ var PointSchema = z.any().transform((p) => {
13
+ if (Array.isArray(p)) {
14
+ const [x, y] = p;
15
+ return { x, y };
16
+ } else if (typeof p === "object") {
17
+ return p;
18
+ }
19
+ throw new Error(`Invalid point: ${p}`);
20
+ }).pipe(
21
+ z.object({
22
+ x: z.number(),
23
+ y: z.number()
24
+ })
25
+ );
26
+ var BaseShapeSchema = z.object({
27
+ type: z.string(),
28
+ id: z.string().optional(),
29
+ layer: z.coerce.number().optional()
30
+ });
31
+ var TrackSchema = BaseShapeSchema.extend({
32
+ type: z.literal("TRACK"),
33
+ width: z.coerce.number(),
34
+ points: z.array(PointSchema)
35
+ });
36
+ var PadSchema = BaseShapeSchema.extend({
37
+ type: z.literal("PAD"),
38
+ shape: z.enum(["RECT", "ELLIPSE", "OVAL"]),
39
+ center: z.object({
40
+ x: tenthmil,
41
+ y: tenthmil
42
+ }),
43
+ width: tenthmil,
44
+ height: tenthmil,
45
+ layermask: z.number(),
46
+ net: z.union([z.string(), z.number()]).optional(),
47
+ number: z.number(),
48
+ holeRadius: tenthmil,
49
+ points: z.array(PointSchema).optional(),
50
+ rotation: z.number().optional(),
51
+ plated: z.boolean()
52
+ });
53
+ var ArcSchema = BaseShapeSchema.extend({
54
+ type: z.literal("ARC"),
55
+ width: z.number(),
56
+ start: PointSchema,
57
+ end: PointSchema,
58
+ radiusX: z.number(),
59
+ radiusY: z.number(),
60
+ largeArc: z.boolean(),
61
+ sweepDirection: z.enum(["CW", "CCW"])
62
+ });
63
+ var CircleSchema = BaseShapeSchema.extend({
64
+ type: z.literal("CIRCLE"),
65
+ center: PointSchema,
66
+ radius: z.number(),
67
+ width: z.number()
68
+ });
69
+ var SolidRegionSchema = BaseShapeSchema.extend({
70
+ type: z.literal("SOLIDREGION"),
71
+ layermask: z.number(),
72
+ points: z.array(PointSchema),
73
+ fillStyle: z.string()
74
+ });
75
+ var SVGNodeSchema = BaseShapeSchema.extend({
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())
84
+ })
85
+ });
86
+ var HoleSchema = BaseShapeSchema.extend({
87
+ type: z.literal("HOLE"),
88
+ center: PointSchema,
89
+ radius: z.number()
90
+ });
91
+ var RectSchema = BaseShapeSchema.extend({
92
+ type: z.literal("RECT"),
93
+ x: tenthmil,
94
+ y: tenthmil,
95
+ width: tenthmil,
96
+ height: tenthmil,
97
+ lineWidth: z.number(),
98
+ fillStyle: z.string(),
99
+ rotation: z.number().optional()
100
+ });
101
+ var PackageDetailShapeSchema = z.discriminatedUnion("type", [
102
+ TrackSchema,
103
+ PadSchema,
104
+ ArcSchema,
105
+ CircleSchema,
106
+ SolidRegionSchema,
107
+ SVGNodeSchema,
108
+ HoleSchema,
109
+ RectSchema
110
+ ]);
111
+ var pairs = (arr) => {
112
+ const pairs2 = [];
113
+ for (let i = 0; i < arr.length; i += 2) {
114
+ pairs2.push([arr[i], arr[i + 1]]);
115
+ }
116
+ return pairs2;
117
+ };
118
+ var parsePoints = (pointsStr) => pairs(
119
+ pointsStr.trim().split(" ").map((n) => Number(n))
120
+ );
121
+ var ShapeItemSchema = z.object({
122
+ type: z.string(),
123
+ data: z.string()
124
+ }).transform((shape) => {
125
+ const [firstParam, ...restParams] = shape.data.split("~");
126
+ const lastParam = restParams.pop();
127
+ switch (shape.type) {
128
+ case "TRACK": {
129
+ const [width, layer, _, pointsStr, id, _n] = shape.data.split("~");
130
+ const points = parsePoints(pointsStr);
131
+ return TrackSchema.parse({ type: "TRACK", width, layer, points, id });
132
+ }
133
+ case "PAD": {
134
+ const [padShape, ...params] = shape.data.split("~");
135
+ const [
136
+ centerX,
137
+ centerY,
138
+ width,
139
+ height,
140
+ layermask,
141
+ net,
142
+ number,
143
+ holeRadius,
144
+ ...rest
145
+ ] = params.map((p) => isNaN(Number(p)) ? p : Number(p));
146
+ const center = { x: centerX, y: centerY };
147
+ let points, rotation2;
148
+ if (padShape === "RECT") {
149
+ points = parsePoints(rest[0]);
150
+ rotation2 = Number(rest[1]);
151
+ }
152
+ const padInputParams = {
153
+ type: "PAD",
154
+ shape: padShape,
155
+ center,
156
+ width,
157
+ height,
158
+ layermask,
159
+ net,
160
+ number,
161
+ holeRadius,
162
+ points,
163
+ rotation: rotation2,
164
+ plated: rest.includes("Y")
165
+ };
166
+ const pad = PadSchema.parse(padInputParams);
167
+ return pad;
168
+ }
169
+ case "ARC": {
170
+ const [width, layer, , arcData] = shape.data.split("~");
171
+ const [
172
+ ,
173
+ startX,
174
+ startY,
175
+ radiusX,
176
+ radiusY,
177
+ xAxisRotation,
178
+ largeArcFlag,
179
+ sweepFlag,
180
+ endX,
181
+ endY
182
+ ] = arcData.match(
183
+ /M\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)\s*A\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)\s*([\d.]+)\s*([01])\s*([01])\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)/
184
+ );
185
+ const start = [Number(startX), Number(startY)];
186
+ const end = [Number(endX), Number(endY)];
187
+ return ArcSchema.parse({
188
+ type: "ARC",
189
+ width: Number(width),
190
+ layer: Number(layer),
191
+ start,
192
+ end,
193
+ radiusX: Number(radiusX),
194
+ radiusY: Number(radiusY),
195
+ largeArc: largeArcFlag === "1",
196
+ sweepDirection: sweepFlag === "1" ? "CW" : "CCW"
197
+ });
198
+ }
199
+ case "CIRCLE": {
200
+ const [centerX, centerY, radius, width, layer, id] = shape.data.split("~");
201
+ const center = [Number(centerX), Number(centerY)];
202
+ return CircleSchema.parse({
203
+ type: "CIRCLE",
204
+ center,
205
+ radius: Number(radius),
206
+ width: Number(width),
207
+ layer: Number(layer),
208
+ id
209
+ });
210
+ }
211
+ case "HOLE": {
212
+ const [centerX, centerY, radius, id] = shape.data.split("~");
213
+ const center = [Number(centerX), Number(centerY)];
214
+ return HoleSchema.parse({
215
+ type: "HOLE",
216
+ center,
217
+ radius: Number(radius),
218
+ id
219
+ });
220
+ }
221
+ case "SOLIDREGION": {
222
+ const [layermask, , pathData, fillStyle, id] = shape.data.split("~");
223
+ const points = pathData.match(/[ML] ?(-?[\d.]+)[ ,](-?[\d.]+)/g)?.map((point2) => {
224
+ const [, x, y] = point2.match(/[ML]? ?(-?[\d.]+)[ ,](-?[\d.]+)/) || [];
225
+ return [Number(x), Number(y)];
226
+ }) || [];
227
+ return SolidRegionSchema.parse({
228
+ type: "SOLIDREGION",
229
+ layermask: Number(layermask),
230
+ points,
231
+ fillStyle,
232
+ id
233
+ });
234
+ }
235
+ case "SVGNODE": {
236
+ const svgData = JSON.parse(shape.data);
237
+ return SVGNodeSchema.parse({ type: "SVGNODE", svgData });
238
+ }
239
+ case "RECT": {
240
+ const [x, y, width, height, lineWidth, id, rotation2, layer, fillStyle] = shape.data.split("~");
241
+ return RectSchema.parse({
242
+ type: "RECT",
243
+ x,
244
+ y,
245
+ width,
246
+ height,
247
+ lineWidth: Number(lineWidth),
248
+ id,
249
+ rotation: rotation2 ? Number(rotation2) : void 0,
250
+ layer: layer ? Number(layer) : void 0,
251
+ fillStyle: fillStyle || void 0
252
+ });
253
+ }
254
+ default:
255
+ throw new Error(`Unknown shape type: ${shape.type}`);
256
+ return BaseShapeSchema.parse({ type: shape.type });
257
+ }
258
+ }).pipe(PackageDetailShapeSchema);
259
+ var ShapesArraySchema = z.array(ShapeItemSchema);
260
+
261
+ // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
262
+ import "zod";
263
+
264
+ // node_modules/circuit-json/dist/index.mjs
265
+ var dist_exports = {};
266
+ __export(dist_exports, {
267
+ all_layers: () => all_layers,
268
+ any_circuit_element: () => any_circuit_element,
269
+ any_soup_element: () => any_soup_element,
270
+ any_source_component: () => any_source_component,
271
+ cad_component: () => cad_component,
272
+ capacitance: () => capacitance,
273
+ current: () => current,
274
+ distance: () => distance,
275
+ getZodPrefixedIdWithDefault: () => getZodPrefixedIdWithDefault,
276
+ inductance: () => inductance,
277
+ layer_ref: () => layer_ref,
278
+ layer_string: () => layer_string,
279
+ length: () => length,
280
+ pcb_board: () => pcb_board,
281
+ pcb_component: () => pcb_component,
282
+ pcb_fabrication_note_path: () => pcb_fabrication_note_path,
283
+ pcb_fabrication_note_text: () => pcb_fabrication_note_text,
284
+ pcb_hole: () => pcb_hole,
285
+ pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
286
+ pcb_hole_oval_shape: () => pcb_hole_oval_shape,
287
+ pcb_keepout: () => pcb_keepout,
288
+ pcb_placement_error: () => pcb_placement_error,
289
+ pcb_plated_hole: () => pcb_plated_hole,
290
+ pcb_port: () => pcb_port,
291
+ pcb_port_not_matched_error: () => pcb_port_not_matched_error,
292
+ pcb_route_hint: () => pcb_route_hint,
293
+ pcb_route_hints: () => pcb_route_hints,
294
+ pcb_silkscreen_circle: () => pcb_silkscreen_circle,
295
+ pcb_silkscreen_line: () => pcb_silkscreen_line,
296
+ pcb_silkscreen_oval: () => pcb_silkscreen_oval,
297
+ pcb_silkscreen_path: () => pcb_silkscreen_path,
298
+ pcb_silkscreen_rect: () => pcb_silkscreen_rect,
299
+ pcb_silkscreen_text: () => pcb_silkscreen_text,
300
+ pcb_smtpad: () => pcb_smtpad,
301
+ pcb_solder_paste: () => pcb_solder_paste,
302
+ pcb_text: () => pcb_text,
303
+ pcb_trace: () => pcb_trace,
304
+ pcb_trace_error: () => pcb_trace_error,
305
+ pcb_trace_hint: () => pcb_trace_hint,
306
+ pcb_trace_route_point: () => pcb_trace_route_point,
307
+ pcb_trace_route_point_via: () => pcb_trace_route_point_via,
308
+ pcb_trace_route_point_wire: () => pcb_trace_route_point_wire,
309
+ pcb_via: () => pcb_via,
310
+ point: () => point,
311
+ point3: () => point3,
312
+ position: () => position,
313
+ position3: () => position3,
314
+ resistance: () => resistance,
315
+ rotation: () => rotation,
316
+ route_hint_point: () => route_hint_point,
317
+ schematic_box: () => schematic_box,
318
+ schematic_component: () => schematic_component,
319
+ schematic_error: () => schematic_error,
320
+ schematic_line: () => schematic_line,
321
+ schematic_net_label: () => schematic_net_label,
322
+ schematic_path: () => schematic_path,
323
+ schematic_pin_styles: () => schematic_pin_styles,
324
+ schematic_port: () => schematic_port,
325
+ schematic_text: () => schematic_text,
326
+ schematic_trace: () => schematic_trace,
327
+ size: () => size,
328
+ source_component_base: () => source_component_base,
329
+ source_group: () => source_group,
330
+ source_led: () => source_led,
331
+ source_net: () => source_net,
332
+ source_port: () => source_port,
333
+ source_simple_bug: () => source_simple_bug,
334
+ source_simple_capacitor: () => source_simple_capacitor,
335
+ source_simple_chip: () => source_simple_chip,
336
+ source_simple_diode: () => source_simple_diode,
337
+ source_simple_ground: () => source_simple_ground,
338
+ source_simple_power_source: () => source_simple_power_source,
339
+ source_simple_resistor: () => source_simple_resistor,
340
+ source_trace: () => source_trace,
341
+ supplier_name: () => supplier_name,
342
+ time: () => time,
343
+ visible_layer: () => visible_layer,
344
+ voltage: () => voltage
345
+ });
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";
351
+
352
+ // node_modules/nanoid/index.js
353
+ import { webcrypto as crypto } from "node:crypto";
354
+
355
+ // node_modules/nanoid/url-alphabet/index.js
356
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
357
+
358
+ // node_modules/nanoid/index.js
359
+ var POOL_SIZE_MULTIPLIER = 128;
360
+ var pool;
361
+ var poolOffset;
362
+ function fillPool(bytes) {
363
+ if (!pool || pool.length < bytes) {
364
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
365
+ crypto.getRandomValues(pool);
366
+ poolOffset = 0;
367
+ } else if (poolOffset + bytes > pool.length) {
368
+ crypto.getRandomValues(pool);
369
+ poolOffset = 0;
370
+ }
371
+ poolOffset += bytes;
372
+ }
373
+ function nanoid(size2 = 21) {
374
+ fillPool(size2 -= 0);
375
+ let id = "";
376
+ for (let i = poolOffset - size2; i < poolOffset; i++) {
377
+ id += urlAlphabet[pool[i] & 63];
378
+ }
379
+ return id;
380
+ }
381
+
382
+ // node_modules/circuit-json/dist/index.mjs
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";
436
+ var unitMappings = {
437
+ Hz: {
438
+ baseUnit: "Hz",
439
+ variants: {
440
+ MHz: 1e6,
441
+ kHz: 1e3,
442
+ Hz: 1
443
+ }
444
+ },
445
+ g: {
446
+ baseUnit: "g",
447
+ variants: {
448
+ kg: 1e3,
449
+ g: 1
450
+ }
451
+ },
452
+ \u03A9: {
453
+ baseUnit: "\u03A9",
454
+ variants: {
455
+ m\u03A9: 1e-3,
456
+ \u03A9: 1,
457
+ k\u03A9: 1e3,
458
+ M\u03A9: 1e6,
459
+ G\u03A9: 1e9,
460
+ T\u03A9: 1e12
461
+ }
462
+ },
463
+ V: {
464
+ baseUnit: "V",
465
+ variants: {
466
+ mV: 1e-3,
467
+ V: 1,
468
+ kV: 1e3,
469
+ MV: 1e6,
470
+ GV: 1e9,
471
+ TV: 1e12
472
+ }
473
+ },
474
+ A: {
475
+ baseUnit: "A",
476
+ variants: {
477
+ \u00B5A: 1e-6,
478
+ mA: 1e-3,
479
+ ma: 1e-3,
480
+ A: 1,
481
+ kA: 1e3,
482
+ MA: 1e6
483
+ }
484
+ },
485
+ F: {
486
+ baseUnit: "F",
487
+ variants: {
488
+ pF: 1e-12,
489
+ nF: 1e-9,
490
+ \u00B5F: 1e-6,
491
+ mF: 1e-3,
492
+ F: 1
493
+ }
494
+ },
495
+ ml: {
496
+ baseUnit: "ml",
497
+ variants: {
498
+ ml: 1,
499
+ mL: 1,
500
+ l: 1e3,
501
+ L: 1e3
502
+ }
503
+ },
504
+ deg: {
505
+ baseUnit: "deg",
506
+ variants: {
507
+ rad: 180 / Math.PI
508
+ }
509
+ },
510
+ ms: {
511
+ baseUnit: "ms",
512
+ variants: {
513
+ s: 1e3
514
+ }
515
+ },
516
+ mm: {
517
+ baseUnit: "mm",
518
+ variants: {
519
+ nm: 1e-6,
520
+ \u00B5m: 1e-3,
521
+ um: 1e-3,
522
+ mm: 1,
523
+ cm: 10,
524
+ dm: 100,
525
+ m: 1e3,
526
+ km: 1e6,
527
+ in: 25.4,
528
+ ft: 304.8,
529
+ IN: 25.4,
530
+ FT: 304.8,
531
+ yd: 914.4,
532
+ mi: 1609344
533
+ }
534
+ }
535
+ };
536
+ function getBaseTscircuitUnit(unit) {
537
+ for (const [baseUnit, info] of Object.entries(unitMappings)) {
538
+ if (unit in info.variants) {
539
+ return {
540
+ baseUnit: info.baseUnit,
541
+ conversionFactor: info.variants[unit]
542
+ };
543
+ }
544
+ }
545
+ return {
546
+ baseUnit: unit,
547
+ conversionFactor: 1
548
+ };
549
+ }
550
+ var parseAndConvertSiUnit = (v) => {
551
+ if (typeof v === "undefined")
552
+ return { parsedUnit: null, unitOfValue: null, value: null };
553
+ if (typeof v === "string" && v.match(/^[\d\.]+$/))
554
+ return {
555
+ value: Number.parseFloat(v),
556
+ parsedUnit: null,
557
+ unitOfValue: null
558
+ };
559
+ if (typeof v === "number")
560
+ return { value: v, parsedUnit: null, unitOfValue: null };
561
+ if (typeof v === "object" && "x" in v && "y" in v) {
562
+ const { parsedUnit, unitOfValue } = parseAndConvertSiUnit(v.x);
563
+ return {
564
+ parsedUnit,
565
+ unitOfValue,
566
+ value: {
567
+ x: parseAndConvertSiUnit(v.x).value,
568
+ y: parseAndConvertSiUnit(v.y).value
569
+ }
570
+ };
571
+ }
572
+ const unit_reversed = v.split("").reverse().join("").match(/[a-zA-Z]+/)?.[0];
573
+ if (!unit_reversed) {
574
+ throw new Error(`Could not determine unit: "${v}"`);
575
+ }
576
+ const unit = unit_reversed.split("").reverse().join("");
577
+ const value = v.slice(0, -unit.length);
578
+ const { baseUnit, conversionFactor } = getBaseTscircuitUnit(unit);
579
+ return {
580
+ parsedUnit: unit,
581
+ unitOfValue: baseUnit,
582
+ value: conversionFactor * Number.parseFloat(value)
583
+ };
584
+ };
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);
590
+ var distance = length;
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) => {
594
+ if (typeof arg === "number") return arg;
595
+ if (arg.endsWith("deg")) {
596
+ return Number.parseFloat(arg.split("deg")[0]);
597
+ }
598
+ if (arg.endsWith("rad")) {
599
+ return Number.parseFloat(arg.split("rad")[0]) * 180 / Math.PI;
600
+ }
601
+ return Number.parseFloat(arg);
602
+ });
603
+ var point = z22.object({
604
+ x: distance,
605
+ y: distance
606
+ });
607
+ var position = point;
608
+ var point3 = z3.object({
609
+ x: distance,
610
+ y: distance,
611
+ z: distance
612
+ });
613
+ var position3 = point3;
614
+ var size = z4.object({
615
+ width: z4.number(),
616
+ height: z4.number()
617
+ });
618
+ var getZodPrefixedIdWithDefault = (prefix) => {
619
+ return z5.string().optional().default(() => `${prefix}_${nanoid(10)}`);
620
+ };
621
+ var supplier_name = z6.enum([
622
+ "jlcpcb",
623
+ "macrofab",
624
+ "pcbway",
625
+ "digikey",
626
+ "mouser",
627
+ "lcsc"
628
+ ]);
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()
636
+ });
637
+ var source_simple_capacitor = source_component_base.extend({
638
+ ftype: z8.literal("simple_capacitor"),
639
+ capacitance
640
+ });
641
+ var source_simple_resistor = source_component_base.extend({
642
+ ftype: z9.literal("simple_resistor"),
643
+ resistance
644
+ });
645
+ var source_simple_diode = source_component_base.extend({
646
+ ftype: z10.literal("simple_diode")
647
+ });
648
+ var source_simple_ground = source_component_base.extend({
649
+ ftype: z11.literal("simple_ground")
650
+ });
651
+ var source_simple_bug = source_component_base.extend({
652
+ ftype: z12.literal("simple_bug")
653
+ }).describe("@deprecated");
654
+ var source_simple_chip = source_component_base.extend({
655
+ ftype: z13.literal("simple_chip")
656
+ });
657
+ var source_simple_inductor = source_component_base.extend({
658
+ ftype: z14.literal("simple_inductor"),
659
+ inductance
660
+ });
661
+ var source_led = source_simple_diode.extend({
662
+ ftype: z15.literal("led")
663
+ });
664
+ var source_simple_power_source = source_component_base.extend({
665
+ ftype: z16.literal("simple_power_source"),
666
+ voltage
667
+ });
668
+ var any_source_component = z17.union([
669
+ source_simple_resistor,
670
+ source_simple_capacitor,
671
+ source_simple_diode,
672
+ source_simple_ground,
673
+ source_simple_chip,
674
+ source_simple_bug,
675
+ source_led,
676
+ source_simple_power_source
677
+ ]);
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(),
711
+ width: distance,
712
+ height: distance,
713
+ x: distance,
714
+ y: distance
715
+ }).describe("Draws a box on the schematic");
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({
725
+ left_margin: length.optional(),
726
+ right_margin: length.optional(),
727
+ top_margin: length.optional(),
728
+ bottom_margin: length.optional()
729
+ })
730
+ );
731
+ var schematic_component = z24.object({
732
+ type: z24.literal("schematic_component"),
733
+ rotation: rotation.default(0),
734
+ size,
735
+ center: point,
736
+ source_component_id: z24.string(),
737
+ schematic_component_id: z24.string(),
738
+ pin_spacing: length.optional(),
739
+ pin_styles: schematic_pin_styles.optional(),
740
+ box_width: length.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()
748
+ }),
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()
753
+ }).optional(),
754
+ right_side: z24.object({
755
+ pins: z24.array(z24.number()),
756
+ direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
757
+ }).optional(),
758
+ top_side: z24.object({
759
+ pins: z24.array(z24.number()),
760
+ direction: z24.enum(["left-to-right", "right-to-left"]).optional()
761
+ }).optional(),
762
+ bottom_side: z24.object({
763
+ pins: z24.array(z24.number()),
764
+ direction: z24.enum(["left-to-right", "right-to-left"]).optional()
765
+ }).optional()
766
+ })
767
+ ]).optional(),
768
+ port_labels: z24.record(z24.string()).optional()
769
+ });
770
+ var schematic_line = z25.object({
771
+ type: z25.literal("schematic_line"),
772
+ schematic_component_id: z25.string(),
773
+ x1: distance,
774
+ x2: distance,
775
+ y1: distance,
776
+ y2: distance
777
+ });
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()
787
+ }),
788
+ to: z26.object({
789
+ x: z26.number(),
790
+ y: z26.number()
791
+ }),
792
+ from_schematic_port_id: z26.string().optional(),
793
+ to_schematic_port_id: z26.string().optional()
794
+ })
795
+ )
796
+ });
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({
803
+ x: distance,
804
+ y: distance
805
+ }),
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(),
814
+ center: point,
815
+ facing_direction: z28.enum(["up", "down", "left", "right"]).optional()
816
+ }).describe("Defines a port on a schematic component");
817
+ var schematic_net_label = z29.object({
818
+ type: z29.literal("schematic_net_label"),
819
+ source_net_id: z29.string(),
820
+ center: point,
821
+ anchor_side: z29.enum(["top", "bottom", "left", "right"]),
822
+ text: z29.string()
823
+ });
824
+ var schematic_error = z30.object({
825
+ schematic_error_id: z30.string(),
826
+ type: z30.literal("schematic_error"),
827
+ // eventually each error type should be broken out into a dir of files
828
+ error_type: z30.literal("schematic_port_not_found"),
829
+ message: z30.string()
830
+ }).describe("Defines a schematic error on the schematic");
831
+ var all_layers = [
832
+ "top",
833
+ "bottom",
834
+ "inner1",
835
+ "inner2",
836
+ "inner3",
837
+ "inner4",
838
+ "inner5",
839
+ "inner6"
840
+ ];
841
+ var layer_string = z31.enum(all_layers);
842
+ var layer_ref = layer_string.or(
843
+ z31.object({
844
+ name: layer_string
845
+ })
846
+ ).transform((layer) => {
847
+ if (typeof layer === "string") {
848
+ return layer;
849
+ }
850
+ return layer.name;
851
+ });
852
+ var visible_layer = z31.enum(["top", "bottom"]);
853
+ var pcb_route_hint = z32.object({
854
+ x: distance,
855
+ y: distance,
856
+ via: z32.boolean().optional(),
857
+ via_to_layer: layer_ref.optional()
858
+ });
859
+ var pcb_route_hints = z32.array(pcb_route_hint);
860
+ var route_hint_point = z33.object({
861
+ x: distance,
862
+ y: distance,
863
+ via: z33.boolean().optional(),
864
+ to_layer: layer_ref.optional(),
865
+ trace_width: distance.optional()
866
+ });
867
+ var expectTypesMatch = (shouldBe) => {
868
+ };
869
+ var pcb_component = z34.object({
870
+ type: z34.literal("pcb_component"),
871
+ pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
872
+ source_component_id: z34.string(),
873
+ center: point,
874
+ layer: layer_ref,
875
+ rotation,
876
+ width: length,
877
+ height: length
878
+ }).describe("Defines a component on the PCB");
879
+ expectTypesMatch(true);
880
+ var pcb_hole_circle_or_square = z35.object({
881
+ type: z35.literal("pcb_hole"),
882
+ pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
883
+ hole_shape: z35.enum(["circle", "square"]),
884
+ hole_diameter: z35.number(),
885
+ x: distance,
886
+ y: distance
887
+ });
888
+ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
889
+ "Defines a circular or square hole on the PCB"
890
+ );
891
+ expectTypesMatch(true);
892
+ var pcb_hole_oval = z35.object({
893
+ type: z35.literal("pcb_hole"),
894
+ pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
895
+ hole_shape: z35.literal("oval"),
896
+ hole_width: z35.number(),
897
+ hole_height: z35.number(),
898
+ x: distance,
899
+ y: distance
900
+ });
901
+ var pcb_hole_oval_shape = pcb_hole_oval.describe(
902
+ "Defines an oval hole on the PCB"
903
+ );
904
+ expectTypesMatch(true);
905
+ var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
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(),
911
+ x: distance,
912
+ y: distance,
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(),
917
+ pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
918
+ });
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(),
926
+ x: distance,
927
+ y: distance,
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(),
932
+ pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
933
+ });
934
+ var pcb_plated_hole = z36.union([
935
+ pcb_plated_hole_circle,
936
+ pcb_plated_hole_oval
937
+ ]);
938
+ expectTypesMatch(
939
+ true
940
+ );
941
+ expectTypesMatch(true);
942
+ var pcb_port = z37.object({
943
+ type: z37.literal("pcb_port"),
944
+ pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
945
+ source_port_id: z37.string(),
946
+ pcb_component_id: z37.string(),
947
+ x: distance,
948
+ y: distance,
949
+ layers: z37.array(layer_ref)
950
+ }).describe("Defines a port on the PCB");
951
+ expectTypesMatch(true);
952
+ var pcb_smtpad_circle = z38.object({
953
+ type: z38.literal("pcb_smtpad"),
954
+ shape: z38.literal("circle"),
955
+ pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
956
+ x: distance,
957
+ y: distance,
958
+ radius: z38.number(),
959
+ layer: layer_ref,
960
+ port_hints: z38.array(z38.string()).optional(),
961
+ pcb_component_id: z38.string().optional(),
962
+ pcb_port_id: z38.string().optional()
963
+ });
964
+ var pcb_smtpad_rect = z38.object({
965
+ type: z38.literal("pcb_smtpad"),
966
+ shape: z38.literal("rect"),
967
+ pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
968
+ x: distance,
969
+ y: distance,
970
+ width: z38.number(),
971
+ height: z38.number(),
972
+ layer: layer_ref,
973
+ port_hints: z38.array(z38.string()).optional(),
974
+ pcb_component_id: z38.string().optional(),
975
+ pcb_port_id: z38.string().optional()
976
+ });
977
+ var pcb_smtpad = z38.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
978
+ expectTypesMatch(true);
979
+ expectTypesMatch(true);
980
+ var pcb_solder_paste_circle = z39.object({
981
+ type: z39.literal("pcb_solder_paste"),
982
+ shape: z39.literal("circle"),
983
+ pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
984
+ x: distance,
985
+ y: distance,
986
+ radius: z39.number(),
987
+ layer: layer_ref,
988
+ pcb_component_id: z39.string().optional(),
989
+ pcb_smtpad_id: z39.string().optional()
990
+ });
991
+ var pcb_solder_paste_rect = z39.object({
992
+ type: z39.literal("pcb_solder_paste"),
993
+ shape: z39.literal("rect"),
994
+ pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
995
+ x: distance,
996
+ y: distance,
997
+ width: z39.number(),
998
+ height: z39.number(),
999
+ layer: layer_ref,
1000
+ pcb_component_id: z39.string().optional(),
1001
+ pcb_smtpad_id: z39.string().optional()
1002
+ });
1003
+ var pcb_solder_paste = z39.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
1004
+ expectTypesMatch(true);
1005
+ expectTypesMatch(true);
1006
+ var pcb_text = z40.object({
1007
+ type: z40.literal("pcb_text"),
1008
+ pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
1009
+ text: z40.string(),
1010
+ center: point,
1011
+ layer: layer_ref,
1012
+ width: length,
1013
+ height: length,
1014
+ lines: z40.number(),
1015
+ align: z40.enum(["bottom-left"])
1016
+ }).describe("Defines text on the PCB");
1017
+ expectTypesMatch(true);
1018
+ var pcb_trace_route_point_wire = z41.object({
1019
+ route_type: z41.literal("wire"),
1020
+ x: distance,
1021
+ y: distance,
1022
+ width: distance,
1023
+ start_pcb_port_id: z41.string().optional(),
1024
+ end_pcb_port_id: z41.string().optional(),
1025
+ layer: layer_ref
1026
+ });
1027
+ var pcb_trace_route_point_via = z41.object({
1028
+ route_type: z41.literal("via"),
1029
+ x: distance,
1030
+ y: distance,
1031
+ from_layer: z41.string(),
1032
+ to_layer: z41.string()
1033
+ });
1034
+ var pcb_trace_route_point = z41.union([
1035
+ pcb_trace_route_point_wire,
1036
+ pcb_trace_route_point_via
1037
+ ]);
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(),
1042
+ pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
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"),
1050
+ x: distance,
1051
+ y: distance,
1052
+ width: distance,
1053
+ start_pcb_port_id: z41.string().optional(),
1054
+ end_pcb_port_id: z41.string().optional(),
1055
+ layer: layer_ref
1056
+ }),
1057
+ z41.object({
1058
+ route_type: z41.literal("via"),
1059
+ x: distance,
1060
+ y: distance,
1061
+ from_layer: z41.string(),
1062
+ to_layer: z41.string()
1063
+ })
1064
+ ])
1065
+ )
1066
+ }).describe("Defines a trace on the PCB");
1067
+ expectTypesMatch(true);
1068
+ expectTypesMatch(true);
1069
+ var pcb_trace_error = z42.object({
1070
+ type: z42.literal("pcb_trace_error"),
1071
+ pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
1072
+ error_type: z42.literal("pcb_trace_error"),
1073
+ message: z42.string(),
1074
+ center: point.optional(),
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())
1079
+ }).describe("Defines a trace error on the PCB");
1080
+ expectTypesMatch(true);
1081
+ var pcb_port_not_matched_error = z43.object({
1082
+ type: z43.literal("pcb_port_not_matched_error"),
1083
+ pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
1084
+ message: z43.string(),
1085
+ pcb_component_ids: z43.array(z43.string())
1086
+ }).describe("Defines a trace error on the PCB where a port is not matched");
1087
+ expectTypesMatch(true);
1088
+ var pcb_via = z44.object({
1089
+ type: z44.literal("pcb_via"),
1090
+ pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
1091
+ x: distance,
1092
+ y: distance,
1093
+ outer_diameter: distance.default("0.6mm"),
1094
+ hole_diameter: distance.default("0.25mm"),
1095
+ /** @deprecated */
1096
+ from_layer: layer_ref.optional(),
1097
+ /** @deprecated */
1098
+ to_layer: layer_ref.optional(),
1099
+ layers: z44.array(layer_ref),
1100
+ pcb_trace_id: z44.string().optional()
1101
+ }).describe("Defines a via on the PCB");
1102
+ expectTypesMatch(true);
1103
+ var pcb_board = z45.object({
1104
+ type: z45.literal("pcb_board"),
1105
+ pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
1106
+ width: length,
1107
+ height: length,
1108
+ center: point,
1109
+ thickness: length.optional().default(1.4),
1110
+ num_layers: z45.number().optional().default(4),
1111
+ outline: z45.array(point).optional()
1112
+ }).describe("Defines the board outline of the PCB");
1113
+ expectTypesMatch(true);
1114
+ var pcb_placement_error = z46.object({
1115
+ type: z46.literal("pcb_placement_error"),
1116
+ pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
1117
+ message: z46.string()
1118
+ }).describe("Defines a placement error on the PCB");
1119
+ expectTypesMatch(true);
1120
+ var pcb_trace_hint = z47.object({
1121
+ type: z47.literal("pcb_trace_hint"),
1122
+ pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
1123
+ pcb_port_id: z47.string(),
1124
+ pcb_component_id: z47.string(),
1125
+ route: z47.array(route_hint_point)
1126
+ }).describe("A hint that can be used during generation of a PCB trace");
1127
+ expectTypesMatch(true);
1128
+ var pcb_silkscreen_line = z48.object({
1129
+ type: z48.literal("pcb_silkscreen_line"),
1130
+ pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
1131
+ pcb_component_id: z48.string(),
1132
+ stroke_width: distance.default("0.1mm"),
1133
+ x1: distance,
1134
+ y1: distance,
1135
+ x2: distance,
1136
+ y2: distance,
1137
+ layer: visible_layer
1138
+ }).describe("Defines a silkscreen line on the PCB");
1139
+ expectTypesMatch(true);
1140
+ var pcb_silkscreen_path = z49.object({
1141
+ type: z49.literal("pcb_silkscreen_path"),
1142
+ pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
1143
+ pcb_component_id: z49.string(),
1144
+ layer: visible_layer,
1145
+ route: z49.array(point),
1146
+ stroke_width: length
1147
+ }).describe("Defines a silkscreen path on the PCB");
1148
+ expectTypesMatch(true);
1149
+ var pcb_silkscreen_text = z50.object({
1150
+ type: z50.literal("pcb_silkscreen_text"),
1151
+ pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
1152
+ font: z50.literal("tscircuit2024").default("tscircuit2024"),
1153
+ font_size: distance.default("0.2mm"),
1154
+ pcb_component_id: z50.string(),
1155
+ text: z50.string(),
1156
+ layer: layer_ref,
1157
+ is_mirrored: z50.boolean().default(false).optional(),
1158
+ anchor_position: point.default({ x: 0, y: 0 }),
1159
+ anchor_alignment: z50.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
1160
+ }).describe("Defines silkscreen text on the PCB");
1161
+ expectTypesMatch(true);
1162
+ var pcb_silkscreen_rect = z51.object({
1163
+ type: z51.literal("pcb_silkscreen_rect"),
1164
+ pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
1165
+ pcb_component_id: z51.string(),
1166
+ center: point,
1167
+ width: length,
1168
+ height: length,
1169
+ layer: layer_ref
1170
+ }).describe("Defines a silkscreen rect on the PCB");
1171
+ expectTypesMatch(true);
1172
+ var pcb_silkscreen_circle = z52.object({
1173
+ type: z52.literal("pcb_silkscreen_circle"),
1174
+ pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
1175
+ "pcb_silkscreen_circle"
1176
+ ),
1177
+ pcb_component_id: z52.string(),
1178
+ center: point,
1179
+ radius: length,
1180
+ layer: visible_layer
1181
+ }).describe("Defines a silkscreen circle on the PCB");
1182
+ expectTypesMatch(true);
1183
+ var pcb_silkscreen_oval = z53.object({
1184
+ type: z53.literal("pcb_silkscreen_oval"),
1185
+ pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
1186
+ pcb_component_id: z53.string(),
1187
+ center: point,
1188
+ radius_x: distance,
1189
+ radius_y: distance,
1190
+ layer: visible_layer
1191
+ }).describe("Defines a silkscreen oval on the PCB");
1192
+ expectTypesMatch(true);
1193
+ var pcb_fabrication_note_text = z54.object({
1194
+ type: z54.literal("pcb_fabrication_note_text"),
1195
+ pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
1196
+ "pcb_fabrication_note_text"
1197
+ ),
1198
+ font: z54.literal("tscircuit2024").default("tscircuit2024"),
1199
+ font_size: distance.default("1mm"),
1200
+ pcb_component_id: z54.string(),
1201
+ text: z54.string(),
1202
+ layer: visible_layer,
1203
+ anchor_position: point.default({ x: 0, y: 0 }),
1204
+ anchor_alignment: z54.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
1205
+ color: z54.string().optional()
1206
+ }).describe(
1207
+ "Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
1208
+ );
1209
+ expectTypesMatch(true);
1210
+ var pcb_fabrication_note_path = z55.object({
1211
+ type: z55.literal("pcb_fabrication_note_path"),
1212
+ pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
1213
+ "pcb_fabrication_note_path"
1214
+ ),
1215
+ pcb_component_id: z55.string(),
1216
+ layer: layer_ref,
1217
+ route: z55.array(point),
1218
+ stroke_width: length,
1219
+ color: z55.string().optional()
1220
+ }).describe(
1221
+ "Defines a fabrication path on the PCB for fabricators or assemblers"
1222
+ );
1223
+ expectTypesMatch(true);
1224
+ var pcb_keepout = z56.object({
1225
+ type: z56.literal("pcb_keepout"),
1226
+ shape: z56.literal("rect"),
1227
+ center: point,
1228
+ width: distance,
1229
+ height: distance,
1230
+ pcb_keepout_id: z56.string(),
1231
+ layers: z56.array(z56.string()),
1232
+ // Specify layers where the keepout applies
1233
+ description: z56.string().optional()
1234
+ // Optional description of the keepout
1235
+ }).or(
1236
+ z56.object({
1237
+ type: z56.literal("pcb_keepout"),
1238
+ shape: z56.literal("circle"),
1239
+ center: point,
1240
+ radius: distance,
1241
+ pcb_keepout_id: z56.string(),
1242
+ layers: z56.array(z56.string()),
1243
+ // Specify layers where the keepout applies
1244
+ description: z56.string().optional()
1245
+ // Optional description of the keepout
1246
+ })
1247
+ );
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(),
1253
+ position: point3,
1254
+ rotation: point3.optional(),
1255
+ size: point3.optional(),
1256
+ layer: layer_ref.optional(),
1257
+ // These are all ways to generate/load the 3d model
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()
1263
+ }).describe("Defines a component on the PCB");
1264
+ var any_circuit_element = z58.union([
1265
+ source_trace,
1266
+ source_port,
1267
+ any_source_component,
1268
+ source_led,
1269
+ source_net,
1270
+ source_group,
1271
+ source_simple_bug,
1272
+ source_simple_chip,
1273
+ source_simple_capacitor,
1274
+ source_simple_diode,
1275
+ source_simple_resistor,
1276
+ source_simple_power_source,
1277
+ pcb_component,
1278
+ pcb_hole,
1279
+ pcb_plated_hole,
1280
+ pcb_keepout,
1281
+ pcb_port,
1282
+ pcb_text,
1283
+ pcb_trace,
1284
+ pcb_via,
1285
+ pcb_smtpad,
1286
+ pcb_solder_paste,
1287
+ pcb_board,
1288
+ pcb_trace_hint,
1289
+ pcb_silkscreen_line,
1290
+ pcb_silkscreen_path,
1291
+ pcb_silkscreen_text,
1292
+ pcb_silkscreen_rect,
1293
+ pcb_silkscreen_circle,
1294
+ pcb_silkscreen_oval,
1295
+ pcb_trace_error,
1296
+ pcb_placement_error,
1297
+ pcb_port_not_matched_error,
1298
+ pcb_fabrication_note_path,
1299
+ pcb_fabrication_note_text,
1300
+ schematic_box,
1301
+ schematic_text,
1302
+ schematic_line,
1303
+ schematic_component,
1304
+ schematic_port,
1305
+ schematic_trace,
1306
+ schematic_path,
1307
+ schematic_error,
1308
+ schematic_net_label,
1309
+ cad_component
1310
+ ]);
1311
+ var any_soup_element = any_circuit_element;
1312
+
1313
+ // lib/math/arc-utils.ts
1314
+ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag, sweepFlag) {
1315
+ const start = { x: startX, y: startY };
1316
+ const end = { x: endX, y: endY };
1317
+ const midX = (startX + endX) / 2;
1318
+ const midY = (startY + endY) / 2;
1319
+ const dx = endX - startX;
1320
+ const dy = endY - startY;
1321
+ const distance2 = Math.sqrt(dx * dx + dy * dy);
1322
+ if (distance2 === 0 || radius < distance2 / 2) {
1323
+ return [start, end];
1324
+ }
1325
+ const h = Math.sqrt(radius * radius - distance2 * distance2 / 4);
1326
+ const angle = Math.atan2(dy, dx);
1327
+ const centerX = midX + h * Math.sin(angle) * (sweepFlag ? 1 : -1);
1328
+ const centerY = midY - h * Math.cos(angle) * (sweepFlag ? 1 : -1);
1329
+ const startAngle = Math.atan2(startY - centerY, startX - centerX);
1330
+ let endAngle = Math.atan2(endY - centerY, endX - centerX);
1331
+ if (!sweepFlag && endAngle > startAngle) {
1332
+ endAngle -= 2 * Math.PI;
1333
+ } else if (sweepFlag && endAngle < startAngle) {
1334
+ endAngle += 2 * Math.PI;
1335
+ }
1336
+ if (!largeArcFlag && Math.abs(endAngle - startAngle) > Math.PI || largeArcFlag && Math.abs(endAngle - startAngle) < Math.PI) {
1337
+ if (endAngle > startAngle) {
1338
+ endAngle -= 2 * Math.PI;
1339
+ } else {
1340
+ endAngle += 2 * Math.PI;
1341
+ }
1342
+ }
1343
+ const numPoints = Math.max(
1344
+ 2,
1345
+ Math.ceil(Math.abs(endAngle - startAngle) * radius)
1346
+ );
1347
+ const path2 = [];
1348
+ for (let i = 0; i <= numPoints; i++) {
1349
+ const t = i / numPoints;
1350
+ const angle2 = startAngle + t * (endAngle - startAngle);
1351
+ const x = centerX + radius * Math.cos(angle2);
1352
+ const y = centerY + radius * Math.sin(angle2);
1353
+ path2.push({ x, y });
1354
+ }
1355
+ return path2;
1356
+ }
1357
+
1358
+ // node_modules/@tscircuit/soup-util/dist/index.js
1359
+ import { applyToPoint, decomposeTSR } from "transformation-matrix";
1360
+ var su = (soup, options = {}) => {
1361
+ let internalStore = soup._internal_store;
1362
+ if (!internalStore) {
1363
+ internalStore = {
1364
+ counts: {}
1365
+ };
1366
+ soup._internal_store = internalStore;
1367
+ for (const elm of soup) {
1368
+ const type = elm.type;
1369
+ const idVal = elm[`${type}_id`];
1370
+ if (!idVal)
1371
+ continue;
1372
+ const idNum = Number.parseInt(idVal.split("_").pop());
1373
+ if (!Number.isNaN(idNum)) {
1374
+ internalStore.counts[type] = Math.max(
1375
+ internalStore.counts[type] ?? 0,
1376
+ idNum
1377
+ );
1378
+ }
1379
+ }
1380
+ }
1381
+ const su22 = new Proxy(
1382
+ {},
1383
+ {
1384
+ get: (proxy_target, component_type) => {
1385
+ if (component_type === "toArray") {
1386
+ return () => soup;
1387
+ }
1388
+ return {
1389
+ get: (id) => soup.find(
1390
+ (e) => e.type === component_type && e[`${component_type}_id`] === id
1391
+ ),
1392
+ getUsing: (using) => {
1393
+ const keys = Object.keys(using);
1394
+ if (keys.length !== 1) {
1395
+ throw new Error(
1396
+ "getUsing requires exactly one key, e.g. { pcb_component_id }"
1397
+ );
1398
+ }
1399
+ const join_key = keys[0];
1400
+ const join_type = join_key.replace("_id", "");
1401
+ const joiner = soup.find(
1402
+ (e) => e.type === join_type && e[join_key] === using[join_key]
1403
+ );
1404
+ if (!joiner)
1405
+ return null;
1406
+ return soup.find(
1407
+ (e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]
1408
+ );
1409
+ },
1410
+ getWhere: (where) => {
1411
+ const keys = Object.keys(where);
1412
+ return soup.find(
1413
+ (e) => e.type === component_type && keys.every((key) => e[key] === where[key])
1414
+ );
1415
+ },
1416
+ list: (where) => {
1417
+ const keys = !where ? [] : Object.keys(where);
1418
+ return soup.filter(
1419
+ (e) => e.type === component_type && keys.every((key) => e[key] === where[key])
1420
+ );
1421
+ },
1422
+ insert: (elm) => {
1423
+ internalStore.counts[component_type] ??= -1;
1424
+ internalStore.counts[component_type]++;
1425
+ const index = internalStore.counts[component_type];
1426
+ const newElm = {
1427
+ type: component_type,
1428
+ [`${component_type}_id`]: `${component_type}_${index}`,
1429
+ ...elm
1430
+ };
1431
+ if (options.validateInserts) {
1432
+ const parser = dist_exports[component_type] ?? any_soup_element;
1433
+ parser.parse(newElm);
1434
+ }
1435
+ soup.push(newElm);
1436
+ return newElm;
1437
+ },
1438
+ delete: (id) => {
1439
+ const elm = soup.find(
1440
+ (e) => e[`${component_type}_id`] === id
1441
+ );
1442
+ if (!elm)
1443
+ return;
1444
+ soup.splice(soup.indexOf(elm), 1);
1445
+ },
1446
+ update: (id, newProps) => {
1447
+ const elm = soup.find(
1448
+ (e) => e[`${component_type}_id`] === id
1449
+ );
1450
+ if (!elm)
1451
+ return;
1452
+ Object.assign(elm, newProps);
1453
+ return elm;
1454
+ },
1455
+ select: (selector) => {
1456
+ if (component_type === "source_component") {
1457
+ return soup.find(
1458
+ (e) => e.type === "source_component" && e.name === selector.replace(/\./g, "")
1459
+ );
1460
+ } else if (component_type === "pcb_port" || component_type === "source_port" || component_type === "schematic_port") {
1461
+ const [component_name, port_selector] = selector.replace(/\./g, "").split(/[\s\>]+/);
1462
+ const source_component = soup.find(
1463
+ (e) => e.type === "source_component" && e.name === component_name
1464
+ );
1465
+ if (!source_component)
1466
+ return null;
1467
+ const source_port2 = soup.find(
1468
+ (e) => e.type === "source_port" && e.source_component_id === source_component.source_component_id && (e.name === port_selector || (e.port_hints ?? []).includes(port_selector))
1469
+ );
1470
+ if (!source_port2)
1471
+ return null;
1472
+ if (component_type === "source_port")
1473
+ return source_port2;
1474
+ if (component_type === "pcb_port") {
1475
+ return soup.find(
1476
+ (e) => e.type === "pcb_port" && e.source_port_id === source_port2.source_port_id
1477
+ );
1478
+ } else if (component_type === "schematic_port") {
1479
+ return soup.find(
1480
+ (e) => e.type === "schematic_port" && e.source_port_id === source_port2.source_port_id
1481
+ );
1482
+ }
1483
+ }
1484
+ }
1485
+ };
1486
+ }
1487
+ }
1488
+ );
1489
+ return su22;
1490
+ };
1491
+ su.unparsed = su;
1492
+ var su_default = su;
1493
+ var transformPCBElement = (elm, matrix) => {
1494
+ if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
1495
+ const { x, y } = applyToPoint(matrix, { x: elm.x, y: elm.y });
1496
+ elm.x = x;
1497
+ elm.y = y;
1498
+ } else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
1499
+ elm.center = applyToPoint(matrix, elm.center);
1500
+ } else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text") {
1501
+ elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
1502
+ } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_component") {
1503
+ elm.center = applyToPoint(matrix, elm.center);
1504
+ } else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path") {
1505
+ elm.route = elm.route.map((rp) => {
1506
+ const tp = applyToPoint(matrix, rp);
1507
+ rp.x = tp.x;
1508
+ rp.y = tp.y;
1509
+ return rp;
1510
+ });
1511
+ } else if (elm.type === "pcb_silkscreen_line") {
1512
+ const p1 = { x: elm.x1, y: elm.y1 };
1513
+ const p2 = { x: elm.x2, y: elm.y2 };
1514
+ const p1t = applyToPoint(matrix, p1);
1515
+ const p2t = applyToPoint(matrix, p2);
1516
+ elm.x1 = p1t.x;
1517
+ elm.y1 = p1t.y;
1518
+ elm.x2 = p2t.x;
1519
+ elm.y2 = p2t.y;
1520
+ } else if (elm.type === "cad_component") {
1521
+ const newPos = applyToPoint(matrix, {
1522
+ x: elm.position.x,
1523
+ y: elm.position.y
1524
+ });
1525
+ elm.position.x = newPos.x;
1526
+ elm.position.y = newPos.y;
1527
+ }
1528
+ return elm;
1529
+ };
1530
+ var transformPCBElements = (elms, matrix) => {
1531
+ const tsr = decomposeTSR(matrix);
1532
+ const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
1533
+ let transformedElms = elms.map((elm) => transformPCBElement(elm, matrix));
1534
+ if (flipPadWidthHeight) {
1535
+ transformedElms = transformedElms.map((elm) => {
1536
+ if (elm.type === "pcb_smtpad" && elm.shape === "rect") {
1537
+ ;
1538
+ [elm.width, elm.height] = [elm.height, elm.width];
1539
+ }
1540
+ return elm;
1541
+ });
1542
+ }
1543
+ return transformedElms;
1544
+ };
1545
+
1546
+ // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
1547
+ import { scale, translate } from "transformation-matrix";
1548
+
1549
+ // lib/compute-center-offset.ts
1550
+ import { mm } from "@tscircuit/mm";
1551
+ var computeCenterOffset = (easyeda) => {
1552
+ const pads = easyeda.packageDetail.dataStr.shape.filter(
1553
+ (shape) => shape.type === "PAD"
1554
+ );
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)));
1559
+ const centerX = (minX + maxX) / 2;
1560
+ const centerY = (minY + maxY) / 2;
1561
+ return {
1562
+ x: centerX,
1563
+ y: centerY
1564
+ };
1565
+ };
1566
+
1567
+ // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
1568
+ import { mm as mm2 } from "@tscircuit/mm";
1569
+ var handleSilkscreenPath = (track, index) => {
1570
+ return pcb_silkscreen_path.parse({
1571
+ type: "pcb_silkscreen_path",
1572
+ pcb_silkscreen_path_id: `pcb_silkscreen_path_${index + 1}`,
1573
+ pcb_component_id: "pcb_component_1",
1574
+ layer: "top",
1575
+ // Assuming all silkscreen is on top layer
1576
+ route: track.points.map((point2) => ({ x: point2.x, y: point2.y })),
1577
+ stroke_width: track.width
1578
+ });
1579
+ };
1580
+ var handleSilkscreenArc = (arc, index) => {
1581
+ const arcPath = generateArcFromSweep(
1582
+ arc.start.x,
1583
+ arc.start.y,
1584
+ arc.end.x,
1585
+ arc.end.y,
1586
+ arc.radiusX,
1587
+ arc.largeArc,
1588
+ arc.sweepDirection === "CW"
1589
+ );
1590
+ return pcb_silkscreen_path.parse({
1591
+ type: "pcb_silkscreen_path",
1592
+ pcb_silkscreen_path_id: `pcb_silkscreen_arc_${index + 1}`,
1593
+ pcb_component_id: "pcb_component_1",
1594
+ layer: "top",
1595
+ // Assuming all silkscreen is on top layer
1596
+ route: arcPath,
1597
+ stroke_width: arc.width
1598
+ });
1599
+ };
1600
+ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecenter = true } = {}) => {
1601
+ const soupElements = [];
1602
+ const centerOffset = computeCenterOffset(easyEdaJson);
1603
+ const source_component = any_source_component.parse({
1604
+ type: "source_component",
1605
+ source_component_id: "source_component_1",
1606
+ name: "U1",
1607
+ ftype: "simple_bug"
1608
+ });
1609
+ const pcb_component2 = pcb_component.parse({
1610
+ type: "pcb_component",
1611
+ pcb_component_id: "pcb_component_1",
1612
+ source_component_id: "source_component_1",
1613
+ name: "U1",
1614
+ ftype: "simple_bug",
1615
+ width: 0,
1616
+ // TODO compute width
1617
+ height: 0,
1618
+ // TODO compute height
1619
+ rotation: 0,
1620
+ center: { x: centerOffset.x, y: centerOffset.y },
1621
+ layer: "top"
1622
+ });
1623
+ soupElements.push(source_component, pcb_component2);
1624
+ easyEdaJson.packageDetail.dataStr.shape.filter((shape) => shape.type === "PAD").forEach((pad, index) => {
1625
+ const portNumber = pad.number.toString();
1626
+ soupElements.push({
1627
+ type: "source_port",
1628
+ source_port_id: `source_port_${index + 1}`,
1629
+ source_component_id: "source_component_1",
1630
+ name: portNumber
1631
+ });
1632
+ if (pad.holeRadius !== void 0 && mm2(pad.holeRadius) !== 0) {
1633
+ soupElements.push(
1634
+ pcb_plated_hole.parse({
1635
+ type: "pcb_plated_hole",
1636
+ pcb_plated_hole_id: `pcb_plated_hole_${index + 1}`,
1637
+ shape: "circle",
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),
1643
+ port_hints: [portNumber],
1644
+ pcb_component_id: "pcb_component_1",
1645
+ pcb_port_id: `pcb_port_${index + 1}`,
1646
+ layers: ["top"]
1647
+ })
1648
+ );
1649
+ } else {
1650
+ let soupShape;
1651
+ if (pad.shape === "RECT") {
1652
+ soupShape = "rect";
1653
+ } else if (pad.shape === "ELLIPSE") {
1654
+ soupShape = "rect";
1655
+ } else if (pad.shape === "OVAL") {
1656
+ soupShape = "rect";
1657
+ }
1658
+ if (!soupShape) {
1659
+ throw new Error(`unknown pad.shape: "${pad.shape}"`);
1660
+ }
1661
+ soupElements.push(
1662
+ pcb_smtpad.parse({
1663
+ type: "pcb_smtpad",
1664
+ pcb_smtpad_id: `pcb_smtpad_${index + 1}`,
1665
+ shape: soupShape,
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 },
1669
+ layer: "top",
1670
+ port_hints: [portNumber],
1671
+ pcb_component_id: "pcb_component_1",
1672
+ pcb_port_id: `pcb_port_${index + 1}`
1673
+ })
1674
+ );
1675
+ }
1676
+ });
1677
+ easyEdaJson.packageDetail.dataStr.shape.forEach((shape, index) => {
1678
+ if (shape.type === "TRACK") {
1679
+ soupElements.push(handleSilkscreenPath(shape, index));
1680
+ } else if (shape.type === "ARC") {
1681
+ soupElements.push(handleSilkscreenArc(shape, index));
1682
+ }
1683
+ });
1684
+ transformPCBElements(soupElements, scale(1, -1));
1685
+ const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
1686
+ (a) => Boolean(a.type === "SVGNODE" && a.svgData.attrs?.uuid)
1687
+ );
1688
+ const objFileUuid = svgNode?.svgData?.attrs?.uuid;
1689
+ const objFileUrl = objFileUuid ? useModelCdn ? `https://modelcdn.tscircuit.com/easyeda_models/download?uuid=${objFileUuid}&pn=${easyEdaJson.lcsc.number}` : `https://modules.easyeda.com/3dmodel/${objFileUuid}` : void 0;
1690
+ if (objFileUrl !== void 0) {
1691
+ const [rx, ry, rz] = (svgNode?.svgData.attrs?.c_rotation ?? "0,0,0").split(",").map(Number);
1692
+ soupElements.push(
1693
+ cad_component.parse({
1694
+ type: "cad_component",
1695
+ cad_component_id: "cad_component_1",
1696
+ source_component_id: "source_component_1",
1697
+ pcb_component_id: "pcb_component_1",
1698
+ position: { x: 0, y: 0, z: 0 },
1699
+ rotation: { x: rx, y: ry, z: rz },
1700
+ model_obj_url: objFileUrl
1701
+ })
1702
+ );
1703
+ }
1704
+ if (shouldRecenter) {
1705
+ transformPCBElements(
1706
+ soupElements,
1707
+ translate(-centerOffset.x, centerOffset.y)
1708
+ );
1709
+ }
1710
+ return soupElements;
1711
+ };
1712
+ var convertEasyEdaJsonToTscircuitSoupJson = convertEasyEdaJsonToCircuitJson;
1713
+
1714
+ // lib/fetch-easyeda-json.ts
1715
+ async function fetchEasyEDAComponent(jlcpcbPartNumber) {
1716
+ const searchUrl = "https://easyeda.com/api/components/search";
1717
+ const componentUrl = (uuid) => `https://easyeda.com/api/components/${uuid}?version=6.4.7&uuid=${uuid}&datastrid=`;
1718
+ const searchHeaders = {
1719
+ authority: "easyeda.com",
1720
+ pragma: "no-cache",
1721
+ "cache-control": "no-cache",
1722
+ accept: "application/json, text/javascript, */*; q=0.01",
1723
+ "x-requested-with": "XMLHttpRequest",
1724
+ "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
1725
+ "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
1726
+ origin: "https://easyeda.com",
1727
+ "sec-fetch-site": "same-origin",
1728
+ "sec-fetch-mode": "cors",
1729
+ "sec-fetch-dest": "empty",
1730
+ referer: "https://easyeda.com/editor",
1731
+ "accept-language": "cs,en;q=0.9,sk;q=0.8,en-GB;q=0.7",
1732
+ cookie: "<PUT your cookies here>"
1733
+ };
1734
+ const searchData = `type=3&doctype%5B%5D=2&uid=0819f05c4eef4c71ace90d822a990e87&returnListStyle=classifyarr&wd=${jlcpcbPartNumber}&version=6.4.7`;
1735
+ const searchResponse = await fetch(searchUrl, {
1736
+ method: "POST",
1737
+ headers: searchHeaders,
1738
+ body: searchData
1739
+ });
1740
+ if (!searchResponse.ok) {
1741
+ throw new Error("Failed to search for the component");
1742
+ }
1743
+ const searchResult = await searchResponse.json();
1744
+ if (!searchResult.success || !searchResult.result.lists.lcsc.length) {
1745
+ throw new Error("Component not found");
1746
+ }
1747
+ const componentUUID = searchResult.result.lists.lcsc[0].uuid;
1748
+ const componentResponse = await fetch(componentUrl(componentUUID), {
1749
+ method: "GET",
1750
+ headers: {
1751
+ ...searchHeaders,
1752
+ referer: `https://easyeda.com/editor?uuid=${componentUUID}`
1753
+ }
1754
+ });
1755
+ if (!componentResponse.ok) {
1756
+ throw new Error("Failed to fetch the component details");
1757
+ }
1758
+ const componentResult = await componentResponse.json();
1759
+ return componentResult.result;
1760
+ }
1761
+
1762
+ // lib/schemas/easy-eda-json-schema.ts
1763
+ import { z as z61 } from "zod";
1764
+
1765
+ // lib/schemas/single-letter-shape-schema.ts
1766
+ import { z as z60 } from "zod";
1767
+ var PointSchema2 = z60.object({
1768
+ x: z60.number(),
1769
+ y: z60.number()
1770
+ });
1771
+ var RectangleShapeOutputSchema = z60.object({
1772
+ type: z60.literal("RECTANGLE"),
1773
+ position: PointSchema2,
1774
+ width: z60.number(),
1775
+ height: z60.number(),
1776
+ color: z60.string(),
1777
+ lineWidth: z60.number(),
1778
+ id: z60.string()
1779
+ });
1780
+ var parseRectangle = (str) => {
1781
+ const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
1782
+ return {
1783
+ type: "RECTANGLE",
1784
+ position: { x: Number(x), y: Number(y) },
1785
+ width: Number(width),
1786
+ height: Number(height),
1787
+ color,
1788
+ lineWidth: Number(lineWidth),
1789
+ id
1790
+ };
1791
+ };
1792
+ var RectangleShapeSchema = z60.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
1793
+ var EllipseShapeOutputSchema = z60.object({
1794
+ type: z60.literal("ELLIPSE"),
1795
+ center: PointSchema2,
1796
+ radiusX: z60.number(),
1797
+ radiusY: z60.number(),
1798
+ color: z60.string(),
1799
+ lineWidth: z60.number(),
1800
+ id: z60.string()
1801
+ });
1802
+ var parseEllipse = (str) => {
1803
+ const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
1804
+ return {
1805
+ type: "ELLIPSE",
1806
+ center: { x: Number(x), y: Number(y) },
1807
+ radiusX: Number(radiusX),
1808
+ radiusY: Number(radiusY),
1809
+ color,
1810
+ lineWidth: Number(lineWidth),
1811
+ id
1812
+ };
1813
+ };
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()
1827
+ });
1828
+ var parsePin = (pinString) => {
1829
+ const parts = pinString.split("~");
1830
+ const [, visibility, , pinNumber, x, y, rotation2, id] = parts;
1831
+ const nameMatch = pinString.match(/~(\w+)~start~/);
1832
+ const label = nameMatch ? nameMatch[1] : "";
1833
+ const colorMatch = pinString.match(/#[0-9A-F]{6}/);
1834
+ const labelColor = colorMatch ? colorMatch[0] : "";
1835
+ const pathMatch = pinString.match(/\^\^([^~]+)/);
1836
+ const path2 = pathMatch ? pathMatch[1] : "";
1837
+ const arrowMatch = pinString.match(/\^\^0~(.+)$/);
1838
+ const arrow = arrowMatch ? arrowMatch[1] : "";
1839
+ return {
1840
+ type: "PIN",
1841
+ visibility,
1842
+ id,
1843
+ pinNumber: parseInt(pinNumber),
1844
+ x: parseFloat(x),
1845
+ y: parseFloat(y),
1846
+ rotation: parseFloat(rotation2),
1847
+ label,
1848
+ labelColor,
1849
+ path: path2,
1850
+ arrow
1851
+ };
1852
+ };
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()
1860
+ });
1861
+ var parsePoints2 = (pointsStr) => {
1862
+ return pointsStr.split(" ").reduce((acc, value, index) => {
1863
+ if (index % 2 === 0) {
1864
+ acc.push({ x: Number(value), y: 0 });
1865
+ } else {
1866
+ acc[acc.length - 1].y = Number(value);
1867
+ }
1868
+ return acc;
1869
+ }, []);
1870
+ };
1871
+ var parsePolyline = (str) => {
1872
+ const [, ...rest] = str.split("~");
1873
+ const [pointsStr, color, lineWidth, , , id] = rest;
1874
+ return {
1875
+ type: "POLYLINE",
1876
+ points: parsePoints2(pointsStr),
1877
+ color,
1878
+ lineWidth: Number(lineWidth),
1879
+ id
1880
+ };
1881
+ };
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()
1890
+ });
1891
+ var parsePolygon = (str) => {
1892
+ const [, ...rest] = str.split("~");
1893
+ const [pointsStr, fillColor, lineWidth, lineColor, , id] = rest;
1894
+ return {
1895
+ type: "POLYGON",
1896
+ points: parsePoints2(pointsStr),
1897
+ fillColor,
1898
+ lineWidth: Number(lineWidth),
1899
+ lineColor,
1900
+ id
1901
+ };
1902
+ };
1903
+ var PolygonShapeSchema = z60.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
1904
+ var SingleLetterShapeSchema = z60.string().transform((x) => {
1905
+ if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
1906
+ if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
1907
+ if (x.startsWith("P~")) return PinShapeSchema.parse(x);
1908
+ if (x.startsWith("PL~")) return PolylineShapeSchema.parse(x);
1909
+ if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
1910
+ throw new Error(`Invalid shape type: ${x}`);
1911
+ }).pipe(
1912
+ z60.union([
1913
+ RectangleShapeOutputSchema,
1914
+ EllipseShapeOutputSchema,
1915
+ PinShapeOutputSchema,
1916
+ PolylineShapeOutputSchema,
1917
+ PolygonShapeOutputSchema
1918
+ ])
1919
+ );
1920
+
1921
+ // lib/schemas/easy-eda-json-schema.ts
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({
1981
+ head: HeadSchema,
1982
+ canvas: z61.string(),
1983
+ shape: z61.array(SingleLetterShapeSchema),
1984
+ BBox: BBoxSchema,
1985
+ colors: z61.array(z61.unknown())
1986
+ });
1987
+ var PackageDetailDataStrSchema = z61.object({
1988
+ head: HeadSchema,
1989
+ canvas: z61.string(),
1990
+ shape: z61.array(z61.string()).transform(
1991
+ (shapes) => shapes.map((shape) => {
1992
+ const [type, ...data] = shape.split("~");
1993
+ return ShapeItemSchema.parse({ type, data: data.join("~") });
1994
+ })
1995
+ ).pipe(z61.array(PackageDetailShapeSchema)),
1996
+ layers: z61.array(z61.string()).transform(
1997
+ (layers) => layers.map((layer) => {
1998
+ const [name, color, visible, active, config, transparency] = layer.split("~");
1999
+ return LayerItemSchema.parse({
2000
+ name,
2001
+ color,
2002
+ visible: visible === "true",
2003
+ active: active === "true",
2004
+ config: config === "true",
2005
+ transparency: transparency === "true"
2006
+ });
2007
+ })
2008
+ ),
2009
+ objects: z61.array(z61.string()).transform(
2010
+ (objects) => objects.map((obj) => {
2011
+ const [name, visible, locked] = obj.split("~");
2012
+ return ObjectItemSchema.parse({
2013
+ name,
2014
+ visible: visible === "true",
2015
+ locked: locked === "true"
2016
+ });
2017
+ })
2018
+ ),
2019
+ BBox: BBoxSchema,
2020
+ netColors: z61.array(z61.unknown()).optional()
2021
+ });
2022
+ var PackageDetailSchema = z61.object({
2023
+ uuid: z61.string(),
2024
+ title: z61.string(),
2025
+ docType: z61.number(),
2026
+ updateTime: z61.number(),
2027
+ owner: OwnerSchema,
2028
+ datastrid: z61.string(),
2029
+ writable: z61.boolean(),
2030
+ dataStr: PackageDetailDataStrSchema
2031
+ });
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(),
2038
+ szlcsc: SzlcscSchema,
2039
+ lcsc: LcscSchema,
2040
+ owner: OwnerSchema,
2041
+ tags: z61.array(z61.string()),
2042
+ updateTime: z61.number(),
2043
+ updated_at: z61.string(),
2044
+ dataStr: DataStrSchema,
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(),
2051
+ packageDetail: PackageDetailSchema
2052
+ });
2053
+
2054
+ // lib/generate-footprint-tsx.ts
2055
+ import "zod";
2056
+ import { mm as mm3 } from "@tscircuit/mm";
2057
+ var generateFootprintTsx = (easyEdaJson) => {
2058
+ const pads = easyEdaJson.packageDetail.dataStr.shape.filter(
2059
+ (shape) => shape.type === "PAD"
2060
+ );
2061
+ const centerOffset = computeCenterOffset(easyEdaJson);
2062
+ const centerX = centerOffset.x;
2063
+ const centerY = centerOffset.y;
2064
+ const footprintElements = pads.map((pad) => {
2065
+ const { center, width, height, holeRadius, number } = pad;
2066
+ const isPlatedHole = holeRadius !== void 0 && mm3(holeRadius) > 0;
2067
+ const normalizedX = mm3(center.x) - centerX;
2068
+ const normalizedY = mm3(center.y) - centerY;
2069
+ if (isPlatedHole) {
2070
+ return `
2071
+ <platedhole
2072
+ pcbX="${normalizedX.toFixed(2)}mm"
2073
+ pcbY="${normalizedY.toFixed(2)}mm"
2074
+ hole_diameter="${mm3(holeRadius) * 2}mm"
2075
+ outer_diameter="${mm3(width)}mm"
2076
+ portHints={["${number}"]}
2077
+ />`.replace(/\n/, "");
2078
+ } else {
2079
+ return `
2080
+ <smtpad
2081
+ pcbX="${normalizedX.toFixed(2)}mm"
2082
+ pcbY="${normalizedY.toFixed(2)}mm"
2083
+ width="${mm3(width)}mm"
2084
+ height="${mm3(height)}mm"
2085
+ shape="rect"
2086
+ portHints={["${number}"]}
2087
+ />`.replace(/\n/, "");
2088
+ }
2089
+ });
2090
+ return `
2091
+ <footprint>
2092
+ ${footprintElements.join("\n")}
2093
+ </footprint>
2094
+ `.trim();
2095
+ };
2096
+
2097
+ // lib/convert-to-typescript-component/soup-typescript-component-template.ts
2098
+ var soupTypescriptComponentTemplate = ({
2099
+ pinLabels,
2100
+ componentName,
2101
+ schPinArrangement,
2102
+ objUrl,
2103
+ easyEdaJson
2104
+ }) => {
2105
+ const footprintTsx = generateFootprintTsx(easyEdaJson);
2106
+ return `
2107
+ import { createUseComponent } from "tscircuit"
2108
+ import type { CommonLayoutProps } from "@tscircuit/props"
2109
+
2110
+ const pinLabels = ${JSON.stringify(pinLabels, null, " ")} as const
2111
+ const pinNames = Object.values(pinLabels)
2112
+
2113
+ interface Props extends CommonLayoutProps {
2114
+ name: string
2115
+ }
2116
+
2117
+ export const ${componentName} = (props: Props) => {
2118
+ return (
2119
+ <bug
2120
+ {...props}
2121
+ footprint={${footprintTsx}}
2122
+ ${objUrl ? `cadModel={{
2123
+ objUrl: "${objUrl}"
2124
+ }}` : ""}
2125
+ pinLabels={pinLabels}
2126
+ schPinSpacing={0.75}
2127
+ schPortArrangement={${JSON.stringify(schPinArrangement, null, " ")}}
2128
+ />
2129
+ )
2130
+ }
2131
+
2132
+ export const use${componentName} = createUseComponent(${componentName}, pinNames)
2133
+
2134
+ `.trim();
2135
+ };
2136
+
2137
+ // lib/utils/normalize-manufacturer-part-number.ts
2138
+ function normalizeManufacturerPartNumber(partNumber) {
2139
+ let normalized = partNumber.replace(/[-]/g, "_").replace(/[^a-zA-Z0-9_$]/g, "_");
2140
+ if (/^\d/.test(normalized)) {
2141
+ normalized = "A_" + normalized;
2142
+ }
2143
+ return normalized;
2144
+ }
2145
+
2146
+ // lib/convert-to-typescript-component/index.tsx
2147
+ var convertRawEasyEdaToTs = async (rawEasy) => {
2148
+ const easyeda = EasyEdaJsonSchema.parse(rawEasy);
2149
+ const soup = convertEasyEdaJsonToTscircuitSoupJson(easyeda, {
2150
+ useModelCdn: true
2151
+ });
2152
+ const result = await convertToTypescriptComponent({
2153
+ easyeda,
2154
+ soup
2155
+ });
2156
+ return result;
2157
+ };
2158
+ var convertToTypescriptComponent = async ({
2159
+ soup,
2160
+ easyeda: easyEdaJson
2161
+ }) => {
2162
+ const rawPn = easyEdaJson.dataStr.head.c_para["Manufacturer Part"];
2163
+ const pn = normalizeManufacturerPartNumber(rawPn);
2164
+ const [cad_component2] = su_default(soup).cad_component.list();
2165
+ const pinLabels = {};
2166
+ easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN").forEach((pin) => {
2167
+ const isPinLabelNumeric = /^\d+$/.test(pin.label);
2168
+ const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
2169
+ pinLabels[pin.pinNumber.toString()] = label;
2170
+ });
2171
+ const pins = easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN");
2172
+ const leftPins = pins.filter((pin) => pin.rotation === 180);
2173
+ const rightPins = pins.filter((pin) => pin.rotation === 0);
2174
+ const schPinArrangement = {
2175
+ leftSide: {
2176
+ direction: "top-to-bottom",
2177
+ pins: leftPins.map((pin) => pin.pinNumber)
2178
+ },
2179
+ rightSide: {
2180
+ direction: "bottom-to-top",
2181
+ pins: rightPins.map((pin) => pin.pinNumber).reverse()
2182
+ }
2183
+ };
2184
+ let modelObjUrl;
2185
+ if (cad_component2.model_obj_url) {
2186
+ const isValidUrl = await checkModelObjUrlValidity(
2187
+ cad_component2.model_obj_url
2188
+ );
2189
+ if (isValidUrl) {
2190
+ modelObjUrl = cad_component2.model_obj_url;
2191
+ }
2192
+ }
2193
+ return soupTypescriptComponentTemplate({
2194
+ componentName: pn,
2195
+ pinLabels,
2196
+ schPinArrangement,
2197
+ objUrl: modelObjUrl,
2198
+ easyEdaJson
2199
+ });
2200
+ };
2201
+ var checkModelObjUrlValidity = async (url) => {
2202
+ try {
2203
+ const response = await fetch(url, { method: "HEAD" });
2204
+ return response.status === 200;
2205
+ } catch (error) {
2206
+ console.error(`Error checking model object URL ${url}:`, error);
2207
+ return false;
2208
+ }
2209
+ };
2210
+
2211
+ // lib/convert-easyeda-json-to-various-formats.ts
2212
+ import fs from "fs/promises";
2213
+ import * as path from "path";
2214
+ var convertEasyEdaJsonToVariousFormats = async ({
2215
+ jlcpcbPartNumberOrFilepath,
2216
+ outputFilename,
2217
+ formatType
2218
+ }) => {
2219
+ let rawEasyEdaJson;
2220
+ if (jlcpcbPartNumberOrFilepath.includes(".") || jlcpcbPartNumberOrFilepath.includes("/")) {
2221
+ rawEasyEdaJson = JSON.parse(
2222
+ await fs.readFile(jlcpcbPartNumberOrFilepath, "utf-8")
2223
+ );
2224
+ } else {
2225
+ rawEasyEdaJson = await fetchEasyEDAComponent(jlcpcbPartNumberOrFilepath);
2226
+ }
2227
+ const tsxExtension = "tsx";
2228
+ if (formatType === "ts") formatType = tsxExtension;
2229
+ if (!outputFilename && formatType) {
2230
+ let filename = path.basename(jlcpcbPartNumberOrFilepath).split(".")[0];
2231
+ if (formatType === tsxExtension) {
2232
+ const {
2233
+ dataStr: {
2234
+ head: {
2235
+ c_para: { "Manufacturer Part": manufacturerPartNumber }
2236
+ }
2237
+ }
2238
+ } = rawEasyEdaJson;
2239
+ filename = normalizeManufacturerPartNumber(manufacturerPartNumber);
2240
+ }
2241
+ outputFilename = `${filename}.${formatType}`;
2242
+ }
2243
+ if (!outputFilename) {
2244
+ console.log("specify --output file (-o) or --type (-t)");
2245
+ process.exit(1);
2246
+ }
2247
+ if (outputFilename.endsWith(".raweasy.json")) {
2248
+ await fs.writeFile(outputFilename, JSON.stringify(rawEasyEdaJson, null, 2));
2249
+ console.log(`Saved raw EasyEDA JSON: ${outputFilename}`);
2250
+ return;
2251
+ }
2252
+ try {
2253
+ const betterEasy = EasyEdaJsonSchema.parse(rawEasyEdaJson);
2254
+ const tscircuitSoup = convertEasyEdaJsonToTscircuitSoupJson(betterEasy);
2255
+ if (outputFilename.endsWith(".soup.json")) {
2256
+ await fs.writeFile(outputFilename, JSON.stringify(tscircuitSoup, null, 2));
2257
+ console.log(`Converted to tscircuit soup JSON: ${outputFilename}`);
2258
+ } else if (outputFilename.endsWith(".kicad_mod")) {
2259
+ console.log("Conversion to KiCad footprint not yet implemented");
2260
+ } else if (outputFilename.endsWith(".bettereasy.json")) {
2261
+ await fs.writeFile(outputFilename, JSON.stringify(betterEasy, null, 2));
2262
+ console.log(`Saved better EasyEDA JSON: ${outputFilename}`);
2263
+ } else if (outputFilename.endsWith(".tsx") || outputFilename.endsWith(".ts")) {
2264
+ const tsComp = await convertRawEasyEdaToTs(rawEasyEdaJson);
2265
+ await fs.writeFile(outputFilename, tsComp);
2266
+ console.log(`Saved TypeScript component: ${outputFilename}`);
2267
+ } else {
2268
+ console.error("Unsupported output format");
2269
+ }
2270
+ } catch (error) {
2271
+ console.error("Error:", error.message);
2272
+ }
2273
+ };
2274
+
2275
+ export {
2276
+ convertEasyEdaJsonToCircuitJson,
2277
+ convertEasyEdaJsonToTscircuitSoupJson,
2278
+ fetchEasyEDAComponent,
2279
+ maybeNumber,
2280
+ SzlcscSchema,
2281
+ LcscSchema,
2282
+ OwnerSchema,
2283
+ HeadSchema,
2284
+ BBoxSchema,
2285
+ LayerItemSchema,
2286
+ ObjectItemSchema,
2287
+ DataStrSchema,
2288
+ PackageDetailDataStrSchema,
2289
+ PackageDetailSchema,
2290
+ EasyEdaJsonSchema,
2291
+ normalizeManufacturerPartNumber,
2292
+ convertRawEasyEdaToTs,
2293
+ convertEasyEdaJsonToVariousFormats
2294
+ };
2295
+ //# sourceMappingURL=chunk-3ZPJFTXV.js.map