@ifc-lite/export 4.13.3 → 4.14.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 (217) hide show
  1. package/dist/affected-set.d.ts.map +1 -1
  2. package/dist/affected-set.js +9 -2
  3. package/dist/affected-set.js.map +1 -1
  4. package/dist/anonymize-export.js +2 -2
  5. package/dist/anonymize-export.js.map +1 -1
  6. package/dist/anonymize-scrub.js +3 -3
  7. package/dist/anonymize-scrub.js.map +1 -1
  8. package/dist/appearance-dependencies.js +1 -1
  9. package/dist/appearance-dependencies.js.map +1 -1
  10. package/dist/attribute-real-slots.js +1 -1
  11. package/dist/attribute-real-slots.js.map +1 -1
  12. package/dist/attribute-slot-types.d.ts.map +1 -1
  13. package/dist/attribute-slot-types.js +19 -13
  14. package/dist/attribute-slot-types.js.map +1 -1
  15. package/dist/authored-resource-cleanup.js +1 -1
  16. package/dist/authored-resource-cleanup.js.map +1 -1
  17. package/dist/declared-property-type.d.ts.map +1 -1
  18. package/dist/declared-property-type.js +5 -4
  19. package/dist/declared-property-type.js.map +1 -1
  20. package/dist/edit-ownership.d.ts +8 -0
  21. package/dist/edit-ownership.d.ts.map +1 -1
  22. package/dist/edit-ownership.js +58 -44
  23. package/dist/edit-ownership.js.map +1 -1
  24. package/dist/effective-index-created-rows.d.ts +19 -0
  25. package/dist/effective-index-created-rows.d.ts.map +1 -0
  26. package/dist/effective-index-created-rows.js +37 -0
  27. package/dist/effective-index-created-rows.js.map +1 -0
  28. package/dist/effective-index.d.ts.map +1 -1
  29. package/dist/effective-index.js +3 -3
  30. package/dist/effective-index.js.map +1 -1
  31. package/dist/effective-source-record.js +1 -1
  32. package/dist/effective-source-record.js.map +1 -1
  33. package/dist/entity-subgraph.d.ts +6 -2
  34. package/dist/entity-subgraph.d.ts.map +1 -1
  35. package/dist/entity-subgraph.js +70 -5
  36. package/dist/entity-subgraph.js.map +1 -1
  37. package/dist/entity-type-sets.d.ts +2 -19
  38. package/dist/entity-type-sets.d.ts.map +1 -1
  39. package/dist/entity-type-sets.js +14 -4
  40. package/dist/entity-type-sets.js.map +1 -1
  41. package/dist/ifc4-registry.d.ts +14 -0
  42. package/dist/ifc4-registry.d.ts.map +1 -0
  43. package/dist/ifc4-registry.js +22 -0
  44. package/dist/ifc4-registry.js.map +1 -0
  45. package/dist/ifc5-effective-rows.js +1 -1
  46. package/dist/ifc5-effective-rows.js.map +1 -1
  47. package/dist/ifc5-tree-scope.js +2 -2
  48. package/dist/ifc5-tree-scope.js.map +1 -1
  49. package/dist/index.d.ts +4 -2
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +4 -2
  52. package/dist/index.js.map +1 -1
  53. package/dist/lod0-generator.d.ts.map +1 -1
  54. package/dist/lod0-generator.js +14 -8
  55. package/dist/lod0-generator.js.map +1 -1
  56. package/dist/merged-exporter.d.ts.map +1 -1
  57. package/dist/merged-exporter.js +6 -3
  58. package/dist/merged-exporter.js.map +1 -1
  59. package/dist/nonrel-positional-ref-narrowing.js +6 -6
  60. package/dist/nonrel-positional-ref-narrowing.js.map +1 -1
  61. package/dist/nonrel-ref-list-types.d.ts +4 -4
  62. package/dist/nonrel-ref-list-types.d.ts.map +1 -1
  63. package/dist/nonrel-ref-list-types.js +19 -7
  64. package/dist/nonrel-ref-list-types.js.map +1 -1
  65. package/dist/parquet-created-entity-rows.js +1 -1
  66. package/dist/parquet-created-entity-rows.js.map +1 -1
  67. package/dist/parquet-relationship-rows.js +1 -1
  68. package/dist/parquet-relationship-rows.js.map +1 -1
  69. package/dist/reference-collector.d.ts.map +1 -1
  70. package/dist/reference-collector.js +2 -2
  71. package/dist/reference-collector.js.map +1 -1
  72. package/dist/registry-entity-names.d.ts +6 -2
  73. package/dist/registry-entity-names.d.ts.map +1 -1
  74. package/dist/registry-entity-names.js +10 -2
  75. package/dist/registry-entity-names.js.map +1 -1
  76. package/dist/relationship-slot-bounds.js +4 -4
  77. package/dist/relationship-slot-bounds.js.map +1 -1
  78. package/dist/remesh-context-roots.d.ts +13 -6
  79. package/dist/remesh-context-roots.d.ts.map +1 -1
  80. package/dist/remesh-context-roots.js +51 -22
  81. package/dist/remesh-context-roots.js.map +1 -1
  82. package/dist/renumber-step-ids.d.ts +43 -0
  83. package/dist/renumber-step-ids.d.ts.map +1 -0
  84. package/dist/renumber-step-ids.js +237 -0
  85. package/dist/renumber-step-ids.js.map +1 -0
  86. package/dist/retype.d.ts.map +1 -1
  87. package/dist/retype.js +23 -12
  88. package/dist/retype.js.map +1 -1
  89. package/dist/schema-conversion-description.d.ts +6 -0
  90. package/dist/schema-conversion-description.d.ts.map +1 -0
  91. package/dist/schema-conversion-description.js +25 -0
  92. package/dist/schema-conversion-description.js.map +1 -0
  93. package/dist/schema-conversion-loss-report.d.ts +2 -24
  94. package/dist/schema-conversion-loss-report.d.ts.map +1 -1
  95. package/dist/schema-conversion-loss-report.js +34 -0
  96. package/dist/schema-conversion-loss-report.js.map +1 -1
  97. package/dist/schema-converter-attr-remap.d.ts +8 -0
  98. package/dist/schema-converter-attr-remap.d.ts.map +1 -1
  99. package/dist/schema-converter-attr-remap.js +10 -0
  100. package/dist/schema-converter-attr-remap.js.map +1 -1
  101. package/dist/schema-converter-enums.d.ts +3 -0
  102. package/dist/schema-converter-enums.d.ts.map +1 -1
  103. package/dist/schema-converter-enums.js +4 -1
  104. package/dist/schema-converter-enums.js.map +1 -1
  105. package/dist/schema-converter-structural-axes.d.ts +11 -0
  106. package/dist/schema-converter-structural-axes.d.ts.map +1 -0
  107. package/dist/schema-converter-structural-axes.js +59 -0
  108. package/dist/schema-converter-structural-axes.js.map +1 -0
  109. package/dist/schema-converter-structural-diagnostics.d.ts +24 -0
  110. package/dist/schema-converter-structural-diagnostics.d.ts.map +1 -0
  111. package/dist/schema-converter-structural-diagnostics.js +84 -0
  112. package/dist/schema-converter-structural-diagnostics.js.map +1 -0
  113. package/dist/schema-converter-structural-links.d.ts +21 -0
  114. package/dist/schema-converter-structural-links.d.ts.map +1 -0
  115. package/dist/schema-converter-structural-links.js +63 -0
  116. package/dist/schema-converter-structural-links.js.map +1 -0
  117. package/dist/schema-converter-structural-varying.d.ts +43 -0
  118. package/dist/schema-converter-structural-varying.d.ts.map +1 -0
  119. package/dist/schema-converter-structural-varying.js +154 -0
  120. package/dist/schema-converter-structural-varying.js.map +1 -0
  121. package/dist/schema-converter-structural.d.ts +8 -0
  122. package/dist/schema-converter-structural.d.ts.map +1 -0
  123. package/dist/schema-converter-structural.js +78 -0
  124. package/dist/schema-converter-structural.js.map +1 -0
  125. package/dist/schema-converter.d.ts +0 -4
  126. package/dist/schema-converter.d.ts.map +1 -1
  127. package/dist/schema-converter.js +19 -32
  128. package/dist/schema-converter.js.map +1 -1
  129. package/dist/schema-grid-frames.d.ts +19 -0
  130. package/dist/schema-grid-frames.d.ts.map +1 -0
  131. package/dist/schema-grid-frames.js +84 -0
  132. package/dist/schema-grid-frames.js.map +1 -0
  133. package/dist/schema-ifc2x3-placements.d.ts +12 -0
  134. package/dist/schema-ifc2x3-placements.d.ts.map +1 -0
  135. package/dist/schema-ifc2x3-placements.js +297 -0
  136. package/dist/schema-ifc2x3-placements.js.map +1 -0
  137. package/dist/schema-ifc2x3-records.d.ts +58 -0
  138. package/dist/schema-ifc2x3-records.d.ts.map +1 -0
  139. package/dist/schema-ifc2x3-records.js +179 -0
  140. package/dist/schema-ifc2x3-records.js.map +1 -0
  141. package/dist/schema-style-flatten.d.ts +7 -2
  142. package/dist/schema-style-flatten.d.ts.map +1 -1
  143. package/dist/schema-style-flatten.js +34 -2
  144. package/dist/schema-style-flatten.js.map +1 -1
  145. package/dist/section-export.d.ts.map +1 -1
  146. package/dist/section-export.js +3 -2
  147. package/dist/section-export.js.map +1 -1
  148. package/dist/select-qualification.d.ts.map +1 -1
  149. package/dist/select-qualification.js +6 -5
  150. package/dist/select-qualification.js.map +1 -1
  151. package/dist/step-collection.d.ts.map +1 -1
  152. package/dist/step-collection.js +3 -0
  153. package/dist/step-collection.js.map +1 -1
  154. package/dist/step-derived-quantities.d.ts +23 -0
  155. package/dist/step-derived-quantities.d.ts.map +1 -0
  156. package/dist/step-derived-quantities.js +50 -0
  157. package/dist/step-derived-quantities.js.map +1 -0
  158. package/dist/step-exporter.js +2 -1
  159. package/dist/step-exporter.js.map +1 -1
  160. package/dist/step-header.d.ts.map +1 -1
  161. package/dist/step-header.js +3 -1
  162. package/dist/step-header.js.map +1 -1
  163. package/dist/step-internal-pset-ids.d.ts +7 -0
  164. package/dist/step-internal-pset-ids.d.ts.map +1 -0
  165. package/dist/step-internal-pset-ids.js +25 -0
  166. package/dist/step-internal-pset-ids.js.map +1 -0
  167. package/dist/step-map-unit-normalization.d.ts.map +1 -1
  168. package/dist/step-map-unit-normalization.js +10 -3
  169. package/dist/step-map-unit-normalization.js.map +1 -1
  170. package/dist/step-native-set-record.d.ts +2 -0
  171. package/dist/step-native-set-record.d.ts.map +1 -1
  172. package/dist/step-native-set-record.js +10 -0
  173. package/dist/step-native-set-record.js.map +1 -1
  174. package/dist/step-overlay-entities.js +4 -4
  175. package/dist/step-overlay-entities.js.map +1 -1
  176. package/dist/step-overlay-property-base.d.ts +13 -0
  177. package/dist/step-overlay-property-base.d.ts.map +1 -0
  178. package/dist/step-overlay-property-base.js +30 -0
  179. package/dist/step-overlay-property-base.js.map +1 -0
  180. package/dist/step-pass-builder.d.ts.map +1 -1
  181. package/dist/step-pass-builder.js +7 -0
  182. package/dist/step-pass-builder.js.map +1 -1
  183. package/dist/step-property-set-collection.d.ts.map +1 -1
  184. package/dist/step-property-set-collection.js +7 -2
  185. package/dist/step-property-set-collection.js.map +1 -1
  186. package/dist/step-property-set-generators.d.ts.map +1 -1
  187. package/dist/step-property-set-generators.js +8 -4
  188. package/dist/step-property-set-generators.js.map +1 -1
  189. package/dist/step-property-set-index.js +1 -1
  190. package/dist/step-property-set-index.js.map +1 -1
  191. package/dist/step-property-set-readers.d.ts.map +1 -1
  192. package/dist/step-property-set-readers.js +6 -5
  193. package/dist/step-property-set-readers.js.map +1 -1
  194. package/dist/step-pset-copy-on-write.d.ts.map +1 -1
  195. package/dist/step-pset-copy-on-write.js +9 -7
  196. package/dist/step-pset-copy-on-write.js.map +1 -1
  197. package/dist/step-serialization.d.ts +1 -1
  198. package/dist/step-serialization.d.ts.map +1 -1
  199. package/dist/step-serialization.js +14 -2
  200. package/dist/step-serialization.js.map +1 -1
  201. package/dist/step-shared-atom-retention.js +1 -1
  202. package/dist/step-shared-atom-retention.js.map +1 -1
  203. package/dist/step-slot-grammar.d.ts +2 -0
  204. package/dist/step-slot-grammar.d.ts.map +1 -1
  205. package/dist/step-slot-grammar.js +5 -0
  206. package/dist/step-slot-grammar.js.map +1 -1
  207. package/dist/step-source-iteration.d.ts.map +1 -1
  208. package/dist/step-source-iteration.js +6 -2
  209. package/dist/step-source-iteration.js.map +1 -1
  210. package/dist/subset-entity-reader.d.ts.map +1 -1
  211. package/dist/subset-entity-reader.js +15 -8
  212. package/dist/subset-entity-reader.js.map +1 -1
  213. package/dist/subset-roots.d.ts +4 -14
  214. package/dist/subset-roots.d.ts.map +1 -1
  215. package/dist/subset-roots.js +14 -4
  216. package/dist/subset-roots.js.map +1 -1
  217. package/package.json +8 -8
@@ -0,0 +1,297 @@
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
+ /**
5
+ * The grid and shared placements of an IFC2X3 output each place exactly one
6
+ * product (#9209).
7
+ *
8
+ * IFC2X3 declares `IfcObjectPlacement.PlacesObject` as `SET [1:1]`; IFC4
9
+ * relaxed it to `SET [0:?]`, and the models this package writes use that:
10
+ *
11
+ * - a column on a grid is `IfcColumn` -> `IfcLocalPlacement` ->
12
+ * `IfcGridPlacement`, so the grid placement places nothing;
13
+ * - a blank model's site and building share one `IfcLocalPlacement`.
14
+ *
15
+ * So an IFC2X3 output is adapted after it is written, the same way for a
16
+ * converted file and an IFC2X3 source:
17
+ *
18
+ * - A grid placement that places nothing, with one local child that only
19
+ * lifts it (no heading, no offset in plan), is folded: the child keeps its
20
+ * id and becomes the grid placement, its height carried as the
21
+ * intersection's third offset. Its product keeps naming it.
22
+ * - Otherwise each local child is written as a plain `IfcLocalPlacement` in
23
+ * the owning grid's frame, at the position the grid placement resolves
24
+ * to, and the grid placement is not written. A grid placement whose
25
+ * intersection does not read (curved axes, say), or one over an axis
26
+ * that bends, where readers may disagree on the point, is left as it was.
27
+ * - A placement shared by several products gives each product after the
28
+ * first its own copy.
29
+ *
30
+ * New records take the ids after the highest one and are written after the
31
+ * last record, in id order, the order a re-read file is written back in.
32
+ *
33
+ * A local placement that places nothing and only parents another one is a
34
+ * source file's shape, under a grid or not; ifc-lite never writes it, and this
35
+ * pass leaves it as it was. Under a grid placement it is still folded or freed
36
+ * as above, which writes one placement that places nothing instead of two.
37
+ *
38
+ * Positions follow the geometry reader (`rust/geometry/src/placement/grid.rs`):
39
+ * the intersection of the two axes' chords, each shifted along its left
40
+ * normal by its offset, lifted by the third offset; `PlacementRefDirection`
41
+ * turns local +X towards a second intersection. IFC4 and IFC4X3 outputs never
42
+ * reach this pass. Twin of `rust/export/src/schema_ifc2x3_placements.rs`,
43
+ * pinned for both by `rust/export/tests/fixtures/schema_grid_placement_vectors.json`.
44
+ */
45
+ import { formatStepReal } from '@ifc-lite/data';
46
+ import { readStepSlots } from './step-argument-parser.js';
47
+ import { EPS, GRID_PLACEMENT, INTERSECTION, LOCAL, OBJECT_PLACEMENT, Records, list, num, refId, triple, } from './schema-ifc2x3-records.js';
48
+ function append(map, key, value) {
49
+ const values = map.get(key);
50
+ if (values)
51
+ values.push(value);
52
+ else
53
+ map.set(key, [value]);
54
+ }
55
+ /** The `#n` references in `text` from `from` on, outside string literals. */
56
+ function references(text, from) {
57
+ const ids = [];
58
+ for (let i = from; i < text.length; i++) {
59
+ if (text[i] === "'") {
60
+ for (i++; i < text.length; i++) {
61
+ if (text[i] === "'" && text[i + 1] === "'")
62
+ i++;
63
+ else if (text[i] === "'")
64
+ break;
65
+ }
66
+ }
67
+ else if (text[i] === '#') {
68
+ let j = i + 1;
69
+ while (j < text.length && text[j] >= '0' && text[j] <= '9')
70
+ j++;
71
+ if (j > i + 1)
72
+ ids.push(Number(text.slice(i + 1, j)));
73
+ i = j - 1;
74
+ }
75
+ }
76
+ return ids;
77
+ }
78
+ /** Who names each placement and intersection. */
79
+ function users(records) {
80
+ const placements = new Set();
81
+ const crossings = new Map();
82
+ for (const rec of records.list) {
83
+ if (rec?.type === LOCAL || rec?.type === GRID_PLACEMENT)
84
+ placements.add(rec.id);
85
+ else if (rec?.type === INTERSECTION)
86
+ crossings.set(rec.id, 0);
87
+ }
88
+ const found = { children: new Map(), products: new Map(), others: new Set(), crossings };
89
+ if (placements.size === 0)
90
+ return found;
91
+ for (const rec of records.list) {
92
+ if (!rec)
93
+ continue;
94
+ const hits = [];
95
+ for (const id of references(rec.text, rec.open)) {
96
+ if (placements.has(id))
97
+ hits.push(id);
98
+ else if (crossings.has(id))
99
+ crossings.set(id, crossings.get(id) + 1);
100
+ }
101
+ if (hits.length === 0)
102
+ continue;
103
+ const s = records.slots(rec);
104
+ for (const id of new Set(hits)) {
105
+ const once = hits.filter((h) => h === id).length === 1;
106
+ if (once && s && rec.type === LOCAL && refId(s[0]) === id)
107
+ append(found.children, id, rec.id);
108
+ else if (once && s && rec.type !== LOCAL && rec.type !== GRID_PLACEMENT && refId(s[OBJECT_PLACEMENT]) === id)
109
+ append(found.products, id, rec.id);
110
+ else
111
+ found.others.add(id);
112
+ }
113
+ }
114
+ return found;
115
+ }
116
+ /**
117
+ * The IFC2X3 output `lines` with every object placement placing one product;
118
+ * null when nothing changes. See the module comment.
119
+ */
120
+ export function placeEachObjectOnce(lines) {
121
+ const records = new Records(lines);
122
+ // A record adds at most four (a freed child's point, two directions and
123
+ // axes); a file whose ids leave no room for them is left as it was.
124
+ if (records.maxId + 4 * records.list.length >= 0xffffffff)
125
+ return null;
126
+ const { children, products, others, crossings } = users(records);
127
+ const rewrites = new Map();
128
+ /** New records, in id order: written after the last record, where a re-read writes them back. */
129
+ const added = [];
130
+ const drops = new Set();
131
+ let next = records.maxId + 1;
132
+ /** A grid placement not written, and the intersections only it named. */
133
+ const drop = (id, g) => {
134
+ drops.add(id);
135
+ const named = g.map(refId);
136
+ for (const i of new Set(named)) {
137
+ if (i !== null && crossings.get(i) === named.filter((n) => n === i).length)
138
+ drops.add(i);
139
+ }
140
+ };
141
+ for (const rec of records.list) {
142
+ if (rec?.type !== GRID_PLACEMENT || others.has(rec.id) || products.has(rec.id))
143
+ continue;
144
+ const g = records.slots(rec);
145
+ const kids = children.get(rec.id) ?? [];
146
+ if (!g || g.length !== 2)
147
+ continue;
148
+ if (kids.length === 0) {
149
+ drop(rec.id, g);
150
+ continue;
151
+ }
152
+ const lifts = kids.length === 1 ? lift(records, kids[0], g) : null;
153
+ if (lifts) {
154
+ const at = refId(g[0]);
155
+ let location = g[0].trim();
156
+ if (lifts.intersection && crossings.get(at) === 1)
157
+ rewrites.set(at, `#${at}=${INTERSECTION}(${lifts.intersection});`);
158
+ else if (lifts.intersection) {
159
+ added.push(`#${next}=${INTERSECTION}(${lifts.intersection});`);
160
+ location = `#${next++}`;
161
+ }
162
+ rewrites.set(kids[0], `#${kids[0]}=${GRID_PLACEMENT}(${location},${g[1].trim()});`);
163
+ drops.add(rec.id);
164
+ continue;
165
+ }
166
+ const frame = records.gridFrame(g);
167
+ const freed = frame && kids.map((kid) => free(records, kid, frame));
168
+ if (!freed || freed.includes(null))
169
+ continue;
170
+ const relTo = records.gridPlacementOf(refId(g[0]));
171
+ freed.forEach((written, i) => {
172
+ const ids = written.map(() => next++);
173
+ written.forEach((line, k) => added.push(`#${ids[k]}=${line.replace(/#\{(\d)\}/g, (_, j) => `#${ids[Number(j)]}`)}`));
174
+ rewrites.set(kids[i], `#${kids[i]}=${LOCAL}(${relTo},#${ids[ids.length - 1]});`);
175
+ });
176
+ drop(rec.id, g);
177
+ }
178
+ for (const rec of records.list) {
179
+ const placed = rec && products.get(rec.id);
180
+ if (!rec || !placed || placed.length < 2 || drops.has(rec.id))
181
+ continue;
182
+ const own = rewrites.get(rec.id) ?? rec.text;
183
+ const frame = readStepSlots(own);
184
+ if (!frame)
185
+ continue;
186
+ for (const product of placed.slice(1)) {
187
+ const productFrame = readStepSlots(records.get(product).text);
188
+ if (!productFrame)
189
+ continue;
190
+ const copy = next++;
191
+ added.push(`#${copy}=${frame.type}(${frame.slots.join(',')});`);
192
+ const slots = [...productFrame.slots];
193
+ slots[OBJECT_PLACEMENT] = `#${copy}`;
194
+ rewrites.set(product, `${productFrame.prefix}${slots.join(',')}${productFrame.suffix}`);
195
+ }
196
+ }
197
+ if (rewrites.size === 0 && drops.size === 0)
198
+ return null;
199
+ const out = [];
200
+ lines.forEach((line, i) => {
201
+ const rec = records.list[i];
202
+ if (rec && drops.has(rec.id))
203
+ return;
204
+ out.push(rec ? rewrites.get(rec.id) ?? line : line);
205
+ });
206
+ for (const line of added)
207
+ out.push(line); // not spread: there can be more than a call takes
208
+ return out;
209
+ }
210
+ /**
211
+ * `lines`, adapted in place by {@link placeEachObjectOnce} when `schema` is
212
+ * IFC2X3 and left as they are otherwise: the one call every STEP writer makes
213
+ * on its finished records.
214
+ */
215
+ export function placeObjectsForSchema(schema, lines) {
216
+ const placed = schema === 'IFC2X3' ? placeEachObjectOnce(lines) : null;
217
+ if (placed) {
218
+ lines.length = 0;
219
+ for (const line of placed)
220
+ lines.push(line);
221
+ }
222
+ return lines;
223
+ }
224
+ /**
225
+ * A child that only lifts its grid placement, folded: the intersection to
226
+ * write with the lift as its third offset (null for no lift). Null when the
227
+ * child turns, tilts or moves in plan, or anything does not read.
228
+ */
229
+ function lift(records, kid, g) {
230
+ const l = records.slots(records.get(kid));
231
+ const a = records.slots(records.get(refId(l?.[1]), 'IFCAXIS2PLACEMENT3D'));
232
+ const at = a && records.vector(a[0], 'IFCCARTESIANPOINT');
233
+ // Within the reader's tolerance: a frame composed through a turned grid
234
+ // leaves residues like 6e-17 where it means zero.
235
+ if (!l || l.length !== 2 || !a || a.length !== 3 || !at || Math.abs(at[0]) > EPS || Math.abs(at[1]) > EPS)
236
+ return null;
237
+ const axis = a[1].trim() === '$' ? [0, 0, 1] : records.vector(a[1], 'IFCDIRECTION');
238
+ const ref = a[2].trim() === '$' ? [1, 0] : records.vector(a[2], 'IFCDIRECTION');
239
+ if (!axis || axis.length !== 3 || !(axis[2] > 0) || Math.abs(axis[0]) > EPS * axis[2] || Math.abs(axis[1]) > EPS * axis[2])
240
+ return null;
241
+ if (!ref || !(ref[0] > 0) || Math.abs(ref[1]) > EPS * ref[0])
242
+ return null;
243
+ if (g[1].trim() !== '$' && !records.get(refId(g[1]), INTERSECTION))
244
+ return null;
245
+ const i = records.slots(records.get(refId(g[0]), INTERSECTION));
246
+ if (!i || i.length !== 2 || !records.crossing(refId(g[0])))
247
+ return null;
248
+ const dz = at[2] ?? 0;
249
+ if (Math.abs(dz) <= EPS)
250
+ return { intersection: null };
251
+ const offsets = i[1].trim() === '$' ? ['0.', '0.'] : list(i[1]);
252
+ if (!offsets || (offsets.length !== 2 && offsets.length !== 3))
253
+ return null;
254
+ const z0 = offsets[2] === undefined ? 0 : num(offsets[2]);
255
+ if (z0 === null)
256
+ return null;
257
+ const z = z0 + dz;
258
+ return { intersection: `${i[0].trim()},(${offsets[0].trim()},${offsets[1].trim()},${formatStepReal(z)})` };
259
+ }
260
+ /**
261
+ * A child as a plain placement in its grid's frame: the records to write
262
+ * before it, the last one its new `RelativePlacement`. `#{k}` names the k-th
263
+ * of them. Null when its relative placement does not read.
264
+ */
265
+ function free(records, kid, frame) {
266
+ const l = records.slots(records.get(kid));
267
+ const a = records.slots(records.get(refId(l?.[1]), 'IFCAXIS2PLACEMENT3D'));
268
+ const at = a && records.vector(a[0], 'IFCCARTESIANPOINT');
269
+ if (!l || l.length !== 2 || !a || a.length !== 3 || !at)
270
+ return null;
271
+ const axisGiven = a[1].trim() !== '$';
272
+ const refGiven = a[2].trim() !== '$';
273
+ const axis = axisGiven ? records.vector(a[1], 'IFCDIRECTION') : null;
274
+ const ref = refGiven ? records.vector(a[2], 'IFCDIRECTION') : null;
275
+ if ((axisGiven && !axis) || (refGiven && !ref))
276
+ return null;
277
+ const [c, s] = frame.turn ?? [1, 0];
278
+ const turn = (v) => (frame.turn ? [c * v[0] - s * v[1], s * v[0] + c * v[1], v[2] ?? 0] : [v[0], v[1], v[2] ?? 0]);
279
+ const p = turn(at);
280
+ const lines = [`IFCCARTESIANPOINT(${triple([frame.at[0] + p[0], frame.at[1] + p[1], frame.at[2] + p[2]])});`];
281
+ const slot = (given, raw, v, fallback) => {
282
+ if (!frame.turn)
283
+ return given ? raw.trim() : '$';
284
+ const turned = v ? turn(v) : fallback;
285
+ if (!turned)
286
+ return '$';
287
+ if (v && turned[0] === v[0] && turned[1] === v[1])
288
+ return raw.trim();
289
+ lines.push(`IFCDIRECTION(${triple(turned)});`);
290
+ return `#{${lines.length - 1}}`;
291
+ };
292
+ const axisSlot = slot(axisGiven, a[1], axis, null);
293
+ const refSlot = slot(refGiven, a[2], ref, [c, s, 0]);
294
+ lines.push(`IFCAXIS2PLACEMENT3D(#{0},${axisSlot},${refSlot});`);
295
+ return lines;
296
+ }
297
+ //# sourceMappingURL=schema-ifc2x3-placements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-ifc2x3-placements.js","sourceRoot":"","sources":["../src/schema-ifc2x3-placements.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EACL,GAAG,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,GAA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0 +1,58 @@
1
+ export declare const LOCAL = "IFCLOCALPLACEMENT";
2
+ export declare const GRID_PLACEMENT = "IFCGRIDPLACEMENT";
3
+ export declare const INTERSECTION = "IFCVIRTUALGRIDINTERSECTION";
4
+ /** `IfcProduct.ObjectPlacement`, the same slot on every IFC2X3 product. */
5
+ export declare const OBJECT_PLACEMENT = 5;
6
+ /** The reader's tolerance for a degenerate axis, direction or crossing. */
7
+ export declare const EPS = 1e-9;
8
+ export type Vec2 = [number, number];
9
+ export type Vec3 = [number, number, number];
10
+ export interface Rec {
11
+ readonly id: number;
12
+ readonly type: string;
13
+ readonly text: string;
14
+ readonly open: number;
15
+ }
16
+ /** A grid placement's frame in its grid's: where it is, and the +X turn, if any. */
17
+ export interface GridFrame {
18
+ readonly at: Vec3;
19
+ readonly turn: Vec2 | null;
20
+ }
21
+ export declare function refId(token: string | undefined): number | null;
22
+ export declare function num(token: string): number | null;
23
+ export declare function list(token: string | undefined): string[] | null;
24
+ export declare function numbers(token: string | undefined, min: number, max: number): number[] | null;
25
+ export declare function triple(v: readonly number[]): string;
26
+ export declare class Records {
27
+ readonly list: (Rec | null)[];
28
+ private readonly byId;
29
+ private readonly split;
30
+ private owners;
31
+ maxId: number;
32
+ constructor(lines: readonly string[]);
33
+ get(id: number | null, type?: string): Rec | undefined;
34
+ slots(rec: Rec | undefined): string[] | null;
35
+ /** The coordinates of a point or the ratios of a direction, by id. */
36
+ vector(token: string | undefined, type: string): number[] | null;
37
+ /**
38
+ * An axis's chord, with its sense, as origin and direction; null when it
39
+ * does not read, or when `straight` and the polyline bends.
40
+ */
41
+ private axisLine;
42
+ /**
43
+ * An intersection's point in its grid's frame, as the geometry reader takes
44
+ * it (each axis by its chord); null when it does not read. With `straight`,
45
+ * also null when an axis bends, where another reader may follow the bend.
46
+ */
47
+ crossing(id: number | null, straight?: boolean): Vec3 | null;
48
+ /**
49
+ * Where a grid placement (IFC2X3 layout) sits in its grid's frame, to write
50
+ * as a plain position: null over a bent axis, which is left as it was.
51
+ */
52
+ gridFrame(g: readonly string[]): GridFrame | null;
53
+ /** The `ObjectPlacement` of the first grid listing an axis of the intersection, as a slot value. */
54
+ gridPlacementOf(intersection: number | null): string;
55
+ /** Each grid axis's first listing grid's `ObjectPlacement`, read once: a pass may free many grid placements. */
56
+ private axisOwners;
57
+ }
58
+ //# sourceMappingURL=schema-ifc2x3-records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-ifc2x3-records.d.ts","sourceRoot":"","sources":["../src/schema-ifc2x3-records.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,KAAK,sBAAsB,CAAC;AACzC,eAAO,MAAM,cAAc,qBAAqB,CAAC;AACjD,eAAO,MAAM,YAAY,+BAA+B,CAAC;AACzD,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAGlC,2EAA2E;AAC3E,eAAO,MAAM,GAAG,OAAO,CAAC;AAExB,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACpC,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE5C,MAAM,WAAW,GAAG;IAAG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAEjH,oFAAoF;AACpF,MAAM,WAAW,SAAS;IAAG,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE;AAE5E,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAG9D;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhD;AAED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B"}
@@ -0,0 +1,179 @@
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
+ /**
5
+ * The records `placeEachObjectOnce` (`schema-ifc2x3-placements.ts`) reads, and
6
+ * where a grid placement resolves to, by the geometry reader's rules
7
+ * (`rust/geometry/src/placement/grid.rs`): the intersection of the two axes'
8
+ * chords, each shifted along its left normal by its offset, lifted by the
9
+ * third offset, its +X turned towards a second intersection. Twin of
10
+ * `rust/export/src/schema_ifc2x3_records.rs`.
11
+ */
12
+ import { formatStepReal } from '@ifc-lite/data';
13
+ import { readStepSlots, splitTopLevelStepArguments } from './step-argument-parser.js';
14
+ import { stepRecordHead } from './step-record-frame.js';
15
+ export const LOCAL = 'IFCLOCALPLACEMENT';
16
+ export const GRID_PLACEMENT = 'IFCGRIDPLACEMENT';
17
+ export const INTERSECTION = 'IFCVIRTUALGRIDINTERSECTION';
18
+ /** `IfcProduct.ObjectPlacement`, the same slot on every IFC2X3 product. */
19
+ export const OBJECT_PLACEMENT = 5;
20
+ /** IfcGrid's `UAxes`, `VAxes`, `WAxes`. */
21
+ const GRID_AXIS_SLOTS = [7, 8, 9];
22
+ /** The reader's tolerance for a degenerate axis, direction or crossing. */
23
+ export const EPS = 1e-9;
24
+ export function refId(token) {
25
+ const m = /^#\s*(\d+)$/.exec((token ?? '').trim());
26
+ return m ? Number(m[1]) : null;
27
+ }
28
+ export function num(token) {
29
+ const t = token.trim();
30
+ if (t === '' || !/^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/.test(t))
31
+ return null;
32
+ const v = Number(t);
33
+ return Number.isFinite(v) ? v : null;
34
+ }
35
+ export function list(token) {
36
+ const t = (token ?? '').trim();
37
+ return t.startsWith('(') && t.endsWith(')') ? splitTopLevelStepArguments(t.slice(1, -1)) : null;
38
+ }
39
+ export function numbers(token, min, max) {
40
+ const items = list(token);
41
+ if (!items || items.length < min || items.length > max)
42
+ return null;
43
+ const values = items.map(num);
44
+ return values.every((v) => v !== null) ? values : null;
45
+ }
46
+ export function triple(v) {
47
+ return `(${v.map(formatStepReal).join(',')})`;
48
+ }
49
+ export class Records {
50
+ list;
51
+ byId = new Map();
52
+ split = new Map();
53
+ owners = null;
54
+ maxId = 0;
55
+ constructor(lines) {
56
+ this.list = lines.map((text) => {
57
+ const head = stepRecordHead(text);
58
+ if (!head)
59
+ return null;
60
+ const id = Number(/#\s*(\d+)/.exec(text)[1]);
61
+ const rec = { id, type: text.slice(head.typeStart, head.typeEnd).toUpperCase(), text, open: head.open };
62
+ this.byId.set(id, rec);
63
+ if (id > this.maxId)
64
+ this.maxId = id;
65
+ return rec;
66
+ });
67
+ }
68
+ get(id, type) {
69
+ const rec = id === null ? undefined : this.byId.get(id);
70
+ return rec && (type === undefined || rec.type === type) ? rec : undefined;
71
+ }
72
+ slots(rec) {
73
+ if (!rec)
74
+ return null;
75
+ if (!this.split.has(rec.id))
76
+ this.split.set(rec.id, readStepSlots(rec.text)?.slots.slice() ?? null);
77
+ return this.split.get(rec.id);
78
+ }
79
+ /** The coordinates of a point or the ratios of a direction, by id. */
80
+ vector(token, type) {
81
+ return numbers(this.slots(this.get(refId(token), type))?.[0], 2, 3);
82
+ }
83
+ /**
84
+ * An axis's chord, with its sense, as origin and direction; null when it
85
+ * does not read, or when `straight` and the polyline bends.
86
+ */
87
+ axisLine(id, straight) {
88
+ const axis = this.slots(this.get(id, 'IFCGRIDAXIS'));
89
+ const points = list(this.slots(this.get(refId(axis?.[1]), 'IFCPOLYLINE'))?.[0]);
90
+ if (!axis || !points || points.length < 2 || (straight && points.length !== 2))
91
+ return null;
92
+ const a = this.vector(points[0], 'IFCCARTESIANPOINT');
93
+ const b = this.vector(points[points.length - 1], 'IFCCARTESIANPOINT');
94
+ if (!a || !b)
95
+ return null;
96
+ let d = [b[0] - a[0], b[1] - a[1]];
97
+ if (Math.sqrt(d[0] * d[0] + d[1] * d[1]) < EPS)
98
+ return null;
99
+ if ((axis[2] ?? '').trim().toUpperCase() === '.F.')
100
+ d = [-d[0], -d[1]];
101
+ return { o: [a[0], a[1]], d };
102
+ }
103
+ /**
104
+ * An intersection's point in its grid's frame, as the geometry reader takes
105
+ * it (each axis by its chord); null when it does not read. With `straight`,
106
+ * also null when an axis bends, where another reader may follow the bend.
107
+ */
108
+ crossing(id, straight = false) {
109
+ const s = this.slots(this.get(id, INTERSECTION));
110
+ const axes = list(s?.[0])?.map(refId);
111
+ if (!s || !axes || axes.length !== 2 || axes.includes(null))
112
+ return null;
113
+ const offsets = s[1]?.trim() === '$' ? [0, 0] : numbers(s[1], 2, 3);
114
+ const a = this.axisLine(axes[0], straight);
115
+ const b = this.axisLine(axes[1], straight);
116
+ if (!offsets || !a || !b)
117
+ return null;
118
+ const shifted = ({ o, d }, by) => {
119
+ const len = Math.sqrt(d[0] * d[0] + d[1] * d[1]);
120
+ return [o[0] + (-d[1] / len) * by, o[1] + (d[0] / len) * by];
121
+ };
122
+ const pa = shifted(a, offsets[0]);
123
+ const pb = shifted(b, offsets[1]);
124
+ const denom = a.d[0] * b.d[1] - a.d[1] * b.d[0];
125
+ if (Math.abs(denom) < EPS)
126
+ return null;
127
+ const t = ((pb[0] - pa[0]) * b.d[1] - (pb[1] - pa[1]) * b.d[0]) / denom;
128
+ return [pa[0] + t * a.d[0], pa[1] + t * a.d[1], offsets[2] ?? 0];
129
+ }
130
+ /**
131
+ * Where a grid placement (IFC2X3 layout) sits in its grid's frame, to write
132
+ * as a plain position: null over a bent axis, which is left as it was.
133
+ */
134
+ gridFrame(g) {
135
+ const at = this.crossing(refId(g[0]), true);
136
+ if (!at)
137
+ return null;
138
+ if (g[1].trim() === '$')
139
+ return { at, turn: null };
140
+ const toward = this.crossing(refId(g[1]), true);
141
+ const ratios = toward ? null : this.vector(g[1], 'IFCDIRECTION');
142
+ const v = toward ? [toward[0] - at[0], toward[1] - at[1]] : ratios;
143
+ if (!v)
144
+ return null;
145
+ const norm = Math.sqrt(v[0] * v[0] + v[1] * v[1]);
146
+ if (!Number.isFinite(norm))
147
+ return null;
148
+ return { at, turn: norm < EPS ? null : [v[0] / norm, v[1] / norm] };
149
+ }
150
+ /** The `ObjectPlacement` of the first grid listing an axis of the intersection, as a slot value. */
151
+ gridPlacementOf(intersection) {
152
+ const axis = refId(list(this.slots(this.get(intersection, INTERSECTION))?.[0])?.[0]);
153
+ const placement = axis === null ? undefined : this.axisOwners().get(axis);
154
+ return placement === undefined || placement === null ? '$' : `#${placement}`;
155
+ }
156
+ /** Each grid axis's first listing grid's `ObjectPlacement`, read once: a pass may free many grid placements. */
157
+ axisOwners() {
158
+ if (this.owners)
159
+ return this.owners;
160
+ this.owners = new Map();
161
+ for (const rec of this.list) {
162
+ if (rec?.type !== 'IFCGRID')
163
+ continue;
164
+ const s = this.slots(rec);
165
+ if (!s)
166
+ continue;
167
+ const placement = refId(s[OBJECT_PLACEMENT]);
168
+ for (const i of GRID_AXIS_SLOTS) {
169
+ for (const m of list(s[i]) ?? []) {
170
+ const axis = refId(m);
171
+ if (axis !== null && !this.owners.has(axis))
172
+ this.owners.set(axis, placement);
173
+ }
174
+ }
175
+ }
176
+ return this.owners;
177
+ }
178
+ }
179
+ //# sourceMappingURL=schema-ifc2x3-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-ifc2x3-records.js","sourceRoot":"","sources":["../src/schema-ifc2x3-records.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG,mBAAmB,CAAC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AACjD,MAAM,CAAC,MA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B,CAAC,CAAC,CAAC;YAC7C,KAAK,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC;gBAChC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;oBACjC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;oBACtB,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;wBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;gBAChF,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
@@ -32,6 +32,10 @@ export declare class StyleFlatten {
32
32
  * list member) or written `$` (a single slot).
33
33
  */
34
34
  private emptied;
35
+ /** The other record this conversion rewrites from a pre-pass, on the same hook (#9026 item 14). */
36
+ private readonly gridFrames;
37
+ /** Which grids this export writes; see {@link GridFrames.retain}. */
38
+ retainGrids(written: (gridId: number) => boolean): void;
35
39
  /** True for the one conversion that flattens: IFC2X3 or IFC4 source, IFC4X3 target. */
36
40
  static applies(from: IfcSchemaVersion, to: IfcSchemaVersion): boolean;
37
41
  /** An empty table for a conversion that flattens; undefined for one that does not. */
@@ -47,9 +51,10 @@ export declare class StyleFlatten {
47
51
  /**
48
52
  * Edited source assignments: each id's record text after the session's
49
53
  * edits (`edited(id)`, null when unchanged), so a styled item flattens to
50
- * the members the user set, not the source ones.
54
+ * the members the user set, not the source ones. Grids and intersections
55
+ * likewise, so an axis the session added has its owner.
51
56
  */
52
- noteEdited(store: Pick<IfcDataStore, 'entityIndex' | 'source'>, edited: (id: number, text: string) => string | null): void;
57
+ noteEdited(store: Pick<IfcDataStore, 'entityIndex' | 'source'>, edited: (id: number, text: string, type: string) => string | null): void;
53
58
  /** Decide which styled items flatten to nothing, reading the store's styled items once an assignment holds nothing. */
54
59
  settle(store?: Pick<IfcDataStore, 'entityIndex' | 'source'>): void;
55
60
  /** A record that is not written: an assignment, or a styled item whose `Styles` flattens to nothing. */
@@ -1 +1 @@
1
- {"version":3,"file":"schema-style-flatten.d.ts","sourceRoot":"","sources":["../src/schema-style-flatten.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA8B/E,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwC;IAChE;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,SAAS,CAAS;IAC1B;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAqB;IAEpC,uFAAuF;IACvF,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,GAAG,OAAO;IAIrE,sFAAsF;IACtF,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,GAAG,YAAY,GAAG,SAAS;IAIrF,sHAAsH;IACtH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAU3C,kHAAkH;IAClH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAa5B,mFAAmF;IACnF,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,YAAY;IAQ3D,+FAA+F;IAC/F,MAAM,CAAC,SAAS,CACd,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,QAAQ,CAAC,EACnD,IAAI,EAAE,gBAAgB,EACtB,EAAE,EAAE,gBAAgB,GACnB,YAAY,GAAG,SAAS;IAa3B;;;;OAIG;IAC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