brepjs 13.2.0 → 14.1.2

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 (147) hide show
  1. package/dist/2d/curve2dGeometryFns.d.ts +107 -0
  2. package/dist/2d/curve2dGeometryFns.d.ts.map +1 -0
  3. package/dist/2d.cjs +230 -3
  4. package/dist/2d.d.ts +2 -0
  5. package/dist/2d.d.ts.map +1 -1
  6. package/dist/2d.js +207 -4
  7. package/dist/arrayAccess-CmulMesb.cjs +40 -0
  8. package/dist/arrayAccess-xxcB3YNq.js +23 -0
  9. package/dist/{blueprint-DYCdRlW5.js → blueprint-B3A5x7P9.js} +10 -10
  10. package/dist/{blueprint-PLJan-W5.cjs → blueprint-D0XChcek.cjs} +14 -14
  11. package/dist/{blueprintFns-eWh7NpZx.js → blueprintFns-BwAMXY3t.js} +3 -3
  12. package/dist/{blueprintFns-Bsx25BG7.cjs → blueprintFns-COrEYX29.cjs} +3 -3
  13. package/dist/{boolean2D-CtB21ajK.cjs → boolean2D-BPsyKImE.cjs} +20 -19
  14. package/dist/{boolean2D-52qVCooY.js → boolean2D-D_Te-6N6.js} +13 -12
  15. package/dist/{booleanFns-BrptUFkP.cjs → booleanFns-B6M6Lm0V.cjs} +24 -22
  16. package/dist/{booleanFns-iM6UPb8e.js → booleanFns-CgsaJFBf.js} +8 -6
  17. package/dist/brepjs.cjs +304 -211
  18. package/dist/brepjs.js +188 -145
  19. package/dist/constants-B9u763C3.js +9 -0
  20. package/dist/constants-unWN8k4c.cjs +26 -0
  21. package/dist/core/curve2dHandle.d.ts +27 -0
  22. package/dist/core/curve2dHandle.d.ts.map +1 -0
  23. package/dist/core/errors.d.ts +11 -1
  24. package/dist/core/errors.d.ts.map +1 -1
  25. package/dist/core/kernelCall.d.ts.map +1 -1
  26. package/dist/core/kernelErrorTranslation.d.ts +2 -0
  27. package/dist/core/kernelErrorTranslation.d.ts.map +1 -1
  28. package/dist/core.cjs +9 -8
  29. package/dist/core.js +6 -5
  30. package/dist/{cornerFinder-C7aDyYLJ.js → cornerFinder-AEFnAxt4.js} +3 -3
  31. package/dist/{cornerFinder-SF-xmMO1.cjs → cornerFinder-DTt_SvtC.cjs} +4 -4
  32. package/dist/{curveFns-C-jU1_Y_.js → curveFns-CcInoOEA.js} +2 -2
  33. package/dist/{curveFns-ywh7Ctyk.cjs → curveFns-DCEcwcpd.cjs} +2 -2
  34. package/dist/{drawFns-DknEB-Qs.cjs → drawFns-BOwBIzPa.cjs} +35 -18
  35. package/dist/{drawFns-D-0p86Lf.js → drawFns-n9qif7QN.js} +17 -15
  36. package/dist/{errors-DupKEMqI.cjs → errors-9zQcQK1H.cjs} +34 -0
  37. package/dist/{errors-B_T0aMQF.js → errors-C-cgQA3w.js} +29 -1
  38. package/dist/{extrudeFns-LsH1rDMa.js → extrudeFns-DrDr9-nU.js} +3 -3
  39. package/dist/{extrudeFns-CGCIbydL.cjs → extrudeFns-Rcut7h8S.cjs} +3 -3
  40. package/dist/{faceFns-EnGcKFAr.js → faceFns-TSH54pPQ.js} +94 -4
  41. package/dist/{faceFns-8dGb8q3J.cjs → faceFns-cE2WxY6I.cjs} +111 -3
  42. package/dist/{helpers-pQpV9Mwh.cjs → helpers-DZje6XWE.cjs} +18 -17
  43. package/dist/{helpers-Rf0vhX6I.js → helpers-XrXlKm8D.js} +8 -7
  44. package/dist/{historyFns-XkjLAQyu.js → historyFns-2hCWrX_X.js} +10 -10
  45. package/dist/{historyFns-lNalnOdR.cjs → historyFns-BiQ9dmzp.cjs} +10 -10
  46. package/dist/{importFns-BSH9cGIp.cjs → importFns-DGE5nCSW.cjs} +4 -4
  47. package/dist/{importFns-Bgs-FYAP.js → importFns-m0xyj0Zt.js} +4 -4
  48. package/dist/index.d.ts +14 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/io.cjs +2 -2
  51. package/dist/io.js +2 -2
  52. package/dist/kernel/brepkit/brepkitAdapter.d.ts +150 -241
  53. package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +1 -1
  54. package/dist/kernel/brepkit/evolutionOps.d.ts +1 -0
  55. package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -1
  56. package/dist/kernel/index.d.ts +1 -1
  57. package/dist/kernel/index.d.ts.map +1 -1
  58. package/dist/kernel/interfaces/curveOps.d.ts +3 -1
  59. package/dist/kernel/interfaces/curveOps.d.ts.map +1 -1
  60. package/dist/kernel/interfaces/surfaceOps.d.ts +3 -1
  61. package/dist/kernel/interfaces/surfaceOps.d.ts.map +1 -1
  62. package/dist/kernel/occt/defaultAdapter.d.ts +3 -1
  63. package/dist/kernel/occt/defaultAdapter.d.ts.map +1 -1
  64. package/dist/kernel/occt/nurbsQueryOps.d.ts +12 -0
  65. package/dist/kernel/occt/nurbsQueryOps.d.ts.map +1 -0
  66. package/dist/kernel/types.d.ts +26 -0
  67. package/dist/kernel/types.d.ts.map +1 -1
  68. package/dist/{measureFns-D7J6qUY_.js → measureFns-DHByqdmn.js} +9 -16
  69. package/dist/{measureFns-CFdHa_fj.cjs → measureFns-D_QKZ5yg.cjs} +9 -16
  70. package/dist/measurement/measureFns.d.ts.map +1 -1
  71. package/dist/measurement.cjs +1 -1
  72. package/dist/measurement.js +1 -1
  73. package/dist/{meshFns-2XnDXgIh.cjs → meshFns-CVe3Kc77.cjs} +4 -4
  74. package/dist/{meshFns-B7uklc4M.js → meshFns-DL4Djz3w.js} +3 -3
  75. package/dist/ns/booleans.d.ts +10 -0
  76. package/dist/ns/booleans.d.ts.map +1 -0
  77. package/dist/ns/construction.d.ts +10 -0
  78. package/dist/ns/construction.d.ts.map +1 -0
  79. package/dist/ns/ioNs.d.ts +18 -0
  80. package/dist/ns/ioNs.d.ts.map +1 -0
  81. package/dist/ns/measurement.d.ts +6 -0
  82. package/dist/ns/measurement.d.ts.map +1 -0
  83. package/dist/ns/modifiers.d.ts +6 -0
  84. package/dist/ns/modifiers.d.ts.map +1 -0
  85. package/dist/ns/patterns.d.ts +5 -0
  86. package/dist/ns/patterns.d.ts.map +1 -0
  87. package/dist/ns/primitives.d.ts +7 -0
  88. package/dist/ns/primitives.d.ts.map +1 -0
  89. package/dist/ns/query.d.ts +6 -0
  90. package/dist/ns/query.d.ts.map +1 -0
  91. package/dist/ns/transforms.d.ts +5 -0
  92. package/dist/ns/transforms.d.ts.map +1 -0
  93. package/dist/operations.cjs +2 -2
  94. package/dist/operations.js +2 -2
  95. package/dist/{planeOps-cTxDywpG.cjs → planeOps-6Wu7dMDN.cjs} +5 -4
  96. package/dist/{planeOps-BuBXTLBr.js → planeOps-gTOEarV2.js} +4 -3
  97. package/dist/{primitiveFns-DKtvEA0i.cjs → primitiveFns-CRPGjIFg.cjs} +101 -69
  98. package/dist/{primitiveFns-CASk8g16.js → primitiveFns-CeKiYSSW.js} +28 -8
  99. package/dist/query.cjs +2 -2
  100. package/dist/query.js +2 -2
  101. package/dist/result.cjs +1 -1
  102. package/dist/result.js +1 -1
  103. package/dist/{arrayAccess-Dps31ERU.js → shapeFns-DCi9O27X.js} +8 -30
  104. package/dist/{arrayAccess-peFKE9Ob.cjs → shapeFns-aEeSHNqX.cjs} +24 -64
  105. package/dist/shapeRef.cjs +8 -0
  106. package/dist/shapeRef.d.ts +5 -0
  107. package/dist/shapeRef.d.ts.map +1 -0
  108. package/dist/shapeRef.js +2 -0
  109. package/dist/shapeRefFns-B1TODUMl.js +194 -0
  110. package/dist/shapeRefFns-CVdS6jWS.cjs +229 -0
  111. package/dist/{shapeTypes-CYb8Byqj.js → shapeTypes-BO1aiDhi.js} +3937 -3697
  112. package/dist/{shapeTypes-CElaawp7.cjs → shapeTypes-BqWQlrYE.cjs} +3937 -3697
  113. package/dist/sketching.cjs +2 -2
  114. package/dist/sketching.js +2 -2
  115. package/dist/{solidBuilders-Cs4XyL58.cjs → solidBuilders-0iVdiZUw.cjs} +3 -3
  116. package/dist/{solidBuilders-ClJxiUa3.js → solidBuilders-jk7HfWs8.js} +3 -3
  117. package/dist/{surfaceBuilders-ZUTb3z6i.cjs → surfaceBuilders-C_8rs79F.cjs} +3 -3
  118. package/dist/{surfaceBuilders-DnGdDW8i.js → surfaceBuilders-DE5e6bp8.js} +3 -3
  119. package/dist/topology/api.d.ts +3 -3
  120. package/dist/topology/api.d.ts.map +1 -1
  121. package/dist/topology/nurbsFns.d.ts +13 -0
  122. package/dist/topology/nurbsFns.d.ts.map +1 -0
  123. package/dist/topology/shapeFns.d.ts +4 -3
  124. package/dist/topology/shapeFns.d.ts.map +1 -1
  125. package/dist/topology/shapeRef/index.d.ts +7 -0
  126. package/dist/topology/shapeRef/index.d.ts.map +1 -0
  127. package/dist/topology/shapeRef/scoring.d.ts +16 -0
  128. package/dist/topology/shapeRef/scoring.d.ts.map +1 -0
  129. package/dist/topology/shapeRef/shapeRefFns.d.ts +47 -0
  130. package/dist/topology/shapeRef/shapeRefFns.d.ts.map +1 -0
  131. package/dist/topology/shapeRef/shapeRefTypes.d.ts +40 -0
  132. package/dist/topology/shapeRef/shapeRefTypes.d.ts.map +1 -0
  133. package/dist/topology.cjs +22 -20
  134. package/dist/topology.d.ts +1 -0
  135. package/dist/topology.d.ts.map +1 -1
  136. package/dist/topology.js +7 -7
  137. package/dist/{vecOps-4iBMiet9.cjs → vecOps-BXvBYIor.cjs} +0 -26
  138. package/dist/{vecOps-B9-MTeC8.js → vecOps-D9etjPgV.js} +1 -9
  139. package/dist/vectors.cjs +6 -5
  140. package/dist/vectors.js +4 -3
  141. package/dist/worker.cjs +1 -1
  142. package/dist/worker.js +1 -1
  143. package/package.json +14 -4
  144. /package/dist/{types-Bb4KK_iG.js → types-BWBlwp6w.js} +0 -0
  145. /package/dist/{types-BD-VVaWB.cjs → types-BjDcsS7l.cjs} +0 -0
  146. /package/dist/{workerHandler-nLkvSOKX.cjs → workerHandler-C-7OUJsa.cjs} +0 -0
  147. /package/dist/{workerHandler-BrOTzYRI.js → workerHandler-o2xzAfFk.js} +0 -0
@@ -0,0 +1,40 @@
1
+ //#region src/utils/arrayAccess.ts
2
+ /**
3
+ * Safe array access utilities.
4
+ * Replaces `arr[i]!` patterns where TypeScript's `noUncheckedIndexedAccess` requires
5
+ * a non-null assertion but bounds are proven by surrounding code.
6
+ */
7
+ /** Access element by index, throwing if out of bounds. Use when bounds are logically guaranteed. */
8
+ function getAtOrThrow(arr, index, msg) {
9
+ if (index < 0 || index >= arr.length) throw new Error(msg ?? `Index ${index} out of bounds (length ${arr.length})`);
10
+ return arr[index];
11
+ }
12
+ /** Get the first element of a non-empty array, throwing if empty. */
13
+ function firstOrThrow(arr, msg) {
14
+ if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
15
+ return arr[0];
16
+ }
17
+ /** Get the last element of a non-empty array, throwing if empty. */
18
+ function lastOrThrow(arr, msg) {
19
+ if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
20
+ return arr[arr.length - 1];
21
+ }
22
+ //#endregion
23
+ Object.defineProperty(exports, "firstOrThrow", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return firstOrThrow;
27
+ }
28
+ });
29
+ Object.defineProperty(exports, "getAtOrThrow", {
30
+ enumerable: true,
31
+ get: function() {
32
+ return getAtOrThrow;
33
+ }
34
+ });
35
+ Object.defineProperty(exports, "lastOrThrow", {
36
+ enumerable: true,
37
+ get: function() {
38
+ return lastOrThrow;
39
+ }
40
+ });
@@ -0,0 +1,23 @@
1
+ //#region src/utils/arrayAccess.ts
2
+ /**
3
+ * Safe array access utilities.
4
+ * Replaces `arr[i]!` patterns where TypeScript's `noUncheckedIndexedAccess` requires
5
+ * a non-null assertion but bounds are proven by surrounding code.
6
+ */
7
+ /** Access element by index, throwing if out of bounds. Use when bounds are logically guaranteed. */
8
+ function getAtOrThrow(arr, index, msg) {
9
+ if (index < 0 || index >= arr.length) throw new Error(msg ?? `Index ${index} out of bounds (length ${arr.length})`);
10
+ return arr[index];
11
+ }
12
+ /** Get the first element of a non-empty array, throwing if empty. */
13
+ function firstOrThrow(arr, msg) {
14
+ if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
15
+ return arr[0];
16
+ }
17
+ /** Get the last element of a non-empty array, throwing if empty. */
18
+ function lastOrThrow(arr, msg) {
19
+ if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
20
+ return arr[arr.length - 1];
21
+ }
22
+ //#endregion
23
+ export { getAtOrThrow as n, lastOrThrow as r, firstOrThrow as t };
@@ -1,13 +1,13 @@
1
- import { H as registerForCleanup, W as unregisterFromCleanup, X as getKernel2D, Y as getKernel, a as createEdge, u as createWire } from "./shapeTypes-CYb8Byqj.js";
2
- import { L as unwrap, d as validationError, k as ok, m as bug, n as computationError, y as err } from "./errors-B_T0aMQF.js";
3
- import { _ as DEG2RAD, y as RAD2DEG } from "./vecOps-B9-MTeC8.js";
4
- import { r as toVec3 } from "./types-Bb4KK_iG.js";
5
- import { r as makePlane } from "./planeOps-BuBXTLBr.js";
6
- import { g as cast, m as uvCoordinates, n as faceCenter, p as uvBounds, r as faceGeomType } from "./faceFns-EnGcKFAr.js";
7
- import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-Dps31ERU.js";
8
- import { f as getOrientation } from "./curveFns-C-jU1_Y_.js";
9
- import { r as makeFace } from "./surfaceBuilders-DnGdDW8i.js";
10
- import { _ as samePoint, b as subtract2d, l as add2d, o as normalize2d, p as distance2d, t as getSingleFace, v as scalarMultiply2d } from "./helpers-Rf0vhX6I.js";
1
+ import { H as registerForCleanup, W as unregisterFromCleanup, X as getKernel2D, Y as getKernel, a as createEdge, u as createWire } from "./shapeTypes-BO1aiDhi.js";
2
+ import { A as ok, R as unwrap, b as err, d as validationError, h as bug, n as computationError } from "./errors-C-cgQA3w.js";
3
+ import { g as cast, m as uvCoordinates, n as faceCenter, p as uvBounds, r as faceGeomType } from "./faceFns-TSH54pPQ.js";
4
+ import { r as RAD2DEG, t as DEG2RAD } from "./constants-B9u763C3.js";
5
+ import { r as toVec3 } from "./types-BWBlwp6w.js";
6
+ import { r as makePlane } from "./planeOps-gTOEarV2.js";
7
+ import { f as getOrientation } from "./curveFns-CcInoOEA.js";
8
+ import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
9
+ import { r as makeFace } from "./surfaceBuilders-DE5e6bp8.js";
10
+ import { _ as samePoint, b as subtract2d, l as add2d, o as normalize2d, p as distance2d, t as getSingleFace, v as scalarMultiply2d } from "./helpers-XrXlKm8D.js";
11
11
  //#region src/2d/lib/definitions.ts
12
12
  /** Type guard that checks whether a value is a `Point2D`. */
13
13
  function isPoint2D(point) {
@@ -1,13 +1,13 @@
1
- const require_shapeTypes = require("./shapeTypes-CElaawp7.cjs");
2
- const require_errors = require("./errors-DupKEMqI.cjs");
3
- const require_vecOps = require("./vecOps-4iBMiet9.cjs");
4
- const require_types = require("./types-BD-VVaWB.cjs");
5
- const require_planeOps = require("./planeOps-cTxDywpG.cjs");
6
- const require_faceFns = require("./faceFns-8dGb8q3J.cjs");
7
- const require_arrayAccess = require("./arrayAccess-peFKE9Ob.cjs");
8
- const require_curveFns = require("./curveFns-ywh7Ctyk.cjs");
9
- const require_surfaceBuilders = require("./surfaceBuilders-ZUTb3z6i.cjs");
10
- const require_helpers = require("./helpers-pQpV9Mwh.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
2
+ const require_errors = require("./errors-9zQcQK1H.cjs");
3
+ const require_faceFns = require("./faceFns-cE2WxY6I.cjs");
4
+ const require_constants = require("./constants-unWN8k4c.cjs");
5
+ const require_types = require("./types-BjDcsS7l.cjs");
6
+ const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
7
+ const require_curveFns = require("./curveFns-DCEcwcpd.cjs");
8
+ const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
9
+ const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
10
+ const require_helpers = require("./helpers-DZje6XWE.cjs");
11
11
  //#region src/2d/lib/definitions.ts
12
12
  /** Type guard that checks whether a value is a `Point2D`. */
13
13
  function isPoint2D(point) {
@@ -528,7 +528,7 @@ var adaptedCurveToPathElem = (curve, lastPoint) => {
528
528
  if (!circleData) require_errors.bug("adaptedCurveToPathElem", "Expected circle data");
529
529
  const { radius, isDirect } = circleData;
530
530
  const bounds = k2d.getCurve2dBounds(curve.wrapped);
531
- const paramAngle = (bounds.last - bounds.first) * require_vecOps.RAD2DEG;
531
+ const paramAngle = (bounds.last - bounds.first) * require_constants.RAD2DEG;
532
532
  const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
533
533
  return `A ${radius} ${radius} 0 ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${isDirect ? "1" : "0"} ${end}`;
534
534
  }
@@ -537,9 +537,9 @@ var adaptedCurveToPathElem = (curve, lastPoint) => {
537
537
  if (!ellipseData) require_errors.bug("adaptedCurveToPathElem", "Expected ellipse data");
538
538
  const { majorRadius: rx, minorRadius: ry, xAxisAngle, isDirect } = ellipseData;
539
539
  const bounds = k2d.getCurve2dBounds(curve.wrapped);
540
- const paramAngle = (bounds.last - bounds.first) * require_vecOps.RAD2DEG;
540
+ const paramAngle = (bounds.last - bounds.first) * require_constants.RAD2DEG;
541
541
  const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
542
- const angle = 180 - xAxisAngle * require_vecOps.RAD2DEG;
542
+ const angle = 180 - xAxisAngle * require_constants.RAD2DEG;
543
543
  return `A ${round5(rx)} ${round5(ry)} ${round5(angle)} ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${isDirect ? "1" : "0"} ${end}`;
544
544
  }
545
545
  require_errors.bug("adaptedCurveToPathElem", `Unsupported curve type: ${curveType}`);
@@ -807,7 +807,7 @@ var Blueprint = class Blueprint {
807
807
  * @returns A new rotated Blueprint.
808
808
  */
809
809
  rotate(angle, center) {
810
- return new Blueprint(transformCurves(this.curves, rotateTransform2d(angle * require_vecOps.DEG2RAD, center)));
810
+ return new Blueprint(transformCurves(this.curves, rotateTransform2d(angle * require_constants.DEG2RAD, center)));
811
811
  }
812
812
  translate(xDistOrPoint, yDist = 0) {
813
813
  const translationVector = isPoint2D(xDistOrPoint) ? xDistOrPoint : [xDistOrPoint, yDist];
@@ -1,6 +1,6 @@
1
- import { d as validationError, k as ok, t as BrepErrorCode, y as err } from "./errors-B_T0aMQF.js";
2
- import { h as CompoundBlueprint } from "./boolean2D-52qVCooY.js";
3
- import { t as Blueprint } from "./blueprint-DYCdRlW5.js";
1
+ import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-C-cgQA3w.js";
2
+ import { h as CompoundBlueprint } from "./boolean2D-D_Te-6N6.js";
3
+ import { t as Blueprint } from "./blueprint-B3A5x7P9.js";
4
4
  //#region src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -1,6 +1,6 @@
1
- const require_errors = require("./errors-DupKEMqI.cjs");
2
- const require_boolean2D = require("./boolean2D-CtB21ajK.cjs");
3
- const require_blueprint = require("./blueprint-PLJan-W5.cjs");
1
+ const require_errors = require("./errors-9zQcQK1H.cjs");
2
+ const require_boolean2D = require("./boolean2D-BPsyKImE.cjs");
3
+ const require_blueprint = require("./blueprint-D0XChcek.cjs");
4
4
  //#region src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -1,15 +1,16 @@
1
- const require_shapeTypes = require("./shapeTypes-CElaawp7.cjs");
2
- const require_errors = require("./errors-DupKEMqI.cjs");
3
- const require_vecOps = require("./vecOps-4iBMiet9.cjs");
4
- const require_types = require("./types-BD-VVaWB.cjs");
5
- const require_planeOps = require("./planeOps-cTxDywpG.cjs");
6
- const require_faceFns = require("./faceFns-8dGb8q3J.cjs");
7
- const require_arrayAccess = require("./arrayAccess-peFKE9Ob.cjs");
8
- const require_curveFns = require("./curveFns-ywh7Ctyk.cjs");
9
- const require_surfaceBuilders = require("./surfaceBuilders-ZUTb3z6i.cjs");
10
- const require_helpers = require("./helpers-pQpV9Mwh.cjs");
11
- const require_blueprint = require("./blueprint-PLJan-W5.cjs");
12
- const require_extrudeFns = require("./extrudeFns-CGCIbydL.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
2
+ const require_errors = require("./errors-9zQcQK1H.cjs");
3
+ const require_faceFns = require("./faceFns-cE2WxY6I.cjs");
4
+ const require_constants = require("./constants-unWN8k4c.cjs");
5
+ const require_types = require("./types-BjDcsS7l.cjs");
6
+ const require_vecOps = require("./vecOps-BXvBYIor.cjs");
7
+ const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
8
+ const require_curveFns = require("./curveFns-DCEcwcpd.cjs");
9
+ const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
10
+ const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
11
+ const require_helpers = require("./helpers-DZje6XWE.cjs");
12
+ const require_blueprint = require("./blueprint-D0XChcek.cjs");
13
+ const require_extrudeFns = require("./extrudeFns-Rcut7h8S.cjs");
13
14
  //#region node_modules/flatqueue/index.js
14
15
  /** @template T */
15
16
  var FlatQueue = class {
@@ -1213,10 +1214,10 @@ var defaultsSplineOptions = (config) => {
1213
1214
  };
1214
1215
  const { endTangent: endTgt, startFactor = 1, endFactor = 1, startTangent: startTgt } = conf;
1215
1216
  let endTangent;
1216
- if (typeof endTgt === "number") endTangent = require_helpers.polarToCartesian(1, endTgt * require_vecOps.DEG2RAD);
1217
+ if (typeof endTgt === "number") endTangent = require_helpers.polarToCartesian(1, endTgt * require_constants.DEG2RAD);
1217
1218
  else endTangent = endTgt;
1218
1219
  let startTangent;
1219
- if (typeof startTgt === "number") startTangent = require_helpers.polarToCartesian(1, startTgt * require_vecOps.DEG2RAD);
1220
+ if (typeof startTgt === "number") startTangent = require_helpers.polarToCartesian(1, startTgt * require_constants.DEG2RAD);
1220
1221
  else startTangent = startTgt;
1221
1222
  return {
1222
1223
  endTangent,
@@ -1335,7 +1336,7 @@ function normalizeEllipseRadii(horizontalRadius, verticalRadius, rotation) {
1335
1336
  * @param convertToUV - Coordinate conversion function from user space to UV space.
1336
1337
  */
1337
1338
  function makeEllipseArcFromSvgParams(startUV, endUV, majorRadius, minorRadius, rotationAngleDeg, longAxis, sweep, convertToUV) {
1338
- const radRotationAngle = rotationAngleDeg * require_vecOps.DEG2RAD;
1339
+ const radRotationAngle = rotationAngleDeg * require_constants.DEG2RAD;
1339
1340
  const convertAxis = (ax) => require_helpers.distance2d(convertToUV(ax));
1340
1341
  const r1 = convertAxis(require_helpers.polarToCartesian(majorRadius, radRotationAngle));
1341
1342
  const r2 = convertAxis(require_helpers.polarToCartesian(minorRadius, radRotationAngle + Math.PI / 2));
@@ -1427,7 +1428,7 @@ var BaseSketcher2d = class {
1427
1428
  const lastCurve = this._lastCurve();
1428
1429
  if (!lastCurve) return 0;
1429
1430
  const [dx, dy] = lastCurve.tangentAt(1);
1430
- return Math.atan2(dy, dx) * require_vecOps.RAD2DEG;
1431
+ return Math.atan2(dy, dx) * require_constants.RAD2DEG;
1431
1432
  }
1432
1433
  /** Move the pen to an absolute 2D position before drawing any curves. */
1433
1434
  movePointerTo(point) {
@@ -1473,11 +1474,11 @@ var BaseSketcher2d = class {
1473
1474
  }
1474
1475
  /** Draw a line to a point given in polar coordinates [r, theta] from the origin. */
1475
1476
  polarLineTo([r, theta]) {
1476
- return this.lineTo(require_helpers.polarToCartesian(r, theta * require_vecOps.DEG2RAD));
1477
+ return this.lineTo(require_helpers.polarToCartesian(r, theta * require_constants.DEG2RAD));
1477
1478
  }
1478
1479
  /** Draw a line in polar coordinates (distance and angle in degrees) from the current point. */
1479
1480
  polarLine(distance, angle) {
1480
- const [x, y] = require_helpers.polarToCartesian(distance, angle * require_vecOps.DEG2RAD);
1481
+ const [x, y] = require_helpers.polarToCartesian(distance, angle * require_constants.DEG2RAD);
1481
1482
  return this.line(x, y);
1482
1483
  }
1483
1484
  /** Draw a line tangent to the previous curve, extending by the given distance. */
@@ -1564,7 +1565,7 @@ var BaseSketcher2d = class {
1564
1565
  halfEllipseTo(end, minorRadius, sweep = false) {
1565
1566
  const angle = require_helpers.polarAngle2d(end, this.pointer);
1566
1567
  const dist = require_helpers.distance2d(end, this.pointer);
1567
- return this.ellipseTo(end, dist / 2, minorRadius, angle * require_vecOps.RAD2DEG, true, sweep);
1568
+ return this.ellipseTo(end, dist / 2, minorRadius, angle * require_constants.RAD2DEG, true, sweep);
1568
1569
  }
1569
1570
  /** Draw a half-ellipse arc to a relative end point with a given minor radius. */
1570
1571
  halfEllipse(xDist, yDist, minorRadius, sweep = false) {
@@ -1,15 +1,16 @@
1
- import { J as _usingCtx, L as DisposalScope, X as getKernel2D, Y as getKernel, a as createEdge, h as isShape3D, o as createFace, t as castShape, u as createWire } from "./shapeTypes-CYb8Byqj.js";
2
- import { L as unwrap, d as validationError, i as kernelError, k as ok, l as typeCastError, m as bug, n as computationError, s as safeIndex, w as isOk, y as err } from "./errors-B_T0aMQF.js";
3
- import { _ as DEG2RAD, d as vecNormalize, h as vecScale, r as vecCross, y as RAD2DEG } from "./vecOps-B9-MTeC8.js";
4
- import { r as toVec3 } from "./types-Bb4KK_iG.js";
5
- import { n as createPlane } from "./planeOps-BuBXTLBr.js";
6
- import { _ as downcast, c as normalAt, p as uvBounds, u as pointOnSurface } from "./faceFns-EnGcKFAr.js";
7
- import { r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-Dps31ERU.js";
8
- import { c as curveStartPoint, l as curveTangentAt, r as curveIsClosed } from "./curveFns-C-jU1_Y_.js";
9
- import { _ as zip, i as makeNewFaceWithinFace, r as makeFace, s as assembleWire } from "./surfaceBuilders-DnGdDW8i.js";
10
- import { _ as samePoint$1, b as subtract2d, d as cartesianToPolar, f as crossProduct2d, g as rotate2d, h as polarToCartesian, l as add2d, m as polarAngle2d, o as normalize2d, p as distance2d, s as PRECISION_INTERSECTION, v as scalarMultiply2d } from "./helpers-Rf0vhX6I.js";
11
- import { _ as Curve2D, b as removeDuplicatePoints, c as make2dCircle, f as make2dSegmentCurve, h as approximateAsBSpline, m as make2dThreePointArc, n as asSVG, o as make2dArcFromCenter, p as make2dTangentArc, r as viewbox, s as make2dBezierCurve, t as Blueprint, u as make2dEllipseArc, x as isPoint2D, y as BoundingBox2d } from "./blueprint-DYCdRlW5.js";
12
- import { c as twistExtrude, n as revolve, r as complexExtrude, s as sweep, t as extrude } from "./extrudeFns-LsH1rDMa.js";
1
+ import { J as _usingCtx, L as DisposalScope, X as getKernel2D, Y as getKernel, a as createEdge, h as isShape3D, o as createFace, t as castShape, u as createWire } from "./shapeTypes-BO1aiDhi.js";
2
+ import { A as ok, R as unwrap, T as isOk, b as err, d as validationError, h as bug, i as kernelError, l as typeCastError, n as computationError, s as safeIndex } from "./errors-C-cgQA3w.js";
3
+ import { _ as downcast, c as normalAt, p as uvBounds, u as pointOnSurface } from "./faceFns-TSH54pPQ.js";
4
+ import { r as RAD2DEG, t as DEG2RAD } from "./constants-B9u763C3.js";
5
+ import { r as toVec3 } from "./types-BWBlwp6w.js";
6
+ import { d as vecNormalize, h as vecScale, r as vecCross } from "./vecOps-D9etjPgV.js";
7
+ import { n as createPlane } from "./planeOps-gTOEarV2.js";
8
+ import { c as curveStartPoint, l as curveTangentAt, r as curveIsClosed } from "./curveFns-CcInoOEA.js";
9
+ import { r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
10
+ import { _ as zip, i as makeNewFaceWithinFace, r as makeFace, s as assembleWire } from "./surfaceBuilders-DE5e6bp8.js";
11
+ import { _ as samePoint$1, b as subtract2d, d as cartesianToPolar, f as crossProduct2d, g as rotate2d, h as polarToCartesian, l as add2d, m as polarAngle2d, o as normalize2d, p as distance2d, s as PRECISION_INTERSECTION, v as scalarMultiply2d } from "./helpers-XrXlKm8D.js";
12
+ import { _ as Curve2D, b as removeDuplicatePoints, c as make2dCircle, f as make2dSegmentCurve, h as approximateAsBSpline, m as make2dThreePointArc, n as asSVG, o as make2dArcFromCenter, p as make2dTangentArc, r as viewbox, s as make2dBezierCurve, t as Blueprint, u as make2dEllipseArc, x as isPoint2D, y as BoundingBox2d } from "./blueprint-B3A5x7P9.js";
13
+ import { c as twistExtrude, n as revolve, r as complexExtrude, s as sweep, t as extrude } from "./extrudeFns-DrDr9-nU.js";
13
14
  //#region node_modules/flatqueue/index.js
14
15
  /** @template T */
15
16
  var FlatQueue = class {
@@ -1,9 +1,11 @@
1
- const require_shapeTypes = require("./shapeTypes-CElaawp7.cjs");
2
- const require_errors = require("./errors-DupKEMqI.cjs");
3
- const require_vecOps = require("./vecOps-4iBMiet9.cjs");
4
- const require_planeOps = require("./planeOps-cTxDywpG.cjs");
5
- const require_arrayAccess = require("./arrayAccess-peFKE9Ob.cjs");
6
- const require_surfaceBuilders = require("./surfaceBuilders-ZUTb3z6i.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
2
+ const require_errors = require("./errors-9zQcQK1H.cjs");
3
+ const require_constants = require("./constants-unWN8k4c.cjs");
4
+ const require_vecOps = require("./vecOps-BXvBYIor.cjs");
5
+ const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
6
+ const require_shapeFns = require("./shapeFns-aEeSHNqX.cjs");
7
+ const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
8
+ const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
7
9
  //#region src/topology/booleanFns.ts
8
10
  /**
9
11
  * Boolean and compound operations — functional replacements for _3DShape boolean methods.
@@ -39,8 +41,8 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
39
41
  if (require_errors.isErr(checkA)) return checkA;
40
42
  const checkB = validateShape3D(b, "fuse: second operand");
41
43
  if (require_errors.isErr(checkB)) return checkB;
42
- const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([a, b]);
43
- const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_vecOps.HASH_CODE_MAX, {
44
+ const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
45
+ const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
44
46
  optimisation,
45
47
  simplify,
46
48
  fuzzyValue
@@ -50,7 +52,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
50
52
  return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
51
53
  }
52
54
  const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape", "Common causes: overlapping coplanar faces, zero-thickness geometry, or non-manifold input. Try autoHeal() on inputs first.", diagnostics);
53
- if (fuseResult.ok) require_arrayAccess.propagateAllMetadata(evolution, [a, b], fuseResult.value);
55
+ if (fuseResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], fuseResult.value);
54
56
  return fuseResult;
55
57
  }
56
58
  function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
@@ -59,8 +61,8 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
59
61
  if (require_errors.isErr(checkBase)) return checkBase;
60
62
  const checkTool = validateShape3D(tool, "cut: tool");
61
63
  if (require_errors.isErr(checkTool)) return checkTool;
62
- const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([base, tool]);
63
- const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_vecOps.HASH_CODE_MAX, {
64
+ const inputFaceHashes = require_shapeFns.collectInputFaceHashes([base, tool]);
65
+ const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
64
66
  optimisation,
65
67
  simplify,
66
68
  fuzzyValue
@@ -70,7 +72,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
70
72
  return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
71
73
  }
72
74
  const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape", "Common causes: tool does not fully intersect the base, or produces a zero-thickness sliver. Ensure the tool extends through the shape.", diagnostics);
73
- if (cutResult.ok) require_arrayAccess.propagateAllMetadata(evolution, [base, tool], cutResult.value);
75
+ if (cutResult.ok) require_shapeFns.propagateAllMetadata(evolution, [base, tool], cutResult.value);
74
76
  return cutResult;
75
77
  }
76
78
  function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
@@ -79,8 +81,8 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
79
81
  if (require_errors.isErr(checkA)) return checkA;
80
82
  const checkB = validateShape3D(b, "intersect: second operand");
81
83
  if (require_errors.isErr(checkB)) return checkB;
82
- const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([a, b]);
83
- const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_vecOps.HASH_CODE_MAX, {
84
+ const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
85
+ const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
84
86
  simplify,
85
87
  fuzzyValue
86
88
  });
@@ -89,7 +91,7 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
89
91
  return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
90
92
  }
91
93
  const intResult = castToShape3D(resultShape, "INTERSECT_NOT_3D", "Intersect did not produce a 3D shape", "Shapes may not overlap. Verify they share a common volume before intersecting.", diagnostics);
92
- if (intResult.ok) require_arrayAccess.propagateAllMetadata(evolution, [a, b], intResult.value);
94
+ if (intResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], intResult.value);
93
95
  return intResult;
94
96
  }
95
97
  /**
@@ -135,7 +137,7 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
135
137
  fuzzyValue,
136
138
  ...signal ? { signal } : {}
137
139
  }), "FUSE_ALL_NOT_3D", "fuseAll did not produce a 3D shape");
138
- if (fuseAllResult.ok) require_arrayAccess.propagateMetadataByHash(shapes, fuseAllResult.value);
140
+ if (fuseAllResult.ok) require_shapeFns.propagateMetadataByHash(shapes, fuseAllResult.value);
139
141
  return fuseAllResult;
140
142
  }
141
143
  return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal, fuzzyValue);
@@ -155,7 +157,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal,
155
157
  simplify,
156
158
  fuzzyValue
157
159
  }), "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
158
- if (cutAllResult.ok) require_arrayAccess.propagateMetadataByHash(allInputs, cutAllResult.value);
160
+ if (cutAllResult.ok) require_shapeFns.propagateMetadataByHash(allInputs, cutAllResult.value);
159
161
  return cutAllResult;
160
162
  }
161
163
  /**
@@ -220,9 +222,9 @@ function buildEdgeAdjacency(edges) {
220
222
  const vertexToEdges = /* @__PURE__ */ new Map();
221
223
  const edgeVertexHashes = /* @__PURE__ */ new Map();
222
224
  for (const edge of edges) {
223
- const verts = require_arrayAccess.getVertices(edge);
224
- const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped, require_vecOps.HASH_CODE_MAX) : -1;
225
- const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped, require_vecOps.HASH_CODE_MAX) : h0;
225
+ const verts = require_shapeFns.getVertices(edge);
226
+ const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped, require_constants.HASH_CODE_MAX) : -1;
227
+ const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped, require_constants.HASH_CODE_MAX) : h0;
226
228
  edgeVertexHashes.set(edge, [h0, h1]);
227
229
  for (const h of [h0, h1]) {
228
230
  const bucket = vertexToEdges.get(h) ?? [];
@@ -326,9 +328,9 @@ function findOuterWireIndex(wires) {
326
328
  function sectionToFace(shape, plane, options = {}) {
327
329
  const sectionResult = section(shape, plane, options);
328
330
  if (!sectionResult.ok) return sectionResult;
329
- const wires = require_arrayAccess.getWires(sectionResult.value);
331
+ const wires = require_shapeFns.getWires(sectionResult.value);
330
332
  if (wires.length === 0) {
331
- const edges = require_arrayAccess.getEdges(sectionResult.value);
333
+ const edges = require_shapeFns.getEdges(sectionResult.value);
332
334
  if (edges.length === 0) return require_errors.err(require_errors.kernelError("SECTION_FAILED", "sectionToFace: section produced no geometry", void 0, void 0, "The cutting plane may not intersect the shape. Verify plane position relative to shape bounds."));
333
335
  wires.push(...assembleWiresFromEdges(edges));
334
336
  }
@@ -1,9 +1,11 @@
1
- import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-CYb8Byqj.js";
2
- import { C as isErr, L as unwrap, d as validationError, i as kernelError, k as ok, l as typeCastError, t as BrepErrorCode, y as err } from "./errors-B_T0aMQF.js";
3
- import { h as vecScale, t as vecAdd, v as HASH_CODE_MAX } from "./vecOps-B9-MTeC8.js";
4
- import { o as resolvePlane } from "./planeOps-BuBXTLBr.js";
5
- import { F as getEdges, R as getVertices, b as propagateAllMetadata, n as getAtOrThrow, t as firstOrThrow, x as propagateMetadataByHash, y as collectInputFaceHashes, z as getWires } from "./arrayAccess-Dps31ERU.js";
6
- import { r as makeFace } from "./surfaceBuilders-DnGdDW8i.js";
1
+ import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-BO1aiDhi.js";
2
+ import { A as ok, R as unwrap, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, w as isErr } from "./errors-C-cgQA3w.js";
3
+ import { n as HASH_CODE_MAX } from "./constants-B9u763C3.js";
4
+ import { h as vecScale, t as vecAdd } from "./vecOps-D9etjPgV.js";
5
+ import { o as resolvePlane } from "./planeOps-gTOEarV2.js";
6
+ import { F as getVertices, I as getWires, M as getEdges, _ as propagateAllMetadata, g as collectInputFaceHashes, v as propagateMetadataByHash } from "./shapeFns-DCi9O27X.js";
7
+ import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
8
+ import { r as makeFace } from "./surfaceBuilders-DE5e6bp8.js";
7
9
  //#region src/topology/booleanFns.ts
8
10
  /**
9
11
  * Boolean and compound operations — functional replacements for _3DShape boolean methods.