@roomle/web-sdk 2.52.0-debug.1 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/banana-for-scale-30597efb.nomodule.js +2 -0
- package/lib/{banana-for-scale-beb021eb.nomodule.js.map → banana-for-scale-30597efb.nomodule.js.map} +1 -1
- package/lib/banana-for-scale-7974e8a1.js +2 -0
- package/lib/{banana-for-scale-7f4886dc.js.map → banana-for-scale-7974e8a1.js.map} +1 -1
- package/lib/{component-dimensioning-172d70ad.nomodule.js → component-dimensioning-421bbb31.nomodule.js} +2 -2
- package/lib/component-dimensioning-421bbb31.nomodule.js.map +1 -0
- package/lib/{component-dimensioning-9246c6cc.js → component-dimensioning-8f50e9ae.js} +2 -2
- package/lib/component-dimensioning-8f50e9ae.js.map +1 -0
- package/lib/{component-raycast-helper-619320dd.nomodule.js → component-raycast-helper-6785d475.nomodule.js} +2 -2
- package/lib/component-raycast-helper-6785d475.nomodule.js.map +1 -0
- package/lib/{component-raycast-helper-f1b04bb6.js → component-raycast-helper-ff38d8de.js} +2 -2
- package/lib/component-raycast-helper-ff38d8de.js.map +1 -0
- package/lib/{configurator-8d5b17e5.js → configurator-4d69676d.js} +2 -2
- package/lib/configurator-4d69676d.js.map +1 -0
- package/lib/{configurator-089743c8.nomodule.js → configurator-9775c600.nomodule.js} +2 -2
- package/lib/configurator-9775c600.nomodule.js.map +1 -0
- package/lib/configurator-dummy-app.js +1 -1
- package/lib/configurator-dummy-app.js.map +1 -1
- package/lib/configurator-main-f4289e3c.js +2 -0
- package/lib/configurator-main-f4289e3c.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{continuous-drawing-helper-7269b28d.js → continuous-drawing-helper-6ab69cc6.js} +2 -2
- package/lib/continuous-drawing-helper-6ab69cc6.js.map +1 -0
- package/lib/{continuous-drawing-helper-161e3098.nomodule.js → continuous-drawing-helper-c361dcaa.nomodule.js} +2 -2
- package/lib/continuous-drawing-helper-c361dcaa.nomodule.js.map +1 -0
- package/lib/{default-light-setting-de008a6d.js → default-light-setting-696a1899.js} +2 -2
- package/lib/default-light-setting-696a1899.js.map +1 -0
- package/lib/{default-light-setting-d6819041.nomodule.js → default-light-setting-f0a27d18.nomodule.js} +2 -2
- package/lib/default-light-setting-f0a27d18.nomodule.js.map +1 -0
- package/lib/definitions/common-core/src/configurator-kernel-access.d.ts +1 -0
- package/lib/definitions/common-core/src/rapi-access.d.ts +9 -2
- package/lib/definitions/common-core/src/utils/shims.d.ts +1 -0
- package/lib/definitions/common-core/src/webgl/static-item-loader.d.ts +6 -2
- package/lib/definitions/configurator-core/mock/kernel-mock.d.ts +1 -1
- package/lib/definitions/planner-core/src/roomle-planner.d.ts +4 -2
- package/lib/definitions/planner-core/src/view-model/static-plan-object-view-model.d.ts +2 -0
- package/lib/definitions/typings/configurator-kernel-container.d.ts +1 -1
- package/lib/definitions/typings/kernel.d.ts +1 -0
- package/lib/definitions/typings/planner-kernel-container.d.ts +2 -2
- package/lib/definitions/typings/planner.d.ts +10 -1
- package/lib/definitions/typings/rapi-types.d.ts +15 -0
- package/lib/{dimensioning-helper-26db3ade.js → dimensioning-helper-a712794b.js} +2 -2
- package/lib/{dimensioning-helper-26db3ade.js.map → dimensioning-helper-a712794b.js.map} +1 -1
- package/lib/{dimensioning-helper-0d4caa33.nomodule.js → dimensioning-helper-cbf5f542.nomodule.js} +2 -2
- package/lib/{dimensioning-helper-0d4caa33.nomodule.js.map → dimensioning-helper-cbf5f542.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-91d48343.js → glb-viewer-1371edb6.js} +2 -2
- package/lib/{glb-viewer-91d48343.js.map → glb-viewer-1371edb6.js.map} +1 -1
- package/lib/{glb-viewer-0246e88b.nomodule.js → glb-viewer-29ff1d91.nomodule.js} +2 -2
- package/lib/{glb-viewer-0246e88b.nomodule.js.map → glb-viewer-29ff1d91.nomodule.js.map} +1 -1
- package/lib/glb-viewer-main-1c408241.js +2 -0
- package/lib/glb-viewer-main-1c408241.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/legacy/banana-for-scale-18804f5f.legacy.js +2 -0
- package/lib/legacy/{banana-for-scale-be99f7f4.legacy.js.map → banana-for-scale-18804f5f.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-7393934c.legacy.js → component-dimensioning-5d54719c.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-5d54719c.legacy.js.map +1 -0
- package/lib/legacy/{component-raycast-helper-3943f1d8.legacy.js → component-raycast-helper-a10a6f49.legacy.js} +2 -2
- package/lib/legacy/component-raycast-helper-a10a6f49.legacy.js.map +1 -0
- package/lib/legacy/{configurator-7c3619d8.legacy.js → configurator-7d487924.legacy.js} +2 -2
- package/lib/legacy/configurator-7d487924.legacy.js.map +1 -0
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{continuous-drawing-helper-e7cc68f4.legacy.js → continuous-drawing-helper-92d203da.legacy.js} +2 -2
- package/lib/legacy/continuous-drawing-helper-92d203da.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-31623ca0.legacy.js → default-light-setting-283463e3.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-283463e3.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-acdfd39b.legacy.js → dimensioning-helper-c080117e.legacy.js} +2 -2
- package/lib/legacy/{dimensioning-helper-acdfd39b.legacy.js.map → dimensioning-helper-c080117e.legacy.js.map} +1 -1
- package/lib/legacy/{glb-viewer-e96b3963.legacy.js → glb-viewer-afc3ac60.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-e96b3963.legacy.js.map → glb-viewer-afc3ac60.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{material-viewer-2f01e891.legacy.js → material-viewer-9b643aef.legacy.js} +2 -2
- package/lib/legacy/material-viewer-9b643aef.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/{pixotron-aed2579e.legacy.js → pixotron-ea1b5c34.legacy.js} +2 -2
- package/lib/legacy/{pixotron-aed2579e.legacy.js.map → pixotron-ea1b5c34.legacy.js.map} +1 -1
- package/lib/legacy/planner-b540a57e.legacy.js +2 -0
- package/lib/legacy/{planner-6c0ce8eb.legacy.js.map → planner-b540a57e.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/roomle-configurator-c972b0fa.legacy.js +2 -0
- package/lib/legacy/{roomle-configurator-89322fbd.legacy.js.map → roomle-configurator-c972b0fa.legacy.js.map} +1 -1
- package/lib/legacy/roomle-dependency-injection-9039338d.legacy.js +16 -0
- package/lib/legacy/{roomle-dependency-injection-6d4fe95c.legacy.js.map → roomle-dependency-injection-9039338d.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/{script-loader-a64acbb1.legacy.js → script-loader-7a3768a8.legacy.js} +2 -2
- package/lib/legacy/script-loader-7a3768a8.legacy.js.map +1 -0
- package/lib/legacy/static/ConfiguratorKernel-d16ae27ee72e88e0.wasm +0 -0
- package/lib/legacy/static/{ConfiguratorKernel-4a120e5209cf1cd0.js → ConfiguratorKernel-f0f690a2a1ca4c6d.js} +25 -25
- package/lib/legacy/static/ConfiguratorKernelJs-247da5a777bb2add.js +146 -0
- package/lib/legacy/static/ConfiguratorKernelJs-bb1d20624c2b4740.mem +0 -0
- package/lib/legacy/static/RoomleCore-6426a8a0d5a9d1c1.wasm +0 -0
- package/lib/legacy/static/RoomleCore-77341d3d3c69e85f.js +131 -0
- package/lib/legacy/static/RoomleCoreJs-2e1bc7afad0a13a5.js +156 -0
- package/lib/legacy/static/RoomleCoreJs-fef5f2a658bf77c3.mem +0 -0
- package/lib/legacy/static/{RoomleToolsCore-1fbf3bc88981cea9.js → RoomleToolsCore-210c30ed9c3f421a.js} +19 -19
- package/lib/legacy/static/RoomleToolsCore-ff9d37683de473c7.wasm +0 -0
- package/lib/{static/shaders-a517109fc4195f66.json → legacy/static/shaders-d6a40bba2f93a977.json} +1 -1
- package/lib/legacy/{stats-helper-767882c3.legacy.js → stats-helper-de80177e.legacy.js} +2 -2
- package/lib/legacy/{stats-helper-767882c3.legacy.js.map → stats-helper-de80177e.legacy.js.map} +1 -1
- package/lib/legacy/{tools-core-253210a4.legacy.js → tools-core-69b04981.legacy.js} +2 -2
- package/lib/legacy/tools-core-69b04981.legacy.js.map +1 -0
- package/lib/{material-viewer-3b958f44.js → material-viewer-5804025c.js} +2 -2
- package/lib/material-viewer-5804025c.js.map +1 -0
- package/lib/{material-viewer-e73cc1f8.nomodule.js → material-viewer-c20237e6.nomodule.js} +2 -2
- package/lib/material-viewer-c20237e6.nomodule.js.map +1 -0
- package/lib/material-viewer-main-35d2c933.js +2 -0
- package/lib/material-viewer-main-35d2c933.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/{pixotron-ad110207.js → pixotron-3bc73e7b.js} +2 -2
- package/lib/{pixotron-ad110207.js.map → pixotron-3bc73e7b.js.map} +1 -1
- package/lib/{pixotron-becbee6b.nomodule.js → pixotron-c971205e.nomodule.js} +2 -2
- package/lib/{pixotron-becbee6b.nomodule.js.map → pixotron-c971205e.nomodule.js.map} +1 -1
- package/lib/planner-a5199e6f.js +2 -0
- package/lib/{planner-86b833ec.js.map → planner-a5199e6f.js.map} +1 -1
- package/lib/planner-ef12336e.nomodule.js +2 -0
- package/lib/{planner-0176717a.nomodule.js.map → planner-ef12336e.nomodule.js.map} +1 -1
- package/lib/planner-main-4201f12d.js +2 -0
- package/lib/planner-main-4201f12d.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/roomle-configurator-23794a99.js +2 -0
- package/lib/{roomle-configurator-ff35715f.js.map → roomle-configurator-23794a99.js.map} +1 -1
- package/lib/roomle-configurator-a87e275f.nomodule.js +2 -0
- package/lib/{roomle-configurator-e7256218.nomodule.js.map → roomle-configurator-a87e275f.nomodule.js.map} +1 -1
- package/lib/roomle-dependency-injection-11aa8a76.nomodule.js +16 -0
- package/lib/{roomle-dependency-injection-95fcebc2.nomodule.js.map → roomle-dependency-injection-11aa8a76.nomodule.js.map} +1 -1
- package/lib/roomle-dependency-injection-f2fa0789.js +16 -0
- package/lib/{roomle-dependency-injection-0d6b01a8.js.map → roomle-dependency-injection-f2fa0789.js.map} +1 -1
- package/lib/{roomle-sdk-f552b223.js → roomle-sdk-5627632f.js} +2 -2
- package/lib/roomle-sdk-5627632f.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/{script-loader-5681c298.js → script-loader-96d0be41.js} +2 -2
- package/lib/script-loader-96d0be41.js.map +1 -0
- package/lib/{script-loader-1d69982b.nomodule.js → script-loader-a86102bc.nomodule.js} +2 -2
- package/lib/script-loader-a86102bc.nomodule.js.map +1 -0
- package/lib/static/ConfiguratorKernel-d16ae27ee72e88e0.wasm +0 -0
- package/lib/static/{ConfiguratorKernel-4a120e5209cf1cd0.js → ConfiguratorKernel-f0f690a2a1ca4c6d.js} +1 -1
- package/lib/static/{ConfiguratorKernel-4a120e5209cf1cd0.js.map → ConfiguratorKernel-f0f690a2a1ca4c6d.js.map} +1 -1
- package/lib/static/ConfiguratorKernelJs-247da5a777bb2add.js +146 -0
- package/lib/static/ConfiguratorKernelJs-bb1d20624c2b4740.mem +0 -0
- package/lib/static/RoomleCore-6426a8a0d5a9d1c1.wasm +0 -0
- package/lib/static/RoomleCore-77341d3d3c69e85f.js +1 -0
- package/lib/static/RoomleCore-77341d3d3c69e85f.js.map +1 -0
- package/lib/static/RoomleCoreJs-2e1bc7afad0a13a5.js +156 -0
- package/lib/static/RoomleCoreJs-fef5f2a658bf77c3.mem +0 -0
- package/lib/static/{RoomleToolsCore-1fbf3bc88981cea9.js → RoomleToolsCore-210c30ed9c3f421a.js} +1 -1
- package/lib/static/{RoomleToolsCore-1fbf3bc88981cea9.js.map → RoomleToolsCore-210c30ed9c3f421a.js.map} +1 -1
- package/lib/static/RoomleToolsCore-ff9d37683de473c7.wasm +0 -0
- package/lib/{legacy/static/shaders-a517109fc4195f66.json → static/shaders-d6a40bba2f93a977.json} +1 -1
- package/lib/{stats-helper-7d9f0a8a.nomodule.js → stats-helper-04478d21.nomodule.js} +2 -2
- package/lib/{stats-helper-7d9f0a8a.nomodule.js.map → stats-helper-04478d21.nomodule.js.map} +1 -1
- package/lib/{stats-helper-b27c936e.js → stats-helper-54bf0373.js} +2 -2
- package/lib/{stats-helper-b27c936e.js.map → stats-helper-54bf0373.js.map} +1 -1
- package/lib/{tools-core-e26bb496.nomodule.js → tools-core-52e89220.nomodule.js} +2 -2
- package/lib/tools-core-52e89220.nomodule.js.map +1 -0
- package/lib/{tools-core-0d19f253.js → tools-core-9bd96441.js} +2 -2
- package/lib/tools-core-9bd96441.js.map +1 -0
- package/package.json +2 -2
- package/lib/banana-for-scale-7f4886dc.js +0 -2
- package/lib/banana-for-scale-beb021eb.nomodule.js +0 -2
- package/lib/component-dimensioning-172d70ad.nomodule.js.map +0 -1
- package/lib/component-dimensioning-9246c6cc.js.map +0 -1
- package/lib/component-raycast-helper-619320dd.nomodule.js.map +0 -1
- package/lib/component-raycast-helper-f1b04bb6.js.map +0 -1
- package/lib/configurator-089743c8.nomodule.js.map +0 -1
- package/lib/configurator-8d5b17e5.js.map +0 -1
- package/lib/configurator-main-f39a172b.js +0 -2
- package/lib/configurator-main-f39a172b.js.map +0 -1
- package/lib/continuous-drawing-helper-161e3098.nomodule.js.map +0 -1
- package/lib/continuous-drawing-helper-7269b28d.js.map +0 -1
- package/lib/default-light-setting-d6819041.nomodule.js.map +0 -1
- package/lib/default-light-setting-de008a6d.js.map +0 -1
- package/lib/glb-viewer-main-9f58a136.js +0 -2
- package/lib/glb-viewer-main-9f58a136.js.map +0 -1
- package/lib/legacy/banana-for-scale-be99f7f4.legacy.js +0 -2
- package/lib/legacy/component-dimensioning-7393934c.legacy.js.map +0 -1
- package/lib/legacy/component-raycast-helper-3943f1d8.legacy.js.map +0 -1
- package/lib/legacy/configurator-7c3619d8.legacy.js.map +0 -1
- package/lib/legacy/continuous-drawing-helper-e7cc68f4.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-31623ca0.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-2f01e891.legacy.js.map +0 -1
- package/lib/legacy/planner-6c0ce8eb.legacy.js +0 -2
- package/lib/legacy/roomle-configurator-89322fbd.legacy.js +0 -2
- package/lib/legacy/roomle-dependency-injection-6d4fe95c.legacy.js +0 -16
- package/lib/legacy/script-loader-a64acbb1.legacy.js.map +0 -1
- package/lib/legacy/static/ConfiguratorKernel-fa95f23ce304f1db.wasm +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-843b32f9cf068595.js +0 -146
- package/lib/legacy/static/ConfiguratorKernelJs-b884d72267d0ed0f.mem +0 -0
- package/lib/legacy/static/RoomleCore-6c1973038e81be15.js +0 -131
- package/lib/legacy/static/RoomleCore-72494809ac9e04bb.wasm +0 -0
- package/lib/legacy/static/RoomleCoreJs-a1ed5d94a85e5ef0.mem +0 -0
- package/lib/legacy/static/RoomleCoreJs-bf2ff14d27bce33b.js +0 -155
- package/lib/legacy/static/RoomleToolsCore-152f43851b519f0a.wasm +0 -0
- package/lib/legacy/tools-core-253210a4.legacy.js.map +0 -1
- package/lib/material-viewer-3b958f44.js.map +0 -1
- package/lib/material-viewer-e73cc1f8.nomodule.js.map +0 -1
- package/lib/material-viewer-main-01a4fb08.js +0 -2
- package/lib/material-viewer-main-01a4fb08.js.map +0 -1
- package/lib/planner-0176717a.nomodule.js +0 -2
- package/lib/planner-86b833ec.js +0 -2
- package/lib/planner-main-d1636ed4.js +0 -2
- package/lib/planner-main-d1636ed4.js.map +0 -1
- package/lib/roomle-configurator-e7256218.nomodule.js +0 -2
- package/lib/roomle-configurator-ff35715f.js +0 -2
- package/lib/roomle-dependency-injection-0d6b01a8.js +0 -16
- package/lib/roomle-dependency-injection-95fcebc2.nomodule.js +0 -16
- package/lib/roomle-sdk-f552b223.js.map +0 -1
- package/lib/script-loader-1d69982b.nomodule.js.map +0 -1
- package/lib/script-loader-5681c298.js.map +0 -1
- package/lib/static/ConfiguratorKernel-fa95f23ce304f1db.wasm +0 -0
- package/lib/static/ConfiguratorKernelJs-843b32f9cf068595.js +0 -146
- package/lib/static/ConfiguratorKernelJs-b884d72267d0ed0f.mem +0 -0
- package/lib/static/RoomleCore-6c1973038e81be15.js +0 -1
- package/lib/static/RoomleCore-6c1973038e81be15.js.map +0 -1
- package/lib/static/RoomleCore-72494809ac9e04bb.wasm +0 -0
- package/lib/static/RoomleCoreJs-a1ed5d94a85e5ef0.mem +0 -0
- package/lib/static/RoomleCoreJs-bf2ff14d27bce33b.js +0 -155
- package/lib/static/RoomleToolsCore-152f43851b519f0a.wasm +0 -0
- package/lib/tools-core-0d19f253.js.map +0 -1
- package/lib/tools-core-e26bb496.nomodule.js.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as __decorate,i as inject,C as ConfiguratorViewModel,c as ConfiguratorPlanObjectViewModel,d as ConstructionPlanObjectViewModel,S as StaticPlanObjectViewModel,W as WallPlanElementViewModel,e as CAMERA_TYPE,F as FloorPlanElementViewModel,f as CeilingPlanElementViewModel,N as NodePlanElementViewModel,k as kernelBoxToThreeBox,P as PlannerKernelAccess,E as EventDispatcher,v as vectorIsZero,g as disposeMesh,h as convertToKernel,t as toRadiant,j as getScreenXY,l as getGUI,m as toDegrees,n as CANVAS_ID,o as Env,b as RoomleDependencyInjection,p as PULSE_LOOPS,q as PULSE_DURATION,r as DynamicLightSettingLoader,s as PREDEFINED_LIGHTSETTING,u as dispose,w as getYRotationOfObject,B as Benchmark,x as RoomleComponentFactoryInitializer,y as DEFAULT_CONVERSATION_ID,z as getCatalogIdFromItemOrConfigurationId,G as isIdItemId,A as AppContext,H as AsyncHelper,J as isRange,K as isMaterial,M as convertCObject}from"./roomle-dependency-injection-0d6b01a8.js";import{d as deepMerge,k as callAgainAfter,l as debounce}from"./main-thread-to-worker-811523e8.js";import{L as LightSetting,S as SceneManager,B as BakedShadowEnvironment,b as BackgroundEnvironment,C as CameraControl3D,F as FloorEnvironment,P as PIXOTRON_EFFETCS,T as TWEEN_FILE_NAME,c as PIXOTRON_FILE_NAME}from"./pixotron-ad110207.js";import{D as DefaultLightSetting}from"./default-light-setting-de008a6d.js";var GLTF_EXPORTER_FILE_NAME="static/GLTFExporter-86edae059df3a219.js";class PlanViewModel extends ConfiguratorViewModel{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._floorPlanObjectViewModels=[],this._nodePlanObjectViewModels=[],this._constructionGroup=new THREE.Group,this._constructionGroup.name="Construction",this._ceilingGroup=new THREE.Group,this._ceilingGroup.name="Ceiling",this._floorGroup=new THREE.Group,this._floorGroup.name="Floor",this._getKernelAccess().addPlannerListener(this)}startedDrawing(){}stoppedDrawing(){}planBoundsChanged(){}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof ConfiguratorPlanObjectViewModel?this._configurablePlanObjectViewModels.push(e):e instanceof ConstructionPlanObjectViewModel?(this._constructionPlanObjectViewModels.push(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof StaticPlanObjectViewModel?(this._staticPlanObjectViewModels.push(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof WallPlanElementViewModel?(this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),this._wallPlanObjectViewModels.push(e),this._constructionGroup.add(e.getContainer())):e instanceof FloorPlanElementViewModel?(this._plannerSceneEventHandler.addNodeHandlers(e),this._floorPlanObjectViewModels.push(e),this._floorGroup.add(e.getContainer())):e instanceof CeilingPlanElementViewModel?this._ceilingGroup.add(e.getContainer()):e instanceof NodePlanElementViewModel&&(this._initData.edit&&this._plannerSceneEventHandler.addNodeHandlers(e),e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D),e.getObject().scale.setScalar(this._nodeZoom),this._nodePlanObjectViewModels.push(e),this._constructionGroup.add(e.getContainer()))}_addRootComponent(e){const t=this._getPlanObjectViewModelForRuntimeId(e.parentObjectId);t&&t instanceof ConfiguratorPlanObjectViewModel&&(t.addRootComponent(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(t),t.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getConfigurablePlanObjectForId(e){for(const t of this._configurablePlanObjectViewModels)if(e===t.getId())return t;return null}getStaticPlanObjectForId(e){for(const t of this._staticPlanObjectViewModels)if(e===t.getId())return t;return null}getPlanObjectForId(e){const t=this.getConfigurablePlanObjectForId(e);if(t)return t;const n=this.getStaticPlanObjectForId(e);if(n)return n;for(const t of this._nodePlanObjectViewModels)if(e===t.getId())return t;for(const t of this._wallPlanObjectViewModels)if(e===t.getId())return t;for(const t of this._floorPlanObjectViewModels)if(e===t.getId())return t;for(const t of this._constructionPlanObjectViewModels)if(e===t.getId())return t;return null}getPlanObjectViewModelsFromRapiId(){return[...this._configurablePlanObjectViewModels,...this._staticPlanObjectViewModels]}getPlanObjectCount(){return this._configurablePlanObjectViewModels.length+this._staticPlanObjectViewModels.length}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getFloorGroup(){return this._floorGroup}getBoundingBox(){if("configurator"===this._configuratorContext.baseContext){const e=this.getPlanObjectForId(this._configuratorContext.planElementId);if(e)return e.getBounds()}if("glb-viewer"===this._configuratorContext.baseContext){const e=this._plannerSceneEventHandler.getSelectedIds();if(e&&1===e.length){const t=this.getPlanObjectForId(e[0]);if(t)return t.getBounds()}}const e=this.getCorePlan();if(e)try{return kernelBoxToThreeBox(e.getBounds())}catch(e){console.error(e)}const t=new THREE.Box3;t.expandByObject(this._constructionGroup);for(const e of this._staticPlanObjectViewModels)t.expandByObject(e.getContainer());for(const e of this._configurablePlanObjectViewModels)t.expandByObject(e.getContainer());return t}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getConfigurablePlanObjectViewModels(){return this._configurablePlanObjectViewModels}getWallPlanObjectViewModels(){return this._wallPlanObjectViewModels}getNodePlanObjectViewModels(){return this._nodePlanObjectViewModels}_generateMesh(e=0,t=null,n,i,o,s,r,a,l){return this._plannerMeshGenerator.generateMesh(e,t,n,i,o,s,r,a,l)}_setMaterial(e,t,n){this._plannerMeshGenerator.setMaterial(e,t)}Editor3dComponentCreated(e,t,n,i,o){super.Editor3dComponentCreated(e,t,n,i,o),this._getKernelAccess()instanceof PlannerKernelAccess&&this.dockComponent(e,i,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,o,s,r){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){const i=this.getConfigurablePlanObjectForId(t.getId());i?n?i.finishConstruction():i.failConstruction():console.warn("planObjectConfigurationLoaded but no view model found")}addMesh(e,t,n,i,o,s){const r=e.extRef.jsObject;let a=r.getMesh(t);a?a.geometry=this._plannerMeshGenerator.generateGeometry(null,n,i,o,s):(a=this._generateMesh(0,null,t,n,i,o,s,e.getType()),r.addMesh(a))}removePlanObjectFromScene(e){const t=e.getPlanElement().getType();this._isConstructionType(t)?this._constructionGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.FLOOR?this._floorGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.CEILING&&this._ceilingGroup.remove(e.getContainer()),e.clear()}_isConstructionType(e){return e===this._getKernelAccess().kernelContainer.PlanElementType.WALL||e===this._getKernelAccess().kernelContainer.PlanElementType.NODE}planElementRemoved(e){const t=e.extRef.jsObject;t instanceof ConfiguratorPlanObjectViewModel?this._removeObject(this._configurablePlanObjectViewModels,t):t instanceof ConstructionPlanObjectViewModel?this._removeObject(this._constructionPlanObjectViewModels,t):t instanceof StaticPlanObjectViewModel?this._removeObject(this._staticPlanObjectViewModels,t):t instanceof FloorPlanElementViewModel?this._removeObject(this._floorPlanObjectViewModels,t):t instanceof WallPlanElementViewModel?this._removeObject(this._wallPlanObjectViewModels,t):t instanceof NodePlanElementViewModel&&this._removeObject(this._nodePlanObjectViewModels,t)}_removeObject(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}getMeshGenerator(){return this._plannerMeshGenerator}componentConfigurationUpdated(e,t){super.componentConfigurationUpdated(e,t)}hideAllExcept(e){this._ceilingGroup.visible=!1,this._floorGroup.visible=!1,this._constructionGroup.visible=!1,this._staticPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurablePlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._constructionPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)})}showAll(){this._ceilingGroup.visible=this._cameraType===CAMERA_TYPE.CAMERA_FP,this._floorGroup.visible=!0,this._constructionGroup.visible=!0,this._staticPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurablePlanObjectViewModels.forEach(e=>e.getContainer().visible=!0)}planHistoryStateChanged(){}setCameraType(e){this._cameraType=e,this._wallPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._nodePlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D)),this._constructionPlanObjectViewModels.forEach(e=>e.setTopView(this._cameraType===CAMERA_TYPE.CAMERA_2D))}setNodeZoom(e){this._nodeZoom=e;for(const t of this._nodePlanObjectViewModels)t.getObject().scale.setScalar(e)}planCleared(){this._configurablePlanObjectViewModels.forEach(e=>e.remove()),this._staticPlanObjectViewModels.forEach(e=>e.remove()),this._wallPlanObjectViewModels.forEach(e=>e.remove()),this._nodePlanObjectViewModels.forEach(e=>e.remove()),this._floorPlanObjectViewModels.forEach(e=>e.remove()),this._constructionPlanObjectViewModels.forEach(e=>e.remove())}}__decorate([inject],PlanViewModel.prototype,"_plannerMeshGenerator",void 0),__decorate([inject],PlanViewModel.prototype,"_roomlePlannerUiCallback",void 0);const ROTATION_TO_DETECT_SIDE=toRadiant(30);class RaycastHelper extends EventDispatcher{constructor(e,t,n,i){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===i?1:i,this._scene=e,this._camera=t,this._raycaster=new THREE.Raycaster,this._raycaster.layers.disableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(e){this._raycaster.layers=e}getLayers(){return this._raycaster.layers}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(12,e=>{this._findSelection(e.positionRelative,!0,e.type)},this),e.addEventListener(14,e=>{this._findSelection(e.positionRelative,!0,e.type)},this),e.addEventListener(6,e=>{this._findHover(e.positionRelative,e.type)},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){this._intersection(e)&&this._inputManager.onElementHit()}_findSelection(e,t=!1,n=0){let i=this._intersection(e);if(i){if(i){const e=t?"double_click":"select";i.object.dispatchEvent({type:e,attachment:{intersection:i,type:n}})}}else this.dispatchEvent(0)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(e,this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(e,this._camera);let t,n=new THREE.Vector3(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._scene.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t);if(e){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,i=new THREE.Vector3(0,0,0),o=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,i),this._raycaster.ray.intersectPlane(this._planeSide,o);let s,r=this._getDistanceToCamera(o),a=this._getDistanceToCamera(i);return n>=-ROTATION_TO_DETECT_SIDE&&n<=ROTATION_TO_DETECT_SIDE?s=t<a?e.clone():i.clone():t<a&&t<r?s=e.clone():a<t&&a<r?s=i.clone():r<t&&r<a&&(s=o.clone()),s}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return vectorIsZero(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new THREE.Vector3).x+e.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(e.getWorldQuaternion(new THREE.Quaternion)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof THREE.Mesh&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&disposeMesh(this._currentDrag),this._currentHover&&disposeMesh(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setScene(e){this._scene=e}setMode(e){this._mode=e}intersectMouseOnScene(e){const t=new THREE.Plane,n=new THREE.Vector3;return n.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(n,this._scene.position),this._raycaster.setFromCamera(e.positionRelative,this._camera),convertToKernel(this._raycaster.ray.intersectPlane(t,new THREE.Vector3))}}class SceneEventHandler extends EventDispatcher{constructor(e,t,n,i){super(),this._debug=!1,this._dragIn=!1,this._inputManager=i,this._raycastHelper=new RaycastHelper(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}}class SceneEventInfo{constructor(e){const{component:t,preview:n,resetCamera:i,consecutive:o,type:s,forceRender:r}=e;this.component=t,this.preview=n,this.resetCamera=void 0===i||i,this.consecutive=void 0===o||o,this.type=s||0,this.forceRender=void 0!==r&&r}}class ConfiguratorSceneEventHandler extends SceneEventHandler{constructor(e,t,n,i){super(e,t,n,i),this._cameraMoving=!1,this._raycastHelper.addEventListener(0,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(0,({component:e,consecutive:t})=>{this.dispatchEvent(8,new SceneEventInfo({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new SceneEventInfo({component:e,resetCamera:t}))},this),this._addInputListeners(this._inputManager)}disable(){const e=new THREE.Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}enable(){const e=new THREE.Layers;e.disableAll(),e.enable(4),e.enable(5),e.enable(7),e.enable(8),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}_addInputListeners(e){e.addEventListener(7,e=>this._interaction(),this),e.addEventListener(8,e=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:2,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.runtimeId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,n){t.userData.hasListener||(Object.assign(t.userData,n),t.addEventListener("select",()=>this.clickComponent(e)),t.addEventListener("hover_on",t=>this._hoverOn(e,t.attachment.type)),t.addEventListener("hover_off",t=>this._hoverOff(e,t.attachment.type)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData=deepMerge(t.userData,{hasListener:!0,priority:3,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreview(e)),t.addEventListener("hover_on",()=>this._hoverOnPreview(e)),t.addEventListener("hover_off",()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData=deepMerge(t.userData,{hasListener:!0,priority:4,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreviewLine(e)),t.addEventListener("hover_on",t=>this._hoverOnPreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_move",t=>this._hoverMovePreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_off",()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new SceneEventInfo({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new SceneEventInfo({preview:e}))}clickComponent(e){this._debug&&e.runtimeId,this._selectionHandler.check(e)}_clickOutside(){this._selectionHandler.cancelSelection(),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new SceneEventInfo({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new SceneEventInfo({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e}_hoverOffPreview(e){e.hoverOff(),this._interaction(!0),this._hoveredPreview=null}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let n=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=n,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(n))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){var t;null===(t=this._draggedComponent)||void 0===t||t.traverse(t=>{if(t instanceof THREE.Mesh){const n=t;e&&void 0!==n.castShadowOld?(n.receiveShadow=n.receiveShadowOld,n.castShadow=n.castShadowOld):(n.receiveShadowOld=t.receiveShadow,n.castShadowOld=t.castShadow,n.receiveShadow=!1,n.castShadow=!1)}})}_dragStart(e){e&&(this._selectionHandler.isSelected(e)||this.isDragIn())&&(this._dragStartPosition=e.position.clone(),this._dragStartRotation=e.rotation.clone(),this._draggedComponent=e,this._setDragComponentShadow(!1),this.dispatchEvent(4,new SceneEventInfo({component:e})),this._interaction())}_drag(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(e&&!this._draggedComponent&&(this._draggedComponent=e),this._previewLineIntersection){let e=this._hoveredPreview,t=e.getPositionForIntersectionPoint(this._previewLineIntersection),n=e.parent.localToWorld(t);this._draggedComponent.position.copy(this._draggedComponent.parent.worldToLocal(n)),this._draggedComponent.rotation.copy(e.docklineRotation),e.hideSelectionLine()}else e.parent?e.position.copy(e.parent.worldToLocal(t)):e.position.copy(t);this._hoveredPreview?e.visible=!1:e.visible=!0,this.dispatchEvent(5,new SceneEventInfo({component:e})),this._interaction()}}_dragEnd(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(this._hoveredPreview)if(this._previewLineIntersection){let t=this._hoveredPreview,n=t.getPositionForIntersectionPoint(this._previewLineIntersection),i=t.parent.localToWorld(n);e.position.copy(e.parent.worldToLocal(i)),e.rotation.copy(t.docklineRotation)}else e.position.copy(t);else this._dragStartPosition&&this._dragStartRotation&&(e.position.copy(this._dragStartPosition),e.rotation.copy(this._dragStartRotation),this._dragStartPosition=null,this._dragStartRotation=null,this.addComponentHandlers(e));e.visible=!0,this._setDragComponentShadow(!0),this._draggedComponent=null,this._previewLineIntersection=null,this.dispatchEvent(6,new SceneEventInfo({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new SceneEventInfo({forceRender:e}))}hasSelection(){return this._selectionHandler.hasSelection()}update(e,t,n){this._raycastHelper.update(e,t,n)}isDragIn(){return this._dragIn}isDragging(){return null!=this._draggedComponent}setRootComponentId(e){this._raycastHelper.setRootComponentId(e)}cancelSelection(){this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection()}setSelectionMode(e){this._selectionHandler.setSelectionMode(e)}getSelectionMode(){return this._selectionHandler.getSelectionMode()}getSelectedRuntimeComponentIds(){return this._selectionHandler.getSelectedRuntimeComponentIds()}setCameraMoving(e){e&&this._hoveredComponent&&this._hoverOff(this._hoveredComponent,0),this._cameraMoving=e}}__decorate([inject],ConfiguratorSceneEventHandler.prototype,"_selectionHandler",void 0);class UiIntersectionHelper extends EventDispatcher{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let i=new THREE.Vector3(-e.x/2,0,-e.z/2),o=new THREE.Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new THREE.Box3(i,o),this._clientWidth=t,this._clientHeight=n;let s=this._boundingBox.getSize(new THREE.Vector3);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new THREE.Vector3(s.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new THREE.Vector3(s.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(null==this._boundingBox||null==this._offset)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let n=0;this.floorEnvironment?(e=["left","right","bottom"],n=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),n|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),n|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),n|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),n|=4),n!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=n)}_checkPaddings(){let e={left:this._clientWidth/2,top:this._clientHeight/2,right:this._clientWidth/2,bottom:this._clientHeight/2};return this._boxVertices.forEach(t=>{let n=getScreenXY(t,this._camera,this._clientWidth,this._clientHeight);n.x<e.left&&(e.left=n.x),n.x>e.right&&(e.right=n.x),n.y<e.top&&(e.top=n.y),n.y>e.bottom&&(e.bottom=n.y)}),e}}class TopImageLightSetting extends LightSetting{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),1.2),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!1}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=getGUI();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}}}let imageRenderer=null;const getImageRenderer=()=>(imageRenderer||(imageRenderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),imageRenderer.outputEncoding=THREE.sRGBEncoding),imageRenderer.autoClear=!0,imageRenderer),getCameraTargetForBBox=(e,t=0)=>{if(!e){const e=new THREE.Vector3;return{center:e,bounds:e,diagonal:0}}const n=e.getSize(new THREE.Vector3);return n.addScalar(t),{center:e.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}},preparePerspectiveImage=(e,t,n,i,o={},s=0)=>new Promise(r=>{const{size:a=1024,showDimensions:l}=o,c=getImageRenderer();c.setSize(a,a);const h=e.fog?e.fog.clone():null,d=e.background?e.background.clone():null;e.background=null,e.fog=null;let _=new DefaultLightSetting(e);n.layers.disable(2),n.layers.disable(6),n.layers.disable(5),l?n.layers.enable(8):n.layers.disable(8);const g=-30+toDegrees(s);placeCameraForPerspectiveImage(n,i,-20,g),c.render(e,n),t&&(c.autoClear=!1,c.clearDepth(),c.render(t,n));const p=c.domElement.toDataURL();n.layers.enable(2),n.layers.enable(6),n.layers.enable(5),e.background=d,e.fog=h,_.removeFromScene(),r({image:p,width:a,height:a,blob:null})}),placeCameraForPerspectiveImage=(e,t,n,i)=>{e.far=1e3,e.fov=15,e.aspect=1,e.position.copy(t.center),e.rotation.set(0,0,0),e.rotateY(toRadiant(i)),e.rotateX(toRadiant(n)),e.translateZ(3.8*t.diagonal),e.updateProjectionMatrix()},prepareTopImage=(e,t,n,i={})=>{const{showDimensions:o=!1}=i;return new Promise(i=>{const s=getImageRenderer();s.autoClear=!1;let r=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);r.position.copy(n.center),r.rotateX(toRadiant(-90)),r.translateZ(n.bounds.y+1),r.far=r.position.y+.5,r.layers.mask=65535;let a=200*n.bounds.x,l=200*n.bounds.z;if(a>4096||l>4096){let e=0;a>4096?e=a/4096:l>4096&&(e=l/4096),a/=e,l/=e}s.setSize(a,l);let c=e.fog?e.fog.clone():null,h=e.background?e.background.clone():null;e.background=null,e.fog=null;let d=o?new TopImageLightSetting(e):new DefaultLightSetting(e);r.layers.disable(2),r.layers.disable(6),r.layers.disable(5),o?r.layers.enable(8):r.layers.disable(8),s.render(e,r),t&&(s.clearDepth(),s.render(t,r));let _=s.domElement.toDataURL();r.layers.enable(2),r.layers.enable(6),r.layers.enable(5),e.background=h,e.fog=c,d.removeFromScene(),i({image:_,width:a,height:l,blob:null})})};class ConfiguratorSceneManager extends SceneManager{constructor(e,t,n=CAMERA_TYPE.CAMERA_3D){super(e,t,CANVAS_ID.HSC,n),this._configuratorContext.baseContext="configurator",this._getViewModel().setListener(this),this._sceneEventHandler=new ConfiguratorSceneEventHandler(this._creator_,this._scene,this._getCameraControl().getCamera(),this._getInputManager()),this._sceneEventHandler.addEventListener(0,({forceRender:e})=>{this._uiIntersectionHelper.calculateUIIntersection(),e&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(1,({component:e,type:t})=>this._onHoverOn(e,t),this),this._sceneEventHandler.addEventListener(2,({component:e,type:t})=>this._onHoverOff(e,t),this),this._sceneEventHandler.addEventListener(3,()=>{this._configuratorUiCallbacks.onClickOutside(),this._cameraControl.unlock(),this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this.cancelComponentSelection(!0),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._sceneEventHandler.addEventListener(8,({component:e,consecutive:t})=>{this._getViewModel().hasPreviews()&&this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this._selectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(9,({component:e,resetCamera:t})=>{this._deselectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelComponentSelection(),this._requestDockingsPreviewWithDrag(e.runtimeId),this._cameraControl.lock(),this._requestRender()},this),this._sceneEventHandler.addEventListener(5,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(6,({component:e,preview:t})=>{if(t){let n=t;this._getViewModel().isPreviewLine(n)?this._getViewModel().dockComponentWithPosition(n,e):this._getViewModel().isPreview(n)&&this._dockComponent(n),this._cancelDockings(!t,e,!0,!0)}else{let t=this._sceneEventHandler.isDragIn()?e:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),t,!1,!0);const n=this._getViewModel().getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))}this._cameraControl.unlock(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(7,({preview:e})=>{this._getViewModel().isPreview(e)&&(this._getViewModel().isPreviewLine(e)?this._getViewModel().dockComponentWithPosition(e):this._dockComponent(e),this._cancelDockings(!1,null,!this._getViewModel().hasPreviews(),!1,!1),this.requestDockingsPreview(!1),this._requestRender())},this),this._cameraControl.addEventListener(0,()=>{var e;this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),null===(e=this._pixotronUtil)||void 0===e||e.movingCameraStarts(),this.disableEvents(),this._requestRender()},this),this._cameraControl.addEventListener(1,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._cameraControl.addEventListener(2,()=>{var e;this._sceneEventHandler.setCameraMoving(!1),null===(e=this._pixotronUtil)||void 0===e||e.movingCameraStops(),this._updateComponentPosition(),this.enableEvents(),this._requestRender()},this),this._cameraControl.addEventListener(5,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this._cameraControl.addEventListener(3,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(4,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(7,()=>{this._pluginSystem.moveCameraStart(this._getCameraControl().getCamera().position)},this),this._cameraControl.addEventListener(8,()=>{this._pluginSystem.moveCameraEnd(this._getCameraControl().getCamera().position)},this),Env.isProduction||(window.__RML__DEBUG__.SceneHelper=this),this.enableConfiguratorEvents(),this._initOptionalModules(),this._offsetAnimationStart=callAgainAfter(this._offsetAnimationStart.bind(this),250),this._offsetAnimationEnd=debounce(this._offsetAnimationEnd.bind(this),32)}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:e}=await import("./component-raycast-helper-f1b04bb6.js");this._componentRaycastHelper=new e,this._componentRaycastHelper.init(this._scene,this._getCameraControl().getCamera())}}disableEvents(){this.disableConfiguratorEvents()}enableEvents(){"configurator"===this._configuratorContext.baseContext&&this.enableConfiguratorEvents()}enableConfiguratorEvents(){this._sceneEventHandler.enable()}disableConfiguratorEvents(){this._sceneEventHandler.disable()}_getViewModel(){return this._viewModel||(this._viewModel=RoomleDependencyInjection.lookup("configurator-view-model",this._creator_),this._viewModel.setRequestRenderCallback(()=>this._renderEverything())),this._viewModel}_getKernelAccess(){return this._plannerKernelAccess}_showDockings(){var e,t;if(null===(t=null===(e=this._initData)||void 0===e?void 0:e.featureFlags)||void 0===t?void 0:t.pulsePreview){this._renderEverything();const e=setInterval(()=>this._renderEverything(),16);setTimeout(()=>clearInterval(e),(PULSE_LOOPS+1)*PULSE_DURATION)}}cancelDockings(){this._cancelDockings(!0,null,!0,!0,!1),this._renderEverything()}_cancelDockings(e,t,n,i,o=!0){e&&(this._sceneEventHandler.setDragIn(!1),this._getViewModel().removeDockingComponent(),t&&this._scene.remove(t)),this._getViewModel().removePreviews(),n&&o&&this._updateCameraToBounds(),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}_onHoverOn(e,t){2!==t&&this._highlightComponent(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.add(e)&&this._renderEverything()}_onHoverOff(e,t){2!==t&&this._highlightComponent(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._componentDimensioningHelper.remove(e),this._renderEverything()),this._requestRender()}_highlightComponent(e=null,t=[]){if(!this._shouldHighlight())return;this._pixotron&&((null==t?void 0:t.length)?this._pixotron.getHighLightPass().transparency=.8:this._pixotron.getHighLightPass().transparency=1,this._pixotron.getHighLightPass().needsUpdate=!0);const n=[],i=this._initData.meshSelection;e?i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh):t&&t.length||(t=this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._getViewModel().getComponentsForIds(t).forEach(e=>{e&&(i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh))}),this._pixotron&&this._pixotron.highlightObjects(n)}shouldClearShadowsAndAO(){return super.shouldClearShadowsAndAO()||!this._sceneEventHandler.isDragging()}resume(){super.resume(),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._applySSR(),this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything(),this._applySSR(),this._environment instanceof BakedShadowEnvironment&&this._environment.update()}_applySSR(){this._initData.ssr&&this._pixotron&&this._getViewModel().getComponent(this._configuratorContext.rootComponentId).traverse(e=>{e instanceof THREE.Mesh&&!e.material.ssrPass&&this._pixotron.fixMaterial(e)})}pause(){super.pause(),this._getViewModel().materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}_setupScene(e,t,n){super._setupScene(e,t),this._uiIntersectionHelper=new UiIntersectionHelper(this._getCameraControl().getCamera()),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(0,e=>{this._configuratorUiCallbacks.onUiIntersectionChange(e)},this),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._domHelper.element.appendChild(this._renderer.domElement),n||(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(DynamicLightSettingLoader.createDynamicLightSettingSource(null,PREDEFINED_LIGHTSETTING.CAMERA)):this._lightSetting=new DefaultLightSetting(this._scene,this._lightSetting)),this._requestRender(),this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded())}sceneCleared(e){this._internalClearScene(e)}display(e){this._scene.add(e),this.setRootComponentId(e.runtimeId),this._requestRender()}setRootComponentId(e){this._sceneEventHandler.setRootComponentId(e)}debugSceneGraph(e){this._getViewModel().debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){e.material&&e.material.opacity,e.type,e.id,e.runtimeId,e.children.length>0&&e.children.forEach(e=>{let n=t+" ";this._printObjectGraph(e,n)})}clearScene(){var e;this._getCameraControl().clear(),this._internalClearScene(!1),this._pixotronUtil&&this._pixotronUtil.lockAdapter(),null===(e=this._sceneEventHandler)||void 0===e||e.cancelSelection(),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this._getCameraControl().getCamera())}_internalClearScene(e){var t;this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type&&"Line"!==e.type||this._scene.remove(e)}),this._uiScene.children.forEach(e=>{this._uiScene.remove(e)}),this._getViewModel().sceneCleared(),null===(t=this._componentDimensioningHelper)||void 0===t||t.invalidateDimensioningsCache(),(e||this._memoryManager.shouldHardReset())&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}async preparePerspectiveImage(e={}){await this._externalMeshesAndMaterialsReady();const{showDimensions:t=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let n=this._getCameraControl().getCamera().clone(),i=this._calculateBoundingBoxOfAllMeshes(0,t);this._lightSetting.removeFromScene();const o=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();o&&this._dimensionHelper.disableDimensions();const s=this._getCameraControl().getObjectRotation();if(t){await this._initDimensions(),await this._dimensionHelper.isInitialized();const e=-30+toDegrees(s);placeCameraForPerspectiveImage(n,i,-20,e),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(n.position),i=this._calculateBoundingBoxOfAllMeshes(0,t)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const r=await preparePerspectiveImage(this._scene,this._uiScene,n,i,e,s);return o?this._dimensionHelper.enableDimensions():t&&this._dimensionHelper.disableDimensions(),this._lightSetting.addToScene(),this._requestRender(),r}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let t=this._getCameraControl().getCamera(),n=null;e.useCurrentPerspective||(t=this._getCameraControl().getCamera().clone(),n=this._calculateBoundingBoxOfAllMeshes());const i=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();i&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const o=await((e,t,n,i,o,s)=>new Promise(i=>{s||(s=1024);const o=getImageRenderer();o.setSize(s,s);const r=e.fog?e.fog.clone():null,a=e.background?e.background.clone():null;e.background=null,e.fog=null,t.layers.disable(2),t.layers.disable(6),t.layers.disable(5),n?placeCameraForPerspectiveImage(t,n,-20,-30):(t.aspect=1,t.updateProjectionMatrix()),o.render(e,t);const l=o.domElement.toDataURL();t.layers.enable(2),t.layers.enable(6),t.layers.enable(5),e.background=a,e.fog=r,i({image:l,width:s,height:s,blob:null})}))(this._scene,t,n,this._pixotron,this._renderer);return i&&this._dimensionHelper.enableDimensions(),this._requestRender(),o}async preparePartImage(e,t){return new Promise((n,i)=>{this._getViewModel().requestSubPartConstruction(e).then(async e=>{t.size||(t.size=256);let i=this._getCameraControl().getCamera().clone(),o=getCameraTargetForBBox((new THREE.Box3).setFromObject(e));const s=new THREE.Scene;s.add(e);const r=await preparePerspectiveImage(s,null,i,o,t);dispose(s),n(r)},i)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._getViewModel().getBoundingBox(),getCameraTargetForBBox(n,e)}async _externalMeshesAndMaterialsReady(){await this._getKernelAccess().externalMeshQueue.finished(!0),await this._getViewModel().materialQueue.finished(!0)}async prepareTopImage(e={}){await this._externalMeshesAndMaterialsReady();const{showDimensions:t=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers(),t&&(await this._initDimensions(),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();let n=this._calculateBoundingBoxOfAllMeshes(.1,t);this._lightSetting.removeFromScene();let i=await prepareTopImage(this._scene,this._uiScene,n,e);return t&&this._dimensionHelper.disableTopDimensions(),this._lightSetting.addToScene(),this._requestRender(),i}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}zoomToComponent(e){this._cameraControl.saveState(!1);let t=e.boundingBox.getSize(new THREE.Vector3),n=getYRotationOfObject(e),i=new THREE.Euler(0,n,0),o=e.getWorldPosition(new THREE.Vector3).clone().add(e.boundingBox.getCenter(new THREE.Vector3).applyEuler(i));const s=new THREE.Vector2;this._renderer.getSize(s),this._getCameraControl().zoomTo(t,s.width,s.height,i.y,toRadiant(15),o)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart(!1)}resetCameraToState(){this._cameraControl.hasSavedState()&&this._cameraControl.resetToState()}resetCameraPositionToStart(e=!0){this._requestRender();const t=this._getViewModel().getBoundingBox();t&&this._cameraControl instanceof CameraControl3D&&this._getCameraControl().reset(t,void 0,void 0,void 0,e)}_clearSelectionAndHovers(){this.cancelComponentSelection(),this._getViewModel().clearRootComponent()}resetPreviews(){this._getViewModel().removePreviews(),this._requestRender()}changeOffset(e){this._getCameraControl().getCamera().offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}updateCamera(e=!0){super.updateCamera(),this._updateCameraToBounds(null,e)}setCameraOffset(e){this._offsetAnimationStart(),this._getCameraControl().getCamera().offset&&(this._getCameraControl().getCamera().offset=e,this._renderEverything()),this._offsetAnimationEnd()}_offsetAnimationStart(){this._onCameraMove()}_offsetAnimationEnd(){this._onCameraIdle()}getCameraOffset(){var e,t;return(null===(t=null===(e=this._getCameraControl())||void 0===e?void 0:e.getCamera())||void 0===t?void 0:t.offset)?JSON.parse(JSON.stringify(this._getCameraControl().getCamera().offset)):{left:0,top:1,right:1,bottom:0}}_onKeyDown(e){super._onKeyDown(e),!e.key||"Escape"!==e.key&&"Esc"!==e.key||(this.cancelComponentSelection(),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof CameraControl3D&&(this._getCameraControl().enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&("Backspace"===e.key||"Delete"===e.key)&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e){super._onKeyUp(e),e.key&&e.key.includes("Shift")&&(this._getCameraControl().disablePanning(),e.preventDefault())}cancelPreviousDockings(){this._cancelDockings(!0,null,!1,!1)}cancelComponentSelection(e){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e)}_cancelSelection(e){this._sceneEventHandler.cancelSelection(),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.resetCameraToState(),this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel()}_selectComponent(e,t){this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),t||("standard"===this._sceneEventHandler.getSelectionMode()?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds())),this._highlightComponent(e),!this._initData.debug&&t&&this.zoomToComponent(e)}_deselectComponent(e,t){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t),this._highlightComponent()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t),this._highlightComponent())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return getScreenXY(e,this._getCameraControl().getCamera(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return this._environment&&this._environment instanceof FloorEnvironment||(this._environment=new FloorEnvironment(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),new Promise((t,n)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},n)})}exportGLB(){this._scriptLoader.fetch("static/GLTFExporter-86edae059df3a219.js",{id:"gltf-exporter"}).then(()=>{let e=new THREE.GLTFExporter,t=[];this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type||t.push(e)}),e.parse(t,e=>{let t=document.createElement("a");const n=new Blob([e],{type:"model/gltf-binary"});t.href=URL.createObjectURL(n),t.download="scene.glb",t.style.display="none",document.body.appendChild(t),t.click()},{binary:!0,embedImages:!0,forceIndices:!0})})}zoomIn(e){this._getCameraControl().zoomIn(e),this._renderEverything()}zoomOut(e){this._getCameraControl().zoomOut(e),this._renderEverything()}async showDimensions(){await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._configuratorUiCallbacks.onDimensionsVisibilityChange(!0),this._renderEverything()}async _initDimensions(){this._dimensionHelper||await import("./dimensioning-helper-26db3ade.js").then(({default:e})=>{this._dimensionHelper=new e(this._creator_),this._pluginSystem.addPlugin(this._dimensionHelper)})}hideDimensions(){this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}async loadSceneSettings(e){await super.loadSceneSettings(e),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof FloorEnvironment}_updateCameraToBounds(e,t=!0,n=!1){e||(e=this._getViewModel().getBoundingBox()),e&&this._cameraControl instanceof CameraControl3D&&(n?this._getCameraControl().zoomToFitBounds(e):this._getCameraControl().updateToBounds(e,!1,t),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition())}requestDockingsPreview(e,t,n,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(),i&&this.enableDragIn(n),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._getKernelAccess().webGlPreviewDockings(this._configuratorContext,i),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._getKernelAccess().previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){const t=Benchmark.start("dock_component_"+e.childId);this._getKernelAccess().dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null,Benchmark.end(t)}_onSelectedRuntimeComponentsChange(e){this._getKernelAccess().multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,n=null;e&&(t=e.runtimeId===this._configuratorContext.rootComponentId,n=e.runtimeId),this._getKernelAccess().selectionChange(n,t),e&&this._getKernelAccess().selectedComponent(e.runtimeId)}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(Array.isArray(e)&&0!==e.length&&t&&-1===e.indexOf(t)){switch(this._configuratorContext.selectionMode){case"standard":this.resetCamera(),this._getKernelAccess().requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case"multiselect":this.resetCamera(),this._getKernelAccess().requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds)}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){var n;if(e.runtimeId===this._configuratorContext.rootComponentId){let t=new THREE.Vector3(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,t,null)}void 0===e.geometryChanged||e.geometryChanged?this._renderEverything():this._renderWithoutShadowsAndAO(),null===(n=this._componentDimensioningHelper)||void 0===n||n.invalidateDimensioningsCache(e.runtimeId)}planObjectUpdated(e,t){const n=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId);if(this._configuratorHistory.push(n),e.bounds){if(this._configuratorContext.planObjectId===e.id){const e=this._getViewModel().getBoundingBox();this._updateBounds(e,t)}this._highlightComponent(),this._requestRender()}}componentDeleted(e){-1===this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.runtimeId)&&"multiselect"!==this._sceneEventHandler.getSelectionMode()||this.cancelComponentSelection()}previewConstructionDone(e,t){const n=this._getViewModel().getBoundingBoxWithPreviews();t||(this._cancelDockings(!0,null,!1,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());let i=!0;this._componentRaycastHelper&&(i=!this._componentRaycastHelper.areAllComponentsInFrustum(this._getViewModel().getPreviews())),this._configuratorContext.requestPreviewsIsUserInitiated&&i&&this._updateCameraToBounds(n,!0,!0),this._lightSetting&&this._lightSetting.needsBounds()&&(this._lightSetting.updateBounds(n),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new THREE.Vector3(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):t||this._initData.debug||this._initData.moc||this.resetCamera(),this._pixotronUtil&&Promise.all([new Promise(e=>setTimeout(e,3e3)),this._getViewModel().materialQueue.finished(!0)]).then(()=>{this._pixotronUtil.unLockAdapter()}),this._environment&&this._environment.reload()}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks.onComponentPositionsUpdated)return;const e=[];this._getViewModel().getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const n=(new THREE.Box3).setFromObject(t.boundingBoxMesh);let i=this._getKernelAccess().kernelInstance.getComponent(t.runtimeId);const o=i.parameters||i.possibleChildren?["edit"]:[];e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"component",actions:o})}),this._getViewModel().getPreviews().forEach(t=>{const n=(new THREE.Box3).setFromObject(t);e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"preview",actions:["add"]})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}_updateBounds(e,t=!1){if(super._updateBounds(e,t),!e)return;let n=e.getSize(new THREE.Vector3);this._sceneEventHandler.hasSelection()||this._updateCameraToBounds(e,!1),this._sceneEventHandler.update(n,null,null),this._uiIntersectionHelper.updateToBounds(n,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._pixotron&&this._pixotron.getShadowPass().setShadowRecieverBBox(e),this._getCameraControl().getCamera().updateProjectionMatrix()}async moveCamera(e){return this._getCameraControl().moveCamera(e)}selectComponent(e){if(!e)return;const t=this._getViewModel().getComponents().find(t=>t.runtimeId===e);t?this._sceneEventHandler.clickComponent(t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlight(){return this._getViewModel().getNumberOfPossibleChildrenForComponent(this._configuratorContext.rootComponentId)>0}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=RoomleComponentFactoryInitializer();const n=this._domHelper.getClientDimensions(),i=n.x,o=n.y,s=this._componentFactory.createPerspectiveCamera(30,i/o,.1,20,t);s.layers.set(3),s.layers.enable(1),s.layers.enable(2),s.layers.enable(6),s.layers.enable(5),s.position.copy(new THREE.Vector3(0,.5,5)),this._changeCameraControl(new CameraControl3D(this._creator_,this._getInputManager(),null,s))}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}getBounds(){return this._getViewModel().getBoundingBox()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:1.5},shadowparams:{shadowMapResolution:1024,shadowRadius:1,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:50,side:THREE.FrontSide},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:1,edgeThickness:2}}}sceneChanged(){}_getCameraControl(){return this._cameraControl}_onCameraIdle(){return super._onCameraIdle()}_onCameraMove(){return super._onCameraMove()}getComponent(e){return this._plannerKernelAccess.kernelInstance.getComponent(e)}}__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorInputManager",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_memoryManager",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorContext",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_componentDimensioningHelper",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorViewModel",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_configuratorHistory",void 0),__decorate([inject],ConfiguratorSceneManager.prototype,"_plannerKernelAccess",void 0);const sortBySort=(e,t)=>e.sort||t.sort?e.sort?t.sort?e.sort-t.sort:-1:1:0,sortByString=(e,t)=>e&&!t?1:!e&&t?-1:e&&t?e.localeCompare(t):0;class RoomleConfigurator{_isInitDone(){return this._isKernelReady&&this._isWebGlReady&&this._isPreloadReady}_checkInitDone(){this._isInitDone()&&(this._onInitDoneCollection.forEach(e=>e()),this._onInitDoneCollection=[])}_onInitDone(e){this._isInitDone()?e():this._onInitDoneCollection.push(e)}constructor(e){this._onInitDoneCollection=[],this._isKernelReady=!1,this._isWebGlReady=!1,this._isPreloadReady=!0,this._isLoadError=!1,this._isReloading=!1,this._needsSync=!1,this._creator_=e,this._configuratorKernelAccessCallback.addListener(this);const t=this._errorHandler;t.subscribe(0,e=>this._configuratorUiCallbacks.onErrorDueToOffline(e)),t.subscribe(1,e=>this._configuratorUiCallbacks.onError(e)),t.subscribe(2,(e,t)=>this._configuratorUiCallbacks.onContentProblem({rapiPath:e,ids:t,message:"Could not load the ids"}))}initSceneManager(e){this._sceneManager=e||RoomleDependencyInjection.lookup("configurator-scene-manager",this._creator_)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}_loadWebGlLib(e,t){this._threeLoader.fetch().then(()=>Promise.all(PIXOTRON_EFFETCS.map(e=>this._scriptLoader.fetch(e,{id:e}))).then(this._loadingWebGlSuccess(e,t).bind(this),this.loadError.bind(this)),this.loadError.bind(this))}_loadingWebGlSuccess(e,t){return()=>{this.initSceneManager(),t&&this._sceneManager.changeOffset(t);const{initialFloorMaterial:e,dls:n,ls:i,stats:o}=this._initData,s=DynamicLightSettingLoader.createDynamicLightSettingSource(n,i);o&&this.showStats(),this._enableHD(s),this._needsSync&&(this._needsSync=!1,this._plannerKernelAccess.requestSync(DEFAULT_CONVERSATION_ID,this._configuratorContext.planObjectId));const r=[this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"})];e&&r.push(this._rapiAccess.getMaterial(e).then(e=>this._sceneManager.changeFloorMaterial(e))),Promise.all(r).then(this._webGlIsReady.bind(this),this.loadError.bind(this))}}_webGlIsReady(){this._isWebGlReady=!0,this._checkInitDone()}_initPromiseCallback(e,t){this._isInitDone()?e():this._isLoadError?t("_initPromiseCallback failed"):(this._onInitDone(()=>e()),this._rejectOnLoadError=t)}_notifyOnConfigurationReady(e){return async t=>{const n=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t.partList,t.hash);t.partList=n,e(t),this._configuratorUiCallbacks.onConfigurationReady(n,t.hash,t.rootComponentLabel)}}_notifyOnConfigurationLoadingError(e){return t=>{this._configuratorUiCallbacks.onConfigurationLoadError(),e(t)}}_loadItemOrConfigById(e,t){this._configuratorContext.lastLoadedRapiId=e,this._onLoadConfiguration(),this._preloadPackage(e),this._clearScene();const{offlineSync:n}=this._initData;if(n){const t=getCatalogIdFromItemOrConfigurationId(e);t&&this._dataSyncer.start(t)}return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(t=>{t&&t.configuration?this._loadConfiguration(t.configuration).then(e=>{const i=this._notifyOnConfigurationReady(n);t.label?this._notifyUiAboutNewItem(t,e.rootComponentLabel):this._notifyUiAboutNewConfiguration(t),i(e)},this._notifyOnConfigurationLoadingError(i).bind(this)):i(new Error("Could not load item or config with id "+e))},i)})}_shouldBroadcastToUi(e){return!(0===e&&this._configuratorContext.selectedRuntimeComponentId||1===e&&!this._configuratorContext.selectedRuntimeComponentId||2===e&&!this._configuratorContext.selectedRuntimeComponentIds.length)}_isCorrectResponse(e,t){if(0===e)return t===this._configuratorContext.planObjectId;if(1===e)return t===this._configuratorContext.selectedRuntimeComponentId;const n=t.length;if(n!==this._configuratorContext.selectedRuntimeComponentIds.length)return!1;for(let e=0;e<n;e++)if(t[e]!==this._configuratorContext.selectedRuntimeComponentIds[e])return!1;return!0}_onLoadConfiguration(){this._clearScene(),this._configuratorUiCallbacks.onLoadConfiguration()}_clearScene(){this._sceneManager&&this._sceneManager.clearScene()}_notifyUiAboutNewItem(e,t){this._rapiAccess.getCatalog(e.catalog).then(n=>this._configuratorUiCallbacks.onConfigurationLabelChange(n.name,e.label,t))}_notifyUiAboutNewConfiguration(e){Promise.all([this._rapiAccess.getCatalog(e.catalog),this._rapiAccess.getComponent(e.rootComponentId)]).then(([e,t])=>this._configuratorUiCallbacks.onConfigurationLabelChange(e.name,null,t.label))}notifyUiAboutNewLabel(e){if(isIdItemId(e)){const t=this._rapiAccess.peekItem(e),n=this._rapiAccess.peekComponent(t.rootComponentId);this._notifyUiAboutNewItem(t,n.label)}else this._notifyUiAboutNewConfiguration(this._rapiAccess.peekConfiguration(e))}_getMaterialGroups(e){const t=(e,t)=>{let n=sortBySort(e,t);return 0!==n?n:(n=sortByString(e.label,t.label),0!==n?n:sortByString(e.id,t.id))},n=e=>(e.sort(t),e.forEach(e=>e.materials.sort(t)),e);if(e.validGroups.length>0)return new Promise((t,i)=>this._rapiAccess.getMaterialsByGroup(e.validGroups).then(e=>t(n(e)),i));const i=[];return e.validValues.forEach(e=>i.push(e.value)),new Promise((e,t)=>{this._rapiAccess.getMaterials(i).then(t=>{this._rapiAccess.combineMaterialsToGroups(t).then(t=>{e(n(t))})},t)})}_loadConfiguration(e){return this._plannerKernelAccess.externalMeshQueue.clear(),new Promise((t,n)=>{const i=()=>{const{x:i,y:o}=this._domHelper.getClientDimensions();if(i<=0&&o<=0){let e="Size of canvas is 0/0! When using embedding set correct size or remove id to load in idle mode!";return console.error(e),n(e)}this.resumeKernelCallbacks(),Benchmark.start("ui_load_configuration");const s=[];if(this._initData.applyCurrentGlobalParameters){const e=this._configuratorContext.planObjectId,t=this._configuratorContext.rootComponentParametersAsGlobal;s.push(this._plannerKernelAccess.getGlobalParameters(e,t))}Promise.all(s).then(([i])=>{const o=[AsyncHelper.waitFor(4),AsyncHelper.waitFor(2)];Promise.all(o).then(([e,[n,o,s,r]])=>{const a=[];i&&this._initData.applyCurrentGlobalParameters&&i.forEach(e=>a.push(this.setParameter(e,e.value,!0)));const l=this._rapiAccess.peekComponent(r);Promise.all(a).then(()=>{const n=[];a.length&&(n.push(this._plannerKernelAccess.getPartList()),n.push(this._plannerKernelAccess.getConfigurationHash(this._configuratorContext))),Promise.all(n).then(async n=>{const i=n&&n[0]?n[0]:o,r=n&&n[1]?n[1]:s,a=await this._plannerKernelAccess.addUiDataAndPriceToPartList(i,r);let c=e.errors;const h=c?convertCObject(c):[];this._configuratorUiCallbacks.onPartListUpdate(a,window.btoa(s)),t({partList:a,hash:r,rootComponentLabel:l?l.label:"",errors:h})})})},n),this._plannerKernelAccess.loadConfiguration(e)},n)};this._onInitDone(()=>i())})}_preLoadItemOrConfig(e,t){return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(n,i)})}_preloadPackage(e){this._isPreloadReady=!1;let t=null;t=isIdItemId(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),Benchmark.start("rapi_preloads");const n=()=>{Benchmark.end("rapi_preloads");const t=Benchmark.getMeasure("rapi_preloads");if(Array.isArray(t)&&1===t.length){const n=t[0];this._configuratorUiCallbacks.onTrackTiming("Timing","RapiPreloads",Math.round(n.duration),{id:e})}};t(e).then(()=>{this._isPreloadReady=!0,this._checkInitDone(),n()},e=>{this._isPreloadReady=!0,this._checkInitDone(),console.error(e),n()})}_reloadConfiguration(e,t,n,i){return this._performLoadConfiguration(e).then(e=>{this._isReloading=!1,n(e)},e=>{this._isReloading=!1,i(e)})}_performLoadConfiguration(e){return this._onLoadConfiguration(),new Promise((t,n)=>{this._initData.preloadHint?this._preloadPackage(this._initData.preloadHint):console.warn("When loading a configuration string you have to supply a preloadHint to use fast loading!"),setTimeout(()=>{this._loadConfiguration(e).then(this._notifyOnConfigurationReady(t).bind(this),this._notifyOnConfigurationLoadingError(n).bind(this))},0)})}_changeHDGeometry(e){return new Promise((t,n)=>e===AppContext.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,AsyncHelper.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,t,n)},n),AppContext.useHDGeometry=e,void this._plannerKernelAccess.changeUseOfHDGeometry(this._configuratorContext,AppContext.useHDGeometry)))}async _callOnPartListUpdate(){const{hash:e}=await AsyncHelper.waitFor(4),t=await this._plannerKernelAccess.getPartList(),n=await this._plannerKernelAccess.getConfigurationHash(this._configuratorContext),i=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t,n);this._configuratorUiCallbacks.onPartListUpdate(i,window.btoa(e))}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}init(e,t){this.setOverrides(t);const{preloadHint:n,offset:i,startTag:o}=this._initData;return this._domHelper.setDomElement(e),n?this._preloadPackage(n):console.warn("No preload hint! Therefore no preload during init!!"),o&&this.getTagById(o,{include:["items"]}).then(e=>this._configuratorUiCallbacks.onOpenTag(e),e=>console.error(e)),this._loadWebGlLib(e,i),new Promise(this._initPromiseCallback.bind(this))}cancelSelection(){this._sceneManager.cancelComponentSelection()}enableHDGeometry(){return this._changeHDGeometry(!0)}disableHDGeometry(){return this._changeHDGeometry(!1)}changeOffset(e){this._sceneManager.changeOffset(e)}previewDockings(e,t,n){this._sceneManager.requestDockingsPreview(!0,e,t,n)}cancelDockings(){this._sceneManager.cancelDockings()}requestDeleteComponent(){this._sceneManager.requestDeleteSelectedComponent()}renderImage(e){return this._sceneManager.renderImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}preparePartImage(e,t){let n={};return"number"==typeof t?n.size=t:(t||(t={}),"number"!=typeof t.size&&(t.size=256),n=t),this._sceneManager.preparePartImage(e,n)}saveCurrentConfiguration(){return new Promise((e,t)=>{this._plannerKernelAccess.getConfigurationData(this._configuratorContext.planObjectId).then(n=>{this._rapiAccess.saveConfiguration(n).then(n=>{this._configuratorUiCallbacks.onConfigurationSaved(n.configurationHash),this._rapiAccess.getComponent(n.rootComponentId).then(i=>{let o=!0,s=!0,r=n.perspectiveImage,a=n.topImage;n.perspectiveImage||(o=!1,this._sceneManager.preparePerspectiveImage().then(l=>{this._rapiAccess.savePerspectiveImage(n,l).then(t=>{o=!0,r=t.perspectiveImage,s&&(t.label=i.label,t.topImage=a,e(t))},t)})),n.topImage||(s=!1,this._sceneManager.prepareTopImage().then(l=>{this._rapiAccess.saveTopImage(n,l).then(t=>{s=!0,a=t.topImage,o&&(t.label=i.label,t.perspectiveImage=r,e(t))},t)})),o&&s&&(n.label=i.label,e(n))},e=>{throw new Error(e)})},t)}).catch(t)})}generateImagesOfCurrentConfiguration(){return new Promise((e,t)=>this.saveCurrentConfiguration().then(t=>e({topImage:t.topImage,perspectiveImage:t.perspectiveImage,isLocally:t.isLocally}),t))}prepareTopImage(e){let t={};return"boolean"==typeof e?t.showDimensions=e:(e||(e={}),"boolean"!=typeof e.showDimensions&&(e.showDimensions=!1),t=e),this._sceneManager.prepareTopImage(t)}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}showBenchmarks(e){Benchmark.showBenchmarks(e)}debugSceneGraph(e){this._sceneManager.debugSceneGraph(e)}async loadConfiguration(e,t){this.setOverrides(t),this._configuratorContext.lastLoadedRapiId=null,this._sceneManager&&this._sceneManager.clearScene();const n=await this._performLoadConfiguration(e);return this._rapiAccess.trackView("configuration string"),n}async loadConfigurationById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!0);return this._rapiAccess.trackView(e),n}syncPlanObjectToView(e,t){this.resumeKernelCallbacks(),this._plannerKernelAccess.requestSync(e,t),this._plannerKernelAccess.requestPlanObjectConstruction(t);const n=this._plannerKernelAccess.getSerializedConfiguration(t),i=this._plannerKernelAccess.getCurrentConfigurationHash(t);this._plannerKernelAccess.planObjectConfigurationUpdated(t,n,i),this._sceneManager.resetCameraPositionToStart(!1)}async loadConfigurableItemById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!1);return this._rapiAccess.trackView(e),n}preLoadConfigurationById(e){return this._preLoadItemOrConfig(e,!0)}preLoadConfigurableItemById(e){return this._preLoadItemOrConfig(e,!1)}_getTag(e){return this._rapiAccess.getTag(e)}_dispatchSetParameter(e,t,n,i,o){const s=this._configuratorContext.selectedRuntimeComponentId?"local":"global",r=Benchmark.start("kernel_change_param_"+s+"_"+e);switch(this._configuratorContext.selectionMode){case"standard":if(this._configuratorContext.selectedRuntimeComponentId||this._configuratorContext.rootComponentParametersAsGlobal){let s=this._configuratorContext.selectedRuntimeComponentId?this._configuratorContext.selectedRuntimeComponentId:this._configuratorContext.rootComponentId;this._plannerKernelAccess.changeComponentParameter(s,e,t,n,i,o)}else this._plannerKernelAccess.changePlanObjectParameter(this._configuratorContext.planObjectId,e,t,n,i,o);break;case"multiselect":this._plannerKernelAccess.changeCommonComponentParameter(this._configuratorContext.selectedRuntimeComponentIds,e,t,n,i,o)}Benchmark.end(r)}setParameter(e,t,n=!1){return new Promise((i,o)=>{const{key:s,type:r}=e;if(isRange(e)){if(!n&&!this._unitFormatter.isParseableUnitString(t,e))return o(new SyntaxError('Value "'+t+'" is not parseable'));const i=n?t:this._unitFormatter.parseValue(t,e),{valueFrom:s,valueTo:a}=e.validRange,l=this._unitFormatter.getAllowedDelta();if(!Number.isNaN(s)&&i<s-l)return o(new RangeError('Value "'+t+'" is too small, min-val "'+s+'"'));if(!Number.isNaN(a)&&i>a+l)return o(new RangeError('Value "'+t+'" is too big, max-val "'+a+'"'));t="Integer"===r&&"number"==typeof i?i.toFixed():i.toString()}this._sceneManager.cancelDockings(),this._dispatchSetParameter(s,r,t,i,o)})}setParameterOfPlanObject(e,t){return new Promise((n,i)=>{const{planObjectId:o,rootComponentId:s,rootComponentParametersAsGlobal:r}=this._configuratorContext,{type:a,key:l}=e;r?this._plannerKernelAccess.changeComponentParameter(s,l,a,t,n,i):this._plannerKernelAccess.changePlanObjectParameter(o,l,a,t,n,i)})}getParametersOfPlanObject(){const{planObjectId:e,rootComponentParametersAsGlobal:t}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,t)}setParameterOfRootComponent(e,t){return new Promise((n,i)=>{const{rootComponentId:o}=this._configuratorContext,{type:s,key:r}=e;this._plannerKernelAccess.changeComponentParameter(o,r,s,t,n,i)})}getParametersOfRootComponent(){const{planObjectId:e}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,!0)}enableMultiselect(){this._sceneManager.setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneManager.setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}getCurrentConfiguration(){return AsyncHelper.waitFor(1,()=>this._plannerKernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return AsyncHelper.waitFor(0,()=>{let t=null;try{if(t=JSON.parse(e).id,!t)throw new Error("Component string has no ID")}catch(e){return this._configuratorUiCallbacks.onContentProblem({rapiPath:"components",ids:[t],message:"Component string is not a valid JSON or has no ID"}),void AsyncHelper.failOperation(0,e)}this._kernelIo.setMeta({componentId:t}),this._plannerKernelAccess.loadComponentIntoKernel(e,t)})}getShortUrlOfCurrentConfiguration(){return new Promise((e,t)=>{this.saveCurrentConfiguration().then(n=>navigator.onLine?this._rapiAccess.getShortUrl(n.id,3).then(t=>{const n=t.shortId,i=Env.APP.SHORTENER_URL+n;e(i)},t):t("Can not generate short url when offline"),t)})}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}getTagById(e,t){return new Promise((n,i)=>{this._getTag(e).then(e=>{let o=Promise.resolve([]),s=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(o=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(s=this._rapiAccess.getItems(e.items))}),Promise.all([o,s]).then(([t,i])=>(i.sort(sortBySort),t.sort(sortBySort),n({...e,items:i,materials:t})),i)},i)})}requestAsset(e){return this._dataSyncer.requestAsset(e)}changeFloorMaterial(e){return this._sceneManager.changeFloorMaterial(e)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._sceneManager.changeFloorMaterial(t)}openFloorMaterials(){this._configuratorUiCallbacks.onOpenFloorMaterials()}openPartList(){this._configuratorUiCallbacks.onOpenPartList()}getAdditionalContentsOf(e){return this._rapiAccess.getAdditionalContentsOfItems(e)}changeTypeChangeTag(e){navigator.onLine&&this._initData.offlineSync&&this._dataSyncer.syncTypeChangeTag(e),this._configuratorUiCallbacks.onChangeTypeChangeTag(e)}removeTypeChangeTag(e){this._configuratorUiCallbacks.onRemoveTypeChangeTag(e)}showGUI(){this._sceneManager.showGUI()}showStats(){this._sceneManager.showStats()}showDimensions(){this._sceneManager.showDimensions()}hideDimensions(){this._sceneManager.hideDimensions()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}syncFloorTag(e){return this._dataSyncer.syncFloorTag(e)}syncTypeChangeTag(e){return this._dataSyncer.syncTypeChangeTag(e)}loadDynamicLightSetting(e){return this._sceneManager.loadDynamicLightSetting(e)}setBackgroundColor(e){this._sceneManager.setBackgroundColor(e)}setBackgroundImage(e){this._sceneManager.setBackgroundImage(e)}setBakedShadow(e,t){this._sceneManager.setBakedShadow(e,t)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}enableMeshSelection(e){this._initData.meshSelection=e}updateSize(){this._sceneManager.updateCamera()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}getMain(){}cleanup(e={}){this._configuratorContext.selectedRuntimeComponentIds=[],this._plannerKernelAccess.cleanUpCallbacks(),this._sceneManager.sceneCleared(!!e.resetMeshCache),e.resetCoreCache&&this._plannerKernelAccess.kernelInstance.clearAll(),e.resetApiCache&&this._rapiAccess.cleanUp()}resumeTest(e){e&&this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}zoomIn(e){this._sceneManager.zoomIn(e)}zoomOut(e){this._sceneManager.zoomOut(e)}get callbacks(){return this._configuratorUiCallbacks}get globalCallbacks(){return this._globalCallback}getRuntimeComponentIdOfRootComponent(){const e=this._configuratorContext.planObjectId;return e?this._plannerKernelAccess.getRuntimeComponentIdOfRootComponent(e):(console.warn("planObjectId not set"),0)}getCurrentConfigurationHash(){return this._plannerKernelAccess.getConfigurationHash(this._configuratorContext)}getCurrentSelection(){let e=this._configuratorContext.selectedRuntimeComponentIds;return e&&e.length||(e=[this._configuratorContext.rootComponentId]),e.map(e=>this._plannerKernelAccess.getRuntimeComponentId(e))}_enableHD(e){return new Promise((t,n)=>{this._scriptLoader.fetch(PIXOTRON_FILE_NAME,{id:"pi-js"}).then(()=>{this._sceneManager.enableHD(e),t()},n)})}isReady(){const e=Benchmark.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=Benchmark.getMeta("kernel_is_ready");this._configuratorUiCallbacks.onTrackTiming("Timing","KernelIsReady",Math.round(t.duration),Object.assign(n,{startTime:t.startTime}))}this._isKernelReady=!0,this._checkInitDone(),"function"==typeof this._configuratorUiCallbacks.onKernelIsReady&&this._configuratorUiCallbacks.onKernelIsReady()}async updatePossibleChildren(e,t,n){const i=await this._addAdditionalInfoToPossibleChildren(e,t,n);if(i){const{tags:e,defaultChild:t}=i;this._shouldBroadcastToUi(n)&&this._configuratorUiCallbacks.onUpdatePossibleChildren(e,t)}}updateParameters(e,t,n,i){this._setParameterTooltip(e,n),this._addGroupsToParameters(n,e,t,i),this._shouldBroadcastToUi(i)&&this._configuratorUiCallbacks.onUpdateParameters(e)}loadError(e){this._isLoadError=!0,this._rejectOnLoadError&&this._rejectOnLoadError(e)}resumeKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!1,this._plannerKernelAccess.resume()}pauseKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!0,this._plannerKernelAccess.pause()}setActiveGroupInView(e){this._plannerKernelAccess.setActiveGroupInView(e)}setActiveGroupInViewForPlanObject(e,t){this._plannerKernelAccess.setActiveGroupInViewForPlanObject(e,t)}getParameterGroups(){return this._plannerKernelAccess.getParameterGroups()}async getConfiguratorSettings(e){return this._rapiAccess.getConfiguratorSettings(e)}async moveCamera(e){return this._sceneManager.moveCamera(e)}selectComponent(e){return this._configuratorContext.selectedRuntimeComponentId===e?Promise.resolve():Promise.resolve(this._sceneManager.selectComponent(e))}setComponentParameter(e,t,n){const{key:i,type:o}=t;return new Promise((t,s)=>this._plannerKernelAccess.changeComponentParameter(e,i,o,n,t,s))}highlightParts(e){this._sceneManager.highlightParts(e)}undo(){return new Promise((e,t)=>{const n=this._configuratorHistory.undo();n&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(n))})}redo(){return new Promise((e,t)=>{const n=this._configuratorHistory.redo();n&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(n))})}clearHistory(){this._configuratorHistory.clearHistory()}getHashOfSerializedConfiguration(e){return this._plannerKernelAccess.kernelInstance.getHashOfSerializedConfiguration(e)}getParametersOfComponent(e){const t=this._plannerKernelAccess.kernelInstance.getComponentParameters(e),n=this.getParameterGroups();return this._mapComponentTooltipsToParamKeys(t,e),this._addGroupsToParameters(e,t,n,1,!0)}_mapComponentTooltipsToParamKeys(e,t){const n=this._plannerKernelAccess.kernelInstance.getComponentId(t),i=this._rapiAccess.peekComponent(n);if(i&&i.additionalInfos)for(const t of e){const e=i.additionalInfos.find(e=>e.key.toLocaleLowerCase()===t.key.toLocaleLowerCase()&&"parameter"===e.type);e&&(t.tooltip=e.tooltip)}}_setParameterTooltip(e,t){Array.isArray(t)?t.forEach(t=>this._mapComponentTooltipsToParamKeys(e,t)):this._mapComponentTooltipsToParamKeys(e,t)}_addGroupsToParameters(e,t,n,i,o=!1){n||(n=[],console.warn("Kernel returned no parameter groups! Check why!"));const s={};return n.forEach(e=>{s[e.key]=e}),t.sort(sortBySort),t.forEach(t=>{t.group?t.grouping=s[t.group]:t.grouping=null,this._unitFormatter.formatParameter(t),isMaterial(t)&&Object.defineProperty(t,"groups",{get:()=>new Promise((n,s)=>{this._getMaterialGroups(t).then(t=>{this._isCorrectResponse(i,e)&&this._shouldBroadcastToUi(i)||o?n(t):s("Response does not match to ids")},s)})})}),t}async _getChildrenOf(e,t,n,i){const o=i(e,t,n);return await this._addAdditionalInfoToPossibleChildren(e,o,2,!1,!0)}async getChildrenOfPlanComponent(e,t=!1,n=!1){const i=this._plannerKernelAccess.kernelInstance.getChildrenOfPlanComponent.bind(this._plannerKernelAccess.kernelInstance);return this._getChildrenOf(e,t,n,i)}async getChildrenOfPlanObject(e=!1,t=!1){const{planObjectId:n}=this._configuratorContext,i=this._plannerKernelAccess.kernelInstance.getChildrenOfPlanObject.bind(this._plannerKernelAccess.kernelInstance);return this._getChildrenOf(n,e,t,i)}async _addAdditionalInfoToPossibleChildren(e,t,n,i=!0,o=!1){const{possibleChildren:s,defaultChild:r}=await this._getPossibleChildrenForKernelPossibleChildren(t,o),a=[],l=new Map,c=[];if(s.forEach(e=>{const t=e.tags;if(e.tags&&Array.isArray(e.tags)&&e.tags.length)for(let n=0,i=e.tags.length;n<i;n++){const i=t[n];-1===a.indexOf(i)&&a.push(i);let o=l.get(i);if(!o){const e=[];l.set(i,e),o=l.get(i)}o.push(e)}else c.push(e)}),this._isCorrectResponse(n,e)||!i){let e;try{e=await this._rapiAccess.getTags(a)}catch(e){console.error("Couldnt load tags of possible children"),console.error(e)}return e.forEach(e=>{e.possibleChildren=l.get(e.id)}),e.sort(sortBySort),c.length&&e.unshift({id:"",externalIdentifier:"",global:!1,created:(new Date).toISOString(),updated:(new Date).toISOString(),language:this._globalInitData.locale,catalog:null,tags:[],parents:[],materials:[],items:[],possibleChildren:c}),{tags:e,defaultChild:r}}return null}async _getPossibleChildrenForKernelPossibleChildren(e,t=!1){const n=[],i=[];let o;const s=new Map,r=new Map;e.forEach(e=>{if(!e.possible&&!t)return;let a=e.itemId;e.itemId?(i.push(e.itemId),r.set(e.itemId,e)):(n.push(e.componentId),s.set(e.componentId,e),a=e.componentId),e.isDefault&&!o&&(o=a)});const a=await Promise.all([this._rapiAccess.getComponents(n),this._rapiAccess.getItems(i)]),l=a[0],c=a[1],h=[];let d=null;return l.forEach(e=>{e.isItem=!1,e.isComponent=!0;const t=s.get(e.id);t&&(e.group=t.group,e.possible=t.possible),e.id===o&&(e.isDefault=!0,d=e),h.push(e)}),c.forEach(e=>{e.isItem=!0,e.isComponent=!1;const t=r.get(e.id);t&&(e.group=t.group,e.possible=t.possible),e.id===o&&(e.isDefault=!0,d=e),h.push(e)}),h.sort(sortBySort),{possibleChildren:h,defaultChild:d}}getUnitFormatter(){return this._unitFormatter}getComponent(e){return this._sceneManager.getComponent(e)}async getTools(){const e=RoomleDependencyInjection.lookup("roomle-tools-core",this._creator_);return await e.init(),e}}__decorate([inject],RoomleConfigurator.prototype,"_rapiAccess",void 0),__decorate([inject],RoomleConfigurator.prototype,"_dataSyncer",void 0),__decorate([inject],RoomleConfigurator.prototype,"_errorHandler",void 0),__decorate([inject],RoomleConfigurator.prototype,"_unitFormatter",void 0),__decorate([inject],RoomleConfigurator.prototype,"_domHelper",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorKernelAccessCallback",void 0),__decorate([inject],RoomleConfigurator.prototype,"_lifeCycleManager",void 0),__decorate([inject],RoomleConfigurator.prototype,"_plannerKernelAccess",void 0),__decorate([inject],RoomleConfigurator.prototype,"_threeLoader",void 0),__decorate([inject],RoomleConfigurator.prototype,"_scriptLoader",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorContext",void 0),__decorate([inject],RoomleConfigurator.prototype,"_initData",void 0),__decorate([inject],RoomleConfigurator.prototype,"_globalInitData",void 0),__decorate([inject],RoomleConfigurator.prototype,"_globalCallback",void 0),__decorate([inject],RoomleConfigurator.prototype,"_kernelIo",void 0),__decorate([inject],RoomleConfigurator.prototype,"_configuratorHistory",void 0);export{ConfiguratorSceneManager as C,GLTF_EXPORTER_FILE_NAME as G,PlanViewModel as P,RoomleConfigurator as R,SceneEventHandler as S,preparePerspectiveImage as a,getCameraTargetForBBox as g,prepareTopImage as p};
|
|
2
|
-
//# sourceMappingURL=roomle-configurator-ff35715f.js.map
|