@bldrs-ai/conway 1.519.1471 → 1.528.1490

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 (66) hide show
  1. package/compiled/examples/browser-bundled.cjs +90 -7
  2. package/compiled/examples/cli-bundled.cjs +368 -79
  3. package/compiled/examples/cli-step-bundled.cjs +330 -84
  4. package/compiled/examples/validator-bundled.cjs +90 -7
  5. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts +2 -2
  6. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts.map +1 -1
  7. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.js +2 -2
  8. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts +3 -3
  9. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts.map +1 -1
  10. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.js +3 -3
  11. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts +1 -1
  12. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts.map +1 -1
  13. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.js +1 -1
  14. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts +1 -1
  15. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts.map +1 -1
  16. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.js +1 -1
  17. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts +1 -1
  18. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts.map +1 -1
  19. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.js +1 -1
  20. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts +1 -1
  21. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts.map +1 -1
  22. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.js +1 -1
  23. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/schema_ap214.gen.js +11 -11
  24. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts +1 -1
  25. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts.map +1 -1
  26. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.js +1 -1
  27. package/compiled/src/AP214E3_2010/ap214_command_line_main.js +7 -3
  28. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +80 -7
  29. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
  30. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +254 -33
  31. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts +2 -0
  32. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts.map +1 -0
  33. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.js +114 -0
  34. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts +2 -0
  35. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts.map +1 -0
  36. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.js +233 -0
  37. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  38. package/compiled/src/compat/web-ifc/ifc_api.js +10 -2
  39. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
  40. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +10 -2
  41. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  42. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +10 -2
  43. package/compiled/src/core/wasm_heap.d.ts +119 -2
  44. package/compiled/src/core/wasm_heap.d.ts.map +1 -1
  45. package/compiled/src/core/wasm_heap.js +239 -30
  46. package/compiled/src/core/wasm_heap.test.js +315 -3
  47. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts +1 -1
  48. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts.map +1 -1
  49. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.js +1 -1
  50. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts +1 -1
  51. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts.map +1 -1
  52. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.js +1 -1
  53. package/compiled/src/ifc/ifc4_gen/schema_ifc.gen.js +2 -2
  54. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +74 -0
  55. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  56. package/compiled/src/ifc/ifc_geometry_extraction.js +315 -7
  57. package/compiled/src/ifc/ifc_grid_placement.test.d.ts +2 -0
  58. package/compiled/src/ifc/ifc_grid_placement.test.d.ts.map +1 -0
  59. package/compiled/src/ifc/ifc_grid_placement.test.js +261 -0
  60. package/compiled/src/ifc/ifc_stream_open.test.js +14 -4
  61. package/compiled/src/step/step_entity_base.d.ts +10 -3
  62. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  63. package/compiled/src/step/step_entity_base.js +30 -2
  64. package/compiled/src/version/version.js +1 -1
  65. package/compiled/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +1 -1
@@ -30,7 +30,7 @@ var import_node_process = require("node:process");
30
30
  var readline = __toESM(require("node:readline"), 1);
31
31
 
32
32
  // compiled/src/version/version.js
33
- var versionString = "Conway v1.519.1471";
33
+ var versionString = "Conway v1.528.1490";
34
34
 
35
35
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
36
36
  var wasmType = "";
@@ -11065,6 +11065,67 @@ function IfcWorkScheduleTypeEnumDeserializeStep(input2, cursor, endCursor) {
11065
11065
  return parser208.extract(IfcWorkScheduleTypeEnumSearch, input2, cursor, endCursor);
11066
11066
  }
11067
11067
 
11068
+ // compiled/src/core/wasm_heap.js
11069
+ function describeHeap(wasmModule, arrayPtr, numBytes) {
11070
+ const heap = wasmModule.HEAPU8;
11071
+ const buffer = currentHeapBuffer(wasmModule);
11072
+ const shared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
11073
+ const kind = buffer === void 0 ? "none" : shared ? "SharedArrayBuffer" : "ArrayBuffer";
11074
+ const extensible = shared ? buffer?.growable : buffer?.resizable;
11075
+ return `ptr ${arrayPtr} + ${numBytes} bytes, heap view length ${heap?.length}, buffer ${kind} byteLength ${buffer?.byteLength}, extensible ${extensible}`;
11076
+ }
11077
+ function currentHeapBuffer(wasmModule) {
11078
+ const memory = wasmModule.wasmMemory;
11079
+ return memory !== void 0 ? memory.buffer : wasmModule.HEAPU8?.buffer;
11080
+ }
11081
+ function refreshHeapViews(wasmModule) {
11082
+ if (typeof wasmModule.updateMemoryViews === "function") {
11083
+ wasmModule.updateMemoryViews();
11084
+ return;
11085
+ }
11086
+ if (wasmModule.wasmMemory !== void 0) {
11087
+ return;
11088
+ }
11089
+ const StringVector = wasmModule.stringVector;
11090
+ if (StringVector === void 0) {
11091
+ return;
11092
+ }
11093
+ let scratch;
11094
+ releaseQuietly(() => {
11095
+ const created2 = new StringVector();
11096
+ scratch = created2;
11097
+ created2.push_back("");
11098
+ });
11099
+ const created = scratch;
11100
+ if (created !== void 0) {
11101
+ releaseQuietly(() => created.delete());
11102
+ }
11103
+ }
11104
+ function reconcileHeapBuffer(wasmModule, address, numBytes) {
11105
+ const buffer = currentHeapBuffer(wasmModule);
11106
+ if (buffer !== void 0 && address + numBytes <= buffer.byteLength) {
11107
+ return buffer;
11108
+ }
11109
+ refreshHeapViews(wasmModule);
11110
+ const refreshed = currentHeapBuffer(wasmModule);
11111
+ if (refreshed !== void 0 && address + numBytes <= refreshed.byteLength) {
11112
+ return refreshed;
11113
+ }
11114
+ throw new Error("wasm heap allocation lies outside the heap, and refreshing the module views did not reconcile it. " + describeHeap(wasmModule, address, numBytes));
11115
+ }
11116
+ function wasmHeapView(wasmModule, arrayType, pointer, elementCount) {
11117
+ const address = pointer >>> 0;
11118
+ const numBytes = elementCount * arrayType.BYTES_PER_ELEMENT;
11119
+ return new arrayType(reconcileHeapBuffer(wasmModule, address, numBytes), address, elementCount);
11120
+ }
11121
+ function releaseQuietly(release) {
11122
+ try {
11123
+ release();
11124
+ } catch (error) {
11125
+ logger_default.debug(`wasm resource release failed during teardown: ${error instanceof Error ? error.message : error}`);
11126
+ }
11127
+ }
11128
+
11068
11129
  // compiled/src/step/step_entity_base.js
11069
11130
  var IfcTokenType;
11070
11131
  (function(IfcTokenType2) {
@@ -11221,6 +11282,27 @@ var StepEntityBase = class {
11221
11282
  }
11222
11283
  return value;
11223
11284
  }
11285
+ /**
11286
+ * Extract a number at the particular vtable offset (i.e. the position
11287
+ * in the matching step object).
11288
+ *
11289
+ * Used by other extraction methods with wrappers to perform
11290
+ * semantically correct extraction.
11291
+ *
11292
+ * Unlike the other extractors this has a single signature rather than an
11293
+ * optional/non-optional overload pair, because LOGICAL is three-valued:
11294
+ * `.U.` is a legitimate value that reads as null, so a non-optional LOGICAL
11295
+ * is null-valued too and `optional` only decides whether a *missing* value
11296
+ * throws. The old `optional: false` overload promised a bare `boolean` and
11297
+ * was a lie for exactly the `.U.` case this extractor exists to handle.
11298
+ *
11299
+ * @param offset The offset in the vtable to extract from
11300
+ * @param baseOffset The base offset in the vtable to extract from
11301
+ * @param depth The depth of the vtable to extract from
11302
+ * @param optional Is this an optional field?
11303
+ * @return {boolean | null} The extracted logical, or null for `.U.` and for
11304
+ * an absent optional.
11305
+ */
11224
11306
  extractLogical(offset, baseOffset, depth, optional) {
11225
11307
  const [cursor, endCursor, buffer] = this.getOffsetAndEndCursor(offset, baseOffset, depth);
11226
11308
  const value = stepExtractLogical(buffer, cursor, endCursor);
@@ -11500,8 +11582,9 @@ var StepEntityBase = class {
11500
11582
  if (optional && stepExtractOptional(buffer, cursor, endCursor) === null) {
11501
11583
  return false;
11502
11584
  }
11503
- const dataPtr = result.resize(endCursor - cursor);
11504
- module2.HEAPU8.set(buffer.subarray(cursor, endCursor), dataPtr);
11585
+ const length = endCursor - cursor;
11586
+ const dataPtr = result.resize(length);
11587
+ wasmHeapView(module2, Uint8Array, dataPtr, length).set(buffer.subarray(cursor, endCursor));
11505
11588
  return true;
11506
11589
  }
11507
11590
  /**
@@ -15361,7 +15444,7 @@ var IfcLogical = class extends StepEntityBase {
15361
15444
  }
15362
15445
  get Value() {
15363
15446
  if (this.Value_ === void 0) {
15364
- this.Value_ = this.extractBoolean(0, 0, 0, false);
15447
+ this.Value_ = this.extractLogical(0, 0, 0, false);
15365
15448
  }
15366
15449
  return this.Value_;
15367
15450
  }
@@ -26483,7 +26566,7 @@ var IfcRelInterferesElements = class extends IfcRelConnects {
26483
26566
  }
26484
26567
  get ImpliedOrder() {
26485
26568
  if (this.ImpliedOrder_ === void 0) {
26486
- this.ImpliedOrder_ = this.extractBoolean(8, 4, 3, false);
26569
+ this.ImpliedOrder_ = this.extractLogical(8, 4, 3, false);
26487
26570
  }
26488
26571
  return this.ImpliedOrder_;
26489
26572
  }
@@ -64751,7 +64834,7 @@ var descriptions = [
64751
64834
  },
64752
64835
  ImpliedOrder: {
64753
64836
  kind: f.BOOLEAN,
64754
- optional: false,
64837
+ optional: true,
64755
64838
  derived: false,
64756
64839
  offset: 8
64757
64840
  }
@@ -69723,7 +69806,7 @@ var descriptions = [
69723
69806
  fields: {
69724
69807
  Value: {
69725
69808
  kind: f.BOOLEAN,
69726
- optional: false,
69809
+ optional: true,
69727
69810
  derived: false,
69728
69811
  offset: 0
69729
69812
  }
@@ -14965,7 +14965,7 @@ ${t5.join("\n")}` : "";
14965
14965
  var import_process = require("process");
14966
14966
 
14967
14967
  // compiled/src/version/version.js
14968
- var versionString = "Conway v1.519.1471";
14968
+ var versionString = "Conway v1.528.1490";
14969
14969
 
14970
14970
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
14971
14971
  function pThreadsAllowed() {
@@ -26948,6 +26948,121 @@ function IfcWorkScheduleTypeEnumDeserializeStep(input, cursor, endCursor) {
26948
26948
  return parser208.extract(IfcWorkScheduleTypeEnumSearch, input, cursor, endCursor);
26949
26949
  }
26950
26950
 
26951
+ // compiled/src/core/wasm_heap.js
26952
+ function describeHeap(wasmModule, arrayPtr, numBytes) {
26953
+ const heap = wasmModule.HEAPU8;
26954
+ const buffer = currentHeapBuffer(wasmModule);
26955
+ const shared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
26956
+ const kind = buffer === void 0 ? "none" : shared ? "SharedArrayBuffer" : "ArrayBuffer";
26957
+ const extensible = shared ? buffer?.growable : buffer?.resizable;
26958
+ return `ptr ${arrayPtr} + ${numBytes} bytes, heap view length ${heap?.length}, buffer ${kind} byteLength ${buffer?.byteLength}, extensible ${extensible}`;
26959
+ }
26960
+ function currentHeapBuffer(wasmModule) {
26961
+ const memory = wasmModule.wasmMemory;
26962
+ return memory !== void 0 ? memory.buffer : wasmModule.HEAPU8?.buffer;
26963
+ }
26964
+ function refreshHeapViews(wasmModule) {
26965
+ if (typeof wasmModule.updateMemoryViews === "function") {
26966
+ wasmModule.updateMemoryViews();
26967
+ return;
26968
+ }
26969
+ if (wasmModule.wasmMemory !== void 0) {
26970
+ return;
26971
+ }
26972
+ const StringVector = wasmModule.stringVector;
26973
+ if (StringVector === void 0) {
26974
+ return;
26975
+ }
26976
+ let scratch;
26977
+ releaseQuietly(() => {
26978
+ const created2 = new StringVector();
26979
+ scratch = created2;
26980
+ created2.push_back("");
26981
+ });
26982
+ const created = scratch;
26983
+ if (created !== void 0) {
26984
+ releaseQuietly(() => created.delete());
26985
+ }
26986
+ }
26987
+ function reconcileHeapBuffer(wasmModule, address, numBytes) {
26988
+ const buffer = currentHeapBuffer(wasmModule);
26989
+ if (buffer !== void 0 && address + numBytes <= buffer.byteLength) {
26990
+ return buffer;
26991
+ }
26992
+ refreshHeapViews(wasmModule);
26993
+ const refreshed = currentHeapBuffer(wasmModule);
26994
+ if (refreshed !== void 0 && address + numBytes <= refreshed.byteLength) {
26995
+ return refreshed;
26996
+ }
26997
+ throw new Error("wasm heap allocation lies outside the heap, and refreshing the module views did not reconcile it. " + describeHeap(wasmModule, address, numBytes));
26998
+ }
26999
+ function wasmHeapView(wasmModule, arrayType, pointer, elementCount) {
27000
+ const address = pointer >>> 0;
27001
+ const numBytes = elementCount * arrayType.BYTES_PER_ELEMENT;
27002
+ return new arrayType(reconcileHeapBuffer(wasmModule, address, numBytes), address, elementCount);
27003
+ }
27004
+ function arrayToWasmHeap(wasmModule, array) {
27005
+ const numBytes = array.length * array.BYTES_PER_ELEMENT;
27006
+ const arrayPtr = wasmModule._malloc(numBytes) >>> 0;
27007
+ if (arrayPtr === 0 && numBytes > 0) {
27008
+ throw new Error(`wasm _malloc returned an unusable address for ${numBytes} bytes - ` + describeHeap(wasmModule, arrayPtr, numBytes));
27009
+ }
27010
+ let destination;
27011
+ try {
27012
+ destination = wasmHeapView(wasmModule, Uint8Array, arrayPtr, numBytes);
27013
+ } catch (error) {
27014
+ releaseQuietly(() => wasmModule._free(arrayPtr));
27015
+ throw error;
27016
+ }
27017
+ destination.set(new Uint8Array(array.buffer, array.byteOffset, numBytes));
27018
+ return arrayPtr;
27019
+ }
27020
+ function arraysToWasmHeap(wasmModule, arrays) {
27021
+ const pointers = [];
27022
+ try {
27023
+ for (const array of arrays) {
27024
+ pointers.push(arrayToWasmHeap(wasmModule, array));
27025
+ }
27026
+ } catch (error) {
27027
+ for (const pointer of pointers) {
27028
+ releaseQuietly(() => wasmModule._free(pointer));
27029
+ }
27030
+ throw error;
27031
+ }
27032
+ return pointers;
27033
+ }
27034
+ function releaseQuietly(release) {
27035
+ try {
27036
+ release();
27037
+ } catch (error) {
27038
+ logger_default.debug(`wasm resource release failed during teardown: ${error instanceof Error ? error.message : error}`);
27039
+ }
27040
+ }
27041
+ function withRelease(body, release) {
27042
+ let result;
27043
+ try {
27044
+ result = body();
27045
+ } catch (error) {
27046
+ releaseQuietly(release);
27047
+ throw error;
27048
+ }
27049
+ release();
27050
+ return result;
27051
+ }
27052
+ function freeAll(wasmModule, pointers) {
27053
+ let firstFailure;
27054
+ for (const pointer of pointers) {
27055
+ try {
27056
+ wasmModule._free(pointer);
27057
+ } catch (error) {
27058
+ firstFailure ??= error;
27059
+ }
27060
+ }
27061
+ if (firstFailure !== void 0) {
27062
+ throw firstFailure;
27063
+ }
27064
+ }
27065
+
26951
27066
  // compiled/src/step/step_entity_base.js
26952
27067
  var IfcTokenType;
26953
27068
  (function(IfcTokenType2) {
@@ -27104,6 +27219,27 @@ var StepEntityBase = class {
27104
27219
  }
27105
27220
  return value;
27106
27221
  }
27222
+ /**
27223
+ * Extract a number at the particular vtable offset (i.e. the position
27224
+ * in the matching step object).
27225
+ *
27226
+ * Used by other extraction methods with wrappers to perform
27227
+ * semantically correct extraction.
27228
+ *
27229
+ * Unlike the other extractors this has a single signature rather than an
27230
+ * optional/non-optional overload pair, because LOGICAL is three-valued:
27231
+ * `.U.` is a legitimate value that reads as null, so a non-optional LOGICAL
27232
+ * is null-valued too and `optional` only decides whether a *missing* value
27233
+ * throws. The old `optional: false` overload promised a bare `boolean` and
27234
+ * was a lie for exactly the `.U.` case this extractor exists to handle.
27235
+ *
27236
+ * @param offset The offset in the vtable to extract from
27237
+ * @param baseOffset The base offset in the vtable to extract from
27238
+ * @param depth The depth of the vtable to extract from
27239
+ * @param optional Is this an optional field?
27240
+ * @return {boolean | null} The extracted logical, or null for `.U.` and for
27241
+ * an absent optional.
27242
+ */
27107
27243
  extractLogical(offset, baseOffset, depth, optional) {
27108
27244
  const [cursor, endCursor, buffer] = this.getOffsetAndEndCursor(offset, baseOffset, depth);
27109
27245
  const value = stepExtractLogical(buffer, cursor, endCursor);
@@ -27383,8 +27519,9 @@ var StepEntityBase = class {
27383
27519
  if (optional && stepExtractOptional(buffer, cursor, endCursor) === null) {
27384
27520
  return false;
27385
27521
  }
27386
- const dataPtr = result.resize(endCursor - cursor);
27387
- module2.HEAPU8.set(buffer.subarray(cursor, endCursor), dataPtr);
27522
+ const length = endCursor - cursor;
27523
+ const dataPtr = result.resize(length);
27524
+ wasmHeapView(module2, Uint8Array, dataPtr, length).set(buffer.subarray(cursor, endCursor));
27388
27525
  return true;
27389
27526
  }
27390
27527
  /**
@@ -31244,7 +31381,7 @@ var IfcLogical = class extends StepEntityBase {
31244
31381
  }
31245
31382
  get Value() {
31246
31383
  if (this.Value_ === void 0) {
31247
- this.Value_ = this.extractBoolean(0, 0, 0, false);
31384
+ this.Value_ = this.extractLogical(0, 0, 0, false);
31248
31385
  }
31249
31386
  return this.Value_;
31250
31387
  }
@@ -42366,7 +42503,7 @@ var IfcRelInterferesElements = class extends IfcRelConnects {
42366
42503
  }
42367
42504
  get ImpliedOrder() {
42368
42505
  if (this.ImpliedOrder_ === void 0) {
42369
- this.ImpliedOrder_ = this.extractBoolean(8, 4, 3, false);
42506
+ this.ImpliedOrder_ = this.extractLogical(8, 4, 3, false);
42370
42507
  }
42371
42508
  return this.ImpliedOrder_;
42372
42509
  }
@@ -80634,7 +80771,7 @@ var descriptions = [
80634
80771
  },
80635
80772
  ImpliedOrder: {
80636
80773
  kind: f.BOOLEAN,
80637
- optional: false,
80774
+ optional: true,
80638
80775
  derived: false,
80639
80776
  offset: 8
80640
80777
  }
@@ -85606,7 +85743,7 @@ var descriptions = [
85606
85743
  fields: {
85607
85744
  Value: {
85608
85745
  kind: f.BOOLEAN,
85609
- optional: false,
85746
+ optional: true,
85610
85747
  derived: false,
85611
85748
  offset: 0
85612
85749
  }
@@ -88642,83 +88779,15 @@ var IfcSceneBuilder = class {
88642
88779
  }
88643
88780
  };
88644
88781
 
88645
- // compiled/src/core/wasm_heap.js
88646
- function describeHeap(wasmModule, arrayPtr, numBytes) {
88647
- const heap = wasmModule.HEAPU8;
88648
- const buffer = heap?.buffer;
88649
- const shared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
88650
- const kind = buffer === void 0 ? "none" : shared ? "SharedArrayBuffer" : "ArrayBuffer";
88651
- const extensible = shared ? buffer?.growable : buffer?.resizable;
88652
- return `ptr ${arrayPtr} + ${numBytes} bytes, heap view length ${heap?.length}, buffer ${kind} byteLength ${buffer?.byteLength}, extensible ${extensible}`;
88653
- }
88654
- function arrayToWasmHeap(wasmModule, array) {
88655
- const numBytes = array.length * array.BYTES_PER_ELEMENT;
88656
- const arrayPtr = wasmModule._malloc(numBytes) >>> 0;
88657
- if (arrayPtr === 0 && numBytes > 0) {
88658
- throw new Error(`wasm _malloc returned an unusable address for ${numBytes} bytes - ` + describeHeap(wasmModule, arrayPtr, numBytes));
88659
- }
88660
- const heapBuffer = wasmModule.HEAPU8.buffer;
88661
- if (arrayPtr + numBytes > heapBuffer.byteLength) {
88662
- const description = describeHeap(wasmModule, arrayPtr, numBytes);
88663
- releaseQuietly(() => wasmModule._free(arrayPtr));
88664
- throw new Error(`wasm heap allocation lies outside the heap view - the view is stale or the heap grew without it. ${description}`);
88665
- }
88666
- const destination = new Uint8Array(heapBuffer, arrayPtr, numBytes);
88667
- destination.set(new Uint8Array(array.buffer, array.byteOffset, numBytes));
88668
- return arrayPtr;
88669
- }
88670
- function arraysToWasmHeap(wasmModule, arrays) {
88671
- const pointers = [];
88672
- try {
88673
- for (const array of arrays) {
88674
- pointers.push(arrayToWasmHeap(wasmModule, array));
88675
- }
88676
- } catch (error) {
88677
- for (const pointer of pointers) {
88678
- releaseQuietly(() => wasmModule._free(pointer));
88679
- }
88680
- throw error;
88681
- }
88682
- return pointers;
88683
- }
88684
- function releaseQuietly(release) {
88685
- try {
88686
- release();
88687
- } catch (error) {
88688
- logger_default.debug(`wasm resource release failed during teardown: ${error instanceof Error ? error.message : error}`);
88689
- }
88690
- }
88691
- function withRelease(body, release) {
88692
- let result;
88693
- try {
88694
- result = body();
88695
- } catch (error) {
88696
- releaseQuietly(release);
88697
- throw error;
88698
- }
88699
- release();
88700
- return result;
88701
- }
88702
- function freeAll(wasmModule, pointers) {
88703
- let firstFailure;
88704
- for (const pointer of pointers) {
88705
- try {
88706
- wasmModule._free(pointer);
88707
- } catch (error) {
88708
- firstFailure ??= error;
88709
- }
88710
- }
88711
- if (firstFailure !== void 0) {
88712
- throw firstFailure;
88713
- }
88714
- }
88715
-
88716
88782
  // compiled/src/ifc/ifc_parser_quirks.js
88717
88783
  var MATERIAL_RELATED_OBJECTS_PERMISSIVE = true;
88718
88784
  var REFLECTANCE_METHOD_PERMISSIVE = true;
88719
88785
 
88720
88786
  // compiled/src/ifc/ifc_geometry_extraction.js
88721
88787
  var DEFAULT_GEOMETRY_YIELD_INTERVAL_MS = 50;
88788
+ var GRID_INTERSECTION_AXIS_COUNT = 2;
88789
+ var GRID_INTERSECTION_Z_OFFSET = 2;
88790
+ var GRID_AXIS_PARALLEL_EPSILON = 1e-9;
88722
88791
  function extractSpecularHighlight(from) {
88723
88792
  if (from === null) {
88724
88793
  return void 0;
@@ -91135,7 +91204,7 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
91135
91204
  pointer = this.wasmModule._malloc(numBytes);
91136
91205
  capacity = maxPossibleFloats;
91137
91206
  }
91138
- const wasmFloat64View = this.wasmModule.HEAPF64.subarray(pointer / bytesPerElement, pointer / bytesPerElement + capacity);
91207
+ const wasmFloat64View = wasmHeapView(this.wasmModule, Float64Array, pointer, capacity);
91139
91208
  let offset = 0;
91140
91209
  let prevLocalID = -1;
91141
91210
  for (let i = 0; i < points.length; i++) {
@@ -92322,6 +92391,225 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
92322
92391
  model.nullOnErrors = priorNullOnErrors;
92323
92392
  }
92324
92393
  }
92394
+ /**
92395
+ * Reduce a grid axis to an unbounded line in the plane of the grid's
92396
+ * placement: a point on it, and its tangent there.
92397
+ *
92398
+ * Only the straight axis curves are handled — an IfcLine, or the single
92399
+ * segment of a two-point IfcPolyline — which is what grid axes are in
92400
+ * practice. Anything else returns undefined after warning, so the
92401
+ * placement lands in errors.csv rather than being dropped in silence.
92402
+ *
92403
+ * `SameSense` is folded into the tangent because everything downstream is
92404
+ * measured from it: the offset in IfcVirtualGridIntersection is normal to
92405
+ * the tangent, and the tangent is also an IfcGridPlacement's default
92406
+ * x-axis, so a reversed axis offsets to the other side and points the
92407
+ * other way.
92408
+ *
92409
+ * @param axis The grid axis to reduce.
92410
+ * @return {{x, y, dx, dy} | undefined} A point and (unnormalised) tangent
92411
+ * in the grid's coordinate system, or undefined for an axis curve this
92412
+ * does not handle.
92413
+ */
92414
+ static gridAxisLine(axis) {
92415
+ const curve = axis.AxisCurve;
92416
+ let x;
92417
+ let y;
92418
+ let dx;
92419
+ let dy;
92420
+ if (curve instanceof IfcPolyline) {
92421
+ const points = curve.Points;
92422
+ if (points.length !== 2) {
92423
+ logger_default.warning("IfcGridPlacement: grid axis IfcPolyline is not a single segment.", axis.expressID);
92424
+ return void 0;
92425
+ }
92426
+ const start = points[0].Coordinates;
92427
+ const end = points[1].Coordinates;
92428
+ x = start[0];
92429
+ y = start[1];
92430
+ dx = end[0] - start[0];
92431
+ dy = end[1] - start[1];
92432
+ } else if (curve instanceof IfcLine) {
92433
+ const origin = curve.Pnt.Coordinates;
92434
+ const direction = curve.Dir.Orientation.DirectionRatios;
92435
+ x = origin[0];
92436
+ y = origin[1];
92437
+ dx = direction[0];
92438
+ dy = direction[1];
92439
+ } else {
92440
+ logger_default.warning(`IfcGridPlacement: unsupported grid axis curve, type: ${entity_types_ifc_gen_default[curve.type]}`, axis.expressID);
92441
+ return void 0;
92442
+ }
92443
+ if (!axis.SameSense) {
92444
+ dx = -dx;
92445
+ dy = -dy;
92446
+ }
92447
+ return { x, y, dx, dy };
92448
+ }
92449
+ /**
92450
+ * Resolve an IfcVirtualGridIntersection to a point in the coordinate system
92451
+ * of the IfcGrid that owns its axes, along with the tangent of its first
92452
+ * axis — which is the default x-axis of an IfcGridPlacement located here.
92453
+ *
92454
+ * Per IFC4 each axis is replaced by its offset curve before intersecting:
92455
+ * OffsetDistances[n] is measured from axis n normal to its tangent,
92456
+ * positive towards the tangent turned a quarter turn anti-clockwise. Both
92457
+ * axes here are straight, so their offset curves are parallel to them and
92458
+ * the tangents are unchanged. A third offset, when the file gives one,
92459
+ * displaces the result along the grid placement's z axis.
92460
+ *
92461
+ * @param from The intersection to resolve.
92462
+ * @return {{position, tangent} | undefined} The intersection point and the
92463
+ * first axis' unit tangent, or undefined when the axes cannot be reduced to
92464
+ * two lines that meet (warned at the point of failure).
92465
+ */
92466
+ resolveVirtualGridIntersection(from) {
92467
+ const axes = from.IntersectingAxes;
92468
+ if (axes.length < GRID_INTERSECTION_AXIS_COUNT) {
92469
+ logger_default.warning("IfcGridPlacement: virtual grid intersection has fewer than two axes.", from.expressID);
92470
+ return void 0;
92471
+ }
92472
+ const line0 = _IfcGeometryExtraction.gridAxisLine(axes[0]);
92473
+ const line1 = _IfcGeometryExtraction.gridAxisLine(axes[1]);
92474
+ if (line0 === void 0 || line1 === void 0) {
92475
+ return void 0;
92476
+ }
92477
+ const length0 = Math.sqrt(line0.dx * line0.dx + line0.dy * line0.dy);
92478
+ const length1 = Math.sqrt(line1.dx * line1.dx + line1.dy * line1.dy);
92479
+ const cross = line0.dx * line1.dy - line0.dy * line1.dx;
92480
+ if (Math.abs(cross) <= GRID_AXIS_PARALLEL_EPSILON * length0 * length1) {
92481
+ logger_default.warning("IfcGridPlacement: intersecting grid axes are parallel or degenerate.", from.expressID);
92482
+ return void 0;
92483
+ }
92484
+ const offsets = from.OffsetDistances;
92485
+ const offset0 = offsets[0] ?? 0;
92486
+ const offset1 = offsets[1] ?? 0;
92487
+ const x0 = line0.x - offset0 * line0.dy / length0;
92488
+ const y0 = line0.y + offset0 * line0.dx / length0;
92489
+ const x1 = line1.x - offset1 * line1.dy / length1;
92490
+ const y1 = line1.y + offset1 * line1.dx / length1;
92491
+ const t = ((x1 - x0) * line1.dy - (y1 - y0) * line1.dx) / cross;
92492
+ return {
92493
+ position: {
92494
+ x: x0 + t * line0.dx,
92495
+ y: y0 + t * line0.dy,
92496
+ z: offsets[GRID_INTERSECTION_Z_OFFSET] ?? 0
92497
+ },
92498
+ tangent: { x: line0.dx / length0, y: line0.dy / length0 }
92499
+ };
92500
+ }
92501
+ /**
92502
+ * The IfcGrid that lists a given axis, or undefined if no grid does.
92503
+ *
92504
+ * IfcGridAxis's route back to its grid is the PartOfU/PartOfV/PartOfW
92505
+ * inverse attributes, and the generated schema layer carries no inverses,
92506
+ * so this is a scan of every IfcGrid's axis lists, memoised. It is built on
92507
+ * the first grid placement extracted and never at all for a model without
92508
+ * one.
92509
+ *
92510
+ * @param axis The axis to look up.
92511
+ * @return {IfcGrid | undefined} The grid listing the axis.
92512
+ */
92513
+ gridByAxis(axis) {
92514
+ let gridByAxis = this.gridByAxis_;
92515
+ if (gridByAxis === void 0) {
92516
+ gridByAxis = /* @__PURE__ */ new Map();
92517
+ for (const grid of this.model.types(IfcGrid)) {
92518
+ for (const gridAxis of grid.UAxes) {
92519
+ gridByAxis.set(gridAxis.localID, grid);
92520
+ }
92521
+ for (const gridAxis of grid.VAxes) {
92522
+ gridByAxis.set(gridAxis.localID, grid);
92523
+ }
92524
+ for (const gridAxis of grid.WAxes ?? []) {
92525
+ gridByAxis.set(gridAxis.localID, grid);
92526
+ }
92527
+ }
92528
+ this.gridByAxis_ = gridByAxis;
92529
+ }
92530
+ return gridByAxis.get(axis.localID);
92531
+ }
92532
+ /**
92533
+ * Extract an IfcGridPlacement, registering a transform against its local ID
92534
+ * the same way the IfcLocalPlacement arm does — same scene, same
92535
+ * memoisation, same composition onto the current parent.
92536
+ *
92537
+ * The origin is the virtual intersection of two grid axes and the x-axis
92538
+ * comes from PlacementRefDirection (defaulting to the first axis' tangent),
92539
+ * both expressed in the coordinate system of the IfcGrid that owns the
92540
+ * axes. IfcGridPlacement has no PlacementRelTo of its own in IFC4, so that
92541
+ * grid's object placement IS the parent: extracting it first leaves it as
92542
+ * the scene's current transform, which `addTransform` then composes onto.
92543
+ *
92544
+ * @param from The grid placement to extract.
92545
+ * @param isRelVoid Whether this placement is being resolved into the void
92546
+ * scene rather than the main one.
92547
+ */
92548
+ extractGridPlacement(from, isRelVoid) {
92549
+ const placementLocation = from.PlacementLocation;
92550
+ const location = this.resolveVirtualGridIntersection(placementLocation);
92551
+ if (location === void 0) {
92552
+ return;
92553
+ }
92554
+ let xAxisRef = { x: location.tangent.x, y: location.tangent.y, z: 0 };
92555
+ const refDirection = from.PlacementRefDirection;
92556
+ if (refDirection instanceof IfcDirection) {
92557
+ const ratios = refDirection.DirectionRatios;
92558
+ xAxisRef = { x: ratios[0], y: ratios[1], z: ratios[2] ?? 0 };
92559
+ } else if (refDirection instanceof IfcVirtualGridIntersection) {
92560
+ const reference = this.resolveVirtualGridIntersection(refDirection);
92561
+ if (reference !== void 0) {
92562
+ xAxisRef = {
92563
+ x: reference.position.x - location.position.x,
92564
+ y: reference.position.y - location.position.y,
92565
+ z: reference.position.z - location.position.z
92566
+ };
92567
+ }
92568
+ }
92569
+ const xAxisRefPlanar = Math.sqrt(xAxisRef.x * xAxisRef.x + xAxisRef.y * xAxisRef.y);
92570
+ const xAxisRefLength = Math.sqrt(xAxisRefPlanar * xAxisRefPlanar + xAxisRef.z * xAxisRef.z);
92571
+ if (xAxisRefPlanar <= GRID_AXIS_PARALLEL_EPSILON * xAxisRefLength) {
92572
+ logger_default.warning("IfcGridPlacement: the placement reference direction is parallel to the grid placement's z axis, or has no length - falling back to the schema default, the first axis' tangent.", from.expressID);
92573
+ xAxisRef = { x: location.tangent.x, y: location.tangent.y, z: 0 };
92574
+ }
92575
+ let grid;
92576
+ let gridScanned = false;
92577
+ try {
92578
+ grid = this.gridByAxis(placementLocation.IntersectingAxes[0]);
92579
+ gridScanned = true;
92580
+ } catch (error) {
92581
+ if (!(error instanceof StepBufferNotResidentError)) {
92582
+ throw error;
92583
+ }
92584
+ logger_default.warning("IfcGridPlacement: grid records are not resident on this windowed source - placing at the grid intersection in the current frame, without the grid's own placement.", from.expressID);
92585
+ }
92586
+ if (gridScanned && grid === void 0) {
92587
+ logger_default.warning("IfcGridPlacement: no IfcGrid lists the axes of this placement.", from.expressID);
92588
+ } else if (grid !== void 0) {
92589
+ try {
92590
+ const gridPlacement = grid.ObjectPlacement;
92591
+ if (gridPlacement !== null) {
92592
+ this.extractPlacement(gridPlacement, isRelVoid);
92593
+ }
92594
+ } catch (error) {
92595
+ if (!(error instanceof StepBufferNotResidentError)) {
92596
+ throw error;
92597
+ }
92598
+ logger_default.warning("IfcGridPlacement: the grid's own placement chain is not fully resident on this windowed source - it was applied as far as it reads, so this placement composes onto a partial frame.", from.expressID);
92599
+ }
92600
+ }
92601
+ const placementTransform = this.conwayModel.getAxis2Placement3D({
92602
+ position: location.position,
92603
+ // A grid is planar in its own placement, so this placement's z axis is
92604
+ // the grid's z axis; only the x axis is steered here.
92605
+ zAxisRef: { x: 0, y: 0, z: 1 },
92606
+ xAxisRef,
92607
+ normalizeZ: false,
92608
+ normalizeX: true
92609
+ });
92610
+ const scene = isRelVoid ? this.voidScene : this.scene;
92611
+ scene.addTransform(from.localID, placementTransform.getValues(), placementTransform);
92612
+ }
92325
92613
  /**
92326
92614
  *
92327
92615
  * @param from
@@ -92356,6 +92644,7 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
92356
92644
  }
92357
92645
  }
92358
92646
  } else if (from instanceof IfcGridPlacement) {
92647
+ this.extractGridPlacement(from, isRelVoid);
92359
92648
  }
92360
92649
  }
92361
92650
  /**