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
package/dist/result.js CHANGED
@@ -1,43 +1,32 @@
1
- import { B, O, a, c, b, e, f, i, d, g, k, m, h, j, l, o, F, q, s, t, n, p, r, v, w, x, y } from "./errors-B7kgv0cd.js";
2
- class BrepBugError extends Error {
3
- location;
4
- constructor(location, message) {
5
- super(`Bug in ${location}: ${message}`);
6
- this.name = "BrepBugError";
7
- this.location = location;
8
- }
9
- }
10
- function bug(location, message) {
11
- throw new BrepBugError(location, message);
12
- }
1
+ import { B, A, O, a, b, c, d, e, f, i, g, h, k, m, j, l, n, o, I, q, s, t, p, r, v, w, x, y, z } from "./result-BaSD1fqR.js";
13
2
  export {
14
- BrepBugError,
15
- B as BrepErrorCode,
3
+ B as BrepBugError,
4
+ A as BrepErrorCode,
16
5
  O as OK,
17
6
  a as andThen,
18
- bug,
7
+ b as bug,
19
8
  c as collect,
20
- b as computationError,
9
+ d as computationError,
21
10
  e as err,
22
11
  f as flatMap,
23
12
  i as ioError,
24
- d as isErr,
25
- g as isOk,
13
+ g as isErr,
14
+ h as isOk,
26
15
  k as kernelError,
27
16
  m as map,
28
- h as mapErr,
29
- j as match,
30
- l as moduleInitError,
17
+ j as mapErr,
18
+ l as match,
19
+ n as moduleInitError,
31
20
  o as ok,
32
- F as pipeline,
21
+ I as pipeline,
33
22
  q as queryError,
34
23
  s as sketcherStateError,
35
24
  t as tryCatch,
36
- n as tryCatchAsync,
37
- p as typeCastError,
38
- r as unwrap,
39
- v as unwrapErr,
40
- w as unwrapOr,
41
- x as unwrapOrElse,
42
- y as validationError
25
+ p as tryCatchAsync,
26
+ r as typeCastError,
27
+ v as unwrap,
28
+ w as unwrapErr,
29
+ x as unwrapOr,
30
+ y as unwrapOrElse,
31
+ z as validationError
43
32
  };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
3
  const vecOps = require("./vecOps-CjRL1jau.cjs");
4
- const faceFns = require("./faceFns-BLTEPBKq.cjs");
5
- const errors = require("./errors-9fDehDNc.cjs");
4
+ const faceFns = require("./faceFns-DB1Fc5gy.cjs");
5
+ const result = require("./result-fAX0OZzI.cjs");
6
6
  function clone(shape) {
7
- return shapeTypes.castShape(errors.unwrap(faceFns.downcast(shape.wrapped)));
7
+ return shapeTypes.castShape(result.unwrap(faceFns.downcast(shape.wrapped)));
8
8
  }
9
9
  function toBREP(shape) {
10
10
  return shapeTypes.getKernel().toBREP(shape.wrapped);
@@ -45,9 +45,9 @@ function translate(shape, v) {
45
45
  inputFaceHashes,
46
46
  vecOps.HASH_CODE_MAX
47
47
  );
48
- const result = shapeTypes.castShape(resultShape);
49
- propagateOriginsFromEvolution(evolution, [shape], result);
50
- return result;
48
+ const result2 = shapeTypes.castShape(resultShape);
49
+ propagateOriginsFromEvolution(evolution, [shape], result2);
50
+ return result2;
51
51
  }
52
52
  function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
53
53
  const inputFaceHashes = collectInputFaceHashes([shape]);
@@ -59,9 +59,9 @@ function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
59
59
  direction,
60
60
  position
61
61
  );
62
- const result = shapeTypes.castShape(resultShape);
63
- propagateOriginsFromEvolution(evolution, [shape], result);
64
- return result;
62
+ const result2 = shapeTypes.castShape(resultShape);
63
+ propagateOriginsFromEvolution(evolution, [shape], result2);
64
+ return result2;
65
65
  }
66
66
  function mirror(shape, planeNormal = [0, 1, 0], planeOrigin = [0, 0, 0]) {
67
67
  const inputFaceHashes = collectInputFaceHashes([shape]);
@@ -72,9 +72,9 @@ function mirror(shape, planeNormal = [0, 1, 0], planeOrigin = [0, 0, 0]) {
72
72
  inputFaceHashes,
73
73
  vecOps.HASH_CODE_MAX
74
74
  );
75
- const result = shapeTypes.castShape(resultShape);
76
- propagateOriginsFromEvolution(evolution, [shape], result);
77
- return result;
75
+ const result2 = shapeTypes.castShape(resultShape);
76
+ propagateOriginsFromEvolution(evolution, [shape], result2);
77
+ return result2;
78
78
  }
79
79
  function scale(shape, factor, center = [0, 0, 0]) {
80
80
  const inputFaceHashes = collectInputFaceHashes([shape]);
@@ -85,9 +85,9 @@ function scale(shape, factor, center = [0, 0, 0]) {
85
85
  inputFaceHashes,
86
86
  vecOps.HASH_CODE_MAX
87
87
  );
88
- const result = shapeTypes.castShape(resultShape);
89
- propagateOriginsFromEvolution(evolution, [shape], result);
90
- return result;
88
+ const result2 = shapeTypes.castShape(resultShape);
89
+ propagateOriginsFromEvolution(evolution, [shape], result2);
90
+ return result2;
91
91
  }
92
92
  function resize(shape, dimensions, options) {
93
93
  const bbox = shapeTypes.getKernel().boundingBox(shape.wrapped);
@@ -174,14 +174,14 @@ function applyMatrix(shape, matrix) {
174
174
  inputFaceHashes,
175
175
  vecOps.HASH_CODE_MAX
176
176
  );
177
- const result2 = shapeTypes.castShape(resultShape2);
178
- propagateOriginsFromEvolution(evolution, [shape], result2);
179
- return result2;
177
+ const result22 = shapeTypes.castShape(resultShape2);
178
+ propagateOriginsFromEvolution(evolution, [shape], result22);
179
+ return result22;
180
180
  }
181
181
  const resultShape = shapeTypes.getKernel().generalTransformNonOrthogonal(shape.wrapped, linear, translation);
182
- const result = shapeTypes.castShape(resultShape);
183
- propagateOriginsByHash([shape], result);
184
- return result;
182
+ const result2 = shapeTypes.castShape(resultShape);
183
+ propagateOriginsByHash([shape], result2);
184
+ return result2;
185
185
  }
186
186
  function composeTransforms(ops) {
187
187
  const kernelOps = ops.map((op) => {
@@ -191,8 +191,8 @@ function composeTransforms(ops) {
191
191
  return {
192
192
  type: "rotate",
193
193
  angle: op.angle,
194
- axis: op.axis ? [...op.axis] : void 0,
195
- center: op.center ? [...op.center] : void 0
194
+ axis: op.axis,
195
+ center: op.center
196
196
  };
197
197
  });
198
198
  const { handle, dispose } = shapeTypes.getKernel().composeTransform(kernelOps);
@@ -206,9 +206,9 @@ function transformCopy(shape, composed) {
206
206
  inputFaceHashes,
207
207
  vecOps.HASH_CODE_MAX
208
208
  );
209
- const result = shapeTypes.castShape(resultShape);
210
- propagateOriginsFromEvolution(evolution, [shape], result);
211
- return result;
209
+ const result2 = shapeTypes.castShape(resultShape);
210
+ propagateOriginsFromEvolution(evolution, [shape], result2);
211
+ return result2;
212
212
  }
213
213
  const topoCache = /* @__PURE__ */ new WeakMap();
214
214
  function getOrCreateCache(shape) {
@@ -226,7 +226,7 @@ function getEdges(shape) {
226
226
  const cache = getOrCreateCache(shape);
227
227
  if (cache.edges) return cache.edges;
228
228
  const edges = Array.from(faceFns.iterTopo(shape.wrapped, "edge")).map(
229
- (e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
229
+ (e) => shapeTypes.castShape(result.unwrap(faceFns.downcast(e)))
230
230
  );
231
231
  cache.edges = edges;
232
232
  return edges;
@@ -235,7 +235,7 @@ function getFaces(shape) {
235
235
  const cache = getOrCreateCache(shape);
236
236
  if (cache.faces) return cache.faces;
237
237
  const faces = Array.from(faceFns.iterTopo(shape.wrapped, "face")).map(
238
- (e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
238
+ (e) => shapeTypes.castShape(result.unwrap(faceFns.downcast(e)))
239
239
  );
240
240
  cache.faces = faces;
241
241
  return faces;
@@ -244,7 +244,7 @@ function getWires(shape) {
244
244
  const cache = getOrCreateCache(shape);
245
245
  if (cache.wires) return cache.wires;
246
246
  const wires = Array.from(faceFns.iterTopo(shape.wrapped, "wire")).map(
247
- (e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
247
+ (e) => shapeTypes.castShape(result.unwrap(faceFns.downcast(e)))
248
248
  );
249
249
  cache.wires = wires;
250
250
  return wires;
@@ -260,7 +260,7 @@ function setShapeOrigin(shape, origin) {
260
260
  function getFaceOrigins(shape) {
261
261
  return topoCache.get(shape.wrapped)?.faceOrigins;
262
262
  }
263
- function propagateOriginsFromEvolution(evolution, inputs, result) {
263
+ function propagateOriginsFromEvolution(evolution, inputs, result2) {
264
264
  const inputOrigins = /* @__PURE__ */ new Map();
265
265
  for (const input of inputs) {
266
266
  const origins = getFaceOrigins(input);
@@ -291,11 +291,11 @@ function propagateOriginsFromEvolution(evolution, inputs, result) {
291
291
  }
292
292
  }
293
293
  if (resultMap.size > 0) {
294
- const cache = getOrCreateCache(result);
294
+ const cache = getOrCreateCache(result2);
295
295
  cache.faceOrigins = resultMap;
296
296
  }
297
297
  }
298
- function propagateOriginsByHash(inputs, result) {
298
+ function propagateOriginsByHash(inputs, result2) {
299
299
  const lookup = /* @__PURE__ */ new Map();
300
300
  for (const input of inputs) {
301
301
  const origins = getFaceOrigins(input);
@@ -307,7 +307,7 @@ function propagateOriginsByHash(inputs, result) {
307
307
  if (lookup.size === 0) return;
308
308
  const kernel = shapeTypes.getKernel();
309
309
  const resultMap = /* @__PURE__ */ new Map();
310
- const resultFaces = getFaces(result);
310
+ const resultFaces = getFaces(result2);
311
311
  for (const f of resultFaces) {
312
312
  const hash = kernel.hashCode(f.wrapped, vecOps.HASH_CODE_MAX);
313
313
  const origin = lookup.get(hash);
@@ -373,7 +373,7 @@ function propagateOriginsByHash(inputs, result) {
373
373
  }
374
374
  }
375
375
  if (resultMap.size > 0) {
376
- const cache = getOrCreateCache(result);
376
+ const cache = getOrCreateCache(result2);
377
377
  cache.faceOrigins = resultMap;
378
378
  }
379
379
  }
@@ -381,29 +381,29 @@ function getVertices(shape) {
381
381
  const cache = getOrCreateCache(shape);
382
382
  if (cache.vertices) return cache.vertices;
383
383
  const vertices = Array.from(faceFns.iterTopo(shape.wrapped, "vertex")).map(
384
- (e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
384
+ (e) => shapeTypes.castShape(result.unwrap(faceFns.downcast(e)))
385
385
  );
386
386
  cache.vertices = vertices;
387
387
  return vertices;
388
388
  }
389
389
  function* iterEdges(shape) {
390
390
  for (const e of faceFns.iterTopo(shape.wrapped, "edge")) {
391
- yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)));
391
+ yield shapeTypes.castShape(result.unwrap(faceFns.downcast(e)));
392
392
  }
393
393
  }
394
394
  function* iterFaces(shape) {
395
395
  for (const f of faceFns.iterTopo(shape.wrapped, "face")) {
396
- yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(f)));
396
+ yield shapeTypes.castShape(result.unwrap(faceFns.downcast(f)));
397
397
  }
398
398
  }
399
399
  function* iterWires(shape) {
400
400
  for (const w of faceFns.iterTopo(shape.wrapped, "wire")) {
401
- yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(w)));
401
+ yield shapeTypes.castShape(result.unwrap(faceFns.downcast(w)));
402
402
  }
403
403
  }
404
404
  function* iterVertices(shape) {
405
405
  for (const v of faceFns.iterTopo(shape.wrapped, "vertex")) {
406
- yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(v)));
406
+ yield shapeTypes.castShape(result.unwrap(faceFns.downcast(v)));
407
407
  }
408
408
  }
409
409
  function getBounds(shape) {
@@ -1,7 +1,7 @@
1
1
  import { B as getKernel, c as castShape, g as getShapeKind } from "./shapeTypes-CpSaBLDv.js";
2
2
  import { H as HASH_CODE_MAX, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
3
- import { i as iterTopo, d as downcast } from "./faceFns-B6ebRh5I.js";
4
- import { r as unwrap } from "./errors-B7kgv0cd.js";
3
+ import { i as iterTopo, d as downcast } from "./faceFns-B8GnxjdY.js";
4
+ import { v as unwrap } from "./result-BaSD1fqR.js";
5
5
  function clone(shape) {
6
6
  return castShape(unwrap(downcast(shape.wrapped)));
7
7
  }
@@ -190,8 +190,8 @@ function composeTransforms(ops) {
190
190
  return {
191
191
  type: "rotate",
192
192
  angle: op.angle,
193
- axis: op.axis ? [...op.axis] : void 0,
194
- center: op.center ? [...op.center] : void 0
193
+ axis: op.axis,
194
+ center: op.center
195
195
  };
196
196
  });
197
197
  const { handle, dispose } = getKernel().composeTransform(kernelOps);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const drawFns = require("./drawFns-CDNafQhv.cjs");
4
- const boolean2D = require("./boolean2D-DyQJt8Na.cjs");
3
+ const drawFns = require("./drawFns-CjRc1NfQ.cjs");
4
+ const boolean2D = require("./boolean2D-0blbVtJ8.cjs");
5
5
  exports.CompoundSketch = drawFns.CompoundSketch;
6
6
  exports.Drawing = drawFns.Drawing;
7
7
  exports.DrawingPen = drawFns.DrawingPen;
package/dist/sketching.js CHANGED
@@ -1,5 +1,5 @@
1
- import { C, D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W } from "./drawFns-5myJTgtX.js";
2
- import { B as B2, a as a2, F as F2, S as S2 } from "./boolean2D-CwZAIJDS.js";
1
+ import { C, D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W } from "./drawFns-Bwakrq7w.js";
2
+ import { B as B2, a as a2, F as F2, S as S2 } from "./boolean2D-y3E92F0u.js";
3
3
  export {
4
4
  B2 as BaseSketcher2d,
5
5
  a2 as BlueprintSketcher,
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
- const errors = require("./errors-9fDehDNc.cjs");
4
- const faceFns = require("./faceFns-BLTEPBKq.cjs");
3
+ const result = require("./result-fAX0OZzI.cjs");
4
+ const faceFns = require("./faceFns-DB1Fc5gy.cjs");
5
5
  function weldShapes(facesOrShells) {
6
6
  const sewn = shapeTypes.getKernel().sew(facesOrShells.map((s) => s.wrapped));
7
- return errors.unwrap(faceFns.cast(errors.unwrap(faceFns.downcast(sewn))));
7
+ return result.unwrap(faceFns.cast(result.unwrap(faceFns.downcast(sewn))));
8
8
  }
9
9
  function weldShellsAndFaces(facesOrShells, ignoreType = false) {
10
10
  const shell = weldShapes(facesOrShells);
11
11
  if (!ignoreType && !shapeTypes.isShell(shell))
12
- return errors.err(errors.typeCastError("WELD_NOT_SHELL", "Could not make a shell from faces and shells"));
13
- return errors.ok(shell);
12
+ return result.err(result.typeCastError("WELD_NOT_SHELL", "Could not make a shell from faces and shells"));
13
+ return result.ok(shell);
14
14
  }
15
15
  function makeCylinder(radius, height, location = [0, 0, 0], direction = [0, 0, 1]) {
16
16
  return shapeTypes.createSolid(
@@ -38,12 +38,12 @@ function makeVertex(point) {
38
38
  }
39
39
  function makeOffset(face, offset, tolerance = 1e-6) {
40
40
  const resultShape = shapeTypes.getKernel().offset(face.wrapped, offset, tolerance);
41
- return errors.andThen(
41
+ return result.andThen(
42
42
  faceFns.downcast(resultShape),
43
- (downcasted) => errors.andThen(faceFns.cast(downcasted), (newShape) => {
43
+ (downcasted) => result.andThen(faceFns.cast(downcasted), (newShape) => {
44
44
  if (!shapeTypes.isShape3D(newShape))
45
- return errors.err(errors.typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
46
- return errors.ok(newShape);
45
+ return result.err(result.typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
46
+ return result.ok(newShape);
47
47
  })
48
48
  );
49
49
  }
@@ -52,10 +52,10 @@ function makeCompound(shapeArray) {
52
52
  }
53
53
  function makeSolid(facesOrShells) {
54
54
  const shell = weldShapes(facesOrShells);
55
- return errors.andThen(faceFns.cast(shapeTypes.getKernel().solidFromShell(shell.wrapped)), (solid) => {
55
+ return result.andThen(faceFns.cast(shapeTypes.getKernel().solidFromShell(shell.wrapped)), (solid) => {
56
56
  if (!shapeTypes.isSolid(solid))
57
- return errors.err(errors.typeCastError("SOLID_BUILD_FAILED", "Could not make a solid of faces and shells"));
58
- return errors.ok(solid);
57
+ return result.err(result.typeCastError("SOLID_BUILD_FAILED", "Could not make a solid of faces and shells"));
58
+ return result.ok(solid);
59
59
  });
60
60
  }
61
61
  exports.makeCompound = makeCompound;
@@ -1,6 +1,6 @@
1
1
  import { B as getKernel, q as isShell, C as createCompound, E as createVertex, F as createSolid, p as isShape3D, r as isSolid } from "./shapeTypes-CpSaBLDv.js";
2
- import { r as unwrap, e as err, p as typeCastError, o as ok, a as andThen } from "./errors-B7kgv0cd.js";
3
- import { c as cast, d as downcast } from "./faceFns-B6ebRh5I.js";
2
+ import { v as unwrap, e as err, r as typeCastError, o as ok, a as andThen } from "./result-BaSD1fqR.js";
3
+ import { c as cast, d as downcast } from "./faceFns-B8GnxjdY.js";
4
4
  function weldShapes(facesOrShells) {
5
5
  const sewn = getKernel().sew(facesOrShells.map((s) => s.wrapped));
6
6
  return unwrap(cast(unwrap(downcast(sewn))));
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
- const errors = require("./errors-9fDehDNc.cjs");
4
- const faceFns = require("./faceFns-BLTEPBKq.cjs");
3
+ const result = require("./result-fAX0OZzI.cjs");
4
+ const faceFns = require("./faceFns-DB1Fc5gy.cjs");
5
5
  function range(len) {
6
6
  return Array.from(Array(len).keys());
7
7
  }
@@ -17,11 +17,11 @@ function makeCircle(radius, center = [0, 0, 0], normal = [0, 0, 1]) {
17
17
  }
18
18
  function makeEllipse(majorRadius, minorRadius, center = [0, 0, 0], normal = [0, 0, 1], xDir) {
19
19
  if (minorRadius > majorRadius) {
20
- return errors.err(
21
- errors.validationError("ELLIPSE_RADII", "The minor radius must be smaller than the major one")
20
+ return result.err(
21
+ result.validationError("ELLIPSE_RADII", "The minor radius must be smaller than the major one")
22
22
  );
23
23
  }
24
- return errors.ok(
24
+ return result.ok(
25
25
  shapeTypes.createEdge(
26
26
  shapeTypes.getKernel().makeEllipseEdge(
27
27
  [...center],
@@ -43,11 +43,11 @@ function makeThreePointArc(v1, v2, v3) {
43
43
  }
44
44
  function makeEllipseArc(majorRadius, minorRadius, startAngle, endAngle, center = [0, 0, 0], normal = [0, 0, 1], xDir) {
45
45
  if (minorRadius > majorRadius) {
46
- return errors.err(
47
- errors.validationError("ELLIPSE_RADII", "The minor radius must be smaller than the major one")
46
+ return result.err(
47
+ result.validationError("ELLIPSE_RADII", "The minor radius must be smaller than the major one")
48
48
  );
49
49
  }
50
- return errors.ok(
50
+ return result.ok(
51
51
  shapeTypes.createEdge(
52
52
  shapeTypes.getKernel().makeEllipseArc(
53
53
  [...center],
@@ -64,19 +64,19 @@ function makeEllipseArc(majorRadius, minorRadius, startAngle, endAngle, center =
64
64
  function makeBSplineApproximation(points, { tolerance = 1e-3, smoothing = null, degMax = 6, degMin = 1 } = {}) {
65
65
  try {
66
66
  const mutablePoints = points.map((p) => [...p]);
67
- return errors.ok(
67
+ return result.ok(
68
68
  shapeTypes.createEdge(
69
69
  shapeTypes.getKernel().approximatePoints(mutablePoints, { tolerance, degMin, degMax, smoothing })
70
70
  )
71
71
  );
72
72
  } catch {
73
- return errors.err(errors.kernelError("BSPLINE_FAILED", "B-spline approximation failed"));
73
+ return result.err(result.kernelError("BSPLINE_FAILED", "B-spline approximation failed"));
74
74
  }
75
75
  }
76
76
  function makeBezierCurve(points) {
77
77
  if (points.length < 2) {
78
- return errors.err(
79
- errors.validationError(
78
+ return result.err(
79
+ result.validationError(
80
80
  "BEZIER_MIN_POINTS",
81
81
  `Need at least 2 points for a Bezier curve, got ${points.length}`,
82
82
  void 0,
@@ -87,17 +87,17 @@ function makeBezierCurve(points) {
87
87
  );
88
88
  }
89
89
  const mutablePoints = points.map((p) => [...p]);
90
- return errors.ok(shapeTypes.createEdge(shapeTypes.getKernel().makeBezierEdge(mutablePoints)));
90
+ return result.ok(shapeTypes.createEdge(shapeTypes.getKernel().makeBezierEdge(mutablePoints)));
91
91
  }
92
92
  function makeTangentArc(startPoint, startTgt, endPoint) {
93
93
  return shapeTypes.createEdge(shapeTypes.getKernel().makeTangentArc([...startPoint], [...startTgt], [...endPoint]));
94
94
  }
95
95
  function assembleWire(listOfEdges) {
96
96
  try {
97
- return errors.ok(shapeTypes.createWire(shapeTypes.getKernel().makeWireFromMixed(listOfEdges.map((e) => e.wrapped))));
97
+ return result.ok(shapeTypes.createWire(shapeTypes.getKernel().makeWireFromMixed(listOfEdges.map((e) => e.wrapped))));
98
98
  } catch (e) {
99
- return errors.err(
100
- errors.kernelError(
99
+ return result.err(
100
+ result.kernelError(
101
101
  "WIRE_BUILD_FAILED",
102
102
  `Failed to build the wire: ${e instanceof Error ? e.message : "unknown error"}`
103
103
  )
@@ -108,12 +108,12 @@ function makeFace(wire, holes) {
108
108
  try {
109
109
  const faceShape = shapeTypes.getKernel().makeFace(wire.wrapped, true);
110
110
  if (holes && holes.length > 0) {
111
- return errors.ok(addHolesInFace(shapeTypes.createFace(faceShape), holes));
111
+ return result.ok(addHolesInFace(shapeTypes.createFace(faceShape), holes));
112
112
  }
113
- return errors.ok(shapeTypes.createFace(faceShape));
113
+ return result.ok(shapeTypes.createFace(faceShape));
114
114
  } catch {
115
- return errors.err(
116
- errors.kernelError("FACE_BUILD_FAILED", "Failed to build the face. Your wire might be non planar.")
115
+ return result.err(
116
+ result.kernelError("FACE_BUILD_FAILED", "Failed to build the face. Your wire might be non planar.")
117
117
  );
118
118
  }
119
119
  }
@@ -129,14 +129,14 @@ function makeNewFaceWithinFace(originFace, wire) {
129
129
  function makeNonPlanarFace(wire) {
130
130
  try {
131
131
  const shape = shapeTypes.getKernel().makeNonPlanarFace(wire.wrapped);
132
- return errors.andThen(faceFns.cast(shape), (newFace) => {
132
+ return result.andThen(faceFns.cast(shape), (newFace) => {
133
133
  if (!shapeTypes.isFace(newFace)) {
134
- return errors.err(errors.kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
134
+ return result.err(result.kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
135
135
  }
136
- return errors.ok(newFace);
136
+ return result.ok(newFace);
137
137
  });
138
138
  } catch {
139
- return errors.err(errors.kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
139
+ return result.err(result.kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
140
140
  }
141
141
  }
142
142
  function addHolesInFace(face, holes) {
@@ -149,14 +149,14 @@ function addHolesInFace(face, holes) {
149
149
  }
150
150
  function makePolygon(points) {
151
151
  if (points.length < 3)
152
- return errors.err(
153
- errors.validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon")
152
+ return result.err(
153
+ result.validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon")
154
154
  );
155
155
  const edges = zip([points, [...points.slice(1), points[0]]]).map(
156
156
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- zip returns untyped pairs
157
157
  ([p1, p2]) => makeLine(p1, p2)
158
158
  );
159
- return errors.andThen(assembleWire(edges), (wire) => makeFace(wire));
159
+ return result.andThen(assembleWire(edges), (wire) => makeFace(wire));
160
160
  }
161
161
  exports.addHolesInFace = addHolesInFace;
162
162
  exports.assembleWire = assembleWire;
@@ -1,6 +1,6 @@
1
1
  import { G as createWire, B as getKernel, H as createEdge, I as createFace, k as isFace } from "./shapeTypes-CpSaBLDv.js";
2
- import { o as ok, e as err, k as kernelError, y as validationError, a as andThen } from "./errors-B7kgv0cd.js";
3
- import { o as outerWire, c as cast } from "./faceFns-B6ebRh5I.js";
2
+ import { o as ok, e as err, k as kernelError, z as validationError, a as andThen } from "./result-BaSD1fqR.js";
3
+ import { o as outerWire, c as cast } from "./faceFns-B8GnxjdY.js";
4
4
  function range(len) {
5
5
  return Array.from(Array(len).keys());
6
6
  }