@tscircuit/cli 0.1.1908 → 0.1.1910
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/main.js +4126 -128
- package/dist/lib/index.js +2 -1
- package/package.json +3 -2
package/dist/cli/main.js
CHANGED
|
@@ -55439,7 +55439,7 @@ var require_fast_json_stable_stringify = __commonJS((exports2, module2) => {
|
|
|
55439
55439
|
};
|
|
55440
55440
|
});
|
|
55441
55441
|
|
|
55442
|
-
// node_modules/circuit-json-to-gerber/dist/chunk-
|
|
55442
|
+
// node_modules/circuit-json-to-gerber/dist/chunk-MJSWOMMX.js
|
|
55443
55443
|
import { z as z4 } from "zod";
|
|
55444
55444
|
import { z as z23 } from "zod";
|
|
55445
55445
|
import { z as z32 } from "zod";
|
|
@@ -55491,6 +55491,7 @@ import { z as z47 } from "zod";
|
|
|
55491
55491
|
import { z as z48 } from "zod";
|
|
55492
55492
|
import { z as z49 } from "zod";
|
|
55493
55493
|
import { z as z50 } from "zod";
|
|
55494
|
+
import { strokeWidthRatio } from "@tscircuit/alphabet";
|
|
55494
55495
|
import {
|
|
55495
55496
|
applyToPoint as applyToPoint26,
|
|
55496
55497
|
compose as compose9,
|
|
@@ -55499,13 +55500,19 @@ import {
|
|
|
55499
55500
|
translate as translate9
|
|
55500
55501
|
} from "transformation-matrix";
|
|
55501
55502
|
import { getBoundFromCenteredRect as getBoundFromCenteredRect2 } from "@tscircuit/math-utils";
|
|
55502
|
-
import { lineAlphabet as lineAlphabet2 } from "@tscircuit/alphabet";
|
|
55503
55503
|
import {
|
|
55504
|
-
|
|
55505
|
-
|
|
55504
|
+
glyphAdvanceRatio,
|
|
55505
|
+
glyphWidthRatio,
|
|
55506
|
+
letterSpacingRatio,
|
|
55507
|
+
lineAlphabet as lineAlphabet2,
|
|
55508
|
+
spaceWidthRatio
|
|
55509
|
+
} from "@tscircuit/alphabet";
|
|
55510
|
+
import {
|
|
55511
|
+
applyToPoint as applyToPoint52,
|
|
55512
|
+
compose as compose52,
|
|
55506
55513
|
identity as identity32,
|
|
55507
|
-
rotate as
|
|
55508
|
-
translate as
|
|
55514
|
+
rotate as rotate52,
|
|
55515
|
+
translate as translate52
|
|
55509
55516
|
} from "transformation-matrix";
|
|
55510
55517
|
import { getBoundFromCenteredRect as getBoundFromCenteredRect3 } from "@tscircuit/math-utils";
|
|
55511
55518
|
import { applyToPoint as applyToPoint25, compose as compose22, rotate as rotate22, translate as translate22 } from "transformation-matrix";
|
|
@@ -55517,6 +55524,7 @@ import {
|
|
|
55517
55524
|
rotate as rotate32,
|
|
55518
55525
|
translate as translate32
|
|
55519
55526
|
} from "transformation-matrix";
|
|
55527
|
+
import { applyToPoint as applyToPoint42, compose as compose42, rotate as rotate42, translate as translate42 } from "transformation-matrix";
|
|
55520
55528
|
function pairs3(arr) {
|
|
55521
55529
|
const result = [];
|
|
55522
55530
|
for (let i2 = 0;i2 < arr.length - 1; i2++) {
|
|
@@ -55542,16 +55550,10 @@ function getAllTraceWidths(soup) {
|
|
|
55542
55550
|
}
|
|
55543
55551
|
}
|
|
55544
55552
|
}
|
|
55545
|
-
return
|
|
55546
|
-
|
|
55547
|
-
|
|
55548
|
-
|
|
55549
|
-
inner3: Array.from(widths.inner3 || []),
|
|
55550
|
-
inner4: Array.from(widths.inner4 || []),
|
|
55551
|
-
inner5: Array.from(widths.inner5 || []),
|
|
55552
|
-
inner6: Array.from(widths.inner6 || []),
|
|
55553
|
-
bottom: Array.from(widths.bottom || [])
|
|
55554
|
-
};
|
|
55553
|
+
return Object.fromEntries(Object.entries(widths).map(([layer, layerWidths]) => [
|
|
55554
|
+
layer,
|
|
55555
|
+
Array.from(layerWidths)
|
|
55556
|
+
]));
|
|
55555
55557
|
}
|
|
55556
55558
|
function defineAperturesForLayer({
|
|
55557
55559
|
glayer,
|
|
@@ -55573,7 +55575,7 @@ function defineAperturesForLayer({
|
|
|
55573
55575
|
glayer.push(...gerberBuilder().add("comment", { comment: "aperture START LIST" }).build());
|
|
55574
55576
|
const traceWidths = getAllTraceWidths(circuitJson);
|
|
55575
55577
|
const layerRef = getLayerRefFromGerberLayerName(glayer_name);
|
|
55576
|
-
for (const width of traceWidths[layerRef]) {
|
|
55578
|
+
for (const width of traceWidths[layerRef] ?? []) {
|
|
55577
55579
|
glayer.push(...gerberBuilder().add("define_aperture_template", {
|
|
55578
55580
|
aperture_number: getNextApertureNumber(),
|
|
55579
55581
|
standard_template_code: "C",
|
|
@@ -55603,6 +55605,7 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
55603
55605
|
const isSoldermaskLayer = glayer_name.endsWith("_Mask");
|
|
55604
55606
|
const isCopperLayer = glayer_name.endsWith("_Cu");
|
|
55605
55607
|
const isFabricationLayer = glayer_name.endsWith("_Fab");
|
|
55608
|
+
const hasCopperPourForLayer = circuitJson.some((element) => element.type === "pcb_copper_pour" && element.layer === layer);
|
|
55606
55609
|
const addConfigIfNew = (config) => {
|
|
55607
55610
|
const hash = import_fast_json_stable_stringify.default(config);
|
|
55608
55611
|
if (!configHashMap.has(hash)) {
|
|
@@ -55625,6 +55628,10 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
55625
55628
|
if (isFabricationLayer)
|
|
55626
55629
|
continue;
|
|
55627
55630
|
if (elm.layer === layer) {
|
|
55631
|
+
if (elm.shape === "oval") {
|
|
55632
|
+
addConfigIfNew(REGION_APERTURE_CONFIG);
|
|
55633
|
+
continue;
|
|
55634
|
+
}
|
|
55628
55635
|
addConfigIfNew(getApertureConfigFromPcbSolderPaste(elm));
|
|
55629
55636
|
if (elm.shape === "pill") {
|
|
55630
55637
|
addConfigIfNew(getApertureConfigFromPcbSolderPaste({
|
|
@@ -55644,6 +55651,10 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
55644
55651
|
if (glayer_name.endsWith("_Mask") && elm.is_covered_with_solder_mask === true) {
|
|
55645
55652
|
continue;
|
|
55646
55653
|
}
|
|
55654
|
+
if (elm.shape === "oval") {
|
|
55655
|
+
addConfigIfNew(REGION_APERTURE_CONFIG);
|
|
55656
|
+
continue;
|
|
55657
|
+
}
|
|
55647
55658
|
if (isSoldermaskLayer) {
|
|
55648
55659
|
addConfigIfNew(getApertureConfigFromPcbPlatedHoleSoldermask(elm));
|
|
55649
55660
|
} else {
|
|
@@ -55651,9 +55662,11 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
55651
55662
|
}
|
|
55652
55663
|
}
|
|
55653
55664
|
} else if (elm.type === "pcb_hole") {
|
|
55654
|
-
if (!isSoldermaskLayer)
|
|
55665
|
+
if (!isCopperLayer && !isSoldermaskLayer)
|
|
55655
55666
|
continue;
|
|
55656
|
-
if (
|
|
55667
|
+
if (isCopperLayer && !hasCopperPourForLayer)
|
|
55668
|
+
continue;
|
|
55669
|
+
if (isSoldermaskLayer && elm.is_covered_with_solder_mask === true) {
|
|
55657
55670
|
continue;
|
|
55658
55671
|
}
|
|
55659
55672
|
if (elm.hole_shape === "circle") {
|
|
@@ -55734,6 +55747,11 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
55734
55747
|
return true;
|
|
55735
55748
|
return isSoldermaskLayer && elm.is_covered_with_solder_mask !== true;
|
|
55736
55749
|
}
|
|
55750
|
+
if (elm.type === "pcb_smtpad" && elm.shape === "rotated_rect") {
|
|
55751
|
+
if (elm.layer !== layer)
|
|
55752
|
+
return false;
|
|
55753
|
+
return isCopperLayer || isSoldermaskLayer;
|
|
55754
|
+
}
|
|
55737
55755
|
if (elm.type === "pcb_plated_hole" && elm.shape === "hole_with_polygon_pad") {
|
|
55738
55756
|
if (!elm.layers.includes(layer))
|
|
55739
55757
|
return false;
|
|
@@ -56362,7 +56380,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
56362
56380
|
return "top";
|
|
56363
56381
|
if (glayer_name.startsWith("B_"))
|
|
56364
56382
|
return "bottom";
|
|
56365
|
-
const innerLayerMatch = glayer_name.match(/^In(
|
|
56383
|
+
const innerLayerMatch = glayer_name.match(/^In(\d+)_/);
|
|
56366
56384
|
if (innerLayerMatch)
|
|
56367
56385
|
return `inner${innerLayerMatch[1]}`;
|
|
56368
56386
|
throw new Error(`Could not infer layer ref from ${glayer_name}`);
|
|
@@ -56485,7 +56503,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
56485
56503
|
if ("font_size" in elm) {
|
|
56486
56504
|
return {
|
|
56487
56505
|
standard_template_code: "C",
|
|
56488
|
-
diameter: elm.font_size
|
|
56506
|
+
diameter: elm.font_size * strokeWidthRatio
|
|
56489
56507
|
};
|
|
56490
56508
|
}
|
|
56491
56509
|
throw new Error(`Provide font_size for: ${elm}`);
|
|
@@ -56493,7 +56511,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
56493
56511
|
if ("font_size" in elm) {
|
|
56494
56512
|
return {
|
|
56495
56513
|
standard_template_code: "C",
|
|
56496
|
-
diameter: elm.font_size
|
|
56514
|
+
diameter: elm.font_size * strokeWidthRatio
|
|
56497
56515
|
};
|
|
56498
56516
|
}
|
|
56499
56517
|
throw new Error(`Provide font_size for: ${elm}`);
|
|
@@ -56501,7 +56519,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
56501
56519
|
if ("font_size" in elm) {
|
|
56502
56520
|
return {
|
|
56503
56521
|
standard_template_code: "C",
|
|
56504
|
-
diameter: elm.font_size
|
|
56522
|
+
diameter: elm.font_size * strokeWidthRatio
|
|
56505
56523
|
};
|
|
56506
56524
|
}
|
|
56507
56525
|
throw new Error(`Provide font_size for: ${elm}`);
|
|
@@ -56542,7 +56560,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
56542
56560
|
diameter: elm.radius * 2
|
|
56543
56561
|
};
|
|
56544
56562
|
}
|
|
56545
|
-
if (elm.shape === "pill") {
|
|
56563
|
+
if (elm.shape === "pill" || elm.shape === "rotated_pill") {
|
|
56546
56564
|
if (!(("width" in elm) && ("height" in elm))) {
|
|
56547
56565
|
throw new Error("Invalid pill shape in getApertureConfigFromPcbPlatedHole: missing dimensions");
|
|
56548
56566
|
}
|
|
@@ -56736,13 +56754,14 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
56736
56754
|
}).add("set_movement_mode_to_linear", {}).add("set_layer_polarity", {
|
|
56737
56755
|
polarity: "D"
|
|
56738
56756
|
}).add("create_arc", {}).build();
|
|
56739
|
-
},
|
|
56757
|
+
}, outerLayerRefToGerberPrefix, layerTypeToGerberSuffix, getGerberLayerName = (layer_ref2, layer_type) => {
|
|
56740
56758
|
if (layer_ref2 === "edgecut")
|
|
56741
56759
|
return "Edge_Cuts";
|
|
56742
56760
|
if (layer_ref2.startsWith("inner") && layer_type !== "copper") {
|
|
56743
56761
|
throw new Error(`Inner layer ${layer_ref2} only supports copper gerbers`);
|
|
56744
56762
|
}
|
|
56745
|
-
|
|
56763
|
+
const prefix = layer_ref2.startsWith("inner") ? `In${layer_ref2.slice("inner".length)}_` : outerLayerRefToGerberPrefix[layer_ref2];
|
|
56764
|
+
return `${prefix}${layerTypeToGerberSuffix[layer_type]}`;
|
|
56746
56765
|
}, getSignedPolygonArea = (points) => {
|
|
56747
56766
|
let area2 = 0;
|
|
56748
56767
|
for (let i2 = 0;i2 < points.length; i2++) {
|
|
@@ -57251,6 +57270,46 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57251
57270
|
builder.add("plot_operation", { x: ordered[i2].x, y: mfy(ordered[i2].y) });
|
|
57252
57271
|
}
|
|
57253
57272
|
builder.add("plot_operation", { x: ordered[0].x, y: mfy(ordered[0].y) });
|
|
57273
|
+
}, getRotatedRectPoints = ({
|
|
57274
|
+
center: center2,
|
|
57275
|
+
width,
|
|
57276
|
+
height,
|
|
57277
|
+
ccwRotationDegrees
|
|
57278
|
+
}) => {
|
|
57279
|
+
const halfWidth = width / 2;
|
|
57280
|
+
const halfHeight = height / 2;
|
|
57281
|
+
const ccwRotationRadians = ccwRotationDegrees * Math.PI / 180;
|
|
57282
|
+
const rectToPcbTransform = compose42(translate42(center2.x, center2.y), rotate42(ccwRotationRadians));
|
|
57283
|
+
return [
|
|
57284
|
+
{ x: -halfWidth, y: halfHeight },
|
|
57285
|
+
{ x: halfWidth, y: halfHeight },
|
|
57286
|
+
{ x: halfWidth, y: -halfHeight },
|
|
57287
|
+
{ x: -halfWidth, y: -halfHeight }
|
|
57288
|
+
].map((point9) => applyToPoint42(rectToPcbTransform, point9));
|
|
57289
|
+
}, getEllipsePoints = ({
|
|
57290
|
+
x: x4,
|
|
57291
|
+
y: y4,
|
|
57292
|
+
width,
|
|
57293
|
+
height,
|
|
57294
|
+
rotationDegrees = 0
|
|
57295
|
+
}) => {
|
|
57296
|
+
const rotationRadians = rotationDegrees * Math.PI / 180;
|
|
57297
|
+
const cosRotation = Math.cos(rotationRadians);
|
|
57298
|
+
const sinRotation = Math.sin(rotationRadians);
|
|
57299
|
+
return Array.from({ length: 64 }, (_4, index) => {
|
|
57300
|
+
const angle = index * 2 * Math.PI / 64;
|
|
57301
|
+
const dx3 = width / 2 * Math.cos(angle);
|
|
57302
|
+
const dy3 = height / 2 * Math.sin(angle);
|
|
57303
|
+
return {
|
|
57304
|
+
x: x4 + dx3 * cosRotation - dy3 * sinRotation,
|
|
57305
|
+
y: y4 + dx3 * sinRotation + dy3 * cosRotation
|
|
57306
|
+
};
|
|
57307
|
+
});
|
|
57308
|
+
}, getAlphabetCharacterAdvance = (char, fontSize) => {
|
|
57309
|
+
if (char === " ")
|
|
57310
|
+
return fontSize * spaceWidthRatio;
|
|
57311
|
+
const advanceRatio = glyphAdvanceRatio[char] ?? glyphWidthRatio;
|
|
57312
|
+
return fontSize * advanceRatio;
|
|
57254
57313
|
}, closeRing = (ring) => {
|
|
57255
57314
|
const first = ring[0];
|
|
57256
57315
|
const last = ring[ring.length - 1];
|
|
@@ -57278,7 +57337,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57278
57337
|
}, getLayerCount2 = (circuitJson) => {
|
|
57279
57338
|
const board = circuitJson.find((element) => element.type === "pcb_board");
|
|
57280
57339
|
const numLayers = board?.num_layers ?? 2;
|
|
57281
|
-
return Math.max(2, Math.min(
|
|
57340
|
+
return Math.max(2, Math.min(10, numLayers));
|
|
57282
57341
|
}, getInnerLayerRefs = (layerCount) => Array.from({ length: layerCount - 2 }, (_4, i2) => `inner${i2 + 1}`), getGerberInnerLayerName = (layerRef) => {
|
|
57283
57342
|
if (!layerRef.startsWith("inner")) {
|
|
57284
57343
|
throw new Error(`Expected inner layer, got ${layerRef}`);
|
|
@@ -57468,14 +57527,8 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57468
57527
|
let initialX = element.anchor_position.x;
|
|
57469
57528
|
let initialY = element.anchor_position.y;
|
|
57470
57529
|
const fontSize = element.font_size * CAP_HEIGHT_SCALE;
|
|
57471
|
-
const letterSpacing =
|
|
57472
|
-
const
|
|
57473
|
-
const textWidth = element.text.split("").reduce((width, char) => {
|
|
57474
|
-
if (char === " ") {
|
|
57475
|
-
return width + spaceWidth + letterSpacing;
|
|
57476
|
-
}
|
|
57477
|
-
return width + fontSize + letterSpacing;
|
|
57478
|
-
}, 0) - letterSpacing;
|
|
57530
|
+
const letterSpacing = element.font_size * letterSpacingRatio;
|
|
57531
|
+
const textWidth = element.text.split("").reduce((width, char) => width + getAlphabetCharacterAdvance(char, element.font_size), 0) + Math.max(0, element.text.length - 1) * letterSpacing;
|
|
57479
57532
|
const textHeight = fontSize;
|
|
57480
57533
|
const anchorAlignment = element.anchor_alignment || (() => {
|
|
57481
57534
|
const side = element.anchor_side;
|
|
@@ -57532,15 +57585,15 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57532
57585
|
const transforms = [];
|
|
57533
57586
|
const shouldMirror = element.is_mirrored !== undefined ? element.is_mirrored : element.layer === "bottom";
|
|
57534
57587
|
if (shouldMirror) {
|
|
57535
|
-
transforms.push(
|
|
57588
|
+
transforms.push(translate52(cx3, cy3), { a: -1, b: 0, c: 0, d: 1, e: 0, f: 0 }, translate52(-cx3, -cy3));
|
|
57536
57589
|
rotation11 = -rotation11;
|
|
57537
57590
|
}
|
|
57538
57591
|
if (rotation11) {
|
|
57539
57592
|
const rad = rotation11 * Math.PI / 180;
|
|
57540
|
-
transforms.push(
|
|
57593
|
+
transforms.push(translate52(cx3, cy3), rotate52(rad), translate52(-cx3, -cy3));
|
|
57541
57594
|
}
|
|
57542
|
-
const transformMatrix = transforms.length > 0 ?
|
|
57543
|
-
const applyTransform = (point9) => transformMatrix ?
|
|
57595
|
+
const transformMatrix = transforms.length > 0 ? compose52(...transforms) : undefined;
|
|
57596
|
+
const applyTransform = (point9) => transformMatrix ? applyToPoint52(transformMatrix, point9) : point9;
|
|
57544
57597
|
if (element.is_knockout) {
|
|
57545
57598
|
const padding = element.knockout_padding ?? {
|
|
57546
57599
|
left: 0.2,
|
|
@@ -57585,7 +57638,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57585
57638
|
}
|
|
57586
57639
|
for (const char of element.text) {
|
|
57587
57640
|
if (char === " ") {
|
|
57588
|
-
anchoredX +=
|
|
57641
|
+
anchoredX += getAlphabetCharacterAdvance(char, element.font_size) + letterSpacing;
|
|
57589
57642
|
continue;
|
|
57590
57643
|
}
|
|
57591
57644
|
const letterPaths = lineAlphabet2[char] || [];
|
|
@@ -57599,7 +57652,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57599
57652
|
gerber.add("move_operation", { x: p12.x, y: mfy(p12.y) });
|
|
57600
57653
|
gerber.add("plot_operation", { x: p22.x, y: mfy(p22.y) });
|
|
57601
57654
|
}
|
|
57602
|
-
anchoredX +=
|
|
57655
|
+
anchoredX += getAlphabetCharacterAdvance(char, element.font_size) + letterSpacing;
|
|
57603
57656
|
}
|
|
57604
57657
|
glayer.push(...gerber.build());
|
|
57605
57658
|
if (element.is_knockout) {
|
|
@@ -57721,10 +57774,10 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57721
57774
|
let transformMatrix = identity32();
|
|
57722
57775
|
if (rotation11) {
|
|
57723
57776
|
const angle_rad = rotation11 * Math.PI / 180;
|
|
57724
|
-
transformMatrix =
|
|
57777
|
+
transformMatrix = rotate52(angle_rad);
|
|
57725
57778
|
}
|
|
57726
|
-
transformMatrix =
|
|
57727
|
-
const transformedPoints = points.map((p3) =>
|
|
57779
|
+
transformMatrix = compose52(translate52(center2.x, center2.y), transformMatrix);
|
|
57780
|
+
const transformedPoints = points.map((p3) => applyToPoint52(transformMatrix, p3));
|
|
57728
57781
|
const regionApertureNumber = getRegionApertureNumber(copper_glayer);
|
|
57729
57782
|
const rect_builder = gerberBuilder().add("select_aperture", { aperture_number: regionApertureNumber }).add("start_region_statement", {});
|
|
57730
57783
|
rect_builder.add("move_operation", {
|
|
@@ -57963,6 +58016,33 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
57963
58016
|
});
|
|
57964
58017
|
continue;
|
|
57965
58018
|
}
|
|
58019
|
+
if (element.shape === "rotated_rect" && !element.corner_radius && !element.rect_border_radius) {
|
|
58020
|
+
const soldermaskMargin = element.soldermask_margin ?? 0;
|
|
58021
|
+
for (const { glayer, width, height } of [
|
|
58022
|
+
{
|
|
58023
|
+
glayer: glayers[getGerberLayerName(layer, "copper")],
|
|
58024
|
+
width: element.width,
|
|
58025
|
+
height: element.height
|
|
58026
|
+
},
|
|
58027
|
+
{
|
|
58028
|
+
glayer: glayers[getGerberLayerName(layer, "soldermask")],
|
|
58029
|
+
width: element.width + soldermaskMargin * 2,
|
|
58030
|
+
height: element.height + soldermaskMargin * 2
|
|
58031
|
+
}
|
|
58032
|
+
]) {
|
|
58033
|
+
addClosedRegionFromPoints({
|
|
58034
|
+
target: glayer,
|
|
58035
|
+
apertureSource: glayer,
|
|
58036
|
+
points: getRotatedRectPoints({
|
|
58037
|
+
center: { x: element.x, y: element.y },
|
|
58038
|
+
width,
|
|
58039
|
+
height,
|
|
58040
|
+
ccwRotationDegrees: element.ccw_rotation
|
|
58041
|
+
})
|
|
58042
|
+
});
|
|
58043
|
+
}
|
|
58044
|
+
continue;
|
|
58045
|
+
}
|
|
57966
58046
|
const rotation11 = element.shape === "rotated_rect" && typeof element.ccw_rotation === "number" ? element.ccw_rotation : 0;
|
|
57967
58047
|
for (const { glayer, apertureConfig } of [
|
|
57968
58048
|
{
|
|
@@ -58011,6 +58091,20 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
58011
58091
|
}
|
|
58012
58092
|
} else if (element.type === "pcb_solder_paste") {
|
|
58013
58093
|
if (element.layer === layer && isOuterLayerRef(layer)) {
|
|
58094
|
+
if (element.shape === "oval") {
|
|
58095
|
+
const glayer2 = glayers[getGerberLayerName(layer, "paste")];
|
|
58096
|
+
addClosedRegionFromPoints({
|
|
58097
|
+
target: glayer2,
|
|
58098
|
+
apertureSource: glayer2,
|
|
58099
|
+
points: getEllipsePoints({
|
|
58100
|
+
x: element.x,
|
|
58101
|
+
y: element.y,
|
|
58102
|
+
width: element.width,
|
|
58103
|
+
height: element.height
|
|
58104
|
+
})
|
|
58105
|
+
});
|
|
58106
|
+
continue;
|
|
58107
|
+
}
|
|
58014
58108
|
const glayer = glayers[getGerberLayerName(layer, "paste")];
|
|
58015
58109
|
let rotation11 = 0;
|
|
58016
58110
|
if ("ccw_rotation" in element && typeof element.ccw_rotation === "number") {
|
|
@@ -58058,9 +58152,9 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
58058
58152
|
const { pad_outline } = element;
|
|
58059
58153
|
if (!pad_outline?.length)
|
|
58060
58154
|
continue;
|
|
58061
|
-
const soldermaskGlayer2 = glayers[getGerberLayerName(layer, "soldermask")];
|
|
58155
|
+
const soldermaskGlayer2 = isOuterLayerRef(layer) ? glayers[getGerberLayerName(layer, "soldermask")] : undefined;
|
|
58062
58156
|
let points = pad_outline;
|
|
58063
|
-
if (glayer === soldermaskGlayer2 && "soldermask_margin" in element && typeof element.soldermask_margin === "number") {
|
|
58157
|
+
if (soldermaskGlayer2 && glayer === soldermaskGlayer2 && "soldermask_margin" in element && typeof element.soldermask_margin === "number") {
|
|
58064
58158
|
points = offsetPolygonOutline(pad_outline, element.soldermask_margin);
|
|
58065
58159
|
}
|
|
58066
58160
|
const translatedPoints = points.map((point9) => ({
|
|
@@ -58092,14 +58186,26 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
58092
58186
|
padHeightCandidates.push(element.rect_pad_height);
|
|
58093
58187
|
}
|
|
58094
58188
|
const padH = Math.max(...padHeightCandidates);
|
|
58095
|
-
const soldermaskGlayer = glayers[getGerberLayerName(layer, "soldermask")];
|
|
58189
|
+
const soldermaskGlayer = isOuterLayerRef(layer) ? glayers[getGerberLayerName(layer, "soldermask")] : undefined;
|
|
58096
58190
|
let soldermaskMargin = 0;
|
|
58097
|
-
if (glayer === soldermaskGlayer && "soldermask_margin" in element && typeof element.soldermask_margin === "number") {
|
|
58191
|
+
if (soldermaskGlayer && glayer === soldermaskGlayer && "soldermask_margin" in element && typeof element.soldermask_margin === "number") {
|
|
58098
58192
|
soldermaskMargin = element.soldermask_margin;
|
|
58099
58193
|
}
|
|
58100
58194
|
const aperturePadW = padW + soldermaskMargin * 2;
|
|
58101
58195
|
const aperturePadH = padH + soldermaskMargin * 2;
|
|
58102
|
-
if (element.shape === "
|
|
58196
|
+
if (element.shape === "oval") {
|
|
58197
|
+
addClosedRegionFromPoints({
|
|
58198
|
+
target: glayer,
|
|
58199
|
+
apertureSource: glayer,
|
|
58200
|
+
points: getEllipsePoints({
|
|
58201
|
+
x: element.x,
|
|
58202
|
+
y: element.y,
|
|
58203
|
+
width: aperturePadW,
|
|
58204
|
+
height: aperturePadH,
|
|
58205
|
+
rotationDegrees: element.ccw_rotation
|
|
58206
|
+
})
|
|
58207
|
+
});
|
|
58208
|
+
} else if (element.shape === "pill") {
|
|
58103
58209
|
const circleApertureConfig = {
|
|
58104
58210
|
standard_template_code: "C",
|
|
58105
58211
|
diameter: Math.min(aperturePadW, aperturePadH)
|
|
@@ -58158,7 +58264,7 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
58158
58264
|
...element,
|
|
58159
58265
|
...element.shape !== "circle" ? { outer_width: padW, outer_height: padH } : {}
|
|
58160
58266
|
});
|
|
58161
|
-
if (glayer === soldermaskGlayer) {
|
|
58267
|
+
if (soldermaskGlayer && glayer === soldermaskGlayer) {
|
|
58162
58268
|
apertureConfig = getApertureConfigFromPcbPlatedHoleSoldermask({
|
|
58163
58269
|
...element,
|
|
58164
58270
|
...element.shape !== "circle" ? { outer_width: padW, outer_height: padH } : {}
|
|
@@ -58296,12 +58402,26 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
|
|
|
58296
58402
|
}
|
|
58297
58403
|
}
|
|
58298
58404
|
}
|
|
58405
|
+
for (const layer of copperLayerRefs) {
|
|
58406
|
+
const hasCopperPour = circuitJson.some((element) => element.type === "pcb_copper_pour" && element.layer === layer);
|
|
58407
|
+
if (!hasCopperPour)
|
|
58408
|
+
continue;
|
|
58409
|
+
const copperGlayer = glayers[getGerberLayerName(layer, "copper")];
|
|
58410
|
+
for (const element of circuitJson) {
|
|
58411
|
+
if (element.type !== "pcb_hole" || element.hole_shape !== "circle") {
|
|
58412
|
+
continue;
|
|
58413
|
+
}
|
|
58414
|
+
copperGlayer.push(...gerberBuilder().add("set_layer_polarity", { polarity: "C" }).add("select_aperture", {
|
|
58415
|
+
aperture_number: findApertureNumber(copperGlayer, getApertureConfigFromCirclePcbHole(element))
|
|
58416
|
+
}).add("flash_operation", { x: element.x, y: mfy(element.y) }).add("set_layer_polarity", { polarity: "D" }).build());
|
|
58417
|
+
}
|
|
58418
|
+
}
|
|
58299
58419
|
for (const key of Object.keys(glayers)) {
|
|
58300
58420
|
glayers[key].push(...gerberBuilder().add("end_of_file", {}).build());
|
|
58301
58421
|
}
|
|
58302
58422
|
return glayers;
|
|
58303
58423
|
};
|
|
58304
|
-
var
|
|
58424
|
+
var init_chunk_MJSWOMMX = __esm(() => {
|
|
58305
58425
|
import_polygon_clipping = __toESM2(require_polygon_clipping_cjs(), 1);
|
|
58306
58426
|
import_fast_json_stable_stringify = __toESM2(require_fast_json_stable_stringify(), 1);
|
|
58307
58427
|
import_polygon_clipping2 = __toESM2(require_polygon_clipping_cjs(), 1);
|
|
@@ -58916,7 +59036,8 @@ ${template_code}%`;
|
|
|
58916
59036
|
};
|
|
58917
59037
|
package_default5 = {
|
|
58918
59038
|
name: "circuit-json-to-gerber",
|
|
58919
|
-
version: "0.0.
|
|
59039
|
+
version: "0.0.93",
|
|
59040
|
+
license: "MIT",
|
|
58920
59041
|
main: "dist/index.js",
|
|
58921
59042
|
type: "module",
|
|
58922
59043
|
scripts: {
|
|
@@ -58941,13 +59062,13 @@ ${template_code}%`;
|
|
|
58941
59062
|
"@types/react-dom": "^19.1.5",
|
|
58942
59063
|
archiver: "^7.0.1",
|
|
58943
59064
|
"bun-match-svg": "^0.0.13",
|
|
58944
|
-
"circuit-json": "^0.0.
|
|
59065
|
+
"circuit-json": "^0.0.456",
|
|
58945
59066
|
commander: "^12.1.0",
|
|
59067
|
+
"format-si-unit": "^0.0.7",
|
|
58946
59068
|
"gerber-to-svg": "^4.2.8",
|
|
58947
59069
|
gerberts: "^0.0.3",
|
|
58948
59070
|
jszip: "^3.10.1",
|
|
58949
59071
|
"pcb-stackup": "^4.2.8",
|
|
58950
|
-
"polygon-clipping": "^0.15.7",
|
|
58951
59072
|
react: "^19.2.1",
|
|
58952
59073
|
"react-dom": "^19.2.1",
|
|
58953
59074
|
tscircuit: "^0.0.1776",
|
|
@@ -58961,6 +59082,7 @@ ${template_code}%`;
|
|
|
58961
59082
|
dependencies: {
|
|
58962
59083
|
"@tscircuit/alphabet": "^0.0.25",
|
|
58963
59084
|
"fast-json-stable-stringify": "^2.1.0",
|
|
59085
|
+
"polygon-clipping": "^0.15.7",
|
|
58964
59086
|
"transformation-matrix": "^3.0.0"
|
|
58965
59087
|
}
|
|
58966
59088
|
};
|
|
@@ -58976,15 +59098,9 @@ ${template_code}%`;
|
|
|
58976
59098
|
"bottom-paste": "Paste,Bot",
|
|
58977
59099
|
edgecut: "Profile,NP"
|
|
58978
59100
|
};
|
|
58979
|
-
|
|
59101
|
+
outerLayerRefToGerberPrefix = {
|
|
58980
59102
|
top: "F_",
|
|
58981
|
-
bottom: "B_"
|
|
58982
|
-
inner1: "In1_",
|
|
58983
|
-
inner2: "In2_",
|
|
58984
|
-
inner3: "In3_",
|
|
58985
|
-
inner4: "In4_",
|
|
58986
|
-
inner5: "In5_",
|
|
58987
|
-
inner6: "In6_"
|
|
59103
|
+
bottom: "B_"
|
|
58988
59104
|
};
|
|
58989
59105
|
layerTypeToGerberSuffix = {
|
|
58990
59106
|
copper: "Cu",
|
|
@@ -58999,7 +59115,7 @@ ${template_code}%`;
|
|
|
58999
59115
|
|
|
59000
59116
|
// node_modules/circuit-json-to-gerber/dist/index.js
|
|
59001
59117
|
var init_dist = __esm(() => {
|
|
59002
|
-
|
|
59118
|
+
init_chunk_MJSWOMMX();
|
|
59003
59119
|
});
|
|
59004
59120
|
|
|
59005
59121
|
// node_modules/@tracespace/xml-id/index.js
|
|
@@ -70424,9 +70540,88 @@ var require_gerber_to_svg = __commonJS((exports2, module2) => {
|
|
|
70424
70540
|
|
|
70425
70541
|
// node_modules/fflate/esm/index.mjs
|
|
70426
70542
|
import { createRequire as createRequire4 } from "module";
|
|
70543
|
+
function deflateSync(data, opts) {
|
|
70544
|
+
return dopt(data, opts || {}, 0, 0);
|
|
70545
|
+
}
|
|
70427
70546
|
function unzlibSync(data, opts) {
|
|
70428
70547
|
return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary);
|
|
70429
70548
|
}
|
|
70549
|
+
function strToU8(str, latin1) {
|
|
70550
|
+
if (latin1) {
|
|
70551
|
+
var ar_1 = new u8(str.length);
|
|
70552
|
+
for (var i3 = 0;i3 < str.length; ++i3)
|
|
70553
|
+
ar_1[i3] = str.charCodeAt(i3);
|
|
70554
|
+
return ar_1;
|
|
70555
|
+
}
|
|
70556
|
+
if (te3)
|
|
70557
|
+
return te3.encode(str);
|
|
70558
|
+
var l3 = str.length;
|
|
70559
|
+
var ar3 = new u8(str.length + (str.length >> 1));
|
|
70560
|
+
var ai3 = 0;
|
|
70561
|
+
var w4 = function(v4) {
|
|
70562
|
+
ar3[ai3++] = v4;
|
|
70563
|
+
};
|
|
70564
|
+
for (var i3 = 0;i3 < l3; ++i3) {
|
|
70565
|
+
if (ai3 + 5 > ar3.length) {
|
|
70566
|
+
var n3 = new u8(ai3 + 8 + (l3 - i3 << 1));
|
|
70567
|
+
n3.set(ar3);
|
|
70568
|
+
ar3 = n3;
|
|
70569
|
+
}
|
|
70570
|
+
var c3 = str.charCodeAt(i3);
|
|
70571
|
+
if (c3 < 128 || latin1)
|
|
70572
|
+
w4(c3);
|
|
70573
|
+
else if (c3 < 2048)
|
|
70574
|
+
w4(192 | c3 >> 6), w4(128 | c3 & 63);
|
|
70575
|
+
else if (c3 > 55295 && c3 < 57344)
|
|
70576
|
+
c3 = 65536 + (c3 & 1023 << 10) | str.charCodeAt(++i3) & 1023, w4(240 | c3 >> 18), w4(128 | c3 >> 12 & 63), w4(128 | c3 >> 6 & 63), w4(128 | c3 & 63);
|
|
70577
|
+
else
|
|
70578
|
+
w4(224 | c3 >> 12), w4(128 | c3 >> 6 & 63), w4(128 | c3 & 63);
|
|
70579
|
+
}
|
|
70580
|
+
return slc(ar3, 0, ai3);
|
|
70581
|
+
}
|
|
70582
|
+
function zipSync(data, opts) {
|
|
70583
|
+
if (!opts)
|
|
70584
|
+
opts = {};
|
|
70585
|
+
var r4 = {};
|
|
70586
|
+
var files = [];
|
|
70587
|
+
fltn(data, "", r4, opts);
|
|
70588
|
+
var o3 = 0;
|
|
70589
|
+
var tot = 0;
|
|
70590
|
+
for (var fn3 in r4) {
|
|
70591
|
+
var _a4 = r4[fn3], file = _a4[0], p3 = _a4[1];
|
|
70592
|
+
var compression = p3.level == 0 ? 0 : 8;
|
|
70593
|
+
var f2 = strToU8(fn3), s2 = f2.length;
|
|
70594
|
+
var com = p3.comment, m3 = com && strToU8(com), ms5 = m3 && m3.length;
|
|
70595
|
+
var exl = exfl(p3.extra);
|
|
70596
|
+
if (s2 > 65535)
|
|
70597
|
+
err(11);
|
|
70598
|
+
var d3 = compression ? deflateSync(file, p3) : file, l3 = d3.length;
|
|
70599
|
+
var c3 = crc();
|
|
70600
|
+
c3.p(file);
|
|
70601
|
+
files.push(mrg(p3, {
|
|
70602
|
+
size: file.length,
|
|
70603
|
+
crc: c3.d(),
|
|
70604
|
+
c: d3,
|
|
70605
|
+
f: f2,
|
|
70606
|
+
m: m3,
|
|
70607
|
+
u: s2 != fn3.length || m3 && com.length != ms5,
|
|
70608
|
+
o: o3,
|
|
70609
|
+
compression
|
|
70610
|
+
}));
|
|
70611
|
+
o3 += 30 + s2 + exl + l3;
|
|
70612
|
+
tot += 76 + 2 * (s2 + exl) + (ms5 || 0) + l3;
|
|
70613
|
+
}
|
|
70614
|
+
var out = new u8(tot + 22), oe3 = o3, cdl = tot - o3;
|
|
70615
|
+
for (var i3 = 0;i3 < files.length; ++i3) {
|
|
70616
|
+
var f2 = files[i3];
|
|
70617
|
+
wzh(out, f2.o, f2, f2.f, f2.u, f2.c.length);
|
|
70618
|
+
var badd = 30 + f2.f.length + exfl(f2.extra);
|
|
70619
|
+
out.set(f2.c, f2.o + badd);
|
|
70620
|
+
wzh(out, o3, f2, f2.f, f2.u, f2.c.length, f2.o, f2.m), o3 += 16 + badd + (f2.m ? f2.m.length : 0);
|
|
70621
|
+
}
|
|
70622
|
+
wzf(out, o3, files.length, cdl, oe3);
|
|
70623
|
+
return out;
|
|
70624
|
+
}
|
|
70430
70625
|
var require3, _a3, Worker2, isMarkedAsUntransferable, u8, u16, i32, fleb, fdeb, clim, freb = function(eb2, start) {
|
|
70431
70626
|
var b3 = new u16(31);
|
|
70432
70627
|
for (var i2 = 0;i2 < 31; ++i2) {
|
|
@@ -70474,7 +70669,7 @@ var require3, _a3, Worker2, isMarkedAsUntransferable, u8, u16, i32, fleb, fdeb,
|
|
|
70474
70669
|
}
|
|
70475
70670
|
}
|
|
70476
70671
|
return co3;
|
|
70477
|
-
}, flt, i2, i2, i2, i2, fdt, i2, flrm, fdrm, max = function(a2) {
|
|
70672
|
+
}, flt, i2, i2, i2, i2, fdt, i2, flm, flrm, fdm, fdrm, max = function(a2) {
|
|
70478
70673
|
var m3 = a2[0];
|
|
70479
70674
|
for (var i3 = 1;i3 < a2.length; ++i3) {
|
|
70480
70675
|
if (a2[i3] > m3)
|
|
@@ -70643,13 +70838,406 @@ var require3, _a3, Worker2, isMarkedAsUntransferable, u8, u16, i32, fleb, fdeb,
|
|
|
70643
70838
|
final = 1, st3.m = lbt, st3.d = dm3, st3.n = dbt;
|
|
70644
70839
|
} while (!final);
|
|
70645
70840
|
return bt2 != buf.length && noBuf ? slc(buf, 0, bt2) : buf.subarray(0, bt2);
|
|
70646
|
-
},
|
|
70841
|
+
}, wbits = function(d3, p3, v4) {
|
|
70842
|
+
v4 <<= p3 & 7;
|
|
70843
|
+
var o3 = p3 / 8 | 0;
|
|
70844
|
+
d3[o3] |= v4;
|
|
70845
|
+
d3[o3 + 1] |= v4 >> 8;
|
|
70846
|
+
}, wbits16 = function(d3, p3, v4) {
|
|
70847
|
+
v4 <<= p3 & 7;
|
|
70848
|
+
var o3 = p3 / 8 | 0;
|
|
70849
|
+
d3[o3] |= v4;
|
|
70850
|
+
d3[o3 + 1] |= v4 >> 8;
|
|
70851
|
+
d3[o3 + 2] |= v4 >> 16;
|
|
70852
|
+
}, hTree = function(d3, mb3) {
|
|
70853
|
+
var t49 = [];
|
|
70854
|
+
for (var i3 = 0;i3 < d3.length; ++i3) {
|
|
70855
|
+
if (d3[i3])
|
|
70856
|
+
t49.push({ s: i3, f: d3[i3] });
|
|
70857
|
+
}
|
|
70858
|
+
var s2 = t49.length;
|
|
70859
|
+
var t210 = t49.slice();
|
|
70860
|
+
if (!s2)
|
|
70861
|
+
return { t: et3, l: 0 };
|
|
70862
|
+
if (s2 == 1) {
|
|
70863
|
+
var v4 = new u8(t49[0].s + 1);
|
|
70864
|
+
v4[t49[0].s] = 1;
|
|
70865
|
+
return { t: v4, l: 1 };
|
|
70866
|
+
}
|
|
70867
|
+
t49.sort(function(a2, b3) {
|
|
70868
|
+
return a2.f - b3.f;
|
|
70869
|
+
});
|
|
70870
|
+
t49.push({ s: -1, f: 25001 });
|
|
70871
|
+
var l3 = t49[0], r4 = t49[1], i02 = 0, i12 = 1, i22 = 2;
|
|
70872
|
+
t49[0] = { s: -1, f: l3.f + r4.f, l: l3, r: r4 };
|
|
70873
|
+
while (i12 != s2 - 1) {
|
|
70874
|
+
l3 = t49[t49[i02].f < t49[i22].f ? i02++ : i22++];
|
|
70875
|
+
r4 = t49[i02 != i12 && t49[i02].f < t49[i22].f ? i02++ : i22++];
|
|
70876
|
+
t49[i12++] = { s: -1, f: l3.f + r4.f, l: l3, r: r4 };
|
|
70877
|
+
}
|
|
70878
|
+
var maxSym = t210[0].s;
|
|
70879
|
+
for (var i3 = 1;i3 < s2; ++i3) {
|
|
70880
|
+
if (t210[i3].s > maxSym)
|
|
70881
|
+
maxSym = t210[i3].s;
|
|
70882
|
+
}
|
|
70883
|
+
var tr3 = new u16(maxSym + 1);
|
|
70884
|
+
var mbt = ln3(t49[i12 - 1], tr3, 0);
|
|
70885
|
+
if (mbt > mb3) {
|
|
70886
|
+
var i3 = 0, dt3 = 0;
|
|
70887
|
+
var lft = mbt - mb3, cst = 1 << lft;
|
|
70888
|
+
t210.sort(function(a2, b3) {
|
|
70889
|
+
return tr3[b3.s] - tr3[a2.s] || a2.f - b3.f;
|
|
70890
|
+
});
|
|
70891
|
+
for (;i3 < s2; ++i3) {
|
|
70892
|
+
var i2_1 = t210[i3].s;
|
|
70893
|
+
if (tr3[i2_1] > mb3) {
|
|
70894
|
+
dt3 += cst - (1 << mbt - tr3[i2_1]);
|
|
70895
|
+
tr3[i2_1] = mb3;
|
|
70896
|
+
} else
|
|
70897
|
+
break;
|
|
70898
|
+
}
|
|
70899
|
+
dt3 >>= lft;
|
|
70900
|
+
while (dt3 > 0) {
|
|
70901
|
+
var i2_2 = t210[i3].s;
|
|
70902
|
+
if (tr3[i2_2] < mb3)
|
|
70903
|
+
dt3 -= 1 << mb3 - tr3[i2_2]++ - 1;
|
|
70904
|
+
else
|
|
70905
|
+
++i3;
|
|
70906
|
+
}
|
|
70907
|
+
for (;i3 >= 0 && dt3; --i3) {
|
|
70908
|
+
var i2_3 = t210[i3].s;
|
|
70909
|
+
if (tr3[i2_3] == mb3) {
|
|
70910
|
+
--tr3[i2_3];
|
|
70911
|
+
++dt3;
|
|
70912
|
+
}
|
|
70913
|
+
}
|
|
70914
|
+
mbt = mb3;
|
|
70915
|
+
}
|
|
70916
|
+
return { t: new u8(tr3), l: mbt };
|
|
70917
|
+
}, ln3 = function(n3, l3, d3) {
|
|
70918
|
+
return n3.s == -1 ? Math.max(ln3(n3.l, l3, d3 + 1), ln3(n3.r, l3, d3 + 1)) : l3[n3.s] = d3;
|
|
70919
|
+
}, lc3 = function(c3) {
|
|
70920
|
+
var s2 = c3.length;
|
|
70921
|
+
while (s2 && !c3[--s2])
|
|
70922
|
+
;
|
|
70923
|
+
var cl3 = new u16(++s2);
|
|
70924
|
+
var cli = 0, cln = c3[0], cls = 1;
|
|
70925
|
+
var w4 = function(v4) {
|
|
70926
|
+
cl3[cli++] = v4;
|
|
70927
|
+
};
|
|
70928
|
+
for (var i3 = 1;i3 <= s2; ++i3) {
|
|
70929
|
+
if (c3[i3] == cln && i3 != s2)
|
|
70930
|
+
++cls;
|
|
70931
|
+
else {
|
|
70932
|
+
if (!cln && cls > 2) {
|
|
70933
|
+
for (;cls > 138; cls -= 138)
|
|
70934
|
+
w4(32754);
|
|
70935
|
+
if (cls > 2) {
|
|
70936
|
+
w4(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
|
|
70937
|
+
cls = 0;
|
|
70938
|
+
}
|
|
70939
|
+
} else if (cls > 3) {
|
|
70940
|
+
w4(cln), --cls;
|
|
70941
|
+
for (;cls > 6; cls -= 6)
|
|
70942
|
+
w4(8304);
|
|
70943
|
+
if (cls > 2)
|
|
70944
|
+
w4(cls - 3 << 5 | 8208), cls = 0;
|
|
70945
|
+
}
|
|
70946
|
+
while (cls--)
|
|
70947
|
+
w4(cln);
|
|
70948
|
+
cls = 1;
|
|
70949
|
+
cln = c3[i3];
|
|
70950
|
+
}
|
|
70951
|
+
}
|
|
70952
|
+
return { c: cl3.subarray(0, cli), n: s2 };
|
|
70953
|
+
}, clen = function(cf3, cl3) {
|
|
70954
|
+
var l3 = 0;
|
|
70955
|
+
for (var i3 = 0;i3 < cl3.length; ++i3)
|
|
70956
|
+
l3 += cf3[i3] * cl3[i3];
|
|
70957
|
+
return l3;
|
|
70958
|
+
}, wfblk = function(out, pos, dat) {
|
|
70959
|
+
var s2 = dat.length;
|
|
70960
|
+
var o3 = shft(pos + 2);
|
|
70961
|
+
out[o3] = s2 & 255;
|
|
70962
|
+
out[o3 + 1] = s2 >> 8;
|
|
70963
|
+
out[o3 + 2] = out[o3] ^ 255;
|
|
70964
|
+
out[o3 + 3] = out[o3 + 1] ^ 255;
|
|
70965
|
+
for (var i3 = 0;i3 < s2; ++i3)
|
|
70966
|
+
out[o3 + i3 + 4] = dat[i3];
|
|
70967
|
+
return (o3 + 4 + s2) * 8;
|
|
70968
|
+
}, wblk = function(dat, out, final, syms, lf3, df3, eb2, li3, bs3, bl3, p3) {
|
|
70969
|
+
wbits(out, p3++, final);
|
|
70970
|
+
++lf3[256];
|
|
70971
|
+
var _a4 = hTree(lf3, 15), dlt = _a4.t, mlb = _a4.l;
|
|
70972
|
+
var _b4 = hTree(df3, 15), ddt = _b4.t, mdb = _b4.l;
|
|
70973
|
+
var _c3 = lc3(dlt), lclt = _c3.c, nlc = _c3.n;
|
|
70974
|
+
var _d3 = lc3(ddt), lcdt = _d3.c, ndc = _d3.n;
|
|
70975
|
+
var lcfreq = new u16(19);
|
|
70976
|
+
for (var i3 = 0;i3 < lclt.length; ++i3)
|
|
70977
|
+
++lcfreq[lclt[i3] & 31];
|
|
70978
|
+
for (var i3 = 0;i3 < lcdt.length; ++i3)
|
|
70979
|
+
++lcfreq[lcdt[i3] & 31];
|
|
70980
|
+
var _e3 = hTree(lcfreq, 7), lct = _e3.t, mlcb = _e3.l;
|
|
70981
|
+
var nlcc = 19;
|
|
70982
|
+
for (;nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
|
|
70983
|
+
;
|
|
70984
|
+
var flen = bl3 + 5 << 3;
|
|
70985
|
+
var ftlen = clen(lf3, flt) + clen(df3, fdt) + eb2;
|
|
70986
|
+
var dtlen = clen(lf3, dlt) + clen(df3, ddt) + eb2 + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
|
|
70987
|
+
if (bs3 >= 0 && flen <= ftlen && flen <= dtlen)
|
|
70988
|
+
return wfblk(out, p3, dat.subarray(bs3, bs3 + bl3));
|
|
70989
|
+
var lm3, ll3, dm3, dl2;
|
|
70990
|
+
wbits(out, p3, 1 + (dtlen < ftlen)), p3 += 2;
|
|
70991
|
+
if (dtlen < ftlen) {
|
|
70992
|
+
lm3 = hMap(dlt, mlb, 0), ll3 = dlt, dm3 = hMap(ddt, mdb, 0), dl2 = ddt;
|
|
70993
|
+
var llm = hMap(lct, mlcb, 0);
|
|
70994
|
+
wbits(out, p3, nlc - 257);
|
|
70995
|
+
wbits(out, p3 + 5, ndc - 1);
|
|
70996
|
+
wbits(out, p3 + 10, nlcc - 4);
|
|
70997
|
+
p3 += 14;
|
|
70998
|
+
for (var i3 = 0;i3 < nlcc; ++i3)
|
|
70999
|
+
wbits(out, p3 + 3 * i3, lct[clim[i3]]);
|
|
71000
|
+
p3 += 3 * nlcc;
|
|
71001
|
+
var lcts = [lclt, lcdt];
|
|
71002
|
+
for (var it3 = 0;it3 < 2; ++it3) {
|
|
71003
|
+
var clct = lcts[it3];
|
|
71004
|
+
for (var i3 = 0;i3 < clct.length; ++i3) {
|
|
71005
|
+
var len = clct[i3] & 31;
|
|
71006
|
+
wbits(out, p3, llm[len]), p3 += lct[len];
|
|
71007
|
+
if (len > 15)
|
|
71008
|
+
wbits(out, p3, clct[i3] >> 5 & 127), p3 += clct[i3] >> 12;
|
|
71009
|
+
}
|
|
71010
|
+
}
|
|
71011
|
+
} else {
|
|
71012
|
+
lm3 = flm, ll3 = flt, dm3 = fdm, dl2 = fdt;
|
|
71013
|
+
}
|
|
71014
|
+
for (var i3 = 0;i3 < li3; ++i3) {
|
|
71015
|
+
var sym = syms[i3];
|
|
71016
|
+
if (sym > 255) {
|
|
71017
|
+
var len = sym >> 18 & 31;
|
|
71018
|
+
wbits16(out, p3, lm3[len + 257]), p3 += ll3[len + 257];
|
|
71019
|
+
if (len > 7)
|
|
71020
|
+
wbits(out, p3, sym >> 23 & 31), p3 += fleb[len];
|
|
71021
|
+
var dst = sym & 31;
|
|
71022
|
+
wbits16(out, p3, dm3[dst]), p3 += dl2[dst];
|
|
71023
|
+
if (dst > 3)
|
|
71024
|
+
wbits16(out, p3, sym >> 5 & 8191), p3 += fdeb[dst];
|
|
71025
|
+
} else {
|
|
71026
|
+
wbits16(out, p3, lm3[sym]), p3 += ll3[sym];
|
|
71027
|
+
}
|
|
71028
|
+
}
|
|
71029
|
+
wbits16(out, p3, lm3[256]);
|
|
71030
|
+
return p3 + ll3[256];
|
|
71031
|
+
}, deo, et3, dflt = function(dat, lvl, plvl, pre, post, st3) {
|
|
71032
|
+
var s2 = st3.z || dat.length;
|
|
71033
|
+
var o3 = new u8(pre + s2 + 5 * (1 + Math.ceil(s2 / 7000)) + post);
|
|
71034
|
+
var w4 = o3.subarray(pre, o3.length - post);
|
|
71035
|
+
var lst = st3.l;
|
|
71036
|
+
var pos = (st3.r || 0) & 7;
|
|
71037
|
+
if (lvl) {
|
|
71038
|
+
if (pos)
|
|
71039
|
+
w4[0] = st3.r >> 3;
|
|
71040
|
+
var opt = deo[lvl - 1];
|
|
71041
|
+
var n3 = opt >> 13, c3 = opt & 8191;
|
|
71042
|
+
var msk_1 = (1 << plvl) - 1;
|
|
71043
|
+
var prev = st3.p || new u16(32768), head = st3.h || new u16(msk_1 + 1);
|
|
71044
|
+
var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
|
|
71045
|
+
var hsh = function(i4) {
|
|
71046
|
+
return (dat[i4] ^ dat[i4 + 1] << bs1_1 ^ dat[i4 + 2] << bs2_1) & msk_1;
|
|
71047
|
+
};
|
|
71048
|
+
var syms = new i32(25000);
|
|
71049
|
+
var lf3 = new u16(288), df3 = new u16(32);
|
|
71050
|
+
var lc_1 = 0, eb2 = 0, i3 = st3.i || 0, li3 = 0, wi3 = st3.w || 0, bs3 = 0;
|
|
71051
|
+
for (;i3 + 2 < s2; ++i3) {
|
|
71052
|
+
var hv2 = hsh(i3);
|
|
71053
|
+
var imod = i3 & 32767, pimod = head[hv2];
|
|
71054
|
+
prev[imod] = pimod;
|
|
71055
|
+
head[hv2] = imod;
|
|
71056
|
+
if (wi3 <= i3) {
|
|
71057
|
+
var rem = s2 - i3;
|
|
71058
|
+
if ((lc_1 > 7000 || li3 > 24576) && (rem > 423 || !lst)) {
|
|
71059
|
+
pos = wblk(dat, w4, 0, syms, lf3, df3, eb2, li3, bs3, i3 - bs3, pos);
|
|
71060
|
+
li3 = lc_1 = eb2 = 0, bs3 = i3;
|
|
71061
|
+
for (var j4 = 0;j4 < 286; ++j4)
|
|
71062
|
+
lf3[j4] = 0;
|
|
71063
|
+
for (var j4 = 0;j4 < 30; ++j4)
|
|
71064
|
+
df3[j4] = 0;
|
|
71065
|
+
}
|
|
71066
|
+
var l3 = 2, d3 = 0, ch_1 = c3, dif = imod - pimod & 32767;
|
|
71067
|
+
if (rem > 2 && hv2 == hsh(i3 - dif)) {
|
|
71068
|
+
var maxn = Math.min(n3, rem) - 1;
|
|
71069
|
+
var maxd = Math.min(32767, i3);
|
|
71070
|
+
var ml2 = Math.min(258, rem);
|
|
71071
|
+
while (dif <= maxd && --ch_1 && imod != pimod) {
|
|
71072
|
+
if (dat[i3 + l3] == dat[i3 + l3 - dif]) {
|
|
71073
|
+
var nl3 = 0;
|
|
71074
|
+
for (;nl3 < ml2 && dat[i3 + nl3] == dat[i3 + nl3 - dif]; ++nl3)
|
|
71075
|
+
;
|
|
71076
|
+
if (nl3 > l3) {
|
|
71077
|
+
l3 = nl3, d3 = dif;
|
|
71078
|
+
if (nl3 > maxn)
|
|
71079
|
+
break;
|
|
71080
|
+
var mmd = Math.min(dif, nl3 - 2);
|
|
71081
|
+
var md3 = 0;
|
|
71082
|
+
for (var j4 = 0;j4 < mmd; ++j4) {
|
|
71083
|
+
var ti3 = i3 - dif + j4 & 32767;
|
|
71084
|
+
var pti = prev[ti3];
|
|
71085
|
+
var cd3 = ti3 - pti & 32767;
|
|
71086
|
+
if (cd3 > md3)
|
|
71087
|
+
md3 = cd3, pimod = ti3;
|
|
71088
|
+
}
|
|
71089
|
+
}
|
|
71090
|
+
}
|
|
71091
|
+
imod = pimod, pimod = prev[imod];
|
|
71092
|
+
dif += imod - pimod & 32767;
|
|
71093
|
+
}
|
|
71094
|
+
}
|
|
71095
|
+
if (d3) {
|
|
71096
|
+
syms[li3++] = 268435456 | revfl[l3] << 18 | revfd[d3];
|
|
71097
|
+
var lin = revfl[l3] & 31, din = revfd[d3] & 31;
|
|
71098
|
+
eb2 += fleb[lin] + fdeb[din];
|
|
71099
|
+
++lf3[257 + lin];
|
|
71100
|
+
++df3[din];
|
|
71101
|
+
wi3 = i3 + l3;
|
|
71102
|
+
++lc_1;
|
|
71103
|
+
} else {
|
|
71104
|
+
syms[li3++] = dat[i3];
|
|
71105
|
+
++lf3[dat[i3]];
|
|
71106
|
+
}
|
|
71107
|
+
}
|
|
71108
|
+
}
|
|
71109
|
+
for (i3 = Math.max(i3, wi3);i3 < s2; ++i3) {
|
|
71110
|
+
syms[li3++] = dat[i3];
|
|
71111
|
+
++lf3[dat[i3]];
|
|
71112
|
+
}
|
|
71113
|
+
pos = wblk(dat, w4, lst, syms, lf3, df3, eb2, li3, bs3, i3 - bs3, pos);
|
|
71114
|
+
if (!lst) {
|
|
71115
|
+
st3.r = pos & 7 | w4[pos / 8 | 0] << 3;
|
|
71116
|
+
pos -= 7;
|
|
71117
|
+
st3.h = head, st3.p = prev, st3.i = i3, st3.w = wi3;
|
|
71118
|
+
}
|
|
71119
|
+
} else {
|
|
71120
|
+
for (var i3 = st3.w || 0;i3 < s2 + lst; i3 += 65535) {
|
|
71121
|
+
var e4 = i3 + 65535;
|
|
71122
|
+
if (e4 >= s2) {
|
|
71123
|
+
w4[pos / 8 | 0] = lst;
|
|
71124
|
+
e4 = s2;
|
|
71125
|
+
}
|
|
71126
|
+
pos = wfblk(w4, pos + 1, dat.subarray(i3, e4));
|
|
71127
|
+
}
|
|
71128
|
+
st3.i = s2;
|
|
71129
|
+
}
|
|
71130
|
+
return slc(o3, 0, pre + shft(pos) + post);
|
|
71131
|
+
}, crct, crc = function() {
|
|
71132
|
+
var c3 = -1;
|
|
71133
|
+
return {
|
|
71134
|
+
p: function(d3) {
|
|
71135
|
+
var cr3 = c3;
|
|
71136
|
+
for (var i3 = 0;i3 < d3.length; ++i3)
|
|
71137
|
+
cr3 = crct[cr3 & 255 ^ d3[i3]] ^ cr3 >>> 8;
|
|
71138
|
+
c3 = cr3;
|
|
71139
|
+
},
|
|
71140
|
+
d: function() {
|
|
71141
|
+
return ~c3;
|
|
71142
|
+
}
|
|
71143
|
+
};
|
|
71144
|
+
}, dopt = function(dat, opt, pre, post, st3) {
|
|
71145
|
+
if (!st3) {
|
|
71146
|
+
st3 = { l: 1 };
|
|
71147
|
+
if (opt.dictionary) {
|
|
71148
|
+
var dict = opt.dictionary.subarray(-32768);
|
|
71149
|
+
var newDat = new u8(dict.length + dat.length);
|
|
71150
|
+
newDat.set(dict);
|
|
71151
|
+
newDat.set(dat, dict.length);
|
|
71152
|
+
dat = newDat;
|
|
71153
|
+
st3.w = dict.length;
|
|
71154
|
+
}
|
|
71155
|
+
}
|
|
71156
|
+
return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st3.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st3);
|
|
71157
|
+
}, mrg = function(a2, b3) {
|
|
71158
|
+
var o3 = {};
|
|
71159
|
+
for (var k4 in a2)
|
|
71160
|
+
o3[k4] = a2[k4];
|
|
71161
|
+
for (var k4 in b3)
|
|
71162
|
+
o3[k4] = b3[k4];
|
|
71163
|
+
return o3;
|
|
71164
|
+
}, wbytes = function(d3, b3, v4) {
|
|
71165
|
+
for (;v4; ++b3)
|
|
71166
|
+
d3[b3] = v4, v4 >>>= 8;
|
|
71167
|
+
}, zls = function(d3, dict) {
|
|
70647
71168
|
if ((d3[0] & 15) != 8 || d3[0] >> 4 > 7 || (d3[0] << 8 | d3[1]) % 31)
|
|
70648
71169
|
err(6, "invalid zlib data");
|
|
70649
71170
|
if ((d3[1] >> 5 & 1) == +!dict)
|
|
70650
71171
|
err(6, "invalid zlib data: " + (d3[1] & 32 ? "need" : "unexpected") + " dictionary");
|
|
70651
71172
|
return (d3[1] >> 3 & 4) + 2;
|
|
70652
|
-
}, Inflate, Unzlib,
|
|
71173
|
+
}, Inflate, Unzlib, fltn = function(d3, p3, t49, o3) {
|
|
71174
|
+
for (var k4 in d3) {
|
|
71175
|
+
var val = d3[k4], n3 = p3 + k4, op3 = o3;
|
|
71176
|
+
if (Array.isArray(val))
|
|
71177
|
+
op3 = mrg(o3, val[1]), val = val[0];
|
|
71178
|
+
if (ArrayBuffer.isView(val))
|
|
71179
|
+
t49[n3] = [val, op3];
|
|
71180
|
+
else {
|
|
71181
|
+
t49[n3 += "/"] = [new u8(0), op3];
|
|
71182
|
+
fltn(val, n3, t49, o3);
|
|
71183
|
+
}
|
|
71184
|
+
}
|
|
71185
|
+
}, te3, td3, tds = 0, exfl = function(ex3) {
|
|
71186
|
+
var le3 = 0;
|
|
71187
|
+
if (ex3) {
|
|
71188
|
+
for (var k4 in ex3) {
|
|
71189
|
+
var l3 = ex3[k4].length;
|
|
71190
|
+
if (l3 > 65535)
|
|
71191
|
+
err(9);
|
|
71192
|
+
le3 += l3 + 4;
|
|
71193
|
+
}
|
|
71194
|
+
}
|
|
71195
|
+
return le3;
|
|
71196
|
+
}, wzh = function(d3, b3, f2, fn3, u4, c3, ce3, co3) {
|
|
71197
|
+
var fl4 = fn3.length, ex3 = f2.extra, col = co3 && co3.length;
|
|
71198
|
+
var exl = exfl(ex3);
|
|
71199
|
+
wbytes(d3, b3, ce3 != null ? 33639248 : 67324752), b3 += 4;
|
|
71200
|
+
if (ce3 != null)
|
|
71201
|
+
d3[b3++] = 20, d3[b3++] = f2.os;
|
|
71202
|
+
d3[b3] = 20, b3 += 2;
|
|
71203
|
+
d3[b3++] = f2.flag << 1 | (c3 < 0 && 8), d3[b3++] = u4 && 8;
|
|
71204
|
+
d3[b3++] = f2.compression & 255, d3[b3++] = f2.compression >> 8;
|
|
71205
|
+
var dt3 = new Date(f2.mtime == null ? Date.now() : f2.mtime), y4 = dt3.getFullYear() - 1980;
|
|
71206
|
+
if (y4 < 0 || y4 > 119)
|
|
71207
|
+
err(10);
|
|
71208
|
+
wbytes(d3, b3, y4 << 25 | dt3.getMonth() + 1 << 21 | dt3.getDate() << 16 | dt3.getHours() << 11 | dt3.getMinutes() << 5 | dt3.getSeconds() >> 1), b3 += 4;
|
|
71209
|
+
if (c3 != -1) {
|
|
71210
|
+
wbytes(d3, b3, f2.crc);
|
|
71211
|
+
wbytes(d3, b3 + 4, c3 < 0 ? -c3 - 2 : c3);
|
|
71212
|
+
wbytes(d3, b3 + 8, f2.size);
|
|
71213
|
+
}
|
|
71214
|
+
wbytes(d3, b3 + 12, fl4);
|
|
71215
|
+
wbytes(d3, b3 + 14, exl), b3 += 16;
|
|
71216
|
+
if (ce3 != null) {
|
|
71217
|
+
wbytes(d3, b3, col);
|
|
71218
|
+
wbytes(d3, b3 + 6, f2.attrs);
|
|
71219
|
+
wbytes(d3, b3 + 10, ce3), b3 += 14;
|
|
71220
|
+
}
|
|
71221
|
+
d3.set(fn3, b3);
|
|
71222
|
+
b3 += fl4;
|
|
71223
|
+
if (exl) {
|
|
71224
|
+
for (var k4 in ex3) {
|
|
71225
|
+
var exf = ex3[k4], l3 = exf.length;
|
|
71226
|
+
wbytes(d3, b3, +k4);
|
|
71227
|
+
wbytes(d3, b3 + 2, l3);
|
|
71228
|
+
d3.set(exf, b3 + 4), b3 += 4 + l3;
|
|
71229
|
+
}
|
|
71230
|
+
}
|
|
71231
|
+
if (col)
|
|
71232
|
+
d3.set(co3, b3), b3 += col;
|
|
71233
|
+
return b3;
|
|
71234
|
+
}, wzf = function(o3, b3, c3, d3, e4) {
|
|
71235
|
+
wbytes(o3, b3, 101010256);
|
|
71236
|
+
wbytes(o3, b3 + 8, c3);
|
|
71237
|
+
wbytes(o3, b3 + 10, c3);
|
|
71238
|
+
wbytes(o3, b3 + 12, d3);
|
|
71239
|
+
wbytes(o3, b3 + 16, e4);
|
|
71240
|
+
};
|
|
70653
71241
|
var init_esm = __esm(() => {
|
|
70654
71242
|
require3 = createRequire4("/");
|
|
70655
71243
|
try {
|
|
@@ -70687,7 +71275,9 @@ var init_esm = __esm(() => {
|
|
|
70687
71275
|
fdt = new u8(32);
|
|
70688
71276
|
for (i2 = 0;i2 < 32; ++i2)
|
|
70689
71277
|
fdt[i2] = 5;
|
|
71278
|
+
flm = /* @__PURE__ */ hMap(flt, 9, 0);
|
|
70690
71279
|
flrm = /* @__PURE__ */ hMap(flt, 9, 1);
|
|
71280
|
+
fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
|
|
70691
71281
|
fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
|
|
70692
71282
|
ec2 = [
|
|
70693
71283
|
"unexpected EOF",
|
|
@@ -70705,7 +71295,18 @@ var init_esm = __esm(() => {
|
|
|
70705
71295
|
"stream finishing",
|
|
70706
71296
|
"invalid zip data"
|
|
70707
71297
|
];
|
|
71298
|
+
deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
|
|
70708
71299
|
et3 = /* @__PURE__ */ new u8(0);
|
|
71300
|
+
crct = /* @__PURE__ */ function() {
|
|
71301
|
+
var t49 = new Int32Array(256);
|
|
71302
|
+
for (var i3 = 0;i3 < 256; ++i3) {
|
|
71303
|
+
var c3 = i3, k4 = 9;
|
|
71304
|
+
while (--k4)
|
|
71305
|
+
c3 = (c3 & 1 && -306674912) ^ c3 >>> 1;
|
|
71306
|
+
t49[i3] = c3;
|
|
71307
|
+
}
|
|
71308
|
+
return t49;
|
|
71309
|
+
}();
|
|
70709
71310
|
Inflate = /* @__PURE__ */ function() {
|
|
70710
71311
|
function Inflate2(opts, cb3) {
|
|
70711
71312
|
if (typeof opts == "function")
|
|
@@ -70764,6 +71365,7 @@ var init_esm = __esm(() => {
|
|
|
70764
71365
|
};
|
|
70765
71366
|
return Unzlib2;
|
|
70766
71367
|
}();
|
|
71368
|
+
te3 = typeof TextEncoder != "undefined" && /* @__PURE__ */ new TextEncoder;
|
|
70767
71369
|
td3 = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder;
|
|
70768
71370
|
try {
|
|
70769
71371
|
td3.decode(et3, { stream: true });
|
|
@@ -71119,12 +71721,12 @@ function updateCrc(currentCrc, data, length67) {
|
|
|
71119
71721
|
}
|
|
71120
71722
|
return c3;
|
|
71121
71723
|
}
|
|
71122
|
-
function
|
|
71724
|
+
function crc2(data, length67) {
|
|
71123
71725
|
return (updateCrc(initialCrc, data, length67) ^ initialCrc) >>> 0;
|
|
71124
71726
|
}
|
|
71125
71727
|
function checkCrc(buffer, crcLength, chunkName) {
|
|
71126
71728
|
const expectedCrc = buffer.readUint32();
|
|
71127
|
-
const actualCrc =
|
|
71729
|
+
const actualCrc = crc2(new Uint8Array(buffer.buffer, buffer.byteOffset + buffer.offset - crcLength - 4, crcLength), crcLength);
|
|
71128
71730
|
if (actualCrc !== expectedCrc) {
|
|
71129
71731
|
throw new Error(`CRC mismatch for chunk ${chunkName}. Expected ${expectedCrc}, found ${actualCrc}`);
|
|
71130
71732
|
}
|
|
@@ -71993,9 +72595,9 @@ import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
|
71993
72595
|
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
71994
72596
|
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
71995
72597
|
import { glyphLineAlphabet } from "@tscircuit/alphabet";
|
|
71996
|
-
import { applyToPoint as
|
|
72598
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
71997
72599
|
import {
|
|
71998
|
-
glyphAdvanceRatio,
|
|
72600
|
+
glyphAdvanceRatio as glyphAdvanceRatio2,
|
|
71999
72601
|
kerningRatio,
|
|
72000
72602
|
textMetrics
|
|
72001
72603
|
} from "@tscircuit/alphabet";
|
|
@@ -72414,9 +73016,9 @@ function addPolygonToPath(ctx, points) {
|
|
|
72414
73016
|
}
|
|
72415
73017
|
function getAlphabetAdvanceWidth(char, nextChar, fontSize) {
|
|
72416
73018
|
const advanceRatio = getAdvanceRatio(char);
|
|
72417
|
-
const
|
|
73019
|
+
const letterSpacingRatio2 = nextChar ? textMetrics.letterSpacingRatio : 0;
|
|
72418
73020
|
const kerningAdjustmentRatio = nextChar ? kerningRatio[char]?.[nextChar] ?? 0 : 0;
|
|
72419
|
-
return fontSize * (advanceRatio +
|
|
73021
|
+
return fontSize * (advanceRatio + letterSpacingRatio2 + kerningAdjustmentRatio);
|
|
72420
73022
|
}
|
|
72421
73023
|
function getAlphabetLayout(text, fontSize) {
|
|
72422
73024
|
const glyphWidth = fontSize * textMetrics.glyphWidthRatio;
|
|
@@ -72647,7 +73249,7 @@ function drawText(params2) {
|
|
|
72647
73249
|
} = params2;
|
|
72648
73250
|
if (!text)
|
|
72649
73251
|
return;
|
|
72650
|
-
const [canvasX, canvasY] =
|
|
73252
|
+
const [canvasX, canvasY] = applyToPoint53(realToCanvasMat, [x4, y4]);
|
|
72651
73253
|
const scale22 = Math.abs(realToCanvasMat.a);
|
|
72652
73254
|
const scaledFontSize = fontSize * scale22;
|
|
72653
73255
|
const layout = getAlphabetLayout(text, scaledFontSize);
|
|
@@ -76879,7 +77481,7 @@ function getCopperLayer(layers) {
|
|
|
76879
77481
|
const renderLayer = layers.find((candidate) => candidate.endsWith("_copper")) ?? layers[0] ?? "top_copper";
|
|
76880
77482
|
return renderLayer.split("_")[0];
|
|
76881
77483
|
}
|
|
76882
|
-
var getAdvanceRatio = (char) =>
|
|
77484
|
+
var getAdvanceRatio = (char) => glyphAdvanceRatio2[char] ?? (char === " " ? textMetrics.spaceWidthRatio : textMetrics.glyphWidthRatio), getGlyphLines = (char) => glyphLineAlphabet[char], DEFAULT_KNOCKOUT_PADDING, TEXT_OFFSET_MULTIPLIER2 = 1.5, CHARACTER_WIDTH_MULTIPLIER2 = 0.6, TEXT_INTERSECTION_PADDING_MULTIPLIER2 = 0.3, DEFAULT_NOTE_COLOR = "rgba(255,255,255,0.5)", DEFAULT_NOTE_TEXT_COLOR = "rgb(89, 148, 220)", SOLDER_PASTE_COLOR = "rgb(105, 105, 105)", CUTOUT_MASK_COLOR = "rgba(255, 255, 255, 1)", COORD_EPSILON = 0.000001, DEFAULT_PCB_COLOR_MAP2, isOnCopperLayer = (element, layer) => element.layers?.includes(layer) ?? true, CircuitToCanvasDrawer = class _CircuitToCanvasDrawer {
|
|
76883
77485
|
ctx;
|
|
76884
77486
|
colorMap;
|
|
76885
77487
|
realToCanvasMat;
|
|
@@ -77470,12 +78072,12 @@ import {
|
|
|
77470
78072
|
} from "@tscircuit/math-utils";
|
|
77471
78073
|
import { applyToPoint as applyToPoint29, identity as identity10 } from "transformation-matrix";
|
|
77472
78074
|
import { convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg22 } from "circuit-to-svg";
|
|
77473
|
-
import { deflateSync } from "node:zlib";
|
|
78075
|
+
import { deflateSync as deflateSync2 } from "node:zlib";
|
|
77474
78076
|
import {
|
|
77475
|
-
glyphAdvanceRatio as
|
|
77476
|
-
glyphWidthRatio,
|
|
77477
|
-
spaceWidthRatio,
|
|
77478
|
-
strokeWidthRatio,
|
|
78077
|
+
glyphAdvanceRatio as glyphAdvanceRatio3,
|
|
78078
|
+
glyphWidthRatio as glyphWidthRatio2,
|
|
78079
|
+
spaceWidthRatio as spaceWidthRatio2,
|
|
78080
|
+
strokeWidthRatio as strokeWidthRatio2,
|
|
77479
78081
|
svgAlphabet as svgAlphabet2
|
|
77480
78082
|
} from "@tscircuit/alphabet";
|
|
77481
78083
|
|
|
@@ -78603,11 +79205,11 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78603
79205
|
return baseSvg.replace("</svg>", `${overlays}
|
|
78604
79206
|
</svg>`);
|
|
78605
79207
|
}, crcTable2, crc32 = (bytes) => {
|
|
78606
|
-
let
|
|
79208
|
+
let crc3 = 4294967295;
|
|
78607
79209
|
for (const byte of bytes) {
|
|
78608
|
-
|
|
79210
|
+
crc3 = crcTable2[(crc3 ^ byte) & 255] ^ crc3 >>> 8;
|
|
78609
79211
|
}
|
|
78610
|
-
return (
|
|
79212
|
+
return (crc3 ^ 4294967295) >>> 0;
|
|
78611
79213
|
}, writeUInt32 = (value) => {
|
|
78612
79214
|
const bytes = new Uint8Array(4);
|
|
78613
79215
|
const view = new DataView(bytes.buffer);
|
|
@@ -78651,7 +79253,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78651
79253
|
return concatBytes([
|
|
78652
79254
|
new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]),
|
|
78653
79255
|
createChunk("IHDR", header),
|
|
78654
|
-
createChunk("IDAT",
|
|
79256
|
+
createChunk("IDAT", deflateSync2(scanlines, { level: 1 })),
|
|
78655
79257
|
createChunk("IEND", new Uint8Array)
|
|
78656
79258
|
]);
|
|
78657
79259
|
}, getLegendLabel = (entry) => {
|
|
@@ -78671,10 +79273,10 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78671
79273
|
if (path49) {
|
|
78672
79274
|
paths.push(`<path d="${path49}" transform="translate(${cursorX} 0)"/>`);
|
|
78673
79275
|
}
|
|
78674
|
-
cursorX +=
|
|
79276
|
+
cursorX += glyphAdvanceRatio3[character] ?? (character === " " ? spaceWidthRatio2 : glyphWidthRatio2);
|
|
78675
79277
|
}
|
|
78676
79278
|
const renderedSize = maxWidth === undefined || cursorX === 0 ? size : Math.min(size, maxWidth / cursorX);
|
|
78677
|
-
return `<g fill="none" stroke="#111" stroke-width="${
|
|
79279
|
+
return `<g fill="none" stroke="#111" stroke-width="${strokeWidthRatio2}" stroke-linecap="round" stroke-linejoin="round" transform="translate(${x4} ${top - 0.24 * renderedSize}) scale(${renderedSize})">${paths.join("")}</g>`;
|
|
78678
79280
|
}, createBitmapLegendSvg = ({
|
|
78679
79281
|
width,
|
|
78680
79282
|
height,
|
|
@@ -78734,11 +79336,11 @@ var init_dist3 = __esm(() => {
|
|
|
78734
79336
|
import_gerber_to_svg = __toESM2(require_gerber_to_svg(), 1);
|
|
78735
79337
|
crcTable2 = new Uint32Array(256);
|
|
78736
79338
|
for (let i3 = 0;i3 < crcTable2.length; i3++) {
|
|
78737
|
-
let
|
|
79339
|
+
let crc3 = i3;
|
|
78738
79340
|
for (let bit = 0;bit < 8; bit++) {
|
|
78739
|
-
|
|
79341
|
+
crc3 = crc3 & 1 ? 3988292384 ^ crc3 >>> 1 : crc3 >>> 1;
|
|
78740
79342
|
}
|
|
78741
|
-
crcTable2[i3] =
|
|
79343
|
+
crcTable2[i3] = crc3 >>> 0;
|
|
78742
79344
|
}
|
|
78743
79345
|
textEncoder = new TextEncoder;
|
|
78744
79346
|
markerLegend = [
|
|
@@ -121949,7 +122551,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
121949
122551
|
break;
|
|
121950
122552
|
}
|
|
121951
122553
|
offset += len;
|
|
121952
|
-
var
|
|
122554
|
+
var crc3 = bin.readUint(data, offset);
|
|
121953
122555
|
offset += 4;
|
|
121954
122556
|
}
|
|
121955
122557
|
if (foff != 0) {
|
|
@@ -122533,7 +123135,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122533
123135
|
UPNG.encode._main = function(nimg, w4, h4, dels, tabs) {
|
|
122534
123136
|
if (tabs == null)
|
|
122535
123137
|
tabs = {};
|
|
122536
|
-
var
|
|
123138
|
+
var crc3 = UPNG.crc.crc, wUi = UPNG._bin.writeUint, wUs = UPNG._bin.writeUshort, wAs = UPNG._bin.writeASCII;
|
|
122537
123139
|
var offset = 8, anim = nimg.frames.length > 1, pltAlpha = false;
|
|
122538
123140
|
var leng = 8 + (16 + 5 + 4) + (anim ? 20 : 0);
|
|
122539
123141
|
if (tabs["sRGB"] != null)
|
|
@@ -122578,7 +123180,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122578
123180
|
offset++;
|
|
122579
123181
|
data[offset] = 0;
|
|
122580
123182
|
offset++;
|
|
122581
|
-
wUi(data, offset,
|
|
123183
|
+
wUi(data, offset, crc3(data, offset - 17, 17));
|
|
122582
123184
|
offset += 4;
|
|
122583
123185
|
if (tabs["sRGB"] != null) {
|
|
122584
123186
|
wUi(data, offset, 1);
|
|
@@ -122587,7 +123189,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122587
123189
|
offset += 4;
|
|
122588
123190
|
data[offset] = tabs["sRGB"];
|
|
122589
123191
|
offset++;
|
|
122590
|
-
wUi(data, offset,
|
|
123192
|
+
wUi(data, offset, crc3(data, offset - 5, 5));
|
|
122591
123193
|
offset += 4;
|
|
122592
123194
|
}
|
|
122593
123195
|
if (tabs["pHYs"] != null) {
|
|
@@ -122601,7 +123203,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122601
123203
|
offset += 4;
|
|
122602
123204
|
data[offset] = tabs["pHYs"][2];
|
|
122603
123205
|
offset++;
|
|
122604
|
-
wUi(data, offset,
|
|
123206
|
+
wUi(data, offset, crc3(data, offset - 13, 13));
|
|
122605
123207
|
offset += 4;
|
|
122606
123208
|
}
|
|
122607
123209
|
if (anim) {
|
|
@@ -122613,7 +123215,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122613
123215
|
offset += 4;
|
|
122614
123216
|
wUi(data, offset, tabs["loop"] != null ? tabs["loop"] : 0);
|
|
122615
123217
|
offset += 4;
|
|
122616
|
-
wUi(data, offset,
|
|
123218
|
+
wUi(data, offset, crc3(data, offset - 12, 12));
|
|
122617
123219
|
offset += 4;
|
|
122618
123220
|
}
|
|
122619
123221
|
if (nimg.ctype == 3) {
|
|
@@ -122629,7 +123231,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122629
123231
|
data[offset + ti3 + 2] = b3;
|
|
122630
123232
|
}
|
|
122631
123233
|
offset += dl2 * 3;
|
|
122632
|
-
wUi(data, offset,
|
|
123234
|
+
wUi(data, offset, crc3(data, offset - dl2 * 3 - 4, dl2 * 3 + 4));
|
|
122633
123235
|
offset += 4;
|
|
122634
123236
|
if (pltAlpha) {
|
|
122635
123237
|
wUi(data, offset, dl2);
|
|
@@ -122639,7 +123241,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122639
123241
|
for (var i3 = 0;i3 < dl2; i3++)
|
|
122640
123242
|
data[offset + i3] = nimg.plte[i3] >>> 24 & 255;
|
|
122641
123243
|
offset += dl2;
|
|
122642
|
-
wUi(data, offset,
|
|
123244
|
+
wUi(data, offset, crc3(data, offset - dl2 - 4, dl2 + 4));
|
|
122643
123245
|
offset += 4;
|
|
122644
123246
|
}
|
|
122645
123247
|
}
|
|
@@ -122669,7 +123271,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122669
123271
|
offset++;
|
|
122670
123272
|
data[offset] = fr3.blend;
|
|
122671
123273
|
offset++;
|
|
122672
|
-
wUi(data, offset,
|
|
123274
|
+
wUi(data, offset, crc3(data, offset - 30, 30));
|
|
122673
123275
|
offset += 4;
|
|
122674
123276
|
}
|
|
122675
123277
|
var imgd = fr3.cimg, dl2 = imgd.length;
|
|
@@ -122684,14 +123286,14 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
122684
123286
|
}
|
|
122685
123287
|
data.set(imgd, offset);
|
|
122686
123288
|
offset += dl2;
|
|
122687
|
-
wUi(data, offset,
|
|
123289
|
+
wUi(data, offset, crc3(data, ioff, offset - ioff));
|
|
122688
123290
|
offset += 4;
|
|
122689
123291
|
}
|
|
122690
123292
|
wUi(data, offset, 0);
|
|
122691
123293
|
offset += 4;
|
|
122692
123294
|
wAs(data, offset, "IEND");
|
|
122693
123295
|
offset += 4;
|
|
122694
|
-
wUi(data, offset,
|
|
123296
|
+
wUi(data, offset, crc3(data, offset - 4, 4));
|
|
122695
123297
|
offset += 4;
|
|
122696
123298
|
return data.buffer;
|
|
122697
123299
|
};
|
|
@@ -123110,7 +123712,7 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
123110
123712
|
node.est.L = 0;
|
|
123111
123713
|
continue;
|
|
123112
123714
|
}
|
|
123113
|
-
var
|
|
123715
|
+
var ln4 = {
|
|
123114
123716
|
i0: node.i0,
|
|
123115
123717
|
i1: s02,
|
|
123116
123718
|
bst: null,
|
|
@@ -123119,8 +123721,8 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
123119
123721
|
left: null,
|
|
123120
123722
|
right: null
|
|
123121
123723
|
};
|
|
123122
|
-
|
|
123123
|
-
|
|
123724
|
+
ln4.bst = UPNG.quantize.stats(nimg, ln4.i0, ln4.i1);
|
|
123725
|
+
ln4.est = UPNG.quantize.estats(ln4.bst);
|
|
123124
123726
|
var rn3 = {
|
|
123125
123727
|
i0: s02,
|
|
123126
123728
|
i1: node.i1,
|
|
@@ -123133,16 +123735,16 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
123133
123735
|
rn3.bst = {
|
|
123134
123736
|
R: [],
|
|
123135
123737
|
m: [],
|
|
123136
|
-
N: node.bst.N -
|
|
123738
|
+
N: node.bst.N - ln4.bst.N
|
|
123137
123739
|
};
|
|
123138
123740
|
for (var i3 = 0;i3 < 16; i3++)
|
|
123139
|
-
rn3.bst.R[i3] = node.bst.R[i3] -
|
|
123741
|
+
rn3.bst.R[i3] = node.bst.R[i3] - ln4.bst.R[i3];
|
|
123140
123742
|
for (var i3 = 0;i3 < 4; i3++)
|
|
123141
|
-
rn3.bst.m[i3] = node.bst.m[i3] -
|
|
123743
|
+
rn3.bst.m[i3] = node.bst.m[i3] - ln4.bst.m[i3];
|
|
123142
123744
|
rn3.est = UPNG.quantize.estats(rn3.bst);
|
|
123143
|
-
node.left =
|
|
123745
|
+
node.left = ln4;
|
|
123144
123746
|
node.right = rn3;
|
|
123145
|
-
leafs[mi3] =
|
|
123747
|
+
leafs[mi3] = ln4;
|
|
123146
123748
|
leafs.push(rn3);
|
|
123147
123749
|
}
|
|
123148
123750
|
leafs.sort(function(a2, b3) {
|
|
@@ -123163,11 +123765,11 @@ var require_UPNG = __commonJS((exports2) => {
|
|
|
123163
123765
|
node0 = nd2.right;
|
|
123164
123766
|
node1 = nd2.left;
|
|
123165
123767
|
}
|
|
123166
|
-
var
|
|
123167
|
-
if (
|
|
123168
|
-
return
|
|
123768
|
+
var ln4 = UPNG.quantize.getNearest(node0, r4, g6, b3, a2);
|
|
123769
|
+
if (ln4.tdst <= planeDst * planeDst)
|
|
123770
|
+
return ln4;
|
|
123169
123771
|
var rn3 = UPNG.quantize.getNearest(node1, r4, g6, b3, a2);
|
|
123170
|
-
return rn3.tdst <
|
|
123772
|
+
return rn3.tdst < ln4.tdst ? rn3 : ln4;
|
|
123171
123773
|
};
|
|
123172
123774
|
UPNG.quantize.planeDst = function(est, r4, g6, b3, a2) {
|
|
123173
123775
|
var e4 = est.e;
|
|
@@ -135484,8 +136086,9 @@ var package_default = {
|
|
|
135484
136086
|
"circuit-json-to-3d-png": "^0.0.6",
|
|
135485
136087
|
"circuit-json-to-bom-csv": "^0.0.7",
|
|
135486
136088
|
"circuit-json-to-connectivity-map": "^0.0.25",
|
|
136089
|
+
"circuit-json-to-fdm-component-box": "^0.0.2",
|
|
135487
136090
|
"circuit-json-to-footprinter": "^0.0.15",
|
|
135488
|
-
"circuit-json-to-gerber": "^0.0.
|
|
136091
|
+
"circuit-json-to-gerber": "^0.0.94",
|
|
135489
136092
|
"circuit-json-to-kicad": "0.0.157",
|
|
135490
136093
|
"circuit-json-to-pnp-csv": "^0.0.9",
|
|
135491
136094
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
@@ -310491,6 +311094,3396 @@ var convertCircuitJsonToPickAndPlaceCsv = (circuitJson, opts = {}) => import_pap
|
|
|
310491
311094
|
Rotation: row.rotation
|
|
310492
311095
|
})));
|
|
310493
311096
|
|
|
311097
|
+
// node_modules/manifold-3d/manifold.js
|
|
311098
|
+
async function Module(moduleArg = {}) {
|
|
311099
|
+
var moduleRtn;
|
|
311100
|
+
var Module2 = moduleArg;
|
|
311101
|
+
var ENVIRONMENT_IS_WEB = !!globalThis.window;
|
|
311102
|
+
var ENVIRONMENT_IS_WORKER = !!globalThis.WorkerGlobalScope;
|
|
311103
|
+
var ENVIRONMENT_IS_NODE = globalThis.process?.versions?.node && globalThis.process?.type != "renderer";
|
|
311104
|
+
if (ENVIRONMENT_IS_NODE) {
|
|
311105
|
+
const { createRequire: createRequire6 } = await import("node:module");
|
|
311106
|
+
var require4 = createRequire6(import.meta.url);
|
|
311107
|
+
}
|
|
311108
|
+
var _ManifoldInitialized = false;
|
|
311109
|
+
Module2.setup = function() {
|
|
311110
|
+
if (_ManifoldInitialized)
|
|
311111
|
+
return;
|
|
311112
|
+
_ManifoldInitialized = true;
|
|
311113
|
+
Module2.initTBB();
|
|
311114
|
+
function toVec(vec, list, f2 = (x4) => x4) {
|
|
311115
|
+
if (list) {
|
|
311116
|
+
for (let x4 of list) {
|
|
311117
|
+
vec.push_back(f2(x4));
|
|
311118
|
+
}
|
|
311119
|
+
}
|
|
311120
|
+
return vec;
|
|
311121
|
+
}
|
|
311122
|
+
function fromVec(vec, f2 = (x4) => x4) {
|
|
311123
|
+
const result = [];
|
|
311124
|
+
const size = vec.size();
|
|
311125
|
+
for (let i3 = 0;i3 < size; i3++)
|
|
311126
|
+
result.push(f2(vec.get(i3)));
|
|
311127
|
+
return result;
|
|
311128
|
+
}
|
|
311129
|
+
function vec2polygons(vec, f2 = (x4) => x4) {
|
|
311130
|
+
const result = [];
|
|
311131
|
+
const nPoly = vec.size();
|
|
311132
|
+
for (let i3 = 0;i3 < nPoly; i3++) {
|
|
311133
|
+
const v4 = vec.get(i3);
|
|
311134
|
+
const nPts = v4.size();
|
|
311135
|
+
const poly = [];
|
|
311136
|
+
for (let j4 = 0;j4 < nPts; j4++) {
|
|
311137
|
+
poly.push(f2(v4.get(j4)));
|
|
311138
|
+
}
|
|
311139
|
+
result.push(poly);
|
|
311140
|
+
}
|
|
311141
|
+
return result;
|
|
311142
|
+
}
|
|
311143
|
+
function polygons2vec(polygons) {
|
|
311144
|
+
if (polygons[0].length < 3) {
|
|
311145
|
+
polygons = [polygons];
|
|
311146
|
+
}
|
|
311147
|
+
return toVec(new Module2.Vector2_vec2, polygons, (poly) => toVec(new Module2.Vector_vec2, poly, (p3) => {
|
|
311148
|
+
if (p3 instanceof Array)
|
|
311149
|
+
return { x: p3[0], y: p3[1] };
|
|
311150
|
+
return p3;
|
|
311151
|
+
}));
|
|
311152
|
+
}
|
|
311153
|
+
function disposePolygons(polygonsVec) {
|
|
311154
|
+
for (let i3 = 0;i3 < polygonsVec.size(); i3++)
|
|
311155
|
+
polygonsVec.get(i3).delete();
|
|
311156
|
+
polygonsVec.delete();
|
|
311157
|
+
}
|
|
311158
|
+
function vararg2vec2(vec) {
|
|
311159
|
+
if (vec[0] instanceof Array)
|
|
311160
|
+
return { x: vec[0][0], y: vec[0][1] };
|
|
311161
|
+
if (typeof vec[0] == "number")
|
|
311162
|
+
return { x: vec[0] || 0, y: vec[1] || 0 };
|
|
311163
|
+
return vec[0];
|
|
311164
|
+
}
|
|
311165
|
+
function vararg2vec3(vec) {
|
|
311166
|
+
if (vec[0] instanceof Array)
|
|
311167
|
+
return { x: vec[0][0], y: vec[0][1], z: vec[0][2] };
|
|
311168
|
+
if (typeof vec[0] == "number")
|
|
311169
|
+
return { x: vec[0] || 0, y: vec[1] || 0, z: vec[2] || 0 };
|
|
311170
|
+
return vec[0];
|
|
311171
|
+
}
|
|
311172
|
+
function fillRuleToInt(fillRule) {
|
|
311173
|
+
return fillRule == "EvenOdd" ? 0 : fillRule == "NonZero" ? 1 : fillRule == "Negative" ? 3 : 2;
|
|
311174
|
+
}
|
|
311175
|
+
function joinTypeToInt(joinType) {
|
|
311176
|
+
return joinType == "Round" ? 1 : joinType == "Miter" ? 2 : 0;
|
|
311177
|
+
}
|
|
311178
|
+
const CrossSectionCtor = Module2.CrossSection;
|
|
311179
|
+
function cross3(polygons, fillRule = "Positive") {
|
|
311180
|
+
if (polygons instanceof CrossSectionCtor) {
|
|
311181
|
+
return polygons;
|
|
311182
|
+
} else {
|
|
311183
|
+
const polygonsVec = polygons2vec(polygons);
|
|
311184
|
+
const cs3 = new CrossSectionCtor(polygonsVec, fillRuleToInt(fillRule));
|
|
311185
|
+
disposePolygons(polygonsVec);
|
|
311186
|
+
return cs3;
|
|
311187
|
+
}
|
|
311188
|
+
}
|
|
311189
|
+
Module2.CrossSection.prototype.translate = function(...vec) {
|
|
311190
|
+
return this._Translate(vararg2vec2(vec));
|
|
311191
|
+
};
|
|
311192
|
+
Module2.CrossSection.prototype.scale = function(vec) {
|
|
311193
|
+
if (typeof vec == "number") {
|
|
311194
|
+
return this._Scale({ x: vec, y: vec });
|
|
311195
|
+
}
|
|
311196
|
+
return this._Scale(vararg2vec2([vec]));
|
|
311197
|
+
};
|
|
311198
|
+
Module2.CrossSection.prototype.mirror = function(vec) {
|
|
311199
|
+
return this._Mirror(vararg2vec2([vec]));
|
|
311200
|
+
};
|
|
311201
|
+
Module2.CrossSection.prototype.warp = function(func) {
|
|
311202
|
+
const wasmFuncPtr = addFunction(function(vec2Ptr) {
|
|
311203
|
+
const x4 = getValue(vec2Ptr, "double");
|
|
311204
|
+
const y4 = getValue(vec2Ptr + 8, "double");
|
|
311205
|
+
const vert = [x4, y4];
|
|
311206
|
+
func(vert);
|
|
311207
|
+
setValue(vec2Ptr, vert[0], "double");
|
|
311208
|
+
setValue(vec2Ptr + 8, vert[1], "double");
|
|
311209
|
+
}, "vi");
|
|
311210
|
+
const out2 = this._Warp(wasmFuncPtr);
|
|
311211
|
+
removeFunction(wasmFuncPtr);
|
|
311212
|
+
return out2;
|
|
311213
|
+
};
|
|
311214
|
+
Module2.CrossSection.prototype.decompose = function() {
|
|
311215
|
+
const vec = this._Decompose();
|
|
311216
|
+
const result = fromVec(vec);
|
|
311217
|
+
vec.delete();
|
|
311218
|
+
return result;
|
|
311219
|
+
};
|
|
311220
|
+
Module2.CrossSection.prototype.bounds = function() {
|
|
311221
|
+
const result = this._Bounds();
|
|
311222
|
+
return { min: ["x", "y"].map((f2) => result.min[f2]), max: ["x", "y"].map((f2) => result.max[f2]) };
|
|
311223
|
+
};
|
|
311224
|
+
Module2.CrossSection.prototype.offset = function(delta, joinType = "Round", miterLimit = 2, circularSegments = 0) {
|
|
311225
|
+
return this._Offset(delta, joinTypeToInt(joinType), miterLimit, circularSegments);
|
|
311226
|
+
};
|
|
311227
|
+
Module2.CrossSection.prototype.simplify = function(epsilon = 0.000001) {
|
|
311228
|
+
return this._Simplify(epsilon);
|
|
311229
|
+
};
|
|
311230
|
+
Module2.CrossSection.prototype.extrude = function(height, nDivisions = 0, twistDegrees = 0, scaleTop = [1, 1], center2 = false) {
|
|
311231
|
+
scaleTop = vararg2vec2([scaleTop]);
|
|
311232
|
+
const man = Module2._Extrude(this._ToPolygons(), height, nDivisions, twistDegrees, scaleTop);
|
|
311233
|
+
return center2 ? man.translate([0, 0, -height / 2]) : man;
|
|
311234
|
+
};
|
|
311235
|
+
Module2.CrossSection.prototype.revolve = function(circularSegments = 0, revolveDegrees = 360) {
|
|
311236
|
+
return Module2._Revolve(this._ToPolygons(), circularSegments, revolveDegrees);
|
|
311237
|
+
};
|
|
311238
|
+
Module2.CrossSection.prototype.add = function(other) {
|
|
311239
|
+
return this._add(cross3(other));
|
|
311240
|
+
};
|
|
311241
|
+
Module2.CrossSection.prototype.subtract = function(other) {
|
|
311242
|
+
return this._subtract(cross3(other));
|
|
311243
|
+
};
|
|
311244
|
+
Module2.CrossSection.prototype.intersect = function(other) {
|
|
311245
|
+
return this._intersect(cross3(other));
|
|
311246
|
+
};
|
|
311247
|
+
Module2.CrossSection.prototype.toPolygons = function() {
|
|
311248
|
+
const vec = this._ToPolygons();
|
|
311249
|
+
const result = vec2polygons(vec, (v4) => [v4.x, v4.y]);
|
|
311250
|
+
vec.delete();
|
|
311251
|
+
return result;
|
|
311252
|
+
};
|
|
311253
|
+
Module2.Manifold.prototype.smoothOut = function(minSharpAngle = 52.5, minSmoothness = 0) {
|
|
311254
|
+
return this._SmoothOut(minSharpAngle, minSmoothness);
|
|
311255
|
+
};
|
|
311256
|
+
Module2.Manifold.prototype.warp = function(func) {
|
|
311257
|
+
const wasmFuncPtr = addFunction(function(vec3Ptr) {
|
|
311258
|
+
const x4 = getValue(vec3Ptr, "double");
|
|
311259
|
+
const y4 = getValue(vec3Ptr + 8, "double");
|
|
311260
|
+
const z56 = getValue(vec3Ptr + 16, "double");
|
|
311261
|
+
const vert = [x4, y4, z56];
|
|
311262
|
+
func(vert);
|
|
311263
|
+
setValue(vec3Ptr, vert[0], "double");
|
|
311264
|
+
setValue(vec3Ptr + 8, vert[1], "double");
|
|
311265
|
+
setValue(vec3Ptr + 16, vert[2], "double");
|
|
311266
|
+
}, "vi");
|
|
311267
|
+
const out2 = this._Warp(wasmFuncPtr);
|
|
311268
|
+
removeFunction(wasmFuncPtr);
|
|
311269
|
+
const status = out2.status();
|
|
311270
|
+
if (status !== "NoError") {
|
|
311271
|
+
throw new Module2.ManifoldError(status);
|
|
311272
|
+
}
|
|
311273
|
+
return out2;
|
|
311274
|
+
};
|
|
311275
|
+
Module2.Manifold.prototype.warpBatch = function(func) {
|
|
311276
|
+
const wasmFuncPtr = addFunction(function(ptr, count) {
|
|
311277
|
+
const heapF64 = Module2.HEAPF64 ?? HEAPF64;
|
|
311278
|
+
if (!heapF64) {
|
|
311279
|
+
throw new Error("WASM heap is not initialized (HEAPF64 unavailable)");
|
|
311280
|
+
}
|
|
311281
|
+
const verts = new Float64Array(heapF64.buffer, ptr, count * 3);
|
|
311282
|
+
func(verts, count);
|
|
311283
|
+
}, "vii");
|
|
311284
|
+
const out2 = this._WarpBatch(wasmFuncPtr);
|
|
311285
|
+
removeFunction(wasmFuncPtr);
|
|
311286
|
+
const status = out2.status();
|
|
311287
|
+
if (status !== "NoError") {
|
|
311288
|
+
throw new Module2.ManifoldError(status);
|
|
311289
|
+
}
|
|
311290
|
+
return out2;
|
|
311291
|
+
};
|
|
311292
|
+
Module2.Manifold.prototype.calculateNormals = function(normalIdx = 0, minSharpAngle = 52.5) {
|
|
311293
|
+
return this._CalculateNormals(normalIdx, minSharpAngle);
|
|
311294
|
+
};
|
|
311295
|
+
Module2.Manifold.prototype.smoothByNormals = function(normalIdx = 0) {
|
|
311296
|
+
return this._SmoothByNormals(normalIdx);
|
|
311297
|
+
};
|
|
311298
|
+
Module2.Manifold.prototype.setProperties = function(numProp, func) {
|
|
311299
|
+
const oldNumProp = this.numProp();
|
|
311300
|
+
const wasmFuncPtr = addFunction(function(newPtr, vec3Ptr, oldPtr) {
|
|
311301
|
+
const newProp = [];
|
|
311302
|
+
for (let i3 = 0;i3 < numProp; ++i3) {
|
|
311303
|
+
newProp[i3] = getValue(newPtr + 8 * i3, "double");
|
|
311304
|
+
}
|
|
311305
|
+
const pos = [];
|
|
311306
|
+
for (let i3 = 0;i3 < 3; ++i3) {
|
|
311307
|
+
pos[i3] = getValue(vec3Ptr + 8 * i3, "double");
|
|
311308
|
+
}
|
|
311309
|
+
const oldProp = [];
|
|
311310
|
+
for (let i3 = 0;i3 < oldNumProp; ++i3) {
|
|
311311
|
+
oldProp[i3] = getValue(oldPtr + 8 * i3, "double");
|
|
311312
|
+
}
|
|
311313
|
+
func(newProp, pos, oldProp);
|
|
311314
|
+
for (let i3 = 0;i3 < numProp; ++i3) {
|
|
311315
|
+
setValue(newPtr + 8 * i3, newProp[i3], "double");
|
|
311316
|
+
}
|
|
311317
|
+
}, "viii");
|
|
311318
|
+
const out2 = this._SetProperties(numProp, wasmFuncPtr);
|
|
311319
|
+
removeFunction(wasmFuncPtr);
|
|
311320
|
+
return out2;
|
|
311321
|
+
};
|
|
311322
|
+
Module2.Manifold.prototype.translate = function(...vec) {
|
|
311323
|
+
return this._Translate(vararg2vec3(vec));
|
|
311324
|
+
};
|
|
311325
|
+
Module2.Manifold.prototype.rotate = function(xOrVec, y4, z56) {
|
|
311326
|
+
if (Array.isArray(xOrVec)) {
|
|
311327
|
+
return this._Rotate(...xOrVec);
|
|
311328
|
+
} else {
|
|
311329
|
+
return this._Rotate(xOrVec, y4 || 0, z56 || 0);
|
|
311330
|
+
}
|
|
311331
|
+
};
|
|
311332
|
+
Module2.Manifold.prototype.scale = function(vec) {
|
|
311333
|
+
if (typeof vec == "number") {
|
|
311334
|
+
return this._Scale({ x: vec, y: vec, z: vec });
|
|
311335
|
+
}
|
|
311336
|
+
return this._Scale(vararg2vec3([vec]));
|
|
311337
|
+
};
|
|
311338
|
+
Module2.Manifold.prototype.mirror = function(vec) {
|
|
311339
|
+
return this._Mirror(vararg2vec3([vec]));
|
|
311340
|
+
};
|
|
311341
|
+
Module2.Manifold.prototype.trimByPlane = function(normal, offset = 0) {
|
|
311342
|
+
return this._TrimByPlane(vararg2vec3([normal]), offset);
|
|
311343
|
+
};
|
|
311344
|
+
Module2.Manifold.prototype.slice = function(height = 0) {
|
|
311345
|
+
const polygonsVec = this._Slice(height);
|
|
311346
|
+
const result = new CrossSectionCtor(polygonsVec, fillRuleToInt("Positive"));
|
|
311347
|
+
disposePolygons(polygonsVec);
|
|
311348
|
+
return result;
|
|
311349
|
+
};
|
|
311350
|
+
Module2.Manifold.prototype.project = function() {
|
|
311351
|
+
const polygonsVec = this._Project();
|
|
311352
|
+
const result = new CrossSectionCtor(polygonsVec, fillRuleToInt("Positive"));
|
|
311353
|
+
disposePolygons(polygonsVec);
|
|
311354
|
+
return result;
|
|
311355
|
+
};
|
|
311356
|
+
Module2.Manifold.prototype.rayCast = function(origin, endpoint) {
|
|
311357
|
+
const vec = this._RayCast(vararg2vec3([origin]), vararg2vec3([endpoint]));
|
|
311358
|
+
const result = fromVec(vec, (hit) => ({ faceID: hit.faceID, distance: hit.distance, position: ["x", "y", "z"].map((f2) => hit.position[f2]), normal: ["x", "y", "z"].map((f2) => hit.normal[f2]) }));
|
|
311359
|
+
vec.delete();
|
|
311360
|
+
return result;
|
|
311361
|
+
};
|
|
311362
|
+
Module2.Manifold.prototype.split = function(manifold) {
|
|
311363
|
+
const vec = this._Split(manifold);
|
|
311364
|
+
const result = fromVec(vec);
|
|
311365
|
+
vec.delete();
|
|
311366
|
+
return result;
|
|
311367
|
+
};
|
|
311368
|
+
Module2.Manifold.prototype.splitByPlane = function(normal, offset = 0) {
|
|
311369
|
+
const vec = this._SplitByPlane(vararg2vec3([normal]), offset);
|
|
311370
|
+
const result = fromVec(vec);
|
|
311371
|
+
vec.delete();
|
|
311372
|
+
return result;
|
|
311373
|
+
};
|
|
311374
|
+
Module2.Manifold.prototype.decompose = function() {
|
|
311375
|
+
const vec = this._Decompose();
|
|
311376
|
+
const result = fromVec(vec);
|
|
311377
|
+
vec.delete();
|
|
311378
|
+
return result;
|
|
311379
|
+
};
|
|
311380
|
+
Module2.Manifold.prototype.boundingBox = function() {
|
|
311381
|
+
const result = this._boundingBox();
|
|
311382
|
+
return { min: ["x", "y", "z"].map((f2) => result.min[f2]), max: ["x", "y", "z"].map((f2) => result.max[f2]) };
|
|
311383
|
+
};
|
|
311384
|
+
Module2.Manifold.prototype.simplify = function(tolerance = 0) {
|
|
311385
|
+
return this._Simplify(tolerance);
|
|
311386
|
+
};
|
|
311387
|
+
|
|
311388
|
+
class Mesh {
|
|
311389
|
+
constructor({ numProp = 3, triVerts = new Uint32Array, vertProperties = new Float32Array, mergeFromVert, mergeToVert, runIndex, runOriginalID, faceID, halfedgeTangent, runTransform, runFlags, tolerance = 0 } = {}) {
|
|
311390
|
+
this.numProp = numProp;
|
|
311391
|
+
this.triVerts = triVerts;
|
|
311392
|
+
this.vertProperties = vertProperties;
|
|
311393
|
+
this.mergeFromVert = mergeFromVert;
|
|
311394
|
+
this.mergeToVert = mergeToVert;
|
|
311395
|
+
this.runIndex = runIndex;
|
|
311396
|
+
this.runOriginalID = runOriginalID;
|
|
311397
|
+
this.faceID = faceID;
|
|
311398
|
+
this.halfedgeTangent = halfedgeTangent;
|
|
311399
|
+
this.runTransform = runTransform;
|
|
311400
|
+
this.runFlags = runFlags;
|
|
311401
|
+
this.tolerance = tolerance;
|
|
311402
|
+
}
|
|
311403
|
+
get numTri() {
|
|
311404
|
+
return this.triVerts.length / 3;
|
|
311405
|
+
}
|
|
311406
|
+
get numVert() {
|
|
311407
|
+
return this.vertProperties.length / this.numProp;
|
|
311408
|
+
}
|
|
311409
|
+
get numRun() {
|
|
311410
|
+
return this.runOriginalID.length;
|
|
311411
|
+
}
|
|
311412
|
+
merge() {
|
|
311413
|
+
const { changed, mesh } = Module2._Merge(this);
|
|
311414
|
+
Object.assign(this, { ...mesh });
|
|
311415
|
+
return changed;
|
|
311416
|
+
}
|
|
311417
|
+
verts(tri) {
|
|
311418
|
+
return this.triVerts.subarray(3 * tri, 3 * (tri + 1));
|
|
311419
|
+
}
|
|
311420
|
+
position(vert) {
|
|
311421
|
+
return this.vertProperties.subarray(this.numProp * vert, this.numProp * vert + 3);
|
|
311422
|
+
}
|
|
311423
|
+
extras(vert) {
|
|
311424
|
+
return this.vertProperties.subarray(this.numProp * vert + 3, this.numProp * (vert + 1));
|
|
311425
|
+
}
|
|
311426
|
+
tangent(halfedge) {
|
|
311427
|
+
return this.halfedgeTangent.subarray(4 * halfedge, 4 * (halfedge + 1));
|
|
311428
|
+
}
|
|
311429
|
+
transform(run3) {
|
|
311430
|
+
const mat4 = new Array(16);
|
|
311431
|
+
for (const col of [0, 1, 2, 3]) {
|
|
311432
|
+
for (const row of [0, 1, 2]) {
|
|
311433
|
+
mat4[4 * col + row] = this.runTransform[12 * run3 + 3 * col + row];
|
|
311434
|
+
}
|
|
311435
|
+
}
|
|
311436
|
+
mat4[15] = 1;
|
|
311437
|
+
return mat4;
|
|
311438
|
+
}
|
|
311439
|
+
backside(run3) {
|
|
311440
|
+
return this.runFlags != null && run3 < this.runFlags.length && (this.runFlags[run3] & 1) !== 0;
|
|
311441
|
+
}
|
|
311442
|
+
hasNormals(run3) {
|
|
311443
|
+
return this.runFlags != null && run3 < this.runFlags.length && (this.runFlags[run3] & 2) !== 0;
|
|
311444
|
+
}
|
|
311445
|
+
}
|
|
311446
|
+
Module2.Mesh = Mesh;
|
|
311447
|
+
Module2.Manifold.prototype.getMesh = function(normalIdx = -1) {
|
|
311448
|
+
return new Mesh(this._GetMeshJS(normalIdx));
|
|
311449
|
+
};
|
|
311450
|
+
Module2.ManifoldError = function ManifoldError(code, ...args) {
|
|
311451
|
+
let message = "Unknown error";
|
|
311452
|
+
switch (code) {
|
|
311453
|
+
case "NonFiniteVertex":
|
|
311454
|
+
message = "Non-finite vertex";
|
|
311455
|
+
break;
|
|
311456
|
+
case "NotManifold":
|
|
311457
|
+
message = "Not manifold";
|
|
311458
|
+
break;
|
|
311459
|
+
case "VertexOutOfBounds":
|
|
311460
|
+
message = "Vertex index out of bounds";
|
|
311461
|
+
break;
|
|
311462
|
+
case "PropertiesWrongLength":
|
|
311463
|
+
message = "Properties have wrong length";
|
|
311464
|
+
break;
|
|
311465
|
+
case "MissingPositionProperties":
|
|
311466
|
+
message = "Less than three properties";
|
|
311467
|
+
break;
|
|
311468
|
+
case "MergeVectorsDifferentLengths":
|
|
311469
|
+
message = "Merge vectors have different lengths";
|
|
311470
|
+
break;
|
|
311471
|
+
case "MergeIndexOutOfBounds":
|
|
311472
|
+
message = "Merge index out of bounds";
|
|
311473
|
+
break;
|
|
311474
|
+
case "TransformWrongLength":
|
|
311475
|
+
message = "Transform vector has wrong length";
|
|
311476
|
+
break;
|
|
311477
|
+
case "RunIndexWrongLength":
|
|
311478
|
+
message = "Run index vector has wrong length";
|
|
311479
|
+
break;
|
|
311480
|
+
case "FaceIDWrongLength":
|
|
311481
|
+
message = "Face ID vector has wrong length";
|
|
311482
|
+
break;
|
|
311483
|
+
case "InvalidConstruction":
|
|
311484
|
+
message = "Manifold constructed with invalid parameters";
|
|
311485
|
+
break;
|
|
311486
|
+
case "ResultTooLarge":
|
|
311487
|
+
message = "Result exceeds maximum size";
|
|
311488
|
+
break;
|
|
311489
|
+
case "InvalidTangents":
|
|
311490
|
+
message = "Invalid halfedge tangents";
|
|
311491
|
+
break;
|
|
311492
|
+
}
|
|
311493
|
+
const base = Error.apply(this, [message, ...args]);
|
|
311494
|
+
base.name = this.name = "ManifoldError";
|
|
311495
|
+
this.message = base.message;
|
|
311496
|
+
this.stack = base.stack;
|
|
311497
|
+
this.code = code;
|
|
311498
|
+
};
|
|
311499
|
+
Module2.ManifoldError.prototype = Object.create(Error.prototype, { constructor: { value: Module2.ManifoldError, writable: true, configurable: true } });
|
|
311500
|
+
Module2.CrossSection = function(polygons, fillRule = "Positive") {
|
|
311501
|
+
const polygonsVec = polygons2vec(polygons);
|
|
311502
|
+
const cs3 = new CrossSectionCtor(polygonsVec, fillRuleToInt(fillRule));
|
|
311503
|
+
disposePolygons(polygonsVec);
|
|
311504
|
+
return cs3;
|
|
311505
|
+
};
|
|
311506
|
+
Module2.CrossSection.ofPolygons = function(polygons, fillRule = "Positive") {
|
|
311507
|
+
return new Module2.CrossSection(polygons, fillRule);
|
|
311508
|
+
};
|
|
311509
|
+
Module2.CrossSection.square = function(...args) {
|
|
311510
|
+
let size = undefined;
|
|
311511
|
+
if (args.length == 0)
|
|
311512
|
+
size = { x: 1, y: 1 };
|
|
311513
|
+
else if (typeof args[0] == "number")
|
|
311514
|
+
size = { x: args[0], y: args[0] };
|
|
311515
|
+
else
|
|
311516
|
+
size = vararg2vec2(args);
|
|
311517
|
+
const center2 = args[1] || false;
|
|
311518
|
+
return Module2._Square(size, center2);
|
|
311519
|
+
};
|
|
311520
|
+
Module2.CrossSection.circle = function(radius, circularSegments = 0) {
|
|
311521
|
+
return Module2._Circle(radius, circularSegments);
|
|
311522
|
+
};
|
|
311523
|
+
function crossSectionBatchbool(name) {
|
|
311524
|
+
return function(...args) {
|
|
311525
|
+
if (args.length == 1)
|
|
311526
|
+
args = args[0];
|
|
311527
|
+
const v4 = new Module2.Vector_crossSection;
|
|
311528
|
+
for (const cs3 of args)
|
|
311529
|
+
v4.push_back(cross3(cs3));
|
|
311530
|
+
const result = Module2["_crossSection" + name](v4);
|
|
311531
|
+
v4.delete();
|
|
311532
|
+
return result;
|
|
311533
|
+
};
|
|
311534
|
+
}
|
|
311535
|
+
Module2.CrossSection.compose = crossSectionBatchbool("Compose");
|
|
311536
|
+
Module2.CrossSection.union = crossSectionBatchbool("UnionN");
|
|
311537
|
+
Module2.CrossSection.difference = crossSectionBatchbool("DifferenceN");
|
|
311538
|
+
Module2.CrossSection.intersection = crossSectionBatchbool("IntersectionN");
|
|
311539
|
+
function pushVec2(vec, ps3) {
|
|
311540
|
+
toVec(vec, ps3, (p3) => {
|
|
311541
|
+
if (p3 instanceof Array)
|
|
311542
|
+
return { x: p3[0], y: p3[1] };
|
|
311543
|
+
return p3;
|
|
311544
|
+
});
|
|
311545
|
+
}
|
|
311546
|
+
Module2.CrossSection.hull = function(...args) {
|
|
311547
|
+
if (args.length == 1)
|
|
311548
|
+
args = args[0];
|
|
311549
|
+
let pts = new Module2.Vector_vec2;
|
|
311550
|
+
for (const cs3 of args) {
|
|
311551
|
+
if (cs3 instanceof CrossSectionCtor) {
|
|
311552
|
+
Module2._crossSectionCollectVertices(pts, cs3);
|
|
311553
|
+
} else if (cs3 instanceof Array && cs3.length == 2 && typeof cs3[0] == "number") {
|
|
311554
|
+
pts.push_back({ x: cs3[0], y: cs3[1] });
|
|
311555
|
+
} else if (cs3.x) {
|
|
311556
|
+
pts.push_back(cs3);
|
|
311557
|
+
} else {
|
|
311558
|
+
const wrap = cs3[0].length == 2 && typeof cs3[0][0] == "number" || cs3[0].x;
|
|
311559
|
+
const polys = wrap ? [cs3] : cs3;
|
|
311560
|
+
for (const poly of polys)
|
|
311561
|
+
pushVec2(pts, poly);
|
|
311562
|
+
}
|
|
311563
|
+
}
|
|
311564
|
+
const result = Module2._crossSectionHullPoints(pts);
|
|
311565
|
+
pts.delete();
|
|
311566
|
+
return result;
|
|
311567
|
+
};
|
|
311568
|
+
Module2.CrossSection.prototype = Object.create(CrossSectionCtor.prototype);
|
|
311569
|
+
Object.defineProperty(Module2.CrossSection, Symbol.hasInstance, { get: () => (t49) => t49 instanceof CrossSectionCtor });
|
|
311570
|
+
const ManifoldCtor = Module2.Manifold;
|
|
311571
|
+
Module2.Manifold = function(mesh) {
|
|
311572
|
+
const manifold = new ManifoldCtor(mesh);
|
|
311573
|
+
const status = manifold.status();
|
|
311574
|
+
if (status !== "NoError") {
|
|
311575
|
+
throw new Module2.ManifoldError(status);
|
|
311576
|
+
}
|
|
311577
|
+
return manifold;
|
|
311578
|
+
};
|
|
311579
|
+
Module2.Manifold.ofMesh = function(mesh) {
|
|
311580
|
+
return new Module2.Manifold(mesh);
|
|
311581
|
+
};
|
|
311582
|
+
Module2.Manifold.tetrahedron = function() {
|
|
311583
|
+
return Module2._Tetrahedron();
|
|
311584
|
+
};
|
|
311585
|
+
Module2.Manifold.cube = function(...args) {
|
|
311586
|
+
let size = undefined;
|
|
311587
|
+
if (args.length == 0)
|
|
311588
|
+
size = { x: 1, y: 1, z: 1 };
|
|
311589
|
+
else if (typeof args[0] == "number")
|
|
311590
|
+
size = { x: args[0], y: args[0], z: args[0] };
|
|
311591
|
+
else
|
|
311592
|
+
size = vararg2vec3(args);
|
|
311593
|
+
const center2 = args[1] || false;
|
|
311594
|
+
return Module2._Cube(size, center2);
|
|
311595
|
+
};
|
|
311596
|
+
Module2.Manifold.cylinder = function(height, radiusLow, radiusHigh = -1, circularSegments = 0, center2 = false) {
|
|
311597
|
+
return Module2._Cylinder(height, radiusLow, radiusHigh, circularSegments, center2);
|
|
311598
|
+
};
|
|
311599
|
+
Module2.Manifold.sphere = function(radius, circularSegments = 0) {
|
|
311600
|
+
return Module2._Sphere(radius, circularSegments);
|
|
311601
|
+
};
|
|
311602
|
+
Module2.Manifold.smooth = function(mesh, sharpenedEdges = []) {
|
|
311603
|
+
const sharp = new Module2.Vector_smoothness;
|
|
311604
|
+
toVec(sharp, sharpenedEdges);
|
|
311605
|
+
const result = Module2._Smooth(mesh, sharp);
|
|
311606
|
+
sharp.delete();
|
|
311607
|
+
return result;
|
|
311608
|
+
};
|
|
311609
|
+
Module2.Manifold.extrude = function(polygons, height, nDivisions = 0, twistDegrees = 0, scaleTop = [1, 1], center2 = false) {
|
|
311610
|
+
const cs3 = polygons instanceof CrossSectionCtor ? polygons : Module2.CrossSection(polygons, "Positive");
|
|
311611
|
+
return cs3.extrude(height, nDivisions, twistDegrees, scaleTop, center2);
|
|
311612
|
+
};
|
|
311613
|
+
Module2.Manifold.revolve = function(polygons, circularSegments = 0, revolveDegrees = 360) {
|
|
311614
|
+
const cs3 = polygons instanceof CrossSectionCtor ? polygons : Module2.CrossSection(polygons, "Positive");
|
|
311615
|
+
return cs3.revolve(circularSegments, revolveDegrees);
|
|
311616
|
+
};
|
|
311617
|
+
Module2.Manifold.reserveIDs = function(n3) {
|
|
311618
|
+
return Module2._ReserveIDs(n3);
|
|
311619
|
+
};
|
|
311620
|
+
function manifoldBatchbool(name) {
|
|
311621
|
+
return function(...args) {
|
|
311622
|
+
if (args.length == 1)
|
|
311623
|
+
args = args[0];
|
|
311624
|
+
const v4 = new Module2.Vector_manifold;
|
|
311625
|
+
for (const m3 of args)
|
|
311626
|
+
v4.push_back(m3);
|
|
311627
|
+
const result = Module2["_manifold" + name + "N"](v4);
|
|
311628
|
+
v4.delete();
|
|
311629
|
+
return result;
|
|
311630
|
+
};
|
|
311631
|
+
}
|
|
311632
|
+
Module2.Manifold.union = manifoldBatchbool("Union");
|
|
311633
|
+
Module2.Manifold.compose = Module2.Manifold.union;
|
|
311634
|
+
Module2.Manifold.difference = manifoldBatchbool("Difference");
|
|
311635
|
+
Module2.Manifold.intersection = manifoldBatchbool("Intersection");
|
|
311636
|
+
Module2.Manifold.levelSet = function(sdf, bounds, edgeLength, level = 0, tolerance = -1) {
|
|
311637
|
+
const bounds2 = { min: { x: bounds.min[0], y: bounds.min[1], z: bounds.min[2] }, max: { x: bounds.max[0], y: bounds.max[1], z: bounds.max[2] } };
|
|
311638
|
+
const wasmFuncPtr = addFunction(function(vec3Ptr) {
|
|
311639
|
+
const x4 = getValue(vec3Ptr, "double");
|
|
311640
|
+
const y4 = getValue(vec3Ptr + 8, "double");
|
|
311641
|
+
const z56 = getValue(vec3Ptr + 16, "double");
|
|
311642
|
+
const vert = [x4, y4, z56];
|
|
311643
|
+
return sdf(vert);
|
|
311644
|
+
}, "di");
|
|
311645
|
+
const out2 = Module2._LevelSet(wasmFuncPtr, bounds2, edgeLength, level, tolerance);
|
|
311646
|
+
removeFunction(wasmFuncPtr);
|
|
311647
|
+
return out2;
|
|
311648
|
+
};
|
|
311649
|
+
Module2.ExecutionContext.prototype.fromMesh = function(mesh) {
|
|
311650
|
+
return this._FromMesh(mesh);
|
|
311651
|
+
};
|
|
311652
|
+
Module2.ExecutionContext.prototype.smooth = function(mesh, sharpenedEdges = []) {
|
|
311653
|
+
const sharp = new Module2.Vector_smoothness;
|
|
311654
|
+
toVec(sharp, sharpenedEdges);
|
|
311655
|
+
const result = this._Smooth(mesh, sharp);
|
|
311656
|
+
sharp.delete();
|
|
311657
|
+
return result;
|
|
311658
|
+
};
|
|
311659
|
+
Module2.ExecutionContext.prototype.levelSet = function(sdf, bounds, edgeLength, level = 0, tolerance = -1) {
|
|
311660
|
+
const bounds2 = { min: { x: bounds.min[0], y: bounds.min[1], z: bounds.min[2] }, max: { x: bounds.max[0], y: bounds.max[1], z: bounds.max[2] } };
|
|
311661
|
+
const wasmFuncPtr = addFunction(function(vec3Ptr) {
|
|
311662
|
+
const x4 = getValue(vec3Ptr, "double");
|
|
311663
|
+
const y4 = getValue(vec3Ptr + 8, "double");
|
|
311664
|
+
const z56 = getValue(vec3Ptr + 16, "double");
|
|
311665
|
+
const vert = [x4, y4, z56];
|
|
311666
|
+
return sdf(vert);
|
|
311667
|
+
}, "di");
|
|
311668
|
+
const out2 = this._LevelSet(wasmFuncPtr, bounds2, edgeLength, level, tolerance);
|
|
311669
|
+
removeFunction(wasmFuncPtr);
|
|
311670
|
+
return out2;
|
|
311671
|
+
};
|
|
311672
|
+
function pushVec3(vec, ps3) {
|
|
311673
|
+
toVec(vec, ps3, (p3) => {
|
|
311674
|
+
if (p3 instanceof Array)
|
|
311675
|
+
return { x: p3[0], y: p3[1], z: p3[2] };
|
|
311676
|
+
return p3;
|
|
311677
|
+
});
|
|
311678
|
+
}
|
|
311679
|
+
Module2.Manifold.hull = function(...args) {
|
|
311680
|
+
if (args.length == 1)
|
|
311681
|
+
args = args[0];
|
|
311682
|
+
let pts = new Module2.Vector_vec3;
|
|
311683
|
+
for (const m3 of args) {
|
|
311684
|
+
if (m3 instanceof ManifoldCtor) {
|
|
311685
|
+
Module2._manifoldCollectVertices(pts, m3);
|
|
311686
|
+
} else if (m3 instanceof Array && m3.length == 3 && typeof m3[0] == "number") {
|
|
311687
|
+
pts.push_back({ x: m3[0], y: m3[1], z: m3[2] });
|
|
311688
|
+
} else if (m3.x) {
|
|
311689
|
+
pts.push_back(m3);
|
|
311690
|
+
} else {
|
|
311691
|
+
pushVec3(pts, m3);
|
|
311692
|
+
}
|
|
311693
|
+
}
|
|
311694
|
+
const result = Module2._manifoldHullPoints(pts);
|
|
311695
|
+
pts.delete();
|
|
311696
|
+
return result;
|
|
311697
|
+
};
|
|
311698
|
+
Module2.Manifold.prototype = Object.create(ManifoldCtor.prototype);
|
|
311699
|
+
Object.defineProperty(Module2.Manifold, Symbol.hasInstance, { get: () => (t49) => t49 instanceof ManifoldCtor });
|
|
311700
|
+
Module2.triangulate = function(polygons, epsilon = -1, allowConvex = true) {
|
|
311701
|
+
const polygonsVec = polygons2vec(polygons);
|
|
311702
|
+
const result = fromVec(Module2._Triangulate(polygonsVec, epsilon, allowConvex), (x4) => [x4[0], x4[1], x4[2]]);
|
|
311703
|
+
disposePolygons(polygonsVec);
|
|
311704
|
+
return result;
|
|
311705
|
+
};
|
|
311706
|
+
};
|
|
311707
|
+
var arguments_ = [];
|
|
311708
|
+
var thisProgram = "./this.program";
|
|
311709
|
+
var quit_ = (status, toThrow) => {
|
|
311710
|
+
throw toThrow;
|
|
311711
|
+
};
|
|
311712
|
+
var _scriptName = import.meta.url;
|
|
311713
|
+
var scriptDirectory = "";
|
|
311714
|
+
function locateFile(path69) {
|
|
311715
|
+
if (Module2["locateFile"]) {
|
|
311716
|
+
return Module2["locateFile"](path69, scriptDirectory);
|
|
311717
|
+
}
|
|
311718
|
+
return scriptDirectory + path69;
|
|
311719
|
+
}
|
|
311720
|
+
var readAsync, readBinary;
|
|
311721
|
+
if (ENVIRONMENT_IS_NODE) {
|
|
311722
|
+
var fs61 = require4("node:fs");
|
|
311723
|
+
if (_scriptName.startsWith("file:")) {
|
|
311724
|
+
scriptDirectory = require4("node:path").dirname(require4("node:url").fileURLToPath(_scriptName)) + "/";
|
|
311725
|
+
}
|
|
311726
|
+
readBinary = (filename) => {
|
|
311727
|
+
filename = isFileURI(filename) ? new URL(filename) : filename;
|
|
311728
|
+
var ret = fs61.readFileSync(filename);
|
|
311729
|
+
return ret;
|
|
311730
|
+
};
|
|
311731
|
+
readAsync = async (filename, binary = true) => {
|
|
311732
|
+
filename = isFileURI(filename) ? new URL(filename) : filename;
|
|
311733
|
+
var ret = fs61.readFileSync(filename, binary ? undefined : "utf8");
|
|
311734
|
+
return ret;
|
|
311735
|
+
};
|
|
311736
|
+
if (process.argv.length > 1) {
|
|
311737
|
+
thisProgram = process.argv[1].replace(/\\/g, "/");
|
|
311738
|
+
}
|
|
311739
|
+
arguments_ = process.argv.slice(2);
|
|
311740
|
+
quit_ = (status, toThrow) => {
|
|
311741
|
+
process.exitCode = status;
|
|
311742
|
+
throw toThrow;
|
|
311743
|
+
};
|
|
311744
|
+
} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
311745
|
+
try {
|
|
311746
|
+
scriptDirectory = new URL(".", _scriptName).href;
|
|
311747
|
+
} catch {}
|
|
311748
|
+
{
|
|
311749
|
+
if (ENVIRONMENT_IS_WORKER) {
|
|
311750
|
+
readBinary = (url2) => {
|
|
311751
|
+
var xhr = new XMLHttpRequest;
|
|
311752
|
+
xhr.open("GET", url2, false);
|
|
311753
|
+
xhr.responseType = "arraybuffer";
|
|
311754
|
+
xhr.send(null);
|
|
311755
|
+
return new Uint8Array(xhr.response);
|
|
311756
|
+
};
|
|
311757
|
+
}
|
|
311758
|
+
readAsync = async (url2) => {
|
|
311759
|
+
if (isFileURI(url2)) {
|
|
311760
|
+
return new Promise((resolve11, reject) => {
|
|
311761
|
+
var xhr = new XMLHttpRequest;
|
|
311762
|
+
xhr.open("GET", url2, true);
|
|
311763
|
+
xhr.responseType = "arraybuffer";
|
|
311764
|
+
xhr.onload = () => {
|
|
311765
|
+
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
311766
|
+
resolve11(xhr.response);
|
|
311767
|
+
return;
|
|
311768
|
+
}
|
|
311769
|
+
reject(xhr.status);
|
|
311770
|
+
};
|
|
311771
|
+
xhr.onerror = reject;
|
|
311772
|
+
xhr.send(null);
|
|
311773
|
+
});
|
|
311774
|
+
}
|
|
311775
|
+
var response = await fetch(url2, { credentials: "same-origin" });
|
|
311776
|
+
if (response.ok) {
|
|
311777
|
+
return response.arrayBuffer();
|
|
311778
|
+
}
|
|
311779
|
+
throw new Error(response.status + " : " + response.url);
|
|
311780
|
+
};
|
|
311781
|
+
}
|
|
311782
|
+
}
|
|
311783
|
+
var out = console.log.bind(console);
|
|
311784
|
+
var err2 = console.error.bind(console);
|
|
311785
|
+
var wasmBinary;
|
|
311786
|
+
var ABORT = false;
|
|
311787
|
+
var isFileURI = (filename) => filename.startsWith("file://");
|
|
311788
|
+
var readyPromiseResolve, readyPromiseReject;
|
|
311789
|
+
var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
311790
|
+
var HEAP64, HEAPU64;
|
|
311791
|
+
var runtimeInitialized = false;
|
|
311792
|
+
function updateMemoryViews() {
|
|
311793
|
+
var b3 = wasmMemory.buffer;
|
|
311794
|
+
HEAP8 = new Int8Array(b3);
|
|
311795
|
+
HEAP16 = new Int16Array(b3);
|
|
311796
|
+
HEAPU8 = new Uint8Array(b3);
|
|
311797
|
+
HEAPU16 = new Uint16Array(b3);
|
|
311798
|
+
HEAP32 = new Int32Array(b3);
|
|
311799
|
+
HEAPU32 = new Uint32Array(b3);
|
|
311800
|
+
HEAPF32 = new Float32Array(b3);
|
|
311801
|
+
HEAPF64 = new Float64Array(b3);
|
|
311802
|
+
HEAP64 = new BigInt64Array(b3);
|
|
311803
|
+
HEAPU64 = new BigUint64Array(b3);
|
|
311804
|
+
}
|
|
311805
|
+
function preRun() {
|
|
311806
|
+
if (Module2["preRun"]) {
|
|
311807
|
+
if (typeof Module2["preRun"] == "function")
|
|
311808
|
+
Module2["preRun"] = [Module2["preRun"]];
|
|
311809
|
+
while (Module2["preRun"].length) {
|
|
311810
|
+
addOnPreRun(Module2["preRun"].shift());
|
|
311811
|
+
}
|
|
311812
|
+
}
|
|
311813
|
+
callRuntimeCallbacks(onPreRuns);
|
|
311814
|
+
}
|
|
311815
|
+
function initRuntime() {
|
|
311816
|
+
runtimeInitialized = true;
|
|
311817
|
+
wasmExports["J"]();
|
|
311818
|
+
}
|
|
311819
|
+
function postRun() {
|
|
311820
|
+
if (Module2["postRun"]) {
|
|
311821
|
+
if (typeof Module2["postRun"] == "function")
|
|
311822
|
+
Module2["postRun"] = [Module2["postRun"]];
|
|
311823
|
+
while (Module2["postRun"].length) {
|
|
311824
|
+
addOnPostRun(Module2["postRun"].shift());
|
|
311825
|
+
}
|
|
311826
|
+
}
|
|
311827
|
+
callRuntimeCallbacks(onPostRuns);
|
|
311828
|
+
}
|
|
311829
|
+
function abort(what) {
|
|
311830
|
+
Module2["onAbort"]?.(what);
|
|
311831
|
+
what = "Aborted(" + what + ")";
|
|
311832
|
+
err2(what);
|
|
311833
|
+
ABORT = true;
|
|
311834
|
+
what += ". Build with -sASSERTIONS for more info.";
|
|
311835
|
+
var e4 = new WebAssembly.RuntimeError(what);
|
|
311836
|
+
readyPromiseReject?.(e4);
|
|
311837
|
+
throw e4;
|
|
311838
|
+
}
|
|
311839
|
+
var wasmBinaryFile;
|
|
311840
|
+
function findWasmBinary() {
|
|
311841
|
+
if (Module2["locateFile"]) {
|
|
311842
|
+
return locateFile("manifold.wasm");
|
|
311843
|
+
}
|
|
311844
|
+
return new URL("manifold.wasm", import.meta.url).href;
|
|
311845
|
+
}
|
|
311846
|
+
function getBinarySync(file) {
|
|
311847
|
+
if (file == wasmBinaryFile && wasmBinary) {
|
|
311848
|
+
return new Uint8Array(wasmBinary);
|
|
311849
|
+
}
|
|
311850
|
+
if (readBinary) {
|
|
311851
|
+
return readBinary(file);
|
|
311852
|
+
}
|
|
311853
|
+
throw "both async and sync fetching of the wasm failed";
|
|
311854
|
+
}
|
|
311855
|
+
async function getWasmBinary(binaryFile) {
|
|
311856
|
+
if (!wasmBinary) {
|
|
311857
|
+
try {
|
|
311858
|
+
var response = await readAsync(binaryFile);
|
|
311859
|
+
return new Uint8Array(response);
|
|
311860
|
+
} catch {}
|
|
311861
|
+
}
|
|
311862
|
+
return getBinarySync(binaryFile);
|
|
311863
|
+
}
|
|
311864
|
+
async function instantiateArrayBuffer(binaryFile, imports) {
|
|
311865
|
+
try {
|
|
311866
|
+
var binary = await getWasmBinary(binaryFile);
|
|
311867
|
+
var instance = await WebAssembly.instantiate(binary, imports);
|
|
311868
|
+
return instance;
|
|
311869
|
+
} catch (reason) {
|
|
311870
|
+
err2(`failed to asynchronously prepare wasm: ${reason}`);
|
|
311871
|
+
abort(reason);
|
|
311872
|
+
}
|
|
311873
|
+
}
|
|
311874
|
+
async function instantiateAsync(binary, binaryFile, imports) {
|
|
311875
|
+
if (!binary && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) {
|
|
311876
|
+
try {
|
|
311877
|
+
var response = fetch(binaryFile, { credentials: "same-origin" });
|
|
311878
|
+
var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
|
|
311879
|
+
return instantiationResult;
|
|
311880
|
+
} catch (reason) {
|
|
311881
|
+
err2(`wasm streaming compile failed: ${reason}`);
|
|
311882
|
+
err2("falling back to ArrayBuffer instantiation");
|
|
311883
|
+
}
|
|
311884
|
+
}
|
|
311885
|
+
return instantiateArrayBuffer(binaryFile, imports);
|
|
311886
|
+
}
|
|
311887
|
+
function getWasmImports() {
|
|
311888
|
+
var imports = { a: wasmImports };
|
|
311889
|
+
return imports;
|
|
311890
|
+
}
|
|
311891
|
+
async function createWasm() {
|
|
311892
|
+
function receiveInstance(instance, module2) {
|
|
311893
|
+
wasmExports = instance.exports;
|
|
311894
|
+
wasmExports = applySignatureConversions(wasmExports);
|
|
311895
|
+
assignWasmExports(wasmExports);
|
|
311896
|
+
updateMemoryViews();
|
|
311897
|
+
return wasmExports;
|
|
311898
|
+
}
|
|
311899
|
+
function receiveInstantiationResult(result2) {
|
|
311900
|
+
return receiveInstance(result2["instance"]);
|
|
311901
|
+
}
|
|
311902
|
+
var info = getWasmImports();
|
|
311903
|
+
if (Module2["instantiateWasm"]) {
|
|
311904
|
+
return new Promise((resolve11, reject) => {
|
|
311905
|
+
Module2["instantiateWasm"](info, (inst, mod) => {
|
|
311906
|
+
resolve11(receiveInstance(inst, mod));
|
|
311907
|
+
});
|
|
311908
|
+
});
|
|
311909
|
+
}
|
|
311910
|
+
wasmBinaryFile ??= findWasmBinary();
|
|
311911
|
+
var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
|
|
311912
|
+
var exports2 = receiveInstantiationResult(result);
|
|
311913
|
+
return exports2;
|
|
311914
|
+
}
|
|
311915
|
+
|
|
311916
|
+
class ExitStatus {
|
|
311917
|
+
name = "ExitStatus";
|
|
311918
|
+
constructor(status) {
|
|
311919
|
+
this.message = `Program terminated with exit(${status})`;
|
|
311920
|
+
this.status = status;
|
|
311921
|
+
}
|
|
311922
|
+
}
|
|
311923
|
+
var callRuntimeCallbacks = (callbacks) => {
|
|
311924
|
+
while (callbacks.length > 0) {
|
|
311925
|
+
callbacks.shift()(Module2);
|
|
311926
|
+
}
|
|
311927
|
+
};
|
|
311928
|
+
var onPostRuns = [];
|
|
311929
|
+
var addOnPostRun = (cb3) => onPostRuns.push(cb3);
|
|
311930
|
+
var onPreRuns = [];
|
|
311931
|
+
var addOnPreRun = (cb3) => onPreRuns.push(cb3);
|
|
311932
|
+
function getValue(ptr, type = "i8") {
|
|
311933
|
+
if (type.endsWith("*"))
|
|
311934
|
+
type = "*";
|
|
311935
|
+
switch (type) {
|
|
311936
|
+
case "i1":
|
|
311937
|
+
return HEAP8[ptr >>> 0];
|
|
311938
|
+
case "i8":
|
|
311939
|
+
return HEAP8[ptr >>> 0];
|
|
311940
|
+
case "i16":
|
|
311941
|
+
return HEAP16[ptr >>> 1 >>> 0];
|
|
311942
|
+
case "i32":
|
|
311943
|
+
return HEAP32[ptr >>> 2 >>> 0];
|
|
311944
|
+
case "i64":
|
|
311945
|
+
return HEAP64[ptr >>> 3 >>> 0];
|
|
311946
|
+
case "float":
|
|
311947
|
+
return HEAPF32[ptr >>> 2 >>> 0];
|
|
311948
|
+
case "double":
|
|
311949
|
+
return HEAPF64[ptr >>> 3 >>> 0];
|
|
311950
|
+
case "*":
|
|
311951
|
+
return HEAPU32[ptr >>> 2 >>> 0];
|
|
311952
|
+
default:
|
|
311953
|
+
abort(`invalid type for getValue: ${type}`);
|
|
311954
|
+
}
|
|
311955
|
+
}
|
|
311956
|
+
var noExitRuntime = true;
|
|
311957
|
+
function setValue(ptr, value, type = "i8") {
|
|
311958
|
+
if (type.endsWith("*"))
|
|
311959
|
+
type = "*";
|
|
311960
|
+
switch (type) {
|
|
311961
|
+
case "i1":
|
|
311962
|
+
HEAP8[ptr >>> 0] = value;
|
|
311963
|
+
break;
|
|
311964
|
+
case "i8":
|
|
311965
|
+
HEAP8[ptr >>> 0] = value;
|
|
311966
|
+
break;
|
|
311967
|
+
case "i16":
|
|
311968
|
+
HEAP16[ptr >>> 1 >>> 0] = value;
|
|
311969
|
+
break;
|
|
311970
|
+
case "i32":
|
|
311971
|
+
HEAP32[ptr >>> 2 >>> 0] = value;
|
|
311972
|
+
break;
|
|
311973
|
+
case "i64":
|
|
311974
|
+
HEAP64[ptr >>> 3 >>> 0] = BigInt(value);
|
|
311975
|
+
break;
|
|
311976
|
+
case "float":
|
|
311977
|
+
HEAPF32[ptr >>> 2 >>> 0] = value;
|
|
311978
|
+
break;
|
|
311979
|
+
case "double":
|
|
311980
|
+
HEAPF64[ptr >>> 3 >>> 0] = value;
|
|
311981
|
+
break;
|
|
311982
|
+
case "*":
|
|
311983
|
+
HEAPU32[ptr >>> 2 >>> 0] = value;
|
|
311984
|
+
break;
|
|
311985
|
+
default:
|
|
311986
|
+
abort(`invalid type for setValue: ${type}`);
|
|
311987
|
+
}
|
|
311988
|
+
}
|
|
311989
|
+
|
|
311990
|
+
class ExceptionInfo {
|
|
311991
|
+
constructor(excPtr) {
|
|
311992
|
+
this.excPtr = excPtr;
|
|
311993
|
+
this.ptr = excPtr - 24;
|
|
311994
|
+
}
|
|
311995
|
+
set_type(type) {
|
|
311996
|
+
HEAPU32[this.ptr + 4 >>> 2 >>> 0] = type;
|
|
311997
|
+
}
|
|
311998
|
+
get_type() {
|
|
311999
|
+
return HEAPU32[this.ptr + 4 >>> 2 >>> 0];
|
|
312000
|
+
}
|
|
312001
|
+
set_destructor(destructor) {
|
|
312002
|
+
HEAPU32[this.ptr + 8 >>> 2 >>> 0] = destructor;
|
|
312003
|
+
}
|
|
312004
|
+
get_destructor() {
|
|
312005
|
+
return HEAPU32[this.ptr + 8 >>> 2 >>> 0];
|
|
312006
|
+
}
|
|
312007
|
+
set_caught(caught) {
|
|
312008
|
+
caught = caught ? 1 : 0;
|
|
312009
|
+
HEAP8[this.ptr + 12 >>> 0] = caught;
|
|
312010
|
+
}
|
|
312011
|
+
get_caught() {
|
|
312012
|
+
return HEAP8[this.ptr + 12 >>> 0] != 0;
|
|
312013
|
+
}
|
|
312014
|
+
set_rethrown(rethrown) {
|
|
312015
|
+
rethrown = rethrown ? 1 : 0;
|
|
312016
|
+
HEAP8[this.ptr + 13 >>> 0] = rethrown;
|
|
312017
|
+
}
|
|
312018
|
+
get_rethrown() {
|
|
312019
|
+
return HEAP8[this.ptr + 13 >>> 0] != 0;
|
|
312020
|
+
}
|
|
312021
|
+
init(type, destructor) {
|
|
312022
|
+
this.set_adjusted_ptr(0);
|
|
312023
|
+
this.set_type(type);
|
|
312024
|
+
this.set_destructor(destructor);
|
|
312025
|
+
}
|
|
312026
|
+
set_adjusted_ptr(adjustedPtr) {
|
|
312027
|
+
HEAPU32[this.ptr + 16 >>> 2 >>> 0] = adjustedPtr;
|
|
312028
|
+
}
|
|
312029
|
+
get_adjusted_ptr() {
|
|
312030
|
+
return HEAPU32[this.ptr + 16 >>> 2 >>> 0];
|
|
312031
|
+
}
|
|
312032
|
+
}
|
|
312033
|
+
var exceptionLast = 0;
|
|
312034
|
+
var uncaughtExceptionCount = 0;
|
|
312035
|
+
function ___cxa_throw(ptr, type, destructor) {
|
|
312036
|
+
ptr >>>= 0;
|
|
312037
|
+
type >>>= 0;
|
|
312038
|
+
destructor >>>= 0;
|
|
312039
|
+
var info = new ExceptionInfo(ptr);
|
|
312040
|
+
info.init(type, destructor);
|
|
312041
|
+
exceptionLast = ptr;
|
|
312042
|
+
uncaughtExceptionCount++;
|
|
312043
|
+
throw exceptionLast;
|
|
312044
|
+
}
|
|
312045
|
+
var __abort_js = () => abort("");
|
|
312046
|
+
var structRegistrations = {};
|
|
312047
|
+
var runDestructors = (destructors) => {
|
|
312048
|
+
while (destructors.length) {
|
|
312049
|
+
var ptr = destructors.pop();
|
|
312050
|
+
var del = destructors.pop();
|
|
312051
|
+
del(ptr);
|
|
312052
|
+
}
|
|
312053
|
+
};
|
|
312054
|
+
function readPointer(pointer) {
|
|
312055
|
+
return this.fromWireType(HEAPU32[pointer >>> 2 >>> 0]);
|
|
312056
|
+
}
|
|
312057
|
+
var awaitingDependencies = {};
|
|
312058
|
+
var registeredTypes = {};
|
|
312059
|
+
var typeDependencies = {};
|
|
312060
|
+
var InternalError = class InternalError2 extends Error {
|
|
312061
|
+
constructor(message) {
|
|
312062
|
+
super(message);
|
|
312063
|
+
this.name = "InternalError";
|
|
312064
|
+
}
|
|
312065
|
+
};
|
|
312066
|
+
var throwInternalError = (message) => {
|
|
312067
|
+
throw new InternalError(message);
|
|
312068
|
+
};
|
|
312069
|
+
var whenDependentTypesAreResolved = (myTypes, dependentTypes, getTypeConverters) => {
|
|
312070
|
+
myTypes.forEach((type) => typeDependencies[type] = dependentTypes);
|
|
312071
|
+
function onComplete(typeConverters2) {
|
|
312072
|
+
var myTypeConverters = getTypeConverters(typeConverters2);
|
|
312073
|
+
if (myTypeConverters.length !== myTypes.length) {
|
|
312074
|
+
throwInternalError("Mismatched type converter count");
|
|
312075
|
+
}
|
|
312076
|
+
for (var i3 = 0;i3 < myTypes.length; ++i3) {
|
|
312077
|
+
registerType(myTypes[i3], myTypeConverters[i3]);
|
|
312078
|
+
}
|
|
312079
|
+
}
|
|
312080
|
+
var typeConverters = new Array(dependentTypes.length);
|
|
312081
|
+
var unregisteredTypes = [];
|
|
312082
|
+
var registered2 = 0;
|
|
312083
|
+
for (let [i3, dt3] of dependentTypes.entries()) {
|
|
312084
|
+
if (registeredTypes.hasOwnProperty(dt3)) {
|
|
312085
|
+
typeConverters[i3] = registeredTypes[dt3];
|
|
312086
|
+
} else {
|
|
312087
|
+
unregisteredTypes.push(dt3);
|
|
312088
|
+
if (!awaitingDependencies.hasOwnProperty(dt3)) {
|
|
312089
|
+
awaitingDependencies[dt3] = [];
|
|
312090
|
+
}
|
|
312091
|
+
awaitingDependencies[dt3].push(() => {
|
|
312092
|
+
typeConverters[i3] = registeredTypes[dt3];
|
|
312093
|
+
++registered2;
|
|
312094
|
+
if (registered2 === unregisteredTypes.length) {
|
|
312095
|
+
onComplete(typeConverters);
|
|
312096
|
+
}
|
|
312097
|
+
});
|
|
312098
|
+
}
|
|
312099
|
+
}
|
|
312100
|
+
if (unregisteredTypes.length === 0) {
|
|
312101
|
+
onComplete(typeConverters);
|
|
312102
|
+
}
|
|
312103
|
+
};
|
|
312104
|
+
var __embind_finalize_value_object = function(structType) {
|
|
312105
|
+
structType >>>= 0;
|
|
312106
|
+
var reg = structRegistrations[structType];
|
|
312107
|
+
delete structRegistrations[structType];
|
|
312108
|
+
var rawConstructor = reg.rawConstructor;
|
|
312109
|
+
var rawDestructor = reg.rawDestructor;
|
|
312110
|
+
var fieldRecords = reg.fields;
|
|
312111
|
+
var fieldTypes = fieldRecords.map((field) => field.getterReturnType).concat(fieldRecords.map((field) => field.setterArgumentType));
|
|
312112
|
+
whenDependentTypesAreResolved([structType], fieldTypes, (fieldTypes2) => {
|
|
312113
|
+
var fields = {};
|
|
312114
|
+
for (var [i3, field] of fieldRecords.entries()) {
|
|
312115
|
+
const getterReturnType = fieldTypes2[i3];
|
|
312116
|
+
const getter = field.getter;
|
|
312117
|
+
const getterContext = field.getterContext;
|
|
312118
|
+
const setterArgumentType = fieldTypes2[i3 + fieldRecords.length];
|
|
312119
|
+
const setter = field.setter;
|
|
312120
|
+
const setterContext = field.setterContext;
|
|
312121
|
+
fields[field.fieldName] = { read: (ptr) => getterReturnType.fromWireType(getter(getterContext, ptr)), write: (ptr, o3) => {
|
|
312122
|
+
var destructors = [];
|
|
312123
|
+
setter(setterContext, ptr, setterArgumentType.toWireType(destructors, o3));
|
|
312124
|
+
runDestructors(destructors);
|
|
312125
|
+
}, optional: getterReturnType.optional };
|
|
312126
|
+
}
|
|
312127
|
+
return [{ name: reg.name, fromWireType: (ptr) => {
|
|
312128
|
+
var rv2 = {};
|
|
312129
|
+
for (var i4 in fields) {
|
|
312130
|
+
rv2[i4] = fields[i4].read(ptr);
|
|
312131
|
+
}
|
|
312132
|
+
rawDestructor(ptr);
|
|
312133
|
+
return rv2;
|
|
312134
|
+
}, toWireType: (destructors, o3) => {
|
|
312135
|
+
for (var fieldName in fields) {
|
|
312136
|
+
if (!(fieldName in o3) && !fields[fieldName].optional) {
|
|
312137
|
+
throw new TypeError(`Missing field: "${fieldName}"`);
|
|
312138
|
+
}
|
|
312139
|
+
}
|
|
312140
|
+
var ptr = rawConstructor();
|
|
312141
|
+
for (fieldName in fields) {
|
|
312142
|
+
fields[fieldName].write(ptr, o3[fieldName]);
|
|
312143
|
+
}
|
|
312144
|
+
if (destructors !== null) {
|
|
312145
|
+
destructors.push(rawDestructor, ptr);
|
|
312146
|
+
}
|
|
312147
|
+
return ptr;
|
|
312148
|
+
}, readValueFromPointer: readPointer, destructorFunction: rawDestructor }];
|
|
312149
|
+
});
|
|
312150
|
+
};
|
|
312151
|
+
var AsciiToString = (ptr) => {
|
|
312152
|
+
ptr >>>= 0;
|
|
312153
|
+
var str = "";
|
|
312154
|
+
while (true) {
|
|
312155
|
+
var ch3 = HEAPU8[ptr++ >>> 0];
|
|
312156
|
+
if (!ch3)
|
|
312157
|
+
return str;
|
|
312158
|
+
str += String.fromCharCode(ch3);
|
|
312159
|
+
}
|
|
312160
|
+
};
|
|
312161
|
+
var BindingError = class BindingError2 extends Error {
|
|
312162
|
+
constructor(message) {
|
|
312163
|
+
super(message);
|
|
312164
|
+
this.name = "BindingError";
|
|
312165
|
+
}
|
|
312166
|
+
};
|
|
312167
|
+
var throwBindingError = (message) => {
|
|
312168
|
+
throw new BindingError(message);
|
|
312169
|
+
};
|
|
312170
|
+
function sharedRegisterType(rawType, registeredInstance, options = {}) {
|
|
312171
|
+
var name = registeredInstance.name;
|
|
312172
|
+
if (!rawType) {
|
|
312173
|
+
throwBindingError(`type "${name}" must have a positive integer typeid pointer`);
|
|
312174
|
+
}
|
|
312175
|
+
if (registeredTypes.hasOwnProperty(rawType)) {
|
|
312176
|
+
if (options.ignoreDuplicateRegistrations) {
|
|
312177
|
+
return;
|
|
312178
|
+
} else {
|
|
312179
|
+
throwBindingError(`Cannot register type '${name}' twice`);
|
|
312180
|
+
}
|
|
312181
|
+
}
|
|
312182
|
+
registeredTypes[rawType] = registeredInstance;
|
|
312183
|
+
delete typeDependencies[rawType];
|
|
312184
|
+
if (awaitingDependencies.hasOwnProperty(rawType)) {
|
|
312185
|
+
var callbacks = awaitingDependencies[rawType];
|
|
312186
|
+
delete awaitingDependencies[rawType];
|
|
312187
|
+
callbacks.forEach((cb3) => cb3());
|
|
312188
|
+
}
|
|
312189
|
+
}
|
|
312190
|
+
function registerType(rawType, registeredInstance, options = {}) {
|
|
312191
|
+
return sharedRegisterType(rawType, registeredInstance, options);
|
|
312192
|
+
}
|
|
312193
|
+
var integerReadValueFromPointer = (name, width, signed) => {
|
|
312194
|
+
switch (width) {
|
|
312195
|
+
case 1:
|
|
312196
|
+
return signed ? (pointer) => HEAP8[pointer >>> 0] : (pointer) => HEAPU8[pointer >>> 0];
|
|
312197
|
+
case 2:
|
|
312198
|
+
return signed ? (pointer) => HEAP16[pointer >>> 1 >>> 0] : (pointer) => HEAPU16[pointer >>> 1 >>> 0];
|
|
312199
|
+
case 4:
|
|
312200
|
+
return signed ? (pointer) => HEAP32[pointer >>> 2 >>> 0] : (pointer) => HEAPU32[pointer >>> 2 >>> 0];
|
|
312201
|
+
case 8:
|
|
312202
|
+
return signed ? (pointer) => HEAP64[pointer >>> 3 >>> 0] : (pointer) => HEAPU64[pointer >>> 3 >>> 0];
|
|
312203
|
+
default:
|
|
312204
|
+
throw new TypeError(`invalid integer width (${width}): ${name}`);
|
|
312205
|
+
}
|
|
312206
|
+
};
|
|
312207
|
+
var __embind_register_bigint = function(primitiveType, name, size, minRange, maxRange) {
|
|
312208
|
+
primitiveType >>>= 0;
|
|
312209
|
+
name >>>= 0;
|
|
312210
|
+
size >>>= 0;
|
|
312211
|
+
name = AsciiToString(name);
|
|
312212
|
+
const isUnsignedType = minRange === 0n;
|
|
312213
|
+
let fromWireType = (value) => value;
|
|
312214
|
+
if (isUnsignedType) {
|
|
312215
|
+
const bitSize = size * 8;
|
|
312216
|
+
fromWireType = (value) => BigInt.asUintN(bitSize, value);
|
|
312217
|
+
maxRange = fromWireType(maxRange);
|
|
312218
|
+
}
|
|
312219
|
+
registerType(primitiveType, { name, fromWireType, toWireType: (destructors, value) => {
|
|
312220
|
+
if (typeof value == "number") {
|
|
312221
|
+
value = BigInt(value);
|
|
312222
|
+
}
|
|
312223
|
+
return value;
|
|
312224
|
+
}, readValueFromPointer: integerReadValueFromPointer(name, size, !isUnsignedType), destructorFunction: null });
|
|
312225
|
+
};
|
|
312226
|
+
function __embind_register_bool(rawType, name, trueValue, falseValue) {
|
|
312227
|
+
rawType >>>= 0;
|
|
312228
|
+
name >>>= 0;
|
|
312229
|
+
name = AsciiToString(name);
|
|
312230
|
+
registerType(rawType, { name, fromWireType: function(wt3) {
|
|
312231
|
+
return !!wt3;
|
|
312232
|
+
}, toWireType: function(destructors, o3) {
|
|
312233
|
+
return o3 ? trueValue : falseValue;
|
|
312234
|
+
}, readValueFromPointer: function(pointer) {
|
|
312235
|
+
return this.fromWireType(HEAPU8[pointer >>> 0]);
|
|
312236
|
+
}, destructorFunction: null });
|
|
312237
|
+
}
|
|
312238
|
+
var shallowCopyInternalPointer = (o3) => ({ count: o3.count, deleteScheduled: o3.deleteScheduled, preservePointerOnDelete: o3.preservePointerOnDelete, ptr: o3.ptr, ptrType: o3.ptrType, smartPtr: o3.smartPtr, smartPtrType: o3.smartPtrType });
|
|
312239
|
+
var throwInstanceAlreadyDeleted = (obj) => {
|
|
312240
|
+
function getInstanceTypeName(handle) {
|
|
312241
|
+
return handle.$$.ptrType.registeredClass.name;
|
|
312242
|
+
}
|
|
312243
|
+
throwBindingError(getInstanceTypeName(obj) + " instance already deleted");
|
|
312244
|
+
};
|
|
312245
|
+
var finalizationRegistry = false;
|
|
312246
|
+
var detachFinalizer = (handle) => {};
|
|
312247
|
+
var runDestructor = ($$) => {
|
|
312248
|
+
if ($$.smartPtr) {
|
|
312249
|
+
$$.smartPtrType.rawDestructor($$.smartPtr);
|
|
312250
|
+
} else {
|
|
312251
|
+
$$.ptrType.registeredClass.rawDestructor($$.ptr);
|
|
312252
|
+
}
|
|
312253
|
+
};
|
|
312254
|
+
var releaseClassHandle = ($$) => {
|
|
312255
|
+
$$.count.value -= 1;
|
|
312256
|
+
var toDelete = $$.count.value === 0;
|
|
312257
|
+
if (toDelete) {
|
|
312258
|
+
runDestructor($$);
|
|
312259
|
+
}
|
|
312260
|
+
};
|
|
312261
|
+
var attachFinalizer = (handle) => {
|
|
312262
|
+
if (!globalThis.FinalizationRegistry) {
|
|
312263
|
+
attachFinalizer = (handle2) => handle2;
|
|
312264
|
+
return handle;
|
|
312265
|
+
}
|
|
312266
|
+
finalizationRegistry = new FinalizationRegistry((info) => {
|
|
312267
|
+
releaseClassHandle(info.$$);
|
|
312268
|
+
});
|
|
312269
|
+
attachFinalizer = (handle2) => {
|
|
312270
|
+
var $$ = handle2.$$;
|
|
312271
|
+
var hasSmartPtr = !!$$.smartPtr;
|
|
312272
|
+
if (hasSmartPtr) {
|
|
312273
|
+
var info = { $$ };
|
|
312274
|
+
finalizationRegistry.register(handle2, info, handle2);
|
|
312275
|
+
}
|
|
312276
|
+
return handle2;
|
|
312277
|
+
};
|
|
312278
|
+
detachFinalizer = (handle2) => finalizationRegistry.unregister(handle2);
|
|
312279
|
+
return attachFinalizer(handle);
|
|
312280
|
+
};
|
|
312281
|
+
var deletionQueue = [];
|
|
312282
|
+
var flushPendingDeletes = () => {
|
|
312283
|
+
while (deletionQueue.length) {
|
|
312284
|
+
var obj = deletionQueue.pop();
|
|
312285
|
+
obj.$$.deleteScheduled = false;
|
|
312286
|
+
obj["delete"]();
|
|
312287
|
+
}
|
|
312288
|
+
};
|
|
312289
|
+
var delayFunction;
|
|
312290
|
+
var init_ClassHandle = () => {
|
|
312291
|
+
let proto = ClassHandle.prototype;
|
|
312292
|
+
Object.assign(proto, { isAliasOf(other) {
|
|
312293
|
+
if (!(this instanceof ClassHandle)) {
|
|
312294
|
+
return false;
|
|
312295
|
+
}
|
|
312296
|
+
if (!(other instanceof ClassHandle)) {
|
|
312297
|
+
return false;
|
|
312298
|
+
}
|
|
312299
|
+
var leftClass = this.$$.ptrType.registeredClass;
|
|
312300
|
+
var left = this.$$.ptr;
|
|
312301
|
+
other.$$ = other.$$;
|
|
312302
|
+
var rightClass = other.$$.ptrType.registeredClass;
|
|
312303
|
+
var right = other.$$.ptr;
|
|
312304
|
+
while (leftClass.baseClass) {
|
|
312305
|
+
left = leftClass.upcast(left);
|
|
312306
|
+
leftClass = leftClass.baseClass;
|
|
312307
|
+
}
|
|
312308
|
+
while (rightClass.baseClass) {
|
|
312309
|
+
right = rightClass.upcast(right);
|
|
312310
|
+
rightClass = rightClass.baseClass;
|
|
312311
|
+
}
|
|
312312
|
+
return leftClass === rightClass && left === right;
|
|
312313
|
+
}, clone() {
|
|
312314
|
+
if (!this.$$.ptr) {
|
|
312315
|
+
throwInstanceAlreadyDeleted(this);
|
|
312316
|
+
}
|
|
312317
|
+
if (this.$$.preservePointerOnDelete) {
|
|
312318
|
+
this.$$.count.value += 1;
|
|
312319
|
+
return this;
|
|
312320
|
+
} else {
|
|
312321
|
+
var clone = attachFinalizer(Object.create(Object.getPrototypeOf(this), { $$: { value: shallowCopyInternalPointer(this.$$) } }));
|
|
312322
|
+
clone.$$.count.value += 1;
|
|
312323
|
+
clone.$$.deleteScheduled = false;
|
|
312324
|
+
return clone;
|
|
312325
|
+
}
|
|
312326
|
+
}, delete() {
|
|
312327
|
+
if (!this.$$.ptr) {
|
|
312328
|
+
throwInstanceAlreadyDeleted(this);
|
|
312329
|
+
}
|
|
312330
|
+
if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {
|
|
312331
|
+
throwBindingError("Object already scheduled for deletion");
|
|
312332
|
+
}
|
|
312333
|
+
detachFinalizer(this);
|
|
312334
|
+
releaseClassHandle(this.$$);
|
|
312335
|
+
if (!this.$$.preservePointerOnDelete) {
|
|
312336
|
+
this.$$.smartPtr = undefined;
|
|
312337
|
+
this.$$.ptr = undefined;
|
|
312338
|
+
}
|
|
312339
|
+
}, isDeleted() {
|
|
312340
|
+
return !this.$$.ptr;
|
|
312341
|
+
}, deleteLater() {
|
|
312342
|
+
if (!this.$$.ptr) {
|
|
312343
|
+
throwInstanceAlreadyDeleted(this);
|
|
312344
|
+
}
|
|
312345
|
+
if (this.$$.deleteScheduled && !this.$$.preservePointerOnDelete) {
|
|
312346
|
+
throwBindingError("Object already scheduled for deletion");
|
|
312347
|
+
}
|
|
312348
|
+
deletionQueue.push(this);
|
|
312349
|
+
if (deletionQueue.length === 1 && delayFunction) {
|
|
312350
|
+
delayFunction(flushPendingDeletes);
|
|
312351
|
+
}
|
|
312352
|
+
this.$$.deleteScheduled = true;
|
|
312353
|
+
return this;
|
|
312354
|
+
} });
|
|
312355
|
+
const symbolDispose = Symbol.dispose;
|
|
312356
|
+
if (symbolDispose) {
|
|
312357
|
+
proto[symbolDispose] = proto["delete"];
|
|
312358
|
+
}
|
|
312359
|
+
};
|
|
312360
|
+
function ClassHandle() {}
|
|
312361
|
+
var createNamedFunction = (name, func) => Object.defineProperty(func, "name", { value: name });
|
|
312362
|
+
var registeredPointers = {};
|
|
312363
|
+
var ensureOverloadTable = (proto, methodName, humanName) => {
|
|
312364
|
+
if (proto[methodName].overloadTable === undefined) {
|
|
312365
|
+
var prevFunc = proto[methodName];
|
|
312366
|
+
proto[methodName] = function(...args) {
|
|
312367
|
+
if (!proto[methodName].overloadTable.hasOwnProperty(args.length)) {
|
|
312368
|
+
throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`);
|
|
312369
|
+
}
|
|
312370
|
+
return proto[methodName].overloadTable[args.length].apply(this, args);
|
|
312371
|
+
};
|
|
312372
|
+
proto[methodName].overloadTable = [];
|
|
312373
|
+
proto[methodName].overloadTable[prevFunc.argCount] = prevFunc;
|
|
312374
|
+
}
|
|
312375
|
+
};
|
|
312376
|
+
var exposePublicSymbol = (name, value, numArguments) => {
|
|
312377
|
+
if (Module2.hasOwnProperty(name)) {
|
|
312378
|
+
if (numArguments === undefined || Module2[name].overloadTable !== undefined && Module2[name].overloadTable[numArguments] !== undefined) {
|
|
312379
|
+
throwBindingError(`Cannot register public name '${name}' twice`);
|
|
312380
|
+
}
|
|
312381
|
+
ensureOverloadTable(Module2, name, name);
|
|
312382
|
+
if (Module2[name].overloadTable.hasOwnProperty(numArguments)) {
|
|
312383
|
+
throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`);
|
|
312384
|
+
}
|
|
312385
|
+
Module2[name].overloadTable[numArguments] = value;
|
|
312386
|
+
} else {
|
|
312387
|
+
Module2[name] = value;
|
|
312388
|
+
Module2[name].argCount = numArguments;
|
|
312389
|
+
}
|
|
312390
|
+
};
|
|
312391
|
+
var char_0 = 48;
|
|
312392
|
+
var char_9 = 57;
|
|
312393
|
+
var makeLegalFunctionName = (name) => {
|
|
312394
|
+
name = name.replace(/[^a-zA-Z0-9_]/g, "$");
|
|
312395
|
+
var f2 = name.charCodeAt(0);
|
|
312396
|
+
if (f2 >= char_0 && f2 <= char_9) {
|
|
312397
|
+
return `_${name}`;
|
|
312398
|
+
}
|
|
312399
|
+
return name;
|
|
312400
|
+
};
|
|
312401
|
+
function RegisteredClass(name, constructor, instancePrototype, rawDestructor, baseClass, getActualType, upcast, downcast) {
|
|
312402
|
+
this.name = name;
|
|
312403
|
+
this.constructor = constructor;
|
|
312404
|
+
this.instancePrototype = instancePrototype;
|
|
312405
|
+
this.rawDestructor = rawDestructor;
|
|
312406
|
+
this.baseClass = baseClass;
|
|
312407
|
+
this.getActualType = getActualType;
|
|
312408
|
+
this.upcast = upcast;
|
|
312409
|
+
this.downcast = downcast;
|
|
312410
|
+
this.pureVirtualFunctions = [];
|
|
312411
|
+
}
|
|
312412
|
+
var upcastPointer = (ptr, ptrClass, desiredClass) => {
|
|
312413
|
+
while (ptrClass !== desiredClass) {
|
|
312414
|
+
if (!ptrClass.upcast) {
|
|
312415
|
+
throwBindingError(`Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`);
|
|
312416
|
+
}
|
|
312417
|
+
ptr = ptrClass.upcast(ptr);
|
|
312418
|
+
ptrClass = ptrClass.baseClass;
|
|
312419
|
+
}
|
|
312420
|
+
return ptr;
|
|
312421
|
+
};
|
|
312422
|
+
var embindRepr = (v4) => {
|
|
312423
|
+
if (v4 === null) {
|
|
312424
|
+
return "null";
|
|
312425
|
+
}
|
|
312426
|
+
var t49 = typeof v4;
|
|
312427
|
+
if (t49 === "object" || t49 === "array" || t49 === "function") {
|
|
312428
|
+
return v4.toString();
|
|
312429
|
+
} else {
|
|
312430
|
+
return "" + v4;
|
|
312431
|
+
}
|
|
312432
|
+
};
|
|
312433
|
+
function constNoSmartPtrRawPointerToWireType(destructors, handle) {
|
|
312434
|
+
if (handle === null) {
|
|
312435
|
+
if (this.isReference) {
|
|
312436
|
+
throwBindingError(`null is not a valid ${this.name}`);
|
|
312437
|
+
}
|
|
312438
|
+
return 0;
|
|
312439
|
+
}
|
|
312440
|
+
if (!handle.$$) {
|
|
312441
|
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
312442
|
+
}
|
|
312443
|
+
if (!handle.$$.ptr) {
|
|
312444
|
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
312445
|
+
}
|
|
312446
|
+
var handleClass = handle.$$.ptrType.registeredClass;
|
|
312447
|
+
var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
312448
|
+
return ptr;
|
|
312449
|
+
}
|
|
312450
|
+
function genericPointerToWireType(destructors, handle) {
|
|
312451
|
+
var ptr;
|
|
312452
|
+
if (handle === null) {
|
|
312453
|
+
if (this.isReference) {
|
|
312454
|
+
throwBindingError(`null is not a valid ${this.name}`);
|
|
312455
|
+
}
|
|
312456
|
+
if (this.isSmartPointer) {
|
|
312457
|
+
ptr = this.rawConstructor();
|
|
312458
|
+
if (destructors !== null) {
|
|
312459
|
+
destructors.push(this.rawDestructor, ptr);
|
|
312460
|
+
}
|
|
312461
|
+
return ptr;
|
|
312462
|
+
} else {
|
|
312463
|
+
return 0;
|
|
312464
|
+
}
|
|
312465
|
+
}
|
|
312466
|
+
if (!handle || !handle.$$) {
|
|
312467
|
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
312468
|
+
}
|
|
312469
|
+
if (!handle.$$.ptr) {
|
|
312470
|
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
312471
|
+
}
|
|
312472
|
+
if (!this.isConst && handle.$$.ptrType.isConst) {
|
|
312473
|
+
throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`);
|
|
312474
|
+
}
|
|
312475
|
+
var handleClass = handle.$$.ptrType.registeredClass;
|
|
312476
|
+
ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
312477
|
+
if (this.isSmartPointer) {
|
|
312478
|
+
if (handle.$$.smartPtr === undefined) {
|
|
312479
|
+
throwBindingError("Passing raw pointer to smart pointer is illegal");
|
|
312480
|
+
}
|
|
312481
|
+
switch (this.sharingPolicy) {
|
|
312482
|
+
case 0:
|
|
312483
|
+
if (handle.$$.smartPtrType === this) {
|
|
312484
|
+
ptr = handle.$$.smartPtr;
|
|
312485
|
+
} else {
|
|
312486
|
+
throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name} to parameter type ${this.name}`);
|
|
312487
|
+
}
|
|
312488
|
+
break;
|
|
312489
|
+
case 1:
|
|
312490
|
+
ptr = handle.$$.smartPtr;
|
|
312491
|
+
break;
|
|
312492
|
+
case 2:
|
|
312493
|
+
if (handle.$$.smartPtrType === this) {
|
|
312494
|
+
ptr = handle.$$.smartPtr;
|
|
312495
|
+
} else {
|
|
312496
|
+
var clonedHandle = handle["clone"]();
|
|
312497
|
+
ptr = this.rawShare(ptr, Emval.toHandle(() => clonedHandle["delete"]()));
|
|
312498
|
+
if (destructors !== null) {
|
|
312499
|
+
destructors.push(this.rawDestructor, ptr);
|
|
312500
|
+
}
|
|
312501
|
+
}
|
|
312502
|
+
break;
|
|
312503
|
+
default:
|
|
312504
|
+
throwBindingError("Unsupported sharing policy");
|
|
312505
|
+
}
|
|
312506
|
+
}
|
|
312507
|
+
return ptr;
|
|
312508
|
+
}
|
|
312509
|
+
function nonConstNoSmartPtrRawPointerToWireType(destructors, handle) {
|
|
312510
|
+
if (handle === null) {
|
|
312511
|
+
if (this.isReference) {
|
|
312512
|
+
throwBindingError(`null is not a valid ${this.name}`);
|
|
312513
|
+
}
|
|
312514
|
+
return 0;
|
|
312515
|
+
}
|
|
312516
|
+
if (!handle.$$) {
|
|
312517
|
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
|
|
312518
|
+
}
|
|
312519
|
+
if (!handle.$$.ptr) {
|
|
312520
|
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
312521
|
+
}
|
|
312522
|
+
if (handle.$$.ptrType.isConst) {
|
|
312523
|
+
throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`);
|
|
312524
|
+
}
|
|
312525
|
+
var handleClass = handle.$$.ptrType.registeredClass;
|
|
312526
|
+
var ptr = upcastPointer(handle.$$.ptr, handleClass, this.registeredClass);
|
|
312527
|
+
return ptr;
|
|
312528
|
+
}
|
|
312529
|
+
var downcastPointer = (ptr, ptrClass, desiredClass) => {
|
|
312530
|
+
if (ptrClass === desiredClass) {
|
|
312531
|
+
return ptr;
|
|
312532
|
+
}
|
|
312533
|
+
if (desiredClass.baseClass === undefined) {
|
|
312534
|
+
return null;
|
|
312535
|
+
}
|
|
312536
|
+
var rv2 = downcastPointer(ptr, ptrClass, desiredClass.baseClass);
|
|
312537
|
+
if (rv2 === null) {
|
|
312538
|
+
return null;
|
|
312539
|
+
}
|
|
312540
|
+
return desiredClass.downcast(rv2);
|
|
312541
|
+
};
|
|
312542
|
+
var registeredInstances = {};
|
|
312543
|
+
var getBasestPointer = (class_, ptr) => {
|
|
312544
|
+
if (ptr === undefined) {
|
|
312545
|
+
throwBindingError("ptr should not be undefined");
|
|
312546
|
+
}
|
|
312547
|
+
while (class_.baseClass) {
|
|
312548
|
+
ptr = class_.upcast(ptr);
|
|
312549
|
+
class_ = class_.baseClass;
|
|
312550
|
+
}
|
|
312551
|
+
return ptr;
|
|
312552
|
+
};
|
|
312553
|
+
var getInheritedInstance = (class_, ptr) => {
|
|
312554
|
+
ptr = getBasestPointer(class_, ptr);
|
|
312555
|
+
return registeredInstances[ptr];
|
|
312556
|
+
};
|
|
312557
|
+
var makeClassHandle = (prototype, record) => {
|
|
312558
|
+
if (!record.ptrType || !record.ptr) {
|
|
312559
|
+
throwInternalError("makeClassHandle requires ptr and ptrType");
|
|
312560
|
+
}
|
|
312561
|
+
var hasSmartPtrType = !!record.smartPtrType;
|
|
312562
|
+
var hasSmartPtr = !!record.smartPtr;
|
|
312563
|
+
if (hasSmartPtrType !== hasSmartPtr) {
|
|
312564
|
+
throwInternalError("Both smartPtrType and smartPtr must be specified");
|
|
312565
|
+
}
|
|
312566
|
+
record.count = { value: 1 };
|
|
312567
|
+
return attachFinalizer(Object.create(prototype, { $$: { value: record, writable: true } }));
|
|
312568
|
+
};
|
|
312569
|
+
function RegisteredPointer_fromWireType(ptr) {
|
|
312570
|
+
var rawPointer = this.getPointee(ptr);
|
|
312571
|
+
if (!rawPointer) {
|
|
312572
|
+
this.destructor(ptr);
|
|
312573
|
+
return null;
|
|
312574
|
+
}
|
|
312575
|
+
var registeredInstance = getInheritedInstance(this.registeredClass, rawPointer);
|
|
312576
|
+
if (registeredInstance !== undefined) {
|
|
312577
|
+
if (registeredInstance.$$.count.value === 0) {
|
|
312578
|
+
registeredInstance.$$.ptr = rawPointer;
|
|
312579
|
+
registeredInstance.$$.smartPtr = ptr;
|
|
312580
|
+
return registeredInstance["clone"]();
|
|
312581
|
+
} else {
|
|
312582
|
+
var rv2 = registeredInstance["clone"]();
|
|
312583
|
+
this.destructor(ptr);
|
|
312584
|
+
return rv2;
|
|
312585
|
+
}
|
|
312586
|
+
}
|
|
312587
|
+
function makeDefaultHandle() {
|
|
312588
|
+
if (this.isSmartPointer) {
|
|
312589
|
+
return makeClassHandle(this.registeredClass.instancePrototype, { ptrType: this.pointeeType, ptr: rawPointer, smartPtrType: this, smartPtr: ptr });
|
|
312590
|
+
} else {
|
|
312591
|
+
return makeClassHandle(this.registeredClass.instancePrototype, { ptrType: this, ptr });
|
|
312592
|
+
}
|
|
312593
|
+
}
|
|
312594
|
+
var actualType = this.registeredClass.getActualType(rawPointer);
|
|
312595
|
+
var registeredPointerRecord = registeredPointers[actualType];
|
|
312596
|
+
if (!registeredPointerRecord) {
|
|
312597
|
+
return makeDefaultHandle.call(this);
|
|
312598
|
+
}
|
|
312599
|
+
var toType;
|
|
312600
|
+
if (this.isConst) {
|
|
312601
|
+
toType = registeredPointerRecord.constPointerType;
|
|
312602
|
+
} else {
|
|
312603
|
+
toType = registeredPointerRecord.pointerType;
|
|
312604
|
+
}
|
|
312605
|
+
var dp3 = downcastPointer(rawPointer, this.registeredClass, toType.registeredClass);
|
|
312606
|
+
if (dp3 === null) {
|
|
312607
|
+
return makeDefaultHandle.call(this);
|
|
312608
|
+
}
|
|
312609
|
+
if (this.isSmartPointer) {
|
|
312610
|
+
return makeClassHandle(toType.registeredClass.instancePrototype, { ptrType: toType, ptr: dp3, smartPtrType: this, smartPtr: ptr });
|
|
312611
|
+
} else {
|
|
312612
|
+
return makeClassHandle(toType.registeredClass.instancePrototype, { ptrType: toType, ptr: dp3 });
|
|
312613
|
+
}
|
|
312614
|
+
}
|
|
312615
|
+
var init_RegisteredPointer = () => {
|
|
312616
|
+
Object.assign(RegisteredPointer.prototype, { getPointee(ptr) {
|
|
312617
|
+
if (this.rawGetPointee) {
|
|
312618
|
+
ptr = this.rawGetPointee(ptr);
|
|
312619
|
+
}
|
|
312620
|
+
return ptr;
|
|
312621
|
+
}, destructor(ptr) {
|
|
312622
|
+
this.rawDestructor?.(ptr);
|
|
312623
|
+
}, readValueFromPointer: readPointer, fromWireType: RegisteredPointer_fromWireType });
|
|
312624
|
+
};
|
|
312625
|
+
function RegisteredPointer(name, registeredClass, isReference, isConst, isSmartPointer, pointeeType, sharingPolicy, rawGetPointee, rawConstructor, rawShare, rawDestructor) {
|
|
312626
|
+
this.name = name;
|
|
312627
|
+
this.registeredClass = registeredClass;
|
|
312628
|
+
this.isReference = isReference;
|
|
312629
|
+
this.isConst = isConst;
|
|
312630
|
+
this.isSmartPointer = isSmartPointer;
|
|
312631
|
+
this.pointeeType = pointeeType;
|
|
312632
|
+
this.sharingPolicy = sharingPolicy;
|
|
312633
|
+
this.rawGetPointee = rawGetPointee;
|
|
312634
|
+
this.rawConstructor = rawConstructor;
|
|
312635
|
+
this.rawShare = rawShare;
|
|
312636
|
+
this.rawDestructor = rawDestructor;
|
|
312637
|
+
if (!isSmartPointer && registeredClass.baseClass === undefined) {
|
|
312638
|
+
if (isConst) {
|
|
312639
|
+
this.toWireType = constNoSmartPtrRawPointerToWireType;
|
|
312640
|
+
this.destructorFunction = null;
|
|
312641
|
+
} else {
|
|
312642
|
+
this.toWireType = nonConstNoSmartPtrRawPointerToWireType;
|
|
312643
|
+
this.destructorFunction = null;
|
|
312644
|
+
}
|
|
312645
|
+
} else {
|
|
312646
|
+
this.toWireType = genericPointerToWireType;
|
|
312647
|
+
}
|
|
312648
|
+
}
|
|
312649
|
+
var replacePublicSymbol = (name, value, numArguments) => {
|
|
312650
|
+
if (!Module2.hasOwnProperty(name)) {
|
|
312651
|
+
throwInternalError("Replacing nonexistent public symbol");
|
|
312652
|
+
}
|
|
312653
|
+
if (Module2[name].overloadTable !== undefined && numArguments !== undefined) {
|
|
312654
|
+
Module2[name].overloadTable[numArguments] = value;
|
|
312655
|
+
} else {
|
|
312656
|
+
Module2[name] = value;
|
|
312657
|
+
Module2[name].argCount = numArguments;
|
|
312658
|
+
}
|
|
312659
|
+
};
|
|
312660
|
+
var getWasmTableEntry = (funcPtr) => wasmTable.get(funcPtr);
|
|
312661
|
+
var dynCall = (sig, ptr, args = [], promising = false) => {
|
|
312662
|
+
var func = getWasmTableEntry(ptr);
|
|
312663
|
+
var rtn = func(...args);
|
|
312664
|
+
function convert(rtn2) {
|
|
312665
|
+
return sig[0] == "p" ? rtn2 >>> 0 : rtn2;
|
|
312666
|
+
}
|
|
312667
|
+
return convert(rtn);
|
|
312668
|
+
};
|
|
312669
|
+
var getDynCaller = (sig, ptr, promising = false) => (...args) => dynCall(sig, ptr, args, promising);
|
|
312670
|
+
var embind__requireFunction = (signature, rawFunction, isAsync2 = false) => {
|
|
312671
|
+
signature = AsciiToString(signature);
|
|
312672
|
+
function makeDynCaller() {
|
|
312673
|
+
if (signature.includes("p")) {
|
|
312674
|
+
return getDynCaller(signature, rawFunction, isAsync2);
|
|
312675
|
+
}
|
|
312676
|
+
var rtn = getWasmTableEntry(rawFunction);
|
|
312677
|
+
return rtn;
|
|
312678
|
+
}
|
|
312679
|
+
var fp4 = makeDynCaller();
|
|
312680
|
+
if (typeof fp4 != "function") {
|
|
312681
|
+
throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`);
|
|
312682
|
+
}
|
|
312683
|
+
return fp4;
|
|
312684
|
+
};
|
|
312685
|
+
|
|
312686
|
+
class UnboundTypeError extends Error {
|
|
312687
|
+
}
|
|
312688
|
+
var getTypeName = (type) => {
|
|
312689
|
+
var ptr = ___getTypeName(type);
|
|
312690
|
+
var rv2 = AsciiToString(ptr);
|
|
312691
|
+
_free(ptr);
|
|
312692
|
+
return rv2;
|
|
312693
|
+
};
|
|
312694
|
+
var throwUnboundTypeError = (message, types3) => {
|
|
312695
|
+
var unboundTypes = [];
|
|
312696
|
+
var seen = {};
|
|
312697
|
+
function visit(type) {
|
|
312698
|
+
if (seen[type]) {
|
|
312699
|
+
return;
|
|
312700
|
+
}
|
|
312701
|
+
if (registeredTypes[type]) {
|
|
312702
|
+
return;
|
|
312703
|
+
}
|
|
312704
|
+
if (typeDependencies[type]) {
|
|
312705
|
+
typeDependencies[type].forEach(visit);
|
|
312706
|
+
return;
|
|
312707
|
+
}
|
|
312708
|
+
unboundTypes.push(type);
|
|
312709
|
+
seen[type] = true;
|
|
312710
|
+
}
|
|
312711
|
+
types3.forEach(visit);
|
|
312712
|
+
throw new UnboundTypeError(`${message}: ` + unboundTypes.map(getTypeName).join([", "]));
|
|
312713
|
+
};
|
|
312714
|
+
function __embind_register_class(rawType, rawPointerType, rawConstPointerType, baseClassRawType, getActualTypeSignature, getActualType, upcastSignature, upcast, downcastSignature, downcast, name, destructorSignature, rawDestructor) {
|
|
312715
|
+
rawType >>>= 0;
|
|
312716
|
+
rawPointerType >>>= 0;
|
|
312717
|
+
rawConstPointerType >>>= 0;
|
|
312718
|
+
baseClassRawType >>>= 0;
|
|
312719
|
+
getActualTypeSignature >>>= 0;
|
|
312720
|
+
getActualType >>>= 0;
|
|
312721
|
+
upcastSignature >>>= 0;
|
|
312722
|
+
upcast >>>= 0;
|
|
312723
|
+
downcastSignature >>>= 0;
|
|
312724
|
+
downcast >>>= 0;
|
|
312725
|
+
name >>>= 0;
|
|
312726
|
+
destructorSignature >>>= 0;
|
|
312727
|
+
rawDestructor >>>= 0;
|
|
312728
|
+
name = AsciiToString(name);
|
|
312729
|
+
getActualType = embind__requireFunction(getActualTypeSignature, getActualType);
|
|
312730
|
+
upcast &&= embind__requireFunction(upcastSignature, upcast);
|
|
312731
|
+
downcast &&= embind__requireFunction(downcastSignature, downcast);
|
|
312732
|
+
rawDestructor = embind__requireFunction(destructorSignature, rawDestructor);
|
|
312733
|
+
var legalFunctionName = makeLegalFunctionName(name);
|
|
312734
|
+
exposePublicSymbol(legalFunctionName, function() {
|
|
312735
|
+
throwUnboundTypeError(`Cannot construct ${name} due to unbound types`, [baseClassRawType]);
|
|
312736
|
+
});
|
|
312737
|
+
whenDependentTypesAreResolved([rawType, rawPointerType, rawConstPointerType], baseClassRawType ? [baseClassRawType] : [], (base) => {
|
|
312738
|
+
base = base[0];
|
|
312739
|
+
var baseClass;
|
|
312740
|
+
var basePrototype;
|
|
312741
|
+
if (baseClassRawType) {
|
|
312742
|
+
baseClass = base.registeredClass;
|
|
312743
|
+
basePrototype = baseClass.instancePrototype;
|
|
312744
|
+
} else {
|
|
312745
|
+
basePrototype = ClassHandle.prototype;
|
|
312746
|
+
}
|
|
312747
|
+
var constructor = createNamedFunction(name, function(...args) {
|
|
312748
|
+
if (Object.getPrototypeOf(this) !== instancePrototype) {
|
|
312749
|
+
throw new BindingError(`Use 'new' to construct ${name}`);
|
|
312750
|
+
}
|
|
312751
|
+
if (registeredClass.constructor_body === undefined) {
|
|
312752
|
+
throw new BindingError(`${name} has no accessible constructor`);
|
|
312753
|
+
}
|
|
312754
|
+
var body = registeredClass.constructor_body[args.length];
|
|
312755
|
+
if (body === undefined) {
|
|
312756
|
+
throw new BindingError(`Tried to invoke ctor of ${name} with invalid number of parameters (${args.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`);
|
|
312757
|
+
}
|
|
312758
|
+
return body.apply(this, args);
|
|
312759
|
+
});
|
|
312760
|
+
var instancePrototype = Object.create(basePrototype, { constructor: { value: constructor } });
|
|
312761
|
+
constructor.prototype = instancePrototype;
|
|
312762
|
+
var registeredClass = new RegisteredClass(name, constructor, instancePrototype, rawDestructor, baseClass, getActualType, upcast, downcast);
|
|
312763
|
+
if (registeredClass.baseClass) {
|
|
312764
|
+
registeredClass.baseClass.__derivedClasses ??= [];
|
|
312765
|
+
registeredClass.baseClass.__derivedClasses.push(registeredClass);
|
|
312766
|
+
}
|
|
312767
|
+
var referenceConverter = new RegisteredPointer(name, registeredClass, true, false, false);
|
|
312768
|
+
var pointerConverter = new RegisteredPointer(name + "*", registeredClass, false, false, false);
|
|
312769
|
+
var constPointerConverter = new RegisteredPointer(name + " const*", registeredClass, false, true, false);
|
|
312770
|
+
registeredPointers[rawType] = { pointerType: pointerConverter, constPointerType: constPointerConverter };
|
|
312771
|
+
replacePublicSymbol(legalFunctionName, constructor);
|
|
312772
|
+
return [referenceConverter, pointerConverter, constPointerConverter];
|
|
312773
|
+
});
|
|
312774
|
+
}
|
|
312775
|
+
var heap32VectorToArray = (count, firstElement) => {
|
|
312776
|
+
var array = [];
|
|
312777
|
+
for (var i3 = 0;i3 < count; i3++) {
|
|
312778
|
+
array.push(HEAPU32[firstElement + i3 * 4 >>> 2 >>> 0]);
|
|
312779
|
+
}
|
|
312780
|
+
return array;
|
|
312781
|
+
};
|
|
312782
|
+
function usesDestructorStack(argTypes) {
|
|
312783
|
+
for (var i3 = 1;i3 < argTypes.length; ++i3) {
|
|
312784
|
+
if (argTypes[i3] !== null && argTypes[i3].destructorFunction === undefined) {
|
|
312785
|
+
return true;
|
|
312786
|
+
}
|
|
312787
|
+
}
|
|
312788
|
+
return false;
|
|
312789
|
+
}
|
|
312790
|
+
function createJsInvoker(argTypes, isClassMethodFunc, returns, isAsync2) {
|
|
312791
|
+
var needsDestructorStack = usesDestructorStack(argTypes);
|
|
312792
|
+
var argCount = argTypes.length - 2;
|
|
312793
|
+
var argsList = [];
|
|
312794
|
+
var argsListWired = ["fn"];
|
|
312795
|
+
if (isClassMethodFunc) {
|
|
312796
|
+
argsListWired.push("thisWired");
|
|
312797
|
+
}
|
|
312798
|
+
for (var i3 = 0;i3 < argCount; ++i3) {
|
|
312799
|
+
argsList.push(`arg${i3}`);
|
|
312800
|
+
argsListWired.push(`arg${i3}Wired`);
|
|
312801
|
+
}
|
|
312802
|
+
argsList = argsList.join(",");
|
|
312803
|
+
argsListWired = argsListWired.join(",");
|
|
312804
|
+
var invokerFnBody = `return function (${argsList}) {
|
|
312805
|
+
`;
|
|
312806
|
+
if (needsDestructorStack) {
|
|
312807
|
+
invokerFnBody += `var destructors = [];
|
|
312808
|
+
`;
|
|
312809
|
+
}
|
|
312810
|
+
var dtorStack = needsDestructorStack ? "destructors" : "null";
|
|
312811
|
+
var args1 = ["humanName", "throwBindingError", "invoker", "fn", "runDestructors", "fromRetWire", "toClassParamWire"];
|
|
312812
|
+
if (isClassMethodFunc) {
|
|
312813
|
+
invokerFnBody += `var thisWired = toClassParamWire(${dtorStack}, this);
|
|
312814
|
+
`;
|
|
312815
|
+
}
|
|
312816
|
+
for (var i3 = 0;i3 < argCount; ++i3) {
|
|
312817
|
+
var argName = `toArg${i3}Wire`;
|
|
312818
|
+
invokerFnBody += `var arg${i3}Wired = ${argName}(${dtorStack}, arg${i3});
|
|
312819
|
+
`;
|
|
312820
|
+
args1.push(argName);
|
|
312821
|
+
}
|
|
312822
|
+
invokerFnBody += (returns || isAsync2 ? "var rv = " : "") + `invoker(${argsListWired});
|
|
312823
|
+
`;
|
|
312824
|
+
if (needsDestructorStack) {
|
|
312825
|
+
invokerFnBody += `runDestructors(destructors);
|
|
312826
|
+
`;
|
|
312827
|
+
} else {
|
|
312828
|
+
for (var i3 = isClassMethodFunc ? 1 : 2;i3 < argTypes.length; ++i3) {
|
|
312829
|
+
var paramName = i3 === 1 ? "thisWired" : "arg" + (i3 - 2) + "Wired";
|
|
312830
|
+
if (argTypes[i3].destructorFunction !== null) {
|
|
312831
|
+
invokerFnBody += `${paramName}_dtor(${paramName});
|
|
312832
|
+
`;
|
|
312833
|
+
args1.push(`${paramName}_dtor`);
|
|
312834
|
+
}
|
|
312835
|
+
}
|
|
312836
|
+
}
|
|
312837
|
+
if (returns) {
|
|
312838
|
+
invokerFnBody += `var ret = fromRetWire(rv);
|
|
312839
|
+
return ret;
|
|
312840
|
+
`;
|
|
312841
|
+
}
|
|
312842
|
+
invokerFnBody += `}
|
|
312843
|
+
`;
|
|
312844
|
+
return new Function(args1, invokerFnBody);
|
|
312845
|
+
}
|
|
312846
|
+
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, isAsync2) {
|
|
312847
|
+
var argCount = argTypes.length;
|
|
312848
|
+
if (argCount < 2) {
|
|
312849
|
+
throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
|
312850
|
+
}
|
|
312851
|
+
var isClassMethodFunc = argTypes[1] !== null && classType !== null;
|
|
312852
|
+
var needsDestructorStack = usesDestructorStack(argTypes);
|
|
312853
|
+
var returns = !argTypes[0].isVoid;
|
|
312854
|
+
var retType = argTypes[0];
|
|
312855
|
+
var instType = argTypes[1];
|
|
312856
|
+
var closureArgs = [humanName, throwBindingError, cppInvokerFunc, cppTargetFunc, runDestructors, retType.fromWireType.bind(retType), instType?.toWireType.bind(instType)];
|
|
312857
|
+
for (var i3 = 2;i3 < argCount; ++i3) {
|
|
312858
|
+
var argType = argTypes[i3];
|
|
312859
|
+
closureArgs.push(argType.toWireType.bind(argType));
|
|
312860
|
+
}
|
|
312861
|
+
if (!needsDestructorStack) {
|
|
312862
|
+
for (var i3 = isClassMethodFunc ? 1 : 2;i3 < argTypes.length; ++i3) {
|
|
312863
|
+
if (argTypes[i3].destructorFunction !== null) {
|
|
312864
|
+
closureArgs.push(argTypes[i3].destructorFunction);
|
|
312865
|
+
}
|
|
312866
|
+
}
|
|
312867
|
+
}
|
|
312868
|
+
let invokerFactory = createJsInvoker(argTypes, isClassMethodFunc, returns, isAsync2);
|
|
312869
|
+
var invokerFn = invokerFactory(...closureArgs);
|
|
312870
|
+
return createNamedFunction(humanName, invokerFn);
|
|
312871
|
+
}
|
|
312872
|
+
var __embind_register_class_constructor = function(rawClassType, argCount, rawArgTypesAddr, invokerSignature, invoker, rawConstructor) {
|
|
312873
|
+
rawClassType >>>= 0;
|
|
312874
|
+
rawArgTypesAddr >>>= 0;
|
|
312875
|
+
invokerSignature >>>= 0;
|
|
312876
|
+
invoker >>>= 0;
|
|
312877
|
+
rawConstructor >>>= 0;
|
|
312878
|
+
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
312879
|
+
invoker = embind__requireFunction(invokerSignature, invoker);
|
|
312880
|
+
whenDependentTypesAreResolved([], [rawClassType], (classType) => {
|
|
312881
|
+
classType = classType[0];
|
|
312882
|
+
var humanName = `constructor ${classType.name}`;
|
|
312883
|
+
if (classType.registeredClass.constructor_body === undefined) {
|
|
312884
|
+
classType.registeredClass.constructor_body = [];
|
|
312885
|
+
}
|
|
312886
|
+
if (classType.registeredClass.constructor_body[argCount - 1] !== undefined) {
|
|
312887
|
+
throw new BindingError(`Cannot register multiple constructors with identical number of parameters (${argCount - 1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
|
|
312888
|
+
}
|
|
312889
|
+
classType.registeredClass.constructor_body[argCount - 1] = () => {
|
|
312890
|
+
throwUnboundTypeError(`Cannot construct ${classType.name} due to unbound types`, rawArgTypes);
|
|
312891
|
+
};
|
|
312892
|
+
whenDependentTypesAreResolved([], rawArgTypes, (argTypes) => {
|
|
312893
|
+
argTypes.splice(1, 0, null);
|
|
312894
|
+
classType.registeredClass.constructor_body[argCount - 1] = craftInvokerFunction(humanName, argTypes, null, invoker, rawConstructor);
|
|
312895
|
+
return [];
|
|
312896
|
+
});
|
|
312897
|
+
return [];
|
|
312898
|
+
});
|
|
312899
|
+
};
|
|
312900
|
+
var getFunctionName = (signature) => {
|
|
312901
|
+
signature = signature.trim();
|
|
312902
|
+
const argsIndex = signature.indexOf("(");
|
|
312903
|
+
if (argsIndex === -1)
|
|
312904
|
+
return signature;
|
|
312905
|
+
return signature.slice(0, argsIndex);
|
|
312906
|
+
};
|
|
312907
|
+
var __embind_register_class_function = function(rawClassType, methodName, argCount, rawArgTypesAddr, invokerSignature, rawInvoker, context, isPureVirtual, isAsync2, isNonnullReturn) {
|
|
312908
|
+
rawClassType >>>= 0;
|
|
312909
|
+
methodName >>>= 0;
|
|
312910
|
+
rawArgTypesAddr >>>= 0;
|
|
312911
|
+
invokerSignature >>>= 0;
|
|
312912
|
+
rawInvoker >>>= 0;
|
|
312913
|
+
context >>>= 0;
|
|
312914
|
+
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
312915
|
+
methodName = AsciiToString(methodName);
|
|
312916
|
+
methodName = getFunctionName(methodName);
|
|
312917
|
+
rawInvoker = embind__requireFunction(invokerSignature, rawInvoker, isAsync2);
|
|
312918
|
+
whenDependentTypesAreResolved([], [rawClassType], (classType) => {
|
|
312919
|
+
classType = classType[0];
|
|
312920
|
+
var humanName = `${classType.name}.${methodName}`;
|
|
312921
|
+
if (methodName.startsWith("@@")) {
|
|
312922
|
+
methodName = Symbol[methodName.substring(2)];
|
|
312923
|
+
}
|
|
312924
|
+
if (isPureVirtual) {
|
|
312925
|
+
classType.registeredClass.pureVirtualFunctions.push(methodName);
|
|
312926
|
+
}
|
|
312927
|
+
function unboundTypesHandler() {
|
|
312928
|
+
throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`, rawArgTypes);
|
|
312929
|
+
}
|
|
312930
|
+
var proto = classType.registeredClass.instancePrototype;
|
|
312931
|
+
var method = proto[methodName];
|
|
312932
|
+
if (method === undefined || method.overloadTable === undefined && method.className !== classType.name && method.argCount === argCount - 2) {
|
|
312933
|
+
unboundTypesHandler.argCount = argCount - 2;
|
|
312934
|
+
unboundTypesHandler.className = classType.name;
|
|
312935
|
+
proto[methodName] = unboundTypesHandler;
|
|
312936
|
+
} else {
|
|
312937
|
+
ensureOverloadTable(proto, methodName, humanName);
|
|
312938
|
+
proto[methodName].overloadTable[argCount - 2] = unboundTypesHandler;
|
|
312939
|
+
}
|
|
312940
|
+
whenDependentTypesAreResolved([], rawArgTypes, (argTypes) => {
|
|
312941
|
+
var memberFunction = craftInvokerFunction(humanName, argTypes, classType, rawInvoker, context, isAsync2);
|
|
312942
|
+
if (proto[methodName].overloadTable === undefined) {
|
|
312943
|
+
memberFunction.argCount = argCount - 2;
|
|
312944
|
+
proto[methodName] = memberFunction;
|
|
312945
|
+
} else {
|
|
312946
|
+
proto[methodName].overloadTable[argCount - 2] = memberFunction;
|
|
312947
|
+
}
|
|
312948
|
+
return [];
|
|
312949
|
+
});
|
|
312950
|
+
return [];
|
|
312951
|
+
});
|
|
312952
|
+
};
|
|
312953
|
+
var emval_freelist = [];
|
|
312954
|
+
var emval_handles = [0, 1, , 1, null, 1, true, 1, false, 1];
|
|
312955
|
+
function __emval_decref(handle) {
|
|
312956
|
+
handle >>>= 0;
|
|
312957
|
+
if (handle > 9 && --emval_handles[handle + 1] === 0) {
|
|
312958
|
+
emval_handles[handle] = undefined;
|
|
312959
|
+
emval_freelist.push(handle);
|
|
312960
|
+
}
|
|
312961
|
+
}
|
|
312962
|
+
var Emval = { toValue: (handle) => {
|
|
312963
|
+
if (!handle) {
|
|
312964
|
+
throwBindingError(`Cannot use deleted val. handle = ${handle}`);
|
|
312965
|
+
}
|
|
312966
|
+
return emval_handles[handle];
|
|
312967
|
+
}, toHandle: (value) => {
|
|
312968
|
+
switch (value) {
|
|
312969
|
+
case undefined:
|
|
312970
|
+
return 2;
|
|
312971
|
+
case null:
|
|
312972
|
+
return 4;
|
|
312973
|
+
case true:
|
|
312974
|
+
return 6;
|
|
312975
|
+
case false:
|
|
312976
|
+
return 8;
|
|
312977
|
+
default: {
|
|
312978
|
+
const handle = emval_freelist.pop() || emval_handles.length;
|
|
312979
|
+
emval_handles[handle] = value;
|
|
312980
|
+
emval_handles[handle + 1] = 1;
|
|
312981
|
+
return handle;
|
|
312982
|
+
}
|
|
312983
|
+
}
|
|
312984
|
+
} };
|
|
312985
|
+
var EmValType = { name: "emscripten::val", fromWireType: (handle) => {
|
|
312986
|
+
var rv2 = Emval.toValue(handle);
|
|
312987
|
+
__emval_decref(handle);
|
|
312988
|
+
return rv2;
|
|
312989
|
+
}, toWireType: (destructors, value) => Emval.toHandle(value), readValueFromPointer: readPointer, destructorFunction: null };
|
|
312990
|
+
function __embind_register_emval(rawType) {
|
|
312991
|
+
rawType >>>= 0;
|
|
312992
|
+
return registerType(rawType, EmValType);
|
|
312993
|
+
}
|
|
312994
|
+
var enumReadValueFromPointer = (name, width, signed) => {
|
|
312995
|
+
switch (width) {
|
|
312996
|
+
case 1:
|
|
312997
|
+
return signed ? function(pointer) {
|
|
312998
|
+
return this.fromWireType(HEAP8[pointer >>> 0]);
|
|
312999
|
+
} : function(pointer) {
|
|
313000
|
+
return this.fromWireType(HEAPU8[pointer >>> 0]);
|
|
313001
|
+
};
|
|
313002
|
+
case 2:
|
|
313003
|
+
return signed ? function(pointer) {
|
|
313004
|
+
return this.fromWireType(HEAP16[pointer >>> 1 >>> 0]);
|
|
313005
|
+
} : function(pointer) {
|
|
313006
|
+
return this.fromWireType(HEAPU16[pointer >>> 1 >>> 0]);
|
|
313007
|
+
};
|
|
313008
|
+
case 4:
|
|
313009
|
+
return signed ? function(pointer) {
|
|
313010
|
+
return this.fromWireType(HEAP32[pointer >>> 2 >>> 0]);
|
|
313011
|
+
} : function(pointer) {
|
|
313012
|
+
return this.fromWireType(HEAPU32[pointer >>> 2 >>> 0]);
|
|
313013
|
+
};
|
|
313014
|
+
default:
|
|
313015
|
+
throw new TypeError(`invalid integer width (${width}): ${name}`);
|
|
313016
|
+
}
|
|
313017
|
+
};
|
|
313018
|
+
function getEnumValueType(rawValueType) {
|
|
313019
|
+
return rawValueType === 0 ? "object" : rawValueType === 1 ? "number" : "string";
|
|
313020
|
+
}
|
|
313021
|
+
function __embind_register_enum(rawType, name, size, isSigned, rawValueType) {
|
|
313022
|
+
rawType >>>= 0;
|
|
313023
|
+
name >>>= 0;
|
|
313024
|
+
size >>>= 0;
|
|
313025
|
+
name = AsciiToString(name);
|
|
313026
|
+
const valueType = getEnumValueType(rawValueType);
|
|
313027
|
+
switch (valueType) {
|
|
313028
|
+
case "object": {
|
|
313029
|
+
let ctor = function() {};
|
|
313030
|
+
ctor.values = {};
|
|
313031
|
+
registerType(rawType, { name, constructor: ctor, valueType, fromWireType: function(c3) {
|
|
313032
|
+
return this.constructor.values[c3];
|
|
313033
|
+
}, toWireType: (destructors, c3) => c3.value, readValueFromPointer: enumReadValueFromPointer(name, size, isSigned), destructorFunction: null });
|
|
313034
|
+
exposePublicSymbol(name, ctor);
|
|
313035
|
+
break;
|
|
313036
|
+
}
|
|
313037
|
+
case "number": {
|
|
313038
|
+
var keysMap = {};
|
|
313039
|
+
registerType(rawType, { name, keysMap, valueType, fromWireType: (c3) => c3, toWireType: (destructors, c3) => c3, readValueFromPointer: enumReadValueFromPointer(name, size, isSigned), destructorFunction: null });
|
|
313040
|
+
exposePublicSymbol(name, keysMap);
|
|
313041
|
+
delete Module2[name].argCount;
|
|
313042
|
+
break;
|
|
313043
|
+
}
|
|
313044
|
+
case "string": {
|
|
313045
|
+
var valuesMap = {};
|
|
313046
|
+
var reverseMap = {};
|
|
313047
|
+
var keysMap = {};
|
|
313048
|
+
registerType(rawType, { name, valuesMap, reverseMap, keysMap, valueType, fromWireType: function(c3) {
|
|
313049
|
+
return this.reverseMap[c3];
|
|
313050
|
+
}, toWireType: function(destructors, c3) {
|
|
313051
|
+
return this.valuesMap[c3];
|
|
313052
|
+
}, readValueFromPointer: enumReadValueFromPointer(name, size, isSigned), destructorFunction: null });
|
|
313053
|
+
exposePublicSymbol(name, keysMap);
|
|
313054
|
+
delete Module2[name].argCount;
|
|
313055
|
+
break;
|
|
313056
|
+
}
|
|
313057
|
+
}
|
|
313058
|
+
}
|
|
313059
|
+
var requireRegisteredType = (rawType, humanName) => {
|
|
313060
|
+
var impl = registeredTypes[rawType];
|
|
313061
|
+
if (impl === undefined) {
|
|
313062
|
+
throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`);
|
|
313063
|
+
}
|
|
313064
|
+
return impl;
|
|
313065
|
+
};
|
|
313066
|
+
function __embind_register_enum_value(rawEnumType, name, enumValue) {
|
|
313067
|
+
rawEnumType >>>= 0;
|
|
313068
|
+
name >>>= 0;
|
|
313069
|
+
var enumType2 = requireRegisteredType(rawEnumType, "enum");
|
|
313070
|
+
name = AsciiToString(name);
|
|
313071
|
+
switch (enumType2.valueType) {
|
|
313072
|
+
case "object": {
|
|
313073
|
+
var Enum = enumType2.constructor;
|
|
313074
|
+
var Value = Object.create(enumType2.constructor.prototype, { value: { value: enumValue }, constructor: { value: createNamedFunction(`${enumType2.name}_${name}`, function() {}) } });
|
|
313075
|
+
Enum.values[enumValue] = Value;
|
|
313076
|
+
Enum[name] = Value;
|
|
313077
|
+
break;
|
|
313078
|
+
}
|
|
313079
|
+
case "number": {
|
|
313080
|
+
enumType2.keysMap[name] = enumValue;
|
|
313081
|
+
break;
|
|
313082
|
+
}
|
|
313083
|
+
case "string": {
|
|
313084
|
+
enumType2.valuesMap[name] = enumValue;
|
|
313085
|
+
enumType2.reverseMap[enumValue] = name;
|
|
313086
|
+
enumType2.keysMap[name] = name;
|
|
313087
|
+
break;
|
|
313088
|
+
}
|
|
313089
|
+
}
|
|
313090
|
+
}
|
|
313091
|
+
var floatReadValueFromPointer = (name, width) => {
|
|
313092
|
+
switch (width) {
|
|
313093
|
+
case 4:
|
|
313094
|
+
return function(pointer) {
|
|
313095
|
+
return this.fromWireType(HEAPF32[pointer >>> 2 >>> 0]);
|
|
313096
|
+
};
|
|
313097
|
+
case 8:
|
|
313098
|
+
return function(pointer) {
|
|
313099
|
+
return this.fromWireType(HEAPF64[pointer >>> 3 >>> 0]);
|
|
313100
|
+
};
|
|
313101
|
+
default:
|
|
313102
|
+
throw new TypeError(`invalid float width (${width}): ${name}`);
|
|
313103
|
+
}
|
|
313104
|
+
};
|
|
313105
|
+
var __embind_register_float = function(rawType, name, size) {
|
|
313106
|
+
rawType >>>= 0;
|
|
313107
|
+
name >>>= 0;
|
|
313108
|
+
size >>>= 0;
|
|
313109
|
+
name = AsciiToString(name);
|
|
313110
|
+
registerType(rawType, { name, fromWireType: (value) => value, toWireType: (destructors, value) => value, readValueFromPointer: floatReadValueFromPointer(name, size), destructorFunction: null });
|
|
313111
|
+
};
|
|
313112
|
+
function __embind_register_function(name, argCount, rawArgTypesAddr, signature, rawInvoker, fn3, isAsync2, isNonnullReturn) {
|
|
313113
|
+
name >>>= 0;
|
|
313114
|
+
rawArgTypesAddr >>>= 0;
|
|
313115
|
+
signature >>>= 0;
|
|
313116
|
+
rawInvoker >>>= 0;
|
|
313117
|
+
fn3 >>>= 0;
|
|
313118
|
+
var argTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
313119
|
+
name = AsciiToString(name);
|
|
313120
|
+
name = getFunctionName(name);
|
|
313121
|
+
rawInvoker = embind__requireFunction(signature, rawInvoker, isAsync2);
|
|
313122
|
+
exposePublicSymbol(name, function() {
|
|
313123
|
+
throwUnboundTypeError(`Cannot call ${name} due to unbound types`, argTypes);
|
|
313124
|
+
}, argCount - 1);
|
|
313125
|
+
whenDependentTypesAreResolved([], argTypes, (argTypes2) => {
|
|
313126
|
+
var invokerArgsArray = [argTypes2[0], null].concat(argTypes2.slice(1));
|
|
313127
|
+
replacePublicSymbol(name, craftInvokerFunction(name, invokerArgsArray, null, rawInvoker, fn3, isAsync2), argCount - 1);
|
|
313128
|
+
return [];
|
|
313129
|
+
});
|
|
313130
|
+
}
|
|
313131
|
+
var __embind_register_integer = function(primitiveType, name, size, minRange, maxRange) {
|
|
313132
|
+
primitiveType >>>= 0;
|
|
313133
|
+
name >>>= 0;
|
|
313134
|
+
size >>>= 0;
|
|
313135
|
+
name = AsciiToString(name);
|
|
313136
|
+
const isUnsignedType = minRange === 0;
|
|
313137
|
+
let fromWireType = (value) => value;
|
|
313138
|
+
if (isUnsignedType) {
|
|
313139
|
+
var bitshift = 32 - 8 * size;
|
|
313140
|
+
fromWireType = (value) => value << bitshift >>> bitshift;
|
|
313141
|
+
maxRange = fromWireType(maxRange);
|
|
313142
|
+
}
|
|
313143
|
+
registerType(primitiveType, { name, fromWireType, toWireType: (destructors, value) => value, readValueFromPointer: integerReadValueFromPointer(name, size, minRange !== 0), destructorFunction: null });
|
|
313144
|
+
};
|
|
313145
|
+
var installIndexedIterator = (proto, sizeMethodName, getMethodName) => {
|
|
313146
|
+
const makeIterator = (size, getValue2) => {
|
|
313147
|
+
let index = 0;
|
|
313148
|
+
return { next() {
|
|
313149
|
+
if (index >= size) {
|
|
313150
|
+
return { done: true };
|
|
313151
|
+
}
|
|
313152
|
+
const current2 = index;
|
|
313153
|
+
index++;
|
|
313154
|
+
const value = getValue2(current2);
|
|
313155
|
+
return { value, done: false };
|
|
313156
|
+
}, [Symbol.iterator]() {
|
|
313157
|
+
return this;
|
|
313158
|
+
} };
|
|
313159
|
+
};
|
|
313160
|
+
if (!proto[Symbol.iterator]) {
|
|
313161
|
+
proto[Symbol.iterator] = function() {
|
|
313162
|
+
const size = this[sizeMethodName]();
|
|
313163
|
+
return makeIterator(size, (i3) => this[getMethodName](i3));
|
|
313164
|
+
};
|
|
313165
|
+
}
|
|
313166
|
+
};
|
|
313167
|
+
var __embind_register_iterable = function(rawClassType, rawElementType, sizeMethodName, getMethodName) {
|
|
313168
|
+
rawClassType >>>= 0;
|
|
313169
|
+
rawElementType >>>= 0;
|
|
313170
|
+
sizeMethodName >>>= 0;
|
|
313171
|
+
getMethodName >>>= 0;
|
|
313172
|
+
sizeMethodName = AsciiToString(sizeMethodName);
|
|
313173
|
+
getMethodName = AsciiToString(getMethodName);
|
|
313174
|
+
whenDependentTypesAreResolved([], [rawClassType, rawElementType], (types3) => {
|
|
313175
|
+
const classType = types3[0];
|
|
313176
|
+
installIndexedIterator(classType.registeredClass.instancePrototype, sizeMethodName, getMethodName);
|
|
313177
|
+
return [];
|
|
313178
|
+
});
|
|
313179
|
+
};
|
|
313180
|
+
function __embind_register_memory_view(rawType, dataTypeIndex, name) {
|
|
313181
|
+
rawType >>>= 0;
|
|
313182
|
+
name >>>= 0;
|
|
313183
|
+
var typeMapping = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array];
|
|
313184
|
+
var TA2 = typeMapping[dataTypeIndex];
|
|
313185
|
+
function decodeMemoryView(handle) {
|
|
313186
|
+
var size = HEAPU32[handle >>> 2 >>> 0];
|
|
313187
|
+
var data = HEAPU32[handle + 4 >>> 2 >>> 0];
|
|
313188
|
+
return new TA2(HEAP8.buffer, data, size);
|
|
313189
|
+
}
|
|
313190
|
+
name = AsciiToString(name);
|
|
313191
|
+
registerType(rawType, { name, fromWireType: decodeMemoryView, readValueFromPointer: decodeMemoryView }, { ignoreDuplicateRegistrations: true });
|
|
313192
|
+
}
|
|
313193
|
+
var EmValOptionalType = Object.assign({ optional: true }, EmValType);
|
|
313194
|
+
function __embind_register_optional(rawOptionalType, rawType) {
|
|
313195
|
+
rawOptionalType >>>= 0;
|
|
313196
|
+
rawType >>>= 0;
|
|
313197
|
+
registerType(rawOptionalType, EmValOptionalType);
|
|
313198
|
+
}
|
|
313199
|
+
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
313200
|
+
outIdx >>>= 0;
|
|
313201
|
+
if (!(maxBytesToWrite > 0))
|
|
313202
|
+
return 0;
|
|
313203
|
+
var startIdx = outIdx;
|
|
313204
|
+
var endIdx = outIdx + maxBytesToWrite - 1;
|
|
313205
|
+
for (var i3 = 0;i3 < str.length; ++i3) {
|
|
313206
|
+
var u4 = str.codePointAt(i3);
|
|
313207
|
+
if (u4 <= 127) {
|
|
313208
|
+
if (outIdx >= endIdx)
|
|
313209
|
+
break;
|
|
313210
|
+
heap[outIdx++ >>> 0] = u4;
|
|
313211
|
+
} else if (u4 <= 2047) {
|
|
313212
|
+
if (outIdx + 1 >= endIdx)
|
|
313213
|
+
break;
|
|
313214
|
+
heap[outIdx++ >>> 0] = 192 | u4 >> 6;
|
|
313215
|
+
heap[outIdx++ >>> 0] = 128 | u4 & 63;
|
|
313216
|
+
} else if (u4 <= 65535) {
|
|
313217
|
+
if (outIdx + 2 >= endIdx)
|
|
313218
|
+
break;
|
|
313219
|
+
heap[outIdx++ >>> 0] = 224 | u4 >> 12;
|
|
313220
|
+
heap[outIdx++ >>> 0] = 128 | u4 >> 6 & 63;
|
|
313221
|
+
heap[outIdx++ >>> 0] = 128 | u4 & 63;
|
|
313222
|
+
} else {
|
|
313223
|
+
if (outIdx + 3 >= endIdx)
|
|
313224
|
+
break;
|
|
313225
|
+
heap[outIdx++ >>> 0] = 240 | u4 >> 18;
|
|
313226
|
+
heap[outIdx++ >>> 0] = 128 | u4 >> 12 & 63;
|
|
313227
|
+
heap[outIdx++ >>> 0] = 128 | u4 >> 6 & 63;
|
|
313228
|
+
heap[outIdx++ >>> 0] = 128 | u4 & 63;
|
|
313229
|
+
i3++;
|
|
313230
|
+
}
|
|
313231
|
+
}
|
|
313232
|
+
heap[outIdx >>> 0] = 0;
|
|
313233
|
+
return outIdx - startIdx;
|
|
313234
|
+
};
|
|
313235
|
+
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
313236
|
+
var lengthBytesUTF8 = (str) => {
|
|
313237
|
+
var len = 0;
|
|
313238
|
+
for (var i3 = 0;i3 < str.length; ++i3) {
|
|
313239
|
+
var c3 = str.charCodeAt(i3);
|
|
313240
|
+
if (c3 <= 127) {
|
|
313241
|
+
len++;
|
|
313242
|
+
} else if (c3 <= 2047) {
|
|
313243
|
+
len += 2;
|
|
313244
|
+
} else if (c3 >= 55296 && c3 <= 57343) {
|
|
313245
|
+
len += 4;
|
|
313246
|
+
++i3;
|
|
313247
|
+
} else {
|
|
313248
|
+
len += 3;
|
|
313249
|
+
}
|
|
313250
|
+
}
|
|
313251
|
+
return len;
|
|
313252
|
+
};
|
|
313253
|
+
var UTF8Decoder = globalThis.TextDecoder && new TextDecoder;
|
|
313254
|
+
var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
|
|
313255
|
+
var maxIdx = idx + maxBytesToRead;
|
|
313256
|
+
if (ignoreNul)
|
|
313257
|
+
return maxIdx;
|
|
313258
|
+
while (heapOrArray[idx] && !(idx >= maxIdx))
|
|
313259
|
+
++idx;
|
|
313260
|
+
return idx;
|
|
313261
|
+
};
|
|
313262
|
+
var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
|
|
313263
|
+
idx >>>= 0;
|
|
313264
|
+
var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
|
|
313265
|
+
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
313266
|
+
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
313267
|
+
}
|
|
313268
|
+
var str = "";
|
|
313269
|
+
while (idx < endPtr) {
|
|
313270
|
+
var u02 = heapOrArray[idx++];
|
|
313271
|
+
if (!(u02 & 128)) {
|
|
313272
|
+
str += String.fromCharCode(u02);
|
|
313273
|
+
continue;
|
|
313274
|
+
}
|
|
313275
|
+
var u12 = heapOrArray[idx++] & 63;
|
|
313276
|
+
if ((u02 & 224) == 192) {
|
|
313277
|
+
str += String.fromCharCode((u02 & 31) << 6 | u12);
|
|
313278
|
+
continue;
|
|
313279
|
+
}
|
|
313280
|
+
var u22 = heapOrArray[idx++] & 63;
|
|
313281
|
+
if ((u02 & 240) == 224) {
|
|
313282
|
+
u02 = (u02 & 15) << 12 | u12 << 6 | u22;
|
|
313283
|
+
} else {
|
|
313284
|
+
u02 = (u02 & 7) << 18 | u12 << 12 | u22 << 6 | heapOrArray[idx++] & 63;
|
|
313285
|
+
}
|
|
313286
|
+
if (u02 < 65536) {
|
|
313287
|
+
str += String.fromCharCode(u02);
|
|
313288
|
+
} else {
|
|
313289
|
+
var ch3 = u02 - 65536;
|
|
313290
|
+
str += String.fromCharCode(55296 | ch3 >> 10, 56320 | ch3 & 1023);
|
|
313291
|
+
}
|
|
313292
|
+
}
|
|
313293
|
+
return str;
|
|
313294
|
+
};
|
|
313295
|
+
var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
|
|
313296
|
+
ptr >>>= 0;
|
|
313297
|
+
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : "";
|
|
313298
|
+
};
|
|
313299
|
+
function __embind_register_std_string(rawType, name) {
|
|
313300
|
+
rawType >>>= 0;
|
|
313301
|
+
name >>>= 0;
|
|
313302
|
+
name = AsciiToString(name);
|
|
313303
|
+
var stdStringIsUTF8 = true;
|
|
313304
|
+
registerType(rawType, { name, fromWireType(value) {
|
|
313305
|
+
var length67 = HEAPU32[value >>> 2 >>> 0];
|
|
313306
|
+
var payload = value + 4;
|
|
313307
|
+
var str;
|
|
313308
|
+
if (stdStringIsUTF8) {
|
|
313309
|
+
str = UTF8ToString(payload, length67, true);
|
|
313310
|
+
} else {
|
|
313311
|
+
str = "";
|
|
313312
|
+
for (var i3 = 0;i3 < length67; ++i3) {
|
|
313313
|
+
str += String.fromCharCode(HEAPU8[payload + i3 >>> 0]);
|
|
313314
|
+
}
|
|
313315
|
+
}
|
|
313316
|
+
_free(value);
|
|
313317
|
+
return str;
|
|
313318
|
+
}, toWireType(destructors, value) {
|
|
313319
|
+
if (value instanceof ArrayBuffer) {
|
|
313320
|
+
value = new Uint8Array(value);
|
|
313321
|
+
}
|
|
313322
|
+
var length67;
|
|
313323
|
+
var valueIsOfTypeString = typeof value == "string";
|
|
313324
|
+
if (!(valueIsOfTypeString || ArrayBuffer.isView(value) && value.BYTES_PER_ELEMENT == 1)) {
|
|
313325
|
+
throwBindingError("Cannot pass non-string to std::string");
|
|
313326
|
+
}
|
|
313327
|
+
if (stdStringIsUTF8 && valueIsOfTypeString) {
|
|
313328
|
+
length67 = lengthBytesUTF8(value);
|
|
313329
|
+
} else {
|
|
313330
|
+
length67 = value.length;
|
|
313331
|
+
}
|
|
313332
|
+
var base = _malloc(4 + length67 + 1);
|
|
313333
|
+
var ptr = base + 4;
|
|
313334
|
+
HEAPU32[base >>> 2 >>> 0] = length67;
|
|
313335
|
+
if (valueIsOfTypeString) {
|
|
313336
|
+
if (stdStringIsUTF8) {
|
|
313337
|
+
stringToUTF8(value, ptr, length67 + 1);
|
|
313338
|
+
} else {
|
|
313339
|
+
for (var i3 = 0;i3 < length67; ++i3) {
|
|
313340
|
+
var charCode = value.charCodeAt(i3);
|
|
313341
|
+
if (charCode > 255) {
|
|
313342
|
+
_free(base);
|
|
313343
|
+
throwBindingError("String has UTF-16 code units that do not fit in 8 bits");
|
|
313344
|
+
}
|
|
313345
|
+
HEAPU8[ptr + i3 >>> 0] = charCode;
|
|
313346
|
+
}
|
|
313347
|
+
}
|
|
313348
|
+
} else {
|
|
313349
|
+
HEAPU8.set(value, ptr >>> 0);
|
|
313350
|
+
}
|
|
313351
|
+
if (destructors !== null) {
|
|
313352
|
+
destructors.push(_free, base);
|
|
313353
|
+
}
|
|
313354
|
+
return base;
|
|
313355
|
+
}, readValueFromPointer: readPointer, destructorFunction(ptr) {
|
|
313356
|
+
_free(ptr);
|
|
313357
|
+
} });
|
|
313358
|
+
}
|
|
313359
|
+
var UTF16Decoder = globalThis.TextDecoder ? new TextDecoder("utf-16le") : undefined;
|
|
313360
|
+
var UTF16ToString = (ptr, maxBytesToRead, ignoreNul) => {
|
|
313361
|
+
var idx = ptr >>> 1;
|
|
313362
|
+
var endIdx = findStringEnd(HEAPU16, idx, maxBytesToRead / 2, ignoreNul);
|
|
313363
|
+
if (endIdx - idx > 16 && UTF16Decoder)
|
|
313364
|
+
return UTF16Decoder.decode(HEAPU16.subarray(idx >>> 0, endIdx >>> 0));
|
|
313365
|
+
var str = "";
|
|
313366
|
+
for (var i3 = idx;i3 < endIdx; ++i3) {
|
|
313367
|
+
var codeUnit = HEAPU16[i3 >>> 0];
|
|
313368
|
+
str += String.fromCharCode(codeUnit);
|
|
313369
|
+
}
|
|
313370
|
+
return str;
|
|
313371
|
+
};
|
|
313372
|
+
var stringToUTF16 = (str, outPtr, maxBytesToWrite) => {
|
|
313373
|
+
maxBytesToWrite ??= 2147483647;
|
|
313374
|
+
if (maxBytesToWrite < 2)
|
|
313375
|
+
return 0;
|
|
313376
|
+
maxBytesToWrite -= 2;
|
|
313377
|
+
var startPtr = outPtr;
|
|
313378
|
+
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
313379
|
+
for (var i3 = 0;i3 < numCharsToWrite; ++i3) {
|
|
313380
|
+
var codeUnit = str.charCodeAt(i3);
|
|
313381
|
+
HEAP16[outPtr >>> 1 >>> 0] = codeUnit;
|
|
313382
|
+
outPtr += 2;
|
|
313383
|
+
}
|
|
313384
|
+
HEAP16[outPtr >>> 1 >>> 0] = 0;
|
|
313385
|
+
return outPtr - startPtr;
|
|
313386
|
+
};
|
|
313387
|
+
var lengthBytesUTF16 = (str) => str.length * 2;
|
|
313388
|
+
var UTF32ToString = (ptr, maxBytesToRead, ignoreNul) => {
|
|
313389
|
+
var str = "";
|
|
313390
|
+
var startIdx = ptr >>> 2;
|
|
313391
|
+
for (var i3 = 0;!(i3 >= maxBytesToRead / 4); i3++) {
|
|
313392
|
+
var utf32 = HEAPU32[startIdx + i3 >>> 0];
|
|
313393
|
+
if (!utf32 && !ignoreNul)
|
|
313394
|
+
break;
|
|
313395
|
+
str += String.fromCodePoint(utf32);
|
|
313396
|
+
}
|
|
313397
|
+
return str;
|
|
313398
|
+
};
|
|
313399
|
+
var stringToUTF32 = (str, outPtr, maxBytesToWrite) => {
|
|
313400
|
+
outPtr >>>= 0;
|
|
313401
|
+
maxBytesToWrite ??= 2147483647;
|
|
313402
|
+
if (maxBytesToWrite < 4)
|
|
313403
|
+
return 0;
|
|
313404
|
+
var startPtr = outPtr;
|
|
313405
|
+
var endPtr = startPtr + maxBytesToWrite - 4;
|
|
313406
|
+
for (var i3 = 0;i3 < str.length; ++i3) {
|
|
313407
|
+
var codePoint = str.codePointAt(i3);
|
|
313408
|
+
if (codePoint > 65535) {
|
|
313409
|
+
i3++;
|
|
313410
|
+
}
|
|
313411
|
+
HEAP32[outPtr >>> 2 >>> 0] = codePoint;
|
|
313412
|
+
outPtr += 4;
|
|
313413
|
+
if (outPtr + 4 > endPtr)
|
|
313414
|
+
break;
|
|
313415
|
+
}
|
|
313416
|
+
HEAP32[outPtr >>> 2 >>> 0] = 0;
|
|
313417
|
+
return outPtr - startPtr;
|
|
313418
|
+
};
|
|
313419
|
+
var lengthBytesUTF32 = (str) => {
|
|
313420
|
+
var len = 0;
|
|
313421
|
+
for (var i3 = 0;i3 < str.length; ++i3) {
|
|
313422
|
+
var codePoint = str.codePointAt(i3);
|
|
313423
|
+
if (codePoint > 65535) {
|
|
313424
|
+
i3++;
|
|
313425
|
+
}
|
|
313426
|
+
len += 4;
|
|
313427
|
+
}
|
|
313428
|
+
return len;
|
|
313429
|
+
};
|
|
313430
|
+
function __embind_register_std_wstring(rawType, charSize, name) {
|
|
313431
|
+
rawType >>>= 0;
|
|
313432
|
+
charSize >>>= 0;
|
|
313433
|
+
name >>>= 0;
|
|
313434
|
+
name = AsciiToString(name);
|
|
313435
|
+
var decodeString, encodeString, lengthBytesUTF;
|
|
313436
|
+
if (charSize === 2) {
|
|
313437
|
+
decodeString = UTF16ToString;
|
|
313438
|
+
encodeString = stringToUTF16;
|
|
313439
|
+
lengthBytesUTF = lengthBytesUTF16;
|
|
313440
|
+
} else {
|
|
313441
|
+
decodeString = UTF32ToString;
|
|
313442
|
+
encodeString = stringToUTF32;
|
|
313443
|
+
lengthBytesUTF = lengthBytesUTF32;
|
|
313444
|
+
}
|
|
313445
|
+
registerType(rawType, { name, fromWireType: (value) => {
|
|
313446
|
+
var length67 = HEAPU32[value >>> 2 >>> 0];
|
|
313447
|
+
var str = decodeString(value + 4, length67 * charSize, true);
|
|
313448
|
+
_free(value);
|
|
313449
|
+
return str;
|
|
313450
|
+
}, toWireType: (destructors, value) => {
|
|
313451
|
+
if (!(typeof value == "string")) {
|
|
313452
|
+
throwBindingError(`Cannot pass non-string to C++ string type ${name}`);
|
|
313453
|
+
}
|
|
313454
|
+
var length67 = lengthBytesUTF(value);
|
|
313455
|
+
var ptr = _malloc(4 + length67 + charSize);
|
|
313456
|
+
HEAPU32[ptr >>> 2 >>> 0] = length67 / charSize;
|
|
313457
|
+
encodeString(value, ptr + 4, length67 + charSize);
|
|
313458
|
+
if (destructors !== null) {
|
|
313459
|
+
destructors.push(_free, ptr);
|
|
313460
|
+
}
|
|
313461
|
+
return ptr;
|
|
313462
|
+
}, readValueFromPointer: readPointer, destructorFunction(ptr) {
|
|
313463
|
+
_free(ptr);
|
|
313464
|
+
} });
|
|
313465
|
+
}
|
|
313466
|
+
function __embind_register_value_object(rawType, name, constructorSignature, rawConstructor, destructorSignature, rawDestructor) {
|
|
313467
|
+
rawType >>>= 0;
|
|
313468
|
+
name >>>= 0;
|
|
313469
|
+
constructorSignature >>>= 0;
|
|
313470
|
+
rawConstructor >>>= 0;
|
|
313471
|
+
destructorSignature >>>= 0;
|
|
313472
|
+
rawDestructor >>>= 0;
|
|
313473
|
+
structRegistrations[rawType] = { name: AsciiToString(name), rawConstructor: embind__requireFunction(constructorSignature, rawConstructor), rawDestructor: embind__requireFunction(destructorSignature, rawDestructor), fields: [] };
|
|
313474
|
+
}
|
|
313475
|
+
function __embind_register_value_object_field(structType, fieldName, getterReturnType, getterSignature, getter, getterContext, setterArgumentType, setterSignature, setter, setterContext) {
|
|
313476
|
+
structType >>>= 0;
|
|
313477
|
+
fieldName >>>= 0;
|
|
313478
|
+
getterReturnType >>>= 0;
|
|
313479
|
+
getterSignature >>>= 0;
|
|
313480
|
+
getter >>>= 0;
|
|
313481
|
+
getterContext >>>= 0;
|
|
313482
|
+
setterArgumentType >>>= 0;
|
|
313483
|
+
setterSignature >>>= 0;
|
|
313484
|
+
setter >>>= 0;
|
|
313485
|
+
setterContext >>>= 0;
|
|
313486
|
+
structRegistrations[structType].fields.push({ fieldName: AsciiToString(fieldName), getterReturnType, getter: embind__requireFunction(getterSignature, getter), getterContext, setterArgumentType, setter: embind__requireFunction(setterSignature, setter), setterContext });
|
|
313487
|
+
}
|
|
313488
|
+
var __embind_register_void = function(rawType, name) {
|
|
313489
|
+
rawType >>>= 0;
|
|
313490
|
+
name >>>= 0;
|
|
313491
|
+
name = AsciiToString(name);
|
|
313492
|
+
registerType(rawType, { isVoid: true, name, fromWireType: () => {
|
|
313493
|
+
return;
|
|
313494
|
+
}, toWireType: (destructors, o3) => {
|
|
313495
|
+
return;
|
|
313496
|
+
} });
|
|
313497
|
+
};
|
|
313498
|
+
function __emval_array_to_memory_view(dst, src) {
|
|
313499
|
+
dst >>>= 0;
|
|
313500
|
+
src >>>= 0;
|
|
313501
|
+
dst = Emval.toValue(dst);
|
|
313502
|
+
src = Emval.toValue(src);
|
|
313503
|
+
dst.set(src);
|
|
313504
|
+
}
|
|
313505
|
+
var emval_methodCallers = [];
|
|
313506
|
+
var emval_addMethodCaller = (caller) => {
|
|
313507
|
+
var id2 = emval_methodCallers.length;
|
|
313508
|
+
emval_methodCallers.push(caller);
|
|
313509
|
+
return id2;
|
|
313510
|
+
};
|
|
313511
|
+
var emval_lookupTypes = (argCount, argTypes) => {
|
|
313512
|
+
var a2 = new Array(argCount);
|
|
313513
|
+
for (var i3 = 0;i3 < argCount; ++i3) {
|
|
313514
|
+
a2[i3] = requireRegisteredType(HEAPU32[argTypes + i3 * 4 >>> 2 >>> 0], `parameter ${i3}`);
|
|
313515
|
+
}
|
|
313516
|
+
return a2;
|
|
313517
|
+
};
|
|
313518
|
+
var emval_returnValue = (toReturnWire, destructorsRef, handle) => {
|
|
313519
|
+
var destructors = [];
|
|
313520
|
+
var result = toReturnWire(destructors, handle);
|
|
313521
|
+
if (destructors.length) {
|
|
313522
|
+
HEAPU32[destructorsRef >>> 2 >>> 0] = Emval.toHandle(destructors);
|
|
313523
|
+
}
|
|
313524
|
+
return result;
|
|
313525
|
+
};
|
|
313526
|
+
var emval_symbols = {};
|
|
313527
|
+
var getStringOrSymbol = (address) => {
|
|
313528
|
+
var symbol = emval_symbols[address];
|
|
313529
|
+
if (symbol === undefined) {
|
|
313530
|
+
return AsciiToString(address);
|
|
313531
|
+
}
|
|
313532
|
+
return symbol;
|
|
313533
|
+
};
|
|
313534
|
+
var __emval_create_invoker = function(argCount, argTypesPtr, kind) {
|
|
313535
|
+
argTypesPtr >>>= 0;
|
|
313536
|
+
var GenericWireTypeSize = 8;
|
|
313537
|
+
var [retType, ...argTypes] = emval_lookupTypes(argCount, argTypesPtr);
|
|
313538
|
+
var toReturnWire = retType.toWireType.bind(retType);
|
|
313539
|
+
var argFromPtr = argTypes.map((type) => type.readValueFromPointer.bind(type));
|
|
313540
|
+
argCount--;
|
|
313541
|
+
var captures = { toValue: Emval.toValue };
|
|
313542
|
+
var args = argFromPtr.map((argFromPtr2, i3) => {
|
|
313543
|
+
var captureName = `argFromPtr${i3}`;
|
|
313544
|
+
captures[captureName] = argFromPtr2;
|
|
313545
|
+
return `${captureName}(args${i3 ? "+" + i3 * GenericWireTypeSize : ""})`;
|
|
313546
|
+
});
|
|
313547
|
+
var functionBody;
|
|
313548
|
+
switch (kind) {
|
|
313549
|
+
case 0:
|
|
313550
|
+
functionBody = "toValue(handle)";
|
|
313551
|
+
break;
|
|
313552
|
+
case 2:
|
|
313553
|
+
functionBody = "new (toValue(handle))";
|
|
313554
|
+
break;
|
|
313555
|
+
case 3:
|
|
313556
|
+
functionBody = "";
|
|
313557
|
+
break;
|
|
313558
|
+
case 1:
|
|
313559
|
+
captures["getStringOrSymbol"] = getStringOrSymbol;
|
|
313560
|
+
functionBody = "toValue(handle)[getStringOrSymbol(methodName)]";
|
|
313561
|
+
break;
|
|
313562
|
+
}
|
|
313563
|
+
functionBody += `(${args})`;
|
|
313564
|
+
if (!retType.isVoid) {
|
|
313565
|
+
captures["toReturnWire"] = toReturnWire;
|
|
313566
|
+
captures["emval_returnValue"] = emval_returnValue;
|
|
313567
|
+
functionBody = `return emval_returnValue(toReturnWire, destructorsRef, ${functionBody})`;
|
|
313568
|
+
}
|
|
313569
|
+
functionBody = `return function (handle, methodName, destructorsRef, args) {
|
|
313570
|
+
${functionBody}
|
|
313571
|
+
}`;
|
|
313572
|
+
var invokerFunction = new Function(Object.keys(captures), functionBody)(...Object.values(captures));
|
|
313573
|
+
var functionName = `methodCaller<(${argTypes.map((t49) => t49.name)}) => ${retType.name}>`;
|
|
313574
|
+
return emval_addMethodCaller(createNamedFunction(functionName, invokerFunction));
|
|
313575
|
+
};
|
|
313576
|
+
function __emval_equals(first, second) {
|
|
313577
|
+
first >>>= 0;
|
|
313578
|
+
second >>>= 0;
|
|
313579
|
+
first = Emval.toValue(first);
|
|
313580
|
+
second = Emval.toValue(second);
|
|
313581
|
+
return first == second;
|
|
313582
|
+
}
|
|
313583
|
+
function __emval_get_property(handle, key) {
|
|
313584
|
+
handle >>>= 0;
|
|
313585
|
+
key >>>= 0;
|
|
313586
|
+
handle = Emval.toValue(handle);
|
|
313587
|
+
key = Emval.toValue(key);
|
|
313588
|
+
return Emval.toHandle(handle[key]);
|
|
313589
|
+
}
|
|
313590
|
+
function __emval_incref(handle) {
|
|
313591
|
+
handle >>>= 0;
|
|
313592
|
+
if (handle > 9) {
|
|
313593
|
+
emval_handles[handle + 1] += 1;
|
|
313594
|
+
}
|
|
313595
|
+
}
|
|
313596
|
+
function __emval_invoke(caller, handle, methodName, destructorsRef, args) {
|
|
313597
|
+
caller >>>= 0;
|
|
313598
|
+
handle >>>= 0;
|
|
313599
|
+
methodName >>>= 0;
|
|
313600
|
+
destructorsRef >>>= 0;
|
|
313601
|
+
args >>>= 0;
|
|
313602
|
+
return emval_methodCallers[caller](handle, methodName, destructorsRef, args);
|
|
313603
|
+
}
|
|
313604
|
+
function __emval_new_cstring(v4) {
|
|
313605
|
+
v4 >>>= 0;
|
|
313606
|
+
return Emval.toHandle(getStringOrSymbol(v4));
|
|
313607
|
+
}
|
|
313608
|
+
function __emval_new_object() {
|
|
313609
|
+
return Emval.toHandle({});
|
|
313610
|
+
}
|
|
313611
|
+
function __emval_run_destructors(handle) {
|
|
313612
|
+
handle >>>= 0;
|
|
313613
|
+
var destructors = Emval.toValue(handle);
|
|
313614
|
+
runDestructors(destructors);
|
|
313615
|
+
__emval_decref(handle);
|
|
313616
|
+
}
|
|
313617
|
+
function __emval_set_property(handle, key, value) {
|
|
313618
|
+
handle >>>= 0;
|
|
313619
|
+
key >>>= 0;
|
|
313620
|
+
value >>>= 0;
|
|
313621
|
+
handle = Emval.toValue(handle);
|
|
313622
|
+
key = Emval.toValue(key);
|
|
313623
|
+
value = Emval.toValue(value);
|
|
313624
|
+
handle[key] = value;
|
|
313625
|
+
}
|
|
313626
|
+
var getHeapMax = () => 4294901760;
|
|
313627
|
+
var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
|
|
313628
|
+
var growMemory = (size) => {
|
|
313629
|
+
var oldHeapSize = wasmMemory.buffer.byteLength;
|
|
313630
|
+
var pages = (size - oldHeapSize + 65535) / 65536 | 0;
|
|
313631
|
+
try {
|
|
313632
|
+
wasmMemory.grow(pages);
|
|
313633
|
+
updateMemoryViews();
|
|
313634
|
+
return 1;
|
|
313635
|
+
} catch (e4) {}
|
|
313636
|
+
};
|
|
313637
|
+
function _emscripten_resize_heap(requestedSize) {
|
|
313638
|
+
requestedSize >>>= 0;
|
|
313639
|
+
var oldSize = HEAPU8.length;
|
|
313640
|
+
var maxHeapSize = getHeapMax();
|
|
313641
|
+
if (requestedSize > maxHeapSize) {
|
|
313642
|
+
return false;
|
|
313643
|
+
}
|
|
313644
|
+
for (var cutDown = 1;cutDown <= 4; cutDown *= 2) {
|
|
313645
|
+
var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
|
|
313646
|
+
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
|
|
313647
|
+
var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
|
|
313648
|
+
var replacement = growMemory(newSize);
|
|
313649
|
+
if (replacement) {
|
|
313650
|
+
return true;
|
|
313651
|
+
}
|
|
313652
|
+
}
|
|
313653
|
+
return false;
|
|
313654
|
+
}
|
|
313655
|
+
var updateTableMap = (offset, count) => {
|
|
313656
|
+
if (functionsInTableMap) {
|
|
313657
|
+
for (var i3 = offset;i3 < offset + count; i3++) {
|
|
313658
|
+
var item = getWasmTableEntry(i3);
|
|
313659
|
+
if (item) {
|
|
313660
|
+
functionsInTableMap.set(item, i3);
|
|
313661
|
+
}
|
|
313662
|
+
}
|
|
313663
|
+
}
|
|
313664
|
+
};
|
|
313665
|
+
var functionsInTableMap;
|
|
313666
|
+
var getFunctionAddress = (func) => {
|
|
313667
|
+
if (!functionsInTableMap) {
|
|
313668
|
+
functionsInTableMap = new WeakMap;
|
|
313669
|
+
updateTableMap(0, wasmTable.length);
|
|
313670
|
+
}
|
|
313671
|
+
return functionsInTableMap.get(func) || 0;
|
|
313672
|
+
};
|
|
313673
|
+
var freeTableIndexes = [];
|
|
313674
|
+
var getEmptyTableSlot = () => {
|
|
313675
|
+
if (freeTableIndexes.length) {
|
|
313676
|
+
return freeTableIndexes.pop();
|
|
313677
|
+
}
|
|
313678
|
+
return wasmTable["grow"](1);
|
|
313679
|
+
};
|
|
313680
|
+
var setWasmTableEntry = (idx, func) => wasmTable.set(idx, func);
|
|
313681
|
+
var uleb128EncodeWithLen = (arr) => {
|
|
313682
|
+
const n3 = arr.length;
|
|
313683
|
+
return [n3 % 128 | 128, n3 >> 7, ...arr];
|
|
313684
|
+
};
|
|
313685
|
+
var wasmTypeCodes = { i: 127, p: 127, j: 126, f: 125, d: 124, e: 111 };
|
|
313686
|
+
var generateTypePack = (types3) => uleb128EncodeWithLen(Array.from(types3, (type) => {
|
|
313687
|
+
var code = wasmTypeCodes[type];
|
|
313688
|
+
return code;
|
|
313689
|
+
}));
|
|
313690
|
+
var convertJsFunctionToWasm = (func, sig) => {
|
|
313691
|
+
var bytes = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, ...uleb128EncodeWithLen([1, 96, ...generateTypePack(sig.slice(1)), ...generateTypePack(sig[0] === "v" ? "" : sig[0])]), 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0);
|
|
313692
|
+
var module2 = new WebAssembly.Module(bytes);
|
|
313693
|
+
var instance = new WebAssembly.Instance(module2, { e: { f: func } });
|
|
313694
|
+
var wrappedFunc = instance.exports["f"];
|
|
313695
|
+
return wrappedFunc;
|
|
313696
|
+
};
|
|
313697
|
+
var addFunction = (func, sig) => {
|
|
313698
|
+
var rtn = getFunctionAddress(func);
|
|
313699
|
+
if (rtn) {
|
|
313700
|
+
return rtn;
|
|
313701
|
+
}
|
|
313702
|
+
var ret = getEmptyTableSlot();
|
|
313703
|
+
try {
|
|
313704
|
+
setWasmTableEntry(ret, func);
|
|
313705
|
+
} catch (err3) {
|
|
313706
|
+
if (!(err3 instanceof TypeError)) {
|
|
313707
|
+
throw err3;
|
|
313708
|
+
}
|
|
313709
|
+
var wrapped = convertJsFunctionToWasm(func, sig);
|
|
313710
|
+
setWasmTableEntry(ret, wrapped);
|
|
313711
|
+
}
|
|
313712
|
+
functionsInTableMap.set(func, ret);
|
|
313713
|
+
return ret;
|
|
313714
|
+
};
|
|
313715
|
+
var removeFunction = (index) => {
|
|
313716
|
+
functionsInTableMap.delete(getWasmTableEntry(index));
|
|
313717
|
+
setWasmTableEntry(index, null);
|
|
313718
|
+
freeTableIndexes.push(index);
|
|
313719
|
+
};
|
|
313720
|
+
init_ClassHandle();
|
|
313721
|
+
init_RegisteredPointer();
|
|
313722
|
+
{
|
|
313723
|
+
if (Module2["noExitRuntime"])
|
|
313724
|
+
noExitRuntime = Module2["noExitRuntime"];
|
|
313725
|
+
if (Module2["print"])
|
|
313726
|
+
out = Module2["print"];
|
|
313727
|
+
if (Module2["printErr"])
|
|
313728
|
+
err2 = Module2["printErr"];
|
|
313729
|
+
if (Module2["wasmBinary"])
|
|
313730
|
+
wasmBinary = Module2["wasmBinary"];
|
|
313731
|
+
if (Module2["arguments"])
|
|
313732
|
+
arguments_ = Module2["arguments"];
|
|
313733
|
+
if (Module2["thisProgram"])
|
|
313734
|
+
thisProgram = Module2["thisProgram"];
|
|
313735
|
+
if (Module2["preInit"]) {
|
|
313736
|
+
if (typeof Module2["preInit"] == "function")
|
|
313737
|
+
Module2["preInit"] = [Module2["preInit"]];
|
|
313738
|
+
while (Module2["preInit"].length > 0) {
|
|
313739
|
+
Module2["preInit"].shift()();
|
|
313740
|
+
}
|
|
313741
|
+
}
|
|
313742
|
+
}
|
|
313743
|
+
Module2["addFunction"] = addFunction;
|
|
313744
|
+
Module2["removeFunction"] = removeFunction;
|
|
313745
|
+
var ___getTypeName, _malloc, _free, memory, __indirect_function_table, wasmMemory, wasmTable;
|
|
313746
|
+
function assignWasmExports(wasmExports2) {
|
|
313747
|
+
___getTypeName = wasmExports2["K"];
|
|
313748
|
+
_malloc = wasmExports2["M"];
|
|
313749
|
+
_free = wasmExports2["N"];
|
|
313750
|
+
memory = wasmMemory = wasmExports2["I"];
|
|
313751
|
+
__indirect_function_table = wasmTable = wasmExports2["L"];
|
|
313752
|
+
}
|
|
313753
|
+
var wasmImports = { l: ___cxa_throw, C: __abort_js, q: __embind_finalize_value_object, z: __embind_register_bigint, G: __embind_register_bool, j: __embind_register_class, i: __embind_register_class_constructor, a: __embind_register_class_function, E: __embind_register_emval, x: __embind_register_enum, d: __embind_register_enum_value, y: __embind_register_float, c: __embind_register_function, p: __embind_register_integer, m: __embind_register_iterable, h: __embind_register_memory_view, n: __embind_register_optional, F: __embind_register_std_string, w: __embind_register_std_wstring, r: __embind_register_value_object, k: __embind_register_value_object_field, H: __embind_register_void, u: __emval_array_to_memory_view, g: __emval_create_invoker, b: __emval_decref, o: __emval_equals, B: __emval_get_property, t: __emval_incref, f: __emval_invoke, s: __emval_new_cstring, A: __emval_new_object, e: __emval_run_destructors, v: __emval_set_property, D: _emscripten_resize_heap };
|
|
313754
|
+
function applySignatureConversions(wasmExports2) {
|
|
313755
|
+
wasmExports2 = Object.assign({}, wasmExports2);
|
|
313756
|
+
var makeWrapper_pp = (f2) => (a02) => f2(a02) >>> 0;
|
|
313757
|
+
var makeWrapper_p = (f2) => () => f2() >>> 0;
|
|
313758
|
+
wasmExports2["K"] = makeWrapper_pp(wasmExports2["K"]);
|
|
313759
|
+
wasmExports2["M"] = makeWrapper_pp(wasmExports2["M"]);
|
|
313760
|
+
wasmExports2["_emscripten_stack_alloc"] = makeWrapper_pp(wasmExports2["_emscripten_stack_alloc"]);
|
|
313761
|
+
wasmExports2["emscripten_stack_get_current"] = makeWrapper_p(wasmExports2["emscripten_stack_get_current"]);
|
|
313762
|
+
return wasmExports2;
|
|
313763
|
+
}
|
|
313764
|
+
function run2() {
|
|
313765
|
+
preRun();
|
|
313766
|
+
function doRun() {
|
|
313767
|
+
Module2["calledRun"] = true;
|
|
313768
|
+
if (ABORT)
|
|
313769
|
+
return;
|
|
313770
|
+
initRuntime();
|
|
313771
|
+
readyPromiseResolve?.(Module2);
|
|
313772
|
+
Module2["onRuntimeInitialized"]?.();
|
|
313773
|
+
postRun();
|
|
313774
|
+
}
|
|
313775
|
+
if (Module2["setStatus"]) {
|
|
313776
|
+
Module2["setStatus"]("Running...");
|
|
313777
|
+
setTimeout(() => {
|
|
313778
|
+
setTimeout(() => Module2["setStatus"](""), 1);
|
|
313779
|
+
doRun();
|
|
313780
|
+
}, 1);
|
|
313781
|
+
} else {
|
|
313782
|
+
doRun();
|
|
313783
|
+
}
|
|
313784
|
+
}
|
|
313785
|
+
var wasmExports;
|
|
313786
|
+
wasmExports = await createWasm();
|
|
313787
|
+
run2();
|
|
313788
|
+
if (runtimeInitialized) {
|
|
313789
|
+
moduleRtn = Module2;
|
|
313790
|
+
} else {
|
|
313791
|
+
moduleRtn = new Promise((resolve11, reject) => {
|
|
313792
|
+
readyPromiseResolve = resolve11;
|
|
313793
|
+
readyPromiseReject = reject;
|
|
313794
|
+
});
|
|
313795
|
+
}
|
|
313796
|
+
return moduleRtn;
|
|
313797
|
+
}
|
|
313798
|
+
var manifold_default = Module;
|
|
313799
|
+
|
|
313800
|
+
// node_modules/circuit-json-to-fdm-component-box/dist/chunk-7FCNDFKL.js
|
|
313801
|
+
init_esm();
|
|
313802
|
+
import outlinePolygons from "@tscircuit/alphabet/outline-polygons";
|
|
313803
|
+
import {
|
|
313804
|
+
glyphAdvanceRatio as glyphAdvanceRatio4,
|
|
313805
|
+
kerningRatio as kerningRatio2,
|
|
313806
|
+
spaceWidthRatio as spaceWidthRatio3,
|
|
313807
|
+
textMetrics as textMetrics2
|
|
313808
|
+
} from "@tscircuit/alphabet";
|
|
313809
|
+
var naturalRefdesCollator = new Intl.Collator("en", {
|
|
313810
|
+
numeric: true,
|
|
313811
|
+
sensitivity: "base"
|
|
313812
|
+
});
|
|
313813
|
+
var asCircuitRecord = (value) => {
|
|
313814
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
313815
|
+
return;
|
|
313816
|
+
}
|
|
313817
|
+
return value;
|
|
313818
|
+
};
|
|
313819
|
+
var normalizeIdentity = (value) => value.trim().replace(/\s+/g, " ").toUpperCase();
|
|
313820
|
+
var getSupplierPartNumbers = (value) => {
|
|
313821
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
313822
|
+
return;
|
|
313823
|
+
}
|
|
313824
|
+
const entries = [];
|
|
313825
|
+
for (const [supplier, partNumbers] of Object.entries(value)) {
|
|
313826
|
+
if (!Array.isArray(partNumbers))
|
|
313827
|
+
continue;
|
|
313828
|
+
const normalized = partNumbers.filter((partNumber) => typeof partNumber === "string").map((partNumber) => partNumber.trim()).filter(Boolean);
|
|
313829
|
+
if (normalized.length > 0)
|
|
313830
|
+
entries.push([supplier, normalized]);
|
|
313831
|
+
}
|
|
313832
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
313833
|
+
};
|
|
313834
|
+
var supplierPriority = [
|
|
313835
|
+
"jlcpcb",
|
|
313836
|
+
"lcsc",
|
|
313837
|
+
"digikey",
|
|
313838
|
+
"mouser",
|
|
313839
|
+
"pcbway",
|
|
313840
|
+
"macrofab"
|
|
313841
|
+
];
|
|
313842
|
+
var getPreferredSupplierIdentity = (supplierPartNumbers) => {
|
|
313843
|
+
if (!supplierPartNumbers)
|
|
313844
|
+
return;
|
|
313845
|
+
const suppliers = Object.keys(supplierPartNumbers).sort((a2, b3) => {
|
|
313846
|
+
const aPriority = supplierPriority.indexOf(a2.toLowerCase());
|
|
313847
|
+
const bPriority = supplierPriority.indexOf(b3.toLowerCase());
|
|
313848
|
+
return (aPriority < 0 ? Number.POSITIVE_INFINITY : aPriority) - (bPriority < 0 ? Number.POSITIVE_INFINITY : bPriority) || a2.localeCompare(b3);
|
|
313849
|
+
});
|
|
313850
|
+
const supplier = suppliers[0];
|
|
313851
|
+
const partNumber = supplier ? supplierPartNumbers[supplier]?.[0] : undefined;
|
|
313852
|
+
return supplier && partNumber ? `supplier:${supplier.toLowerCase()}:${normalizeIdentity(partNumber)}` : undefined;
|
|
313853
|
+
};
|
|
313854
|
+
var getPassiveValue = (source) => {
|
|
313855
|
+
switch (source.ftype) {
|
|
313856
|
+
case "simple_resistor":
|
|
313857
|
+
return source.resistance;
|
|
313858
|
+
case "simple_capacitor":
|
|
313859
|
+
return source.capacitance;
|
|
313860
|
+
case "simple_inductor":
|
|
313861
|
+
return source.inductance;
|
|
313862
|
+
default:
|
|
313863
|
+
return;
|
|
313864
|
+
}
|
|
313865
|
+
};
|
|
313866
|
+
var getComponentKey = (component, groupByComponent) => {
|
|
313867
|
+
const sourceId = component.source.source_component_id;
|
|
313868
|
+
if (!groupByComponent)
|
|
313869
|
+
return `source:${sourceId}`;
|
|
313870
|
+
const manufacturerPartNumber = component.source.manufacturer_part_number;
|
|
313871
|
+
if (typeof manufacturerPartNumber === "string" && manufacturerPartNumber.trim()) {
|
|
313872
|
+
return `mpn:${normalizeIdentity(manufacturerPartNumber)}`;
|
|
313873
|
+
}
|
|
313874
|
+
const supplierIdentity = getPreferredSupplierIdentity(getSupplierPartNumbers(component.source.supplier_part_numbers));
|
|
313875
|
+
if (supplierIdentity)
|
|
313876
|
+
return supplierIdentity;
|
|
313877
|
+
const passiveValue = getPassiveValue(component.source);
|
|
313878
|
+
const packageIdentity = component.footprint ?? component.physicalSize;
|
|
313879
|
+
if (passiveValue !== undefined && passiveValue !== null && packageIdentity && typeof component.source.ftype === "string") {
|
|
313880
|
+
return `passive:${component.source.ftype}:${String(passiveValue)}:${normalizeIdentity(packageIdentity)}`;
|
|
313881
|
+
}
|
|
313882
|
+
return `source:${sourceId}`;
|
|
313883
|
+
};
|
|
313884
|
+
var selectComponents = (circuitJson, options) => {
|
|
313885
|
+
if (!Array.isArray(circuitJson)) {
|
|
313886
|
+
throw new TypeError("Circuit JSON must be an array");
|
|
313887
|
+
}
|
|
313888
|
+
const sources = [];
|
|
313889
|
+
const placedBySourceId = /* @__PURE__ */ new Map;
|
|
313890
|
+
const cadByPcbComponentId = /* @__PURE__ */ new Map;
|
|
313891
|
+
let hasPcbComponents = false;
|
|
313892
|
+
for (const element of circuitJson) {
|
|
313893
|
+
const record = asCircuitRecord(element);
|
|
313894
|
+
if (!record)
|
|
313895
|
+
continue;
|
|
313896
|
+
if (record.type === "source_component") {
|
|
313897
|
+
if (typeof record.source_component_id !== "string" || record.source_component_id.trim() === "" || typeof record.name !== "string" || record.name.trim() === "") {
|
|
313898
|
+
throw new TypeError("Every source_component must have non-empty source_component_id and name fields");
|
|
313899
|
+
}
|
|
313900
|
+
sources.push(record);
|
|
313901
|
+
}
|
|
313902
|
+
if (record.type === "pcb_component") {
|
|
313903
|
+
hasPcbComponents = true;
|
|
313904
|
+
if (record.do_not_place !== true && typeof record.source_component_id === "string") {
|
|
313905
|
+
placedBySourceId.set(record.source_component_id, record);
|
|
313906
|
+
}
|
|
313907
|
+
}
|
|
313908
|
+
if (record.type === "cad_component" && typeof record.pcb_component_id === "string") {
|
|
313909
|
+
cadByPcbComponentId.set(record.pcb_component_id, record);
|
|
313910
|
+
}
|
|
313911
|
+
}
|
|
313912
|
+
const shouldFilterUnplaced = !options.includeUnplacedComponents && hasPcbComponents;
|
|
313913
|
+
const selected = sources.filter((source) => {
|
|
313914
|
+
if (!options.includeTestPoints && source.ftype === "simple_test_point") {
|
|
313915
|
+
return false;
|
|
313916
|
+
}
|
|
313917
|
+
return !shouldFilterUnplaced || placedBySourceId.has(source.source_component_id);
|
|
313918
|
+
}).map((source) => {
|
|
313919
|
+
const pcb = placedBySourceId.get(source.source_component_id);
|
|
313920
|
+
const cad = pcb && typeof pcb.pcb_component_id === "string" ? cadByPcbComponentId.get(pcb.pcb_component_id) : undefined;
|
|
313921
|
+
const footprint = typeof cad?.footprinter_string === "string" && cad.footprinter_string.trim() ? cad.footprinter_string.trim() : undefined;
|
|
313922
|
+
const physicalSize = typeof pcb?.width === "number" && typeof pcb.height === "number" ? `${pcb.width}x${pcb.height}` : undefined;
|
|
313923
|
+
return { source, footprint, physicalSize };
|
|
313924
|
+
});
|
|
313925
|
+
if (selected.length === 0) {
|
|
313926
|
+
throw new Error(shouldFilterUnplaced ? "Circuit JSON has no placed, populated components to assign to compartments" : "Circuit JSON has no components to assign to compartments");
|
|
313927
|
+
}
|
|
313928
|
+
const duplicateRefdes = selected.map(({ source }) => source.name.trim()).find((refdes, index, all) => all.indexOf(refdes) !== index);
|
|
313929
|
+
if (duplicateRefdes) {
|
|
313930
|
+
throw new Error(`Duplicate component refdes: ${duplicateRefdes}`);
|
|
313931
|
+
}
|
|
313932
|
+
return selected;
|
|
313933
|
+
};
|
|
313934
|
+
var extractComponentGroups = (circuitJson, options = {}) => {
|
|
313935
|
+
const groupByComponent = options.groupByComponent ?? true;
|
|
313936
|
+
const grouped = /* @__PURE__ */ new Map;
|
|
313937
|
+
for (const component of selectComponents(circuitJson, options)) {
|
|
313938
|
+
const componentKey = getComponentKey(component, groupByComponent);
|
|
313939
|
+
const refdes = component.source.name.trim();
|
|
313940
|
+
const existing = grouped.get(componentKey);
|
|
313941
|
+
if (existing) {
|
|
313942
|
+
existing.referenceDesignators.push(refdes);
|
|
313943
|
+
existing.quantity += 1;
|
|
313944
|
+
continue;
|
|
313945
|
+
}
|
|
313946
|
+
const manufacturerPartNumber = typeof component.source.manufacturer_part_number === "string" && component.source.manufacturer_part_number.trim() ? component.source.manufacturer_part_number.trim() : undefined;
|
|
313947
|
+
grouped.set(componentKey, {
|
|
313948
|
+
componentKey,
|
|
313949
|
+
referenceDesignators: [refdes],
|
|
313950
|
+
quantity: 1,
|
|
313951
|
+
componentType: typeof component.source.ftype === "string" ? component.source.ftype : undefined,
|
|
313952
|
+
manufacturerPartNumber,
|
|
313953
|
+
supplierPartNumbers: getSupplierPartNumbers(component.source.supplier_part_numbers),
|
|
313954
|
+
footprint: component.footprint
|
|
313955
|
+
});
|
|
313956
|
+
}
|
|
313957
|
+
const groups = [...grouped.values()];
|
|
313958
|
+
for (const group of groups) {
|
|
313959
|
+
group.referenceDesignators.sort((a2, b3) => naturalRefdesCollator.compare(a2, b3));
|
|
313960
|
+
}
|
|
313961
|
+
return groups.sort((a2, b3) => naturalRefdesCollator.compare(a2.referenceDesignators[0], b3.referenceDesignators[0]));
|
|
313962
|
+
};
|
|
313963
|
+
var DEFAULT_FDM_COMPONENT_BOX_OPTIONS = {
|
|
313964
|
+
compartmentWidth: 26,
|
|
313965
|
+
compartmentDepth: 22,
|
|
313966
|
+
compartmentHeight: 12,
|
|
313967
|
+
wallThickness: 1.6,
|
|
313968
|
+
floorThickness: 1.6,
|
|
313969
|
+
labelBandDepth: 6.5,
|
|
313970
|
+
labelThickness: 0.6,
|
|
313971
|
+
labelPadding: 0.75,
|
|
313972
|
+
minimumLabelStrokeWidth: 0.45,
|
|
313973
|
+
includeUnplacedComponents: false,
|
|
313974
|
+
includeTestPoints: false,
|
|
313975
|
+
groupByComponent: true,
|
|
313976
|
+
boxColor: "#D9D9D9FF",
|
|
313977
|
+
labelColor: "#151515FF"
|
|
313978
|
+
};
|
|
313979
|
+
var pointsMatch = (a2, b3) => Math.abs(a2.x - b3.x) < 0.000000000001 && Math.abs(a2.y - b3.y) < 0.000000000001;
|
|
313980
|
+
var getLabelTextGeometry = (text) => {
|
|
313981
|
+
const contours = [];
|
|
313982
|
+
let cursorX = 0;
|
|
313983
|
+
let previousCharacter;
|
|
313984
|
+
for (const character of text) {
|
|
313985
|
+
if (character === " ") {
|
|
313986
|
+
cursorX += spaceWidthRatio3;
|
|
313987
|
+
previousCharacter = character;
|
|
313988
|
+
continue;
|
|
313989
|
+
}
|
|
313990
|
+
const glyph = outlinePolygons[character];
|
|
313991
|
+
if (!glyph) {
|
|
313992
|
+
throw new Error(`Label ${JSON.stringify(text)} contains unsupported character ${JSON.stringify(character)}`);
|
|
313993
|
+
}
|
|
313994
|
+
cursorX += previousCharacter ? kerningRatio2[previousCharacter]?.[character] ?? 0 : 0;
|
|
313995
|
+
for (const ring of glyph) {
|
|
313996
|
+
const unclosedRing = ring.length > 1 && pointsMatch(ring[0], ring[ring.length - 1]) ? ring.slice(0, -1) : ring;
|
|
313997
|
+
contours.push(unclosedRing.map(({ x: x4, y: y4 }) => ({ x: x4 + cursorX, y: y4 })));
|
|
313998
|
+
}
|
|
313999
|
+
cursorX += glyphAdvanceRatio4[character] ?? spaceWidthRatio3;
|
|
314000
|
+
previousCharacter = character;
|
|
314001
|
+
}
|
|
314002
|
+
if (contours.length === 0) {
|
|
314003
|
+
throw new Error(`Label ${JSON.stringify(text)} has no printable glyphs`);
|
|
314004
|
+
}
|
|
314005
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
314006
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
314007
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
314008
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
314009
|
+
for (const ring of contours) {
|
|
314010
|
+
for (const point9 of ring) {
|
|
314011
|
+
minX = Math.min(minX, point9.x);
|
|
314012
|
+
minY = Math.min(minY, point9.y);
|
|
314013
|
+
maxX = Math.max(maxX, point9.x);
|
|
314014
|
+
maxY = Math.max(maxY, point9.y);
|
|
314015
|
+
}
|
|
314016
|
+
}
|
|
314017
|
+
return {
|
|
314018
|
+
contours,
|
|
314019
|
+
bounds: { minX, minY, maxX, maxY },
|
|
314020
|
+
rawWidth: maxX - minX,
|
|
314021
|
+
rawHeight: maxY - minY
|
|
314022
|
+
};
|
|
314023
|
+
};
|
|
314024
|
+
var getScaledLabelMetrics = (text, availableWidth, availableHeight) => {
|
|
314025
|
+
const geometry = getLabelTextGeometry(text);
|
|
314026
|
+
const scale6 = Math.min(availableWidth / geometry.rawWidth, availableHeight / geometry.rawHeight);
|
|
314027
|
+
return {
|
|
314028
|
+
...geometry,
|
|
314029
|
+
scale: scale6,
|
|
314030
|
+
strokeWidth: textMetrics2.strokeWidthRatio * scale6
|
|
314031
|
+
};
|
|
314032
|
+
};
|
|
314033
|
+
var createLabelManifold = (module2, placement, options, boxHeight) => {
|
|
314034
|
+
const availableWidth = options.compartmentWidth - options.labelPadding * 2;
|
|
314035
|
+
const availableHeight = options.labelBandDepth - options.labelPadding * 2;
|
|
314036
|
+
const { contours, bounds, rawWidth, rawHeight, scale: scale6, strokeWidth } = getScaledLabelMetrics(placement.label, availableWidth, availableHeight);
|
|
314037
|
+
if (strokeWidth < options.minimumLabelStrokeWidth) {
|
|
314038
|
+
throw new Error(`Label ${JSON.stringify(placement.label)} needs a ${strokeWidth.toFixed(3)}mm text stroke, below minimumLabelStrokeWidth ${options.minimumLabelStrokeWidth}mm; increase compartmentWidth or labelBandDepth`);
|
|
314039
|
+
}
|
|
314040
|
+
const scaledWidth = rawWidth * scale6;
|
|
314041
|
+
const scaledHeight = rawHeight * scale6;
|
|
314042
|
+
const offsetX = placement.labelCenter.x - scaledWidth / 2 - bounds.minX * scale6;
|
|
314043
|
+
const offsetY = placement.labelCenter.y - scaledHeight / 2 - bounds.minY * scale6;
|
|
314044
|
+
const transformedContours = contours.map((ring) => ring.map(({ x: x4, y: y4 }) => [x4 * scale6 + offsetX, y4 * scale6 + offsetY]));
|
|
314045
|
+
const crossSection = module2.CrossSection.ofPolygons(transformedContours, "Positive");
|
|
314046
|
+
let unpositioned;
|
|
314047
|
+
try {
|
|
314048
|
+
unpositioned = crossSection.extrude(options.labelThickness);
|
|
314049
|
+
return unpositioned.translate([0, 0, boxHeight]);
|
|
314050
|
+
} finally {
|
|
314051
|
+
unpositioned?.delete();
|
|
314052
|
+
crossSection.delete();
|
|
314053
|
+
}
|
|
314054
|
+
};
|
|
314055
|
+
var manifoldModulePromise;
|
|
314056
|
+
var getManifoldModule = async () => {
|
|
314057
|
+
manifoldModulePromise ??= manifold_default().then((module2) => {
|
|
314058
|
+
module2.setup();
|
|
314059
|
+
return module2;
|
|
314060
|
+
});
|
|
314061
|
+
return manifoldModulePromise;
|
|
314062
|
+
};
|
|
314063
|
+
var copyMesh = (mesh, name, materialIndex) => {
|
|
314064
|
+
const vertices = new Float32Array(mesh.numVert * 3);
|
|
314065
|
+
for (let vertexIndex = 0;vertexIndex < mesh.numVert; vertexIndex += 1) {
|
|
314066
|
+
const sourceOffset = vertexIndex * mesh.numProp;
|
|
314067
|
+
const destinationOffset = vertexIndex * 3;
|
|
314068
|
+
vertices[destinationOffset] = mesh.vertProperties[sourceOffset];
|
|
314069
|
+
vertices[destinationOffset + 1] = mesh.vertProperties[sourceOffset + 1];
|
|
314070
|
+
vertices[destinationOffset + 2] = mesh.vertProperties[sourceOffset + 2];
|
|
314071
|
+
}
|
|
314072
|
+
return {
|
|
314073
|
+
name,
|
|
314074
|
+
vertices,
|
|
314075
|
+
triangles: new Uint32Array(mesh.triVerts),
|
|
314076
|
+
materialIndex
|
|
314077
|
+
};
|
|
314078
|
+
};
|
|
314079
|
+
var deleteAll = (manifolds) => {
|
|
314080
|
+
for (const manifold of manifolds)
|
|
314081
|
+
manifold.delete();
|
|
314082
|
+
};
|
|
314083
|
+
var createPrintableMeshes = async (options, dimensions, compartments) => {
|
|
314084
|
+
const module2 = await getManifoldModule();
|
|
314085
|
+
const { Manifold } = module2;
|
|
314086
|
+
const rowSolids = [];
|
|
314087
|
+
const cavitySolids = [];
|
|
314088
|
+
const labelSolids = [];
|
|
314089
|
+
let outer;
|
|
314090
|
+
let cavityUnion;
|
|
314091
|
+
let box2;
|
|
314092
|
+
try {
|
|
314093
|
+
const rowInnerDepth = options.compartmentDepth + options.labelBandDepth;
|
|
314094
|
+
const rowPitch = rowInnerDepth + options.wallThickness;
|
|
314095
|
+
for (let row = 0;row < dimensions.rows; row += 1) {
|
|
314096
|
+
const rowCellCount = Math.min(options.columns, compartments.length - row * options.columns);
|
|
314097
|
+
const rowWidth = rowCellCount * options.compartmentWidth + (rowCellCount + 1) * options.wallThickness;
|
|
314098
|
+
rowSolids.push(Manifold.cube([
|
|
314099
|
+
rowWidth,
|
|
314100
|
+
rowInnerDepth + options.wallThickness * 2,
|
|
314101
|
+
dimensions.height
|
|
314102
|
+
]).translate([0, row * rowPitch, 0]));
|
|
314103
|
+
}
|
|
314104
|
+
for (const compartment of compartments) {
|
|
314105
|
+
const cavityX = compartment.center.x - options.compartmentWidth / 2;
|
|
314106
|
+
const cavityY = compartment.center.y - options.compartmentDepth / 2;
|
|
314107
|
+
cavitySolids.push(Manifold.cube([
|
|
314108
|
+
options.compartmentWidth,
|
|
314109
|
+
options.compartmentDepth,
|
|
314110
|
+
options.compartmentHeight + 0.1
|
|
314111
|
+
]).translate([cavityX, cavityY, options.floorThickness]));
|
|
314112
|
+
}
|
|
314113
|
+
outer = Manifold.union(rowSolids);
|
|
314114
|
+
cavityUnion = Manifold.union(cavitySolids);
|
|
314115
|
+
box2 = outer.subtract(cavityUnion);
|
|
314116
|
+
if (box2.isEmpty() || box2.status() !== "NoError") {
|
|
314117
|
+
throw new Error(`manifold-3d could not create the box: ${box2.status()}`);
|
|
314118
|
+
}
|
|
314119
|
+
const boxMesh = copyMesh(box2.getMesh(), "Box", 0);
|
|
314120
|
+
const labelMeshes = [];
|
|
314121
|
+
for (const compartment of compartments) {
|
|
314122
|
+
const label = createLabelManifold(module2, compartment, options, dimensions.height);
|
|
314123
|
+
labelSolids.push(label);
|
|
314124
|
+
if (label.isEmpty() || label.status() !== "NoError") {
|
|
314125
|
+
throw new Error(`manifold-3d could not create label ${compartment.refdes}: ${label.status()}`);
|
|
314126
|
+
}
|
|
314127
|
+
labelMeshes.push(copyMesh(label.getMesh(), `Label ${compartment.referenceDesignators.join(",")}`, 1));
|
|
314128
|
+
}
|
|
314129
|
+
return { box: boxMesh, labels: labelMeshes };
|
|
314130
|
+
} finally {
|
|
314131
|
+
box2?.delete();
|
|
314132
|
+
cavityUnion?.delete();
|
|
314133
|
+
outer?.delete();
|
|
314134
|
+
deleteAll(labelSolids);
|
|
314135
|
+
deleteAll(cavitySolids);
|
|
314136
|
+
deleteAll(rowSolids);
|
|
314137
|
+
}
|
|
314138
|
+
};
|
|
314139
|
+
var compactNumericRange = (refdes) => {
|
|
314140
|
+
const parsed = refdes.map((value) => {
|
|
314141
|
+
const match = /^(.*?)(\d+)$/.exec(value);
|
|
314142
|
+
return match ? { prefix: match[1], number: Number(match[2]) } : undefined;
|
|
314143
|
+
});
|
|
314144
|
+
if (parsed.some((value) => !value))
|
|
314145
|
+
return;
|
|
314146
|
+
const values = parsed;
|
|
314147
|
+
const prefix = values[0].prefix;
|
|
314148
|
+
if (values.some((value) => value.prefix !== prefix))
|
|
314149
|
+
return;
|
|
314150
|
+
const ranges = [];
|
|
314151
|
+
for (const number of [...new Set(values.map((value) => value.number))].sort((a2, b3) => a2 - b3)) {
|
|
314152
|
+
const previous = ranges[ranges.length - 1];
|
|
314153
|
+
if (previous && number === previous.end + 1)
|
|
314154
|
+
previous.end = number;
|
|
314155
|
+
else
|
|
314156
|
+
ranges.push({ start: number, end: number });
|
|
314157
|
+
}
|
|
314158
|
+
return ranges.map(({ start, end }) => start === end ? `${prefix}${start}` : `${prefix}${start}-${end}`).join(",");
|
|
314159
|
+
};
|
|
314160
|
+
var middleAbbreviations = (value) => {
|
|
314161
|
+
const abbreviations = [];
|
|
314162
|
+
for (let kept = value.length - 1;kept >= 2; kept -= 1) {
|
|
314163
|
+
const startLength = Math.ceil(kept / 2);
|
|
314164
|
+
const endLength = Math.floor(kept / 2);
|
|
314165
|
+
abbreviations.push(`${value.slice(0, startLength)}...${value.slice(value.length - endLength)}`);
|
|
314166
|
+
}
|
|
314167
|
+
return abbreviations;
|
|
314168
|
+
};
|
|
314169
|
+
var tokenAbbreviations = (value) => {
|
|
314170
|
+
const count = /\+\d+$/.exec(value)?.[0] ?? "";
|
|
314171
|
+
const refdes = count ? value.slice(0, -count.length) : value;
|
|
314172
|
+
const tokens = refdes.split("_");
|
|
314173
|
+
if (tokens.length < 2)
|
|
314174
|
+
return [];
|
|
314175
|
+
const separated = [4, 3, 2, 1].map((charactersPerToken) => [
|
|
314176
|
+
tokens[0],
|
|
314177
|
+
...tokens.slice(1).map((token) => token.slice(0, charactersPerToken))
|
|
314178
|
+
].join("_").concat(count));
|
|
314179
|
+
const condensed = [3, 2, 1].map((charactersPerToken) => [
|
|
314180
|
+
tokens[0],
|
|
314181
|
+
...tokens.slice(1).map((token) => token.slice(0, charactersPerToken))
|
|
314182
|
+
].join("").concat(count));
|
|
314183
|
+
return [...separated, ...condensed];
|
|
314184
|
+
};
|
|
314185
|
+
var formatComponentGroupLabel = (referenceDesignators, options) => {
|
|
314186
|
+
const full = referenceDesignators.join(",");
|
|
314187
|
+
const compact = compactNumericRange(referenceDesignators);
|
|
314188
|
+
const counted = referenceDesignators.length > 1 ? `${referenceDesignators[0]}+${referenceDesignators.length - 1}` : referenceDesignators[0];
|
|
314189
|
+
const candidates = [
|
|
314190
|
+
...new Set([full, compact, counted].filter((candidate) => Boolean(candidate)))
|
|
314191
|
+
];
|
|
314192
|
+
candidates.push(...tokenAbbreviations(counted));
|
|
314193
|
+
candidates.push(...middleAbbreviations(counted));
|
|
314194
|
+
for (const candidate of candidates) {
|
|
314195
|
+
const { strokeWidth: strokeWidth2 } = getScaledLabelMetrics(candidate, options.availableWidth, options.availableHeight);
|
|
314196
|
+
if (strokeWidth2 >= options.minimumStrokeWidth)
|
|
314197
|
+
return candidate;
|
|
314198
|
+
}
|
|
314199
|
+
const { strokeWidth } = getScaledLabelMetrics(counted, options.availableWidth, options.availableHeight);
|
|
314200
|
+
throw new Error(`Refdes group ${JSON.stringify(referenceDesignators)} needs a ${strokeWidth.toFixed(3)}mm text stroke, below minimumLabelStrokeWidth ${options.minimumStrokeWidth}mm; increase compartmentWidth or labelBandDepth`);
|
|
314201
|
+
};
|
|
314202
|
+
var assertPositive = (value, name) => {
|
|
314203
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
314204
|
+
throw new RangeError(`${name} must be a positive finite number`);
|
|
314205
|
+
}
|
|
314206
|
+
return value;
|
|
314207
|
+
};
|
|
314208
|
+
var normalizeColor = (value, name) => {
|
|
314209
|
+
if (!/^#[0-9a-f]{6}(?:[0-9a-f]{2})?$/i.test(value)) {
|
|
314210
|
+
throw new TypeError(`${name} must use #RRGGBB or #RRGGBBAA notation`);
|
|
314211
|
+
}
|
|
314212
|
+
return `${value.toUpperCase()}${value.length === 7 ? "FF" : ""}`;
|
|
314213
|
+
};
|
|
314214
|
+
var resolveFdmComponentBoxOptions = (componentGroups, options) => {
|
|
314215
|
+
if (componentGroups.length === 0) {
|
|
314216
|
+
throw new Error("At least one component is required");
|
|
314217
|
+
}
|
|
314218
|
+
const requestedColumns = options.columns ?? Math.ceil(Math.sqrt(componentGroups.length));
|
|
314219
|
+
if (!Number.isInteger(requestedColumns) || requestedColumns <= 0) {
|
|
314220
|
+
throw new RangeError("columns must be a positive integer");
|
|
314221
|
+
}
|
|
314222
|
+
const columns = Math.min(requestedColumns, componentGroups.length);
|
|
314223
|
+
const compartmentWidth = assertPositive(options.compartmentWidth ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.compartmentWidth, "compartmentWidth");
|
|
314224
|
+
const compartmentDepth = assertPositive(options.compartmentDepth ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.compartmentDepth, "compartmentDepth");
|
|
314225
|
+
const compartmentHeight = assertPositive(options.compartmentHeight ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.compartmentHeight, "compartmentHeight");
|
|
314226
|
+
const wallThickness = assertPositive(options.wallThickness ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.wallThickness, "wallThickness");
|
|
314227
|
+
const floorThickness = assertPositive(options.floorThickness ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.floorThickness, "floorThickness");
|
|
314228
|
+
const labelBandDepth = assertPositive(options.labelBandDepth ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.labelBandDepth, "labelBandDepth");
|
|
314229
|
+
const labelThickness = assertPositive(options.labelThickness ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.labelThickness, "labelThickness");
|
|
314230
|
+
const labelPadding = assertPositive(options.labelPadding ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.labelPadding, "labelPadding");
|
|
314231
|
+
const minimumLabelStrokeWidth = assertPositive(options.minimumLabelStrokeWidth ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.minimumLabelStrokeWidth, "minimumLabelStrokeWidth");
|
|
314232
|
+
if (labelPadding * 2 >= compartmentWidth) {
|
|
314233
|
+
throw new RangeError("labelPadding leaves no horizontal room for text");
|
|
314234
|
+
}
|
|
314235
|
+
if (labelPadding * 2 >= labelBandDepth) {
|
|
314236
|
+
throw new RangeError("labelPadding leaves no vertical room for text");
|
|
314237
|
+
}
|
|
314238
|
+
const rows = Math.ceil(componentGroups.length / columns);
|
|
314239
|
+
const rowInnerDepth = compartmentDepth + labelBandDepth;
|
|
314240
|
+
const rowPitch = rowInnerDepth + wallThickness;
|
|
314241
|
+
const dimensions = {
|
|
314242
|
+
width: columns * compartmentWidth + (columns + 1) * wallThickness,
|
|
314243
|
+
depth: rows * rowInnerDepth + (rows + 1) * wallThickness,
|
|
314244
|
+
height: floorThickness + compartmentHeight,
|
|
314245
|
+
columns,
|
|
314246
|
+
rows
|
|
314247
|
+
};
|
|
314248
|
+
const compartments = componentGroups.map((group, index) => {
|
|
314249
|
+
const row = Math.floor(index / columns);
|
|
314250
|
+
const column = index % columns;
|
|
314251
|
+
const rowY = row * rowPitch;
|
|
314252
|
+
const cavityX = wallThickness + column * (compartmentWidth + wallThickness);
|
|
314253
|
+
const cavityY = rowY + wallThickness;
|
|
314254
|
+
const labelY = cavityY + compartmentDepth;
|
|
314255
|
+
return {
|
|
314256
|
+
refdes: group.referenceDesignators[0],
|
|
314257
|
+
referenceDesignators: [...group.referenceDesignators],
|
|
314258
|
+
label: formatComponentGroupLabel(group.referenceDesignators, {
|
|
314259
|
+
availableWidth: compartmentWidth - labelPadding * 2,
|
|
314260
|
+
availableHeight: labelBandDepth - labelPadding * 2,
|
|
314261
|
+
minimumStrokeWidth: minimumLabelStrokeWidth
|
|
314262
|
+
}),
|
|
314263
|
+
componentKey: group.componentKey,
|
|
314264
|
+
quantity: group.quantity,
|
|
314265
|
+
row,
|
|
314266
|
+
column,
|
|
314267
|
+
center: {
|
|
314268
|
+
x: cavityX + compartmentWidth / 2,
|
|
314269
|
+
y: cavityY + compartmentDepth / 2
|
|
314270
|
+
},
|
|
314271
|
+
labelCenter: {
|
|
314272
|
+
x: cavityX + compartmentWidth / 2,
|
|
314273
|
+
y: labelY + labelBandDepth / 2
|
|
314274
|
+
},
|
|
314275
|
+
width: compartmentWidth,
|
|
314276
|
+
depth: compartmentDepth
|
|
314277
|
+
};
|
|
314278
|
+
});
|
|
314279
|
+
const duplicateLabel = compartments.map(({ label }) => label).find((label, index, labels) => labels.indexOf(label) !== index);
|
|
314280
|
+
if (duplicateLabel) {
|
|
314281
|
+
throw new Error(`Compartment label ${JSON.stringify(duplicateLabel)} is ambiguous after abbreviation; increase compartmentWidth or labelBandDepth`);
|
|
314282
|
+
}
|
|
314283
|
+
return {
|
|
314284
|
+
options: {
|
|
314285
|
+
columns,
|
|
314286
|
+
compartmentWidth,
|
|
314287
|
+
compartmentDepth,
|
|
314288
|
+
compartmentHeight,
|
|
314289
|
+
wallThickness,
|
|
314290
|
+
floorThickness,
|
|
314291
|
+
labelBandDepth,
|
|
314292
|
+
labelThickness,
|
|
314293
|
+
labelPadding,
|
|
314294
|
+
minimumLabelStrokeWidth,
|
|
314295
|
+
includeUnplacedComponents: options.includeUnplacedComponents ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.includeUnplacedComponents,
|
|
314296
|
+
includeTestPoints: options.includeTestPoints ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.includeTestPoints,
|
|
314297
|
+
groupByComponent: options.groupByComponent ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.groupByComponent,
|
|
314298
|
+
boxColor: normalizeColor(options.boxColor ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.boxColor, "boxColor"),
|
|
314299
|
+
labelColor: normalizeColor(options.labelColor ?? DEFAULT_FDM_COMPONENT_BOX_OPTIONS.labelColor, "labelColor"),
|
|
314300
|
+
title: options.title?.trim() || (() => {
|
|
314301
|
+
const componentCount = componentGroups.reduce((sum, group) => sum + group.quantity, 0);
|
|
314302
|
+
return componentCount === componentGroups.length ? `Assembly box for ${componentCount} components` : `Assembly box for ${componentCount} components in ${componentGroups.length} compartments`;
|
|
314303
|
+
})()
|
|
314304
|
+
},
|
|
314305
|
+
dimensions,
|
|
314306
|
+
compartments
|
|
314307
|
+
};
|
|
314308
|
+
};
|
|
314309
|
+
var buildFdmComponentBox = async (circuitJson, options = {}) => {
|
|
314310
|
+
const componentGroups = extractComponentGroups(circuitJson, {
|
|
314311
|
+
includeUnplacedComponents: options.includeUnplacedComponents,
|
|
314312
|
+
includeTestPoints: options.includeTestPoints,
|
|
314313
|
+
groupByComponent: options.groupByComponent
|
|
314314
|
+
});
|
|
314315
|
+
const resolved = resolveFdmComponentBoxOptions(componentGroups, options);
|
|
314316
|
+
const meshes = await createPrintableMeshes(resolved.options, resolved.dimensions, resolved.compartments);
|
|
314317
|
+
return {
|
|
314318
|
+
componentGroups,
|
|
314319
|
+
componentRefdes: componentGroups.flatMap(({ referenceDesignators }) => referenceDesignators).sort((a2, b3) => naturalRefdesCollator.compare(a2, b3)),
|
|
314320
|
+
options: resolved.options,
|
|
314321
|
+
dimensions: resolved.dimensions,
|
|
314322
|
+
compartments: resolved.compartments,
|
|
314323
|
+
meshes
|
|
314324
|
+
};
|
|
314325
|
+
};
|
|
314326
|
+
var CONTENT_TYPES_XML = `<?xml version="1.0" encoding="UTF-8"?>
|
|
314327
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
314328
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
|
|
314329
|
+
<Default Extension="model" ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml" />
|
|
314330
|
+
</Types>
|
|
314331
|
+
`;
|
|
314332
|
+
var RELATIONSHIPS_XML = `<?xml version="1.0" encoding="UTF-8"?>
|
|
314333
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
314334
|
+
<Relationship Target="/3D/3dmodel.model" Id="rel-1" Type="http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel" />
|
|
314335
|
+
</Relationships>
|
|
314336
|
+
`;
|
|
314337
|
+
var escapeXml3 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
314338
|
+
var formatNumber5 = (value) => {
|
|
314339
|
+
const normalized = Math.abs(value) < 0.0000005 ? 0 : value;
|
|
314340
|
+
return normalized.toFixed(6).replace(/(?:\.0+|(?<decimal>\.[0-9]*?)0+)$/, "$<decimal>");
|
|
314341
|
+
};
|
|
314342
|
+
var appendMeshObject = (output, mesh, objectId) => {
|
|
314343
|
+
output.push(` <object id="${objectId}" type="model" name="${escapeXml3(mesh.name)}" pid="1" pindex="${mesh.materialIndex}">
|
|
314344
|
+
`, ` <mesh>
|
|
314345
|
+
`, ` <vertices>
|
|
314346
|
+
`);
|
|
314347
|
+
for (let index = 0;index < mesh.vertices.length; index += 3) {
|
|
314348
|
+
output.push(` <vertex x="${formatNumber5(mesh.vertices[index])}" y="${formatNumber5(mesh.vertices[index + 1])}" z="${formatNumber5(mesh.vertices[index + 2])}" />
|
|
314349
|
+
`);
|
|
314350
|
+
}
|
|
314351
|
+
output.push(` </vertices>
|
|
314352
|
+
`, ` <triangles>
|
|
314353
|
+
`);
|
|
314354
|
+
for (let index = 0;index < mesh.triangles.length; index += 3) {
|
|
314355
|
+
output.push(` <triangle v1="${mesh.triangles[index]}" v2="${mesh.triangles[index + 1]}" v3="${mesh.triangles[index + 2]}" />
|
|
314356
|
+
`);
|
|
314357
|
+
}
|
|
314358
|
+
output.push(` </triangles>
|
|
314359
|
+
`, ` </mesh>
|
|
314360
|
+
`, ` </object>
|
|
314361
|
+
`);
|
|
314362
|
+
};
|
|
314363
|
+
var createBambuModelSettings = (meshes, assemblyId, title) => {
|
|
314364
|
+
const settings = [
|
|
314365
|
+
`<?xml version="1.0" encoding="UTF-8"?>
|
|
314366
|
+
`,
|
|
314367
|
+
`<config>
|
|
314368
|
+
`,
|
|
314369
|
+
` <object id="${assemblyId}">
|
|
314370
|
+
`,
|
|
314371
|
+
` <metadata key="name" value="${escapeXml3(title)}"/>
|
|
314372
|
+
`,
|
|
314373
|
+
` <metadata key="extruder" value="1"/>
|
|
314374
|
+
`
|
|
314375
|
+
];
|
|
314376
|
+
for (const [index, mesh] of meshes.entries()) {
|
|
314377
|
+
const objectId = index + 2;
|
|
314378
|
+
const extruder = mesh.materialIndex + 1;
|
|
314379
|
+
settings.push(` <part id="${objectId}" subtype="normal_part">
|
|
314380
|
+
`, ` <metadata key="name" value="${escapeXml3(mesh.name)}"/>
|
|
314381
|
+
`, ` <metadata key="extruder" value="${extruder}"/>
|
|
314382
|
+
`, ` <mesh_stat face_count="${mesh.triangles.length / 3}" edges_fixed="0" degenerate_facets="0" facets_removed="0" facets_reversed="0" backwards_edges="0"/>
|
|
314383
|
+
`, ` </part>
|
|
314384
|
+
`);
|
|
314385
|
+
}
|
|
314386
|
+
settings.push(` </object>
|
|
314387
|
+
`, ` <assemble>
|
|
314388
|
+
`, ` </assemble>
|
|
314389
|
+
`, `</config>
|
|
314390
|
+
`);
|
|
314391
|
+
return settings.join("");
|
|
314392
|
+
};
|
|
314393
|
+
var createThreeMf = ({
|
|
314394
|
+
box: box2,
|
|
314395
|
+
labels,
|
|
314396
|
+
boxColor,
|
|
314397
|
+
labelColor,
|
|
314398
|
+
title
|
|
314399
|
+
}) => {
|
|
314400
|
+
const model = [
|
|
314401
|
+
`<?xml version="1.0" encoding="UTF-8"?>
|
|
314402
|
+
`,
|
|
314403
|
+
`<model unit="millimeter" xml:lang="en-US" xmlns="http://schemas.microsoft.com/3dmanufacturing/core/2015/02">
|
|
314404
|
+
`,
|
|
314405
|
+
` <metadata name="Title">${escapeXml3(title)}</metadata>
|
|
314406
|
+
`,
|
|
314407
|
+
` <metadata name="Designer">tscircuit</metadata>
|
|
314408
|
+
`,
|
|
314409
|
+
` <metadata name="Description">Labeled component-organization box generated from Circuit JSON</metadata>
|
|
314410
|
+
`,
|
|
314411
|
+
` <metadata name="Application">circuit-json-to-fdm-component-box</metadata>
|
|
314412
|
+
`,
|
|
314413
|
+
` <resources>
|
|
314414
|
+
`,
|
|
314415
|
+
` <basematerials id="1">
|
|
314416
|
+
`,
|
|
314417
|
+
` <base name="Box" displaycolor="${boxColor}" />
|
|
314418
|
+
`,
|
|
314419
|
+
` <base name="Labels" displaycolor="${labelColor}" />
|
|
314420
|
+
`,
|
|
314421
|
+
` </basematerials>
|
|
314422
|
+
`
|
|
314423
|
+
];
|
|
314424
|
+
const meshes = [box2, ...labels];
|
|
314425
|
+
for (const [index, mesh] of meshes.entries()) {
|
|
314426
|
+
appendMeshObject(model, mesh, index + 2);
|
|
314427
|
+
}
|
|
314428
|
+
const assemblyId = meshes.length + 2;
|
|
314429
|
+
model.push(` <object id="${assemblyId}" type="model" name="${escapeXml3(title)}">
|
|
314430
|
+
`, ` <components>
|
|
314431
|
+
`);
|
|
314432
|
+
for (let objectId = 2;objectId < assemblyId; objectId += 1) {
|
|
314433
|
+
model.push(` <component objectid="${objectId}" />
|
|
314434
|
+
`);
|
|
314435
|
+
}
|
|
314436
|
+
model.push(` </components>
|
|
314437
|
+
`, ` </object>
|
|
314438
|
+
`, ` </resources>
|
|
314439
|
+
`, ` <build>
|
|
314440
|
+
`, ` <item objectid="${assemblyId}" />
|
|
314441
|
+
`, ` </build>
|
|
314442
|
+
`, `</model>
|
|
314443
|
+
`);
|
|
314444
|
+
const bambuModelSettings = createBambuModelSettings(meshes, assemblyId, title);
|
|
314445
|
+
return zipSync({
|
|
314446
|
+
"[Content_Types].xml": strToU8(CONTENT_TYPES_XML),
|
|
314447
|
+
"_rels/.rels": strToU8(RELATIONSHIPS_XML),
|
|
314448
|
+
"3D/3dmodel.model": strToU8(model.join("")),
|
|
314449
|
+
"Metadata/model_settings.config": strToU8(bambuModelSettings)
|
|
314450
|
+
}, {
|
|
314451
|
+
level: 6,
|
|
314452
|
+
mtime: /* @__PURE__ */ new Date("1980-01-02T00:00:00.000Z")
|
|
314453
|
+
});
|
|
314454
|
+
};
|
|
314455
|
+
var createFdmComponentBox = async (circuitJson, options = {}) => {
|
|
314456
|
+
const built = await buildFdmComponentBox(circuitJson, options);
|
|
314457
|
+
const boxTriangles = built.meshes.box.triangles.length / 3;
|
|
314458
|
+
const labelTriangles = built.meshes.labels.reduce((sum, mesh) => sum + mesh.triangles.length / 3, 0);
|
|
314459
|
+
return {
|
|
314460
|
+
threeMf: createThreeMf({
|
|
314461
|
+
box: built.meshes.box,
|
|
314462
|
+
labels: built.meshes.labels,
|
|
314463
|
+
boxColor: built.options.boxColor,
|
|
314464
|
+
labelColor: built.options.labelColor,
|
|
314465
|
+
title: built.options.title
|
|
314466
|
+
}),
|
|
314467
|
+
componentRefdes: built.componentRefdes,
|
|
314468
|
+
componentGroups: built.componentGroups,
|
|
314469
|
+
dimensions: built.dimensions,
|
|
314470
|
+
compartments: built.compartments,
|
|
314471
|
+
meshStats: {
|
|
314472
|
+
boxTriangles,
|
|
314473
|
+
labelTriangles,
|
|
314474
|
+
totalTriangles: boxTriangles + labelTriangles
|
|
314475
|
+
}
|
|
314476
|
+
};
|
|
314477
|
+
};
|
|
314478
|
+
var circuitJsonToFdmComponentBox = async (circuitJson, options = {}) => (await createFdmComponentBox(circuitJson, options)).threeMf;
|
|
314479
|
+
|
|
314480
|
+
// node_modules/circuit-json-to-fdm-component-box/dist/index.js
|
|
314481
|
+
import {
|
|
314482
|
+
createSceneFromGLTF,
|
|
314483
|
+
encodePNG,
|
|
314484
|
+
renderSceneFromGLTF
|
|
314485
|
+
} from "poppygl";
|
|
314486
|
+
|
|
310494
314487
|
// lib/shared/export-snippet.ts
|
|
310495
314488
|
import {
|
|
310496
314489
|
convertCircuitJsonToAssemblySvg as convertCircuitJsonToAssemblySvg2,
|
|
@@ -310515,7 +314508,7 @@ import Debug32 from "debug";
|
|
|
310515
314508
|
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
310516
314509
|
import Debug6 from "debug";
|
|
310517
314510
|
import"transformation-matrix";
|
|
310518
|
-
import { applyToPoint as
|
|
314511
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
310519
314512
|
import Debug42 from "debug";
|
|
310520
314513
|
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
310521
314514
|
import Debug5 from "debug";
|
|
@@ -311856,7 +315849,8 @@ var ALLOWED_EXPORT_FORMATS = [
|
|
|
311856
315849
|
"kicad-library",
|
|
311857
315850
|
"srj",
|
|
311858
315851
|
"step",
|
|
311859
|
-
"assembly-svg"
|
|
315852
|
+
"assembly-svg",
|
|
315853
|
+
"component-box-3mf"
|
|
311860
315854
|
];
|
|
311861
315855
|
var OUTPUT_EXTENSIONS = {
|
|
311862
315856
|
json: ".circuit.json",
|
|
@@ -311875,7 +315869,8 @@ var OUTPUT_EXTENSIONS = {
|
|
|
311875
315869
|
kicad_zip: "-kicad.zip",
|
|
311876
315870
|
"kicad-library": "",
|
|
311877
315871
|
srj: ".simple-route.json",
|
|
311878
|
-
step: ".step"
|
|
315872
|
+
step: ".step",
|
|
315873
|
+
"component-box-3mf": "-component-box.3mf"
|
|
311879
315874
|
};
|
|
311880
315875
|
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
311881
315876
|
var unwrapSimpleRouteJson = (value) => {
|
|
@@ -312078,6 +316073,9 @@ var exportSnippet = async ({
|
|
|
312078
316073
|
case "assembly-svg":
|
|
312079
316074
|
outputContent = convertCircuitJsonToAssemblySvg2(circuitJson);
|
|
312080
316075
|
break;
|
|
316076
|
+
case "component-box-3mf":
|
|
316077
|
+
outputContent = Buffer.from(await circuitJsonToFdmComponentBox(circuitJson));
|
|
316078
|
+
break;
|
|
312081
316079
|
default:
|
|
312082
316080
|
outputContent = JSON.stringify(circuitJson, null, 2);
|
|
312083
316081
|
}
|
|
@@ -324800,7 +328798,7 @@ var getPointTransformer = (origin) => (point22) => ({
|
|
|
324800
328798
|
x: toSchematicUnits(point22.x - origin.x),
|
|
324801
328799
|
y: toSchematicUnits(origin.y - point22.y)
|
|
324802
328800
|
});
|
|
324803
|
-
var
|
|
328801
|
+
var formatNumber6 = (value) => String(round(value));
|
|
324804
328802
|
var SVG_PATH_COMMAND_PARAMETER_COUNTS = {
|
|
324805
328803
|
A: 7,
|
|
324806
328804
|
C: 6,
|
|
@@ -324855,7 +328853,7 @@ var transformSvgPath = (pathData, origin) => {
|
|
|
324855
328853
|
if (upperCommand === "H" || upperCommand === "V") {
|
|
324856
328854
|
const point22 = getOriginalPoint(upperCommand === "H" ? values[0] : isRelative ? 0 : currentX, upperCommand === "V" ? values[0] : isRelative ? 0 : currentY, isRelative);
|
|
324857
328855
|
const transformed = transformPoint2(point22);
|
|
324858
|
-
output.push(`L ${
|
|
328856
|
+
output.push(`L ${formatNumber6(transformed.x)} ${formatNumber6(transformed.y)}`);
|
|
324859
328857
|
currentX = point22.x;
|
|
324860
328858
|
currentY = point22.y;
|
|
324861
328859
|
continue;
|
|
@@ -324863,7 +328861,7 @@ var transformSvgPath = (pathData, origin) => {
|
|
|
324863
328861
|
if (["M", "L", "T"].includes(upperCommand)) {
|
|
324864
328862
|
const point22 = getOriginalPoint(values[0], values[1], isRelative);
|
|
324865
328863
|
const transformed = transformPoint2(point22);
|
|
324866
|
-
output.push(`${upperCommand} ${
|
|
328864
|
+
output.push(`${upperCommand} ${formatNumber6(transformed.x)} ${formatNumber6(transformed.y)}`);
|
|
324867
328865
|
currentX = point22.x;
|
|
324868
328866
|
currentY = point22.y;
|
|
324869
328867
|
if (upperCommand === "M") {
|
|
@@ -324880,7 +328878,7 @@ var transformSvgPath = (pathData, origin) => {
|
|
|
324880
328878
|
const transformed = transformPoint2(point22);
|
|
324881
328879
|
transformedValues.push(transformed.x, transformed.y);
|
|
324882
328880
|
}
|
|
324883
|
-
output.push(`${upperCommand} ${transformedValues.map(
|
|
328881
|
+
output.push(`${upperCommand} ${transformedValues.map(formatNumber6).join(" ")}`);
|
|
324884
328882
|
currentX = isRelative ? currentX + values[values.length - 2] : values[values.length - 2];
|
|
324885
328883
|
currentY = isRelative ? currentY + values[values.length - 1] : values[values.length - 1];
|
|
324886
328884
|
continue;
|
|
@@ -324890,13 +328888,13 @@ var transformSvgPath = (pathData, origin) => {
|
|
|
324890
328888
|
const transformedEndpoint = transformPoint2(endpoint);
|
|
324891
328889
|
output.push([
|
|
324892
328890
|
"A",
|
|
324893
|
-
|
|
324894
|
-
|
|
324895
|
-
|
|
328891
|
+
formatNumber6(toSchematicUnits(Math.abs(values[0]))),
|
|
328892
|
+
formatNumber6(toSchematicUnits(Math.abs(values[1]))),
|
|
328893
|
+
formatNumber6(-values[2]),
|
|
324896
328894
|
String(values[3]),
|
|
324897
328895
|
String(values[4] === 0 ? 1 : 0),
|
|
324898
|
-
|
|
324899
|
-
|
|
328896
|
+
formatNumber6(transformedEndpoint.x),
|
|
328897
|
+
formatNumber6(transformedEndpoint.y)
|
|
324900
328898
|
].join(" "));
|
|
324901
328899
|
currentX = endpoint.x;
|
|
324902
328900
|
currentY = endpoint.y;
|
|
@@ -334968,7 +338966,7 @@ var registerSetup = (program3) => {
|
|
|
334968
338966
|
};
|
|
334969
338967
|
|
|
334970
338968
|
// lib/shared/result-to-table.ts
|
|
334971
|
-
var
|
|
338969
|
+
var formatNumber7 = (n3) => {
|
|
334972
338970
|
return n3.toExponential(6);
|
|
334973
338971
|
};
|
|
334974
338972
|
function formatRows(rows) {
|
|
@@ -335000,7 +338998,7 @@ var resultToTable = (result) => {
|
|
|
335000
338998
|
for (let i3 = 0;i3 < result.numPoints; i3++) {
|
|
335001
338999
|
const row = [
|
|
335002
339000
|
i3.toString(),
|
|
335003
|
-
...uniqueData.map((d3) =>
|
|
339001
|
+
...uniqueData.map((d3) => formatNumber7(d3.values[i3]))
|
|
335004
339002
|
];
|
|
335005
339003
|
dataRows2.push(row);
|
|
335006
339004
|
}
|
|
@@ -335015,8 +339013,8 @@ var resultToTable = (result) => {
|
|
|
335015
339013
|
const row = [
|
|
335016
339014
|
i3.toString(),
|
|
335017
339015
|
...uniqueData.flatMap((d3) => [
|
|
335018
|
-
|
|
335019
|
-
|
|
339016
|
+
formatNumber7(d3.values[i3].real),
|
|
339017
|
+
formatNumber7(d3.values[i3].img)
|
|
335020
339018
|
])
|
|
335021
339019
|
];
|
|
335022
339020
|
dataRows.push(row);
|