brepjs 12.7.3 → 12.8.1

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 (72) hide show
  1. package/dist/2d/blueprints/boolean2D.d.ts.map +1 -1
  2. package/dist/2d/blueprints/lib.d.ts.map +1 -1
  3. package/dist/2d/blueprints/offset.d.ts.map +1 -1
  4. package/dist/2d.cjs +2 -2
  5. package/dist/2d.js +3 -3
  6. package/dist/{Blueprint-CnDVffSX.cjs → Blueprint-CQ28WJhz.cjs} +29 -30
  7. package/dist/{Blueprint-C3lWY1Jf.js → Blueprint-DbVaf6k7.js} +7 -8
  8. package/dist/{boolean2D-DyQJt8Na.cjs → boolean2D-0blbVtJ8.cjs} +70 -61
  9. package/dist/{boolean2D-CwZAIJDS.js → boolean2D-y3E92F0u.js} +37 -28
  10. package/dist/{booleanFns-CcNUsgI8.js → booleanFns-BCTjYZAg.js} +4 -4
  11. package/dist/{booleanFns-D7HmkpYt.cjs → booleanFns-gmsX3Cv2.cjs} +59 -59
  12. package/dist/brepjs.cjs +319 -372
  13. package/dist/brepjs.js +358 -411
  14. package/dist/core/errors.d.ts +14 -5
  15. package/dist/core/errors.d.ts.map +1 -1
  16. package/dist/core.cjs +30 -31
  17. package/dist/core.js +19 -20
  18. package/dist/{cornerFinder-BV-l1BCw.js → cornerFinder-Ckz-mPHE.js} +1 -1
  19. package/dist/{cornerFinder-3zfbQvXg.cjs → cornerFinder-ZmOyOOsh.cjs} +1 -1
  20. package/dist/{curveFns-Ch87sD5O.cjs → curveFns-BZngcnQ1.cjs} +17 -17
  21. package/dist/{curveFns-CloOqAQ_.js → curveFns-mROFhiuG.js} +1 -1
  22. package/dist/{drawFns-5myJTgtX.js → drawFns-Bwakrq7w.js} +24 -25
  23. package/dist/{drawFns-CDNafQhv.cjs → drawFns-CjRc1NfQ.cjs} +51 -52
  24. package/dist/{faceFns-B6ebRh5I.js → faceFns-B8GnxjdY.js} +1 -1
  25. package/dist/{faceFns-BLTEPBKq.cjs → faceFns-DB1Fc5gy.cjs} +20 -20
  26. package/dist/{helpers-6kn30cSD.cjs → helpers-C8NoT0Wu.cjs} +14 -14
  27. package/dist/{helpers-C9KvE1RW.js → helpers-X0juxnwj.js} +4 -4
  28. package/dist/io.cjs +26 -26
  29. package/dist/io.js +3 -3
  30. package/dist/kernel/brepkitAdapter.d.ts +8 -8
  31. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  32. package/dist/kernel/brepkitWasmTypes.d.ts +6 -0
  33. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  34. package/dist/kernel/historyOps.d.ts +3 -3
  35. package/dist/kernel/historyOps.d.ts.map +1 -1
  36. package/dist/kernel/types.d.ts +8 -8
  37. package/dist/kernel/types.d.ts.map +1 -1
  38. package/dist/{loft-BcZUCGKi.js → loft-Bhw-FMoL.js} +4 -4
  39. package/dist/{loft-DR1UN5uN.cjs → loft-hp3pc1M7.cjs} +43 -43
  40. package/dist/{measurement-DoYXRaKI.cjs → measurement-BoNTUBAp.cjs} +1 -1
  41. package/dist/{measurement-oWvhSVZG.js → measurement-D8EJ694A.js} +1 -1
  42. package/dist/measurement.cjs +1 -1
  43. package/dist/measurement.js +1 -1
  44. package/dist/{meshFns-3gy0empP.cjs → meshFns-BnV0ZR8w.cjs} +17 -17
  45. package/dist/{meshFns-DsLRd3tA.js → meshFns-nQjK38EC.js} +2 -2
  46. package/dist/{operations-Dcz6YlOt.js → operations-BfbkK6DU.js} +5 -5
  47. package/dist/{operations-DLFzmdFX.cjs → operations-CYpmLSC4.cjs} +75 -75
  48. package/dist/operations.cjs +2 -2
  49. package/dist/operations.js +2 -2
  50. package/dist/query.cjs +3 -3
  51. package/dist/query.js +4 -4
  52. package/dist/{errors-B7kgv0cd.js → result-BaSD1fqR.js} +43 -23
  53. package/dist/{errors-9fDehDNc.cjs → result-fAX0OZzI.cjs} +20 -0
  54. package/dist/result.cjs +30 -41
  55. package/dist/result.js +18 -29
  56. package/dist/{shapeFns-D-MOoqJd.cjs → shapeFns-C2SnNvdH.cjs} +39 -39
  57. package/dist/{shapeFns-D2PlLFE6.js → shapeFns-FDuKkrDR.js} +4 -4
  58. package/dist/sketching.cjs +2 -2
  59. package/dist/sketching.js +2 -2
  60. package/dist/{solidBuilders-BzfRBizW.cjs → solidBuilders-994_MQwB.cjs} +12 -12
  61. package/dist/{solidBuilders-BXhh5hP2.js → solidBuilders-DmwhTCCd.js} +2 -2
  62. package/dist/{surfaceBuilders-Be_ENWSA.cjs → surfaceBuilders-5VA34a3_.cjs} +27 -27
  63. package/dist/{surfaceBuilders-D6iDVPIM.js → surfaceBuilders-nQdJ56fe.js} +2 -2
  64. package/dist/{topology-CKtCGLmb.cjs → topology-ANwCzGL8.cjs} +54 -54
  65. package/dist/{topology-DxD58iQ6.js → topology-C7x98OVn.js} +8 -8
  66. package/dist/topology.cjs +6 -6
  67. package/dist/topology.js +6 -6
  68. package/dist/{vectors-CESkzEm6.js → vectors-Bx8wkNui.js} +1 -1
  69. package/dist/{vectors-BafmMf96.cjs → vectors-D_IiZx0q.cjs} +6 -6
  70. package/dist/vectors.cjs +1 -1
  71. package/dist/vectors.js +1 -1
  72. package/package.json +5 -8
@@ -1,8 +1,5 @@
1
- /**
2
- * Domain error types and constructors for brepjs.
3
- * Re-exports bug/BrepBugError from utils (Layer 0) for convenience.
4
- */
5
- export { bug, BrepBugError } from '../utils/bug.js';
1
+ import { bug, BrepBugError } from '../utils/bug.js';
2
+ export { bug, BrepBugError };
6
3
  /** High-level category for a brepjs error. */
7
4
  export type BrepErrorKind = 'KERNEL_OPERATION' | 'VALIDATION' | 'TYPE_CAST' | 'SKETCHER_STATE' | 'MODULE_INIT' | 'COMPUTATION' | 'IO' | 'QUERY' | 'UNSUPPORTED';
8
5
  /**
@@ -147,4 +144,16 @@ export declare function unsupportedError(code: string, message: string, cause?:
147
144
  * @returns User-friendly error message with actionable guidance
148
145
  */
149
146
  export declare function translateKernelError(kernelMessage: string): string;
147
+ /**
148
+ * Safe array index access that throws a descriptive {@link BrepBugError} instead
149
+ * of returning `undefined` when the index is out of bounds.
150
+ *
151
+ * Use in place of `arr[i]!` when the caller can prove the index is valid by
152
+ * construction but TypeScript's `noUncheckedIndexedAccess` still requires a guard.
153
+ *
154
+ * @param arr - The array to index into.
155
+ * @param index - The index to access.
156
+ * @param context - Optional caller context for the error message (e.g. function name).
157
+ */
158
+ export declare function safeIndex<T>(arr: readonly T[], index: number, context?: string): T;
150
159
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GACrB,kBAAkB,GAClB,YAAY,GACZ,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,IAAI,GACJ,OAAO,GACP,aAAa,CAAC;AAMlB;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0HhB,CAAC;AAEX,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAM/E;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,C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AAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,CAEX;AAyED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQlE;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAMlF"}
package/dist/core.cjs CHANGED
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const types = require("./types-CA_xrgDq.cjs");
4
4
  const vecOps = require("./vecOps-CjRL1jau.cjs");
5
- const errors = require("./errors-9fDehDNc.cjs");
6
- const vectors = require("./vectors-BafmMf96.cjs");
5
+ const result = require("./result-fAX0OZzI.cjs");
6
+ const vectors = require("./vectors-D_IiZx0q.cjs");
7
7
  const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
8
- const result = require("./result.cjs");
9
8
  exports.resolveDirection = types.resolveDirection;
10
9
  exports.toVec2 = types.toVec2;
11
10
  exports.toVec3 = types.toVec3;
@@ -28,32 +27,34 @@ exports.vecRepr = vecOps.vecRepr;
28
27
  exports.vecRotate = vecOps.vecRotate;
29
28
  exports.vecScale = vecOps.vecScale;
30
29
  exports.vecSub = vecOps.vecSub;
31
- exports.OK = errors.OK;
32
- exports.andThen = errors.andThen;
33
- exports.collect = errors.collect;
34
- exports.computationError = errors.computationError;
35
- exports.err = errors.err;
36
- exports.flatMap = errors.flatMap;
37
- exports.ioError = errors.ioError;
38
- exports.isErr = errors.isErr;
39
- exports.isOk = errors.isOk;
40
- exports.kernelError = errors.kernelError;
41
- exports.map = errors.map;
42
- exports.mapErr = errors.mapErr;
43
- exports.match = errors.match;
44
- exports.moduleInitError = errors.moduleInitError;
45
- exports.ok = errors.ok;
46
- exports.queryError = errors.queryError;
47
- exports.sketcherStateError = errors.sketcherStateError;
48
- exports.tryCatch = errors.tryCatch;
49
- exports.tryCatchAsync = errors.tryCatchAsync;
50
- exports.typeCastError = errors.typeCastError;
51
- exports.unsupportedError = errors.unsupportedError;
52
- exports.unwrap = errors.unwrap;
53
- exports.unwrapErr = errors.unwrapErr;
54
- exports.unwrapOr = errors.unwrapOr;
55
- exports.unwrapOrElse = errors.unwrapOrElse;
56
- exports.validationError = errors.validationError;
30
+ exports.BrepBugError = result.BrepBugError;
31
+ exports.OK = result.OK;
32
+ exports.andThen = result.andThen;
33
+ exports.bug = result.bug;
34
+ exports.collect = result.collect;
35
+ exports.computationError = result.computationError;
36
+ exports.err = result.err;
37
+ exports.flatMap = result.flatMap;
38
+ exports.ioError = result.ioError;
39
+ exports.isErr = result.isErr;
40
+ exports.isOk = result.isOk;
41
+ exports.kernelError = result.kernelError;
42
+ exports.map = result.map;
43
+ exports.mapErr = result.mapErr;
44
+ exports.match = result.match;
45
+ exports.moduleInitError = result.moduleInitError;
46
+ exports.ok = result.ok;
47
+ exports.queryError = result.queryError;
48
+ exports.sketcherStateError = result.sketcherStateError;
49
+ exports.tryCatch = result.tryCatch;
50
+ exports.tryCatchAsync = result.tryCatchAsync;
51
+ exports.typeCastError = result.typeCastError;
52
+ exports.unsupportedError = result.unsupportedError;
53
+ exports.unwrap = result.unwrap;
54
+ exports.unwrapErr = result.unwrapErr;
55
+ exports.unwrapOr = result.unwrapOr;
56
+ exports.unwrapOrElse = result.unwrapOrElse;
57
+ exports.validationError = result.validationError;
57
58
  exports.createNamedPlane = vectors.createNamedPlane;
58
59
  exports.createPlane = vectors.createPlane;
59
60
  exports.pivotPlane = vectors.pivotPlane;
@@ -87,5 +88,3 @@ exports.validSolid = shapeTypes.validSolid;
87
88
  exports.withScope = shapeTypes.withScope;
88
89
  exports.withScopeResult = shapeTypes.withScopeResult;
89
90
  exports.withScopeResultAsync = shapeTypes.withScopeResultAsync;
90
- exports.BrepBugError = result.BrepBugError;
91
- exports.bug = result.bug;
package/dist/core.js CHANGED
@@ -1,22 +1,21 @@
1
1
  import { r, t, a } from "./types-CWDdqcrq.js";
2
2
  import { D, H, R, v, a as a2, b, c, d, e, f, g, h, i, j, k, l, m, n, o } from "./vecOps-ZDdZWbwT.js";
3
- import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, k as k2, m as m2, h as h2, j as j2, l as l2, o as o2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x, y } from "./errors-B7kgv0cd.js";
4
- import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-CESkzEm6.js";
5
- import { D as D2, c as c4, a as a5, b as b3, d as d3, g as g3, i as i3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, o as o3, p as p3, q as q2, r as r4, s as s2, t as t4, u as u2, v as v3, w as w2, x as x2, y as y2, z, A } from "./shapeTypes-CpSaBLDv.js";
6
- import { BrepBugError, bug } from "./result.js";
3
+ import { B, O, a as a3, b as b2, c as c2, d as d2, e as e2, f as f2, i as i2, g as g2, h as h2, k as k2, m as m2, j as j2, l as l2, n as n2, o as o2, q, s, t as t2, p, r as r2, u, v as v2, w, x, y, z } from "./result-BaSD1fqR.js";
4
+ import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-Bx8wkNui.js";
5
+ import { D as D2, c as c4, a as a5, b as b3, d as d3, g as g3, i as i3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, o as o3, p as p3, q as q2, r as r4, s as s2, t as t4, u as u2, v as v3, w as w2, x as x2, y as y2, z as z2, A } from "./shapeTypes-CpSaBLDv.js";
7
6
  export {
8
- BrepBugError,
7
+ B as BrepBugError,
9
8
  D as DEG2RAD,
10
9
  D2 as DisposalScope,
11
10
  H as HASH_CODE_MAX,
12
11
  O as OK,
13
12
  R as RAD2DEG,
14
13
  a3 as andThen,
15
- bug,
14
+ b2 as bug,
16
15
  c4 as castShape,
17
16
  a5 as closedWire,
18
17
  c2 as collect,
19
- b2 as computationError,
18
+ d2 as computationError,
20
19
  b3 as createHandle,
21
20
  d3 as createKernelHandle,
22
21
  c3 as createNamedPlane,
@@ -30,11 +29,11 @@ export {
30
29
  f3 as isClosedWire,
31
30
  h3 as isCompound,
32
31
  j3 as isEdge,
33
- d2 as isErr,
32
+ g2 as isErr,
34
33
  k3 as isFace,
35
34
  l3 as isLive,
36
35
  m3 as isManifoldShell,
37
- g2 as isOk,
36
+ h2 as isOk,
38
37
  n3 as isOrientedFace,
39
38
  o3 as isShape1D,
40
39
  p3 as isShape3D,
@@ -46,9 +45,9 @@ export {
46
45
  k2 as kernelError,
47
46
  v3 as manifoldShell,
48
47
  m2 as map,
49
- h2 as mapErr,
50
- j2 as match,
51
- l2 as moduleInitError,
48
+ j2 as mapErr,
49
+ l2 as match,
50
+ n2 as moduleInitError,
52
51
  o2 as ok,
53
52
  w2 as orientedFace,
54
53
  p2 as pivotPlane,
@@ -60,15 +59,15 @@ export {
60
59
  a as toVec3,
61
60
  t3 as translatePlane,
62
61
  t2 as tryCatch,
63
- n2 as tryCatchAsync,
64
- p as typeCastError,
62
+ p as tryCatchAsync,
63
+ r2 as typeCastError,
65
64
  u as unsupportedError,
66
- r2 as unwrap,
67
- v2 as unwrapErr,
68
- w as unwrapOr,
69
- x as unwrapOrElse,
65
+ v2 as unwrap,
66
+ w as unwrapErr,
67
+ x as unwrapOr,
68
+ y as unwrapOrElse,
70
69
  x2 as validSolid,
71
- y as validationError,
70
+ z as validationError,
72
71
  v as vecAdd,
73
72
  a2 as vecAngle,
74
73
  b as vecCross,
@@ -86,6 +85,6 @@ export {
86
85
  n as vecScale,
87
86
  o as vecSub,
88
87
  y2 as withScope,
89
- z as withScopeResult,
88
+ z2 as withScopeResult,
90
89
  A as withScopeResultAsync
91
90
  };
@@ -1,5 +1,5 @@
1
1
  import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
2
- import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-C9KvE1RW.js";
2
+ import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-X0juxnwj.js";
3
3
  const PI_2 = 2 * Math.PI;
4
4
  function positiveHalfAngle(angle) {
5
5
  const limitedAngle = angle % PI_2;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vecOps = require("./vecOps-CjRL1jau.cjs");
3
- const helpers = require("./helpers-6kn30cSD.cjs");
3
+ const helpers = require("./helpers-C8NoT0Wu.cjs");
4
4
  const PI_2 = 2 * Math.PI;
5
5
  function positiveHalfAngle(angle) {
6
6
  const limitedAngle = angle % PI_2;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
- const errors = require("./errors-9fDehDNc.cjs");
3
+ const result = require("./result-fAX0OZzI.cjs");
4
4
  function getCurveType(shape) {
5
5
  return shapeTypes.getKernel().curveType(shape.wrapped);
6
6
  }
@@ -43,18 +43,18 @@ function flipOrientation(shape) {
43
43
  }
44
44
  function interpolateCurve(points, options = {}) {
45
45
  if (points.length < 2) {
46
- return errors.err(errors.typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
46
+ return result.err(result.typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
47
47
  }
48
48
  try {
49
- const result = shapeTypes.getKernel().interpolatePoints(points, options);
50
- const cast = shapeTypes.castShape(result);
49
+ const result$1 = shapeTypes.getKernel().interpolatePoints(points, options);
50
+ const cast = shapeTypes.castShape(result$1);
51
51
  if (!shapeTypes.isEdge(cast)) {
52
- return errors.err(errors.typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
52
+ return result.err(result.typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
53
53
  }
54
- return errors.ok(cast);
54
+ return result.ok(cast);
55
55
  } catch (e) {
56
- return errors.err(
57
- errors.typeCastError(
56
+ return result.err(
57
+ result.typeCastError(
58
58
  "INTERPOLATE_FAILED",
59
59
  `Interpolation failed: ${e instanceof Error ? e.message : String(e)}`
60
60
  )
@@ -63,18 +63,18 @@ function interpolateCurve(points, options = {}) {
63
63
  }
64
64
  function approximateCurve(points, options = {}) {
65
65
  if (points.length < 2) {
66
- return errors.err(errors.typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
66
+ return result.err(result.typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
67
67
  }
68
68
  try {
69
- const result = shapeTypes.getKernel().approximatePoints(points, options);
70
- const cast = shapeTypes.castShape(result);
69
+ const result$1 = shapeTypes.getKernel().approximatePoints(points, options);
70
+ const cast = shapeTypes.castShape(result$1);
71
71
  if (!shapeTypes.isEdge(cast)) {
72
- return errors.err(errors.typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
72
+ return result.err(result.typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
73
73
  }
74
- return errors.ok(cast);
74
+ return result.ok(cast);
75
75
  } catch (e) {
76
- return errors.err(
77
- errors.typeCastError(
76
+ return result.err(
77
+ result.typeCastError(
78
78
  "APPROXIMATE_FAILED",
79
79
  `Approximation failed: ${e instanceof Error ? e.message : String(e)}`
80
80
  )
@@ -93,9 +93,9 @@ function offsetWire2D(wire, offset, kind = "arc") {
93
93
  const wrapped = shapeTypes.castShape(resultShape);
94
94
  if (!shapeTypes.isWire(wrapped)) {
95
95
  wrapped[Symbol.dispose]();
96
- return errors.err(errors.typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
96
+ return result.err(result.typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
97
97
  }
98
- return errors.ok(wrapped);
98
+ return result.ok(wrapped);
99
99
  }
100
100
  exports.approximateCurve = approximateCurve;
101
101
  exports.curveEndPoint = curveEndPoint;
@@ -1,5 +1,5 @@
1
1
  import { B as getKernel, c as castShape, j as isEdge, u as isWire } from "./shapeTypes-CpSaBLDv.js";
2
- import { e as err, p as typeCastError, o as ok } from "./errors-B7kgv0cd.js";
2
+ import { e as err, r as typeCastError, o as ok } from "./result-BaSD1fqR.js";
3
3
  function getCurveType(shape) {
4
4
  return getKernel().curveType(shape.wrapped);
5
5
  }
@@ -43,23 +43,22 @@ var __callDispose = (stack, error, hasError) => {
43
43
  };
44
44
  return next();
45
45
  };
46
- import { r as unwrap, g as isOk, e as err, y as validationError, o as ok } from "./errors-B7kgv0cd.js";
47
- import { r as resolvePlane, b as planeToWorld } from "./vectors-CESkzEm6.js";
46
+ import { b as bug, v as unwrap, h as isOk, C as safeIndex, e as err, z as validationError, o as ok } from "./result-BaSD1fqR.js";
47
+ import { r as resolvePlane, b as planeToWorld } from "./vectors-Bx8wkNui.js";
48
48
  import { a as toVec3 } from "./types-CWDdqcrq.js";
49
49
  import { j as vecNormalize, b as vecCross, o as vecSub, n as vecScale, m as vecRotate, D as DEG2RAD, g as vecLength } from "./vecOps-ZDdZWbwT.js";
50
- import { b as Flatbush, B as BaseSketcher2d, S as Sketch, r as roundedRectangleBlueprint, c as Blueprints, C as CompoundBlueprint, d as cut2D, i as intersectCurves, f as fuse2D, m as make2dOffset, e as filletCurves, g as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, h as intersect2D, p as polysidesBlueprint } from "./boolean2D-CwZAIJDS.js";
51
- import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-B6ebRh5I.js";
52
- import { o as offsetWire2D } from "./curveFns-CloOqAQ_.js";
53
- import { b as assembleWire, d as addHolesInFace, m as makeFace, e as makeCircle, f as makeEllipse, c as makeHelix, g as makeBSplineApproximation } from "./surfaceBuilders-D6iDVPIM.js";
50
+ import { b as Flatbush, B as BaseSketcher2d, S as Sketch, r as roundedRectangleBlueprint, c as Blueprints, C as CompoundBlueprint, d as cut2D, i as intersectCurves, f as fuse2D, m as make2dOffset, e as filletCurves, g as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, h as intersect2D, p as polysidesBlueprint } from "./boolean2D-y3E92F0u.js";
51
+ import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-B8GnxjdY.js";
52
+ import { o as offsetWire2D } from "./curveFns-mROFhiuG.js";
53
+ import { b as assembleWire, d as addHolesInFace, m as makeFace, e as makeCircle, f as makeEllipse, c as makeHelix, g as makeBSplineApproximation } from "./surfaceBuilders-nQdJ56fe.js";
54
54
  import { D as DisposalScope, G as createWire, I as createFace, B as getKernel, k as isFace, c as castShape } from "./shapeTypes-CpSaBLDv.js";
55
- import { c as curvesAsEdgesOnPlane, m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, d as approximateAsSvgCompatibleCurve, e as BoundingBox2d, f as edgeToCurve, g as make2dInerpolatedBSplineCurve, h as make2dCircle, i as make2dEllipse, j as deserializeCurve2D } from "./Blueprint-C3lWY1Jf.js";
56
- import { bug } from "./result.js";
57
- import { s as samePoint$1, P as PRECISION_OFFSET, f as squareDistance2d, e as subtract2d, c as add2d } from "./helpers-C9KvE1RW.js";
58
- import { d as getEdges } from "./shapeFns-D2PlLFE6.js";
59
- import { a as makeCompound, b as makeSolid } from "./solidBuilders-BXhh5hP2.js";
60
- import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-BcZUCGKi.js";
55
+ import { c as curvesAsEdgesOnPlane, m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, d as approximateAsSvgCompatibleCurve, e as BoundingBox2d, f as edgeToCurve, g as make2dInerpolatedBSplineCurve, h as make2dCircle, i as make2dEllipse, j as deserializeCurve2D } from "./Blueprint-DbVaf6k7.js";
56
+ import { s as samePoint$1, P as PRECISION_OFFSET, f as squareDistance2d, e as subtract2d, c as add2d } from "./helpers-X0juxnwj.js";
57
+ import { d as getEdges } from "./shapeFns-FDuKkrDR.js";
58
+ import { a as makeCompound, b as makeSolid } from "./solidBuilders-DmwhTCCd.js";
59
+ import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-Bhw-FMoL.js";
61
60
  import opentype from "opentype.js";
62
- import { c as cornerFinder } from "./cornerFinder-BV-l1BCw.js";
61
+ import { c as cornerFinder } from "./cornerFinder-Ckz-mPHE.js";
63
62
  const stitchCurves = (curves, precision = 1e-7) => {
64
63
  const startPoints = new Flatbush(curves.length);
65
64
  curves.forEach((c) => {
@@ -591,12 +590,12 @@ function rawOffsets(blueprint, offset2, offsetConfig = {}) {
591
590
  intersections = [...pointIntersections, ...commonSegmentsPoints];
592
591
  }
593
592
  if (intersections.length > 0) {
594
- let intersection = intersections[0];
593
+ let intersection = safeIndex(intersections, 0, "rawOffsets");
595
594
  if (intersections.length > 1) {
596
595
  const originalEndpoint = previousCurve.original.lastPoint;
597
596
  let minDist = squareDistance2d(intersection, originalEndpoint);
598
597
  for (let i = 1; i < intersections.length; i++) {
599
- const point = intersections[i];
598
+ const point = safeIndex(intersections, i, "rawOffsets");
600
599
  const d = squareDistance2d(point, originalEndpoint);
601
600
  if (d < minDist) {
602
601
  minDist = d;
@@ -604,10 +603,11 @@ function rawOffsets(blueprint, offset2, offsetConfig = {}) {
604
603
  }
605
604
  }
606
605
  }
607
- const splitPreviousCurve = previousCurve.offset.splitAt(
608
- [intersection],
609
- PRECISION_OFFSET
610
- )[0];
606
+ const splitPreviousCurve = safeIndex(
607
+ previousCurve.offset.splitAt([intersection], PRECISION_OFFSET),
608
+ 0,
609
+ "rawOffsets"
610
+ );
611
611
  const splitCurve = curve.offset.splitAt([intersection], PRECISION_OFFSET).at(-1);
612
612
  if (!splitCurve) bug("offset.rawOffsets", "Split produced no trailing curve segment");
613
613
  appendCurve({
@@ -647,7 +647,7 @@ function offsetBlueprint(blueprint, offset2, offsetConfig = {}) {
647
647
  const pairKey = `${firstIndex}-${secondIndex}`;
648
648
  if (testedPairs.has(pairKey)) continue;
649
649
  testedPairs.add(pairKey);
650
- const secondCurve = offsettedArray[secondIndex];
650
+ const secondCurve = safeIndex(offsettedArray, secondIndex, "offsetBlueprint");
651
651
  const { intersections: rawIntersections, commonSegmentsPoints } = unwrap(
652
652
  intersectCurves(firstCurve, secondCurve, PRECISION_OFFSET)
653
653
  );
@@ -685,14 +685,14 @@ function offsetBlueprint(blueprint, offset2, offsetConfig = {}) {
685
685
  const blueprints = curvesGrouped.filter((c) => c.length > 1).map((c) => new Blueprint(c)).filter((b) => b.isClosed());
686
686
  if (!blueprints.length) return null;
687
687
  if (blueprints.length === 1) {
688
- return blueprints[0];
688
+ return safeIndex(blueprints, 0, "offsetBlueprint");
689
689
  }
690
690
  return new Blueprints(blueprints);
691
691
  }
692
692
  const fuseAll = (blueprints) => {
693
- let fused = blueprints[0];
693
+ let fused = safeIndex(blueprints, 0, "fuseAll");
694
694
  for (let i = 1; i < blueprints.length; i++) {
695
- fused = fuse2D(fused, blueprints[i]);
695
+ fused = fuse2D(fused, safeIndex(blueprints, i, "fuseAll"));
696
696
  }
697
697
  return fused;
698
698
  };
@@ -706,8 +706,7 @@ function offset(bp, offsetDistance, offsetConfig = {}) {
706
706
  bp.blueprints.slice(1).map((b) => offset(b, offsetDistance, offsetConfig))
707
707
  );
708
708
  return cut2D(
709
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- compound always has outer boundary
710
- offset(bp.blueprints[0], offsetDistance, offsetConfig),
709
+ offset(safeIndex(bp.blueprints, 0, "offset"), offsetDistance, offsetConfig),
711
710
  innerShape
712
711
  );
713
712
  }