@ifc-lite/export 3.1.0 → 4.0.0

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/README.md +3 -1
  2. package/dist/anonymize-export.d.ts.map +1 -1
  3. package/dist/anonymize-export.js +108 -8
  4. package/dist/anonymize-export.js.map +1 -1
  5. package/dist/anonymize-placement.js +4 -4
  6. package/dist/anonymize-scrub.d.ts.map +1 -1
  7. package/dist/anonymize-scrub.js +5 -2
  8. package/dist/anonymize-scrub.js.map +1 -1
  9. package/dist/anonymize-types.d.ts +30 -7
  10. package/dist/anonymize-types.d.ts.map +1 -1
  11. package/dist/declared-property-type.d.ts +15 -0
  12. package/dist/declared-property-type.d.ts.map +1 -1
  13. package/dist/declared-property-type.js +43 -0
  14. package/dist/declared-property-type.js.map +1 -1
  15. package/dist/georef-closure.d.ts +55 -0
  16. package/dist/georef-closure.d.ts.map +1 -0
  17. package/dist/georef-closure.js +95 -0
  18. package/dist/georef-closure.js.map +1 -0
  19. package/dist/glb.d.ts.map +1 -1
  20. package/dist/glb.js +26 -2
  21. package/dist/glb.js.map +1 -1
  22. package/dist/ifc5-classification.d.ts +36 -0
  23. package/dist/ifc5-classification.d.ts.map +1 -0
  24. package/dist/ifc5-classification.js +46 -0
  25. package/dist/ifc5-classification.js.map +1 -0
  26. package/dist/ifc5-export-helpers.d.ts +32 -0
  27. package/dist/ifc5-export-helpers.d.ts.map +1 -0
  28. package/dist/ifc5-export-helpers.js +84 -0
  29. package/dist/ifc5-export-helpers.js.map +1 -0
  30. package/dist/ifc5-exporter.d.ts.map +1 -1
  31. package/dist/ifc5-exporter.js +14 -86
  32. package/dist/ifc5-exporter.js.map +1 -1
  33. package/dist/ifc5-material.d.ts +38 -0
  34. package/dist/ifc5-material.d.ts.map +1 -0
  35. package/dist/ifc5-material.js +32 -0
  36. package/dist/ifc5-material.js.map +1 -0
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +2 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/merged-context.d.ts +100 -0
  42. package/dist/merged-context.d.ts.map +1 -0
  43. package/dist/merged-context.js +211 -0
  44. package/dist/merged-context.js.map +1 -0
  45. package/dist/merged-empty-containers.d.ts +63 -0
  46. package/dist/merged-empty-containers.d.ts.map +1 -0
  47. package/dist/merged-empty-containers.js +354 -0
  48. package/dist/merged-empty-containers.js.map +1 -0
  49. package/dist/merged-exporter.d.ts +28 -67
  50. package/dist/merged-exporter.d.ts.map +1 -1
  51. package/dist/merged-exporter.js +134 -258
  52. package/dist/merged-exporter.js.map +1 -1
  53. package/dist/merged-guid.d.ts +48 -0
  54. package/dist/merged-guid.d.ts.map +1 -0
  55. package/dist/merged-guid.js +128 -0
  56. package/dist/merged-guid.js.map +1 -0
  57. package/dist/merged-rel-aggregates.d.ts +63 -0
  58. package/dist/merged-rel-aggregates.d.ts.map +1 -0
  59. package/dist/merged-rel-aggregates.js +122 -0
  60. package/dist/merged-rel-aggregates.js.map +1 -0
  61. package/dist/merged-remap.d.ts +18 -0
  62. package/dist/merged-remap.d.ts.map +1 -0
  63. package/dist/merged-remap.js +66 -0
  64. package/dist/merged-remap.js.map +1 -0
  65. package/dist/merged-subcontext.d.ts +41 -0
  66. package/dist/merged-subcontext.d.ts.map +1 -0
  67. package/dist/merged-subcontext.js +99 -0
  68. package/dist/merged-subcontext.js.map +1 -0
  69. package/dist/parquet-exporter-ondemand.d.ts +34 -0
  70. package/dist/parquet-exporter-ondemand.d.ts.map +1 -0
  71. package/dist/parquet-exporter-ondemand.js +89 -0
  72. package/dist/parquet-exporter-ondemand.js.map +1 -0
  73. package/dist/parquet-exporter.d.ts +1 -29
  74. package/dist/parquet-exporter.d.ts.map +1 -1
  75. package/dist/parquet-exporter.js +59 -81
  76. package/dist/parquet-exporter.js.map +1 -1
  77. package/dist/parquet-type-strings.d.ts +11 -0
  78. package/dist/parquet-type-strings.d.ts.map +1 -0
  79. package/dist/parquet-type-strings.js +40 -0
  80. package/dist/parquet-type-strings.js.map +1 -0
  81. package/dist/parquet-uint32-columns.d.ts +30 -0
  82. package/dist/parquet-uint32-columns.d.ts.map +1 -0
  83. package/dist/parquet-uint32-columns.js +38 -0
  84. package/dist/parquet-uint32-columns.js.map +1 -0
  85. package/dist/reference-collector.d.ts +0 -31
  86. package/dist/reference-collector.d.ts.map +1 -1
  87. package/dist/reference-collector.js +27 -82
  88. package/dist/reference-collector.js.map +1 -1
  89. package/dist/related-entities.d.ts.map +1 -1
  90. package/dist/related-entities.js +19 -4
  91. package/dist/related-entities.js.map +1 -1
  92. package/dist/schema-converter-attr-remap.d.ts +53 -0
  93. package/dist/schema-converter-attr-remap.d.ts.map +1 -0
  94. package/dist/schema-converter-attr-remap.js +106 -0
  95. package/dist/schema-converter-attr-remap.js.map +1 -0
  96. package/dist/schema-converter.d.ts.map +1 -1
  97. package/dist/schema-converter.js +24 -1
  98. package/dist/schema-converter.js.map +1 -1
  99. package/dist/schema-untranslatable.d.ts +35 -0
  100. package/dist/schema-untranslatable.d.ts.map +1 -0
  101. package/dist/schema-untranslatable.js +60 -0
  102. package/dist/schema-untranslatable.js.map +1 -0
  103. package/dist/step-argument-parser.d.ts.map +1 -1
  104. package/dist/step-argument-parser.js +11 -1
  105. package/dist/step-argument-parser.js.map +1 -1
  106. package/dist/step-attribute-mutations.js +14 -11
  107. package/dist/step-attribute-mutations.js.map +1 -1
  108. package/dist/step-collection.d.ts.map +1 -1
  109. package/dist/step-collection.js +20 -6
  110. package/dist/step-collection.js.map +1 -1
  111. package/dist/step-export-types.d.ts +15 -0
  112. package/dist/step-export-types.d.ts.map +1 -1
  113. package/dist/step-export-types.js +10 -0
  114. package/dist/step-export-types.js.map +1 -1
  115. package/dist/step-exporter.d.ts.map +1 -1
  116. package/dist/step-exporter.js +9 -1
  117. package/dist/step-exporter.js.map +1 -1
  118. package/dist/step-map-unit.d.ts +2 -1
  119. package/dist/step-map-unit.d.ts.map +1 -1
  120. package/dist/step-map-unit.js.map +1 -1
  121. package/dist/step-serialization.d.ts +10 -30
  122. package/dist/step-serialization.d.ts.map +1 -1
  123. package/dist/step-serialization.js +10 -60
  124. package/dist/step-serialization.js.map +1 -1
  125. package/dist/step-source-iteration.d.ts.map +1 -1
  126. package/dist/step-source-iteration.js +21 -0
  127. package/dist/step-source-iteration.js.map +1 -1
  128. package/dist/style-closure.d.ts +91 -0
  129. package/dist/style-closure.d.ts.map +1 -0
  130. package/dist/style-closure.js +164 -0
  131. package/dist/style-closure.js.map +1 -0
  132. package/dist/subset-entity-reader.d.ts +10 -9
  133. package/dist/subset-entity-reader.d.ts.map +1 -1
  134. package/dist/subset-entity-reader.js +21 -11
  135. package/dist/subset-entity-reader.js.map +1 -1
  136. package/dist/subset-roots.d.ts +17 -1
  137. package/dist/subset-roots.d.ts.map +1 -1
  138. package/dist/subset-roots.js +67 -2
  139. package/dist/subset-roots.js.map +1 -1
  140. package/dist/type-owned-psets.d.ts +19 -0
  141. package/dist/type-owned-psets.d.ts.map +1 -1
  142. package/dist/type-owned-psets.js +31 -0
  143. package/dist/type-owned-psets.js.map +1 -1
  144. package/dist/unit-normalize.d.ts.map +1 -1
  145. package/dist/unit-normalize.js +10 -2
  146. package/dist/unit-normalize.js.map +1 -1
  147. package/package.json +7 -7
@@ -0,0 +1,354 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { asSourceBytes, STEP_TRIVIA } from '@ifc-lite/parser';
5
+ import { splitTopLevelArgs } from './step-argument-parser.js';
6
+ /**
7
+ * `#N=TYPE(...)` record, with STEP trivia (whitespace and/or a
8
+ * `/* ... *​/` comment, #3789) tolerated between the type name and `(` —
9
+ * same adjacency fix as `entity-extractor.ts`'s `extractEntity`. Without it
10
+ * a wrapped line's arguments are unreadable here (`topLevelAttrs` returns
11
+ * `null`), which the caller treats as "can't safely rewrite" and blocks the
12
+ * empty-container drop for that entity.
13
+ */
14
+ const RECORD_RE = new RegExp(`^#\\d+\\s*=\\s*\\w+${STEP_TRIVIA}\\(([\\s\\S]*)\\)\\s*;?\\s*$`);
15
+ /**
16
+ * Spatial container types dropped when they end up empty. `IfcProject` is
17
+ * deliberately absent: it is the file's root, never a candidate.
18
+ */
19
+ const CONTAINER_TYPES = new Set([
20
+ 'IFCSITE',
21
+ 'IFCBUILDING',
22
+ 'IFCBUILDINGSTOREY',
23
+ 'IFCSPACE',
24
+ ]);
25
+ /**
26
+ * Relationships that express spatial structure, as
27
+ * `[relatingAttributeIndex, relatedAttributeIndex]` — `IfcRelAggregates` names
28
+ * the whole first, the containment relationships name the parts first.
29
+ */
30
+ const STRUCTURE_RELATIONS = {
31
+ IFCRELAGGREGATES: [4, 5],
32
+ IFCRELCONTAINEDINSPATIALSTRUCTURE: [5, 4],
33
+ IFCRELREFERENCEDINSPATIALSTRUCTURE: [5, 4],
34
+ };
35
+ /** True when `typeUpper` is a droppable spatial container type. */
36
+ function isSpatialContainerType(typeUpper) {
37
+ return CONTAINER_TYPES.has(typeUpper);
38
+ }
39
+ /**
40
+ * A model with nothing to analyse — the placeholder for an input whose source
41
+ * bytes are missing (a cache-restored, metadata-only store), which the emit loop
42
+ * skips too. Keeps the caller's per-model arrays aligned with its inputs.
43
+ */
44
+ export const EMPTY_MODEL_VIEW = {
45
+ entities: new Map(),
46
+ source: asSourceBytes(new Uint8Array()),
47
+ included: null,
48
+ sharedRemap: new Map(),
49
+ offset: 0,
50
+ compatible: false,
51
+ };
52
+ /**
53
+ * Plan which spatial containers the merge leaves holding nothing.
54
+ *
55
+ * The returned local ids are what the caller withholds from the output; every
56
+ * surviving line that named one is narrowed (or withheld with it) by
57
+ * `filterHiddenRefsFromRelationshipLine`, which is what keeps the result free of
58
+ * dangling references.
59
+ */
60
+ export function planEmptyContainerDrops(models) {
61
+ const nodes = new Set();
62
+ const hasContent = new Set();
63
+ const blocked = new Set();
64
+ /** Spatial child node → its container nodes (upward edges for the sweep). */
65
+ const parents = new Map();
66
+ const guidNode = new Map();
67
+ const containersByModel = [];
68
+ for (const view of models) {
69
+ const canon = canonicalContainers(view, guidNode);
70
+ containersByModel.push(canon);
71
+ for (const node of canon.values())
72
+ nodes.add(node);
73
+ recordEdges(view, canon, hasContent, parents);
74
+ recordBlocks(view, canon, blocked);
75
+ }
76
+ // A container is non-empty when it holds something, is blocked, or has a
77
+ // non-empty spatial child — the last propagated upward from the first two.
78
+ // The visited check also makes a self-referential aggregation terminate.
79
+ const nonEmpty = new Set([...hasContent, ...blocked]);
80
+ const stack = [...nonEmpty];
81
+ while (stack.length > 0) {
82
+ const node = stack.pop();
83
+ for (const parent of parents.get(node) ?? []) {
84
+ if (!nonEmpty.has(parent)) {
85
+ nonEmpty.add(parent);
86
+ stack.push(parent);
87
+ }
88
+ }
89
+ }
90
+ const dropped = new Set([...nodes].filter(node => !nonEmpty.has(node)));
91
+ return {
92
+ droppedByModel: containersByModel.map(canon => {
93
+ const ids = new Set();
94
+ for (const [localId, node] of canon) {
95
+ if (dropped.has(node))
96
+ ids.add(localId);
97
+ }
98
+ return ids;
99
+ }),
100
+ droppedCount: dropped.size,
101
+ };
102
+ }
103
+ /**
104
+ * Map each of this model's visible containers to its node in the merged model:
105
+ * the container it was unified onto, the earlier instance that already carries
106
+ * its GlobalId, or its own final express id. Mirrors the emit loop's
107
+ * unification order (iteration order, first occurrence wins).
108
+ */
109
+ function canonicalContainers(view, guidNode) {
110
+ const canon = new Map();
111
+ for (const [localId, ref] of view.entities) {
112
+ if (view.included !== null && !view.included.has(localId))
113
+ continue;
114
+ if (!isSpatialContainerType(ref.type.toUpperCase()))
115
+ continue;
116
+ const unified = view.sharedRemap.get(localId);
117
+ if (unified !== undefined) {
118
+ canon.set(localId, unified);
119
+ continue;
120
+ }
121
+ const finalId = localId + view.offset;
122
+ if (!view.compatible) {
123
+ canon.set(localId, finalId);
124
+ continue;
125
+ }
126
+ const guid = leadingGuid(lineOf(view, localId));
127
+ if (guid === null) {
128
+ canon.set(localId, finalId);
129
+ continue;
130
+ }
131
+ const known = guidNode.get(guid);
132
+ if (known === undefined)
133
+ guidNode.set(guid, finalId);
134
+ canon.set(localId, known ?? finalId);
135
+ }
136
+ return canon;
137
+ }
138
+ /**
139
+ * Record what this model contributes to each container: contained elements and
140
+ * aggregated objects become content; aggregated spatial children become upward
141
+ * edges, so a non-empty storey keeps its building and its site.
142
+ */
143
+ function recordEdges(view, canon, hasContent, parents) {
144
+ if (canon.size === 0)
145
+ return;
146
+ for (const [localId, ref] of view.entities) {
147
+ if (view.included !== null && !view.included.has(localId))
148
+ continue;
149
+ const slots = STRUCTURE_RELATIONS[ref.type.toUpperCase()];
150
+ if (slots === undefined)
151
+ continue;
152
+ const attrs = topLevelAttrs(lineOf(view, localId));
153
+ if (attrs === null)
154
+ continue;
155
+ const [relatingIndex, relatedIndex] = slots;
156
+ const relating = singleRef(attrs[relatingIndex] ?? '');
157
+ // Not a container (an IfcProject aggregating its sites, say) — its children
158
+ // are roots of the spatial tree, with nothing above them to keep.
159
+ if (relating === null)
160
+ continue;
161
+ const parent = canon.get(relating);
162
+ if (parent === undefined)
163
+ continue;
164
+ for (const child of refList(attrs[relatedIndex] ?? '')) {
165
+ if (view.included !== null && !view.included.has(child))
166
+ continue;
167
+ const childNode = canon.get(child);
168
+ if (childNode === undefined) {
169
+ hasContent.add(parent);
170
+ continue;
171
+ }
172
+ const edges = parents.get(childNode);
173
+ if (edges === undefined)
174
+ parents.set(childNode, [parent]);
175
+ else
176
+ edges.push(parent);
177
+ }
178
+ }
179
+ }
180
+ /**
181
+ * Block every container this model names in a way the emit loop could not
182
+ * rewrite. Dropping such a container would leave a dangling `#ref`, so it stays
183
+ * (counting as non-empty, which keeps its ancestors too) instead.
184
+ *
185
+ * Rewritable is: a reference from an objectified relationship (`IfcRel*`) that
186
+ * nothing else references, since `filterHiddenRefsFromRelationshipLine` can
187
+ * strip it from a list or withhold the whole line. Everything else — a
188
+ * non-relationship referrer, a reference nested inside a typed value, or a
189
+ * relationship that is itself referenced (withholding it would dangle in turn) —
190
+ * blocks.
191
+ */
192
+ function recordBlocks(view, canon, blocked) {
193
+ if (canon.size === 0)
194
+ return;
195
+ const referrers = [];
196
+ const referencedRelationships = new Set();
197
+ for (const [localId, ref] of view.entities) {
198
+ if (view.included !== null && !view.included.has(localId))
199
+ continue;
200
+ let namesContainer = false;
201
+ for (const target of argRefs(view.source.slice(ref.byteOffset, ref.byteOffset + ref.byteLength))) {
202
+ if (canon.has(target))
203
+ namesContainer = true;
204
+ const targetType = view.entities.get(target)?.type.toUpperCase();
205
+ if (targetType?.startsWith('IFCREL'))
206
+ referencedRelationships.add(target);
207
+ }
208
+ if (namesContainer)
209
+ referrers.push(localId);
210
+ }
211
+ for (const localId of referrers) {
212
+ const typeUpper = view.entities.get(localId).type.toUpperCase();
213
+ const rewritable = typeUpper.startsWith('IFCREL') && !referencedRelationships.has(localId);
214
+ const line = lineOf(view, localId);
215
+ const slots = classifyRefs(line);
216
+ if (slots === null) {
217
+ // The argument list could not be parsed, so no rewrite can narrow this
218
+ // line: every container it names has to stay.
219
+ for (const target of argRefs(line)) {
220
+ const node = canon.get(target);
221
+ if (node !== undefined)
222
+ blocked.add(node);
223
+ }
224
+ continue;
225
+ }
226
+ for (const [target, nested] of slots) {
227
+ const node = canon.get(target);
228
+ if (node === undefined)
229
+ continue;
230
+ if (nested || !rewritable)
231
+ blocked.add(node);
232
+ }
233
+ }
234
+ }
235
+ /** The entity's STEP line text. */
236
+ function lineOf(view, localId) {
237
+ const ref = view.entities.get(localId);
238
+ if (ref === undefined)
239
+ return '';
240
+ return view.source.decodeUtf8(ref.byteOffset, ref.byteOffset + ref.byteLength);
241
+ }
242
+ /** Top-level arguments of a `#id=TYPE(…);` line, or `null` when unparseable. */
243
+ function topLevelAttrs(line) {
244
+ const match = line.match(RECORD_RE);
245
+ if (!match)
246
+ return null;
247
+ return splitTopLevelArgs(match[1]).map(arg => arg.trim());
248
+ }
249
+ /** Parse an argument that is exactly one reference (`"#7"` → `7`). */
250
+ function singleRef(arg) {
251
+ const match = arg.trim().match(/^#(\d+)$/);
252
+ return match ? Number(match[1]) : null;
253
+ }
254
+ /** Parse a `(#a,#b,…)` list argument into ids. */
255
+ function refList(arg) {
256
+ const trimmed = arg.trim();
257
+ if (!trimmed.startsWith('(') || !trimmed.endsWith(')'))
258
+ return [];
259
+ const inner = trimmed.slice(1, -1).trim();
260
+ if (inner === '')
261
+ return [];
262
+ const ids = [];
263
+ for (const item of splitTopLevelArgs(inner)) {
264
+ const id = singleRef(item);
265
+ if (id !== null)
266
+ ids.push(id);
267
+ }
268
+ return ids;
269
+ }
270
+ /**
271
+ * Every reference in a line's argument list, paired with whether it sits
272
+ * somewhere neither `filterHiddenRefsFromRelationshipLine` can strip (a direct
273
+ * list element) nor withhold the line for (a whole single-valued attribute) —
274
+ * i.e. nested inside a list of lists or a typed value. `null` when the line's
275
+ * argument list cannot be parsed at all: a line no rewrite can narrow, which the
276
+ * analysis must treat as a blocker rather than as "names nothing".
277
+ */
278
+ function classifyRefs(line) {
279
+ const attrs = topLevelAttrs(line);
280
+ if (attrs === null)
281
+ return null;
282
+ const out = [];
283
+ for (const attr of attrs) {
284
+ const direct = singleRef(attr);
285
+ if (direct !== null) {
286
+ out.push([direct, false]);
287
+ continue;
288
+ }
289
+ if (attr.startsWith('(') && attr.endsWith(')')) {
290
+ const inner = attr.slice(1, -1).trim();
291
+ if (inner === '')
292
+ continue;
293
+ for (const item of splitTopLevelArgs(inner)) {
294
+ const id = singleRef(item);
295
+ if (id !== null)
296
+ out.push([id, false]);
297
+ else
298
+ for (const nested of argRefs(item))
299
+ out.push([nested, true]);
300
+ }
301
+ continue;
302
+ }
303
+ for (const nested of argRefs(attr))
304
+ out.push([nested, true]);
305
+ }
306
+ return out;
307
+ }
308
+ /**
309
+ * Every `#N` reference in a chunk of STEP text, skipping quoted strings (where a
310
+ * `#` is literal) and any leading `#id=` (the line's own id). Reads bytes rather
311
+ * than decoded text so the reverse-reference scan never decodes a whole model.
312
+ */
313
+ function argRefs(text) {
314
+ const bytes = typeof text === 'string' ? new TextEncoder().encode(text) : text;
315
+ const eq = bytes.indexOf(0x3d /* = */);
316
+ const from = eq === -1 ? 0 : eq + 1;
317
+ const out = [];
318
+ let inString = false;
319
+ for (let i = from; i < bytes.length; i++) {
320
+ const byte = bytes[i];
321
+ if (byte === 0x27 /* ' */) {
322
+ inString = !inString;
323
+ continue;
324
+ }
325
+ if (inString || byte !== 0x23 /* # */)
326
+ continue;
327
+ let j = i + 1;
328
+ let value = 0;
329
+ while (j < bytes.length && bytes[j] >= 0x30 && bytes[j] <= 0x39) {
330
+ value = value * 10 + (bytes[j] - 0x30);
331
+ j++;
332
+ }
333
+ if (j > i + 1) {
334
+ out.push(value);
335
+ i = j - 1;
336
+ }
337
+ }
338
+ return out;
339
+ }
340
+ /** The GlobalId (first quoted attribute) of a rooted entity's line. */
341
+ function leadingGuid(line) {
342
+ const open = line.indexOf('(');
343
+ if (open === -1)
344
+ return null;
345
+ const first = line.indexOf("'", open + 1);
346
+ if (first === -1)
347
+ return null;
348
+ const second = line.indexOf("'", first + 1);
349
+ if (second === -1)
350
+ return null;
351
+ const raw = line.slice(first + 1, second);
352
+ return /^[0-9A-Za-z_$]{22}$/.test(raw) ? raw : null;
353
+ }
354
+ //# sourceMappingURL=merged-empty-containers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merged-empty-containers.js","sourceRoot":"","sources":["../src/merged-empty-containers.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAyB/D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,sBAAsB,WAAW,8BAA8B,CAAC,CAAC;AAE9F;;;GAGG;AAC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AAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC"}
@@ -7,25 +7,6 @@
7
7
  */
8
8
  import type { IfcDataStore } from '@ifc-lite/parser';
9
9
  import type { MutablePropertyView } from '@ifc-lite/mutations';
10
- /**
11
- * Whether `type` is an IfcRoot subtype — a schema-derived replacement for a
12
- * hand-maintained denylist of "non-rooted types whose first attribute happens
13
- * to be a string". A denylist has to be told about every such type by hand and
14
- * silently under-covers as the schema grows — `IfcMaterialProfileWithOffsets`
15
- * and several other resource types were missing and got their leading Name
16
- * treated as a GlobalId, corrupting ordinary model data on a collision.
17
- *
18
- * `getInheritanceChainAcrossSchemas` walks the bundled IFC2X3/IFC4/IFC4X3
19
- * schema union to the entity's root ancestor; a rooted entity's chain always
20
- * ends in `IfcRoot`. This mirrors the Rust side's `IfcType::is_subtype_of`
21
- * schema check, so the two implementations of "is this rooted" agree instead
22
- * of drifting apart as separate hand-maintained lists.
23
- *
24
- * A type unknown to every bundled schema (typo, vendor extension) yields an
25
- * empty chain and is treated as non-rooted — the same safe-miss direction the
26
- * old denylist documented: it just skips one GlobalId reconciliation.
27
- */
28
- export declare function isRootedType(type: string): boolean;
29
10
  /**
30
11
  * A model to be included in the merge, with its data store and metadata.
31
12
  */
@@ -137,6 +118,16 @@ export interface MergeExportOptions {
137
118
  * - `'by-name-then-elevation'`: try Name first, fall back to Elevation.
138
119
  */
139
120
  mergeStoreys?: 'by-name' | 'by-elevation' | 'by-name-then-elevation';
121
+ /**
122
+ * Drop spatial containers (`IfcSite` / `IfcBuilding` / `IfcBuildingStorey` /
123
+ * `IfcSpace`) the merge leaves holding nothing — the "Merge Projects" recipe
124
+ * step the matching options above do not cover (#3643). Emptiness is judged on
125
+ * the MERGED model, after visibility filtering and spatial unification, so a
126
+ * container only a later model fills is kept; see
127
+ * `merged-empty-containers.ts` for the exact rule. Off by default: output is
128
+ * byte-identical to a merge that never asked for it.
129
+ */
130
+ dropEmptyContainers?: boolean;
140
131
  /** Apply visibility filtering to each model before merging */
141
132
  visibleOnly?: boolean;
142
133
  /** Hidden entity IDs per model (local expressIds) */
@@ -186,6 +177,12 @@ export interface MergeExportResult {
186
177
  * modes (or when every model already shared the first model's unit).
187
178
  */
188
179
  normalizedModelCount: number;
180
+ /**
181
+ * Spatial containers dropped for holding nothing, counted in the merged
182
+ * model (a container unified across three inputs counts once). Always 0
183
+ * unless {@link MergeExportOptions.dropEmptyContainers} is set.
184
+ */
185
+ droppedContainerCount: number;
189
186
  /**
190
187
  * Human-readable advisories about the merge (empty on a clean single-unit
191
188
  * merge). Notably flags when federation produced more than one IfcProject,
@@ -291,6 +288,16 @@ export declare class MergedExporter {
291
288
  * Assemble the result stats, including any federation conformance warnings.
292
289
  */
293
290
  private buildStats;
291
+ /**
292
+ * Plan the empty spatial containers of the whole merge (#3643), or `null` when
293
+ * the caller did not ask for the drop. Reproduces the same spatial unification
294
+ * {@link planModel} will, so emptiness is judged on the containers the merge
295
+ * actually keeps rather than on each file in isolation.
296
+ */
297
+ private planContainerDrops;
298
+ /** Fold a model's dropped containers into its plan: the container lines are
299
+ * skipped outright, and {@link renderEntity} narrows every line naming one. */
300
+ private applyContainerDrops;
294
301
  /**
295
302
  * Record advisories for a model being normalized. The rescaler derives its
296
303
  * length-attribute map from the IFC4 schema registry, so it may not cover
@@ -331,8 +338,8 @@ export declare class MergedExporter {
331
338
  * Resolve a model's declared AREAUNIT / VOLUMEUNIT scale (SI m² / m³ per unit)
332
339
  * by walking IfcProject → IfcUnitAssignment. Falls back to the length-derived
333
340
  * unit (`lengthScale ** power`) when the model declares no explicit area/volume
334
- * unit — the IFC default. A prefixed SI area/volume unit (rare) applies the
335
- * prefix once (buildingSMART / IfcOpenShell convention).
341
+ * unit — the IFC default. A prefixed SI area/volume unit (rare) raises the
342
+ * prefix to `power` (area = prefix², volume = prefix³), matching `rust/core`.
336
343
  */
337
344
  private resolveDerivedUnitScale;
338
345
  /** Uppercase an enum token, stripping the STEP `.ENUM.` dots. `''` for nullish. */
@@ -387,41 +394,6 @@ export declare class MergedExporter {
387
394
  * hidden (below).
388
395
  */
389
396
  private renderEntity;
390
- /**
391
- * Read the GlobalId (first quoted attribute) from an already-rendered STEP
392
- * line. Used to register the id that was actually emitted, after any id
393
- * remap, GlobalId re-stamp, or schema conversion. Returns null if the first
394
- * quoted token is not a 22-char GlobalId.
395
- */
396
- private readLeadingGuid;
397
- /**
398
- * Mint a fresh, deterministic, collision-free GlobalId for an entity whose id
399
- * collides. Seeded from the original GlobalId and the model's stable id so the
400
- * output is reproducible and does not churn when an unrelated earlier model
401
- * changes size; checked against both already-emitted ids and the ids minted
402
- * so far for this model.
403
- */
404
- private mintUniqueGuid;
405
- /**
406
- * Read an entity's GlobalId (first attribute) by decoding only its head.
407
- * Returns the 22-char id for a rooted entity, or `null` for any entity whose
408
- * first attribute is not a GlobalId (geometry, lists, property atoms, …).
409
- */
410
- private extractGlobalIdFast;
411
- /**
412
- * Replace an entity's GlobalId (first quoted attribute) with `newGuid`.
413
- * `newGuid` is a 22-char IFC id (no quote in its charset), so this is safe.
414
- */
415
- private replaceGlobalId;
416
- /**
417
- * Remap all #ID references in a STEP entity line.
418
- * Applies offset to all IDs, then overrides with specific remappings.
419
- *
420
- * Only `#<digits>` tokens in code positions are rewritten; tokens inside
421
- * single-quoted STEP strings (e.g. a 'Room #205' Name or a 'http://x#42'
422
- * URL) are left untouched so string attribute values are not corrupted.
423
- */
424
- private remapEntityText;
425
397
  /**
426
398
  * Find entity IDs of shared infrastructure types in a data store.
427
399
  * Returns a map of uppercase type name → array of expressIds.
@@ -465,17 +437,6 @@ export declare class MergedExporter {
465
437
  * rather than kept as its own root.
466
438
  */
467
439
  private matchRootContainer;
468
- /**
469
- * Skip IfcRelAggregates that become fully redundant after spatial unification.
470
- *
471
- * When Model2's `IfcRelAggregates(Project, (Site))` gets remapped to
472
- * `IfcRelAggregates(FirstProject, (FirstSite))`, it duplicates Model1's
473
- * existing relationship, causing viewers to show Site multiple times.
474
- *
475
- * An IfcRelAggregates is redundant if both its RelatingObject (attr 4)
476
- * and ALL its RelatedObjects (attr 5) were remapped via sharedRemap.
477
- */
478
- private skipRedundantRelAggregates;
479
440
  /**
480
441
  * Extract the Name attribute (index 2) from a STEP entity.
481
442
  */
@@ -1 +1 @@
1
- {"version":3,"file":"merged-exporter.d.ts","sourceRoot":"","sources":["../src/merged-exporter.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,kBAAkB,CAAC;AASrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2C/D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAqHD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,SAAS,EAAE,YAAY,CAAC;IACxB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAoCD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mFAAmF;IACnF,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,YAAY,CAAC;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