@ifc-lite/create 4.0.0 → 5.1.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.
- package/README.md +34 -0
- package/dist/in-store/align-boxes.d.ts +38 -0
- package/dist/in-store/align-boxes.d.ts.map +1 -0
- package/dist/in-store/align-boxes.js +97 -0
- package/dist/in-store/align-boxes.js.map +1 -0
- package/dist/in-store/anchor.d.ts.map +1 -1
- package/dist/in-store/anchor.js +13 -2
- package/dist/in-store/anchor.js.map +1 -1
- package/dist/in-store/beam.d.ts.map +1 -1
- package/dist/in-store/beam.js +3 -10
- package/dist/in-store/beam.js.map +1 -1
- package/dist/in-store/copy-array.d.ts +17 -0
- package/dist/in-store/copy-array.d.ts.map +1 -0
- package/dist/in-store/copy-array.js +47 -0
- package/dist/in-store/copy-array.js.map +1 -0
- package/dist/in-store/copy-batch.d.ts +27 -0
- package/dist/in-store/copy-batch.d.ts.map +1 -0
- package/dist/in-store/copy-batch.js +101 -0
- package/dist/in-store/copy-batch.js.map +1 -0
- package/dist/in-store/copy-dependent-walk.d.ts +27 -0
- package/dist/in-store/copy-dependent-walk.d.ts.map +1 -0
- package/dist/in-store/copy-dependent-walk.js +61 -0
- package/dist/in-store/copy-dependent-walk.js.map +1 -0
- package/dist/in-store/copy-frame.d.ts +4 -3
- package/dist/in-store/copy-frame.d.ts.map +1 -1
- package/dist/in-store/copy-frame.js +14 -1
- package/dist/in-store/copy-frame.js.map +1 -1
- package/dist/in-store/copy-product.d.ts +0 -20
- package/dist/in-store/copy-product.d.ts.map +1 -1
- package/dist/in-store/copy-product.js +35 -35
- package/dist/in-store/copy-product.js.map +1 -1
- package/dist/in-store/edit/effective-mutation-view.d.ts +6 -0
- package/dist/in-store/edit/effective-mutation-view.d.ts.map +1 -0
- package/dist/in-store/edit/effective-mutation-view.js +45 -0
- package/dist/in-store/edit/effective-mutation-view.js.map +1 -0
- package/dist/in-store/edit/effective-storey.d.ts +13 -0
- package/dist/in-store/edit/effective-storey.d.ts.map +1 -0
- package/dist/in-store/edit/effective-storey.js +36 -0
- package/dist/in-store/edit/effective-storey.js.map +1 -0
- package/dist/in-store/edit/effective-storeys.d.ts +9 -0
- package/dist/in-store/edit/effective-storeys.d.ts.map +1 -0
- package/dist/in-store/edit/effective-storeys.js +16 -0
- package/dist/in-store/edit/effective-storeys.js.map +1 -0
- package/dist/in-store/edit/hosted-opening-refit.d.ts +29 -0
- package/dist/in-store/edit/hosted-opening-refit.d.ts.map +1 -0
- package/dist/in-store/edit/hosted-opening-refit.js +168 -0
- package/dist/in-store/edit/hosted-opening-refit.js.map +1 -0
- package/dist/in-store/edit/length-unit-scale.d.ts +24 -0
- package/dist/in-store/edit/length-unit-scale.d.ts.map +1 -0
- package/dist/in-store/edit/length-unit-scale.js +37 -0
- package/dist/in-store/edit/length-unit-scale.js.map +1 -0
- package/dist/in-store/edit/linear-element-edit.d.ts +131 -0
- package/dist/in-store/edit/linear-element-edit.d.ts.map +1 -0
- package/dist/in-store/edit/linear-element-edit.js +259 -0
- package/dist/in-store/edit/linear-element-edit.js.map +1 -0
- package/dist/in-store/edit/metadata-clone-effective.d.ts +5 -0
- package/dist/in-store/edit/metadata-clone-effective.d.ts.map +1 -0
- package/dist/in-store/edit/metadata-clone-effective.js +47 -0
- package/dist/in-store/edit/metadata-clone-effective.js.map +1 -0
- package/dist/in-store/edit/metadata-clone.d.ts +40 -0
- package/dist/in-store/edit/metadata-clone.d.ts.map +1 -0
- package/dist/in-store/edit/metadata-clone.js +107 -0
- package/dist/in-store/edit/metadata-clone.js.map +1 -0
- package/dist/in-store/edit/placement-core.d.ts +140 -0
- package/dist/in-store/edit/placement-core.d.ts.map +1 -0
- package/dist/in-store/edit/placement-core.js +317 -0
- package/dist/in-store/edit/placement-core.js.map +1 -0
- package/dist/in-store/edit/polygon-clip.d.ts +58 -0
- package/dist/in-store/edit/polygon-clip.d.ts.map +1 -0
- package/dist/in-store/edit/polygon-clip.js +153 -0
- package/dist/in-store/edit/polygon-clip.js.map +1 -0
- package/dist/in-store/edit/read-profile.d.ts +6 -0
- package/dist/in-store/edit/read-profile.d.ts.map +1 -0
- package/dist/in-store/edit/read-profile.js +95 -0
- package/dist/in-store/edit/read-profile.js.map +1 -0
- package/dist/in-store/edit/slab-edit-frame.d.ts +40 -0
- package/dist/in-store/edit/slab-edit-frame.d.ts.map +1 -0
- package/dist/in-store/edit/slab-edit-frame.js +146 -0
- package/dist/in-store/edit/slab-edit-frame.js.map +1 -0
- package/dist/in-store/edit/slab-edit.d.ts +112 -0
- package/dist/in-store/edit/slab-edit.d.ts.map +1 -0
- package/dist/in-store/edit/slab-edit.js +275 -0
- package/dist/in-store/edit/slab-edit.js.map +1 -0
- package/dist/in-store/edit/slab-opening-carry.d.ts +10 -0
- package/dist/in-store/edit/slab-opening-carry.d.ts.map +1 -0
- package/dist/in-store/edit/slab-opening-carry.js +65 -0
- package/dist/in-store/edit/slab-opening-carry.js.map +1 -0
- package/dist/in-store/edit/split-guid.d.ts +29 -0
- package/dist/in-store/edit/split-guid.d.ts.map +1 -0
- package/dist/in-store/edit/split-guid.js +64 -0
- package/dist/in-store/edit/split-guid.js.map +1 -0
- package/dist/in-store/edit/split-target.d.ts +90 -0
- package/dist/in-store/edit/split-target.d.ts.map +1 -0
- package/dist/in-store/edit/split-target.js +116 -0
- package/dist/in-store/edit/split-target.js.map +1 -0
- package/dist/in-store/edit/target.d.ts +8 -0
- package/dist/in-store/edit/target.d.ts.map +1 -0
- package/dist/in-store/edit/target.js +5 -0
- package/dist/in-store/edit/target.js.map +1 -0
- package/dist/in-store/edit/trim-extend-geometry.d.ts +99 -0
- package/dist/in-store/edit/trim-extend-geometry.d.ts.map +1 -0
- package/dist/in-store/edit/trim-extend-geometry.js +105 -0
- package/dist/in-store/edit/trim-extend-geometry.js.map +1 -0
- package/dist/in-store/edit/wall-axis-edit.d.ts +16 -0
- package/dist/in-store/edit/wall-axis-edit.d.ts.map +1 -0
- package/dist/in-store/edit/wall-axis-edit.js +40 -0
- package/dist/in-store/edit/wall-axis-edit.js.map +1 -0
- package/dist/in-store/edit/wall-edit.d.ts +157 -0
- package/dist/in-store/edit/wall-edit.d.ts.map +1 -0
- package/dist/in-store/edit/wall-edit.js +276 -0
- package/dist/in-store/edit/wall-edit.js.map +1 -0
- package/dist/in-store/edit/wall-hosted-cuts.d.ts +35 -0
- package/dist/in-store/edit/wall-hosted-cuts.d.ts.map +1 -0
- package/dist/in-store/edit/wall-hosted-cuts.js +27 -0
- package/dist/in-store/edit/wall-hosted-cuts.js.map +1 -0
- package/dist/in-store/edit/wall-opening-reassign.d.ts +18 -0
- package/dist/in-store/edit/wall-opening-reassign.d.ts.map +1 -0
- package/dist/in-store/edit/wall-opening-reassign.js +50 -0
- package/dist/in-store/edit/wall-opening-reassign.js.map +1 -0
- package/dist/in-store/element-align.d.ts +13 -0
- package/dist/in-store/element-align.d.ts.map +1 -0
- package/dist/in-store/element-align.js +90 -0
- package/dist/in-store/element-align.js.map +1 -0
- package/dist/in-store/element-replacement.d.ts +26 -0
- package/dist/in-store/element-replacement.d.ts.map +1 -0
- package/dist/in-store/element-replacement.js +68 -0
- package/dist/in-store/element-replacement.js.map +1 -0
- package/dist/in-store/element-size-edit.d.ts +40 -0
- package/dist/in-store/element-size-edit.d.ts.map +1 -0
- package/dist/in-store/element-size-edit.js +103 -0
- package/dist/in-store/element-size-edit.js.map +1 -0
- package/dist/in-store/element-split-axis.d.ts +6 -0
- package/dist/in-store/element-split-axis.d.ts.map +1 -0
- package/dist/in-store/element-split-axis.js +87 -0
- package/dist/in-store/element-split-axis.js.map +1 -0
- package/dist/in-store/element-split-joined.d.ts +13 -0
- package/dist/in-store/element-split-joined.d.ts.map +1 -0
- package/dist/in-store/element-split-joined.js +74 -0
- package/dist/in-store/element-split-joined.js.map +1 -0
- package/dist/in-store/element-split-placement.d.ts +19 -0
- package/dist/in-store/element-split-placement.d.ts.map +1 -0
- package/dist/in-store/element-split-placement.js +48 -0
- package/dist/in-store/element-split-placement.js.map +1 -0
- package/dist/in-store/element-split-slab.d.ts +19 -0
- package/dist/in-store/element-split-slab.d.ts.map +1 -0
- package/dist/in-store/element-split-slab.js +86 -0
- package/dist/in-store/element-split-slab.js.map +1 -0
- package/dist/in-store/element-split.d.ts +49 -0
- package/dist/in-store/element-split.d.ts.map +1 -0
- package/dist/in-store/element-split.js +52 -0
- package/dist/in-store/element-split.js.map +1 -0
- package/dist/in-store/element-transform-edit.d.ts +33 -0
- package/dist/in-store/element-transform-edit.d.ts.map +1 -0
- package/dist/in-store/element-transform-edit.js +97 -0
- package/dist/in-store/element-transform-edit.js.map +1 -0
- package/dist/in-store/element-transform-frames.d.ts +58 -0
- package/dist/in-store/element-transform-frames.d.ts.map +1 -0
- package/dist/in-store/element-transform-frames.js +110 -0
- package/dist/in-store/element-transform-frames.js.map +1 -0
- package/dist/in-store/element-transform-joins.d.ts +4 -0
- package/dist/in-store/element-transform-joins.d.ts.map +1 -0
- package/dist/in-store/element-transform-joins.js +62 -0
- package/dist/in-store/element-transform-joins.js.map +1 -0
- package/dist/in-store/element-transform-plan.d.ts +38 -0
- package/dist/in-store/element-transform-plan.d.ts.map +1 -0
- package/dist/in-store/element-transform-plan.js +115 -0
- package/dist/in-store/element-transform-plan.js.map +1 -0
- package/dist/in-store/element-trim-extend.d.ts +25 -0
- package/dist/in-store/element-trim-extend.d.ts.map +1 -0
- package/dist/in-store/element-trim-extend.js +97 -0
- package/dist/in-store/element-trim-extend.js.map +1 -0
- package/dist/in-store/extract-grids.d.ts +7 -17
- package/dist/in-store/extract-grids.d.ts.map +1 -1
- package/dist/in-store/extract-grids.js +11 -2
- package/dist/in-store/extract-grids.js.map +1 -1
- package/dist/in-store/grid-column.d.ts +23 -0
- package/dist/in-store/grid-column.d.ts.map +1 -0
- package/dist/in-store/grid-column.js +73 -0
- package/dist/in-store/grid-column.js.map +1 -0
- package/dist/in-store/grid-intersection-read.d.ts +10 -0
- package/dist/in-store/grid-intersection-read.d.ts.map +1 -0
- package/dist/in-store/grid-intersection-read.js +45 -0
- package/dist/in-store/grid-intersection-read.js.map +1 -0
- package/dist/in-store/grid.d.ts +7 -1
- package/dist/in-store/grid.d.ts.map +1 -1
- package/dist/in-store/grid.js +12 -2
- package/dist/in-store/grid.js.map +1 -1
- package/dist/in-store/group-evidence.d.ts +49 -0
- package/dist/in-store/group-evidence.d.ts.map +1 -0
- package/dist/in-store/group-evidence.js +111 -0
- package/dist/in-store/group-evidence.js.map +1 -0
- package/dist/in-store/group-graph.d.ts +51 -0
- package/dist/in-store/group-graph.d.ts.map +1 -0
- package/dist/in-store/group-graph.js +213 -0
- package/dist/in-store/group-graph.js.map +1 -0
- package/dist/in-store/group.d.ts +34 -0
- package/dist/in-store/group.d.ts.map +1 -0
- package/dist/in-store/group.js +181 -0
- package/dist/in-store/group.js.map +1 -0
- package/dist/in-store/host-geometry-frame.d.ts +5 -1
- package/dist/in-store/host-geometry-frame.d.ts.map +1 -1
- package/dist/in-store/host-geometry-frame.js +46 -2
- package/dist/in-store/host-geometry-frame.js.map +1 -1
- package/dist/in-store/index.d.ts +7 -0
- package/dist/in-store/index.d.ts.map +1 -1
- package/dist/in-store/index.js +7 -0
- package/dist/in-store/index.js.map +1 -1
- package/dist/in-store/linear-profile-frame.d.ts +10 -0
- package/dist/in-store/linear-profile-frame.d.ts.map +1 -0
- package/dist/in-store/linear-profile-frame.js +17 -0
- package/dist/in-store/linear-profile-frame.js.map +1 -0
- package/dist/in-store/material.d.ts.map +1 -1
- package/dist/in-store/material.js +17 -6
- package/dist/in-store/material.js.map +1 -1
- package/dist/in-store/member.d.ts.map +1 -1
- package/dist/in-store/member.js +3 -7
- package/dist/in-store/member.js.map +1 -1
- package/dist/in-store/ordinary-element.d.ts +47 -0
- package/dist/in-store/ordinary-element.d.ts.map +1 -0
- package/dist/in-store/ordinary-element.js +38 -0
- package/dist/in-store/ordinary-element.js.map +1 -0
- package/dist/in-store/placement-frame.d.ts +6 -1
- package/dist/in-store/placement-frame.d.ts.map +1 -1
- package/dist/in-store/placement-frame.js +5 -1
- package/dist/in-store/placement-frame.js.map +1 -1
- package/dist/in-store/resolve-anchor.d.ts +3 -2
- package/dist/in-store/resolve-anchor.d.ts.map +1 -1
- package/dist/in-store/resolve-anchor.js +7 -5
- package/dist/in-store/resolve-anchor.js.map +1 -1
- package/dist/in-store/resolve-relations.d.ts +3 -1
- package/dist/in-store/resolve-relations.d.ts.map +1 -1
- package/dist/in-store/resolve-relations.js +8 -3
- package/dist/in-store/resolve-relations.js.map +1 -1
- package/dist/in-store/room-candidates.d.ts +58 -0
- package/dist/in-store/room-candidates.d.ts.map +1 -0
- package/dist/in-store/room-candidates.js +135 -0
- package/dist/in-store/room-candidates.js.map +1 -0
- package/dist/in-store/room-creation-plan.d.ts +16 -0
- package/dist/in-store/room-creation-plan.d.ts.map +1 -0
- package/dist/in-store/room-creation-plan.js +28 -0
- package/dist/in-store/room-creation-plan.js.map +1 -0
- package/dist/in-store/room-floor-height.d.ts +24 -0
- package/dist/in-store/room-floor-height.d.ts.map +1 -0
- package/dist/in-store/room-floor-height.js +32 -0
- package/dist/in-store/room-floor-height.js.map +1 -0
- package/dist/in-store/room-footprint-native.d.ts +19 -0
- package/dist/in-store/room-footprint-native.d.ts.map +1 -0
- package/dist/in-store/room-footprint-native.js +117 -0
- package/dist/in-store/room-footprint-native.js.map +1 -0
- package/dist/in-store/room-layout-cache.d.ts +23 -0
- package/dist/in-store/room-layout-cache.d.ts.map +1 -0
- package/dist/in-store/room-layout-cache.js +84 -0
- package/dist/in-store/room-layout-cache.js.map +1 -0
- package/dist/in-store/room-layout-core.d.ts +68 -0
- package/dist/in-store/room-layout-core.d.ts.map +1 -0
- package/dist/in-store/room-layout-core.js +153 -0
- package/dist/in-store/room-layout-core.js.map +1 -0
- package/dist/in-store/room-population.d.ts +5 -0
- package/dist/in-store/room-population.d.ts.map +1 -0
- package/dist/in-store/room-population.js +28 -0
- package/dist/in-store/room-population.js.map +1 -0
- package/dist/in-store/room-space-meshes.d.ts +15 -0
- package/dist/in-store/room-space-meshes.d.ts.map +1 -0
- package/dist/in-store/room-space-meshes.js +38 -0
- package/dist/in-store/room-space-meshes.js.map +1 -0
- package/dist/in-store/room-store.d.ts +55 -0
- package/dist/in-store/room-store.d.ts.map +1 -0
- package/dist/in-store/room-store.js +173 -0
- package/dist/in-store/room-store.js.map +1 -0
- package/dist/in-store/room-storey-elevation.d.ts +5 -0
- package/dist/in-store/room-storey-elevation.d.ts.map +1 -0
- package/dist/in-store/room-storey-elevation.js +42 -0
- package/dist/in-store/room-storey-elevation.js.map +1 -0
- package/dist/in-store/room-storey-frame.d.ts +47 -0
- package/dist/in-store/room-storey-frame.d.ts.map +1 -0
- package/dist/in-store/room-storey-frame.js +48 -0
- package/dist/in-store/room-storey-frame.js.map +1 -0
- package/dist/in-store/room-wall-rects.d.ts +117 -0
- package/dist/in-store/room-wall-rects.d.ts.map +1 -0
- package/dist/in-store/room-wall-rects.js +157 -0
- package/dist/in-store/room-wall-rects.js.map +1 -0
- package/dist/in-store/schema-attributes.d.ts +3 -3
- package/dist/in-store/schema-attributes.d.ts.map +1 -1
- package/dist/in-store/schema-attributes.js +9 -7
- package/dist/in-store/schema-attributes.js.map +1 -1
- package/dist/in-store/slab.d.ts.map +1 -1
- package/dist/in-store/slab.js +1 -4
- package/dist/in-store/slab.js.map +1 -1
- package/dist/in-store/stair-removal.d.ts +17 -0
- package/dist/in-store/stair-removal.d.ts.map +1 -0
- package/dist/in-store/stair-removal.js +134 -0
- package/dist/in-store/stair-removal.js.map +1 -0
- package/dist/in-store/storey-plan-frame.d.ts +2 -1
- package/dist/in-store/storey-plan-frame.d.ts.map +1 -1
- package/dist/in-store/storey-plan-frame.js +20 -11
- package/dist/in-store/storey-plan-frame.js.map +1 -1
- package/dist/in-store/storey-reassignment-plan.d.ts +53 -0
- package/dist/in-store/storey-reassignment-plan.d.ts.map +1 -0
- package/dist/in-store/storey-reassignment-plan.js +237 -0
- package/dist/in-store/storey-reassignment-plan.js.map +1 -0
- package/dist/in-store/storey-reassignment.d.ts +8 -0
- package/dist/in-store/storey-reassignment.d.ts.map +1 -0
- package/dist/in-store/storey-reassignment.js +52 -0
- package/dist/in-store/storey-reassignment.js.map +1 -0
- package/dist/in-store/trim-extend-plan.d.ts +27 -0
- package/dist/in-store/trim-extend-plan.d.ts.map +1 -0
- package/dist/in-store/trim-extend-plan.js +49 -0
- package/dist/in-store/trim-extend-plan.js.map +1 -0
- package/dist/in-store/wall-join-edit.d.ts +0 -17
- package/dist/in-store/wall-join-edit.d.ts.map +1 -1
- package/dist/in-store/wall-join-edit.js +41 -7
- package/dist/in-store/wall-join-edit.js.map +1 -1
- package/dist/in-store/wall-section-edit.d.ts +16 -0
- package/dist/in-store/wall-section-edit.d.ts.map +1 -0
- package/dist/in-store/wall-section-edit.js +75 -0
- package/dist/in-store/wall-section-edit.js.map +1 -0
- package/dist/in-store/wall-size-edit.d.ts +29 -0
- package/dist/in-store/wall-size-edit.d.ts.map +1 -0
- package/dist/in-store/wall-size-edit.js +65 -0
- package/dist/in-store/wall-size-edit.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -38,10 +38,15 @@ const { content } = creator.toIfc(); // IFC STEP text
|
|
|
38
38
|
- Property sets, element quantities, materials, and colors
|
|
39
39
|
- 4D scheduling entities: IfcWorkSchedule, IfcTask, IfcRelSequence
|
|
40
40
|
- In-store builders (`addWallToStore`, `addSlabToStore`, ...) that emit elements into an existing parsed model
|
|
41
|
+
- `addOrdinaryElementInStore(editor, anchor, element)` commits the eight ordinary
|
|
42
|
+
builders atomically. Its anchor can be resolved or supplied by a synchronous
|
|
43
|
+
draft-editor callback so existing host preparation shares that transaction.
|
|
44
|
+
Failed creation leaves no helpers, journal entries or consumed IDs.
|
|
41
45
|
- `resolveSpatialAnchor(store, storeyId, view)` reads the live mutation view when
|
|
42
46
|
authoring into an edited model. Pass the same view as the `StoreEditor` so a
|
|
43
47
|
created storey or placement, and deletions or retypes of source anchors, are
|
|
44
48
|
reflected before an element is emitted. Omitting `view` reads the parsed model.
|
|
49
|
+
- Source-empty transported models cannot reconstruct edited source relationship records. Native spatial authoring suppresses their original indexed graph edges instead of treating the original endpoints as current membership. Complete authored relationship records remain readable. Load the original IFC to resolve unavailable source membership.
|
|
45
50
|
- `applyStylesInStore` reads styled items and representation chains from the
|
|
46
51
|
editor's live overlay, so a deleted style can be replaced and an authored
|
|
47
52
|
style is found before adding another one to the same representation item.
|
|
@@ -64,3 +69,32 @@ const { content } = creator.toIfc(); // IFC STEP text
|
|
|
64
69
|
## License
|
|
65
70
|
|
|
66
71
|
MPL-2.0
|
|
72
|
+
|
|
73
|
+
`linearProfileFrame(Start, End)` returns the existing native beam/member extrusion frame (`origin`, `u`, `v`, `along`, `length`) in the coordinates and units supplied. The in-store beam/member builders and reviewed viewer section ghosts share it, including the near-vertical reference-axis fallback. Non-finite or coincident endpoints are refused.
|
|
74
|
+
|
|
75
|
+
### Current storey plan frames
|
|
76
|
+
|
|
77
|
+
`storeyPlanFrame(store, storeyExpressId, mutationView)` reads current named and positional placement edits, authored records and deletions through the canonical native metadata reader. Omitting the mutation view retains source-only behavior. A live chain is limited to 256 placements and returns `null` when unreadable, non-planar, cyclic or oversized; callers must disclose unavailable geometry rather than use old coordinates. Coordinates remain metres; directions are dimensionless. This planar reader does not support tilted storey placement or infer a transform from unavailable source data.
|
|
78
|
+
|
|
79
|
+
Native split placement snapshots and their writers honor current `ObjectPlacement`, `PlacementRelTo`, `RelativePlacement`, axis and direction edits. Named edits use the canonical schema layout; positional edits win for the same slot. The existing source attribute callback still supplies source records, and disabling it still makes source-only placement unreadable. Deleted leaves and cyclic or oversized parent chains are refused. This does not make unsupported body/profile layouts editable or infer geometry from missing source records.
|
|
80
|
+
|
|
81
|
+
### Generic group lifecycle
|
|
82
|
+
|
|
83
|
+
`addGroupToStore`, `readGroupInStore`, `updateGroupInStore`, and
|
|
84
|
+
`removeGroupInStore` share a current, bounded IFC4/IFC4X3 graph owner. Supply the
|
|
85
|
+
parsed `store`, its live `mutationView`, and current `ownerHistoryId` (or `null`
|
|
86
|
+
where absent). Group/member identities pin `expressId` and current `GlobalId`.
|
|
87
|
+
Create/update require the complete explicit `RelatedObjects` list; updates and
|
|
88
|
+
deletions also require a complete current `GroupSnapshot`. `readGroupEvidenceInStore`
|
|
89
|
+
provides selected native roots, owned membership and immediate incoming records
|
|
90
|
+
with the actual source content identity for review; it refuses partial evidence.
|
|
91
|
+
|
|
92
|
+
The owner preserves group identity, reuses/removes exact membership edges,
|
|
93
|
+
protects other incoming dependencies, retains member objects and shared other
|
|
94
|
+
memberships, and publishes all records atomically. Specialized groups and
|
|
95
|
+
specialized assignment relationships are refused by this generic lifecycle.
|
|
96
|
+
Replacement also refuses typed `RelatedObjectsType` assignments and multiple
|
|
97
|
+
assignments with distinct OwnerHistory, Name or Description; a single complete
|
|
98
|
+
member list cannot express their separate semantics. Reads and safe deletion
|
|
99
|
+
remain available, and refusal preserves the entire graph and allocator.
|
|
100
|
+
Native hosts provide their history publisher; the viewer publishes one Undo.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MeshData } from '@ifc-lite/geometry';
|
|
2
|
+
type Vec2 = readonly [number, number];
|
|
3
|
+
export type AlignMode = 'left' | 'centre' | 'right' | 'top' | 'middle' | 'bottom';
|
|
4
|
+
export declare const ALIGN_MODES: readonly AlignMode[];
|
|
5
|
+
/** An element's extent in workplane-local metres: plan box and height range. */
|
|
6
|
+
export interface PlanBox {
|
|
7
|
+
readonly min: Vec2;
|
|
8
|
+
readonly max: Vec2;
|
|
9
|
+
readonly z0: number;
|
|
10
|
+
readonly z1: number;
|
|
11
|
+
}
|
|
12
|
+
/** True for the modes that move along u (the rest move along v). */
|
|
13
|
+
export declare const alignsAlongU: (mode: AlignMode) => boolean;
|
|
14
|
+
/** `expressId`'s meshes' extent in `plane`, or null when it has no rendered geometry. */
|
|
15
|
+
export declare function planBoxOf(meshes: readonly MeshData[], globalId: number, plane: {
|
|
16
|
+
renderToLocal(point: readonly [number, number, number]): readonly [number, number, number];
|
|
17
|
+
}): PlanBox | null;
|
|
18
|
+
/** The element whose box holds `point`: the smallest, so a column on a slab wins. Null when none does. */
|
|
19
|
+
export declare function pickBox(boxes: ReadonlyMap<number, PlanBox>, point: Vec2): number | null;
|
|
20
|
+
/** The edge (or centre line) of `box` that `mode` names, along its axis. */
|
|
21
|
+
export declare function edgeOf(mode: AlignMode, box: PlanBox): number;
|
|
22
|
+
/** The workplane-local shift that puts `box`'s `mode` edge on `reference`'s. */
|
|
23
|
+
export declare function alignShift(mode: AlignMode, reference: PlanBox, box: PlanBox): Vec2;
|
|
24
|
+
/** `box` moved by `shift`. */
|
|
25
|
+
export declare function shiftBox(box: PlanBox, shift: Vec2): PlanBox;
|
|
26
|
+
/** The moves the gesture would make: each target's shift, the ones already aligned left out. */
|
|
27
|
+
export declare function alignMoves(g: {
|
|
28
|
+
reference: number | null;
|
|
29
|
+
targets: readonly number[];
|
|
30
|
+
carried?: readonly number[];
|
|
31
|
+
mode: AlignMode;
|
|
32
|
+
boxes: ReadonlyMap<number, PlanBox>;
|
|
33
|
+
}): {
|
|
34
|
+
id: number;
|
|
35
|
+
shift: [number, number];
|
|
36
|
+
}[];
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=align-boxes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align-boxes.d.ts","sourceRoot":"","sources":["../../src/in-store/align-boxes.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,KAAK,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,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CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,EAAE,CAapN"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
export const ALIGN_MODES = ['left', 'centre', 'right', 'top', 'middle', 'bottom'];
|
|
5
|
+
/** True for the modes that move along u (the rest move along v). */
|
|
6
|
+
export const alignsAlongU = (mode) => mode === 'left' || mode === 'centre' || mode === 'right';
|
|
7
|
+
const MAX_COORD = 1e7;
|
|
8
|
+
/** `expressId`'s meshes' extent in `plane`, or null when it has no rendered geometry. */
|
|
9
|
+
export function planBoxOf(meshes, globalId, plane) {
|
|
10
|
+
let u0 = Infinity, v0 = Infinity, z0 = Infinity, u1 = -Infinity, v1 = -Infinity, z1 = -Infinity;
|
|
11
|
+
for (const mesh of meshes) {
|
|
12
|
+
if (mesh.expressId !== globalId)
|
|
13
|
+
continue;
|
|
14
|
+
const [ox, oy, oz] = mesh.origin ?? [0, 0, 0];
|
|
15
|
+
const p = mesh.positions;
|
|
16
|
+
for (let i = 0; i + 2 < p.length; i += 3) {
|
|
17
|
+
const x = p[i] + ox, y = p[i + 1] + oy, z = p[i + 2] + oz;
|
|
18
|
+
if (!(Math.abs(x) < MAX_COORD && Math.abs(y) < MAX_COORD && Math.abs(z) < MAX_COORD))
|
|
19
|
+
continue;
|
|
20
|
+
const [u, v, h] = plane.renderToLocal([x, y, z]);
|
|
21
|
+
if (u < u0)
|
|
22
|
+
u0 = u;
|
|
23
|
+
if (u > u1)
|
|
24
|
+
u1 = u;
|
|
25
|
+
if (v < v0)
|
|
26
|
+
v0 = v;
|
|
27
|
+
if (v > v1)
|
|
28
|
+
v1 = v;
|
|
29
|
+
if (h < z0)
|
|
30
|
+
z0 = h;
|
|
31
|
+
if (h > z1)
|
|
32
|
+
z1 = h;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return Number.isFinite(u0) ? { min: [u0, v0], max: [u1, v1], z0, z1 } : null;
|
|
36
|
+
}
|
|
37
|
+
/** How far outside a box a click still picks it (metres): a wall's thin footprint is easy to miss. */
|
|
38
|
+
const PICK_REACH = 0.05;
|
|
39
|
+
/** The element whose box holds `point`: the smallest, so a column on a slab wins. Null when none does. */
|
|
40
|
+
export function pickBox(boxes, point) {
|
|
41
|
+
let best = null;
|
|
42
|
+
let bestArea = Infinity;
|
|
43
|
+
for (const [id, box] of boxes) {
|
|
44
|
+
if (point[0] < box.min[0] - PICK_REACH || point[0] > box.max[0] + PICK_REACH)
|
|
45
|
+
continue;
|
|
46
|
+
if (point[1] < box.min[1] - PICK_REACH || point[1] > box.max[1] + PICK_REACH)
|
|
47
|
+
continue;
|
|
48
|
+
const area = Math.max(box.max[0] - box.min[0], 0.01) * Math.max(box.max[1] - box.min[1], 0.01);
|
|
49
|
+
if (area < bestArea) {
|
|
50
|
+
best = id;
|
|
51
|
+
bestArea = area;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return best;
|
|
55
|
+
}
|
|
56
|
+
/** The edge (or centre line) of `box` that `mode` names, along its axis. */
|
|
57
|
+
export function edgeOf(mode, box) {
|
|
58
|
+
switch (mode) {
|
|
59
|
+
case 'left': return box.min[0];
|
|
60
|
+
case 'right': return box.max[0];
|
|
61
|
+
case 'centre': return (box.min[0] + box.max[0]) / 2;
|
|
62
|
+
case 'top': return box.max[1];
|
|
63
|
+
case 'bottom': return box.min[1];
|
|
64
|
+
case 'middle': return (box.min[1] + box.max[1]) / 2;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** The workplane-local shift that puts `box`'s `mode` edge on `reference`'s. */
|
|
68
|
+
export function alignShift(mode, reference, box) {
|
|
69
|
+
const d = edgeOf(mode, reference) - edgeOf(mode, box);
|
|
70
|
+
return alignsAlongU(mode) ? [d, 0] : [0, d];
|
|
71
|
+
}
|
|
72
|
+
/** `box` moved by `shift`. */
|
|
73
|
+
export function shiftBox(box, shift) {
|
|
74
|
+
return { ...box, min: [box.min[0] + shift[0], box.min[1] + shift[1]], max: [box.max[0] + shift[0], box.max[1] + shift[1]] };
|
|
75
|
+
}
|
|
76
|
+
/** A shift below this (metres) is already aligned. */
|
|
77
|
+
const ALIGNED = 1e-4;
|
|
78
|
+
/** The moves the gesture would make: each target's shift, the ones already aligned left out. */
|
|
79
|
+
export function alignMoves(g) {
|
|
80
|
+
const reference = g.reference === null ? null : g.boxes.get(g.reference);
|
|
81
|
+
if (!reference)
|
|
82
|
+
return [];
|
|
83
|
+
const moves = [];
|
|
84
|
+
const carried = new Set(g.carried ?? []);
|
|
85
|
+
for (const id of g.targets) {
|
|
86
|
+
if (carried.has(id))
|
|
87
|
+
continue;
|
|
88
|
+
const box = g.boxes.get(id);
|
|
89
|
+
if (!box)
|
|
90
|
+
continue;
|
|
91
|
+
const [du, dv] = alignShift(g.mode, reference, box);
|
|
92
|
+
if (Math.hypot(du, dv) > ALIGNED)
|
|
93
|
+
moves.push({ id, shift: [du, dv] });
|
|
94
|
+
}
|
|
95
|
+
return moves;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=align-boxes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align-boxes.js","sourceRoot":"","sources":["../../src/in-store/align-boxes.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAQ/D,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,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M,EAAE,IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvG;AAED,kDAAkD;AAClD,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAEpG;AAED,kDAAkD;AAClD,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEpH;AAED,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B"}
|
package/dist/in-store/anchor.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
function finiteRoundedLength(value) {
|
|
5
|
+
if (!Number.isFinite(value))
|
|
6
|
+
throw new Error('Length conversion overflow: derived length must be finite');
|
|
7
|
+
// Above this bound decimal rounding itself would overflow. The number's
|
|
8
|
+
// representable precision already exceeds nine decimal places.
|
|
9
|
+
return Math.abs(value) <= Number.MAX_VALUE / 1e9 ? Math.round(value * 1e9) / 1e9 : value;
|
|
10
|
+
}
|
|
4
11
|
/**
|
|
5
12
|
* Convert a metre value to the anchor's native length unit for STEP emit.
|
|
6
13
|
* Rounded to 9 decimals to absorb the float noise the division introduces
|
|
@@ -13,9 +20,11 @@
|
|
|
13
20
|
*/
|
|
14
21
|
export function toNativeLength(anchor, metres) {
|
|
15
22
|
const scale = anchor.lengthUnitScale;
|
|
23
|
+
if (!Number.isFinite(metres))
|
|
24
|
+
throw new Error('Length must be finite');
|
|
16
25
|
if (!scale || !Number.isFinite(scale) || scale <= 0 || scale === 1)
|
|
17
26
|
return metres;
|
|
18
|
-
return
|
|
27
|
+
return finiteRoundedLength(metres / scale);
|
|
19
28
|
}
|
|
20
29
|
/**
|
|
21
30
|
* Inverse of {@link toNativeLength}: convert a value stored in the anchor's
|
|
@@ -28,9 +37,11 @@ export function toNativeLength(anchor, metres) {
|
|
|
28
37
|
*/
|
|
29
38
|
export function fromNativeLength(anchor, native) {
|
|
30
39
|
const scale = anchor.lengthUnitScale;
|
|
40
|
+
if (!Number.isFinite(native))
|
|
41
|
+
throw new Error('Native length must be finite');
|
|
31
42
|
if (!scale || !Number.isFinite(scale) || scale <= 0 || scale === 1)
|
|
32
43
|
return native;
|
|
33
|
-
return
|
|
44
|
+
return finiteRoundedLength(native * scale);
|
|
34
45
|
}
|
|
35
46
|
/** 2D point variant of {@link toNativeLength}. */
|
|
36
47
|
export function toNativePoint2(anchor, p) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.js","sourceRoot":"","sources":["../../src/in-store/anchor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA4D/D;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,MAA8C,EAAE,MAAc;IAC3F,MAAM,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;IACrC,IAAI,CA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M,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5F,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAGD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,iBAAiB,GAAG,yBAAyB,GACpD,eAAe,CAgGjB"}
|
package/dist/in-store/beam.js
CHANGED
|
@@ -18,17 +18,11 @@
|
|
|
18
18
|
* Pure: no I/O, no parser access — operates entirely through the editor.
|
|
19
19
|
*/
|
|
20
20
|
import { generateIfcGuid } from '@ifc-lite/encoding';
|
|
21
|
-
import {
|
|
21
|
+
import { assertFinitePoint3 } from '../ifc-creator-math.js';
|
|
22
|
+
import { linearProfileFrame } from './linear-profile-frame.js';
|
|
22
23
|
import { toNativeLength, toNativePoint3 } from './anchor.js';
|
|
23
24
|
import { emitRectangleProfile, ownerHistoryRef, productGuid } from './_emit-helpers.js';
|
|
24
25
|
import { emitProfileSection, linearSection } from './profile.js';
|
|
25
|
-
/**
|
|
26
|
-
* Stable perpendicular to a beam axis. Mirrors IfcCreator.computeRefDirection.
|
|
27
|
-
*/
|
|
28
|
-
function computeRefDirection(axis) {
|
|
29
|
-
const up = Math.abs(axis[2]) < 0.9 ? [0, 0, 1] : [1, 0, 0];
|
|
30
|
-
return vecNorm(vecCross(up, axis));
|
|
31
|
-
}
|
|
32
26
|
export function addBeamToStore(editor, anchor, params) {
|
|
33
27
|
const { ownerHistoryId, bodyContextId, storeyId, storeyPlacementId } = anchor;
|
|
34
28
|
// A non-finite Start/End coordinate makes the derived beamLen NaN, and
|
|
@@ -45,8 +39,7 @@ export function addBeamToStore(editor, anchor, params) {
|
|
|
45
39
|
throw new Error('addBeamToStore: Start and End must be distinct points');
|
|
46
40
|
}
|
|
47
41
|
const section = linearSection(anchor, params, 'addBeamToStore');
|
|
48
|
-
const dir =
|
|
49
|
-
const refDir = computeRefDirection(dir);
|
|
42
|
+
const { along: dir, u: refDir } = linearProfileFrame(start, end);
|
|
50
43
|
// Placement at Start with local Z along the beam axis.
|
|
51
44
|
const beamOriginPt = editor.addEntity('IfcCartesianPoint', [start]).expressId;
|
|
52
45
|
const axisVec = editor.addEntity('IfcDirection', [dir]).expressId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beam.js","sourceRoot":"","sources":["../../src/in-store/beam.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"beam.js","sourceRoot":"","sources":["../../src/in-store/beam.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAuB,MAAM,cAAc,CA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e,CAAC,MAAM,CAAC,UAAU,CAAC;QAClC,eAAe,CAAC,cAAc,CAAC;QAC/B,IAAI;QACJ,IAAI;QACJ,CAAC,IAAI,MAAM,EAAE,CAAC;QACd,IAAI,QAAQ,EAAE;KACf,CAAC,CAAC,SAAS,CAAC;IAEb,OAAO;QACL,MAAM;QACN,WAAW;QACX,SAAS;QACT,OAAO;QACP,UAAU;QACV,cAAc;QACd,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CopyTransform } from './copy-product.js';
|
|
2
|
+
export interface CopyArrayParams {
|
|
3
|
+
readonly mode: 'linear' | 'polar';
|
|
4
|
+
/** Items including the original, at least two. */
|
|
5
|
+
readonly count: number;
|
|
6
|
+
/** Storey-local direction start (linear) or rotation centre (polar), metres. */
|
|
7
|
+
readonly anchor: readonly [number, number] | null;
|
|
8
|
+
readonly cursor?: readonly [number, number] | null;
|
|
9
|
+
/** Typed linear spacing, or total span with fit; omitted follows cursor. */
|
|
10
|
+
readonly distance?: number | null;
|
|
11
|
+
readonly fit?: boolean;
|
|
12
|
+
/** Polar span in degrees; a full turn excludes the coincident last copy. */
|
|
13
|
+
readonly angleDegrees?: number;
|
|
14
|
+
}
|
|
15
|
+
/** The same placement planner for viewer previews, commits and public arrays (#6232 D5). */
|
|
16
|
+
export declare function arrayCopyTransforms(params: CopyArrayParams): CopyTransform[] | null;
|
|
17
|
+
//# sourceMappingURL=copy-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-array.d.ts","sourceRoot":"","sources":["../../src/in-store/copy-array.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACnD,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,EAAE,GAAG,IAAI,CA4BnF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { finiteCopyFrame, turnThenMove } from './copy-frame.js';
|
|
5
|
+
import { COPY_BATCH_LIMIT } from './copy-batch.js';
|
|
6
|
+
/** The same placement planner for viewer previews, commits and public arrays (#6232 D5). */
|
|
7
|
+
export function arrayCopyTransforms(params) {
|
|
8
|
+
const { mode, count, anchor, cursor } = params;
|
|
9
|
+
if (mode !== 'linear' && mode !== 'polar')
|
|
10
|
+
throw new Error('Unsupported array mode');
|
|
11
|
+
if (!Number.isSafeInteger(count) || count < 2)
|
|
12
|
+
throw new Error('Array count must be an integer of at least two');
|
|
13
|
+
if (count - 1 > COPY_BATCH_LIMIT)
|
|
14
|
+
throw new Error(`An array may contain at most ${COPY_BATCH_LIMIT} new copies`);
|
|
15
|
+
if (!anchor)
|
|
16
|
+
return null;
|
|
17
|
+
if (!anchor.every(Number.isFinite) || (cursor && !cursor.every(Number.isFinite)))
|
|
18
|
+
throw new Error('Array points must contain finite metre coordinates');
|
|
19
|
+
const copies = Array.from({ length: count - 1 }, (_, i) => i + 1);
|
|
20
|
+
if (mode === 'polar') {
|
|
21
|
+
const angle = params.angleDegrees ?? 360;
|
|
22
|
+
if (!Number.isFinite(angle) || angle === 0 || Math.abs(angle) > 360)
|
|
23
|
+
throw new Error('Polar span must be nonzero finite degrees within one turn');
|
|
24
|
+
const step = Math.abs(angle) >= 360 ? (Math.sign(angle) * 360) / count : angle / (count - 1);
|
|
25
|
+
return copies.map((i) => {
|
|
26
|
+
const turn = (step * i * Math.PI) / 180;
|
|
27
|
+
finiteCopyFrame(turnThenMove(turn, anchor, [0, 0, 0]), 'storey-local metres');
|
|
28
|
+
return { turn, pivot: [anchor[0], anchor[1]] };
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!cursor)
|
|
32
|
+
return null;
|
|
33
|
+
const clicked = Math.hypot(cursor[0] - anchor[0], cursor[1] - anchor[1]);
|
|
34
|
+
if (!Number.isFinite(clicked))
|
|
35
|
+
throw new Error('Linear array direction must have finite length');
|
|
36
|
+
if (clicked < 1e-6)
|
|
37
|
+
return null;
|
|
38
|
+
const distance = params.distance ?? clicked;
|
|
39
|
+
if (!Number.isFinite(distance) || distance <= 0)
|
|
40
|
+
throw new Error('Linear array distance must be positive finite metres');
|
|
41
|
+
const ux = (cursor[0] - anchor[0]) / clicked, uy = (cursor[1] - anchor[1]) / clicked;
|
|
42
|
+
const step = params.fit ? distance / (count - 1) : distance;
|
|
43
|
+
if (!Number.isFinite(step * (count - 1)))
|
|
44
|
+
throw new Error('Linear array extent must be finite metres');
|
|
45
|
+
return copies.map((i) => ({ offset: [ux * step * i, uy * step * i, 0] }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=copy-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-array.js","sourceRoot":"","sources":["../../src/in-store/copy-array.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,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C,IAAI,QAAQ,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACzH,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IACrF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACvG,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Shared selection, preview and atomic write for paste, array and Duplicate (#6232 D5). */
|
|
2
|
+
import type { StoreEditor } from '@ifc-lite/mutations';
|
|
3
|
+
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
4
|
+
import { type CopyContext, type CopyProductResult, type CopyTransform } from './copy-product.js';
|
|
5
|
+
import type { DuplicateInStoreOptions } from './duplicate.js';
|
|
6
|
+
/** Bound pruned root fan-out before allocating products/transforms. */
|
|
7
|
+
export declare const COPY_BATCH_LIMIT = 10000;
|
|
8
|
+
/** Keep roots once; their openings, fillings and assembly parts travel with them. */
|
|
9
|
+
export declare function copySourcesInStore(ctx: CopyContext, ids: readonly number[], copyCount?: number): {
|
|
10
|
+
ids: number[];
|
|
11
|
+
} | {
|
|
12
|
+
refusal: string;
|
|
13
|
+
};
|
|
14
|
+
/** Products a copy preview displays, including hosted fillings and assembly parts. */
|
|
15
|
+
export declare function copiedProductsInStore(ctx: CopyContext, ids: readonly number[]): number[];
|
|
16
|
+
export interface CopyBatchOptions {
|
|
17
|
+
/** Duplicate's naming/randomness policy; displacement is supplied by transforms. */
|
|
18
|
+
readonly duplicate?: Pick<DuplicateInStoreOptions, 'name' | 'guidRandom'>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Each transform copies each selected root, in transform-major order. All
|
|
22
|
+
* graph writes succeed together or leave records, journal and allocator intact.
|
|
23
|
+
* The same selection policy is applied at preview and commit: selected hosted
|
|
24
|
+
* children never create a second independent copy.
|
|
25
|
+
*/
|
|
26
|
+
export declare function copyBatchInStore(store: IfcDataStore, editor: StoreEditor, ids: readonly number[], transforms: readonly CopyTransform[], options?: CopyBatchOptions): readonly CopyProductResult[];
|
|
27
|
+
//# sourceMappingURL=copy-batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-batch.d.ts","sourceRoot":"","sources":["../../src/in-store/copy-batch.ts"],"names":[],"mappings":"AAIA,4FAA4F;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAA2E,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC1K,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAG9D,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,SAAI,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CA4BnI;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAYxF;AAED,MAAM,WAAW,gBAAgB;IAC/B,oFAAoF;IACpF,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC;CAC3E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,UAAU,EAAE,SAAS,aAAa,EAAE,EACpC,OAAO,GAAE,gBAAqB,GAC7B,SAAS,iBAAiB,EAAE,CAuB9B"}
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { copyProductInStore, copyRefusal, createCopyContext, productStoreyOrigin } from './copy-product.js';
|
|
5
|
+
import { copiedProductWork, COPY_PRODUCT_WORK_LIMIT } from './copy-dependent-walk.js';
|
|
6
|
+
/** Bound pruned root fan-out before allocating products/transforms. */
|
|
7
|
+
export const COPY_BATCH_LIMIT = 10_000;
|
|
8
|
+
/** Keep roots once; their openings, fillings and assembly parts travel with them. */
|
|
9
|
+
export function copySourcesInStore(ctx, ids, copyCount = 1) {
|
|
10
|
+
const hostOf = new Map();
|
|
11
|
+
for (const [host, openings] of ctx.voids)
|
|
12
|
+
for (const { id } of openings)
|
|
13
|
+
hostOf.set(id, host);
|
|
14
|
+
const chosen = new Set(ids);
|
|
15
|
+
const carried = (id) => {
|
|
16
|
+
const seen = new Set();
|
|
17
|
+
for (let up = id; up !== undefined && !seen.has(up);) {
|
|
18
|
+
seen.add(up);
|
|
19
|
+
up = ctx.partOf.get(up) ?? hostOf.get(ctx.filledBy.get(up) ?? up);
|
|
20
|
+
if (up !== undefined && chosen.has(up))
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
const kept = [...chosen].filter((id) => !carried(id));
|
|
26
|
+
if (!Number.isSafeInteger(copyCount) || copyCount < 1 || kept.length * copyCount > COPY_BATCH_LIMIT)
|
|
27
|
+
return { refusal: `A copy batch may contain at most ${COPY_BATCH_LIMIT} root copies` };
|
|
28
|
+
let productWork = 0;
|
|
29
|
+
for (const id of kept) {
|
|
30
|
+
const refusal = copyRefusal(ctx, id);
|
|
31
|
+
if (refusal)
|
|
32
|
+
return { refusal };
|
|
33
|
+
try {
|
|
34
|
+
productWork += copiedProductWork(ctx, id);
|
|
35
|
+
if (productWork * copyCount > COPY_PRODUCT_WORK_LIMIT)
|
|
36
|
+
return { refusal: `Copy carried products exceed ${COPY_PRODUCT_WORK_LIMIT} product writes` };
|
|
37
|
+
if (!productStoreyOrigin(ctx, id))
|
|
38
|
+
return { refusal: `#${id} has no placement to copy from` };
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return { refusal: error instanceof Error ? error.message : String(error) };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return kept.length > 0 ? { ids: kept } : { refusal: 'Nothing to copy' };
|
|
45
|
+
}
|
|
46
|
+
/** Products a copy preview displays, including hosted fillings and assembly parts. */
|
|
47
|
+
export function copiedProductsInStore(ctx, ids) {
|
|
48
|
+
const shown = new Set();
|
|
49
|
+
const pending = [...ids].reverse();
|
|
50
|
+
while (pending.length > 0) {
|
|
51
|
+
const id = pending.pop();
|
|
52
|
+
if (shown.has(id))
|
|
53
|
+
continue;
|
|
54
|
+
shown.add(id);
|
|
55
|
+
const children = (ctx.voids.get(id) ?? []).flatMap(({ id: opening }) => (ctx.fills.get(opening) ?? []).map(({ id: filling }) => filling));
|
|
56
|
+
children.push(...(ctx.parts.get(id) ?? []).flatMap((link) => link.parts));
|
|
57
|
+
for (let i = children.length - 1; i >= 0; i--)
|
|
58
|
+
pending.push(children[i]);
|
|
59
|
+
}
|
|
60
|
+
return [...shown];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Each transform copies each selected root, in transform-major order. All
|
|
64
|
+
* graph writes succeed together or leave records, journal and allocator intact.
|
|
65
|
+
* The same selection policy is applied at preview and commit: selected hosted
|
|
66
|
+
* children never create a second independent copy.
|
|
67
|
+
*/
|
|
68
|
+
export function copyBatchInStore(store, editor, ids, transforms, options = {}) {
|
|
69
|
+
if (transforms.length > COPY_BATCH_LIMIT)
|
|
70
|
+
throw new Error(`A copy batch may contain at most ${COPY_BATCH_LIMIT} transforms`);
|
|
71
|
+
if (transforms.length === 0)
|
|
72
|
+
throw new Error('At least one copy transform is required');
|
|
73
|
+
for (const transform of transforms) {
|
|
74
|
+
if (transform.offset && (transform.offset.length !== 3 || !transform.offset.every(Number.isFinite)))
|
|
75
|
+
throw new Error('Copy offset must contain three finite metre coordinates');
|
|
76
|
+
if (transform.pivot && (transform.pivot.length !== 2 || !transform.pivot.every(Number.isFinite)))
|
|
77
|
+
throw new Error('Copy pivot must contain two finite metre coordinates');
|
|
78
|
+
if (transform.turn !== undefined && !Number.isFinite(transform.turn))
|
|
79
|
+
throw new Error('Copy turn must be finite radians');
|
|
80
|
+
if (transform.targetStoreyId !== undefined && (!Number.isSafeInteger(transform.targetStoreyId) || transform.targetStoreyId <= 0))
|
|
81
|
+
throw new Error('Copy targetStoreyId must be a positive integer');
|
|
82
|
+
}
|
|
83
|
+
return editor.runAtomic((draft) => {
|
|
84
|
+
const ctx = createCopyContext(store, draft, { guidRandom: options.duplicate?.guidRandom });
|
|
85
|
+
for (const transform of transforms) {
|
|
86
|
+
if (transform.targetStoreyId !== undefined && ctx.read(transform.targetStoreyId)?.type.toUpperCase() !== 'IFCBUILDINGSTOREY')
|
|
87
|
+
throw new Error('Copy targetStoreyId must identify an IfcBuildingStorey in this model');
|
|
88
|
+
}
|
|
89
|
+
const sources = copySourcesInStore(ctx, ids, transforms.length);
|
|
90
|
+
if ('refusal' in sources)
|
|
91
|
+
throw new Error(sources.refusal);
|
|
92
|
+
return transforms.flatMap((transform) => sources.ids.map((id) => {
|
|
93
|
+
if (!options.duplicate)
|
|
94
|
+
return copyProductInStore(ctx, id, transform);
|
|
95
|
+
const sourceName = ctx.read(id)?.attributes[2];
|
|
96
|
+
const name = options.duplicate.name ?? (typeof sourceName === 'string' && sourceName.length > 0 ? `${sourceName} (copy)` : sourceName);
|
|
97
|
+
return copyProductInStore(ctx, id, transform, typeof name === 'string' ? { Name: name } : {});
|
|
98
|
+
}));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=copy-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-batch.js","sourceRoot":"","sources":["../../src/in-store/copy-batch.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAK/D,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAgE,MAAM,mBAAmB,CAAC;AAE1K,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,uEAAuE;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC,qFAAqF;AACrF,MAAM,UAAU,kBAAkB,CAAC,GAAgB,EAAE,GAAsB,EAAE,SAAS,GAAG,CAAC;IACxF,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,CAAC,KAAK;QAAE,KAAK,MAAM,EAAE,EAAE,EAAE,IAAI,QAAQ;YAAE,MAAM,CAAC,GAAG,CA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C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YAC9D,IAAI,CAAC,OAAO,CAAC,SAAS;gBAAE,OAAO,kBAAkB,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YACtE,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACvI,OAAO,kBAAkB,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CopyContext } from './copy-product.js';
|
|
2
|
+
/** Separate from the public 10k root/transform budget. A normal Bonsai wall
|
|
3
|
+
* carries two openings and two fillings: 10k roots remains exactly admissible. */
|
|
4
|
+
export declare const COPY_PRODUCT_WORK_LIMIT = 50000;
|
|
5
|
+
type ProductStep = {
|
|
6
|
+
kind: 'opening' | 'filling' | 'part';
|
|
7
|
+
sourceId: number;
|
|
8
|
+
parentId: number;
|
|
9
|
+
ownerHistory: string | null;
|
|
10
|
+
};
|
|
11
|
+
type AssemblyStep = {
|
|
12
|
+
kind: 'assembly';
|
|
13
|
+
sourceId: number;
|
|
14
|
+
parts: number[];
|
|
15
|
+
ownerHistory: string | null;
|
|
16
|
+
};
|
|
17
|
+
type Step = ProductStep | AssemblyStep;
|
|
18
|
+
/** Iterative depth-first traversal matches the existing product preorder and
|
|
19
|
+
* relation postorder. Assemblies dedupe parts globally; hosted links retain
|
|
20
|
+
* their existing per-host cardinality. Neither deep acyclic graphs nor cycles
|
|
21
|
+
* consume the JavaScript call stack. */
|
|
22
|
+
export declare function copyDependentSteps(ctx: CopyContext, rootId: number): Generator<Step>;
|
|
23
|
+
/** Actual writes, including openings that preview intentionally omits. Stops
|
|
24
|
+
* before writes when fan-out would exceed the separately bounded work budget. */
|
|
25
|
+
export declare function copiedProductWork(ctx: CopyContext, rootId: number): number;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=copy-dependent-walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-dependent-walk.d.ts","sourceRoot":"","sources":["../../src/in-store/copy-dependent-walk.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;kFACkF;AAClF,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAG9C,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC7H,KAAK,YAAY,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AACzG,KAAK,IAAI,GAAG,WAAW,GAAG,YAAY,CAAC;AAGvC;;;wCAGwC;AACxC,wBAAiB,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAoCrF;AAED;iFACiF;AACjF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAK1E"}
|