brepjs 20.12.11 → 20.12.12

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.
Files changed (59) hide show
  1. package/dist/2d.cjs +4 -4
  2. package/dist/2d.js +4 -4
  3. package/dist/{blueprint-DbNFPHzC.js → blueprint-BYXwa2cF.js} +1 -1
  4. package/dist/{blueprint-BY2aygt_.cjs → blueprint-DtPRNDEu.cjs} +1 -1
  5. package/dist/{blueprintFns-dU5V5WcD.js → blueprintFns-YuJQgywS.js} +2 -2
  6. package/dist/{blueprintFns-AfHtvBKP.cjs → blueprintFns-y2oH3LOO.cjs} +2 -2
  7. package/dist/{blueprintSketcher-nBI9PlsW.js → blueprintSketcher-DPP1g95U.js} +2 -2
  8. package/dist/{blueprintSketcher-DHp6AeEM.cjs → blueprintSketcher-zQgjgodb.cjs} +2 -2
  9. package/dist/{boolean2D-C6TS6oFP.cjs → boolean2D-BJFpEXix.cjs} +3 -3
  10. package/dist/{boolean2D-DuWgyjOR.js → boolean2D-CNf7lVXV.js} +3 -3
  11. package/dist/{booleanFns-BwzBRGqj.js → booleanFns-B9RvEpHB.js} +55 -29
  12. package/dist/{booleanFns-D0qfjH0a.cjs → booleanFns-CkcJ8WB7.cjs} +60 -28
  13. package/dist/brepjs.cjs +18 -18
  14. package/dist/brepjs.js +18 -18
  15. package/dist/{cornerFinder-CeyQ5JMA.js → cornerFinder-DgVMDBCo.js} +1 -1
  16. package/dist/{cornerFinder-Da8Dv4bp.cjs → cornerFinder-Dzsi68w-.cjs} +1 -1
  17. package/dist/{drawFns-BQIHgHQg.js → drawFns-Bht1ceeH.js} +6 -6
  18. package/dist/{drawFns-JZV96JGO.cjs → drawFns-CLJog-Xp.cjs} +6 -6
  19. package/dist/{healingFns-qioD81Of.cjs → healingFns-DGc2hk9z.cjs} +76 -16
  20. package/dist/{healingFns-D6mUhe0Z.js → healingFns-DvuJr4RS.js} +76 -16
  21. package/dist/{helpers-CsHdKbfF.js → helpers-BuI9lh-t.js} +1 -1
  22. package/dist/{helpers-BvYkHZK7.cjs → helpers-D7Y4Vxhf.cjs} +1 -1
  23. package/dist/{importFns-BzzUvnKA.cjs → importFns-Dwlc0KtB.cjs} +1 -1
  24. package/dist/{importFns-C8yUNPzJ.js → importFns-TKzj4FaZ.js} +1 -1
  25. package/dist/io.cjs +1 -1
  26. package/dist/io.js +1 -1
  27. package/dist/{measureFns-D3egqKcW.js → measureFns--UKrACtx.js} +12 -6
  28. package/dist/{measureFns-R85865k9.cjs → measureFns-D8uSDn-8.cjs} +23 -5
  29. package/dist/measurement/measureFns.d.ts +18 -3
  30. package/dist/measurement/principalBoxFns.d.ts +2 -1
  31. package/dist/measurement.cjs +2 -2
  32. package/dist/measurement.js +2 -2
  33. package/dist/operations.cjs +1 -1
  34. package/dist/operations.js +1 -1
  35. package/dist/{primitiveFns-eiM6OjWU.cjs → primitiveFns-CZqSRhm8.cjs} +1 -1
  36. package/dist/{primitiveFns-NxbTqKy7.js → primitiveFns-DPqHA3sX.js} +1 -1
  37. package/dist/{principalBoxFns-BgetPvvQ.js → principalBoxFns-C3SQMyG5.js} +28 -19
  38. package/dist/{principalBoxFns-DepJW5im.cjs → principalBoxFns-Cozj46sS.cjs} +27 -18
  39. package/dist/query.cjs +2 -2
  40. package/dist/query.js +2 -2
  41. package/dist/{refResolveFns-DpWvqRm0.cjs → refResolveFns-DBY8yC6n.cjs} +1 -1
  42. package/dist/{refResolveFns-Bl10yOGJ.js → refResolveFns-DtztzO1g.js} +1 -1
  43. package/dist/shapeRef.cjs +1 -1
  44. package/dist/shapeRef.js +1 -1
  45. package/dist/sketching.cjs +3 -3
  46. package/dist/sketching.js +3 -3
  47. package/dist/text.cjs +2 -2
  48. package/dist/text.js +2 -2
  49. package/dist/{textBlueprints-D3XhH1kb.cjs → textBlueprints-BPrPhg5b.cjs} +2 -2
  50. package/dist/{textBlueprints-BvZNjVwM.js → textBlueprints-Dq3pUNSr.js} +2 -2
  51. package/dist/{textMetrics-zk48vXsM.cjs → textMetrics-4xkjKmD1.cjs} +1 -1
  52. package/dist/{textMetrics-BGPUxjiq.js → textMetrics-JN70dV5x.js} +1 -1
  53. package/dist/{threadFns-CEr8JDsu.js → threadFns-D7D_qR7t.js} +3 -3
  54. package/dist/{threadFns-DNFoBBrH.cjs → threadFns-Dq_Gff0C.cjs} +3 -3
  55. package/dist/topology/booleanFns.d.ts +15 -3
  56. package/dist/topology/metadata/metadataPropagation.d.ts +4 -1
  57. package/dist/topology.cjs +3 -3
  58. package/dist/topology.js +3 -3
  59. package/package.json +1 -1
package/dist/2d.cjs CHANGED
@@ -2,10 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_shapeTypes = require("./shapeTypes-C06KHgTm.cjs");
3
3
  const require_errors = require("./errors-O_blYTWT.cjs");
4
4
  const require_topologyQueryFns = require("./topologyQueryFns-BUhKY2Kj.cjs");
5
- const require_blueprintSketcher = require("./blueprintSketcher-DHp6AeEM.cjs");
6
- const require_blueprint = require("./blueprint-BY2aygt_.cjs");
7
- const require_boolean2D = require("./boolean2D-C6TS6oFP.cjs");
8
- const require_blueprintFns = require("./blueprintFns-AfHtvBKP.cjs");
5
+ const require_blueprintSketcher = require("./blueprintSketcher-zQgjgodb.cjs");
6
+ const require_blueprint = require("./blueprint-DtPRNDEu.cjs");
7
+ const require_boolean2D = require("./boolean2D-BJFpEXix.cjs");
8
+ const require_blueprintFns = require("./blueprintFns-y2oH3LOO.cjs");
9
9
  // src/core/curve2dHandle.ts
10
10
  /**
11
11
  * Wrap a raw kernel 2D curve handle with brand + disposal tracking.
package/dist/2d.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { F as createKernelHandle, J as getKernel2D, c as createEdge } from "./shapeTypes-DoPnZHn_.js";
2
2
  import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
3
3
  import { E as kernelCallRaw } from "./topologyQueryFns-yOGEI9hO.js";
4
- import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-nBI9PlsW.js";
5
- import { t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-DbNFPHzC.js";
6
- import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-DuWgyjOR.js";
7
- import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-dU5V5WcD.js";
4
+ import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-DPP1g95U.js";
5
+ import { t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-BYXwa2cF.js";
6
+ import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-CNf7lVXV.js";
7
+ import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-YuJQgywS.js";
8
8
  // src/core/curve2dHandle.ts
9
9
  /**
10
10
  * Wrap a raw kernel 2D curve handle with brand + disposal tracking.
@@ -8,7 +8,7 @@ import { _ as cast, h as uvCoordinates, i as faceGeomType, m as uvBounds, r as f
8
8
  import { p as getOrientation } from "./curveFns-EsJgIpc6.js";
9
9
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
10
10
  import { r as makeFace } from "./surfaceBuilders-BBs6D6Km.js";
11
- import { l as add2d, m as normalize2d$1, p as distance2d, t as getSingleFace, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-CsHdKbfF.js";
11
+ import { l as add2d, m as normalize2d$1, p as distance2d, t as getSingleFace, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-BuI9lh-t.js";
12
12
  // src/2d/lib/definitions.ts
13
13
  /** Type guard that checks whether a value is a `Point2D`. */
14
14
  function isPoint2D(point) {
@@ -8,7 +8,7 @@ const require_faceFns = require("./faceFns-Jo9hMVqL.cjs");
8
8
  const require_curveFns = require("./curveFns-B8mm5cou.cjs");
9
9
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
10
10
  const require_surfaceBuilders = require("./surfaceBuilders-D5kFAV1i.cjs");
11
- const require_helpers = require("./helpers-BvYkHZK7.cjs");
11
+ const require_helpers = require("./helpers-D7Y4Vxhf.cjs");
12
12
  // src/2d/lib/definitions.ts
13
13
  /** Type guard that checks whether a value is a `Point2D`. */
14
14
  function isPoint2D(point) {
@@ -1,6 +1,6 @@
1
1
  import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
2
- import { i as CompoundBlueprint } from "./blueprintSketcher-nBI9PlsW.js";
3
- import { t as Blueprint } from "./blueprint-DbNFPHzC.js";
2
+ import { i as CompoundBlueprint } from "./blueprintSketcher-DPP1g95U.js";
3
+ import { t as Blueprint } from "./blueprint-BYXwa2cF.js";
4
4
  // src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -1,6 +1,6 @@
1
1
  const require_errors = require("./errors-O_blYTWT.cjs");
2
- const require_blueprintSketcher = require("./blueprintSketcher-DHp6AeEM.cjs");
3
- const require_blueprint = require("./blueprint-BY2aygt_.cjs");
2
+ const require_blueprintSketcher = require("./blueprintSketcher-zQgjgodb.cjs");
3
+ const require_blueprint = require("./blueprint-DtPRNDEu.cjs");
4
4
  // src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -3,8 +3,8 @@ import { i as wasmIndex, n as bug } from "./bug-ClMTAJhe.js";
3
3
  import { E as ok, P as unwrap, g as err, n as computationError, s as safeIndex, x as isOk } from "./errors-BTccWbtE.js";
4
4
  import { r as RAD2DEG, t as DEG2RAD } from "./constants-iraOnb2p.js";
5
5
  import { t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
6
- import { _ as rotate2d, b as squareDistance2d, d as cartesianToPolar, f as crossProduct2d, g as polarToCartesian, h as polarAngle2d, l as add2d, p as distance2d, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-CsHdKbfF.js";
7
- import { C as isPoint2D, b as normalize2d, c as make2dBezierCurve, d as make2dEllipseArc, g as approximateAsBSpline, h as make2dThreePointArc, l as make2dCircle, m as make2dTangentArc, n as asSVG, p as make2dSegmentCurve, r as viewbox, s as make2dArcFromCenter, t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-DbNFPHzC.js";
6
+ import { _ as rotate2d, b as squareDistance2d, d as cartesianToPolar, f as crossProduct2d, g as polarToCartesian, h as polarAngle2d, l as add2d, p as distance2d, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-BuI9lh-t.js";
7
+ import { C as isPoint2D, b as normalize2d, c as make2dBezierCurve, d as make2dEllipseArc, g as approximateAsBSpline, h as make2dThreePointArc, l as make2dCircle, m as make2dTangentArc, n as asSVG, p as make2dSegmentCurve, r as viewbox, s as make2dArcFromCenter, t as Blueprint, v as Curve2D, x as BoundingBox2d } from "./blueprint-BYXwa2cF.js";
8
8
  // node_modules/flatqueue/index.js
9
9
  /**
10
10
  * @typedef {Float64ArrayConstructor | Float32ArrayConstructor |
@@ -3,8 +3,8 @@ const require_bug = require("./bug-CBcpIPuf.cjs");
3
3
  const require_errors = require("./errors-O_blYTWT.cjs");
4
4
  const require_constants = require("./constants-oee0S_x6.cjs");
5
5
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
6
- const require_helpers = require("./helpers-BvYkHZK7.cjs");
7
- const require_blueprint = require("./blueprint-BY2aygt_.cjs");
6
+ const require_helpers = require("./helpers-D7Y4Vxhf.cjs");
7
+ const require_blueprint = require("./blueprint-DtPRNDEu.cjs");
8
8
  // node_modules/flatqueue/index.js
9
9
  /**
10
10
  * @typedef {Float64ArrayConstructor | Float32ArrayConstructor |
@@ -2,9 +2,9 @@ const require_bug = require("./bug-CBcpIPuf.cjs");
2
2
  const require_errors = require("./errors-O_blYTWT.cjs");
3
3
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
4
4
  const require_surfaceBuilders = require("./surfaceBuilders-D5kFAV1i.cjs");
5
- const require_blueprintSketcher = require("./blueprintSketcher-DHp6AeEM.cjs");
6
- const require_helpers = require("./helpers-BvYkHZK7.cjs");
7
- const require_blueprint = require("./blueprint-BY2aygt_.cjs");
5
+ const require_blueprintSketcher = require("./blueprintSketcher-zQgjgodb.cjs");
6
+ const require_helpers = require("./helpers-D7Y4Vxhf.cjs");
7
+ const require_blueprint = require("./blueprint-DtPRNDEu.cjs");
8
8
  // src/2d/blueprints/cannedBlueprints.ts
9
9
  /**
10
10
  * Create a regular polygon blueprint inscribed in a circle of the given radius.
@@ -2,9 +2,9 @@ import { i as wasmIndex, n as bug } from "./bug-ClMTAJhe.js";
2
2
  import { P as unwrap, s as safeIndex } from "./errors-BTccWbtE.js";
3
3
  import { r as lastOrThrow } from "./arrayAccess-BpgouNir.js";
4
4
  import { v as zip } from "./surfaceBuilders-BBs6D6Km.js";
5
- import { a as Blueprints, i as CompoundBlueprint, l as intersectCurves, r as organiseBlueprints, t as BlueprintSketcher, u as Flatbush } from "./blueprintSketcher-nBI9PlsW.js";
6
- import { f as crossProduct2d, o as PRECISION_INTERSECTION, v as samePoint$1, x as subtract2d } from "./helpers-CsHdKbfF.js";
7
- import { S as removeDuplicatePoints, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-DbNFPHzC.js";
5
+ import { a as Blueprints, i as CompoundBlueprint, l as intersectCurves, r as organiseBlueprints, t as BlueprintSketcher, u as Flatbush } from "./blueprintSketcher-DPP1g95U.js";
6
+ import { f as crossProduct2d, o as PRECISION_INTERSECTION, v as samePoint$1, x as subtract2d } from "./helpers-BuI9lh-t.js";
7
+ import { S as removeDuplicatePoints, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-BYXwa2cF.js";
8
8
  // src/2d/blueprints/cannedBlueprints.ts
9
9
  /**
10
10
  * Create a regular polygon blueprint inscribed in a circle of the given radius.
@@ -6,6 +6,7 @@ import { a as vecDot, g as vecSub, h as vecScale, t as vecAdd } from "./vecOps-S
6
6
  import { o as resolvePlane } from "./planeOps-D3yDuMux.js";
7
7
  import { d as getFaceOrigins, f as propagateOriginsByHash, p as propagateOriginsFromEvolution } from "./solidBuilders-ZDGdvaTU.js";
8
8
  import { n as hasFaceRoles, r as propagateFaceRolesFromEvolution } from "./faceRoleFns-BPxzQF-n.js";
9
+ import { t as clone } from "./shapeFns-kFm-m8jh.js";
9
10
  import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
10
11
  import { r as makeFace } from "./surfaceBuilders-BBs6D6Km.js";
11
12
  // src/topology/metadata/faceTagFns.ts
@@ -286,9 +287,12 @@ function propagateMetadataByHash(inputs, result) {
286
287
  * hash) and runs the standard propagation pipeline, so origins, tags, and
287
288
  * colors all survive a move at `locate` cost (O(faces)), not a full copy.
288
289
  *
290
+ * A `copyShape` copy keeps the same 1:1 face order with new hashes, so this
291
+ * re-keys metadata onto a copy too.
292
+ *
289
293
  * Callers should gate on {@link hasAnyMetadata} first: with no metadata this
290
294
  * does pointless face iteration. The face counts always match for a rigid
291
- * relocation; the length guard is purely defensive.
295
+ * relocation or a copy; the length guard is purely defensive.
292
296
  */
293
297
  function propagateMetadataThroughRelocation(source, moved) {
294
298
  try {
@@ -355,6 +359,18 @@ function castToShape3D(shape, errorCode, errorMsg, suggestion, diagnostics) {
355
359
  }
356
360
  return ok(wrapped);
357
361
  }
362
+ /**
363
+ * A copy of `shape` the caller owns, for a boolean that has nothing to combine.
364
+ * With `trackEvolution` on, its face metadata is re-keyed onto the copy, as a
365
+ * real boolean would propagate it.
366
+ *
367
+ * @internal
368
+ */
369
+ function copyAsBooleanResult(shape, trackEvolution) {
370
+ const copy = clone(shape);
371
+ if (copy.ok && trackEvolution && hasAnyMetadata(shape)) propagateMetadataThroughRelocation(shape, copy.value);
372
+ return copy;
373
+ }
358
374
  function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
359
375
  if (signal?.aborted) throw signal.reason;
360
376
  const checkA = validateShape3D(a, "fuse: first operand");
@@ -483,35 +499,38 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isFinal, tr
483
499
  const mid = start + Math.ceil(count / 2);
484
500
  const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
485
501
  if (isErr(leftResult)) return leftResult;
486
- const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
487
- if (isErr(rightResult)) {
488
- if (leftResult.value.owned) disposeResultShape(leftResult.value.shape);
489
- return rightResult;
502
+ const left = leftResult.value;
503
+ let right;
504
+ try {
505
+ const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
506
+ if (isErr(rightResult)) return rightResult;
507
+ right = rightResult.value;
508
+ const combined = fuse(left.shape, right.shape, {
509
+ optimisation,
510
+ simplify,
511
+ trackEvolution,
512
+ fuzzyValue,
513
+ unsafe: true,
514
+ ...signal ? { signal } : {}
515
+ });
516
+ if (isErr(combined)) return combined;
517
+ return ok({
518
+ shape: combined.value,
519
+ owned: true
520
+ });
521
+ } finally {
522
+ if (left.owned) disposeResultShape(left.shape);
523
+ if (right?.owned) disposeResultShape(right.shape);
490
524
  }
491
- const combined = fuse(leftResult.value.shape, rightResult.value.shape, {
492
- optimisation,
493
- simplify,
494
- trackEvolution,
495
- fuzzyValue,
496
- unsafe: true,
497
- ...signal ? { signal } : {}
498
- });
499
- if (leftResult.value.owned) disposeResultShape(leftResult.value.shape);
500
- if (rightResult.value.owned) disposeResultShape(rightResult.value.shape);
501
- if (isErr(combined)) return combined;
502
- return ok({
503
- shape: combined.value,
504
- owned: true
505
- });
506
525
  }
507
526
  function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "native", signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
508
527
  if (signal?.aborted) throw signal.reason;
509
528
  if (shapes.length === 0) return err(validationError("FUSE_ALL_EMPTY", "fuseAll requires at least one shape"));
510
- if (shapes.length === 1) return ok(firstOrThrow(shapes));
511
529
  for (let i = 0; i < shapes.length; i++) {
512
530
  const check = validateShape3D(getAtOrThrow(shapes, i), `fuseAll: shape at index ${i}`);
513
531
  if (isErr(check)) return check;
514
532
  }
533
+ if (shapes.length === 1) return copyAsBooleanResult(firstOrThrow(shapes), trackEvolution);
515
534
  if (strategy === "native") {
516
535
  const kernel = getKernel();
517
536
  const inputFaceHashes = trackEvolution && kernel.fuseAllWithHistory ? collectInputFaceHashes(shapes) : [];
@@ -541,9 +560,9 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
541
560
  }
542
561
  function cutAll(base, tools, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
543
562
  if (signal?.aborted) throw signal.reason;
544
- if (tools.length === 0) return ok(base);
545
563
  const checkBase = validateShape3D(base, "cutAll: base");
546
564
  if (isErr(checkBase)) return checkBase;
565
+ if (tools.length === 0) return copyAsBooleanResult(base, trackEvolution);
547
566
  for (let i = 0; i < tools.length; i++) {
548
567
  const check = validateShape3D(getAtOrThrow(tools, i), `cutAll: tool at index ${i}`);
549
568
  if (isErr(check)) return check;
@@ -787,11 +806,12 @@ function sectionToFace(shape, plane, options = {}) {
787
806
  }
788
807
  /**
789
808
  * Split a shape with one or more tool shapes using BRepAlgoAPI_Splitter.
790
- * Returns all pieces from the split as a compound.
809
+ * Returns all pieces from the split as a compound, or a copy of the shape when
810
+ * `tools` is empty, so the result is always the caller's to dispose.
791
811
  */
792
812
  function split(shape, tools) {
793
- if (tools.length === 0) return ok(shape);
794
813
  if (getKernel().isNull(shape.wrapped)) return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
814
+ if (tools.length === 0) return copyAsBooleanResult(shape, true);
795
815
  for (let i = 0; i < tools.length; i++) if (getKernel().isNull(getAtOrThrow(tools, i).wrapped)) return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `splitShape: tool at index ${i} is a null shape`));
796
816
  try {
797
817
  const result = getKernel().split(shape.wrapped, tools.map((t) => t.wrapped));
@@ -825,10 +845,11 @@ function slice(shape, planes, options = {}) {
825
845
  * simplifies the final shape.
826
846
  *
827
847
  * Falls back to sequential operations when the C++ pipeline class is not
828
- * available in the WASM build.
848
+ * available in the WASM build. An empty pipeline returns a copy of `base`, so
849
+ * the result is always the caller's to dispose.
829
850
  */
830
851
  function booleanPipeline(base, steps, options) {
831
- if (steps.length === 0) return ok(base);
852
+ if (steps.length === 0) return copyAsBooleanResult(base, true);
832
853
  const glueMode = options?.optimisation === "commonFace" ? 1 : options?.optimisation === "sameFace" ? 2 : 0;
833
854
  const k = getKernel();
834
855
  const kernelSteps = steps.map((s) => ({
@@ -856,10 +877,15 @@ function booleanPipelineFallback(base, steps, options) {
856
877
  unsafe: true
857
878
  };
858
879
  for (const step of steps) {
859
- const r = step.op === "fuse" ? fuse(current, step.tool, boolOpts) : step.op === "cut" ? cut(current, step.tool, boolOpts) : intersect(current, step.tool, boolOpts);
880
+ let r;
881
+ try {
882
+ r = step.op === "fuse" ? fuse(current, step.tool, boolOpts) : step.op === "cut" ? cut(current, step.tool, boolOpts) : intersect(current, step.tool, boolOpts);
883
+ } finally {
884
+ if (current !== base) disposeResultShape(current);
885
+ }
860
886
  if (isErr(r)) return r;
861
- current = unwrap(r);
887
+ current = r.value;
862
888
  }
863
889
  return ok(current);
864
890
  }
865
- export { getTagMetadata as C, getFaceTags as S, tagFaces as T, colorShape as _, fuseAll as a, parseColor as b, sectionToFace as c, collectInputFaceHashes as d, hasAnyMetadata as f, colorFaces as g, propagateMetadataThroughRelocation as h, fuse as i, slice as l, propagateMetadataByHash as m, cut as n, intersect as o, propagateAllMetadata as p, cutAll as r, section as s, booleanPipeline as t, split as u, getFaceColor as v, setTagMetadata as w, findFacesByTag as x, getShapeColor as y };
891
+ export { getFaceTags as C, tagFaces as E, findFacesByTag as S, setTagMetadata as T, colorFaces as _, fuse as a, getShapeColor as b, section as c, split as d, collectInputFaceHashes as f, propagateMetadataThroughRelocation as g, propagateMetadataByHash as h, cutAll as i, sectionToFace as l, propagateAllMetadata as m, copyAsBooleanResult as n, fuseAll as o, hasAnyMetadata as p, cut as r, intersect as s, booleanPipeline as t, slice as u, colorShape as v, getTagMetadata as w, parseColor as x, getFaceColor as y };
@@ -6,6 +6,7 @@ const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
6
6
  const require_planeOps = require("./planeOps-DZfLToKZ.cjs");
7
7
  const require_solidBuilders = require("./solidBuilders-Dwm0hXn5.cjs");
8
8
  const require_faceRoleFns = require("./faceRoleFns-Db5bYj4Q.cjs");
9
+ const require_shapeFns = require("./shapeFns-D47cmLG8.cjs");
9
10
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
10
11
  const require_surfaceBuilders = require("./surfaceBuilders-D5kFAV1i.cjs");
11
12
  // src/topology/metadata/faceTagFns.ts
@@ -286,9 +287,12 @@ function propagateMetadataByHash(inputs, result) {
286
287
  * hash) and runs the standard propagation pipeline, so origins, tags, and
287
288
  * colors all survive a move at `locate` cost (O(faces)), not a full copy.
288
289
  *
290
+ * A `copyShape` copy keeps the same 1:1 face order with new hashes, so this
291
+ * re-keys metadata onto a copy too.
292
+ *
289
293
  * Callers should gate on {@link hasAnyMetadata} first: with no metadata this
290
294
  * does pointless face iteration. The face counts always match for a rigid
291
- * relocation; the length guard is purely defensive.
295
+ * relocation or a copy; the length guard is purely defensive.
292
296
  */
293
297
  function propagateMetadataThroughRelocation(source, moved) {
294
298
  try {
@@ -355,6 +359,18 @@ function castToShape3D(shape, errorCode, errorMsg, suggestion, diagnostics) {
355
359
  }
356
360
  return require_errors.ok(wrapped);
357
361
  }
362
+ /**
363
+ * A copy of `shape` the caller owns, for a boolean that has nothing to combine.
364
+ * With `trackEvolution` on, its face metadata is re-keyed onto the copy, as a
365
+ * real boolean would propagate it.
366
+ *
367
+ * @internal
368
+ */
369
+ function copyAsBooleanResult(shape, trackEvolution) {
370
+ const copy = require_shapeFns.clone(shape);
371
+ if (copy.ok && trackEvolution && hasAnyMetadata(shape)) propagateMetadataThroughRelocation(shape, copy.value);
372
+ return copy;
373
+ }
358
374
  function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
359
375
  if (signal?.aborted) throw signal.reason;
360
376
  const checkA = validateShape3D(a, "fuse: first operand");
@@ -483,35 +499,38 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isFinal, tr
483
499
  const mid = start + Math.ceil(count / 2);
484
500
  const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
485
501
  if (require_errors.isErr(leftResult)) return leftResult;
486
- const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
487
- if (require_errors.isErr(rightResult)) {
488
- if (leftResult.value.owned) require_shapeTypes.disposeResultShape(leftResult.value.shape);
489
- return rightResult;
502
+ const left = leftResult.value;
503
+ let right;
504
+ try {
505
+ const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, trackEvolution, signal, fuzzyValue);
506
+ if (require_errors.isErr(rightResult)) return rightResult;
507
+ right = rightResult.value;
508
+ const combined = fuse(left.shape, right.shape, {
509
+ optimisation,
510
+ simplify,
511
+ trackEvolution,
512
+ fuzzyValue,
513
+ unsafe: true,
514
+ ...signal ? { signal } : {}
515
+ });
516
+ if (require_errors.isErr(combined)) return combined;
517
+ return require_errors.ok({
518
+ shape: combined.value,
519
+ owned: true
520
+ });
521
+ } finally {
522
+ if (left.owned) require_shapeTypes.disposeResultShape(left.shape);
523
+ if (right?.owned) require_shapeTypes.disposeResultShape(right.shape);
490
524
  }
491
- const combined = fuse(leftResult.value.shape, rightResult.value.shape, {
492
- optimisation,
493
- simplify,
494
- trackEvolution,
495
- fuzzyValue,
496
- unsafe: true,
497
- ...signal ? { signal } : {}
498
- });
499
- if (leftResult.value.owned) require_shapeTypes.disposeResultShape(leftResult.value.shape);
500
- if (rightResult.value.owned) require_shapeTypes.disposeResultShape(rightResult.value.shape);
501
- if (require_errors.isErr(combined)) return combined;
502
- return require_errors.ok({
503
- shape: combined.value,
504
- owned: true
505
- });
506
525
  }
507
526
  function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "native", signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
508
527
  if (signal?.aborted) throw signal.reason;
509
528
  if (shapes.length === 0) return require_errors.err(require_errors.validationError("FUSE_ALL_EMPTY", "fuseAll requires at least one shape"));
510
- if (shapes.length === 1) return require_errors.ok(require_arrayAccess.firstOrThrow(shapes));
511
529
  for (let i = 0; i < shapes.length; i++) {
512
530
  const check = validateShape3D(require_arrayAccess.getAtOrThrow(shapes, i), `fuseAll: shape at index ${i}`);
513
531
  if (require_errors.isErr(check)) return check;
514
532
  }
533
+ if (shapes.length === 1) return copyAsBooleanResult(require_arrayAccess.firstOrThrow(shapes), trackEvolution);
515
534
  if (strategy === "native") {
516
535
  const kernel = require_shapeTypes.getKernel();
517
536
  const inputFaceHashes = trackEvolution && kernel.fuseAllWithHistory ? collectInputFaceHashes(shapes) : [];
@@ -541,9 +560,9 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
541
560
  }
542
561
  function cutAll(base, tools, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
543
562
  if (signal?.aborted) throw signal.reason;
544
- if (tools.length === 0) return require_errors.ok(base);
545
563
  const checkBase = validateShape3D(base, "cutAll: base");
546
564
  if (require_errors.isErr(checkBase)) return checkBase;
565
+ if (tools.length === 0) return copyAsBooleanResult(base, trackEvolution);
547
566
  for (let i = 0; i < tools.length; i++) {
548
567
  const check = validateShape3D(require_arrayAccess.getAtOrThrow(tools, i), `cutAll: tool at index ${i}`);
549
568
  if (require_errors.isErr(check)) return check;
@@ -787,11 +806,12 @@ function sectionToFace(shape, plane, options = {}) {
787
806
  }
788
807
  /**
789
808
  * Split a shape with one or more tool shapes using BRepAlgoAPI_Splitter.
790
- * Returns all pieces from the split as a compound.
809
+ * Returns all pieces from the split as a compound, or a copy of the shape when
810
+ * `tools` is empty, so the result is always the caller's to dispose.
791
811
  */
792
812
  function split(shape, tools) {
793
- if (tools.length === 0) return require_errors.ok(shape);
794
813
  if (require_shapeTypes.getKernel().isNull(shape.wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
814
+ if (tools.length === 0) return copyAsBooleanResult(shape, true);
795
815
  for (let i = 0; i < tools.length; i++) if (require_shapeTypes.getKernel().isNull(require_arrayAccess.getAtOrThrow(tools, i).wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, `splitShape: tool at index ${i} is a null shape`));
796
816
  try {
797
817
  const result = require_shapeTypes.getKernel().split(shape.wrapped, tools.map((t) => t.wrapped));
@@ -825,10 +845,11 @@ function slice(shape, planes, options = {}) {
825
845
  * simplifies the final shape.
826
846
  *
827
847
  * Falls back to sequential operations when the C++ pipeline class is not
828
- * available in the WASM build.
848
+ * available in the WASM build. An empty pipeline returns a copy of `base`, so
849
+ * the result is always the caller's to dispose.
829
850
  */
830
851
  function booleanPipeline(base, steps, options) {
831
- if (steps.length === 0) return require_errors.ok(base);
852
+ if (steps.length === 0) return copyAsBooleanResult(base, true);
832
853
  const glueMode = options?.optimisation === "commonFace" ? 1 : options?.optimisation === "sameFace" ? 2 : 0;
833
854
  const k = require_shapeTypes.getKernel();
834
855
  const kernelSteps = steps.map((s) => ({
@@ -856,9 +877,14 @@ function booleanPipelineFallback(base, steps, options) {
856
877
  unsafe: true
857
878
  };
858
879
  for (const step of steps) {
859
- const r = step.op === "fuse" ? fuse(current, step.tool, boolOpts) : step.op === "cut" ? cut(current, step.tool, boolOpts) : intersect(current, step.tool, boolOpts);
880
+ let r;
881
+ try {
882
+ r = step.op === "fuse" ? fuse(current, step.tool, boolOpts) : step.op === "cut" ? cut(current, step.tool, boolOpts) : intersect(current, step.tool, boolOpts);
883
+ } finally {
884
+ if (current !== base) require_shapeTypes.disposeResultShape(current);
885
+ }
860
886
  if (require_errors.isErr(r)) return r;
861
- current = require_errors.unwrap(r);
887
+ current = r.value;
862
888
  }
863
889
  return require_errors.ok(current);
864
890
  }
@@ -886,6 +912,12 @@ Object.defineProperty(exports, "colorShape", {
886
912
  return colorShape;
887
913
  }
888
914
  });
915
+ Object.defineProperty(exports, "copyAsBooleanResult", {
916
+ enumerable: true,
917
+ get: function() {
918
+ return copyAsBooleanResult;
919
+ }
920
+ });
889
921
  Object.defineProperty(exports, "cut", {
890
922
  enumerable: true,
891
923
  get: function() {
package/dist/brepjs.cjs CHANGED
@@ -12,31 +12,31 @@ const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
12
12
  const require_planeOps = require("./planeOps-DZfLToKZ.cjs");
13
13
  const require_faceFns = require("./faceFns-Jo9hMVqL.cjs");
14
14
  const require_solidBuilders = require("./solidBuilders-Dwm0hXn5.cjs");
15
- const require_booleanFns = require("./booleanFns-D0qfjH0a.cjs");
16
- const require_primitiveFns = require("./primitiveFns-eiM6OjWU.cjs");
15
+ const require_booleanFns = require("./booleanFns-CkcJ8WB7.cjs");
16
+ const require_primitiveFns = require("./primitiveFns-CZqSRhm8.cjs");
17
17
  const require_shapeFns = require("./shapeFns-D47cmLG8.cjs");
18
18
  const require_curveFns = require("./curveFns-B8mm5cou.cjs");
19
19
  const require_meshFns = require("./meshFns-Cs_qrlXI.cjs");
20
20
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
21
21
  const require_surfaceBuilders = require("./surfaceBuilders-D5kFAV1i.cjs");
22
- const require_healingFns = require("./healingFns-qioD81Of.cjs");
23
- const require_threadFns = require("./threadFns-DNFoBBrH.cjs");
24
- const require_blueprintSketcher = require("./blueprintSketcher-DHp6AeEM.cjs");
25
- const require_helpers = require("./helpers-BvYkHZK7.cjs");
26
- const require_blueprint = require("./blueprint-BY2aygt_.cjs");
27
- const require_drawFns = require("./drawFns-JZV96JGO.cjs");
28
- const require_measureFns = require("./measureFns-R85865k9.cjs");
29
- const require_cornerFinder = require("./cornerFinder-Da8Dv4bp.cjs");
30
- const require_boolean2D = require("./boolean2D-C6TS6oFP.cjs");
31
- const require_blueprintFns = require("./blueprintFns-AfHtvBKP.cjs");
32
- const require_importFns = require("./importFns-BzzUvnKA.cjs");
33
- const require_textBlueprints = require("./textBlueprints-D3XhH1kb.cjs");
22
+ const require_healingFns = require("./healingFns-DGc2hk9z.cjs");
23
+ const require_threadFns = require("./threadFns-Dq_Gff0C.cjs");
24
+ const require_blueprintSketcher = require("./blueprintSketcher-zQgjgodb.cjs");
25
+ const require_helpers = require("./helpers-D7Y4Vxhf.cjs");
26
+ const require_blueprint = require("./blueprint-DtPRNDEu.cjs");
27
+ const require_drawFns = require("./drawFns-CLJog-Xp.cjs");
28
+ const require_measureFns = require("./measureFns-D8uSDn-8.cjs");
29
+ const require_cornerFinder = require("./cornerFinder-Dzsi68w-.cjs");
30
+ const require_boolean2D = require("./boolean2D-BJFpEXix.cjs");
31
+ const require_blueprintFns = require("./blueprintFns-y2oH3LOO.cjs");
32
+ const require_importFns = require("./importFns-Dwlc0KtB.cjs");
33
+ const require_textBlueprints = require("./textBlueprints-BPrPhg5b.cjs");
34
34
  const require_loftFns = require("./loftFns-CnerVgTM.cjs");
35
- const require_refResolveFns = require("./refResolveFns-DpWvqRm0.cjs");
35
+ const require_refResolveFns = require("./refResolveFns-DBY8yC6n.cjs");
36
36
  const require_adjacencyFns = require("./adjacencyFns-DSGyqGyy.cjs");
37
37
  const require_cameraFns = require("./cameraFns-B9xKg36U.cjs");
38
- const require_textMetrics = require("./textMetrics-zk48vXsM.cjs");
39
- const require_principalBoxFns = require("./principalBoxFns-DepJW5im.cjs");
38
+ const require_textMetrics = require("./textMetrics-4xkjKmD1.cjs");
39
+ const require_principalBoxFns = require("./principalBoxFns-Cozj46sS.cjs");
40
40
  const require_workerPool = require("./workerPool-D5tiNXrI.cjs");
41
41
  // src/kernel/types.ts
42
42
  /** Check if the kernel supports hidden-line-removal projection. */
@@ -2773,7 +2773,7 @@ function combine(source, placements, fuse) {
2773
2773
  copies.push(placed.value);
2774
2774
  }
2775
2775
  const result = fuse ? require_booleanFns.fuseAll(copies, { unsafe: true }) : require_errors.ok(require_solidBuilders.makeCompound(copies));
2776
- for (const c of copies) if (!result.ok || c !== result.value) c[Symbol.dispose]();
2776
+ for (const c of copies) c[Symbol.dispose]();
2777
2777
  return result;
2778
2778
  }
2779
2779
  /**
package/dist/brepjs.js CHANGED
@@ -10,31 +10,31 @@ import { a as vecDot, c as vecLength, d as vecNormalize, f as vecProjectToPlane,
10
10
  import { i as pivotPlane, n as createPlane, o as resolvePlane, r as makePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-D3yDuMux.js";
11
11
  import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fromBREP, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, p as removeHolesFromFace, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, x as isCompSolid, y as downcast } from "./faceFns-2jGPfqvB.js";
12
12
  import { d as getFaceOrigins, m as setShapeOrigin, r as makeCylinder, t as makeCompound } from "./solidBuilders-ZDGdvaTU.js";
13
- import { C as getTagMetadata, S as getFaceTags, T as tagFaces, _ as colorShape, a as fuseAll$2, b as parseColor, c as sectionToFace$1, f as hasAnyMetadata, g as colorFaces, h as propagateMetadataThroughRelocation, i as fuse$2, l as slice$1, n as cut$2, o as intersect$2, r as cutAll$2, s as section$1, t as booleanPipeline, u as split$1, v as getFaceColor, w as setTagMetadata, x as findFacesByTag, y as getShapeColor } from "./booleanFns-BwzBRGqj.js";
14
- import { A as locate$1, C as threePointArc, D as wireLoop, E as wire, F as transformCopy$1, I as translate$2, M as resize, N as rotate$2, O as applyMatrix$1, P as scale$3, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, j as mirror$2, k as composeTransforms, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-NxbTqKy7.js";
13
+ import { C as getFaceTags, E as tagFaces, S as findFacesByTag, T as setTagMetadata, _ as colorFaces, a as fuse$2, b as getShapeColor, c as section$1, d as split$1, g as propagateMetadataThroughRelocation, i as cutAll$2, l as sectionToFace$1, o as fuseAll$2, p as hasAnyMetadata, r as cut$2, s as intersect$2, t as booleanPipeline, u as slice$1, v as colorShape, w as getTagMetadata, x as parseColor, y as getFaceColor } from "./booleanFns-B9RvEpHB.js";
14
+ import { A as locate$1, C as threePointArc, D as wireLoop, E as wire, F as transformCopy$1, I as translate$2, M as resize, N as rotate$2, O as applyMatrix$1, P as scale$3, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, j as mirror$2, k as composeTransforms, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-DPqHA3sX.js";
15
15
  import { a as isSameShape, i as isEqualShape, n as getHashCode, o as simplify$1, r as isEmpty$2, s as toBREP$1, t as clone$1 } from "./shapeFns-kFm-m8jh.js";
16
16
  import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-EsJgIpc6.js";
17
17
  import { a as meshEdges$1, c as meshMultiLOD, d as buildMeshCacheKey, f as clearMeshCache, i as mesh$1, l as scaleDefaultTolerance, n as exportSTEP, o as meshLODs, p as createMeshCache, r as exportSTL, s as meshLODsProgressive, t as exportIGES } from "./meshFns-Bo4EQJFO.js";
18
18
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
19
19
  import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, p as makeEllipseArc, r as makeFace, s as assembleWire, u as makeBezierCurve } from "./surfaceBuilders-BBs6D6Km.js";
20
- import { A as thicken$1, C as chamferDistAngles, D as offset$1, E as fillet$2, F as toLODGeometryLevels, I as toLineGeometryData, M as toBufferGeometryData, N as toGroupedBufferGeometryData, O as removeFaces$1, P as toLODGeometryData, S as chamferDistAngle, T as draft$1, _ as checkBoolean, a as healFace, b as getNurbsCurveData, c as isValid$1, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, i as heal$1, j as variableFillet, k as shell$2, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, w as chamfer$2, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-D6mUhe0Z.js";
21
- import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, G as quatFromAxisAngle, H as circularPattern, I as createAssemblyNode, J as quatRotate, K as quatFromTo, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as quatMultiply, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as updateNode } from "./threadFns-CEr8JDsu.js";
22
- import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-nBI9PlsW.js";
23
- import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-CsHdKbfF.js";
24
- import { _ as approximateAsSvgCompatibleCurve, o as ellipseArcFlags } from "./blueprint-DbNFPHzC.js";
25
- import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-BQIHgHQg.js";
26
- import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, i as measureCurvatureAtMid, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, r as measureCurvatureAt, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-D3egqKcW.js";
27
- import { t as cornerFinder } from "./cornerFinder-CeyQ5JMA.js";
28
- import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-DuWgyjOR.js";
29
- import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-dU5V5WcD.js";
30
- import { a as exportSTEPConfigured, c as exportThreeMF, d as exportGlb, f as exportGltf, i as sewMeshToSolid, l as blueprintToDXF, n as importSTEP, o as importSVG, p as exportOBJ, r as importSTL, s as importSVGPathD, t as importIGES, u as exportDXF } from "./importFns-C8yUNPzJ.js";
31
- import { S as revolve$2, a as Sketches, b as extrude$2, c as compoundSketchFace, d as sketchExtrude, f as sketchFace, g as sketchWires, h as sketchSweep, i as setFallbackFont, l as compoundSketchLoft, m as sketchRevolve, n as getFont, o as Sketch, p as sketchLoft, r as loadFont, s as compoundSketchExtrude, t as textBlueprints, u as compoundSketchRevolve, x as extrudeAll, y as CompoundSketch } from "./textBlueprints-BvZNjVwM.js";
20
+ import { A as thicken$1, C as chamferDistAngles, D as offset$1, E as fillet$2, F as toLODGeometryLevels, I as toLineGeometryData, M as toBufferGeometryData, N as toGroupedBufferGeometryData, O as removeFaces$1, P as toLODGeometryData, S as chamferDistAngle, T as draft$1, _ as checkBoolean, a as healFace, b as getNurbsCurveData, c as isValid$1, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, i as heal$1, j as variableFillet, k as shell$2, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, w as chamfer$2, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-DvuJr4RS.js";
21
+ import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, G as quatFromAxisAngle, H as circularPattern, I as createAssemblyNode, J as quatRotate, K as quatFromTo, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as quatMultiply, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as updateNode } from "./threadFns-D7D_qR7t.js";
22
+ import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-DPP1g95U.js";
23
+ import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-BuI9lh-t.js";
24
+ import { _ as approximateAsSvgCompatibleCurve, o as ellipseArcFlags } from "./blueprint-BYXwa2cF.js";
25
+ import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-Bht1ceeH.js";
26
+ import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, i as measureCurvatureAtMid, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, r as measureCurvatureAt, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns--UKrACtx.js";
27
+ import { t as cornerFinder } from "./cornerFinder-DgVMDBCo.js";
28
+ import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-CNf7lVXV.js";
29
+ import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-YuJQgywS.js";
30
+ import { a as exportSTEPConfigured, c as exportThreeMF, d as exportGlb, f as exportGltf, i as sewMeshToSolid, l as blueprintToDXF, n as importSTEP, o as importSVG, p as exportOBJ, r as importSTL, s as importSVGPathD, t as importIGES, u as exportDXF } from "./importFns-TKzj4FaZ.js";
31
+ import { S as revolve$2, a as Sketches, b as extrude$2, c as compoundSketchFace, d as sketchExtrude, f as sketchFace, g as sketchWires, h as sketchSweep, i as setFallbackFont, l as compoundSketchLoft, m as sketchRevolve, n as getFont, o as Sketch, p as sketchLoft, r as loadFont, s as compoundSketchExtrude, t as textBlueprints, u as compoundSketchRevolve, x as extrudeAll, y as CompoundSketch } from "./textBlueprints-Dq3pUNSr.js";
32
32
  import { a as multiSectionSweep, c as twistExtrude, i as guidedSweep, n as loftAll, o as supportExtrude, r as complexExtrude, s as sweep$1, t as loft$2 } from "./loftFns-jnQL_zpD.js";
33
- import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-Bl10yOGJ.js";
33
+ import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-DtztzO1g.js";
34
34
  import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-DfPO5LGP.js";
35
35
  import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-CLkNCsYU.js";
36
- import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-BGPUxjiq.js";
37
- import { t as principalBoundingBox } from "./principalBoxFns-BgetPvvQ.js";
36
+ import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-JN70dV5x.js";
37
+ import { t as principalBoundingBox } from "./principalBoxFns-C3SQMyG5.js";
38
38
  import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-Bc5hmJc4.js";
39
39
  // \0rolldown/runtime.js
40
40
  var __defProp = Object.defineProperty;
@@ -2782,7 +2782,7 @@ function combine(source, placements, fuse) {
2782
2782
  copies.push(placed.value);
2783
2783
  }
2784
2784
  const result = fuse ? fuseAll$2(copies, { unsafe: true }) : ok(makeCompound(copies));
2785
- for (const c of copies) if (!result.ok || c !== result.value) c[Symbol.dispose]();
2785
+ for (const c of copies) c[Symbol.dispose]();
2786
2786
  return result;
2787
2787
  }
2788
2788
  /**
@@ -1,6 +1,6 @@
1
1
  import { t as DEG2RAD } from "./constants-iraOnb2p.js";
2
2
  import { n as getAtOrThrow } from "./arrayAccess-BpgouNir.js";
3
- import { p as distance2d, u as angle2d, v as samePoint } from "./helpers-CsHdKbfF.js";
3
+ import { p as distance2d, u as angle2d, v as samePoint } from "./helpers-BuI9lh-t.js";
4
4
  // src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -1,6 +1,6 @@
1
1
  const require_constants = require("./constants-oee0S_x6.cjs");
2
2
  const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
3
- const require_helpers = require("./helpers-BvYkHZK7.cjs");
3
+ const require_helpers = require("./helpers-D7Y4Vxhf.cjs");
4
4
  // src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {