@pascal-app/core 1.0.3 → 1.0.4

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 (1098) hide show
  1. package/dist/agent-operations/__fixtures__/add-object-cases.d.ts +235 -0
  2. package/dist/agent-operations/__fixtures__/add-object-cases.d.ts.map +1 -0
  3. package/dist/agent-operations/__fixtures__/add-object-cases.js +129 -0
  4. package/dist/agent-operations/__fixtures__/build-room-cases.d.ts +4 -0
  5. package/dist/agent-operations/__fixtures__/build-room-cases.d.ts.map +1 -0
  6. package/dist/agent-operations/__fixtures__/build-room-cases.js +635 -0
  7. package/dist/agent-operations/__fixtures__/cases.d.ts +52 -0
  8. package/dist/agent-operations/__fixtures__/cases.d.ts.map +1 -0
  9. package/dist/agent-operations/__fixtures__/cases.js +689 -0
  10. package/dist/agent-operations/__fixtures__/find-by-type-cases.d.ts +7 -0
  11. package/dist/agent-operations/__fixtures__/find-by-type-cases.d.ts.map +1 -0
  12. package/dist/agent-operations/__fixtures__/find-by-type-cases.js +21 -0
  13. package/dist/agent-operations/__fixtures__/place-items-cases.d.ts +17 -0
  14. package/dist/agent-operations/__fixtures__/place-items-cases.d.ts.map +1 -0
  15. package/dist/agent-operations/__fixtures__/place-items-cases.js +506 -0
  16. package/dist/agent-operations/__fixtures__/room-cases.d.ts +3 -0
  17. package/dist/agent-operations/__fixtures__/room-cases.d.ts.map +1 -0
  18. package/dist/agent-operations/__fixtures__/room-cases.js +338 -0
  19. package/dist/agent-operations/__fixtures__/search-assets-cases.d.ts +5 -0
  20. package/dist/agent-operations/__fixtures__/search-assets-cases.d.ts.map +1 -0
  21. package/dist/agent-operations/__fixtures__/search-assets-cases.js +137 -0
  22. package/dist/agent-operations/__fixtures__/structure-cases.d.ts +6 -0
  23. package/dist/agent-operations/__fixtures__/structure-cases.d.ts.map +1 -0
  24. package/dist/agent-operations/__fixtures__/structure-cases.js +588 -0
  25. package/dist/agent-operations/__fixtures__/verify-scene-cases.d.ts +3 -0
  26. package/dist/agent-operations/__fixtures__/verify-scene-cases.d.ts.map +1 -0
  27. package/dist/agent-operations/__fixtures__/verify-scene-cases.js +302 -0
  28. package/dist/agent-operations/achieved.d.ts +16 -0
  29. package/dist/agent-operations/achieved.d.ts.map +1 -0
  30. package/dist/agent-operations/achieved.js +28 -0
  31. package/dist/agent-operations/add-column.d.ts +23 -0
  32. package/dist/agent-operations/add-column.d.ts.map +1 -0
  33. package/dist/agent-operations/add-column.js +97 -0
  34. package/dist/agent-operations/add-level.d.ts +14 -0
  35. package/dist/agent-operations/add-level.d.ts.map +1 -0
  36. package/dist/agent-operations/add-level.js +94 -0
  37. package/dist/agent-operations/add-object.d.ts +114 -0
  38. package/dist/agent-operations/add-object.d.ts.map +1 -0
  39. package/dist/agent-operations/add-object.js +361 -0
  40. package/dist/agent-operations/add-wall.d.ts +15 -0
  41. package/dist/agent-operations/add-wall.d.ts.map +1 -0
  42. package/dist/agent-operations/add-wall.js +47 -0
  43. package/dist/agent-operations/apply-changes.d.ts +16 -0
  44. package/dist/agent-operations/apply-changes.d.ts.map +1 -0
  45. package/dist/agent-operations/apply-changes.js +93 -0
  46. package/dist/agent-operations/apply-outcome.d.ts +15 -0
  47. package/dist/agent-operations/apply-outcome.d.ts.map +1 -0
  48. package/dist/agent-operations/apply-outcome.js +18 -0
  49. package/dist/agent-operations/collections.d.ts +28 -0
  50. package/dist/agent-operations/collections.d.ts.map +1 -0
  51. package/dist/agent-operations/collections.js +130 -0
  52. package/dist/agent-operations/create-room.d.ts +36 -0
  53. package/dist/agent-operations/create-room.d.ts.map +1 -0
  54. package/dist/agent-operations/create-room.js +177 -0
  55. package/dist/agent-operations/create-stair.d.ts +33 -0
  56. package/dist/agent-operations/create-stair.d.ts.map +1 -0
  57. package/dist/agent-operations/create-stair.js +247 -0
  58. package/dist/agent-operations/delete-node.d.ts +6 -0
  59. package/dist/agent-operations/delete-node.d.ts.map +1 -0
  60. package/dist/agent-operations/delete-node.js +9 -0
  61. package/dist/agent-operations/door-clearance.d.ts +135 -0
  62. package/dist/agent-operations/door-clearance.d.ts.map +1 -0
  63. package/dist/agent-operations/door-clearance.js +334 -0
  64. package/dist/agent-operations/duplicate-level.d.ts +12 -0
  65. package/dist/agent-operations/duplicate-level.d.ts.map +1 -0
  66. package/dist/agent-operations/duplicate-level.js +54 -0
  67. package/dist/agent-operations/find-by-type.d.ts +11 -0
  68. package/dist/agent-operations/find-by-type.d.ts.map +1 -0
  69. package/dist/agent-operations/find-by-type.js +94 -0
  70. package/dist/agent-operations/furnish-room.d.ts +18 -0
  71. package/dist/agent-operations/furnish-room.d.ts.map +1 -0
  72. package/dist/agent-operations/furnish-room.js +259 -0
  73. package/dist/agent-operations/get-node.d.ts +9 -0
  74. package/dist/agent-operations/get-node.d.ts.map +1 -0
  75. package/dist/agent-operations/get-node.js +33 -0
  76. package/dist/agent-operations/hosted-services.d.ts +13 -0
  77. package/dist/agent-operations/hosted-services.d.ts.map +1 -0
  78. package/dist/agent-operations/hosted-services.js +22 -0
  79. package/dist/agent-operations/index.d.ts +277 -0
  80. package/dist/agent-operations/index.d.ts.map +1 -0
  81. package/dist/agent-operations/index.js +80 -0
  82. package/dist/agent-operations/layout-clearance.d.ts +108 -0
  83. package/dist/agent-operations/layout-clearance.d.ts.map +1 -0
  84. package/dist/agent-operations/layout-clearance.js +190 -0
  85. package/dist/agent-operations/level-reads.d.ts +33 -0
  86. package/dist/agent-operations/level-reads.d.ts.map +1 -0
  87. package/dist/agent-operations/level-reads.js +161 -0
  88. package/dist/agent-operations/level-target.d.ts +11 -0
  89. package/dist/agent-operations/level-target.d.ts.map +1 -0
  90. package/dist/agent-operations/level-target.js +29 -0
  91. package/dist/agent-operations/list-levels.d.ts +4 -0
  92. package/dist/agent-operations/list-levels.d.ts.map +1 -0
  93. package/dist/agent-operations/list-levels.js +31 -0
  94. package/dist/agent-operations/material-preset.d.ts +11 -0
  95. package/dist/agent-operations/material-preset.d.ts.map +1 -0
  96. package/dist/agent-operations/material-preset.js +74 -0
  97. package/dist/agent-operations/material-refs.d.ts +24 -0
  98. package/dist/agent-operations/material-refs.d.ts.map +1 -0
  99. package/dist/agent-operations/material-refs.js +100 -0
  100. package/dist/agent-operations/node-patch.d.ts +3 -0
  101. package/dist/agent-operations/node-patch.d.ts.map +1 -0
  102. package/dist/agent-operations/node-patch.js +114 -0
  103. package/dist/agent-operations/paint.d.ts +21 -0
  104. package/dist/agent-operations/paint.d.ts.map +1 -0
  105. package/dist/agent-operations/paint.js +219 -0
  106. package/dist/agent-operations/place-items.d.ts +20 -0
  107. package/dist/agent-operations/place-items.d.ts.map +1 -0
  108. package/dist/agent-operations/place-items.js +226 -0
  109. package/dist/agent-operations/plan-geometry.d.ts +24 -0
  110. package/dist/agent-operations/plan-geometry.d.ts.map +1 -0
  111. package/dist/agent-operations/plan-geometry.js +94 -0
  112. package/dist/agent-operations/room-structure.d.ts +87 -0
  113. package/dist/agent-operations/room-structure.d.ts.map +1 -0
  114. package/dist/agent-operations/room-structure.js +144 -0
  115. package/dist/agent-operations/scene-materials.d.ts +15 -0
  116. package/dist/agent-operations/scene-materials.d.ts.map +1 -0
  117. package/dist/agent-operations/scene-materials.js +62 -0
  118. package/dist/agent-operations/scene-measure.d.ts +73 -0
  119. package/dist/agent-operations/scene-measure.d.ts.map +1 -0
  120. package/dist/agent-operations/scene-measure.js +73 -0
  121. package/dist/agent-operations/scene-queries.d.ts +4510 -0
  122. package/dist/agent-operations/scene-queries.d.ts.map +1 -0
  123. package/dist/agent-operations/scene-queries.js +84 -0
  124. package/dist/agent-operations/scene-view.d.ts +98 -0
  125. package/dist/agent-operations/scene-view.d.ts.map +1 -0
  126. package/dist/agent-operations/scene-view.js +559 -0
  127. package/dist/agent-operations/search-assets.d.ts +14 -0
  128. package/dist/agent-operations/search-assets.d.ts.map +1 -0
  129. package/dist/agent-operations/search-assets.js +42 -0
  130. package/dist/agent-operations/search-materials.d.ts +12 -0
  131. package/dist/agent-operations/search-materials.d.ts.map +1 -0
  132. package/dist/agent-operations/search-materials.js +111 -0
  133. package/dist/agent-operations/stairs.d.ts +5 -0
  134. package/dist/agent-operations/stairs.d.ts.map +1 -0
  135. package/dist/agent-operations/stairs.js +70 -0
  136. package/dist/agent-operations/types.d.ts +59 -0
  137. package/dist/agent-operations/types.d.ts.map +1 -0
  138. package/dist/agent-operations/types.js +1 -0
  139. package/dist/agent-operations/verify-scene.d.ts +50 -0
  140. package/dist/agent-operations/verify-scene.d.ts.map +1 -0
  141. package/dist/agent-operations/verify-scene.js +369 -0
  142. package/dist/agent-operations/wall-opening.d.ts +65 -0
  143. package/dist/agent-operations/wall-opening.d.ts.map +1 -0
  144. package/dist/agent-operations/wall-opening.js +55 -0
  145. package/dist/agent-tools/achieved.d.ts +9 -0
  146. package/dist/agent-tools/achieved.d.ts.map +1 -0
  147. package/dist/agent-tools/achieved.js +8 -0
  148. package/dist/agent-tools/add-object.d.ts +43 -0
  149. package/dist/agent-tools/add-object.d.ts.map +1 -0
  150. package/dist/agent-tools/add-object.js +86 -0
  151. package/dist/agent-tools/assets.d.ts +13 -0
  152. package/dist/agent-tools/assets.d.ts.map +1 -0
  153. package/dist/agent-tools/assets.js +18 -0
  154. package/dist/agent-tools/clear-scene.d.ts +10 -0
  155. package/dist/agent-tools/clear-scene.d.ts.map +1 -0
  156. package/dist/agent-tools/clear-scene.js +9 -0
  157. package/dist/agent-tools/collections.d.ts +35 -0
  158. package/dist/agent-tools/collections.d.ts.map +1 -0
  159. package/dist/agent-tools/collections.js +31 -0
  160. package/dist/agent-tools/columns.d.ts +44 -0
  161. package/dist/agent-tools/columns.d.ts.map +1 -0
  162. package/dist/agent-tools/columns.js +59 -0
  163. package/dist/agent-tools/contract.d.ts +68 -0
  164. package/dist/agent-tools/contract.d.ts.map +1 -0
  165. package/dist/agent-tools/contract.js +1 -0
  166. package/dist/agent-tools/create-room.d.ts +63 -0
  167. package/dist/agent-tools/create-room.d.ts.map +1 -0
  168. package/dist/agent-tools/create-room.js +90 -0
  169. package/dist/agent-tools/find-by-type.d.ts +11 -0
  170. package/dist/agent-tools/find-by-type.d.ts.map +1 -0
  171. package/dist/agent-tools/find-by-type.js +14 -0
  172. package/dist/agent-tools/furnish-room.d.ts +26 -0
  173. package/dist/agent-tools/furnish-room.d.ts.map +1 -0
  174. package/dist/agent-tools/furnish-room.js +35 -0
  175. package/dist/agent-tools/hosted-services.d.ts +402 -0
  176. package/dist/agent-tools/hosted-services.d.ts.map +1 -0
  177. package/dist/agent-tools/hosted-services.js +148 -0
  178. package/dist/agent-tools/index.d.ts +864 -0
  179. package/dist/agent-tools/index.d.ts.map +1 -0
  180. package/dist/agent-tools/index.js +82 -0
  181. package/dist/agent-tools/levels.d.ts +72 -0
  182. package/dist/agent-tools/levels.d.ts.map +1 -0
  183. package/dist/agent-tools/levels.js +76 -0
  184. package/dist/agent-tools/measurement.d.ts +37 -0
  185. package/dist/agent-tools/measurement.d.ts.map +1 -0
  186. package/dist/agent-tools/measurement.js +94 -0
  187. package/dist/agent-tools/node-id.d.ts +3 -0
  188. package/dist/agent-tools/node-id.d.ts.map +1 -0
  189. package/dist/agent-tools/node-id.js +2 -0
  190. package/dist/agent-tools/nodes.d.ts +17 -0
  191. package/dist/agent-tools/nodes.d.ts.map +1 -0
  192. package/dist/agent-tools/nodes.js +13 -0
  193. package/dist/agent-tools/paint.d.ts +46 -0
  194. package/dist/agent-tools/paint.d.ts.map +1 -0
  195. package/dist/agent-tools/paint.js +29 -0
  196. package/dist/agent-tools/place-items.d.ts +19 -0
  197. package/dist/agent-tools/place-items.d.ts.map +1 -0
  198. package/dist/agent-tools/place-items.js +29 -0
  199. package/dist/agent-tools/refusal.d.ts +20 -0
  200. package/dist/agent-tools/refusal.d.ts.map +1 -0
  201. package/dist/agent-tools/refusal.js +29 -0
  202. package/dist/agent-tools/room-structure.d.ts +438 -0
  203. package/dist/agent-tools/room-structure.d.ts.map +1 -0
  204. package/dist/agent-tools/room-structure.js +207 -0
  205. package/dist/agent-tools/search-materials.d.ts +20 -0
  206. package/dist/agent-tools/search-materials.d.ts.map +1 -0
  207. package/dist/agent-tools/search-materials.js +32 -0
  208. package/dist/agent-tools/stairs.d.ts +86 -0
  209. package/dist/agent-tools/stairs.d.ts.map +1 -0
  210. package/dist/agent-tools/stairs.js +103 -0
  211. package/dist/agent-tools/verify-scene.d.ts +13 -0
  212. package/dist/agent-tools/verify-scene.d.ts.map +1 -0
  213. package/dist/agent-tools/verify-scene.js +21 -0
  214. package/dist/agent-tools/view-scene.d.ts +43 -0
  215. package/dist/agent-tools/view-scene.d.ts.map +1 -0
  216. package/dist/agent-tools/view-scene.js +80 -0
  217. package/dist/agent-tools/wall-openings.d.ts +163 -0
  218. package/dist/agent-tools/wall-openings.d.ts.map +1 -0
  219. package/dist/agent-tools/wall-openings.js +144 -0
  220. package/dist/agent-tools/walls.d.ts +21 -0
  221. package/dist/agent-tools/walls.d.ts.map +1 -0
  222. package/dist/agent-tools/walls.js +30 -0
  223. package/dist/agent-tools/write-target.d.ts +12 -0
  224. package/dist/agent-tools/write-target.d.ts.map +1 -0
  225. package/dist/agent-tools/write-target.js +10 -0
  226. package/dist/building/__fixtures__/wall-opening-cases.d.ts +736 -0
  227. package/dist/building/__fixtures__/wall-opening-cases.d.ts.map +1 -0
  228. package/dist/building/__fixtures__/wall-opening-cases.js +307 -0
  229. package/dist/building/door-types.d.ts +22 -0
  230. package/dist/building/door-types.d.ts.map +1 -0
  231. package/dist/building/door-types.js +167 -0
  232. package/dist/building/floor-item-fit.d.ts +38 -0
  233. package/dist/building/floor-item-fit.d.ts.map +1 -0
  234. package/dist/building/floor-item-fit.js +47 -0
  235. package/dist/building/index.d.ts +7 -0
  236. package/dist/building/index.d.ts.map +1 -0
  237. package/dist/building/index.js +6 -0
  238. package/dist/building/level-duplication.d.ts +8983 -0
  239. package/dist/building/level-duplication.d.ts.map +1 -0
  240. package/dist/building/level-duplication.js +314 -0
  241. package/dist/building/opening-style-presets.d.ts +46 -0
  242. package/dist/building/opening-style-presets.d.ts.map +1 -0
  243. package/dist/building/opening-style-presets.js +195 -0
  244. package/dist/building/wall-openings.d.ts +445 -0
  245. package/dist/building/wall-openings.d.ts.map +1 -0
  246. package/dist/building/wall-openings.js +231 -0
  247. package/dist/building/window-types.d.ts +17 -0
  248. package/dist/building/window-types.d.ts.map +1 -0
  249. package/dist/building/window-types.js +31 -0
  250. package/dist/commands/structure/apply-zone-transform.d.ts +23 -0
  251. package/dist/commands/structure/apply-zone-transform.d.ts.map +1 -0
  252. package/dist/commands/structure/apply-zone-transform.js +55 -0
  253. package/dist/commands/structure/create-mezzanine.d.ts +12 -0
  254. package/dist/commands/structure/create-mezzanine.d.ts.map +1 -0
  255. package/dist/commands/structure/create-mezzanine.js +46 -0
  256. package/dist/commands/structure/create-zone.d.ts +32 -0
  257. package/dist/commands/structure/create-zone.d.ts.map +1 -0
  258. package/dist/commands/structure/create-zone.js +126 -0
  259. package/dist/commands/structure/delete-zone.d.ts +51 -0
  260. package/dist/commands/structure/delete-zone.d.ts.map +1 -0
  261. package/dist/commands/structure/delete-zone.js +354 -0
  262. package/dist/commands/structure/divide-zone.d.ts +38 -0
  263. package/dist/commands/structure/divide-zone.d.ts.map +1 -0
  264. package/dist/commands/structure/divide-zone.js +186 -0
  265. package/dist/commands/structure/duplicate-zone.d.ts +7 -0
  266. package/dist/commands/structure/duplicate-zone.d.ts.map +1 -0
  267. package/dist/commands/structure/duplicate-zone.js +21 -0
  268. package/dist/commands/structure/floor-opening.d.ts +36 -0
  269. package/dist/commands/structure/floor-opening.d.ts.map +1 -0
  270. package/dist/commands/structure/floor-opening.js +124 -0
  271. package/dist/commands/structure/index.d.ts +22 -0
  272. package/dist/commands/structure/index.d.ts.map +1 -0
  273. package/dist/commands/structure/index.js +20 -0
  274. package/dist/commands/structure/lock-outside-faces.d.ts +12 -0
  275. package/dist/commands/structure/lock-outside-faces.d.ts.map +1 -0
  276. package/dist/commands/structure/lock-outside-faces.js +32 -0
  277. package/dist/commands/structure/merge-zones.d.ts +5 -0
  278. package/dist/commands/structure/merge-zones.d.ts.map +1 -0
  279. package/dist/commands/structure/merge-zones.js +22 -0
  280. package/dist/commands/structure/mezzanine-content.d.ts +16 -0
  281. package/dist/commands/structure/mezzanine-content.d.ts.map +1 -0
  282. package/dist/commands/structure/mezzanine-content.js +109 -0
  283. package/dist/commands/structure/plan-mezzanine-stair.d.ts +7 -0
  284. package/dist/commands/structure/plan-mezzanine-stair.d.ts.map +1 -0
  285. package/dist/commands/structure/plan-mezzanine-stair.js +127 -0
  286. package/dist/commands/structure/plan-wall-deletion.d.ts +9 -0
  287. package/dist/commands/structure/plan-wall-deletion.d.ts.map +1 -0
  288. package/dist/commands/structure/plan-wall-deletion.js +151 -0
  289. package/dist/commands/structure/rebase-floor-reference.d.ts +7 -0
  290. package/dist/commands/structure/rebase-floor-reference.d.ts.map +1 -0
  291. package/dist/commands/structure/rebase-floor-reference.js +90 -0
  292. package/dist/commands/structure/resize-mezzanine.d.ts +8 -0
  293. package/dist/commands/structure/resize-mezzanine.d.ts.map +1 -0
  294. package/dist/commands/structure/resize-mezzanine.js +43 -0
  295. package/dist/commands/structure/rotate-zone.d.ts +8 -0
  296. package/dist/commands/structure/rotate-zone.d.ts.map +1 -0
  297. package/dist/commands/structure/rotate-zone.js +28 -0
  298. package/dist/commands/structure/set-floor-foundation.d.ts +62 -0
  299. package/dist/commands/structure/set-floor-foundation.d.ts.map +1 -0
  300. package/dist/commands/structure/set-floor-foundation.js +162 -0
  301. package/dist/commands/structure/set-room-floor-construction.d.ts +8 -0
  302. package/dist/commands/structure/set-room-floor-construction.d.ts.map +1 -0
  303. package/dist/commands/structure/set-room-floor-construction.js +72 -0
  304. package/dist/commands/structure/set-wall-geometry.d.ts +10 -0
  305. package/dist/commands/structure/set-wall-geometry.d.ts.map +1 -0
  306. package/dist/commands/structure/set-wall-geometry.js +52 -0
  307. package/dist/commands/structure/set-zone-edges.d.ts +14 -0
  308. package/dist/commands/structure/set-zone-edges.d.ts.map +1 -0
  309. package/dist/commands/structure/set-zone-edges.js +143 -0
  310. package/dist/commands/structure/set-zone-intent.d.ts +39 -0
  311. package/dist/commands/structure/set-zone-intent.d.ts.map +1 -0
  312. package/dist/commands/structure/set-zone-intent.js +125 -0
  313. package/dist/commands/structure/shared.d.ts +4512 -0
  314. package/dist/commands/structure/shared.d.ts.map +1 -0
  315. package/dist/commands/structure/shared.js +102 -0
  316. package/dist/commands/structure/transform-zone.d.ts +23 -0
  317. package/dist/commands/structure/transform-zone.d.ts.map +1 -0
  318. package/dist/commands/structure/transform-zone.js +472 -0
  319. package/dist/commands/structure/validate-mezzanine.d.ts +5 -0
  320. package/dist/commands/structure/validate-mezzanine.d.ts.map +1 -0
  321. package/dist/commands/structure/validate-mezzanine.js +46 -0
  322. package/dist/commands/structure/zone-crossings.d.ts +8 -0
  323. package/dist/commands/structure/zone-crossings.d.ts.map +1 -0
  324. package/dist/commands/structure/zone-crossings.js +162 -0
  325. package/dist/commands/structure/zone-drop.d.ts +4 -0
  326. package/dist/commands/structure/zone-drop.d.ts.map +1 -0
  327. package/dist/commands/structure/zone-drop.js +68 -0
  328. package/dist/commands/structure/zone-insertion.d.ts +4 -0
  329. package/dist/commands/structure/zone-insertion.d.ts.map +1 -0
  330. package/dist/commands/structure/zone-insertion.js +200 -0
  331. package/dist/commands/structure/zone-transform-content.d.ts +6 -0
  332. package/dist/commands/structure/zone-transform-content.d.ts.map +1 -0
  333. package/dist/commands/structure/zone-transform-content.js +117 -0
  334. package/dist/commands/structure/zone-wall-merge.d.ts +4977 -0
  335. package/dist/commands/structure/zone-wall-merge.d.ts.map +1 -0
  336. package/dist/commands/structure/zone-wall-merge.js +135 -0
  337. package/dist/contracts/reference-discovery.d.ts +18 -0
  338. package/dist/contracts/reference-discovery.d.ts.map +1 -0
  339. package/dist/contracts/reference-discovery.js +100 -0
  340. package/dist/contracts/reference-inventory.d.ts +44 -0
  341. package/dist/contracts/reference-inventory.d.ts.map +1 -0
  342. package/dist/contracts/reference-inventory.js +872 -0
  343. package/dist/events/bus.d.ts +70 -9
  344. package/dist/events/bus.d.ts.map +1 -1
  345. package/dist/hooks/scene-registry/item-clip-registry.d.ts +6 -3
  346. package/dist/hooks/scene-registry/item-clip-registry.d.ts.map +1 -1
  347. package/dist/hooks/scene-registry/item-clip-registry.js +2 -1
  348. package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
  349. package/dist/hooks/spatial-grid/floor-placed-elevation.js +15 -1
  350. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +3 -2
  351. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
  352. package/dist/hooks/spatial-grid/spatial-grid-manager.js +53 -66
  353. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +1612 -127
  354. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
  355. package/dist/hooks/spatial-grid/spatial-grid-sync.js +86 -83
  356. package/dist/hooks/spatial-grid/support-host-patch.d.ts +1 -0
  357. package/dist/hooks/spatial-grid/support-host-patch.d.ts.map +1 -1
  358. package/dist/hooks/spatial-grid/support-host-patch.js +12 -5
  359. package/dist/index.d.ts +80 -13
  360. package/dist/index.d.ts.map +1 -1
  361. package/dist/index.js +75 -11
  362. package/dist/lib/__bench__/near-linear-walls.d.ts +2 -0
  363. package/dist/lib/__bench__/near-linear-walls.d.ts.map +1 -0
  364. package/dist/lib/__bench__/near-linear-walls.js +24 -0
  365. package/dist/lib/__bench__/structure-preview.bench.d.ts +2 -0
  366. package/dist/lib/__bench__/structure-preview.bench.d.ts.map +1 -0
  367. package/dist/lib/__bench__/structure-preview.bench.js +72 -0
  368. package/dist/lib/__fixtures__/mezzanine.d.ts +13968 -0
  369. package/dist/lib/__fixtures__/mezzanine.d.ts.map +1 -0
  370. package/dist/lib/__fixtures__/mezzanine.js +43 -0
  371. package/dist/lib/absorb-wall-separators.d.ts +4483 -0
  372. package/dist/lib/absorb-wall-separators.d.ts.map +1 -0
  373. package/dist/lib/absorb-wall-separators.js +65 -0
  374. package/dist/lib/angle-accumulator.d.ts +3 -0
  375. package/dist/lib/angle-accumulator.d.ts.map +1 -0
  376. package/dist/lib/angle-accumulator.js +13 -0
  377. package/dist/lib/artifact-store.d.ts +31 -0
  378. package/dist/lib/artifact-store.d.ts.map +1 -0
  379. package/dist/lib/artifact-store.js +42 -0
  380. package/dist/lib/assembly-stack.d.ts +54 -0
  381. package/dist/lib/assembly-stack.d.ts.map +1 -0
  382. package/dist/lib/assembly-stack.js +52 -0
  383. package/dist/lib/asset-storage.d.ts.map +1 -1
  384. package/dist/lib/asset-storage.js +3 -0
  385. package/dist/lib/canonical-opening-ring.d.ts +3 -0
  386. package/dist/lib/canonical-opening-ring.d.ts.map +1 -0
  387. package/dist/lib/canonical-opening-ring.js +14 -0
  388. package/dist/lib/ceiling-children.d.ts +8 -0
  389. package/dist/lib/ceiling-children.d.ts.map +1 -0
  390. package/dist/lib/ceiling-children.js +36 -0
  391. package/dist/lib/ceiling-surface.d.ts +40 -0
  392. package/dist/lib/ceiling-surface.d.ts.map +1 -0
  393. package/dist/lib/ceiling-surface.js +65 -0
  394. package/dist/lib/cutter-host.d.ts +5 -0
  395. package/dist/lib/cutter-host.d.ts.map +1 -0
  396. package/dist/lib/cutter-host.js +30 -0
  397. package/dist/lib/floor-construction-lift.d.ts +4 -0
  398. package/dist/lib/floor-construction-lift.d.ts.map +1 -0
  399. package/dist/lib/floor-construction-lift.js +54 -0
  400. package/dist/lib/floor-footprint-key.d.ts +3 -0
  401. package/dist/lib/floor-footprint-key.d.ts.map +1 -0
  402. package/dist/lib/floor-footprint-key.js +9 -0
  403. package/dist/lib/floor-footprint-name.d.ts +11 -0
  404. package/dist/lib/floor-footprint-name.d.ts.map +1 -0
  405. package/dist/lib/floor-footprint-name.js +52 -0
  406. package/dist/lib/floor-foundation-datum.d.ts +31 -0
  407. package/dist/lib/floor-foundation-datum.d.ts.map +1 -0
  408. package/dist/lib/floor-foundation-datum.js +226 -0
  409. package/dist/lib/floor-foundation-stack.d.ts +16 -0
  410. package/dist/lib/floor-foundation-stack.d.ts.map +1 -0
  411. package/dist/lib/floor-foundation-stack.js +214 -0
  412. package/dist/lib/floor-intent-changes.d.ts +10 -0
  413. package/dist/lib/floor-intent-changes.d.ts.map +1 -0
  414. package/dist/lib/floor-intent-changes.js +461 -0
  415. package/dist/lib/floor-opening-footprints.d.ts +24 -0
  416. package/dist/lib/floor-opening-footprints.d.ts.map +1 -0
  417. package/dist/lib/floor-opening-footprints.js +127 -0
  418. package/dist/lib/floor-opening-intent.d.ts +16 -0
  419. package/dist/lib/floor-opening-intent.d.ts.map +1 -0
  420. package/dist/lib/floor-opening-intent.js +82 -0
  421. package/dist/lib/floor-plate-id.d.ts +5 -0
  422. package/dist/lib/floor-plate-id.d.ts.map +1 -0
  423. package/dist/lib/floor-plate-id.js +20 -0
  424. package/dist/lib/floor-plate-paint.d.ts +8 -0
  425. package/dist/lib/floor-plate-paint.d.ts.map +1 -0
  426. package/dist/lib/floor-plate-paint.js +11 -0
  427. package/dist/lib/floor-plates.d.ts +211 -0
  428. package/dist/lib/floor-plates.d.ts.map +1 -0
  429. package/dist/lib/floor-plates.js +729 -0
  430. package/dist/lib/floor-room-faces.d.ts +5 -0
  431. package/dist/lib/floor-room-faces.d.ts.map +1 -0
  432. package/dist/lib/floor-room-faces.js +29 -0
  433. package/dist/lib/floor-step-finish.d.ts +49 -0
  434. package/dist/lib/floor-step-finish.d.ts.map +1 -0
  435. package/dist/lib/floor-step-finish.js +128 -0
  436. package/dist/lib/geometry-script-node.d.ts +82 -0
  437. package/dist/lib/geometry-script-node.d.ts.map +1 -0
  438. package/dist/lib/geometry-script-node.js +147 -0
  439. package/dist/lib/geometry-surfaces.d.ts +61 -0
  440. package/dist/lib/geometry-surfaces.d.ts.map +1 -0
  441. package/dist/lib/geometry-surfaces.js +156 -0
  442. package/dist/lib/item-slab-support.d.ts +14 -0
  443. package/dist/lib/item-slab-support.d.ts.map +1 -0
  444. package/dist/lib/item-slab-support.js +40 -0
  445. package/dist/lib/level-footprints.d.ts +23 -0
  446. package/dist/lib/level-footprints.d.ts.map +1 -0
  447. package/dist/lib/level-footprints.js +398 -0
  448. package/dist/lib/level-name.d.ts +7 -0
  449. package/dist/lib/level-name.d.ts.map +1 -1
  450. package/dist/lib/level-name.js +11 -3
  451. package/dist/lib/new-zone.d.ts +10 -0
  452. package/dist/lib/new-zone.d.ts.map +1 -0
  453. package/dist/lib/new-zone.js +10 -0
  454. package/dist/lib/node-ancestry.d.ts +30 -0
  455. package/dist/lib/node-ancestry.d.ts.map +1 -0
  456. package/dist/lib/node-ancestry.js +76 -0
  457. package/dist/lib/object-cuts.d.ts +11 -0
  458. package/dist/lib/object-cuts.d.ts.map +1 -0
  459. package/dist/lib/object-cuts.js +63 -0
  460. package/dist/lib/opening-floor-datum.d.ts +24 -0
  461. package/dist/lib/opening-floor-datum.d.ts.map +1 -0
  462. package/dist/lib/opening-floor-datum.js +145 -0
  463. package/dist/lib/own-floor-intent.d.ts +15 -0
  464. package/dist/lib/own-floor-intent.d.ts.map +1 -0
  465. package/dist/lib/own-floor-intent.js +201 -0
  466. package/dist/lib/plate-reference.d.ts +3 -0
  467. package/dist/lib/plate-reference.d.ts.map +1 -0
  468. package/dist/lib/plate-reference.js +91 -0
  469. package/dist/lib/plate-surface.d.ts +120 -0
  470. package/dist/lib/plate-surface.d.ts.map +1 -0
  471. package/dist/lib/plate-surface.js +725 -0
  472. package/dist/lib/polygon-boolean.d.ts +17 -0
  473. package/dist/lib/polygon-boolean.d.ts.map +1 -0
  474. package/dist/lib/polygon-boolean.js +195 -0
  475. package/dist/lib/polygon-label.d.ts +7 -0
  476. package/dist/lib/polygon-label.d.ts.map +1 -0
  477. package/dist/lib/polygon-label.js +94 -0
  478. package/dist/lib/room-drawn-floor.d.ts +29 -0
  479. package/dist/lib/room-drawn-floor.d.ts.map +1 -0
  480. package/dist/lib/room-drawn-floor.js +88 -0
  481. package/dist/lib/room-floor-choices.d.ts +11 -0
  482. package/dist/lib/room-floor-choices.d.ts.map +1 -0
  483. package/dist/lib/room-floor-choices.js +60 -0
  484. package/dist/lib/room-floor-feasibility.d.ts +25 -0
  485. package/dist/lib/room-floor-feasibility.d.ts.map +1 -0
  486. package/dist/lib/room-floor-feasibility.js +293 -0
  487. package/dist/lib/room-floor-plate.d.ts +3 -0
  488. package/dist/lib/room-floor-plate.d.ts.map +1 -0
  489. package/dist/lib/room-floor-plate.js +4 -0
  490. package/dist/lib/room-graph.d.ts +79 -0
  491. package/dist/lib/room-graph.d.ts.map +1 -0
  492. package/dist/lib/room-graph.js +1265 -0
  493. package/dist/lib/room-name.d.ts +10 -0
  494. package/dist/lib/room-name.d.ts.map +1 -0
  495. package/dist/lib/room-name.js +22 -0
  496. package/dist/lib/room-topology-index.d.ts +53 -5
  497. package/dist/lib/room-topology-index.d.ts.map +1 -1
  498. package/dist/lib/room-topology-index.js +176 -30
  499. package/dist/lib/room-vertical-placement.d.ts +12 -0
  500. package/dist/lib/room-vertical-placement.d.ts.map +1 -0
  501. package/dist/lib/room-vertical-placement.js +28 -0
  502. package/dist/lib/room-zone-adoption.d.ts +74 -0
  503. package/dist/lib/room-zone-adoption.d.ts.map +1 -0
  504. package/dist/lib/room-zone-adoption.js +150 -0
  505. package/dist/lib/setback-envelope.d.ts +73 -0
  506. package/dist/lib/setback-envelope.d.ts.map +1 -0
  507. package/dist/lib/setback-envelope.js +506 -0
  508. package/dist/lib/slab-polygon.d.ts.map +1 -1
  509. package/dist/lib/slab-polygon.js +33 -12
  510. package/dist/lib/slots.d.ts +20 -0
  511. package/dist/lib/slots.d.ts.map +1 -1
  512. package/dist/lib/slots.js +44 -0
  513. package/dist/lib/space-detection.d.ts +14 -94
  514. package/dist/lib/space-detection.d.ts.map +1 -1
  515. package/dist/lib/space-detection.js +244 -1616
  516. package/dist/lib/structure-commit.d.ts +38 -0
  517. package/dist/lib/structure-commit.d.ts.map +1 -0
  518. package/dist/lib/structure-commit.js +52 -0
  519. package/dist/lib/structure-kernel.d.ts +66 -0
  520. package/dist/lib/structure-kernel.d.ts.map +1 -0
  521. package/dist/lib/structure-kernel.js +735 -0
  522. package/dist/lib/structure-reconcile.d.ts +15 -0
  523. package/dist/lib/structure-reconcile.d.ts.map +1 -0
  524. package/dist/lib/structure-reconcile.js +218 -0
  525. package/dist/lib/terrain-contours.d.ts +29 -0
  526. package/dist/lib/terrain-contours.d.ts.map +1 -0
  527. package/dist/lib/terrain-contours.js +199 -0
  528. package/dist/lib/terrain-source-persisted.d.ts +42 -0
  529. package/dist/lib/terrain-source-persisted.d.ts.map +1 -0
  530. package/dist/lib/terrain-source-persisted.js +68 -0
  531. package/dist/lib/terrain-source.d.ts +2 -40
  532. package/dist/lib/terrain-source.d.ts.map +1 -1
  533. package/dist/lib/terrain-source.js +2 -68
  534. package/dist/lib/terrain-support-query.d.ts +83 -0
  535. package/dist/lib/terrain-support-query.d.ts.map +1 -0
  536. package/dist/lib/terrain-support-query.js +187 -0
  537. package/dist/lib/terrain-support.d.ts +1 -77
  538. package/dist/lib/terrain-support.d.ts.map +1 -1
  539. package/dist/lib/terrain-support.js +3 -181
  540. package/dist/lib/unit-containment.js +2 -2
  541. package/dist/lib/unit-report.d.ts.map +1 -1
  542. package/dist/lib/unit-report.js +5 -4
  543. package/dist/lib/zone-colors.d.ts +11 -0
  544. package/dist/lib/zone-colors.d.ts.map +1 -0
  545. package/dist/lib/zone-colors.js +32 -0
  546. package/dist/lib/zone-quantities.d.ts.map +1 -1
  547. package/dist/lib/zone-quantities.js +113 -223
  548. package/dist/material-library.d.ts +9 -1
  549. package/dist/material-library.d.ts.map +1 -1
  550. package/dist/material-library.js +550 -1
  551. package/dist/node-slots/block.d.ts +7 -0
  552. package/dist/node-slots/block.d.ts.map +1 -0
  553. package/dist/node-slots/block.js +27 -0
  554. package/dist/node-slots/cabinet.d.ts +4 -0
  555. package/dist/node-slots/cabinet.d.ts.map +1 -0
  556. package/dist/node-slots/cabinet.js +24 -0
  557. package/dist/node-slots/ceiling.d.ts +6 -0
  558. package/dist/node-slots/ceiling.d.ts.map +1 -0
  559. package/dist/node-slots/ceiling.js +7 -0
  560. package/dist/node-slots/column.d.ts +9 -0
  561. package/dist/node-slots/column.d.ts.map +1 -0
  562. package/dist/node-slots/column.js +24 -0
  563. package/dist/node-slots/door.d.ts +9 -0
  564. package/dist/node-slots/door.d.ts.map +1 -0
  565. package/dist/node-slots/door.js +20 -0
  566. package/dist/node-slots/duct.d.ts +5 -0
  567. package/dist/node-slots/duct.d.ts.map +1 -0
  568. package/dist/node-slots/duct.js +5 -0
  569. package/dist/node-slots/elevator.d.ts +9 -0
  570. package/dist/node-slots/elevator.d.ts.map +1 -0
  571. package/dist/node-slots/elevator.js +17 -0
  572. package/dist/node-slots/fence.d.ts +10 -0
  573. package/dist/node-slots/fence.d.ts.map +1 -0
  574. package/dist/node-slots/fence.js +23 -0
  575. package/dist/node-slots/index.d.ts +25 -0
  576. package/dist/node-slots/index.d.ts.map +1 -0
  577. package/dist/node-slots/index.js +92 -0
  578. package/dist/node-slots/lean-to-extension.d.ts +5 -0
  579. package/dist/node-slots/lean-to-extension.d.ts.map +1 -0
  580. package/dist/node-slots/lean-to-extension.js +15 -0
  581. package/dist/node-slots/procedural-item.d.ts +4 -0
  582. package/dist/node-slots/procedural-item.d.ts.map +1 -0
  583. package/dist/node-slots/procedural-item.js +3 -0
  584. package/dist/node-slots/roof-accessories.d.ts +9 -0
  585. package/dist/node-slots/roof-accessories.d.ts.map +1 -0
  586. package/dist/node-slots/roof-accessories.js +34 -0
  587. package/dist/node-slots/shelf.d.ts +9 -0
  588. package/dist/node-slots/shelf.d.ts.map +1 -0
  589. package/dist/node-slots/shelf.js +30 -0
  590. package/dist/node-slots/slab.d.ts +7 -0
  591. package/dist/node-slots/slab.d.ts.map +1 -0
  592. package/dist/node-slots/slab.js +21 -0
  593. package/dist/node-slots/stair.d.ts +8 -0
  594. package/dist/node-slots/stair.d.ts.map +1 -0
  595. package/dist/node-slots/stair.js +17 -0
  596. package/dist/node-slots/wall.d.ts +12 -0
  597. package/dist/node-slots/wall.d.ts.map +1 -0
  598. package/dist/node-slots/wall.js +55 -0
  599. package/dist/node-slots/window.d.ts +5 -0
  600. package/dist/node-slots/window.d.ts.map +1 -0
  601. package/dist/node-slots/window.js +11 -0
  602. package/dist/procedural-items/design-placement.d.ts +49 -0
  603. package/dist/procedural-items/design-placement.d.ts.map +1 -0
  604. package/dist/procedural-items/design-placement.js +129 -0
  605. package/dist/procedural-items/design.d.ts +261 -0
  606. package/dist/procedural-items/design.d.ts.map +1 -0
  607. package/dist/procedural-items/design.js +707 -0
  608. package/dist/procedural-items/fixtures.d.ts +464 -24
  609. package/dist/procedural-items/fixtures.d.ts.map +1 -1
  610. package/dist/procedural-items/index.d.ts +5 -0
  611. package/dist/procedural-items/index.d.ts.map +1 -1
  612. package/dist/procedural-items/index.js +5 -0
  613. package/dist/procedural-items/integration.d.ts +127 -6
  614. package/dist/procedural-items/integration.d.ts.map +1 -1
  615. package/dist/procedural-items/joints.d.ts +56 -0
  616. package/dist/procedural-items/joints.d.ts.map +1 -0
  617. package/dist/procedural-items/joints.js +251 -0
  618. package/dist/procedural-items/library-colors.d.ts +12 -0
  619. package/dist/procedural-items/library-colors.d.ts.map +1 -1
  620. package/dist/procedural-items/library-colors.js +37 -3
  621. package/dist/procedural-items/motion-controller.d.ts +29 -0
  622. package/dist/procedural-items/motion-controller.d.ts.map +1 -0
  623. package/dist/procedural-items/motion-controller.js +130 -0
  624. package/dist/procedural-items/node.d.ts +490 -24
  625. package/dist/procedural-items/node.d.ts.map +1 -1
  626. package/dist/procedural-items/query.d.ts +18 -1
  627. package/dist/procedural-items/query.d.ts.map +1 -1
  628. package/dist/procedural-items/query.js +78 -39
  629. package/dist/procedural-items/recipe.d.ts +258 -14
  630. package/dist/procedural-items/recipe.d.ts.map +1 -1
  631. package/dist/procedural-items/recipe.js +933 -61
  632. package/dist/procedural-items/section.d.ts +27 -0
  633. package/dist/procedural-items/section.d.ts.map +1 -0
  634. package/dist/procedural-items/section.js +237 -0
  635. package/dist/procedural-items/spatial.d.ts +21 -0
  636. package/dist/procedural-items/spatial.d.ts.map +1 -1
  637. package/dist/procedural-items/spatial.js +90 -0
  638. package/dist/registry/handles.d.ts +2 -0
  639. package/dist/registry/handles.d.ts.map +1 -1
  640. package/dist/registry/index.d.ts +6 -4
  641. package/dist/registry/index.d.ts.map +1 -1
  642. package/dist/registry/index.js +4 -2
  643. package/dist/registry/mechanism.d.ts +9 -0
  644. package/dist/registry/mechanism.d.ts.map +1 -0
  645. package/dist/registry/mechanism.js +21 -0
  646. package/dist/registry/registry.d.ts +6 -3
  647. package/dist/registry/registry.d.ts.map +1 -1
  648. package/dist/registry/registry.js +59 -22
  649. package/dist/registry/scene-api.d.ts +20 -0
  650. package/dist/registry/scene-api.d.ts.map +1 -1
  651. package/dist/registry/scene-api.js +26 -13
  652. package/dist/registry/subtree.d.ts +8 -0
  653. package/dist/registry/subtree.d.ts.map +1 -1
  654. package/dist/registry/subtree.js +53 -0
  655. package/dist/registry/types.d.ts +340 -11
  656. package/dist/registry/types.d.ts.map +1 -1
  657. package/dist/schema/__fixtures__/node-fixtures.d.ts.map +1 -1
  658. package/dist/schema/__fixtures__/node-fixtures.js +2 -0
  659. package/dist/schema/assembly.d.ts +153 -0
  660. package/dist/schema/assembly.d.ts.map +1 -0
  661. package/dist/schema/assembly.js +155 -0
  662. package/dist/schema/asset-url.d.ts +2 -1
  663. package/dist/schema/asset-url.d.ts.map +1 -1
  664. package/dist/schema/asset-url.js +5 -2
  665. package/dist/schema/base.d.ts +26 -0
  666. package/dist/schema/base.d.ts.map +1 -1
  667. package/dist/schema/base.js +2 -0
  668. package/dist/schema/collection-templates.d.ts +46 -0
  669. package/dist/schema/collection-templates.d.ts.map +1 -0
  670. package/dist/schema/collection-templates.js +14 -0
  671. package/dist/schema/collections.d.ts +7 -0
  672. package/dist/schema/collections.d.ts.map +1 -1
  673. package/dist/schema/cut.d.ts +29 -0
  674. package/dist/schema/cut.d.ts.map +1 -0
  675. package/dist/schema/cut.js +50 -0
  676. package/dist/schema/geometry-metadata.d.ts +51 -0
  677. package/dist/schema/geometry-metadata.d.ts.map +1 -0
  678. package/dist/schema/geometry-metadata.js +57 -0
  679. package/dist/schema/geometry-source.d.ts +250 -0
  680. package/dist/schema/geometry-source.d.ts.map +1 -0
  681. package/dist/schema/geometry-source.js +130 -0
  682. package/dist/schema/index.d.ts +19 -7
  683. package/dist/schema/index.d.ts.map +1 -1
  684. package/dist/schema/index.js +21 -5
  685. package/dist/schema/nodes/block.d.ts +26 -0
  686. package/dist/schema/nodes/block.d.ts.map +1 -1
  687. package/dist/schema/nodes/block.js +1 -1
  688. package/dist/schema/nodes/box-vent.d.ts +26 -0
  689. package/dist/schema/nodes/box-vent.d.ts.map +1 -1
  690. package/dist/schema/nodes/building.d.ts +26 -0
  691. package/dist/schema/nodes/building.d.ts.map +1 -1
  692. package/dist/schema/nodes/cabinet.d.ts +61 -9
  693. package/dist/schema/nodes/cabinet.d.ts.map +1 -1
  694. package/dist/schema/nodes/ceiling.d.ts +37 -0
  695. package/dist/schema/nodes/ceiling.d.ts.map +1 -1
  696. package/dist/schema/nodes/ceiling.js +8 -0
  697. package/dist/schema/nodes/chimney.d.ts +26 -0
  698. package/dist/schema/nodes/chimney.d.ts.map +1 -1
  699. package/dist/schema/nodes/column.d.ts +126 -0
  700. package/dist/schema/nodes/column.d.ts.map +1 -1
  701. package/dist/schema/nodes/column.js +2 -0
  702. package/dist/schema/nodes/construction-dimension.d.ts +26 -0
  703. package/dist/schema/nodes/construction-dimension.d.ts.map +1 -1
  704. package/dist/schema/nodes/cupola.d.ts +26 -0
  705. package/dist/schema/nodes/cupola.d.ts.map +1 -1
  706. package/dist/schema/nodes/curtain-wall.d.ts +5 -5
  707. package/dist/schema/nodes/door.d.ts +139 -20
  708. package/dist/schema/nodes/door.d.ts.map +1 -1
  709. package/dist/schema/nodes/door.js +18 -33
  710. package/dist/schema/nodes/dormer.d.ts +28 -2
  711. package/dist/schema/nodes/dormer.d.ts.map +1 -1
  712. package/dist/schema/nodes/downspout.d.ts +27 -1
  713. package/dist/schema/nodes/downspout.d.ts.map +1 -1
  714. package/dist/schema/nodes/duct-fitting.d.ts +27 -1
  715. package/dist/schema/nodes/duct-fitting.d.ts.map +1 -1
  716. package/dist/schema/nodes/duct-segment.d.ts +27 -1
  717. package/dist/schema/nodes/duct-segment.d.ts.map +1 -1
  718. package/dist/schema/nodes/duct-terminal.d.ts +26 -0
  719. package/dist/schema/nodes/duct-terminal.d.ts.map +1 -1
  720. package/dist/schema/nodes/elevator.d.ts +26 -0
  721. package/dist/schema/nodes/elevator.d.ts.map +1 -1
  722. package/dist/schema/nodes/eyebrow-vent.d.ts +26 -0
  723. package/dist/schema/nodes/eyebrow-vent.d.ts.map +1 -1
  724. package/dist/schema/nodes/fence-feature.d.ts +141 -0
  725. package/dist/schema/nodes/fence-feature.d.ts.map +1 -0
  726. package/dist/schema/nodes/fence-feature.js +21 -0
  727. package/dist/schema/nodes/fence.d.ts +186 -0
  728. package/dist/schema/nodes/fence.d.ts.map +1 -1
  729. package/dist/schema/nodes/fence.js +92 -7
  730. package/dist/schema/nodes/floor-opening.d.ts +61 -0
  731. package/dist/schema/nodes/floor-opening.d.ts.map +1 -0
  732. package/dist/schema/nodes/floor-opening.js +17 -0
  733. package/dist/schema/nodes/guide.d.ts +26 -0
  734. package/dist/schema/nodes/guide.d.ts.map +1 -1
  735. package/dist/schema/nodes/gutter.d.ts +26 -0
  736. package/dist/schema/nodes/gutter.d.ts.map +1 -1
  737. package/dist/schema/nodes/hvac-equipment.d.ts +26 -0
  738. package/dist/schema/nodes/hvac-equipment.d.ts.map +1 -1
  739. package/dist/schema/nodes/imported-mesh.d.ts +26 -0
  740. package/dist/schema/nodes/imported-mesh.d.ts.map +1 -1
  741. package/dist/schema/nodes/item.d.ts +153 -2
  742. package/dist/schema/nodes/item.d.ts.map +1 -1
  743. package/dist/schema/nodes/item.js +13 -0
  744. package/dist/schema/nodes/lean-to-extension.d.ts +26 -0
  745. package/dist/schema/nodes/lean-to-extension.d.ts.map +1 -1
  746. package/dist/schema/nodes/level.d.ts +27 -1
  747. package/dist/schema/nodes/level.d.ts.map +1 -1
  748. package/dist/schema/nodes/lineset.d.ts +26 -0
  749. package/dist/schema/nodes/lineset.d.ts.map +1 -1
  750. package/dist/schema/nodes/liquid-line.d.ts +26 -0
  751. package/dist/schema/nodes/liquid-line.d.ts.map +1 -1
  752. package/dist/schema/nodes/measurement.d.ts +26 -0
  753. package/dist/schema/nodes/measurement.d.ts.map +1 -1
  754. package/dist/schema/nodes/opening-types.d.ts +41 -0
  755. package/dist/schema/nodes/opening-types.d.ts.map +1 -0
  756. package/dist/schema/nodes/opening-types.js +48 -0
  757. package/dist/schema/nodes/pipe-fitting.d.ts +26 -0
  758. package/dist/schema/nodes/pipe-fitting.d.ts.map +1 -1
  759. package/dist/schema/nodes/pipe-segment.d.ts +26 -0
  760. package/dist/schema/nodes/pipe-segment.d.ts.map +1 -1
  761. package/dist/schema/nodes/pipe-trap.d.ts +26 -0
  762. package/dist/schema/nodes/pipe-trap.d.ts.map +1 -1
  763. package/dist/schema/nodes/ridge-vent.d.ts +26 -0
  764. package/dist/schema/nodes/ridge-vent.d.ts.map +1 -1
  765. package/dist/schema/nodes/roof-segment-walls.d.ts.map +1 -1
  766. package/dist/schema/nodes/roof-segment-walls.js +2 -1
  767. package/dist/schema/nodes/roof-segment.d.ts +30 -2
  768. package/dist/schema/nodes/roof-segment.d.ts.map +1 -1
  769. package/dist/schema/nodes/roof-segment.js +9 -0
  770. package/dist/schema/nodes/roof.d.ts +101 -0
  771. package/dist/schema/nodes/roof.d.ts.map +1 -1
  772. package/dist/schema/nodes/roof.js +6 -0
  773. package/dist/schema/nodes/scan.d.ts +26 -0
  774. package/dist/schema/nodes/scan.d.ts.map +1 -1
  775. package/dist/schema/nodes/separator.d.ts +50 -0
  776. package/dist/schema/nodes/separator.d.ts.map +1 -0
  777. package/dist/schema/nodes/separator.js +8 -0
  778. package/dist/schema/nodes/shelf.d.ts +26 -0
  779. package/dist/schema/nodes/shelf.d.ts.map +1 -1
  780. package/dist/schema/nodes/site.d.ts +192 -0
  781. package/dist/schema/nodes/site.d.ts.map +1 -1
  782. package/dist/schema/nodes/site.js +178 -1
  783. package/dist/schema/nodes/skylight.d.ts +30 -4
  784. package/dist/schema/nodes/skylight.d.ts.map +1 -1
  785. package/dist/schema/nodes/slab.d.ts +84 -0
  786. package/dist/schema/nodes/slab.d.ts.map +1 -1
  787. package/dist/schema/nodes/slab.js +37 -2
  788. package/dist/schema/nodes/solar-panel.d.ts +26 -0
  789. package/dist/schema/nodes/solar-panel.d.ts.map +1 -1
  790. package/dist/schema/nodes/spawn.d.ts +26 -0
  791. package/dist/schema/nodes/spawn.d.ts.map +1 -1
  792. package/dist/schema/nodes/stair-construction.d.ts +21 -0
  793. package/dist/schema/nodes/stair-construction.d.ts.map +1 -0
  794. package/dist/schema/nodes/stair-construction.js +13 -0
  795. package/dist/schema/nodes/stair-design-targets.d.ts +9 -0
  796. package/dist/schema/nodes/stair-design-targets.d.ts.map +1 -0
  797. package/dist/schema/nodes/stair-design-targets.js +7 -0
  798. package/dist/schema/nodes/stair-segment.d.ts +72 -4
  799. package/dist/schema/nodes/stair-segment.d.ts.map +1 -1
  800. package/dist/schema/nodes/stair-segment.js +13 -0
  801. package/dist/schema/nodes/stair.d.ts +119 -2
  802. package/dist/schema/nodes/stair.d.ts.map +1 -1
  803. package/dist/schema/nodes/stair.js +59 -2
  804. package/dist/schema/nodes/structural-grid.d.ts +26 -0
  805. package/dist/schema/nodes/structural-grid.d.ts.map +1 -1
  806. package/dist/schema/nodes/surface-hole-metadata.d.ts +3 -0
  807. package/dist/schema/nodes/surface-hole-metadata.d.ts.map +1 -1
  808. package/dist/schema/nodes/surface-hole-metadata.js +2 -1
  809. package/dist/schema/nodes/surface-paint-region.d.ts +14 -0
  810. package/dist/schema/nodes/surface-paint-region.d.ts.map +1 -0
  811. package/dist/schema/nodes/surface-paint-region.js +12 -0
  812. package/dist/schema/nodes/turbine-vent.d.ts +26 -0
  813. package/dist/schema/nodes/turbine-vent.d.ts.map +1 -1
  814. package/dist/schema/nodes/unit.d.ts +26 -0
  815. package/dist/schema/nodes/unit.d.ts.map +1 -1
  816. package/dist/schema/nodes/wall.d.ts +352 -61
  817. package/dist/schema/nodes/wall.d.ts.map +1 -1
  818. package/dist/schema/nodes/wall.js +185 -186
  819. package/dist/schema/nodes/window.d.ts +139 -20
  820. package/dist/schema/nodes/window.d.ts.map +1 -1
  821. package/dist/schema/nodes/window.js +12 -14
  822. package/dist/schema/nodes/zone.d.ts +69 -1
  823. package/dist/schema/nodes/zone.d.ts.map +1 -1
  824. package/dist/schema/nodes/zone.js +46 -0
  825. package/dist/schema/provenance.d.ts +118 -0
  826. package/dist/schema/provenance.d.ts.map +1 -0
  827. package/dist/schema/provenance.js +76 -0
  828. package/dist/schema/source-ref.d.ts +23 -0
  829. package/dist/schema/source-ref.d.ts.map +1 -0
  830. package/dist/schema/source-ref.js +29 -0
  831. package/dist/schema/types.d.ts +3317 -68
  832. package/dist/schema/types.d.ts.map +1 -1
  833. package/dist/schema/types.js +7 -0
  834. package/dist/services/alignment-anchors.d.ts +2 -1
  835. package/dist/services/alignment-anchors.d.ts.map +1 -1
  836. package/dist/services/alignment-anchors.js +9 -6
  837. package/dist/services/index.d.ts +1 -1
  838. package/dist/services/index.d.ts.map +1 -1
  839. package/dist/services/index.js +1 -1
  840. package/dist/services/level-height.d.ts.map +1 -1
  841. package/dist/services/level-height.js +6 -4
  842. package/dist/services/storey.d.ts +21 -1
  843. package/dist/services/storey.d.ts.map +1 -1
  844. package/dist/services/storey.js +94 -8
  845. package/dist/services/surface-hosting.d.ts.map +1 -1
  846. package/dist/services/surface-hosting.js +4 -1
  847. package/dist/store/actions/node-actions.d.ts +4563 -8
  848. package/dist/store/actions/node-actions.d.ts.map +1 -1
  849. package/dist/store/actions/node-actions.js +495 -174
  850. package/dist/store/derived-node-guard.d.ts +84 -0
  851. package/dist/store/derived-node-guard.d.ts.map +1 -0
  852. package/dist/store/derived-node-guard.js +586 -0
  853. package/dist/store/history-control.d.ts +34 -0
  854. package/dist/store/history-control.d.ts.map +1 -1
  855. package/dist/store/history-control.js +99 -1
  856. package/dist/store/history-drafts.d.ts +48 -0
  857. package/dist/store/history-drafts.d.ts.map +1 -0
  858. package/dist/store/history-drafts.js +403 -0
  859. package/dist/store/history-invalidation.d.ts.map +1 -1
  860. package/dist/store/history-invalidation.js +1 -0
  861. package/dist/store/item-interaction.d.ts +28 -0
  862. package/dist/store/item-interaction.d.ts.map +1 -0
  863. package/dist/store/item-interaction.js +34 -0
  864. package/dist/store/registered-node-defaults.d.ts +11 -0
  865. package/dist/store/registered-node-defaults.d.ts.map +1 -0
  866. package/dist/store/registered-node-defaults.js +25 -0
  867. package/dist/store/scene-annotations.d.ts +8969 -0
  868. package/dist/store/scene-annotations.d.ts.map +1 -0
  869. package/dist/store/scene-annotations.js +107 -0
  870. package/dist/store/use-interactive.d.ts +23 -1
  871. package/dist/store/use-interactive.d.ts.map +1 -1
  872. package/dist/store/use-interactive.js +128 -5
  873. package/dist/store/use-scene.d.ts +68 -12
  874. package/dist/store/use-scene.d.ts.map +1 -1
  875. package/dist/store/use-scene.js +416 -305
  876. package/dist/systems/elevator/elevator-opening-sync.d.ts.map +1 -1
  877. package/dist/systems/elevator/elevator-opening-sync.js +4 -6
  878. package/dist/systems/elevator/elevator-opening-system.d.ts.map +1 -1
  879. package/dist/systems/elevator/elevator-opening-system.js +12 -6
  880. package/dist/systems/elevator/elevator-service.d.ts.map +1 -1
  881. package/dist/systems/elevator/elevator-service.js +8 -3
  882. package/dist/systems/fence/fence-centerline.d.ts.map +1 -1
  883. package/dist/systems/fence/fence-centerline.js +6 -5
  884. package/dist/systems/fence/fence-features.d.ts +36 -0
  885. package/dist/systems/fence/fence-features.d.ts.map +1 -0
  886. package/dist/systems/fence/fence-features.js +105 -0
  887. package/dist/systems/fence/fence-spline.d.ts +8 -5
  888. package/dist/systems/fence/fence-spline.d.ts.map +1 -1
  889. package/dist/systems/fence/fence-spline.js +51 -16
  890. package/dist/systems/owned-floor-openings.d.ts +9 -0
  891. package/dist/systems/owned-floor-openings.d.ts.map +1 -0
  892. package/dist/systems/owned-floor-openings.js +326 -0
  893. package/dist/systems/reconcile-owned-floor-openings.d.ts +3 -0
  894. package/dist/systems/reconcile-owned-floor-openings.d.ts.map +1 -0
  895. package/dist/systems/reconcile-owned-floor-openings.js +25 -0
  896. package/dist/systems/slab/__fixtures__/doorway-steps.d.ts +8 -0
  897. package/dist/systems/slab/__fixtures__/doorway-steps.d.ts.map +1 -0
  898. package/dist/systems/slab/__fixtures__/doorway-steps.js +62 -0
  899. package/dist/systems/slab/__fixtures__/floor-step.d.ts +5636 -0
  900. package/dist/systems/slab/__fixtures__/floor-step.d.ts.map +1 -0
  901. package/dist/systems/slab/__fixtures__/floor-step.js +66 -0
  902. package/dist/systems/slab/__fixtures__/raised-room.d.ts +5775 -0
  903. package/dist/systems/slab/__fixtures__/raised-room.d.ts.map +1 -0
  904. package/dist/systems/slab/__fixtures__/raised-room.js +54 -0
  905. package/dist/systems/slab/ensure-slab-openings.d.ts +9 -0
  906. package/dist/systems/slab/ensure-slab-openings.d.ts.map +1 -0
  907. package/dist/systems/slab/ensure-slab-openings.js +41 -0
  908. package/dist/systems/slab/slab-support.d.ts +25 -6
  909. package/dist/systems/slab/slab-support.d.ts.map +1 -1
  910. package/dist/systems/slab/slab-support.js +471 -54
  911. package/dist/systems/stair/stair-base-elevation.d.ts +3 -0
  912. package/dist/systems/stair/stair-base-elevation.d.ts.map +1 -0
  913. package/dist/systems/stair/stair-base-elevation.js +49 -0
  914. package/dist/systems/stair/stair-clearance.d.ts +39 -0
  915. package/dist/systems/stair/stair-clearance.d.ts.map +1 -0
  916. package/dist/systems/stair/stair-clearance.js +508 -0
  917. package/dist/systems/stair/stair-construction.d.ts +37 -0
  918. package/dist/systems/stair/stair-construction.d.ts.map +1 -0
  919. package/dist/systems/stair/stair-construction.js +314 -0
  920. package/dist/systems/stair/stair-detail-budget.d.ts +13 -0
  921. package/dist/systems/stair/stair-detail-budget.d.ts.map +1 -0
  922. package/dist/systems/stair/stair-detail-budget.js +64 -0
  923. package/dist/systems/stair/stair-flight.d.ts +2 -2
  924. package/dist/systems/stair/stair-flight.d.ts.map +1 -1
  925. package/dist/systems/stair/stair-flight.js +4 -3
  926. package/dist/systems/stair/stair-floor-footprints.d.ts +7 -0
  927. package/dist/systems/stair/stair-floor-footprints.d.ts.map +1 -0
  928. package/dist/systems/stair/stair-floor-footprints.js +113 -0
  929. package/dist/systems/stair/stair-footprint.d.ts +3 -1
  930. package/dist/systems/stair/stair-footprint.d.ts.map +1 -1
  931. package/dist/systems/stair/stair-footprint.js +97 -44
  932. package/dist/systems/stair/stair-layout.d.ts +39 -0
  933. package/dist/systems/stair/stair-layout.d.ts.map +1 -0
  934. package/dist/systems/stair/stair-layout.js +58 -0
  935. package/dist/systems/stair/stair-opening-preview.d.ts +1612 -80
  936. package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
  937. package/dist/systems/stair/stair-opening-sync.d.ts +8 -2
  938. package/dist/systems/stair/stair-opening-sync.d.ts.map +1 -1
  939. package/dist/systems/stair/stair-opening-sync.js +136 -315
  940. package/dist/systems/stair/stair-opening-system.d.ts.map +1 -1
  941. package/dist/systems/stair/stair-opening-system.js +40 -8
  942. package/dist/systems/stair/stair-presets.d.ts +276 -0
  943. package/dist/systems/stair/stair-presets.d.ts.map +1 -0
  944. package/dist/systems/stair/stair-presets.js +151 -0
  945. package/dist/systems/stair/stair-rail-budget.d.ts +6 -0
  946. package/dist/systems/stair/stair-rail-budget.d.ts.map +1 -0
  947. package/dist/systems/stair/stair-rail-budget.js +36 -0
  948. package/dist/systems/stair/stair-rail-path.d.ts +22 -0
  949. package/dist/systems/stair/stair-rail-path.d.ts.map +1 -0
  950. package/dist/systems/stair/stair-rail-path.js +497 -0
  951. package/dist/systems/stair/stair-rise-edit.d.ts +9 -0
  952. package/dist/systems/stair/stair-rise-edit.d.ts.map +1 -0
  953. package/dist/systems/stair/stair-rise-edit.js +46 -0
  954. package/dist/systems/stair/stair-rise-query.d.ts +24 -0
  955. package/dist/systems/stair/stair-rise-query.d.ts.map +1 -0
  956. package/dist/systems/stair/stair-rise-query.js +125 -0
  957. package/dist/systems/stair/stair-rise.d.ts +4 -19
  958. package/dist/systems/stair/stair-rise.d.ts.map +1 -1
  959. package/dist/systems/stair/stair-rise.js +8 -71
  960. package/dist/systems/stair/stair-sizing.d.ts +414 -0
  961. package/dist/systems/stair/stair-sizing.d.ts.map +1 -0
  962. package/dist/systems/stair/stair-sizing.js +255 -0
  963. package/dist/systems/stair/stair-sweep-edit.d.ts +7 -0
  964. package/dist/systems/stair/stair-sweep-edit.d.ts.map +1 -0
  965. package/dist/systems/stair/stair-sweep-edit.js +8 -0
  966. package/dist/systems/stair/stair-walking-line.d.ts +5 -0
  967. package/dist/systems/stair/stair-walking-line.d.ts.map +1 -0
  968. package/dist/systems/stair/stair-walking-line.js +91 -0
  969. package/dist/systems/stair/stair-winder.d.ts +36 -0
  970. package/dist/systems/stair/stair-winder.d.ts.map +1 -0
  971. package/dist/systems/stair/stair-winder.js +173 -0
  972. package/dist/systems/wall/wall-assembly.d.ts +234 -0
  973. package/dist/systems/wall/wall-assembly.d.ts.map +1 -0
  974. package/dist/systems/wall/wall-assembly.js +854 -0
  975. package/dist/systems/wall/wall-curve.d.ts +2 -1
  976. package/dist/systems/wall/wall-curve.d.ts.map +1 -1
  977. package/dist/systems/wall/wall-curve.js +21 -5
  978. package/dist/systems/wall/wall-finish.d.ts +102 -0
  979. package/dist/systems/wall/wall-finish.d.ts.map +1 -0
  980. package/dist/systems/wall/wall-finish.js +264 -0
  981. package/dist/systems/wall/wall-footprint.d.ts +3 -0
  982. package/dist/systems/wall/wall-footprint.d.ts.map +1 -1
  983. package/dist/systems/wall/wall-footprint.js +15 -13
  984. package/dist/systems/wall/wall-frame.d.ts +45 -0
  985. package/dist/systems/wall/wall-frame.d.ts.map +1 -0
  986. package/dist/systems/wall/wall-frame.js +162 -0
  987. package/dist/systems/wall/wall-layer-bands.d.ts +38 -0
  988. package/dist/systems/wall/wall-layer-bands.d.ts.map +1 -0
  989. package/dist/systems/wall/wall-layer-bands.js +109 -0
  990. package/dist/systems/wall/wall-merge.d.ts +20 -1
  991. package/dist/systems/wall/wall-merge.d.ts.map +1 -1
  992. package/dist/systems/wall/wall-merge.js +189 -18
  993. package/dist/systems/wall/wall-mitering.d.ts +6 -5
  994. package/dist/systems/wall/wall-mitering.d.ts.map +1 -1
  995. package/dist/systems/wall/wall-mitering.js +70 -20
  996. package/dist/systems/wall/wall-operations.d.ts +1 -1
  997. package/dist/systems/wall/wall-operations.d.ts.map +1 -1
  998. package/dist/systems/wall/wall-operations.js +2 -1
  999. package/dist/systems/wall/wall-paint-plan.d.ts +30 -0
  1000. package/dist/systems/wall/wall-paint-plan.d.ts.map +1 -0
  1001. package/dist/systems/wall/wall-paint-plan.js +167 -0
  1002. package/dist/systems/wall/wall-room-sides.d.ts +6 -0
  1003. package/dist/systems/wall/wall-room-sides.d.ts.map +1 -0
  1004. package/dist/systems/wall/wall-room-sides.js +14 -0
  1005. package/dist/systems/wall/wall-step-openings.d.ts +17 -0
  1006. package/dist/systems/wall/wall-step-openings.d.ts.map +1 -0
  1007. package/dist/systems/wall/wall-step-openings.js +32 -0
  1008. package/dist/systems/wall/wall-top.d.ts +2 -6
  1009. package/dist/systems/wall/wall-top.d.ts.map +1 -1
  1010. package/dist/systems/wall/wall-top.js +3 -9
  1011. package/dist/systems/wall/wall-topology.d.ts +21 -0
  1012. package/dist/systems/wall/wall-topology.d.ts.map +1 -1
  1013. package/dist/systems/wall/wall-topology.js +405 -4
  1014. package/dist/utils/clone-scene-graph.d.ts +6 -0
  1015. package/dist/utils/clone-scene-graph.d.ts.map +1 -1
  1016. package/dist/utils/clone-scene-graph.js +123 -15
  1017. package/dist/utils/ensure-scene-openings.d.ts +8965 -0
  1018. package/dist/utils/ensure-scene-openings.d.ts.map +1 -0
  1019. package/dist/utils/ensure-scene-openings.js +29 -0
  1020. package/dist/utils/exterior-threshold-migration.d.ts +4 -0
  1021. package/dist/utils/exterior-threshold-migration.d.ts.map +1 -0
  1022. package/dist/utils/exterior-threshold-migration.js +114 -0
  1023. package/dist/utils/floor-follow-migration.d.ts +3 -0
  1024. package/dist/utils/floor-follow-migration.d.ts.map +1 -0
  1025. package/dist/utils/floor-follow-migration.js +29 -0
  1026. package/dist/utils/floor-opening-migration.d.ts +13 -0
  1027. package/dist/utils/floor-opening-migration.d.ts.map +1 -0
  1028. package/dist/utils/floor-opening-migration.js +148 -0
  1029. package/dist/utils/floor-piece-adoption.d.ts +50 -0
  1030. package/dist/utils/floor-piece-adoption.d.ts.map +1 -0
  1031. package/dist/utils/floor-piece-adoption.js +182 -0
  1032. package/dist/utils/floor-plate-migration.d.ts +4507 -0
  1033. package/dist/utils/floor-plate-migration.d.ts.map +1 -0
  1034. package/dist/utils/floor-plate-migration.js +1360 -0
  1035. package/dist/utils/heal-plan-coordinates.d.ts +2 -0
  1036. package/dist/utils/heal-plan-coordinates.d.ts.map +1 -0
  1037. package/dist/utils/heal-plan-coordinates.js +69 -0
  1038. package/dist/utils/heal-scene-graph.d.ts +20 -6
  1039. package/dist/utils/heal-scene-graph.d.ts.map +1 -1
  1040. package/dist/utils/heal-scene-graph.js +61 -16
  1041. package/dist/utils/legacy-material-slots.d.ts +23 -0
  1042. package/dist/utils/legacy-material-slots.d.ts.map +1 -0
  1043. package/dist/utils/legacy-material-slots.js +120 -0
  1044. package/dist/utils/legacy-opening-datums.d.ts +11 -0
  1045. package/dist/utils/legacy-opening-datums.d.ts.map +1 -0
  1046. package/dist/utils/legacy-opening-datums.js +92 -0
  1047. package/dist/utils/legacy-wall-datums.d.ts +6 -0
  1048. package/dist/utils/legacy-wall-datums.d.ts.map +1 -0
  1049. package/dist/utils/legacy-wall-datums.js +199 -0
  1050. package/dist/utils/load-migration.d.ts +28 -0
  1051. package/dist/utils/load-migration.d.ts.map +1 -0
  1052. package/dist/utils/load-migration.js +89 -0
  1053. package/dist/utils/node-defaults.d.ts +37 -0
  1054. package/dist/utils/node-defaults.d.ts.map +1 -0
  1055. package/dist/utils/node-defaults.js +96 -0
  1056. package/dist/utils/normalize-legacy-structure.d.ts +2 -0
  1057. package/dist/utils/normalize-legacy-structure.d.ts.map +1 -0
  1058. package/dist/utils/normalize-legacy-structure.js +61 -0
  1059. package/dist/utils/omit-undefined.d.ts +2 -0
  1060. package/dist/utils/omit-undefined.d.ts.map +1 -0
  1061. package/dist/utils/omit-undefined.js +17 -0
  1062. package/dist/utils/owned-floor-opening-migration.d.ts +4489 -0
  1063. package/dist/utils/owned-floor-opening-migration.d.ts.map +1 -0
  1064. package/dist/utils/owned-floor-opening-migration.js +365 -0
  1065. package/dist/utils/reconcile-structure-on-load.d.ts +8965 -0
  1066. package/dist/utils/reconcile-structure-on-load.d.ts.map +1 -0
  1067. package/dist/utils/reconcile-structure-on-load.js +307 -0
  1068. package/dist/utils/room-zone-migration.d.ts +18 -0
  1069. package/dist/utils/room-zone-migration.d.ts.map +1 -0
  1070. package/dist/utils/room-zone-migration.js +258 -0
  1071. package/dist/utils/scene-migrations.d.ts +16 -1
  1072. package/dist/utils/scene-migrations.d.ts.map +1 -1
  1073. package/dist/utils/scene-migrations.js +15 -1
  1074. package/dist/utils/structure-id.d.ts +4 -0
  1075. package/dist/utils/structure-id.d.ts.map +1 -0
  1076. package/dist/utils/structure-id.js +115 -0
  1077. package/dist/utils/vertical-scene-migration.d.ts +8 -8
  1078. package/dist/utils/vertical-scene-migration.d.ts.map +1 -1
  1079. package/dist/utils/vertical-scene-migration.js +18 -8
  1080. package/dist/utils/wall-assembly-migration.d.ts +14 -0
  1081. package/dist/utils/wall-assembly-migration.d.ts.map +1 -0
  1082. package/dist/utils/wall-assembly-migration.js +23 -0
  1083. package/dist/utils/wall-face-migration.d.ts +23 -0
  1084. package/dist/utils/wall-face-migration.d.ts.map +1 -0
  1085. package/dist/utils/wall-face-migration.js +246 -0
  1086. package/dist/validation/opening-bounds.d.ts +36 -0
  1087. package/dist/validation/opening-bounds.d.ts.map +1 -0
  1088. package/dist/validation/opening-bounds.js +34 -0
  1089. package/dist/validation/validate-build-json.d.ts +2 -0
  1090. package/dist/validation/validate-build-json.d.ts.map +1 -1
  1091. package/dist/validation/validate-build-json.js +36 -1
  1092. package/package.json +36 -3
  1093. package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts +0 -13
  1094. package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts.map +0 -1
  1095. package/dist/services/surface-hosting-procedural-parity.fixtures.js +0 -4691
  1096. package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts +0 -1060
  1097. package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts.map +0 -1
  1098. package/dist/services/surface-hosting-shelf-parity.fixtures.js +0 -3127
@@ -0,0 +1,1360 @@
1
+ import { isFloorAnchoredOpening } from '../lib/floor-opening-footprints.js';
2
+ import { floorPlateId } from '../lib/floor-plate-id.js';
3
+ import { buildFloorPlates, footprintIoU, parseSlabConstruction, slabFootprint, warnPlateFailure, } from '../lib/floor-plates.js';
4
+ import { floorRoomFaces } from '../lib/floor-room-faces.js';
5
+ import { plateFootprint } from '../lib/level-footprints.js';
6
+ import { getOpeningFloorDatum, wallSupportForNodes } from '../lib/opening-floor-datum.js';
7
+ import { replacementPlateFor } from '../lib/plate-reference.js';
8
+ import { computePlateSurfacePartition } from '../lib/plate-surface.js';
9
+ import { area, containsPoint, difference, distanceToBoundary, intersection, union, } from '../lib/polygon-boolean.js';
10
+ import { autoRoomVerticalPlacements } from '../lib/room-vertical-placement.js';
11
+ import { getRenderableSlabPolygon, prepareSlabPolygonContext } from '../lib/slab-polygon.js';
12
+ import { DEFAULT_SLAB_ELEVATION } from '../schema/nodes/slab.js';
13
+ import { getStoredLevelHeight } from '../services/storey.js';
14
+ import { wallOverlapsSlabFootprint } from '../systems/slab/slab-support.js';
15
+ import { getWallCurveLength } from '../systems/wall/wall-curve.js';
16
+ import { calculateLevelMiters, getWallPlanFootprint } from '../systems/wall/wall-footprint.js';
17
+ import { resolveWallTop } from '../systems/wall/wall-top.js';
18
+ import { floorPieceFinish, PIECE_GAP_WIDTH, PIECE_TRIM_DEPTH, partWidth, planFloorPieceAdoption, } from './floor-piece-adoption.js';
19
+ import { legacyWallElevations } from './legacy-wall-datums.js';
20
+ import { loadMigration } from './load-migration.js';
21
+ import { omitUndefined } from './omit-undefined.js';
22
+ function visibleFloorTopAreas(slabs, walls) {
23
+ let covered = union(walls);
24
+ const tops = new Map();
25
+ for (const slab of [...slabs].sort((a, b) => b.elevation - a.elevation)) {
26
+ if (slab.visible === false || slab.support === 'open' || slab.recessed)
27
+ continue;
28
+ const footprint = difference({ outer: slab.polygon, holes: [] }, union((slab.holes ?? []).map((hole) => ({ outer: hole, holes: [] }))));
29
+ const visible = difference(footprint, covered);
30
+ const top = Math.round(slab.elevation * 1000) / 1000;
31
+ tops.set(top, (tops.get(top) ?? 0) + area(visible));
32
+ covered = union([...covered, ...footprint]);
33
+ }
34
+ return tops;
35
+ }
36
+ function visibleFloorTopChange(before, after, walls) {
37
+ const old = visibleFloorTopAreas(before, walls);
38
+ const next = visibleFloorTopAreas(after, walls);
39
+ for (const [oldTop] of old)
40
+ for (const [nextTop, nextArea] of next) {
41
+ if (Math.abs(oldTop - nextTop) > 0.02 + 1e-9)
42
+ continue;
43
+ const oldArea = old.get(oldTop);
44
+ const shared = Math.min(oldArea, nextArea);
45
+ old.set(oldTop, oldArea - shared);
46
+ next.set(nextTop, nextArea - shared);
47
+ if (old.get(oldTop) <= 1e-6)
48
+ break;
49
+ }
50
+ return Math.min([...old.values()].reduce((sum, value) => sum + value, 0), [...next.values()].reduce((sum, value) => sum + value, 0));
51
+ }
52
+ export function associateLegacyManualFloors(source, legacy = source, finalize = true) {
53
+ const bounds = (ring) => ({
54
+ minX: Math.min(...ring.map(([x]) => x)),
55
+ maxX: Math.max(...ring.map(([x]) => x)),
56
+ minZ: Math.min(...ring.map(([, z]) => z)),
57
+ maxZ: Math.max(...ring.map(([, z]) => z)),
58
+ });
59
+ const nearby = (a, b) => a.minX < b.maxX && b.minX < a.maxX && a.minZ < b.maxZ && b.minZ < a.maxZ;
60
+ let nodes = source;
61
+ for (const level of Object.values(source)) {
62
+ if (level.type !== 'level' || level.metadata?.floorOwnershipMigrated === true)
63
+ continue;
64
+ const children = Object.values(source).filter((node) => node.parentId === level.id);
65
+ const authored = children.filter((node) => node.type === 'slab' &&
66
+ !node.autoFromWalls &&
67
+ node.boundary !== 'auto' &&
68
+ node.support !== 'open' &&
69
+ !node.recessed);
70
+ const manual = union(authored.map(slabFootprint));
71
+ const original = Object.values(legacy).filter((node) => node.type === 'slab' &&
72
+ node.parentId === level.id &&
73
+ node.visible !== false &&
74
+ node.support !== 'open' &&
75
+ !node.recessed);
76
+ const originalFaces = original.map((slab) => ({
77
+ slab,
78
+ footprint: slabFootprint(slab),
79
+ coverageFootprint: {
80
+ outer: slab.polygon,
81
+ holes: (slab.holes ?? []).filter((_, index) => slab.holeMetadata?.[index]?.source !== 'stair' &&
82
+ slab.holeMetadata?.[index]?.source !== 'elevator'),
83
+ },
84
+ bounds: bounds(slab.polygon),
85
+ }));
86
+ const rooms = children.filter((node) => node.type === 'zone' && node.spaceRole === 'room');
87
+ const wallBand = Math.max(0, ...children
88
+ .filter((node) => node.type === 'wall')
89
+ .map((wall) => (wall.thickness ?? 0.1) / 2)) + 0.005;
90
+ for (const slab of authored) {
91
+ const associatedZoneIds = rooms
92
+ .filter((room) => area(intersection(slabFootprint(room), slabFootprint(slab))) > 1e-4)
93
+ .map((room) => room.id)
94
+ .sort();
95
+ if (JSON.stringify(slab.associatedZoneIds) === JSON.stringify(associatedZoneIds))
96
+ continue;
97
+ if (nodes === source)
98
+ nodes = { ...source };
99
+ nodes[slab.id] = { ...slab, associatedZoneIds };
100
+ }
101
+ for (const zone of children) {
102
+ if (zone.type !== 'zone' ||
103
+ zone.spaceRole !== 'room' ||
104
+ zone.hasFloor === false ||
105
+ zone.floor?.support === 'open' ||
106
+ zone.floor?.sourceSlabId)
107
+ continue;
108
+ const face = slabFootprint(zone);
109
+ const faceArea = area([face]);
110
+ if (faceArea <= 0)
111
+ continue;
112
+ const faceBounds = bounds(zone.polygon);
113
+ const originalOverlaps = originalFaces
114
+ .filter((entry) => nearby(faceBounds, entry.bounds))
115
+ .map((entry) => ({
116
+ ...entry,
117
+ overlap: intersection(face, entry.coverageFootprint),
118
+ }));
119
+ const supportArea = area(union(originalOverlaps.flatMap((entry) => entry.overlap)));
120
+ if (supportArea <= 1e-4) {
121
+ if (nodes === source)
122
+ nodes = { ...source };
123
+ nodes[zone.id] = { ...zone, hasFloor: false };
124
+ continue;
125
+ }
126
+ const nearWholeAutoPlate = originalOverlaps.some((entry) => {
127
+ const plateBounds = entry.bounds;
128
+ return (entry.slab.autoFromWalls &&
129
+ area(entry.overlap) >= faceArea * 0.8 &&
130
+ Math.abs(plateBounds.minX - faceBounds.minX) <= wallBand &&
131
+ Math.abs(plateBounds.maxX - faceBounds.maxX) <= wallBand &&
132
+ Math.abs(plateBounds.minZ - faceBounds.minZ) <= wallBand &&
133
+ Math.abs(plateBounds.maxZ - faceBounds.maxZ) <= wallBand);
134
+ });
135
+ if (!nearWholeAutoPlate &&
136
+ supportArea > 1e-4 &&
137
+ faceArea - supportArea > Math.max(0.02, faceArea * 0.01)) {
138
+ const provider = originalOverlaps
139
+ .filter((entry) => area(entry.overlap) > 1e-4)
140
+ .sort((a, b) => b.slab.elevation - a.slab.elevation ||
141
+ area(b.overlap) - area(a.overlap) ||
142
+ a.slab.id.localeCompare(b.slab.id))[0]?.slab;
143
+ // A partial provider that became a generated plate supplies no authored floor.
144
+ if (provider && !nodes[provider.id]?.plateRole) {
145
+ if (nodes === source)
146
+ nodes = { ...source };
147
+ nodes[zone.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: provider.id } };
148
+ }
149
+ continue;
150
+ }
151
+ if (area(intersection(face, manual)) <= 1e-4)
152
+ continue;
153
+ const provider = authored
154
+ .filter((slab) => nearby(faceBounds, bounds(slab.polygon)))
155
+ .map((slab) => ({ slab, overlap: area(intersection(face, slabFootprint(slab))) }))
156
+ .filter(({ slab, overlap }) => overlap >= faceArea * 0.05 ||
157
+ (overlap > 1e-4 &&
158
+ slab.metadata?.plateMigration?.demoted !==
159
+ undefined))
160
+ .sort((a, b) => b.slab.elevation - a.slab.elevation ||
161
+ b.overlap - a.overlap ||
162
+ a.slab.id.localeCompare(b.slab.id))[0]?.slab;
163
+ if (!provider)
164
+ continue;
165
+ const providerCoverage = area(intersection(face, slabFootprint(provider)));
166
+ const automaticCover = originalFaces
167
+ .filter((entry) => entry.slab.autoFromWalls && nearby(faceBounds, entry.bounds))
168
+ .reduce((best, entry) => Math.max(best, area(intersection(face, entry.footprint))), 0);
169
+ if (automaticCover >= faceArea * 0.95 && providerCoverage < faceArea * 0.95)
170
+ continue;
171
+ const finishOnly = provider.metadata?.plateMigration?.demoted ===
172
+ undefined &&
173
+ providerCoverage >= faceArea * 0.95 &&
174
+ Object.values(legacy).some((node) => node.type === 'slab' &&
175
+ node.parentId === level.id &&
176
+ node.autoFromWalls &&
177
+ Math.abs(node.elevation - provider.elevation) <= 0.02 + 1e-9 &&
178
+ provider.thickness <= node.thickness + 0.02 + 1e-9 &&
179
+ area(difference(slabFootprint(provider), slabFootprint(node))) <=
180
+ Math.max(1e-6, area([slabFootprint(provider)]) * 0.01));
181
+ if (finishOnly)
182
+ continue;
183
+ if (nodes === source)
184
+ nodes = { ...source };
185
+ nodes[zone.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: provider.id } };
186
+ }
187
+ if (finalize) {
188
+ if (nodes === source)
189
+ nodes = { ...source };
190
+ const hadLegacyAutoPlate = Object.values(legacy).some((node) => node.type === 'slab' &&
191
+ node.parentId === level.id &&
192
+ node.autoFromWalls &&
193
+ !node.plateRole);
194
+ nodes[level.id] = {
195
+ ...level,
196
+ metadata: {
197
+ ...level.metadata,
198
+ floorOwnershipMigrated: true,
199
+ ...(hadLegacyAutoPlate ? { legacyAutoOpeningsMigrated: true } : {}),
200
+ },
201
+ };
202
+ }
203
+ }
204
+ return nodes;
205
+ }
206
+ function convertLegacyFinishSlabs(source) {
207
+ let nodes = source;
208
+ const slabs = Object.values(source).filter((node) => node.type === 'slab');
209
+ for (const slab of slabs) {
210
+ if (slab.autoFromWalls ||
211
+ slab.boundary === 'auto' ||
212
+ slab.plateRole ||
213
+ slab.support === 'open' ||
214
+ slab.recessed ||
215
+ slab.visible === false ||
216
+ slab.holes?.length ||
217
+ !slab.parentId)
218
+ continue;
219
+ const finish = slab.slots?.surface ?? slab.material ?? slab.materialPreset;
220
+ if (finish === undefined)
221
+ continue;
222
+ if (Object.values(source).some((node) => node.id !== slab.id &&
223
+ (node.supportSlabId === slab.id ||
224
+ node.deckSlabId === slab.id)))
225
+ continue;
226
+ const footprint = slabFootprint(slab);
227
+ const auto = slabs.filter((other) => other.parentId === slab.parentId &&
228
+ (other.autoFromWalls || other.boundary === 'auto') &&
229
+ !other.plateRole &&
230
+ Math.abs(other.elevation - slab.elevation) <= 0.02 + 1e-9 &&
231
+ slab.thickness <= other.thickness + 0.02 + 1e-9);
232
+ if (!auto.length || area(difference(footprint, union(auto.map(slabFootprint)))) > 1e-4)
233
+ continue;
234
+ const rooms = Object.values(nodes).filter((node) => node.type === 'zone' &&
235
+ node.parentId === slab.parentId &&
236
+ node.spaceRole === 'room' &&
237
+ node.hasFloor !== false);
238
+ const pieces = rooms.flatMap((room) => intersection(footprint, slabFootprint(room)).map((part) => ({ room, part })));
239
+ if (pieces.some(({ part }) => part.holes.length) ||
240
+ area(difference(footprint, union(pieces.map(({ part }) => part)))) > 1e-4)
241
+ continue;
242
+ if (nodes === source)
243
+ nodes = { ...source };
244
+ for (const room of rooms) {
245
+ const regions = pieces
246
+ .filter((piece) => piece.room.id === room.id)
247
+ .map(({ part }, index) => ({
248
+ id: pieces.length === 1 ? slab.id : `${slab.id}_${room.id}_${index}`,
249
+ polygon: part.outer,
250
+ finish,
251
+ }));
252
+ if (!regions.length)
253
+ continue;
254
+ const { sourceSlabId, ...floor } = room.floor ?? {};
255
+ nodes[room.id] = {
256
+ ...room,
257
+ floor: {
258
+ ...floor,
259
+ ...(sourceSlabId && sourceSlabId !== slab.id ? { sourceSlabId } : {}),
260
+ regions: [...(floor.regions ?? []), ...regions],
261
+ },
262
+ };
263
+ }
264
+ const level = nodes[slab.parentId];
265
+ if (level?.type === 'level')
266
+ nodes[level.id] = { ...level, children: level.children.filter((id) => id !== slab.id) };
267
+ delete nodes[slab.id];
268
+ }
269
+ return nodes;
270
+ }
271
+ function absorbCompleteManualFloors(source) {
272
+ let nodes = source;
273
+ const slabs = Object.values(source).filter((node) => node.type === 'slab');
274
+ for (const slab of slabs) {
275
+ if (slab.autoFromWalls ||
276
+ slab.boundary === 'auto' ||
277
+ slab.plateRole ||
278
+ slab.support === 'open' ||
279
+ slab.recessed ||
280
+ slab.visible === false ||
281
+ slab.metadata?.plateMigration?.demoted !== undefined ||
282
+ !slab.parentId)
283
+ continue;
284
+ const rooms = Object.values(source).filter((node) => node.type === 'zone' &&
285
+ node.parentId === slab.parentId &&
286
+ node.spaceRole === 'room' &&
287
+ node.floor?.sourceSlabId === slab.id);
288
+ if (!rooms.length || rooms.length !== slab.associatedZoneIds?.length)
289
+ continue;
290
+ const levelSlabs = slabs.filter((other) => other.parentId === slab.parentId);
291
+ const levelRooms = Object.values(source).filter((node) => node.type === 'zone' && node.parentId === slab.parentId && node.spaceRole === 'room');
292
+ const completeLevel = levelRooms.length > 0 &&
293
+ levelSlabs.every((other) => !other.autoFromWalls &&
294
+ other.boundary !== 'auto' &&
295
+ !other.plateRole &&
296
+ !other.recessed &&
297
+ Math.abs(other.elevation - slab.elevation) <= 1e-6 &&
298
+ Math.abs(other.thickness - slab.thickness) <= 1e-6 &&
299
+ levelRooms.some((room) => room.floor?.sourceSlabId === other.id)) &&
300
+ levelRooms.every((room) => levelSlabs.some((other) => room.floor?.sourceSlabId === other.id));
301
+ if (!completeLevel)
302
+ continue;
303
+ if (rooms.some((room) => room.floor?.elevation !== undefined &&
304
+ Math.abs(room.floor.elevation - slab.elevation) > 0.02 + 1e-9) ||
305
+ slabs.some((other) => other.id !== slab.id &&
306
+ other.parentId === slab.parentId &&
307
+ area(intersection(slabFootprint(other), slabFootprint(slab))) > 1e-4))
308
+ continue;
309
+ const footprint = union(rooms.map(slabFootprint));
310
+ const outside = { outer: slab.polygon, holes: [] };
311
+ const tolerance = Math.max(1e-4, area([outside]) * 1e-4);
312
+ try {
313
+ if (area(difference(outside, footprint, { throwOnError: true })) > tolerance ||
314
+ area(difference(footprint, outside, { throwOnError: true })) > tolerance)
315
+ continue;
316
+ }
317
+ catch {
318
+ continue;
319
+ }
320
+ if (nodes === source)
321
+ nodes = { ...source };
322
+ nodes[slab.id] = {
323
+ ...parseSlabConstruction(slab),
324
+ boundary: 'auto',
325
+ plateRole: 'base',
326
+ autoFromWalls: true,
327
+ zoneIds: rooms.map((room) => room.id).sort(),
328
+ associatedZoneIds: undefined,
329
+ referenceFloorElevation: slab.elevation,
330
+ foundation: slab.fillToTerrain ? { type: 'solid' } : { type: 'none' },
331
+ fillToTerrain: undefined,
332
+ };
333
+ for (const room of rooms) {
334
+ const { sourceSlabId: _sourceSlabId, ...floor } = room.floor ?? {};
335
+ nodes[room.id] = {
336
+ ...room,
337
+ floor: {
338
+ ...floor,
339
+ elevation: floor.elevation ?? slab.elevation,
340
+ finish: floor.finish ?? slab.slots?.surface ?? slab.material ?? slab.materialPreset,
341
+ },
342
+ };
343
+ }
344
+ }
345
+ return nodes;
346
+ }
347
+ function clearDanglingFloorSources(nodes) {
348
+ let changed = false;
349
+ for (const zone of Object.values(nodes)) {
350
+ if (zone.type !== 'zone' || !zone.floor?.sourceSlabId)
351
+ continue;
352
+ if (nodes[zone.floor.sourceSlabId]?.type === 'slab')
353
+ continue;
354
+ const { sourceSlabId: _missing, ...floor } = zone.floor;
355
+ nodes[zone.id] = { ...zone, floor };
356
+ changed = true;
357
+ }
358
+ return changed;
359
+ }
360
+ /** A level whose hand-drawn floor pieces cannot be adopted exactly: migrate it without them. */
361
+ class AdoptionRejected extends Error {
362
+ }
363
+ function migrateFloorPlatesOnView(sourceNodes) {
364
+ // Adoption is all-or-nothing per level: a level whose pieces are not all
365
+ // consumed migrates exactly as it would without adoption.
366
+ const skip = new Set();
367
+ for (;;) {
368
+ const adoption = planFloorPieceAdoption(sourceNodes, skip);
369
+ const result = runFloorPlateMigration(sourceNodes, adoption);
370
+ const failed = [...adoption.levels.keys()].filter((levelId) => [...adoption.pieces].some(([id, level]) => level === levelId &&
371
+ result.nodes[id]?.type === 'slab' &&
372
+ !result.nodes[id].plateRole));
373
+ if (!failed.length)
374
+ return result;
375
+ for (const levelId of failed)
376
+ skip.add(levelId);
377
+ }
378
+ }
379
+ function runFloorPlateMigration(sourceNodes, adoption) {
380
+ const slotMigration = migrateSlabSlots(sourceNodes);
381
+ const nodes = { ...slotMigration.nodes };
382
+ for (const id of adoption.pieces.keys())
383
+ nodes[id] = { ...nodes[id], autoFromWalls: true };
384
+ const plateIds = [];
385
+ const reports = [];
386
+ const remap = new Map();
387
+ let changed = slotMigration.changed;
388
+ if (clearDanglingFloorSources(nodes))
389
+ changed = true;
390
+ for (const level of Object.values(nodes)) {
391
+ if (level.type !== 'level' || !level.metadata?.legacyRoomMigrationPending)
392
+ continue;
393
+ if (Object.values(nodes).some((node) => node.type === 'slab' && node.parentId === level.id))
394
+ continue;
395
+ for (const zone of Object.values(nodes)) {
396
+ if (zone.type !== 'zone' || zone.parentId !== level.id || zone.hasFloor !== undefined)
397
+ continue;
398
+ nodes[zone.id] = { ...zone, hasFloor: false };
399
+ changed = true;
400
+ }
401
+ }
402
+ for (const source of Object.values(nodes)) {
403
+ if (source.type !== 'slab' || !Object.hasOwn(source, 'legacyFloor'))
404
+ continue;
405
+ const { legacyFloor, ...plate } = source;
406
+ nodes[source.id] = {
407
+ ...plate,
408
+ referenceFloorElevation: plate.referenceFloorElevation ?? legacyFloor,
409
+ };
410
+ changed = true;
411
+ }
412
+ if (Object.values(nodes).some((node) => node.type === 'slab' && !node.plateRole) &&
413
+ !Object.values(nodes).some((node) => node.type === 'slab' && node.plateRole)) {
414
+ const converted = convertLegacyFinishSlabs(nodes);
415
+ if (converted !== nodes) {
416
+ Object.assign(nodes, converted);
417
+ for (const id of Object.keys(nodes))
418
+ if (!(id in converted))
419
+ delete nodes[id];
420
+ changed = true;
421
+ }
422
+ // Adopted pieces are still hand-drawn history: they neither mark legacy
423
+ // wall-generated openings nor hold back the level's finalisation.
424
+ const history = adoption.pieces.size
425
+ ? Object.fromEntries(Object.entries(nodes).map(([id, node]) => [
426
+ id,
427
+ adoption.pieces.has(id) ? { ...node, autoFromWalls: false } : node,
428
+ ]))
429
+ : nodes;
430
+ const associated = associateLegacyManualFloors(nodes, history, !Object.values(nodes).some((node) => node.type === 'slab' &&
431
+ node.autoFromWalls &&
432
+ !node.plateRole &&
433
+ !adoption.pieces.has(node.id)));
434
+ if (associated !== nodes) {
435
+ Object.assign(nodes, associated);
436
+ changed = true;
437
+ }
438
+ const absorbed = absorbCompleteManualFloors(nodes);
439
+ if (absorbed !== nodes) {
440
+ Object.assign(nodes, absorbed);
441
+ changed = true;
442
+ }
443
+ }
444
+ for (const level of Object.values(nodes)) {
445
+ if (level.type !== 'level' || !Object.hasOwn(level, 'floorElevation'))
446
+ continue;
447
+ const { floorElevation, ...clean } = level;
448
+ nodes[level.id] = clean;
449
+ for (const plate of Object.values(nodes))
450
+ if (plate.type === 'slab' &&
451
+ plate.parentId === level.id &&
452
+ (plate.plateRole === 'base' ||
453
+ (!plate.plateRole &&
454
+ plate.support !== 'open' &&
455
+ (plate.autoFromWalls || plate.boundary === 'auto'))))
456
+ nodes[plate.id] = { ...plate, floorHeight: floorElevation ?? plate.floorHeight };
457
+ changed = true;
458
+ }
459
+ for (const plate of Object.values(nodes)) {
460
+ if (plate.type !== 'slab' || plate.plateRole !== 'base')
461
+ continue;
462
+ if (!plate.foundation || Object.hasOwn(plate, 'fillToTerrain')) {
463
+ const { fillToTerrain, ...clean } = plate;
464
+ nodes[plate.id] = {
465
+ ...clean,
466
+ foundation: plate.foundation ?? {
467
+ type: fillToTerrain ? 'solid' : 'none',
468
+ ...(fillToTerrain
469
+ ? { material: plate.slots?.edge ?? plate.slots?.side ?? '#cccccc' }
470
+ : {}),
471
+ },
472
+ };
473
+ changed = true;
474
+ }
475
+ }
476
+ for (const plate of Object.values(nodes)) {
477
+ if (plate.type !== 'slab' || plate.support !== 'open' || plate.boundary !== 'auto')
478
+ continue;
479
+ for (const id of plate.zoneIds ?? []) {
480
+ const zone = nodes[id];
481
+ if (zone?.type !== 'zone')
482
+ continue;
483
+ const floorEdgeFinish = zone.floorEdgeFinish ?? plate.slots?.edge;
484
+ const finish = zone.floor?.finish ?? plate.slots?.surface ?? plate.material ?? plate.materialPreset;
485
+ if (floorEdgeFinish === zone.floorEdgeFinish && finish === zone.floor?.finish)
486
+ continue;
487
+ nodes[id] = {
488
+ ...zone,
489
+ ...(floorEdgeFinish === undefined ? {} : { floorEdgeFinish }),
490
+ ...(finish === undefined ? {} : { floor: { ...zone.floor, finish } }),
491
+ };
492
+ changed = true;
493
+ }
494
+ }
495
+ for (const level of Object.values(nodes)
496
+ .filter((node) => node.type === 'level')
497
+ .sort((a, b) => a.level - b.level || a.id.localeCompare(b.id))) {
498
+ const children = Object.values(nodes)
499
+ .filter((node) => node.parentId === level.id)
500
+ .sort((a, b) => a.id.localeCompare(b.id));
501
+ if (!children.some((node) => node.type === 'slab' &&
502
+ (node.autoFromWalls || node.boundary === 'auto') &&
503
+ !node.plateRole &&
504
+ node.support !== 'open'))
505
+ continue;
506
+ const beforeNodes = { ...nodes };
507
+ const beforeRemap = new Map(remap);
508
+ const beforePlateCount = plateIds.length;
509
+ const beforeChanged = changed;
510
+ try {
511
+ const recessed = children.filter((node) => node.type === 'slab' && node.autoFromWalls && !node.boundary && node.recessed);
512
+ if (recessed.length)
513
+ warnPlateFailure(level.id, recessed.map((node) => node.id), 'recessed-legacy: preserved verbatim');
514
+ const demotionReasons = new Map();
515
+ const demoteUnmatched = (reason) => {
516
+ for (const node of children) {
517
+ if (node.type !== 'slab' ||
518
+ (!node.autoFromWalls && node.boundary !== 'auto') ||
519
+ node.recessed ||
520
+ !nodes[node.id] ||
521
+ nodes[node.id].plateRole)
522
+ continue;
523
+ // Unmatched legacy geometry is authored construction, not a room generator.
524
+ nodes[node.id] = {
525
+ ...nodes[node.id],
526
+ autoFromWalls: false,
527
+ boundary: undefined,
528
+ metadata: {
529
+ ...node.metadata,
530
+ plateMigration: {
531
+ demoted: demotionReasons.get(node.id) === 'has-floor-disabled'
532
+ ? 'has-floor-disabled'
533
+ : (reason ?? demotionReasons.get(node.id)),
534
+ },
535
+ },
536
+ };
537
+ changed = true;
538
+ }
539
+ };
540
+ const adopted = adoption.levels.get(level.id);
541
+ const reject = () => {
542
+ if (adopted)
543
+ throw new AdoptionRejected();
544
+ };
545
+ const legacy = children
546
+ .filter((node) => node.type === 'slab' &&
547
+ (node.autoFromWalls || node.boundary === 'auto') &&
548
+ !node.plateRole &&
549
+ node.support !== 'open' &&
550
+ !node.recessed)
551
+ .map((node) => parseSlabConstruction(node));
552
+ if (!legacy.length)
553
+ continue;
554
+ const walls = children.filter((node) => node.type === 'wall');
555
+ const separators = children.filter((node) => node.type === 'separator');
556
+ const zones = children.filter((node) => node.type === 'zone' &&
557
+ node.spaceRole === 'room' &&
558
+ node.enclosureStatus !== 'open' &&
559
+ node.floor?.support !== 'open');
560
+ const faces = floorRoomFaces([...walls, ...separators]);
561
+ const boundsOf = (ring) => ({
562
+ minX: Math.min(...ring.map(([x]) => x)),
563
+ maxX: Math.max(...ring.map(([x]) => x)),
564
+ minZ: Math.min(...ring.map(([, z]) => z)),
565
+ maxZ: Math.max(...ring.map(([, z]) => z)),
566
+ });
567
+ const intersectsBounds = (a, b) => a.minX <= b.maxX && b.minX <= a.maxX && a.minZ <= b.maxZ && b.minZ <= a.maxZ;
568
+ const boundedFaces = faces.map((face) => ({
569
+ face,
570
+ bounds: boundsOf(face.referencePolygon),
571
+ }));
572
+ const boundedLegacy = legacy.map((slab) => ({ slab, bounds: boundsOf(slab.polygon) }));
573
+ const miters = calculateLevelMiters(walls);
574
+ const context = {
575
+ revision: 0,
576
+ walls: new Map(walls.map((wall) => [wall.id, wall])),
577
+ wallFootprints: new Map(walls.map((wall) => [
578
+ wall.id,
579
+ getWallPlanFootprint(wall, miters).map(({ x, y }) => [x, y]),
580
+ ])),
581
+ };
582
+ const allSlabs = children.filter((node) => node.type === 'slab');
583
+ const manualCoverage = union(allSlabs
584
+ .filter((slab) => !slab.autoFromWalls && slab.boundary !== 'auto')
585
+ .map(slabFootprint));
586
+ for (const slab of legacy) {
587
+ const surface = union([slabFootprint(slab)]);
588
+ const disabled = zones.some((zone) => zone.hasFloor === false &&
589
+ footprintIoU(slabFootprint(zone), slabFootprint(slab)) >= 0.6);
590
+ demotionReasons.set(slab.id, disabled
591
+ ? 'has-floor-disabled'
592
+ : area(surface) > 0 &&
593
+ area(intersection(surface, manualCoverage)) >= area(surface) * 0.6
594
+ ? 'manual-coverage'
595
+ : faces.length
596
+ ? walls.some((wall) => wall.curveOffset)
597
+ ? 'curved-face-mismatch'
598
+ : 'stale-or-unmatched-straight'
599
+ : 'no-detected-room');
600
+ }
601
+ const linked = new Set(allSlabs
602
+ .filter((slab) => slab.boundary === 'auto' && slab.plateRole)
603
+ .flatMap((slab) => slab.zoneIds ?? []));
604
+ const wallArea = union([...context.wallFootprints.values()]);
605
+ const renderContext = prepareSlabPolygonContext({ walls, siblingSlabs: allSlabs });
606
+ const renderedSlabs = new Map(allSlabs.map((slab) => [slab.id, getRenderableSlabPolygon(slab, renderContext)]));
607
+ const legacySurfaces = new Map(legacy.map((slab) => [
608
+ slab.id,
609
+ {
610
+ outer: renderedSlabs.get(slab.id),
611
+ holes: [],
612
+ },
613
+ ]));
614
+ const sources = new Map();
615
+ const rooms = [];
616
+ for (const zone of zones) {
617
+ if (linked.has(zone.id))
618
+ continue;
619
+ const zoneFootprint = slabFootprint(zone);
620
+ const zoneBounds = boundsOf(zone.polygon);
621
+ const face = boundedFaces
622
+ .filter((entry) => intersectsBounds(zoneBounds, entry.bounds))
623
+ .map(({ face }) => ({
624
+ face,
625
+ iou: footprintIoU(zoneFootprint, {
626
+ outer: face.referencePolygon,
627
+ holes: face.holes,
628
+ }),
629
+ }))
630
+ .sort((a, b) => b.iou - a.iou)[0];
631
+ if (!face || face.iou < 0.9 || zone.hasFloor === false)
632
+ continue;
633
+ const candidates = boundedLegacy
634
+ .filter((entry) => intersectsBounds(zoneBounds, entry.bounds))
635
+ .map(({ slab }) => ({
636
+ slab,
637
+ overlap: area(intersection(slabFootprint(slab), zoneFootprint)),
638
+ iou: footprintIoU(slabFootprint(slab), zoneFootprint),
639
+ }))
640
+ .filter(({ overlap }) => overlap > 0)
641
+ .sort((a, b) => b.overlap - a.overlap || b.iou - a.iou || a.slab.id.localeCompare(b.slab.id));
642
+ const source = candidates[0]?.slab;
643
+ const boundaryWalls = union([...new Set(face.face.spans.map((span) => span.boundaryId))].flatMap((id) => context.wallFootprints.has(id) ? [context.wallFootprints.get(id)] : []));
644
+ let clear = union([slabFootprint(zone)]);
645
+ try {
646
+ clear = difference(clear, boundaryWalls, { throwOnError: true });
647
+ }
648
+ catch {
649
+ // If wall subtraction fails, require coverage of the entire reference
650
+ // face instead of treating a clipping failure as an empty room.
651
+ }
652
+ if (!clear.length)
653
+ continue;
654
+ // A stale/sliver slab overlap is not evidence that this whole face had a floor.
655
+ // Subtract only nearby surfaces: unioning every legacy slab can fail on
656
+ // distant self-intersections and incorrectly suppress otherwise valid rooms.
657
+ const uncovered = candidates.reduce((remaining, { slab }) => {
658
+ try {
659
+ return difference(remaining, legacySurfaces.get(slab.id), { throwOnError: true });
660
+ }
661
+ catch {
662
+ return remaining;
663
+ }
664
+ }, clear);
665
+ const open = adopted?.voids.length
666
+ ? difference(uncovered, union(adopted.voids.map((ring) => ({ outer: ring, holes: [] }))))
667
+ : uncovered;
668
+ if (area(open) > Math.max(1e-6, area(clear) * 0.01))
669
+ continue;
670
+ const recessed = allSlabs.some((slab) => slab.recessed &&
671
+ area(intersection({ outer: slab.polygon, holes: [] }, clear)) >= area(clear) * 0.6);
672
+ if (recessed)
673
+ continue;
674
+ if (!source)
675
+ continue;
676
+ const floor = { ...zone.floor };
677
+ // Partial cover by a piece is an open void in the plate, not an authored floor.
678
+ if (adopted && legacy.some((slab) => slab.id === floor.sourceSlabId))
679
+ delete floor.sourceSlabId;
680
+ const finish = source.slots?.surface ?? source.material ?? source.materialPreset;
681
+ if (finish !== undefined && floor.finish === undefined)
682
+ floor.finish = finish;
683
+ // Keep legacy F even when it matches this room's automatic datum:
684
+ // the connected footprint can inherit a higher automatic datum.
685
+ if (floor.elevation === undefined)
686
+ floor.elevation = source.elevation;
687
+ const updated = Object.keys(floor).length ? { ...zone, floor } : zone;
688
+ nodes[zone.id] = updated;
689
+ sources.set(zone.id, source);
690
+ rooms.push({
691
+ id: zone.id,
692
+ zone: updated,
693
+ polygon: face.face.referencePolygon,
694
+ holes: face.face.holes,
695
+ spans: face.face.spans,
696
+ context,
697
+ });
698
+ }
699
+ if (!rooms.length) {
700
+ reject();
701
+ demoteUnmatched();
702
+ continue;
703
+ }
704
+ // Legacy support uses rendered slabs, without the new room-face datums.
705
+ const oldSupports = legacyWallElevations(walls, allSlabs, beforeNodes, level.id);
706
+ const derived = autoRoomVerticalPlacements(rooms, nodes);
707
+ const defaultFloor = derived.size ? Math.max(...derived.values()) : DEFAULT_SLAB_ELEVATION;
708
+ const componentFloors = new Map();
709
+ const referenceFloors = new Map();
710
+ for (const component of plateFootprint(rooms)) {
711
+ const members = rooms.filter((room) => area(intersection(slabFootprint(room), component)) > 0);
712
+ const inherited = members
713
+ .map((room) => sources.get(room.id)?.floorHeight)
714
+ .find((height) => height !== undefined);
715
+ const boundaryIds = new Set(members.flatMap((room) => room.spans.map((span) => span.boundaryId)));
716
+ // The footprint keeps the floor height most of its floor area had (on a
717
+ // tie, the one the walls give anyway). The wall-derived datum can differ
718
+ // (a pad under one wall, an authored slab height); re-deriving it sinks
719
+ // the other rooms and lifts walls onto a band with a gap under it.
720
+ const grounded = members.filter((room) => !room.zone.floor?.sourceSlabId);
721
+ const automatic = grounded.length
722
+ ? Math.max(...grounded.map((room) => derived.get(room.zone.id) ?? DEFAULT_SLAB_ELEVATION))
723
+ : undefined;
724
+ const candidates = new Map();
725
+ for (const room of grounded) {
726
+ const source = sources.get(room.id);
727
+ if (!source)
728
+ continue;
729
+ const floor = Math.round(source.elevation * 1e6) / 1e6;
730
+ const entry = candidates.get(floor) ?? { area: 0, thickness: source.thickness };
731
+ entry.area += area([slabFootprint(room)]);
732
+ entry.thickness = Math.max(entry.thickness, source.thickness);
733
+ candidates.set(floor, entry);
734
+ }
735
+ const largest = Math.max(0, ...[...candidates.values()].map((entry) => entry.area));
736
+ const [referenceFloor] = [...candidates]
737
+ .filter(([, entry]) => entry.area >= largest * 0.99)
738
+ .sort(([a], [b]) => Math.abs(a - (automatic ?? a)) - Math.abs(b - (automatic ?? b)) || a - b)[0] ?? [];
739
+ if (inherited === undefined &&
740
+ referenceFloor !== undefined &&
741
+ automatic !== undefined &&
742
+ Math.abs(referenceFloor - automatic) > 0.005)
743
+ for (const room of grounded) {
744
+ const source = sources.get(room.id);
745
+ if (source)
746
+ referenceFloors.set(source.id, referenceFloor);
747
+ }
748
+ const weights = new Map();
749
+ for (const wall of walls) {
750
+ if (!boundaryIds.has(wall.id))
751
+ continue;
752
+ const support = oldSupports.get(wall.id);
753
+ const elevation = Math.round((support.elevation - (wall.supportOffset ?? 0)) * 1e6) / 1e6;
754
+ weights.set(elevation, (weights.get(elevation) ?? 0) + getWallCurveLength(wall));
755
+ }
756
+ const height = inherited ??
757
+ [...weights].sort((a, b) => b[1] - a[1] || a[0] - b[0])[0]?.[0] ??
758
+ defaultFloor;
759
+ for (const room of members)
760
+ componentFloors.set(room.id, height);
761
+ }
762
+ for (const room of rooms) {
763
+ const levelFloor = componentFloors.get(room.id) ?? defaultFloor;
764
+ if (Math.abs((sources.get(room.id)?.elevation ?? levelFloor) - levelFloor) > 0.005)
765
+ reports.push({ code: 'floor-moved', nodeId: room.id });
766
+ }
767
+ const preserveWallSupportedLegacy = () => {
768
+ reject();
769
+ for (const room of rooms) {
770
+ const source = sources.get(room.id);
771
+ if (!source)
772
+ continue;
773
+ const zone = nodes[room.id];
774
+ nodes[room.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: source.id } };
775
+ }
776
+ demoteUnmatched('wall-supported-floor');
777
+ };
778
+ const supportedSources = new Set([...oldSupports.values()].flatMap((support) => support.electedSlabId ? [support.electedSlabId] : []));
779
+ if (rooms.some((room) => room.zone.autoFromWalls &&
780
+ supportedSources.has(sources.get(room.id)?.id ?? '') &&
781
+ (sources.get(room.id)?.elevation ?? 0) >
782
+ (componentFloors.get(room.id) ?? defaultFloor) + 0.005)) {
783
+ preserveWallSupportedLegacy();
784
+ continue;
785
+ }
786
+ const converted = legacy
787
+ .filter((slab) => [...sources.values()].some((source) => source.id === slab.id))
788
+ .map((slab) => ({
789
+ ...slab,
790
+ boundary: 'auto',
791
+ floorHeight: slab.floorHeight,
792
+ referenceFloorElevation: referenceFloors.get(slab.id),
793
+ foundation: slab.foundation ?? {
794
+ type: slab.fillToTerrain ? 'solid' : 'none',
795
+ ...(slab.fillToTerrain
796
+ ? { material: slab.slots?.edge ?? slab.slots?.side ?? '#cccccc' }
797
+ : {}),
798
+ },
799
+ zoneIds: rooms
800
+ .filter((room) => sources.get(room.id)?.id === slab.id)
801
+ .map((room) => room.id),
802
+ }));
803
+ // Finish overlays must be consumed before manual coverage can suppress their room.
804
+ const regions = new Set();
805
+ const sourceCoverage = union(converted.map(slabFootprint));
806
+ for (const node of children) {
807
+ if (node.type !== 'slab' || node.autoFromWalls || node.boundary === 'auto' || node.recessed)
808
+ continue;
809
+ const slab = parseSlabConstruction(node);
810
+ const surface = union([slabFootprint(slab)]);
811
+ // A manual floor filling an opening in the old construction is structural,
812
+ // not a finish overlay; deleting it would expose that opening.
813
+ if (area(difference(surface, sourceCoverage)) > Math.max(1e-6, area(surface) * 0.01))
814
+ continue;
815
+ const room = rooms.find(({ zone }) => Math.abs(slab.elevation - (zone.floor?.elevation ?? DEFAULT_SLAB_ELEVATION)) <=
816
+ 0.02 + 1e-9 &&
817
+ area(intersection(surface, slabFootprint(zone))) >= area(surface) * (1 - 1e-3));
818
+ if (!room)
819
+ continue;
820
+ const finish = slab.slots?.surface ?? slab.material ?? slab.materialPreset ?? 'library:wood-woodplank48';
821
+ const polygon = slabFootprint(slab);
822
+ const xs = [...new Set(slab.holes.flatMap((hole) => hole.map(([x]) => x)))].sort((a, b) => a - b);
823
+ const minX = Math.min(...slab.polygon.map(([x]) => x));
824
+ const maxX = Math.max(...slab.polygon.map(([x]) => x));
825
+ const minZ = Math.min(...slab.polygon.map(([, z]) => z));
826
+ const maxZ = Math.max(...slab.polygon.map(([, z]) => z));
827
+ const cuts = [...new Set([minX, ...xs, maxX])].sort((a, b) => a - b);
828
+ const regionPolygons = slab.holes.length
829
+ ? cuts.slice(1).flatMap((x, i) => intersection(polygon, [
830
+ [cuts[i], minZ],
831
+ [x, minZ],
832
+ [x, maxZ],
833
+ [cuts[i], maxZ],
834
+ ]).map((part) => part.outer))
835
+ : [slab.polygon];
836
+ const zone = nodes[room.id];
837
+ nodes[zone.id] = {
838
+ ...zone,
839
+ floor: {
840
+ ...zone.floor,
841
+ regions: [
842
+ ...(zone.floor?.regions ?? []),
843
+ ...regionPolygons.map((polygon, i) => ({
844
+ id: i ? `${slab.id}_${i}` : slab.id,
845
+ polygon,
846
+ finish,
847
+ })),
848
+ ],
849
+ },
850
+ };
851
+ regions.add(slab.id);
852
+ remap.set(slab.id, sources.get(room.id).id);
853
+ }
854
+ const plan = buildFloorPlates({
855
+ levelId: level.id,
856
+ nodes: Object.fromEntries(Object.entries(nodes).filter(([id]) => !regions.has(id))),
857
+ rooms,
858
+ slabs: [
859
+ ...converted,
860
+ ...children
861
+ .filter((node) => node.type === 'slab' &&
862
+ !node.autoFromWalls &&
863
+ node.boundary !== 'auto' &&
864
+ !regions.has(node.id))
865
+ .map((slab) => parseSlabConstruction(slab)),
866
+ ],
867
+ mintId: (ids, component, role) => floorPlateId(level.id, role ?? 'base', ids, component),
868
+ renderedManualCuts: false,
869
+ });
870
+ for (const source of converted) {
871
+ for (const [index, hole] of (source.holes ?? []).entries()) {
872
+ const holeArea = area([{ outer: hole, holes: [] }]);
873
+ if (holeArea < 1e-4)
874
+ continue;
875
+ const plateIndex = plan.plates.findIndex((plate) => Math.abs(plate.elevation - source.elevation) <= 1e-6 &&
876
+ area(intersection(hole, slabFootprint(plate))) >= holeArea - 1e-4);
877
+ if (plateIndex < 0)
878
+ continue;
879
+ const plate = plan.plates[plateIndex];
880
+ if (plate.holes.some((existing) => area(intersection(existing, hole)) >= holeArea - 1e-4 &&
881
+ Math.abs(area([{ outer: existing, holes: [] }]) - holeArea) <= 1e-4))
882
+ continue;
883
+ plan.plates[plateIndex] = {
884
+ ...plate,
885
+ holes: [...plate.holes, hole],
886
+ holeMetadata: [
887
+ ...plate.holeMetadata,
888
+ source.holeMetadata?.[index] ?? { source: 'manual' },
889
+ ],
890
+ };
891
+ }
892
+ }
893
+ const expandsLegacySource = plan.plates.some((plate) => {
894
+ const source = legacySurfaces.get(plate.id);
895
+ if (!source)
896
+ return false;
897
+ const added = area(difference(slabFootprint(plate), [source]));
898
+ return area([source]) < 5 && added > Math.max(10, area([source]) * 5);
899
+ });
900
+ if (expandsLegacySource) {
901
+ reject();
902
+ demoteUnmatched('excess-plate-extent');
903
+ continue;
904
+ }
905
+ const retained = allSlabs.filter((slab) => !legacy.some((source) => source.id === slab.id) && !regions.has(slab.id));
906
+ const retainedConstruction = retained.filter((slab) => slab.visible !== false && slab.support !== 'open' && !slab.recessed);
907
+ if (retainedConstruction.length) {
908
+ const retainedFootprint = union(retainedConstruction.map((slab) => ({
909
+ outer: renderedSlabs.get(slab.id),
910
+ holes: slab.holes,
911
+ })));
912
+ const oldOverlap = intersection(retainedFootprint, union(legacy.map((slab) => legacySurfaces.get(slab.id))));
913
+ const newOverlap = intersection(retainedFootprint, union(plan.plates.map(slabFootprint)));
914
+ if (area(difference(newOverlap, oldOverlap)) > 1e-4) {
915
+ preserveWallSupportedLegacy();
916
+ continue;
917
+ }
918
+ const nextRenderContext = prepareSlabPolygonContext({
919
+ walls,
920
+ siblingSlabs: [...retained, ...plan.plates],
921
+ });
922
+ if (retainedConstruction.some((slab) => {
923
+ if (slab.boundary === 'auto')
924
+ return false;
925
+ const before = renderedSlabs.get(slab.id);
926
+ const after = getRenderableSlabPolygon(slab, nextRenderContext);
927
+ return area(difference(before, after)) + area(difference(after, before)) > 1e-4;
928
+ })) {
929
+ preserveWallSupportedLegacy();
930
+ continue;
931
+ }
932
+ }
933
+ const wallSupports = new Set([...oldSupports.values()].flatMap((support) => support.electedSlabId ? [support.electedSlabId] : []));
934
+ if (rooms.some((room) => room.zone.autoFromWalls) &&
935
+ (plan.plates.some((plate) => plate.plateRole !== 'base' &&
936
+ wallSupports.has(plate.id) &&
937
+ legacy.some((source) => source.id === plate.id)) ||
938
+ walls.some((wall) => {
939
+ const sourceId = oldSupports.get(wall.id)?.electedSlabId;
940
+ if (!sourceId || !legacy.some((source) => source.id === sourceId))
941
+ return false;
942
+ const next = plan.plates.find((plate) => plate.id === sourceId);
943
+ return next !== undefined && !wallOverlapsSlabFootprint(wall, next.polygon, next.holes);
944
+ }))) {
945
+ preserveWallSupportedLegacy();
946
+ continue;
947
+ }
948
+ const nextSlabs = [...retained, ...plan.plates];
949
+ const visibleTops = (slabs) => new Set(slabs
950
+ .filter((slab) => slab.visible !== false && slab.support !== 'open' && !slab.recessed)
951
+ .map((slab) => Math.round(slab.elevation * 1000)));
952
+ const oldTops = visibleTops(allSlabs);
953
+ const newTops = visibleTops(nextSlabs);
954
+ const sameSingleTop = oldTops.size === 1 &&
955
+ newTops.size === 1 &&
956
+ Math.abs([...oldTops][0] - [...newTops][0]) <= 20;
957
+ if (!sameSingleTop &&
958
+ visibleFloorTopChange(allSlabs, nextSlabs, [...context.wallFootprints.values()]) > 0.05) {
959
+ for (const room of rooms) {
960
+ const source = sources.get(room.id);
961
+ if (!source)
962
+ continue;
963
+ const zone = nodes[room.id];
964
+ nodes[room.id] = { ...zone, floor: { ...zone.floor, sourceSlabId: source.id } };
965
+ }
966
+ reject();
967
+ demoteUnmatched('visible-floor-top');
968
+ continue;
969
+ }
970
+ const oldFloor = union(allSlabs.map((slab) => ({
971
+ outer: renderedSlabs.get(slab.id),
972
+ holes: slab.holes ?? [],
973
+ })));
974
+ const nextFloor = () => union([
975
+ ...retained.map((slab) => ({
976
+ outer: renderedSlabs.get(slab.id),
977
+ holes: slab.holes ?? [],
978
+ })),
979
+ ...plan.plates.map(slabFootprint),
980
+ ]);
981
+ // A hidden wall hides no floor: pieces are compared on what is seen.
982
+ const seenWalls = adopted
983
+ ? union(walls
984
+ .filter((wall) => wall.visible !== false)
985
+ .map((wall) => ({ outer: context.wallFootprints.get(wall.id), holes: [] })))
986
+ : wallArea;
987
+ const visibleBefore = difference(oldFloor, seenWalls);
988
+ let visibleAfter = difference(nextFloor(), seenWalls);
989
+ // Hand-drawn pieces: floor the plate would add stays open (a hole) unless
990
+ // it is a narrow drawing gap; floor it drops must be a thin strip drawn
991
+ // past the walls, outside every room.
992
+ let trimmed = [];
993
+ let voidHoles = 0;
994
+ // No measurable old floor (invalid piece geometry): nothing proves the plate matches it.
995
+ if (adopted && !oldFloor.length)
996
+ reject();
997
+ if (adopted) {
998
+ for (const part of difference(visibleAfter, visibleBefore)) {
999
+ if (area([part]) <= 1e-4 || partWidth(part) <= PIECE_GAP_WIDTH + 1e-9)
1000
+ continue;
1001
+ const plate = plan.plates.find((candidate) => candidate.plateRole === 'base' &&
1002
+ area(difference(part, slabFootprint(candidate))) <= 1e-6);
1003
+ // A hole survives re-derivation; a notch in the plate's outline would not.
1004
+ if (!plate ||
1005
+ part.holes.length ||
1006
+ part.outer.some((point) => distanceToBoundary([{ outer: plate.polygon, holes: [] }], point) <= 1e-3))
1007
+ reject();
1008
+ plate.holes = [...plate.holes, part.outer];
1009
+ plate.holeMetadata = [...plate.holeMetadata, { source: 'manual' }];
1010
+ voidHoles++;
1011
+ }
1012
+ visibleAfter = difference(nextFloor(), seenWalls);
1013
+ const kept = union([...visibleAfter, ...seenWalls]);
1014
+ const roomArea = union(zones.map(slabFootprint));
1015
+ trimmed = difference(visibleBefore, visibleAfter).filter((part) => area([part]) > 1e-6);
1016
+ for (const part of trimmed)
1017
+ if (area(intersection(part, roomArea)) > 1e-4 ||
1018
+ partWidth(part) > PIECE_TRIM_DEPTH ||
1019
+ part.outer.some((point) => !containsPoint(kept, point) &&
1020
+ distanceToBoundary(kept, point) > PIECE_TRIM_DEPTH + 1e-6))
1021
+ reject();
1022
+ if (area(difference(visibleAfter, visibleBefore)) > Math.max(1e-4, area(visibleBefore) * 0.02))
1023
+ reject();
1024
+ }
1025
+ else if (oldFloor.length &&
1026
+ (area(difference(visibleAfter, visibleBefore)) > 1e-4 ||
1027
+ area(difference(visibleBefore, visibleAfter)) > 1e-4)) {
1028
+ preserveWallSupportedLegacy();
1029
+ continue;
1030
+ }
1031
+ for (const [component, plate] of plan.plates.entries()) {
1032
+ const source = converted.find((source) => source.id === plate.id);
1033
+ if (!source)
1034
+ continue;
1035
+ let preservesSource = false;
1036
+ try {
1037
+ const original = difference(slabFootprint(source), [], { throwOnError: true });
1038
+ const visibleSource = difference({ ...legacySurfaces.get(source.id), holes: source.holes }, wallArea, { throwOnError: true });
1039
+ preservesSource = [original, visibleSource].every((surface) => area(difference(surface, union(plan.plates.map(slabFootprint)), { throwOnError: true })) <= Math.max(1e-6, area(surface) * 0.01));
1040
+ }
1041
+ catch {
1042
+ demotionReasons.set(source.id, 'coverage-error');
1043
+ }
1044
+ if (!preservesSource) {
1045
+ const id = floorPlateId(level.id, plate.plateRole ?? 'open', plate.zoneIds ?? [], component);
1046
+ plan.remap.set(source.id, id);
1047
+ plate.id = id;
1048
+ }
1049
+ }
1050
+ const generated = new Map();
1051
+ for (const plate of plan.plates) {
1052
+ const id = plate.id;
1053
+ const majority = converted
1054
+ .map((source) => ({
1055
+ source,
1056
+ area: area(intersection(slabFootprint(source), slabFootprint(plate))),
1057
+ }))
1058
+ .sort((a, b) => b.area - a.area || a.source.id.localeCompare(b.source.id))[0]?.source;
1059
+ // An unfinished piece showed the default slab top; its room must not
1060
+ // inherit another piece's finish through the plate's own surface.
1061
+ const surface = adopted &&
1062
+ rooms.some((room) => plate.zoneIds?.includes(room.id) &&
1063
+ nodes[room.id].floor?.finish === undefined)
1064
+ ? undefined
1065
+ : majority;
1066
+ const slots = { ...plate.slots };
1067
+ delete slots.surface;
1068
+ if (surface?.slots?.surface)
1069
+ slots.surface = surface.slots.surface;
1070
+ nodes[id] = {
1071
+ ...plate,
1072
+ id,
1073
+ // A hand-drawn floor's top was authored, not derived from support.
1074
+ ...(plate.plateRole === 'base' &&
1075
+ plate.referenceFloorElevation === undefined &&
1076
+ (adopted || Math.abs(plate.elevation - DEFAULT_SLAB_ELEVATION) > 0.02)
1077
+ ? { referenceFloorElevation: plate.elevation }
1078
+ : {}),
1079
+ slots: plate.plateRole === 'base' || plate.support === 'open' ? slots : undefined,
1080
+ material: surface?.material,
1081
+ materialPreset: surface?.materialPreset,
1082
+ };
1083
+ changed = true;
1084
+ plateIds.push(id);
1085
+ generated.set(plate.id, id);
1086
+ }
1087
+ const partitionContext = {
1088
+ walls,
1089
+ zones: rooms.map((room) => nodes[room.id]),
1090
+ slabs: plan.plates,
1091
+ openings: Object.values(nodes).filter((node) => node.type === 'door' || node.type === 'window'),
1092
+ };
1093
+ const needsSidePaint = [...sources.values()].some((source) => source.slots?.riser || source.slots?.edge);
1094
+ const migratedSides = needsSidePaint
1095
+ ? plan.plates.flatMap((plate) => computePlateSurfacePartition(plate, partitionContext)?.sides ?? [])
1096
+ : [];
1097
+ for (const room of rooms) {
1098
+ const source = sources.get(room.id);
1099
+ if (!source)
1100
+ continue;
1101
+ const sides = migratedSides.filter((side) => side.zoneId === room.id);
1102
+ const zone = nodes[room.id];
1103
+ nodes[room.id] = {
1104
+ ...zone,
1105
+ ...(zone.floorStepFinish === undefined &&
1106
+ source.slots?.riser &&
1107
+ sides.some((s) => s.role === 'riser')
1108
+ ? { floorStepFinish: source.slots.riser }
1109
+ : {}),
1110
+ ...(zone.floorEdgeFinish === undefined &&
1111
+ source.slots?.edge &&
1112
+ sides.some((s) => s.role === 'edge')
1113
+ ? { floorEdgeFinish: source.slots.edge }
1114
+ : {}),
1115
+ };
1116
+ }
1117
+ for (const source of converted) {
1118
+ if (plan.plates.some((plate) => plate.id === source.id))
1119
+ continue;
1120
+ const replacements = adopted
1121
+ ? plan.plates
1122
+ : plan.plates.filter((plate) => plate.zoneIds?.some((id) => source.zoneIds.includes(id)));
1123
+ const replacementCoverage = union(replacements.map(slabFootprint));
1124
+ // Stale slabs can extend beyond every current room. Keep that authored
1125
+ // surface until its remaining area can be represented, rather than erase it.
1126
+ let covered = false;
1127
+ let reason = replacements.length ? 'matched-source-residual' : 'manual-coverage';
1128
+ try {
1129
+ const original = difference(slabFootprint(source), [], { throwOnError: true });
1130
+ const visibleSource = difference({ ...legacySurfaces.get(source.id), holes: source.holes }, wallArea, { throwOnError: true });
1131
+ covered = adopted
1132
+ ? area(difference(difference(visibleSource, replacementCoverage), trimmed)) <= 1e-4
1133
+ : [original, visibleSource].every((surface) => area(difference(surface, replacementCoverage, { throwOnError: true })) <=
1134
+ Math.max(1e-6, area(surface) * 0.01));
1135
+ }
1136
+ catch {
1137
+ // A failed coverage calculation cannot justify deleting stored construction.
1138
+ reason = 'coverage-error';
1139
+ }
1140
+ if (!covered) {
1141
+ demotionReasons.set(source.id, reason);
1142
+ continue;
1143
+ }
1144
+ const target = generated.get(source.id) ?? generated.get(plan.remap.get(source.id) ?? '');
1145
+ remap.set(source.id, target);
1146
+ delete nodes[source.id];
1147
+ changed = true;
1148
+ }
1149
+ if (adopted) {
1150
+ const cover = union(plan.plates.map(slabFootprint));
1151
+ for (const [id, levelId] of adoption.pieces) {
1152
+ if (levelId !== level.id || !nodes[id] || generated.has(id))
1153
+ continue;
1154
+ // A piece no room took as its source (a finish laid on another piece).
1155
+ const surface = difference({ outer: renderedSlabs.get(id), holes: [] }, wallArea);
1156
+ if (area(difference(difference(surface, cover), trimmed)) > 1e-4)
1157
+ reject();
1158
+ const [target] = plan.plates
1159
+ .map((plate) => ({ plate, overlap: area(intersection(surface, slabFootprint(plate))) }))
1160
+ .sort((a, b) => b.overlap - a.overlap || a.plate.id.localeCompare(b.plate.id));
1161
+ remap.set(id, target?.plate.id);
1162
+ delete nodes[id];
1163
+ changed = true;
1164
+ }
1165
+ const finishOf = (slab) => JSON.stringify(floorPieceFinish(slab) ?? null);
1166
+ for (const room of rooms) {
1167
+ const zone = nodes[room.id];
1168
+ const own = JSON.stringify(zone.floor?.finish ?? null);
1169
+ const same = union(legacy
1170
+ .filter((slab) => finishOf(slab) === own)
1171
+ .map((slab) => ({ outer: renderedSlabs.get(slab.id), holes: [] })));
1172
+ const regions = legacy.flatMap((slab) => {
1173
+ const finish = floorPieceFinish(slab);
1174
+ if (finish === undefined || finishOf(slab) === own)
1175
+ return [];
1176
+ const parts = difference(intersection({ outer: renderedSlabs.get(slab.id), holes: [] }, slabFootprint(zone)), same).filter((part) => area([part]) > 0.01 && partWidth(part) > PIECE_GAP_WIDTH);
1177
+ return parts.map((part, i) => ({
1178
+ id: `${slab.id}_${room.id}${i ? `_${i}` : ''}`,
1179
+ polygon: part.outer,
1180
+ finish,
1181
+ }));
1182
+ });
1183
+ if (regions.length)
1184
+ nodes[room.id] = {
1185
+ ...zone,
1186
+ floor: { ...zone.floor, regions: [...(zone.floor?.regions ?? []), ...regions] },
1187
+ };
1188
+ }
1189
+ // Every wall-generated slab and piece is consumed, or the level keeps its slabs.
1190
+ if (legacy.some((slab) => nodes[slab.id] && !nodes[slab.id].plateRole))
1191
+ reject();
1192
+ reports.push({
1193
+ code: 'floor-pieces-absorbed',
1194
+ nodeId: level.id,
1195
+ pieces: [...adoption.pieces].flatMap(([id, levelId]) => levelId === level.id ? [id] : []),
1196
+ trimmed: Math.round(area(trimmed) * 1e4) / 1e4,
1197
+ closed: Math.round(area(difference(visibleAfter, visibleBefore)) * 1e4) / 1e4,
1198
+ holes: voidHoles,
1199
+ });
1200
+ }
1201
+ demoteUnmatched();
1202
+ for (const id of regions)
1203
+ delete nodes[id];
1204
+ const newSupportNodes = { ...nodes };
1205
+ for (const wall of walls) {
1206
+ const old = oldSupports.get(wall.id);
1207
+ const next = wallSupportForNodes(wall, newSupportNodes);
1208
+ const oldTop = wall.height === undefined
1209
+ ? getStoredLevelHeight(level)
1210
+ : (wall.supportSlabId === 'ground' ? old.elevation : Math.max(0, old.elevation)) +
1211
+ wall.height;
1212
+ const newTop = resolveWallTop(wall, getStoredLevelHeight(level), next.elevation);
1213
+ if (wall.height !== undefined && Math.abs(oldTop - newTop) > 0.001)
1214
+ nodes[wall.id] = { ...wall, height: oldTop - next.elevation };
1215
+ for (const id of wall.children ?? []) {
1216
+ const opening = nodes[id];
1217
+ if ((opening?.type !== 'door' && opening?.type !== 'window') ||
1218
+ isFloorAnchoredOpening(opening))
1219
+ continue;
1220
+ const delta = old.elevation - getOpeningFloorDatum(wall, opening, newSupportNodes);
1221
+ if (Math.abs(delta) > 1e-6)
1222
+ nodes[id] = {
1223
+ ...opening,
1224
+ ...(opening.position[1] + delta - opening.height / 2 <= 0.01
1225
+ ? { verticalAnchor: 'wall' }
1226
+ : {}),
1227
+ position: [
1228
+ opening.position[0],
1229
+ Math.round((opening.position[1] + delta) * 1e6) / 1e6,
1230
+ opening.position[2],
1231
+ ],
1232
+ };
1233
+ }
1234
+ const delta = old.elevation - next.elevation;
1235
+ if (wall.faceRegions?.length && Math.abs(delta) > 1e-6)
1236
+ nodes[wall.id] = {
1237
+ ...nodes[wall.id],
1238
+ faceRegions: wall.faceRegions.map((region) => ({
1239
+ ...region,
1240
+ ...(region.v0 === undefined
1241
+ ? {}
1242
+ : { v0: Math.round((region.v0 + delta) * 1e6) / 1e6 }),
1243
+ ...(region.v1 === undefined
1244
+ ? {}
1245
+ : { v1: Math.round((region.v1 + delta) * 1e6) / 1e6 }),
1246
+ })),
1247
+ };
1248
+ }
1249
+ if (level.type === 'level')
1250
+ nodes[level.id] = {
1251
+ ...level,
1252
+ children: [
1253
+ ...level.children.filter((id) => !!nodes[id]),
1254
+ ...[...generated.values()].filter((id) => !level.children.includes(id)),
1255
+ ],
1256
+ };
1257
+ }
1258
+ catch (error) {
1259
+ const rejected = error instanceof AdoptionRejected;
1260
+ for (const id of Object.keys(nodes))
1261
+ delete nodes[id];
1262
+ Object.assign(nodes, beforeNodes);
1263
+ remap.clear();
1264
+ for (const [id, target] of beforeRemap)
1265
+ remap.set(id, target);
1266
+ plateIds.length = beforePlateCount;
1267
+ changed = beforeChanged;
1268
+ if (!rejected)
1269
+ warnPlateFailure(level.id, Object.values(beforeNodes)
1270
+ .filter((node) => node.parentId === level.id)
1271
+ .map((node) => node.id), error);
1272
+ }
1273
+ }
1274
+ for (const node of Object.values(nodes)) {
1275
+ const data = { ...node };
1276
+ let changed = false;
1277
+ for (const field of ['supportSlabId', 'deckSlabId']) {
1278
+ let host = data[field];
1279
+ const seen = new Set();
1280
+ while (host && remap.has(host) && !seen.has(host)) {
1281
+ seen.add(host);
1282
+ host = remap.get(host);
1283
+ }
1284
+ if (host !== data[field]) {
1285
+ data[field] = replacementPlateFor(node, field, Object.values(nodes).filter((n) => n.type === 'slab'), { ...sourceNodes, ...nodes });
1286
+ changed = true;
1287
+ }
1288
+ }
1289
+ if (changed)
1290
+ nodes[node.id] = data;
1291
+ }
1292
+ if (Object.values(sourceNodes).some((node) => node.type === 'slab' &&
1293
+ (node.autoFromWalls || node.boundary === 'auto') &&
1294
+ !node.plateRole)) {
1295
+ const associated = associateLegacyManualFloors(nodes, sourceNodes);
1296
+ if (associated !== nodes) {
1297
+ Object.assign(nodes, associated);
1298
+ changed = true;
1299
+ }
1300
+ }
1301
+ if (!Object.values(sourceNodes).some((node) => node.plateRole)) {
1302
+ const absorbed = absorbCompleteManualFloors(nodes);
1303
+ if (absorbed !== nodes) {
1304
+ Object.assign(nodes, absorbed);
1305
+ changed = true;
1306
+ }
1307
+ }
1308
+ if (clearDanglingFloorSources(nodes))
1309
+ changed = true;
1310
+ if (changed)
1311
+ for (const [id, node] of Object.entries(nodes))
1312
+ if (node !== sourceNodes[id])
1313
+ nodes[id] = omitUndefined(node);
1314
+ const visibleFinishes = new Set(Object.values(nodes)
1315
+ .flatMap((node) => {
1316
+ if (node.type === 'zone')
1317
+ return [
1318
+ node.floor?.finish,
1319
+ node.floorStepFinish,
1320
+ node.floorEdgeFinish,
1321
+ ...(node.floor?.regions ?? []).map((region) => region.finish),
1322
+ ];
1323
+ if (node.type === 'slab')
1324
+ return [node.material, node.materialPreset, ...Object.values(node.slots ?? {})];
1325
+ return [];
1326
+ })
1327
+ .filter((value) => value !== undefined)
1328
+ .map((value) => JSON.stringify(value)));
1329
+ for (const source of Object.values(sourceNodes))
1330
+ if (source.type === 'slab' &&
1331
+ (source.autoFromWalls || source.boundary === 'auto') &&
1332
+ !source.plateRole) {
1333
+ for (const finish of new Set([source.material, source.materialPreset, ...Object.values(source.slots ?? {})].filter((value) => value !== undefined)))
1334
+ if (!visibleFinishes.has(JSON.stringify(finish)))
1335
+ reports.push({ code: 'finish-not-visible', nodeId: source.id, finish });
1336
+ }
1337
+ return { nodes: changed ? nodes : sourceNodes, plateIds, reports };
1338
+ }
1339
+ function migrateSlabSlotsOnView(sourceNodes) {
1340
+ const nodes = { ...sourceNodes };
1341
+ let changed = false;
1342
+ for (const node of Object.values(nodes)) {
1343
+ if (node.type !== 'slab' || !node.slots?.side)
1344
+ continue;
1345
+ if (['edge', 'riser', 'underside'].every((key) => node.slots[key] !== undefined))
1346
+ continue;
1347
+ const slots = { ...node.slots };
1348
+ for (const key of ['edge', 'riser', 'underside'])
1349
+ if (slots[key] === undefined)
1350
+ slots[key] = slots.side;
1351
+ nodes[node.id] = omitUndefined({ ...node, slots });
1352
+ changed = true;
1353
+ }
1354
+ return { nodes: changed ? nodes : sourceNodes, changed };
1355
+ }
1356
+ export const migrateFloorPlates = loadMigration('floor plates', migrateFloorPlatesOnView, (nodes) => ({ nodes, plateIds: [], reports: [] }));
1357
+ export const migrateSlabSlots = loadMigration('slab slots', migrateSlabSlotsOnView, (nodes) => ({
1358
+ nodes,
1359
+ changed: false,
1360
+ }));