@roomle/web-sdk 2.52.0 → 2.53.0-alpha.2
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-7974e8a1.js → banana-for-scale-a8fc60a2.js} +2 -2
- package/lib/{banana-for-scale-7974e8a1.js.map → banana-for-scale-a8fc60a2.js.map} +1 -1
- package/lib/{banana-for-scale-30597efb.nomodule.js → banana-for-scale-be28b5dc.nomodule.js} +2 -2
- package/lib/{banana-for-scale-30597efb.nomodule.js.map → banana-for-scale-be28b5dc.nomodule.js.map} +1 -1
- package/lib/{component-dimensioning-8f50e9ae.js → component-dimensioning-35616e12.js} +2 -2
- package/lib/component-dimensioning-35616e12.js.map +1 -0
- package/lib/{component-dimensioning-421bbb31.nomodule.js → component-dimensioning-fb94b7d0.nomodule.js} +2 -2
- package/lib/component-dimensioning-fb94b7d0.nomodule.js.map +1 -0
- package/lib/{component-raycast-helper-6785d475.nomodule.js → component-raycast-helper-1a846112.nomodule.js} +2 -2
- package/lib/component-raycast-helper-1a846112.nomodule.js.map +1 -0
- package/lib/{component-raycast-helper-ff38d8de.js → component-raycast-helper-ba8eceb9.js} +2 -2
- package/lib/component-raycast-helper-ba8eceb9.js.map +1 -0
- package/lib/{configurator-9775c600.nomodule.js → configurator-1aa2bb88.nomodule.js} +2 -2
- package/lib/configurator-1aa2bb88.nomodule.js.map +1 -0
- package/lib/{configurator-4d69676d.js → configurator-6c624b9f.js} +2 -2
- package/lib/configurator-6c624b9f.js.map +1 -0
- package/lib/configurator-main-4f51546e.js +2 -0
- package/lib/configurator-main-4f51546e.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{continuous-drawing-helper-c361dcaa.nomodule.js → continuous-drawing-helper-3871037e.nomodule.js} +2 -2
- package/lib/continuous-drawing-helper-3871037e.nomodule.js.map +1 -0
- package/lib/{continuous-drawing-helper-6ab69cc6.js → continuous-drawing-helper-4eddf42f.js} +2 -2
- package/lib/continuous-drawing-helper-4eddf42f.js.map +1 -0
- package/lib/{default-light-setting-f0a27d18.nomodule.js → default-light-setting-7b0d68f1.nomodule.js} +2 -2
- package/lib/default-light-setting-7b0d68f1.nomodule.js.map +1 -0
- package/lib/{default-light-setting-696a1899.js → default-light-setting-e129aba9.js} +2 -2
- package/lib/default-light-setting-e129aba9.js.map +1 -0
- package/lib/{dimensioning-helper-cbf5f542.nomodule.js → dimensioning-helper-48c93142.nomodule.js} +2 -2
- package/lib/{dimensioning-helper-cbf5f542.nomodule.js.map → dimensioning-helper-48c93142.nomodule.js.map} +1 -1
- package/lib/{dimensioning-helper-a712794b.js → dimensioning-helper-b024a4cf.js} +2 -2
- package/lib/{dimensioning-helper-a712794b.js.map → dimensioning-helper-b024a4cf.js.map} +1 -1
- package/lib/{glb-viewer-29ff1d91.nomodule.js → glb-viewer-085d78e6.nomodule.js} +2 -2
- package/lib/{glb-viewer-29ff1d91.nomodule.js.map → glb-viewer-085d78e6.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-1371edb6.js → glb-viewer-da4dd12d.js} +2 -2
- package/lib/{glb-viewer-1371edb6.js.map → glb-viewer-da4dd12d.js.map} +1 -1
- package/lib/glb-viewer-main-479aa23d.js +2 -0
- package/lib/glb-viewer-main-479aa23d.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/legacy/{banana-for-scale-18804f5f.legacy.js → banana-for-scale-42cf3f5f.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-18804f5f.legacy.js.map → banana-for-scale-42cf3f5f.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-5d54719c.legacy.js → component-dimensioning-215b142a.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-215b142a.legacy.js.map +1 -0
- package/lib/legacy/{component-raycast-helper-a10a6f49.legacy.js → component-raycast-helper-7fddf31e.legacy.js} +2 -2
- package/lib/legacy/component-raycast-helper-7fddf31e.legacy.js.map +1 -0
- package/lib/legacy/{configurator-7d487924.legacy.js → configurator-3efc569e.legacy.js} +2 -2
- package/lib/legacy/configurator-3efc569e.legacy.js.map +1 -0
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{continuous-drawing-helper-92d203da.legacy.js → continuous-drawing-helper-3870a0f0.legacy.js} +2 -2
- package/lib/legacy/continuous-drawing-helper-3870a0f0.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-283463e3.legacy.js → default-light-setting-9d4422ab.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-9d4422ab.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-c080117e.legacy.js → dimensioning-helper-78c20e64.legacy.js} +2 -2
- package/lib/legacy/{dimensioning-helper-c080117e.legacy.js.map → dimensioning-helper-78c20e64.legacy.js.map} +1 -1
- package/lib/legacy/{glb-viewer-afc3ac60.legacy.js → glb-viewer-2467aa45.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-afc3ac60.legacy.js.map → glb-viewer-2467aa45.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{material-viewer-9b643aef.legacy.js → material-viewer-81d71fd0.legacy.js} +2 -2
- package/lib/legacy/material-viewer-81d71fd0.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/{pixotron-ea1b5c34.legacy.js → pixotron-c4a9ead0.legacy.js} +2 -2
- package/lib/legacy/{pixotron-ea1b5c34.legacy.js.map → pixotron-c4a9ead0.legacy.js.map} +1 -1
- package/lib/legacy/{planner-b540a57e.legacy.js → planner-6f12af94.legacy.js} +2 -2
- package/lib/legacy/{planner-b540a57e.legacy.js.map → planner-6f12af94.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/{roomle-configurator-c972b0fa.legacy.js → roomle-configurator-ee16043c.legacy.js} +2 -2
- package/lib/legacy/{roomle-configurator-c972b0fa.legacy.js.map → roomle-configurator-ee16043c.legacy.js.map} +1 -1
- package/lib/legacy/roomle-dependency-injection-41f249eb.legacy.js +16 -0
- package/lib/legacy/{roomle-dependency-injection-9039338d.legacy.js.map → roomle-dependency-injection-41f249eb.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/{script-loader-7a3768a8.legacy.js → script-loader-e0ee81af.legacy.js} +2 -2
- package/lib/legacy/script-loader-e0ee81af.legacy.js.map +1 -0
- package/lib/legacy/static/ConfiguratorKernel-88ee35a23593e020.wasm +0 -0
- package/lib/legacy/static/{ConfiguratorKernel-f0f690a2a1ca4c6d.js → ConfiguratorKernel-be1ee1dded268455.js} +17 -17
- package/lib/legacy/static/ConfiguratorKernelJs-04a204c0e8218347.js +146 -0
- package/lib/legacy/static/ConfiguratorKernelJs-72fabe7bc4b9ff5a.mem +0 -0
- package/lib/legacy/static/{RoomleCore-77341d3d3c69e85f.js → RoomleCore-491ead199d2a6141.js} +15 -15
- package/lib/legacy/static/RoomleCore-67a2a4f9f7935f75.wasm +0 -0
- package/lib/legacy/static/RoomleCoreJs-75a93d1695ec0d75.mem +0 -0
- package/lib/legacy/static/RoomleCoreJs-e342b0acf2e171b0.js +156 -0
- package/lib/legacy/static/RoomleToolsCore-456631fc5d50b807.wasm +0 -0
- package/lib/legacy/static/{RoomleToolsCore-210c30ed9c3f421a.js → RoomleToolsCore-c31314d8be7ab53e.js} +2 -2
- package/lib/{static/shaders-d6a40bba2f93a977.json → legacy/static/shaders-abdbb9d5e91ab82b.json} +1 -1
- package/lib/legacy/{stats-helper-de80177e.legacy.js → stats-helper-1b2ecabf.legacy.js} +2 -2
- package/lib/legacy/{stats-helper-de80177e.legacy.js.map → stats-helper-1b2ecabf.legacy.js.map} +1 -1
- package/lib/legacy/{tools-core-69b04981.legacy.js → tools-core-3a425bea.legacy.js} +2 -2
- package/lib/legacy/tools-core-3a425bea.legacy.js.map +1 -0
- package/lib/{material-viewer-c20237e6.nomodule.js → material-viewer-0dbfb545.nomodule.js} +2 -2
- package/lib/material-viewer-0dbfb545.nomodule.js.map +1 -0
- package/lib/{material-viewer-5804025c.js → material-viewer-9c5b6974.js} +2 -2
- package/lib/material-viewer-9c5b6974.js.map +1 -0
- package/lib/material-viewer-main-b027b3c7.js +2 -0
- package/lib/material-viewer-main-b027b3c7.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/{pixotron-3bc73e7b.js → pixotron-c6ab9075.js} +2 -2
- package/lib/{pixotron-3bc73e7b.js.map → pixotron-c6ab9075.js.map} +1 -1
- package/lib/{pixotron-c971205e.nomodule.js → pixotron-e0c3d3ef.nomodule.js} +2 -2
- package/lib/{pixotron-c971205e.nomodule.js.map → pixotron-e0c3d3ef.nomodule.js.map} +1 -1
- package/lib/{planner-ef12336e.nomodule.js → planner-5115c46c.nomodule.js} +2 -2
- package/lib/{planner-ef12336e.nomodule.js.map → planner-5115c46c.nomodule.js.map} +1 -1
- package/lib/{planner-a5199e6f.js → planner-59b788a8.js} +2 -2
- package/lib/{planner-a5199e6f.js.map → planner-59b788a8.js.map} +1 -1
- package/lib/planner-main-b3177e3e.js +2 -0
- package/lib/planner-main-b3177e3e.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/{roomle-configurator-a87e275f.nomodule.js → roomle-configurator-6baf63da.nomodule.js} +2 -2
- package/lib/{roomle-configurator-a87e275f.nomodule.js.map → roomle-configurator-6baf63da.nomodule.js.map} +1 -1
- package/lib/{roomle-configurator-23794a99.js → roomle-configurator-7e1e21fd.js} +2 -2
- package/lib/{roomle-configurator-23794a99.js.map → roomle-configurator-7e1e21fd.js.map} +1 -1
- package/lib/roomle-dependency-injection-3ba57e77.js +16 -0
- package/lib/{roomle-dependency-injection-f2fa0789.js.map → roomle-dependency-injection-3ba57e77.js.map} +1 -1
- package/lib/roomle-dependency-injection-c5e9074b.nomodule.js +16 -0
- package/lib/{roomle-dependency-injection-11aa8a76.nomodule.js.map → roomle-dependency-injection-c5e9074b.nomodule.js.map} +1 -1
- package/lib/{roomle-sdk-5627632f.js → roomle-sdk-f3a5f1f9.js} +2 -2
- package/lib/roomle-sdk-f3a5f1f9.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/{script-loader-a86102bc.nomodule.js → script-loader-266407dc.nomodule.js} +2 -2
- package/lib/script-loader-266407dc.nomodule.js.map +1 -0
- package/lib/{script-loader-96d0be41.js → script-loader-75d6f0e4.js} +2 -2
- package/lib/script-loader-75d6f0e4.js.map +1 -0
- package/lib/static/ConfiguratorKernel-88ee35a23593e020.wasm +0 -0
- package/lib/static/{ConfiguratorKernel-f0f690a2a1ca4c6d.js → ConfiguratorKernel-be1ee1dded268455.js} +1 -1
- package/lib/static/ConfiguratorKernel-be1ee1dded268455.js.map +1 -0
- package/lib/static/ConfiguratorKernelJs-04a204c0e8218347.js +146 -0
- package/lib/static/ConfiguratorKernelJs-72fabe7bc4b9ff5a.mem +0 -0
- package/lib/static/{RoomleCore-77341d3d3c69e85f.js → RoomleCore-491ead199d2a6141.js} +1 -1
- package/lib/static/{RoomleCore-77341d3d3c69e85f.js.map → RoomleCore-491ead199d2a6141.js.map} +1 -1
- package/lib/static/RoomleCore-67a2a4f9f7935f75.wasm +0 -0
- package/lib/static/RoomleCoreJs-75a93d1695ec0d75.mem +0 -0
- package/lib/static/RoomleCoreJs-e342b0acf2e171b0.js +156 -0
- package/lib/static/RoomleToolsCore-456631fc5d50b807.wasm +0 -0
- package/lib/static/{RoomleToolsCore-210c30ed9c3f421a.js → RoomleToolsCore-c31314d8be7ab53e.js} +1 -1
- package/lib/static/{RoomleToolsCore-210c30ed9c3f421a.js.map → RoomleToolsCore-c31314d8be7ab53e.js.map} +1 -1
- package/lib/{legacy/static/shaders-d6a40bba2f93a977.json → static/shaders-abdbb9d5e91ab82b.json} +1 -1
- package/lib/{stats-helper-04478d21.nomodule.js → stats-helper-b19f7047.nomodule.js} +2 -2
- package/lib/{stats-helper-04478d21.nomodule.js.map → stats-helper-b19f7047.nomodule.js.map} +1 -1
- package/lib/{stats-helper-54bf0373.js → stats-helper-d8fdd141.js} +2 -2
- package/lib/{stats-helper-54bf0373.js.map → stats-helper-d8fdd141.js.map} +1 -1
- package/lib/{tools-core-52e89220.nomodule.js → tools-core-2bca5f01.nomodule.js} +2 -2
- package/lib/tools-core-2bca5f01.nomodule.js.map +1 -0
- package/lib/{tools-core-9bd96441.js → tools-core-53f04ba0.js} +2 -2
- package/lib/tools-core-53f04ba0.js.map +1 -0
- package/package.json +2 -2
- package/lib/component-dimensioning-421bbb31.nomodule.js.map +0 -1
- package/lib/component-dimensioning-8f50e9ae.js.map +0 -1
- package/lib/component-raycast-helper-6785d475.nomodule.js.map +0 -1
- package/lib/component-raycast-helper-ff38d8de.js.map +0 -1
- package/lib/configurator-4d69676d.js.map +0 -1
- package/lib/configurator-9775c600.nomodule.js.map +0 -1
- package/lib/configurator-main-f4289e3c.js +0 -2
- package/lib/configurator-main-f4289e3c.js.map +0 -1
- package/lib/continuous-drawing-helper-6ab69cc6.js.map +0 -1
- package/lib/continuous-drawing-helper-c361dcaa.nomodule.js.map +0 -1
- package/lib/default-light-setting-696a1899.js.map +0 -1
- package/lib/default-light-setting-f0a27d18.nomodule.js.map +0 -1
- package/lib/glb-viewer-main-1c408241.js +0 -2
- package/lib/glb-viewer-main-1c408241.js.map +0 -1
- package/lib/legacy/component-dimensioning-5d54719c.legacy.js.map +0 -1
- package/lib/legacy/component-raycast-helper-a10a6f49.legacy.js.map +0 -1
- package/lib/legacy/configurator-7d487924.legacy.js.map +0 -1
- package/lib/legacy/continuous-drawing-helper-92d203da.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-283463e3.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-9b643aef.legacy.js.map +0 -1
- package/lib/legacy/roomle-dependency-injection-9039338d.legacy.js +0 -16
- package/lib/legacy/script-loader-7a3768a8.legacy.js.map +0 -1
- package/lib/legacy/static/ConfiguratorKernel-d16ae27ee72e88e0.wasm +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-247da5a777bb2add.js +0 -146
- package/lib/legacy/static/ConfiguratorKernelJs-bb1d20624c2b4740.mem +0 -0
- package/lib/legacy/static/RoomleCore-6426a8a0d5a9d1c1.wasm +0 -0
- package/lib/legacy/static/RoomleCoreJs-2e1bc7afad0a13a5.js +0 -156
- package/lib/legacy/static/RoomleCoreJs-fef5f2a658bf77c3.mem +0 -0
- package/lib/legacy/static/RoomleToolsCore-ff9d37683de473c7.wasm +0 -0
- package/lib/legacy/tools-core-69b04981.legacy.js.map +0 -1
- package/lib/material-viewer-5804025c.js.map +0 -1
- package/lib/material-viewer-c20237e6.nomodule.js.map +0 -1
- package/lib/material-viewer-main-35d2c933.js +0 -2
- package/lib/material-viewer-main-35d2c933.js.map +0 -1
- package/lib/planner-main-4201f12d.js +0 -2
- package/lib/planner-main-4201f12d.js.map +0 -1
- package/lib/roomle-dependency-injection-11aa8a76.nomodule.js +0 -16
- package/lib/roomle-dependency-injection-f2fa0789.js +0 -16
- package/lib/roomle-sdk-5627632f.js.map +0 -1
- package/lib/script-loader-96d0be41.js.map +0 -1
- package/lib/script-loader-a86102bc.nomodule.js.map +0 -1
- package/lib/static/ConfiguratorKernel-d16ae27ee72e88e0.wasm +0 -0
- package/lib/static/ConfiguratorKernel-f0f690a2a1ca4c6d.js.map +0 -1
- package/lib/static/ConfiguratorKernelJs-247da5a777bb2add.js +0 -146
- package/lib/static/ConfiguratorKernelJs-bb1d20624c2b4740.mem +0 -0
- package/lib/static/RoomleCore-6426a8a0d5a9d1c1.wasm +0 -0
- package/lib/static/RoomleCoreJs-2e1bc7afad0a13a5.js +0 -156
- package/lib/static/RoomleCoreJs-fef5f2a658bf77c3.mem +0 -0
- package/lib/static/RoomleToolsCore-ff9d37683de473c7.wasm +0 -0
- package/lib/tools-core-52e89220.nomodule.js.map +0 -1
- package/lib/tools-core-9bd96441.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-9039338d.legacy.js","./main-thread-to-worker-876e61ea.legacy.js","./roomle-configurator-c972b0fa.legacy.js","./pixotron-ea1b5c34.legacy.js","./script-loader-7a3768a8.legacy.js","./default-light-setting-283463e3.legacy.js"],(function(e,t){var n,i,a,s,r,o,l,h,c,d,_,g,p,m,u,w,C,E,v,f,b,S,M,P,I,y,H,D,L,O,A,k,V,T,R,j,x,B,F,W,K,G,U,z,N,q,Z,X,Q,J,Y,$,ee,te,ne,ie,ae,se,re;return{setters:[function(){},function(e){n=e.l,i=e._,a=e.i,s=e.h,r=e.N,o=e.W,l=e.a6,h=e.a7,c=e.c,d=e.S,_=e.a8,g=e.j,p=e.F,m=e.M,u=e.V,w=e.a9,C=e.aa,E=e.k,v=e.B,f=e.Y,b=e.e,S=e.ab,M=e.d,P=e.ac,I=e.ad,y=e.G,H=e.ae,D=e.af,L=e.ag,O=e.r,A=e.ah,k=e.E,V=e.D,T=e.L,R=e.ai,j=e.R,x=e.b},function(e){B=e.d,F=e.i,W=e.m},function(e){K=e.S,G=e.C,U=e.P,z=e.G,N=e.p,q=e.a,Z=e.g,X=e.R},function(e){Q=e.L,J=e.B,Y=e.b,$=e.C,ee=e.d,te=e.e,ne=e.T,ie=e.P,ae=e.c},function(e){se=e.S,re=e.M},function(){}],execute:function(){class oe extends Q{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:2,y:1,z:2},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.4),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,i=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);i.normalize(),i.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(i),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=n();if(e){if(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))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class le{constructor(e){const{planElementViewModel:t,resetCamera:n,state:i,oldState:a}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===i?0:i,this.oldState=void 0===a?0:a}}class he extends K{constructor(e,t,n,i){super(e,t,n,i),this._isDrawingEnabled=!1,this._isCurrentlyDrawing=!1,this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0),this._raycastHelper.addEventListener(0,()=>{2!==this._state?this._plannerSelectionHandler.cancelSelection():this.resetState()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new le({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{1!==this._state&&this.setState(0),this.dispatchEvent(1,new le({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}disable(){const e=new THREE.Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}get planInteractionHandler(){var e;return null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler}enable(){const e=new THREE.Layers;e.disableAll(),e.enable(3),e.enable(7),e.enable(6),e.enable(9),e.enable(2),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}enableConstructionEvents(e){e?this._raycastHelper.getLayers().enable(9):this._raycastHelper.getLayers().disable(9)}enableObjectEvents(e){e?this._raycastHelper.getLayers().enable(6):this._raycastHelper.getLayers().disable(6)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}addPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getObject(),{hasListener:!0,priority:1,roomleId:e.getId()})}addNodeHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=B(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),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)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=B(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("double_click",t=>{var n;this._doubleClickElement(e,t.attachment.type,null===(n=t.attachment.intersection)||void 0===n?void 0:n.point)}),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)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_createFloorMeshWithHandler(){const e=new THREE.PlaneBufferGeometry(1e3,1e3,8,8),t=new THREE.MeshBasicMaterial;t.visible=!1;const n=new THREE.Mesh(e,t);return n.name="2D raycaster floor mesh",n.rotation.set(-Math.PI/2,0,0),n.layers.enable(2),n.userData=B(n.userData,{hasListener:!0,priority:.9,roomleId:void 0}),n.addEventListener("double_click",e=>{this._doubleClickOnPlane(s(e.attachment.intersection.point),e.attachment.type)}),n.addEventListener("select",e=>{this._isCurrentlyDrawing?this._clickOnPlane(s(e.attachment.intersection.point)):this._plannerSelectionHandler.cancelSelection()}),n}_clickOnPlane(e){this._createNode(null,e)}_doubleClickOnPlane(e,t=0){this._closeToPoint(e)?this.stopDrawing():this._toggleDrawing(null,e,t)}_closeToPoint(e){let t=!1;for(const n of this._planViewModel.getNodePlanObjectViewModels())this._close(n.getPlanElement().getCenter(),e)&&(t=!0);return t}_close(e,t){return Math.abs(e.x-t.x)<500&&Math.abs(e.y-t.y)<500&&Math.abs(e.z-t.z)<500}_clickElement(e){this._isCurrentlyDrawing||(this._debug&&e.getId(),2!==this._state?(this._plannerSelectionHandler.check(e),this._setCursor()):this.resetState())}_doubleClickElement(e,t=0,n){if(!this._isDrawingEnabled||!(e instanceof r||e instanceof o))return;let i;this._debug&&e.getId(),e instanceof o&&this._plannerSelectionHandler.cancelSelection(),e instanceof r?i=e.getPlanElement().getCenter():n&&(i=s(new THREE.Vector3(n.x,0,n.z))),this._isCurrentlyDrawing?this._endWallDrawing(null,i):this._startWallDrawing(null,i,t)}_hoverOn(e){this._isCurrentlyDrawing||(e.hoverOn(),this._hoveredObject=e,this.dispatchEvent(3,new le({planElementViewModel:e})),this._interaction(),this._setCursor())}_hoverOff(e){e.hoverOff(),this.dispatchEvent(4,new le({planElementViewModel:e})),this._interaction(),this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?F("ew-resize"):1===this._state?F("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?F("move"):this._hoveredObject?F("pointer"):3===this._state?F(l?"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 0 15, auto":"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 3 20, auto"):F("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){((this._plannerSelectionHandler.isSelected(e.getId())||this._dragIn)&&0===this._state||this._isDrawingEnabled)&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(8,new le({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let i=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanElement())),n.moveObjectsBy(e,s(i))}else(e instanceof r||e instanceof o)&&(t.y=h(e.getPlanElement().getCenter()).y),n.moveElementTo(e.getPlanElement(),s(t));this.dispatchEvent(9,new le({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(10,new le({planElementViewModel:e})),this._dragIn&&this.setDragIn(!1),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this.planInteractionHandler,i=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),i.rotation-t)}}setState(e){var t,n;const i=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new le({state:this._state,oldState:i})),this._position=null,2===this._state?null===(t=this.planInteractionHandler)||void 0===t||t.deactivateAllSnappingActivity():2===i&&(null===(n=this.planInteractionHandler)||void 0===n||n.reactivateAllSnappingActivity())}resetState(){this.setState(0)}_move(e){if(3!==this._state&&2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:i}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const a=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,r=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(a.push_back(n.getPlanElement()),r.expandByObject(n.getContainer()))});const o=r.getCenter(new THREE.Vector3);this.planInteractionHandler.rotateObjectsBy(a,t,s(o)),this._position.copy(new THREE.Vector3(n,i,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}async selectPlanElement(e){(e instanceof c||e instanceof d)&&await e.isInitDone(),this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(11,new le({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}enableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!0}disableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!1}enableWallDrawing(){return this._isDrawingEnabled=!0,this._drawingGroup=new THREE.Group,this._drawingGroup.name="Drawing",this._drawingGroup.add(this._createFloorMeshWithHandler()),this._inputManager.addEventListener(6,this._drawWallOnMouseMove,this),this._inputManager.addEventListener(13,this._endWallDrawing,this),this._drawingGroup}cancelWallDrawing(){return this._isDrawingEnabled=!1,this._setStateAndCursor(0),this._inputManager.removeEventListener(6,this._drawWallOnMouseMove),this._inputManager.removeEventListener(13,this._endWallDrawing),this._raycastHelper.clear(),this._drawingGroup}stopDrawing(e=!0){var t;e&&this.planInteractionHandler.cancelDrawing(),this._raycastHelper.getLayers().enable(9),this._isCurrentlyDrawing=!1,this._setStateAndCursor(0),this.dispatchEvent(7),null===(t=this._continousDrawingHelper)||void 0===t||t.endDrawing()}startDrawing(){var e;this._isCurrentlyDrawing||(this._isCurrentlyDrawing=!0,this._raycastHelper.getLayers().disable(9),this.dispatchEvent(6),this._setStateAndCursor(3),null===(e=this._continousDrawingHelper)||void 0===e||e.update())}_toggleDrawing(e,t,n){this._isCurrentlyDrawing?this._endWallDrawing(e,t):this._startWallDrawing(e,t,n)}_endWallDrawing(e,t){if(this._isCurrentlyDrawing){if(this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle()&&this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle())this.planInteractionHandler.cancelDrawing();else{const{x:n,y:i}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.endDrawing({x:n,y:i,z:0})}this.stopDrawing(!1)}}async _startWallDrawing(e,t,n){(e&&2===e.type||2===n)&&(await this._initMobileDrawing(),this._continousDrawingHelper.update());const{x:i,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.beginDrawing({x:i,y:a,z:0}),this.startDrawing()}async _initMobileDrawing(){if(this.planInteractionHandler.setDrawingType(0),this.planInteractionHandler.setSnapFeedbackWhileDrawing(!0),!this._continousDrawingHelper){const{default:e}=await t.import("./continuous-drawing-helper-92d203da.legacy.js");this._continousDrawingHelper=new e,this._continousDrawingHelper.init(this._drawingGroup,this.planInteractionHandler.getContinuousDrawingManager(),this._kernelZoomFactor)}}_drawWallOnMouseMove(e){var t;if(!this._isCurrentlyDrawing)return;const{x:n,y:i}=this._getIntersectionPointWithScene(e);this.planInteractionHandler.currentDrawingPosition({x:n,y:i,z:0}),null===(t=this._continousDrawingHelper)||void 0===t||t.update(),this.dispatchEvent(5)}_createNode(e,t){if(!this._isCurrentlyDrawing)return;const{x:n,y:i}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.forceNode({x:n,y:i,z:0}),this._raycastHelper.clear()}_getIntersectionPointWithScene(e){return this._raycastHelper.intersectMouseOnScene(e)}_setStateAndCursor(e){this.setState(e),this._setCursor()}setKernelZoomFactor(e){var t;this._kernelZoomFactor=e,null===(t=this._continousDrawingHelper)||void 0===t||t.setKernelZoomFactor(e)}}i([a],he.prototype,"_plannerSelectionHandler",void 0),i([a],he.prototype,"_plannerKernelAccess",void 0);const ce=(e,t,n,i)=>{const a=(new THREE.Box3).setFromObject(e.getContainer()).getCenter(new THREE.Vector3);return{runtimeId:e.getId(),position2d:_(g(a,t,n,i))}},de=(e,t)=>{const n=e.planInteractionHandler.getPlan(),i=e.planModelViewHelper.getPlanOverview(n);return m(i.objects).find(e=>e.runtimeId===t)},_e=async(e,t,n)=>{let i=[];const a=[],s=[];await Promise.all(e.map(async e=>{const n=m(e);if(n.catalogItemId?a.push(n.catalogItemId):n.configurationHash&&s.push(n.configurationHash),n.parts){const e=n.configurationHash||n.catalogItemId,i=await t.addUiDataAndPriceToPartList(n.parts,e);n.parts=i}n.data=null,i.push(n)}));const[r,o]=await Promise.all([n.getItems(a),n.getConfigurations(s)]),l=[],h=new Map;for(const e of r)h.set(e.id,e);for(const e of o)h.set(e.id,e),l.push(e.rootComponentId);const c=await n.getComponents(l),d=new Map;for(const e of c)d.set(e.id,e);for(const e of i){const t=e.catalogItemId||e.configurationHash,n=h.get(t)||null;if(n&&!n.label&&d.has(n.rootComponentId)){const e=d.get(n.rootComponentId);n.label=e.label}n&&!n.label&&(n.label=t),e.data=n}return i};class ge extends G{constructor(e,t,n,i){super(e,t,i),this._staticItemGuard=new u,this._configurableItemGuard=new u,this.currentSelection=null,this._stopRendering=!0,this._configuratorContext.baseContext="planner",this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new he(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e||3===e?(this._cameraControl.lock(),this._onCameraMove()):(this._cameraControl.unlock(),this._onCameraIdle())},this),this._plannerSceneEventHandler.addEventListener(11,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(3,({planElementViewModel:e})=>this._onPlanElementHoverOn(e),this),this._plannerSceneEventHandler.addEventListener(4,({planElementViewModel:e})=>this._onPlanElementHoverOff(e),this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof d&&this._initData.debug&&e.getGLBUrl(),this._highlightPlanElement(e),this._onSelectionChange(e),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(1,({planElementViewModel:e})=>{this._highlightPlanElement(null),this._onSelectionCancel(e),this._roomlePlannerUiCallback.onSelectionCancel(),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(8,({planElementViewModel:e})=>{this._getKernelAccess().planInteractionHandler.startInteraction(),this._cameraControl.lock(),e instanceof o&&this._sendWallDimensions(),this._environment instanceof J&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(9,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(10,async({planElementViewModel:e})=>{const t=this._getKernelAccess().planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof J&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),s(n)),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!1),this._renderEverything();const i=de(this._plannerKernelAccess,e.getId());let a;i&&(a=await _e([i],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.CHANGED,a?a[0]:null)},this),this._plannerSceneEventHandler.addEventListener(6,()=>{this._setKernelZoomFactor(),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(5,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(7,()=>this._renderWithoutShadowsAndAO(),this),this._getKernelAccess().addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._renderListener=()=>{this._requestRender()},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this.disableConfiguratorEvents(),this.enablePlannerEvents()}planCleared(){}planHistoryStateChanged(){this._sendWallDimensions()}_getViewModel(){return this._viewModel||(this._viewModel=new U(this._creator_)),this._viewModel}_onPlanElementHoverOn(e){this._highlightPlanElement(e)}_onPlanElementHoverOff(e){this._highlightPlanElement(null)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),i=e.distanceTo(n),a=t.getSize(new THREE.Vector3),s=Math.max(a.x,a.z)+3;if(i>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){const t={};e instanceof d&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof c&&(t.configurationRuntimeId=e.getConfigurationRuntimeId()),e instanceof o&&(t.wall=e.getWallDimension()),e instanceof p&&(t.staticItemRuntimeId=e.getPlanElement().getId());let n=(e=>{if(e instanceof d){const t=e.getPlanObject().getObjectType();return"door"!==t&&"window"!==t?"static":t}return e instanceof c?"configuration":e instanceof o?"wall":e instanceof p?"floor":"unknown"})(e);const i=(async()=>{const t={};if(e instanceof d&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof c){await e.isInitDone();const i=e.getConfigurationRuntimeId(),a=e.getPlanObject().getCatalogItemId();let s,r=a;if(r||(r=this._getKernelAccess().kernelInstance.getHashOfConfiguration(i)),this._configuratorContext.planObjectId=i,this._configuratorContext.planElementId=e.getId(),this._configuratorContext.rootComponentId=e.getRootComponentRuntimeId(),a&&y(a)){const e=await this._rapiAccess.getItem(a);t.item=e,s=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(r);t.configuration=e,s=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+r+", saving configuration...");const n=await this._getKernelAccess().getConfigurationData(i),a=await this._rapiAccess.saveConfiguration(n);t.configuration=a,s=a.rootComponentId?a.rootComponentId:null}if(s){const e=await this._rapiAccess.getComponent(s);t.component=e}t.configurationRuntimeId=i,n="configuration"}return t.planElementId=e.getId(),W(t)})();this.currentSelection=W(t),this._roomlePlannerUiCallback.onSelectionChange(W(this._plannerSceneEventHandler.getSelectionMode()),W(n),W(t),i,e),(e instanceof o||e instanceof r)&&(this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.show()),this._updateNodeSize()),this._renderWithoutShadowsAndAO()}_onSelectionCancel(e){this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide()),this._renderWithoutShadowsAndAO(),this.resetConfiguratorContext(),this.currentSelection=null}resetConfiguratorContext(){this._configuratorContext.planObjectId=0,this._configuratorContext.planElementId=0,this._configuratorContext.rootComponentId=0,this._configuratorContext.dockingRootComponentId=0}_setupScene(e,t){super._setupScene(e,t,!0),this._lightSetting=new oe(this._scene,this._lightSetting),this._initData.moc?this._setEnvironment(new Y(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))):(this._addSky(),this._setEnvironment(new J(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof $&&(C(this._cameraControl.getCamera(),this._getViewModel().getWallPlanObjectViewModels()),this._renderEverything())}_getInputManager(){return this._plannerInputManager}createCameraControl(e,t){this.setMode(e)}startViewing(){this._configuratorContext.baseContext="glb-viewer";const e=this._plannerSceneEventHandler.getSelectedIds();if(1===e.length){const t=this._getViewModel().getPlanObjectForId(e[0]);this._cameraControl instanceof $&&this._cameraControl.setObjectRotation(t.getPlanElement().rotation),this._getViewModel().hideAllExcept(t.getId())}this.resetCamera(),this.disablePlannerEvents(),this.updateEnvironment(this.getBounds(),!0)}startConfiguring(){var e;this._configuratorContext.baseContext="configurator";const{planElementId:t}=this._configuratorContext,n=this._getViewModel().getPlanObjectForId(t);n&&(this.setRootComponentId(n.getRootComponentRuntimeId()),this._cameraControl instanceof $&&this._cameraControl.setObjectRotation(n.getPlanElement().rotation));const i=null==n?void 0:n.getConfigurationRuntimeId();this._configuratorContext.planObjectId!==i&&(this._configuratorContext.planObjectId=i),this._getViewModel().hideAllExcept(t),this.resetCamera(),this.disablePlannerEvents(),this.enableConfiguratorEvents(),this.updateScene(),this._getKernelAccess().updatePlanObjectDependencies(i),this._getKernelAccess().requestPartListAndUpdatePricesOfParts(),this._getKernelAccess().planObjectUpdated(i),this.updateEnvironment(this.getBounds(),!0);const a=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==a||a.startInteraction()}async selectPlanObject(e){if(this._plannerSceneEventHandler.getSelectedIds().includes(e))return;const t=this._getViewModel().getPlanObjectForId(e);await this._plannerSceneEventHandler.selectPlanElement(t)}backToPlanner(){var e;if(this._getViewModel().showAll(),"configurator"===this._configuratorContext.baseContext){const t=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==t||t.endInteraction()}this._configuratorContext.baseContext="planner",this._cameraControl instanceof $&&this._cameraControl.setObjectRotation(0),this.resetCamera(),this.enablePlannerEvents(),this.disableConfiguratorEvents(),this.updateScene()}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._getViewModel().getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._getKernelAccess().catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,i)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},i)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=E(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._stopRendering=!1,this._renderEverything(),this.resetCamera()}handlerSwitchedPlans(e,t){if(this._getViewModel().setReference(t),this._getKernelAccess().coupleReferences(this._getViewModel(),t),this._getViewModel().setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._getViewModel().setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._getViewModel()),e&&this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._getViewModel().getCorePlan();if(this._pixotron){const t=E(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this._pixotronUtil&&this._getViewModel().materialQueue.finished(!0).then(()=>{this._pixotronUtil.unLockAdapter()}),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),v.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,a,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._getViewModel().getConstructionGroup()),this._scene.add(this._getViewModel().getCeilingGroup()),this._scene.add(this._getViewModel().getFloorGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._getViewModel().getBoundingBox()),this._scene.remove(this._preloadScene)}}async addPlanObjectToScene(e){if(e){const t=e.getContainer();f(t),this._scene.add(t),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender()),this._roomlePlannerUiCallback.onPlanChanged(),await e.isInitDone(),this._zoomToBounds(!1,!1),this.updateEnvironment(this.getBounds()),this._renderEverything();const n=de(this._plannerKernelAccess,e.getId());let i;n&&(i=await _e([n],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.ADDED,i?i[0]:null)}}removePlanObjectFromScene(e){(e instanceof o||e instanceof r)&&this._sendWallDimensions(),this._scene.remove(e.getContainer()),e.clear(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!0),this._renderEverything()}async planElementChanged(e,t){if(this._drawingEnabled&&this._sendWallDimensions(!1),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged(),!this._plannerSceneEventHandler.isDragIn()){const e=de(this._plannerKernelAccess,t.getId());let n;e&&(n=await _e([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.CHANGED,n?n[0]:null)}}exportGLB(e,t){this._scriptLoader.fetch(z,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._getViewModel().sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof oe&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){if(this._onCameraMove(),!(this._cameraControl instanceof ee)){for(const e of this._getViewModel().getWallPlanObjectViewModels())e.show();this._getViewModel().setCameraType(b.CAMERA_2D),this._renderEverything(),this._changeCameraControl(new ee(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(b.CAMERA_2D),this._setCameraControlListeners(),this._setKernelZoomFactor(),this._onCameraMove()}}switchTo3D(){this._onCameraMove(),this._cameraControl instanceof $||(this._getViewModel().setCameraType(b.CAMERA_3D),this._renderEverything(),this._changeCameraControl(new $(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(b.CAMERA_3D),this._setCameraControlListeners())}_setCameraControlListeners(){this._cameraControl.addEventListener(8,()=>{this._onCameraIdle()},this),this._cameraControl.addEventListener(1,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(3,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(4,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(5,()=>{this._onCameraZoomChange()},this)}_onCameraZoomChange(){this._setKernelZoomFactor()}_setKernelZoomFactor(){var e;const t=this._cameraControl.getKernelZoomFactor();this._getKernelAccess().planInteractionHandler.setZoomFactor(t),null===(e=this._plannerSceneEventHandler)||void 0===e||e.setKernelZoomFactor(t)}_setCeiling(){this._getViewModel()&&(this._cameraControl instanceof te?this._getViewModel().getCeilingGroup().visible=!0:this._getViewModel().getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof $&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof te)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>S(e.material,!1,!1)),this._getViewModel().setCameraType(b.CAMERA_FP),this._renderEverything();let e=new THREE.Vector3(0,0,0);this._getViewModel()&&(e=this._getViewModel().getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new te(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(b.CAMERA_FP),this._setCameraControlListeners()}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof $&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof $&&(this._cameraControl.disablePanning(),e.preventDefault()),!e.key||"Escape"!==e.key&&"Esc"!==e.key||this._drawingEnabled&&(this.escapeDrawing(),this._roomlePlannerUiCallback.onDrawCancel())}setMode(e){switch(e){case b.CAMERA_2D:this.switchTo2D();break;case b.CAMERA_3D:this.switchTo3D();break;case b.CAMERA_FP:this.switchToFirstPerson()}}_highlightPlanElement(e){let t=new Set;e instanceof M&&this._cameraControl instanceof ee&&e&&e.getTopViewContainer()?t.add(e.getTopViewContainer()):e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._getViewModel().getPlanObjectForId(e);n instanceof M&&this._cameraControl instanceof ee&&n&&n.getTopViewContainer()?t.add(n.getTopViewContainer()):n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._getViewModel().removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}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}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._getViewModel().constructComponents(e)}}addMesh(e,t,n,i,a,s){}_updateBounds(e){e&&("planner"===this._configuratorContext.baseContext&&this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){e||(e=this.getBounds()),e&&(this._cameraControl instanceof $&&this._cameraControl.updateToBounds(e,!1),this._cameraControl instanceof ee&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(P(e,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),!0))}_zoomToBounds(e,t=!0){const n=this.getBounds();this._cameraControl instanceof $&&(this._getViewModel().getPlanObjectCount()<=1?this._cameraControl.zoomToFitBounds(n,t):this._cameraControl.checkBoundsAndPlaceCamera(n,t)),this._cameraControl instanceof ee&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(n,e,t)}updateCameraOnDrawWalls(){const e=this.getBounds();this._cameraControl instanceof ee&&this._cameraControl.zoomToFitBounds(e,!1,!0)}getBounds(){return this._getViewModel()?this._getViewModel().getBoundingBox():null}cancelPlanElementSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlightPlanElement(null),this._requestRender()}async deletePlanElementSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelPlanElementSelection();for(const t of e){const e=this._getViewModel().getPlanObjectForId(t);if(e&&e.getObject()){const t=de(this._plannerKernelAccess,e.getId());let n;t&&(n=await _e([t],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.REMOVED,n?n[0]:null),this._getKernelAccess().planInteractionHandler.removeElement(e.getKernelObject())}}}rotatePlanElementSelection(e){const t=new(this._getKernelAccess().kernelContainer.PlanObjectPtrList),n=new THREE.Box3;let i={x:0,y:0,z:0};if(this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._getViewModel().getPlanObjectForId(e);a&&a.getObject()&&(i=a.getPlanElement().getCenter(),t.push_back(a.getPlanElement()),n.expandByObject(a.getContainer()))}),t.size()>1){const e=n.getCenter(new THREE.Vector3);i=s(e)}const a=this._getKernelAccess().planInteractionHandler.groupObjects(t);this._getKernelAccess().planInteractionHandler.rotateGroupBy(a,e,i)}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let i=await N(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(i)})})}preparePerspectiveImage(e={}){return"configurator"===this._configuratorContext.baseContext?super.preparePerspectiveImage(e):new Promise((t,n)=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof $?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let i=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const a=await q(this._scene,null,n,i,e);this._lightSetting.addToScene(),this._requestRender(),t(a)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return Z(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}enableSnapping(){this._plannerSceneEventHandler.enableSnapping()}disableSnapping(){this._plannerSceneEventHandler.disableSnapping()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}disablePlannerEvents(){this._plannerSceneEventHandler.disable()}enablePlannerEvents(){this._plannerSceneEventHandler.enable()}_onCameraIdle(){return super._onCameraIdle()&&(this._sendWallDimensions(),this._sendPlanObjectPositions()),!0}_onCameraMove(){return super._onCameraMove()&&(this._roomlePlannerUiCallback.disableWallDimensions(),this._roomlePlannerUiCallback.cameraStartsMoving()),this._updateNodeSize(),!0}_updateNodeSize(){if(this._cameraControl instanceof ee){const e=1/this._cameraControl.getCamera().zoom;this._getViewModel().setNodeZoom(e)}}_sendPlanObjectPositions(){if(this._cameraControl.isLocked())return;const{clientWidth:e,clientHeight:t}=this._domHelper.element,n=this._cameraControl.getCamera(),i=[],a=this._getViewModel().getStaticPlanObjectViewModels();for(const s of a)i.push(ce(s,n,e,t));const s=this._getViewModel().getConfigurablePlanObjectViewModels();for(const a of s)i.push(ce(a,n,e,t));this._roomlePlannerUiCallback.onUpdatePlanObjectPositions(i)}_sendWallDimensions(e=!0){if(this._cameraControl.isLocked()&&e)return;const t=[],{clientWidth:n,clientHeight:i}=this._domHelper.element,a=this._getViewModel().getWallPlanObjectViewModels();for(const e of a){const a=e.getWallDimension();if(a.length>0&&(a.fromPosition2d=g(a.fromPosition3d,this._cameraControl.getCamera(),n,i),a.toPosition2d=g(a.toPosition3d,this._cameraControl.getCamera(),n,i),a.textPosition2d=g(a.textPosition3d,this._cameraControl.getCamera(),n,i),a.lengthFormatted=this._unitFormatter.formatMMValueToUnitString(a.length),t.push(I(a))),this._initData.debug){const e=new THREE.SphereGeometry(.1,32,16),t=new THREE.MeshBasicMaterial({color:16711680}),n=new THREE.Mesh(e,t);n.position.copy(a.fromPosition3d);const i=new THREE.Mesh(e,t);i.position.copy(a.toPosition3d);const s=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:65280}));s.position.copy(a.textPosition3d),this._scene.add(n),this._scene.add(i),this._scene.add(s)}}this._roomlePlannerUiCallback.onUpdateWallDimensions(t)}enableWallDrawing(){if(this._cameraControl instanceof ee){const e=P(this.getBounds(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight);this._cameraControl.zoomToFitBounds(e,!0)}this._drawingEnabled||(this._drawingEnabled=!0,this._scene.add(this._plannerSceneEventHandler.enableWallDrawing()))}disableWallDrawing(){this._drawingEnabled=!1,this._cameraControl.unlock(),this._scene.remove(this._plannerSceneEventHandler.cancelWallDrawing())}escapeDrawing(){this._plannerSceneEventHandler.stopDrawing()}_changeCameraControl(e){super._changeCameraControl(e)}setSceneEvents(e){var t,n;void 0!==e.construction&&(null===(t=this._plannerSceneEventHandler)||void 0===t||t.enableConstructionEvents(e.construction)),void 0!==e.objects&&(null===(n=this._plannerSceneEventHandler)||void 0===n||n.enableObjectEvents(e.objects))}startedDrawing(){this._plannerSceneEventHandler.startDrawing()}stoppedDrawing(){this._plannerSceneEventHandler.stopDrawing()}disableEvents(){super.disableEvents(),this.disablePlannerEvents()}enableEvents(){super.enableEvents(),"planner"===this._configuratorContext.baseContext&&this.enablePlannerEvents()}}i([a],ge.prototype,"_rapiAccess",void 0),i([a],ge.prototype,"_plannerMeshGenerator",void 0),i([a],ge.prototype,"_plannerInputManager",void 0),i([a],ge.prototype,"_roomlePlannerUiCallback",void 0),i([a],ge.prototype,"_localStorageHelper",void 0),i([a],ge.prototype,"_unitFormatter",void 0);const pe={left:0,top:1,right:1,bottom:0};class me{constructor(e){this._hscInstance=null,this._glbInstance=null,this._configurator=null,this._currentMode=1,this._creator_=e,this._kernelAccessCallback.addListener(this)}deleteSelection(){this._sceneManager.deletePlanElementSelection()}rotateSelection(e){this._sceneManager.rotatePlanElementSelection(e)}cancelSelection(){this._sceneManager.cancelPlanElementSelection()}init(e,t,n){return v.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{const i=H(e);(i?this._rapiAccess.getPlanSnapshot(e):this._rapiAccess.getPlan(e)).then(n=>{const a=i?n.plan:n.planObjects;this._plan=this._planInteractionHandler.loadPlanXML(a),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&this._rapiAccess.trackView(e),t(n)},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(D,{id:"gltf-loader"}),n=this._scriptLoader.fetch(L,{id:"draco-loader"}),i=this._scriptLoader.fetch(ne,{id:"tween-js"}),a=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,i,a]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:i,stats:a}=this._initData;this._sceneManager||(this._sceneManager=new ge(this._creator_,pe,this,i)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const s=O.createDynamicLightSettingSource(t,n);a&&this.showStats(),this.enableHD(s),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(e){return new Promise((t,n)=>{const i=()=>{this._sceneManager.enableHD(e),t()};this._threeLoader.fetch().then(()=>Promise.all(ie.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(ae,{id:"pi-js"}).then(i,n)},n)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){v.showBenchmarks()}getConfiguratorApi(){return this._configurator||(this._configurator=new X(this._creator_),this._configurator.setOverrides(this._initData),this._configurator.initSceneManager(this._sceneManager)),this._configurator}startViewing(){this._sceneManager.startViewing()}startConfiguring(){var e,t;this._sceneManager.startConfiguring();const n=this._sceneManager.currentSelection,i=(null===(e=n.item)||void 0===e?void 0:e.id)||(null===(t=n.configuration)||void 0===t?void 0:t.id);i&&this._configurator.notifyUiAboutNewLabel(i)}async selectPlanObjectById(e){return this._sceneManager.selectPlanObject(e)}backToPlanner(){this._sceneManager.backToPlanner()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-7d487924.legacy.js").then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().initSceneManager(this._sceneManager),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._currentMode=0,this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-afc3ac60.legacy.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._currentMode=2,this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._currentMode=1}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(2===this._currentMode&&this._glbInstance&&this._glbInstance.getApi().clearScene(),0===this._currentMode&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._currentMode=1}backTo(e){console.error("backTo in planner Needs to be implemented later")}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");t&&(t=s(new THREE.Vector3(t.x,t.y,t.z)));const i=await(y(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),a=await this._plannerKernelAccess.addPlanObjectFromItem(i,t,n);return this._sceneManager.updateScene(),a}async insertItemList(e){const t=e.map(e=>y(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);return await this._plannerKernelAccess.insertItems(n)}async insertItems(e){return await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan),t=m(e.objects);return _e(t,this._plannerKernelAccess,this._rapiAccess)}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return m(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e),i=await this.insertItems([n]);if(1!==i.length)throw new Error("More than one object added, abort");return i[0]}enableSnapping(){this._sceneManager.enableSnapping()}disableSnapping(){this._sceneManager.disableSnapping()}async getPartlistOf(e){const t=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(e);if(!t){const e="Object has no partlist because it is not a configuration: "+t;return console.warn(e),Promise.reject(e)}const n=this._plannerKernelAccess.kernelInstance.getPartList(e);return await this._plannerKernelAccess.addUiDataAndPriceToPartList(n,t)}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}drawWalls(e,t={}){var n,i;const a=this._planInteractionHandler;a.startInteraction();const s=[];for(const t of e){const e=a.addNode(t.from),r=a.addNode(t.to),o=a.addWall(e,r);void 0!==(null===(n=t.props)||void 0===n?void 0:n.height)&&a.setWallHeight(o,t.props.height),void 0!==(null===(i=t.props)||void 0===i?void 0:i.thickness)&&a.setWallThickness(o,t.props.thickness),s.push(o)}return t.keepInteractionOpen||a.endInteraction(),this._sceneManager.updateCameraOnDrawWalls(),this._sceneManager.updateScene(),s}async removeElements(e,t={}){const n=this._planInteractionHandler;n.startInteraction();for(const t of e){const e=de(this._plannerKernelAccess,m(t).getId());let n;e&&(n=await _e([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.REMOVED,n?n[0]:null),this._planInteractionHandler.removeElement(t)}t.keepInteractionOpen||n.endInteraction()}hasWalls(){const e=this._planInteractionHandler,t=null==e?void 0:e.getPlan();return!(!t||t.getWallCount()<1)}enableWallDrawing(){this._sceneManager.enableWallDrawing()}disableWallDrawing(){this._sceneManager.disableWallDrawing()}getUnitFormatter(){return this._unitFormatter}get PlannerCoreTypes(){return this._plannerKernelAccess.kernelContainer}setSceneEvents(e){this._sceneManager.setSceneEvents(e)}async saveCurrentPlanSnapshot(e){const t=await this.getPlanModelViewHelper(),n=this._planInteractionHandler.getPlan(),i=t.getPlanOverview(n),a={parentId:e||null,planObjects:[],combinedIds:[],plan:n.getPlanXML(!1,2)},s=i.objects,r=s.size();for(let e=0;e<r;e++){const t=s.get(e),n=t.configurationHash||t.catalogItemId,{center:i,dimensions:r,rotation:o}=t,l=JSON.stringify({center:i,dimensions:r,rotation:o});a.planObjects.push({combinedId:n,location:l})}const o=await this._rapiAccess.savePlanSnapshot(a),l=new Promise((e,t)=>{let n=null,i=null;this.preparePerspectiveImage().then(a=>this._rapiAccess.savePlanSnapshotPerspectiveImage(o,a).then(t=>{n=t,i&&(t.topImage=i.topImage,e(t))},t),t),this.prepareTopImage().then(a=>this._rapiAccess.savePlanSnapshotTopImage(o,a).then(t=>{i=t,n&&(t.perspectiveImage=i.perspectiveImage,e(t))},t),t)});try{return await l}catch(e){return console.error(e),o}}getPlanXmlFrom(e){return e?H(e.id)?e.plan:e.planObjects:null}}i([a],me.prototype,"_domHelper",void 0),i([a],me.prototype,"_scriptLoader",void 0),i([a],me.prototype,"_kernelAccessCallback",void 0),i([a],me.prototype,"_plannerKernelAccess",void 0),i([a],me.prototype,"_rapiAccess",void 0),i([a],me.prototype,"_singlePromiseFactory",void 0),i([a],me.prototype,"_roomlePlannerUiCallback",void 0),i([a],me.prototype,"_lifeCycleManager",void 0),i([a],me.prototype,"_threeLoader",void 0),i([a],me.prototype,"_dataSyncer",void 0),i([a],me.prototype,"_initData",void 0),i([a],me.prototype,"_globalInitData",void 0),i([a],me.prototype,"_unitFormatter",void 0);class ue{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const we=[new V("script-loader",se),new V("planner-input-manager",class extends A{_canDrag(e){return!0}},1),new V("logger",T),new V("planner-mesh-generator",R),new V("rapi-access",j),new V("planner-selection-handler",class extends k{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new ue({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),e.deselect(),void this.dispatchEvent(1,new ue({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new ue({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(0,new ue({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),e.deselect(),void this.dispatchEvent(1,new ue({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(0,new ue({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends re{setupGlobals(){}setupDependencies(){x.setup(we),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context).init(0)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new me(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
|
|
2
|
-
//# sourceMappingURL=planner-
|
|
1
|
+
System.register(["./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-41f249eb.legacy.js","./main-thread-to-worker-876e61ea.legacy.js","./roomle-configurator-ee16043c.legacy.js","./pixotron-c4a9ead0.legacy.js","./script-loader-e0ee81af.legacy.js","./default-light-setting-9d4422ab.legacy.js"],(function(e,t){var n,i,a,s,r,o,l,h,c,d,_,g,p,m,u,w,C,E,v,f,b,S,M,P,I,y,H,D,L,O,A,k,V,T,R,j,x,B,F,W,K,G,U,z,N,q,Z,X,Q,J,Y,$,ee,te,ne,ie,ae,se,re;return{setters:[function(){},function(e){n=e.l,i=e._,a=e.i,s=e.h,r=e.N,o=e.W,l=e.a6,h=e.a7,c=e.c,d=e.S,_=e.a8,g=e.j,p=e.F,m=e.M,u=e.V,w=e.a9,C=e.aa,E=e.k,v=e.B,f=e.Y,b=e.e,S=e.ab,M=e.d,P=e.ac,I=e.ad,y=e.G,H=e.ae,D=e.af,L=e.ag,O=e.r,A=e.ah,k=e.E,V=e.D,T=e.L,R=e.ai,j=e.R,x=e.b},function(e){B=e.d,F=e.i,W=e.m},function(e){K=e.S,G=e.C,U=e.P,z=e.G,N=e.p,q=e.a,Z=e.g,X=e.R},function(e){Q=e.L,J=e.B,Y=e.b,$=e.C,ee=e.d,te=e.e,ne=e.T,ie=e.P,ae=e.c},function(e){se=e.S,re=e.M},function(){}],execute:function(){class oe extends Q{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:2,y:1,z:2},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.4),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,i=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);i.normalize(),i.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(i),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=n();if(e){if(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))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class le{constructor(e){const{planElementViewModel:t,resetCamera:n,state:i,oldState:a}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===i?0:i,this.oldState=void 0===a?0:a}}class he extends K{constructor(e,t,n,i){super(e,t,n,i),this._isDrawingEnabled=!1,this._isCurrentlyDrawing=!1,this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0),this._raycastHelper.addEventListener(0,()=>{2!==this._state?this._plannerSelectionHandler.cancelSelection():this.resetState()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new le({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{1!==this._state&&this.setState(0),this.dispatchEvent(1,new le({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}disable(){const e=new THREE.Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}get planInteractionHandler(){var e;return null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler}enable(){const e=new THREE.Layers;e.disableAll(),e.enable(3),e.enable(7),e.enable(6),e.enable(9),e.enable(2),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}enableConstructionEvents(e){e?this._raycastHelper.getLayers().enable(9):this._raycastHelper.getLayers().disable(9)}enableObjectEvents(e){e?this._raycastHelper.getLayers().enable(6):this._raycastHelper.getLayers().disable(6)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}addPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getObject(),{hasListener:!0,priority:1,roomleId:e.getId()})}addNodeHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=B(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),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)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=B(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("double_click",t=>{var n;this._doubleClickElement(e,t.attachment.type,null===(n=t.attachment.intersection)||void 0===n?void 0:n.point)}),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)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_createFloorMeshWithHandler(){const e=new THREE.PlaneBufferGeometry(1e3,1e3,8,8),t=new THREE.MeshBasicMaterial;t.visible=!1;const n=new THREE.Mesh(e,t);return n.name="2D raycaster floor mesh",n.rotation.set(-Math.PI/2,0,0),n.layers.enable(2),n.userData=B(n.userData,{hasListener:!0,priority:.9,roomleId:void 0}),n.addEventListener("double_click",e=>{this._doubleClickOnPlane(s(e.attachment.intersection.point),e.attachment.type)}),n.addEventListener("select",e=>{this._isCurrentlyDrawing?this._clickOnPlane(s(e.attachment.intersection.point)):this._plannerSelectionHandler.cancelSelection()}),n}_clickOnPlane(e){this._createNode(null,e)}_doubleClickOnPlane(e,t=0){this._closeToPoint(e)?this.stopDrawing():this._toggleDrawing(null,e,t)}_closeToPoint(e){let t=!1;for(const n of this._planViewModel.getNodePlanObjectViewModels())this._close(n.getPlanElement().getCenter(),e)&&(t=!0);return t}_close(e,t){return Math.abs(e.x-t.x)<500&&Math.abs(e.y-t.y)<500&&Math.abs(e.z-t.z)<500}_clickElement(e){this._isCurrentlyDrawing||(this._debug&&e.getId(),2!==this._state?(this._plannerSelectionHandler.check(e),this._setCursor()):this.resetState())}_doubleClickElement(e,t=0,n){if(!this._isDrawingEnabled||!(e instanceof r||e instanceof o))return;let i;this._debug&&e.getId(),e instanceof o&&this._plannerSelectionHandler.cancelSelection(),e instanceof r?i=e.getPlanElement().getCenter():n&&(i=s(new THREE.Vector3(n.x,0,n.z))),this._isCurrentlyDrawing?this._endWallDrawing(null,i):this._startWallDrawing(null,i,t)}_hoverOn(e){this._isCurrentlyDrawing||(e.hoverOn(),this._hoveredObject=e,this.dispatchEvent(3,new le({planElementViewModel:e})),this._interaction(),this._setCursor())}_hoverOff(e){e.hoverOff(),this.dispatchEvent(4,new le({planElementViewModel:e})),this._interaction(),this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?F("ew-resize"):1===this._state?F("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?F("move"):this._hoveredObject?F("pointer"):3===this._state?F(l?"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 0 15, auto":"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 3 20, auto"):F("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){((this._plannerSelectionHandler.isSelected(e.getId())||this._dragIn)&&0===this._state||this._isDrawingEnabled)&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(8,new le({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let i=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanElement())),n.moveObjectsBy(e,s(i))}else(e instanceof r||e instanceof o)&&(t.y=h(e.getPlanElement().getCenter()).y),n.moveElementTo(e.getPlanElement(),s(t));this.dispatchEvent(9,new le({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(10,new le({planElementViewModel:e})),this._dragIn&&this.setDragIn(!1),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this.planInteractionHandler,i=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),i.rotation-t)}}setState(e){var t,n;const i=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new le({state:this._state,oldState:i})),this._position=null,2===this._state?null===(t=this.planInteractionHandler)||void 0===t||t.deactivateAllSnappingActivity():2===i&&(null===(n=this.planInteractionHandler)||void 0===n||n.reactivateAllSnappingActivity())}resetState(){this.setState(0)}_move(e){if(3!==this._state&&2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:i}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const a=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,r=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(a.push_back(n.getPlanElement()),r.expandByObject(n.getContainer()))});const o=r.getCenter(new THREE.Vector3);this.planInteractionHandler.rotateObjectsBy(a,t,s(o)),this._position.copy(new THREE.Vector3(n,i,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}async selectPlanElement(e){(e instanceof c||e instanceof d)&&await e.isInitDone(),this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(11,new le({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}enableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!0}disableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!1}enableWallDrawing(){return this._isDrawingEnabled=!0,this._drawingGroup=new THREE.Group,this._drawingGroup.name="Drawing",this._drawingGroup.add(this._createFloorMeshWithHandler()),this._inputManager.addEventListener(6,this._drawWallOnMouseMove,this),this._inputManager.addEventListener(13,this._endWallDrawing,this),this._drawingGroup}cancelWallDrawing(){return this._isDrawingEnabled=!1,this._setStateAndCursor(0),this._inputManager.removeEventListener(6,this._drawWallOnMouseMove),this._inputManager.removeEventListener(13,this._endWallDrawing),this._raycastHelper.clear(),this._drawingGroup}stopDrawing(e=!0){var t;e&&this.planInteractionHandler.cancelDrawing(),this._raycastHelper.getLayers().enable(9),this._isCurrentlyDrawing=!1,this._setStateAndCursor(0),this.dispatchEvent(7),null===(t=this._continousDrawingHelper)||void 0===t||t.endDrawing()}startDrawing(){var e;this._isCurrentlyDrawing||(this._isCurrentlyDrawing=!0,this._raycastHelper.getLayers().disable(9),this.dispatchEvent(6),this._setStateAndCursor(3),null===(e=this._continousDrawingHelper)||void 0===e||e.update())}_toggleDrawing(e,t,n){this._isCurrentlyDrawing?this._endWallDrawing(e,t):this._startWallDrawing(e,t,n)}_endWallDrawing(e,t){if(this._isCurrentlyDrawing){if(this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle()&&this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle())this.planInteractionHandler.cancelDrawing();else{const{x:n,y:i}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.endDrawing({x:n,y:i,z:0})}this.stopDrawing(!1)}}async _startWallDrawing(e,t,n){(e&&2===e.type||2===n)&&(await this._initMobileDrawing(),this._continousDrawingHelper.update());const{x:i,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.beginDrawing({x:i,y:a,z:0}),this.startDrawing()}async _initMobileDrawing(){if(this.planInteractionHandler.setDrawingType(0),this.planInteractionHandler.setSnapFeedbackWhileDrawing(!0),!this._continousDrawingHelper){const{default:e}=await t.import("./continuous-drawing-helper-3870a0f0.legacy.js");this._continousDrawingHelper=new e,this._continousDrawingHelper.init(this._drawingGroup,this.planInteractionHandler.getContinuousDrawingManager(),this._kernelZoomFactor)}}_drawWallOnMouseMove(e){var t;if(!this._isCurrentlyDrawing)return;const{x:n,y:i}=this._getIntersectionPointWithScene(e);this.planInteractionHandler.currentDrawingPosition({x:n,y:i,z:0}),null===(t=this._continousDrawingHelper)||void 0===t||t.update(),this.dispatchEvent(5)}_createNode(e,t){if(!this._isCurrentlyDrawing)return;const{x:n,y:i}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.forceNode({x:n,y:i,z:0}),this._raycastHelper.clear()}_getIntersectionPointWithScene(e){return this._raycastHelper.intersectMouseOnScene(e)}_setStateAndCursor(e){this.setState(e),this._setCursor()}setKernelZoomFactor(e){var t;this._kernelZoomFactor=e,null===(t=this._continousDrawingHelper)||void 0===t||t.setKernelZoomFactor(e)}}i([a],he.prototype,"_plannerSelectionHandler",void 0),i([a],he.prototype,"_plannerKernelAccess",void 0);const ce=(e,t,n,i)=>{const a=(new THREE.Box3).setFromObject(e.getContainer()).getCenter(new THREE.Vector3);return{runtimeId:e.getId(),position2d:_(g(a,t,n,i))}},de=(e,t)=>{const n=e.planInteractionHandler.getPlan(),i=e.planModelViewHelper.getPlanOverview(n);return m(i.objects).find(e=>e.runtimeId===t)},_e=async(e,t,n)=>{let i=[];const a=[],s=[];await Promise.all(e.map(async e=>{const n=m(e);if(n.catalogItemId?a.push(n.catalogItemId):n.configurationHash&&s.push(n.configurationHash),n.parts){const e=n.configurationHash||n.catalogItemId,i=await t.addUiDataAndPriceToPartList(n.parts,e);n.parts=i}n.data=null,i.push(n)}));const[r,o]=await Promise.all([n.getItems(a),n.getConfigurations(s)]),l=[],h=new Map;for(const e of r)h.set(e.id,e);for(const e of o)h.set(e.id,e),l.push(e.rootComponentId);const c=await n.getComponents(l),d=new Map;for(const e of c)d.set(e.id,e);for(const e of i){const t=e.catalogItemId||e.configurationHash,n=h.get(t)||null;if(n&&!n.label&&d.has(n.rootComponentId)){const e=d.get(n.rootComponentId);n.label=e.label}n&&!n.label&&(n.label=t),e.data=n}return i};class ge extends G{constructor(e,t,n,i){super(e,t,i),this._staticItemGuard=new u,this._configurableItemGuard=new u,this.currentSelection=null,this._stopRendering=!0,this._configuratorContext.baseContext="planner",this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new he(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e||3===e?(this._cameraControl.lock(),this._onCameraMove()):(this._cameraControl.unlock(),this._onCameraIdle())},this),this._plannerSceneEventHandler.addEventListener(11,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(3,({planElementViewModel:e})=>this._onPlanElementHoverOn(e),this),this._plannerSceneEventHandler.addEventListener(4,({planElementViewModel:e})=>this._onPlanElementHoverOff(e),this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof d&&this._initData.debug&&e.getGLBUrl(),this._highlightPlanElement(e),this._onSelectionChange(e),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(1,({planElementViewModel:e})=>{this._highlightPlanElement(null),this._onSelectionCancel(e),this._roomlePlannerUiCallback.onSelectionCancel(),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(8,({planElementViewModel:e})=>{this._getKernelAccess().planInteractionHandler.startInteraction(),this._cameraControl.lock(),e instanceof o&&this._sendWallDimensions(),this._environment instanceof J&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(9,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(10,async({planElementViewModel:e})=>{const t=this._getKernelAccess().planInteractionHandler;t.endInteraction(),this._cameraControl.unlock(),this._environment instanceof J&&this._environment.addToScene();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),s(n)),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!1),this._renderEverything();const i=de(this._plannerKernelAccess,e.getId());let a;i&&(a=await _e([i],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.CHANGED,a?a[0]:null)},this),this._plannerSceneEventHandler.addEventListener(6,()=>{this._setKernelZoomFactor(),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(5,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(7,()=>this._renderWithoutShadowsAndAO(),this),this._getKernelAccess().addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._renderListener=()=>{this._requestRender()},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this.disableConfiguratorEvents(),this.enablePlannerEvents()}planCleared(){}planHistoryStateChanged(){this._sendWallDimensions()}_getViewModel(){return this._viewModel||(this._viewModel=new U(this._creator_)),this._viewModel}_onPlanElementHoverOn(e){this._highlightPlanElement(e)}_onPlanElementHoverOff(e){this._highlightPlanElement(null)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),i=e.distanceTo(n),a=t.getSize(new THREE.Vector3),s=Math.max(a.x,a.z)+3;if(i>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){const t={};e instanceof d&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof c&&(t.configurationRuntimeId=e.getConfigurationRuntimeId()),e instanceof o&&(t.wall=e.getWallDimension()),e instanceof p&&(t.staticItemRuntimeId=e.getPlanElement().getId());let n=(e=>{if(e instanceof d){const t=e.getPlanObject().getObjectType();return"door"!==t&&"window"!==t?"static":t}return e instanceof c?"configuration":e instanceof o?"wall":e instanceof p?"floor":"unknown"})(e);const i=(async()=>{const t={};if(e instanceof d&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof c){await e.isInitDone();const i=e.getConfigurationRuntimeId(),a=e.getPlanObject().getCatalogItemId();let s,r=a;if(r||(r=this._getKernelAccess().kernelInstance.getHashOfConfiguration(i)),this._configuratorContext.planObjectId=i,this._configuratorContext.planElementId=e.getId(),this._configuratorContext.rootComponentId=e.getRootComponentRuntimeId(),a&&y(a)){const e=await this._rapiAccess.getItem(a);t.item=e,s=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(r);t.configuration=e,s=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+r+", saving configuration...");const n=await this._getKernelAccess().getConfigurationData(i),a=await this._rapiAccess.saveConfiguration(n);t.configuration=a,s=a.rootComponentId?a.rootComponentId:null}if(s){const e=await this._rapiAccess.getComponent(s);t.component=e}t.configurationRuntimeId=i,n="configuration"}return t.planElementId=e.getId(),W(t)})();this.currentSelection=W(t),this._roomlePlannerUiCallback.onSelectionChange(W(this._plannerSceneEventHandler.getSelectionMode()),W(n),W(t),i,e),(e instanceof o||e instanceof r)&&(this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.show()),this._updateNodeSize()),this._renderWithoutShadowsAndAO()}_onSelectionCancel(e){this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide()),this._renderWithoutShadowsAndAO(),this.resetConfiguratorContext(),this.currentSelection=null}resetConfiguratorContext(){this._configuratorContext.planObjectId=0,this._configuratorContext.planElementId=0,this._configuratorContext.rootComponentId=0,this._configuratorContext.dockingRootComponentId=0}_setupScene(e,t){super._setupScene(e,t,!0),this._lightSetting=new oe(this._scene,this._lightSetting),this._initData.moc?this._setEnvironment(new Y(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))):(this._addSky(),this._setEnvironment(new J(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof $&&(C(this._cameraControl.getCamera(),this._getViewModel().getWallPlanObjectViewModels()),this._renderEverything())}_getInputManager(){return this._plannerInputManager}createCameraControl(e,t){this.setMode(e)}startViewing(){this._configuratorContext.baseContext="glb-viewer";const e=this._plannerSceneEventHandler.getSelectedIds();if(1===e.length){const t=this._getViewModel().getPlanObjectForId(e[0]);this._cameraControl instanceof $&&this._cameraControl.setObjectRotation(t.getPlanElement().rotation),this._getViewModel().hideAllExcept(t.getId())}this.resetCamera(),this.disablePlannerEvents(),this.updateEnvironment(this.getBounds(),!0)}startConfiguring(){var e;this._configuratorContext.baseContext="configurator";const{planElementId:t}=this._configuratorContext,n=this._getViewModel().getPlanObjectForId(t);n&&(this.setRootComponentId(n.getRootComponentRuntimeId()),this._cameraControl instanceof $&&this._cameraControl.setObjectRotation(n.getPlanElement().rotation));const i=null==n?void 0:n.getConfigurationRuntimeId();this._configuratorContext.planObjectId!==i&&(this._configuratorContext.planObjectId=i),this._getViewModel().hideAllExcept(t),this.resetCamera(),this.disablePlannerEvents(),this.enableConfiguratorEvents(),this.updateScene(),this._getKernelAccess().updatePlanObjectDependencies(i),this._getKernelAccess().requestPartListAndUpdatePricesOfParts(),this._getKernelAccess().planObjectUpdated(i),this.updateEnvironment(this.getBounds(),!0);const a=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==a||a.startInteraction()}async selectPlanObject(e){if(this._plannerSceneEventHandler.getSelectedIds().includes(e))return;const t=this._getViewModel().getPlanObjectForId(e);await this._plannerSceneEventHandler.selectPlanElement(t)}backToPlanner(){var e;if(this._getViewModel().showAll(),"configurator"===this._configuratorContext.baseContext){const t=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==t||t.endInteraction()}this._configuratorContext.baseContext="planner",this._cameraControl instanceof $&&this._cameraControl.setObjectRotation(0),this.resetCamera(),this.enablePlannerEvents(),this.disableConfiguratorEvents(),this.updateScene()}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._getViewModel().getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._getKernelAccess().catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,i)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},i)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=E(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._stopRendering=!1,this._renderEverything(),this.resetCamera()}handlerSwitchedPlans(e,t){if(this._getViewModel().setReference(t),this._getKernelAccess().coupleReferences(this._getViewModel(),t),this._getViewModel().setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._getViewModel().setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._getViewModel()),e&&this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._getViewModel().getCorePlan();if(this._pixotron){const t=E(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this._pixotronUtil&&this._getViewModel().materialQueue.finished(!0).then(()=>{this._pixotronUtil.unLockAdapter()}),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),v.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,a,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._getViewModel().getConstructionGroup()),this._scene.add(this._getViewModel().getCeilingGroup()),this._scene.add(this._getViewModel().getFloorGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._getViewModel().getBoundingBox()),this._scene.remove(this._preloadScene)}}async addPlanObjectToScene(e){if(e){const t=e.getContainer();f(t),this._scene.add(t),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender()),this._roomlePlannerUiCallback.onPlanChanged(),await e.isInitDone(),this._zoomToBounds(!1,!1),this.updateEnvironment(this.getBounds()),this._renderEverything();const n=de(this._plannerKernelAccess,e.getId());let i;n&&(i=await _e([n],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.ADDED,i?i[0]:null)}}removePlanObjectFromScene(e){(e instanceof o||e instanceof r)&&this._sendWallDimensions(),this._scene.remove(e.getContainer()),e.clear(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!0),this._renderEverything()}async planElementChanged(e,t){if(this._drawingEnabled&&this._sendWallDimensions(!1),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged(),!this._plannerSceneEventHandler.isDragIn()){const e=de(this._plannerKernelAccess,t.getId());let n;e&&(n=await _e([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.CHANGED,n?n[0]:null)}}exportGLB(e,t){this._scriptLoader.fetch(z,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._getViewModel().sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof oe&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){if(this._onCameraMove(),!(this._cameraControl instanceof ee)){for(const e of this._getViewModel().getWallPlanObjectViewModels())e.show();this._getViewModel().setCameraType(b.CAMERA_2D),this._renderEverything(),this._changeCameraControl(new ee(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(b.CAMERA_2D),this._setCameraControlListeners(),this._setKernelZoomFactor(),this._onCameraMove()}}switchTo3D(){this._onCameraMove(),this._cameraControl instanceof $||(this._getViewModel().setCameraType(b.CAMERA_3D),this._renderEverything(),this._changeCameraControl(new $(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(b.CAMERA_3D),this._setCameraControlListeners())}_setCameraControlListeners(){this._cameraControl.addEventListener(8,()=>{this._onCameraIdle()},this),this._cameraControl.addEventListener(1,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(3,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(4,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(5,()=>{this._onCameraZoomChange()},this)}_onCameraZoomChange(){this._setKernelZoomFactor()}_setKernelZoomFactor(){var e;const t=this._cameraControl.getKernelZoomFactor();this._getKernelAccess().planInteractionHandler.setZoomFactor(t),null===(e=this._plannerSceneEventHandler)||void 0===e||e.setKernelZoomFactor(t)}_setCeiling(){this._getViewModel()&&(this._cameraControl instanceof te?this._getViewModel().getCeilingGroup().visible=!0:this._getViewModel().getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof $&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof te)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>S(e.material,!1,!1)),this._getViewModel().setCameraType(b.CAMERA_FP),this._renderEverything();let e=new THREE.Vector3(0,0,0);this._getViewModel()&&(e=this._getViewModel().getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new te(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(b.CAMERA_FP),this._setCameraControlListeners()}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof $&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof $&&(this._cameraControl.disablePanning(),e.preventDefault()),!e.key||"Escape"!==e.key&&"Esc"!==e.key||this._drawingEnabled&&(this.escapeDrawing(),this._roomlePlannerUiCallback.onDrawCancel())}setMode(e){switch(e){case b.CAMERA_2D:this.switchTo2D();break;case b.CAMERA_3D:this.switchTo3D();break;case b.CAMERA_FP:this.switchToFirstPerson()}}_highlightPlanElement(e){let t=new Set;e instanceof M&&this._cameraControl instanceof ee&&e&&e.getTopViewContainer()?t.add(e.getTopViewContainer()):e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._getViewModel().getPlanObjectForId(e);n instanceof M&&this._cameraControl instanceof ee&&n&&n.getTopViewContainer()?t.add(n.getTopViewContainer()):n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._getViewModel().removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}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}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._getViewModel().constructComponents(e)}}addMesh(e,t,n,i,a,s){}_updateBounds(e){e&&("planner"===this._configuratorContext.baseContext&&this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){e||(e=this.getBounds()),e&&(this._cameraControl instanceof $&&this._cameraControl.updateToBounds(e,!1),this._cameraControl instanceof ee&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(P(e,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),!0))}_zoomToBounds(e,t=!0){const n=this.getBounds();this._cameraControl instanceof $&&(this._getViewModel().getPlanObjectCount()<=1?this._cameraControl.zoomToFitBounds(n,t):this._cameraControl.checkBoundsAndPlaceCamera(n,t)),this._cameraControl instanceof ee&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(n,e,t)}updateCameraOnDrawWalls(){const e=this.getBounds();this._cameraControl instanceof ee&&this._cameraControl.zoomToFitBounds(e,!1,!0)}getBounds(){return this._getViewModel()?this._getViewModel().getBoundingBox():null}cancelPlanElementSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlightPlanElement(null),this._requestRender()}async deletePlanElementSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelPlanElementSelection();for(const t of e){const e=this._getViewModel().getPlanObjectForId(t);if(e&&e.getObject()){const t=de(this._plannerKernelAccess,e.getId());let n;t&&(n=await _e([t],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.REMOVED,n?n[0]:null),this._getKernelAccess().planInteractionHandler.removeElement(e.getKernelObject())}}}rotatePlanElementSelection(e){const t=new(this._getKernelAccess().kernelContainer.PlanObjectPtrList),n=new THREE.Box3;let i={x:0,y:0,z:0};if(this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._getViewModel().getPlanObjectForId(e);a&&a.getObject()&&(i=a.getPlanElement().getCenter(),t.push_back(a.getPlanElement()),n.expandByObject(a.getContainer()))}),t.size()>1){const e=n.getCenter(new THREE.Vector3);i=s(e)}const a=this._getKernelAccess().planInteractionHandler.groupObjects(t);this._getKernelAccess().planInteractionHandler.rotateGroupBy(a,e,i)}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let i=await N(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(i)})})}preparePerspectiveImage(e={}){return"configurator"===this._configuratorContext.baseContext?super.preparePerspectiveImage(e):new Promise((t,n)=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof $?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let i=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const a=await q(this._scene,null,n,i,e);this._lightSetting.addToScene(),this._requestRender(),t(a)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return Z(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}enableSnapping(){this._plannerSceneEventHandler.enableSnapping()}disableSnapping(){this._plannerSceneEventHandler.disableSnapping()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}disablePlannerEvents(){this._plannerSceneEventHandler.disable()}enablePlannerEvents(){this._plannerSceneEventHandler.enable()}_onCameraIdle(){return super._onCameraIdle()&&(this._sendWallDimensions(),this._sendPlanObjectPositions()),!0}_onCameraMove(){return super._onCameraMove()&&(this._roomlePlannerUiCallback.disableWallDimensions(),this._roomlePlannerUiCallback.cameraStartsMoving()),this._updateNodeSize(),!0}_updateNodeSize(){if(this._cameraControl instanceof ee){const e=1/this._cameraControl.getCamera().zoom;this._getViewModel().setNodeZoom(e)}}_sendPlanObjectPositions(){if(this._cameraControl.isLocked())return;const{clientWidth:e,clientHeight:t}=this._domHelper.element,n=this._cameraControl.getCamera(),i=[],a=this._getViewModel().getStaticPlanObjectViewModels();for(const s of a)i.push(ce(s,n,e,t));const s=this._getViewModel().getConfigurablePlanObjectViewModels();for(const a of s)i.push(ce(a,n,e,t));this._roomlePlannerUiCallback.onUpdatePlanObjectPositions(i)}_sendWallDimensions(e=!0){if(this._cameraControl.isLocked()&&e)return;const t=[],{clientWidth:n,clientHeight:i}=this._domHelper.element,a=this._getViewModel().getWallPlanObjectViewModels();for(const e of a){const a=e.getWallDimension();if(a.length>0&&(a.fromPosition2d=g(a.fromPosition3d,this._cameraControl.getCamera(),n,i),a.toPosition2d=g(a.toPosition3d,this._cameraControl.getCamera(),n,i),a.textPosition2d=g(a.textPosition3d,this._cameraControl.getCamera(),n,i),a.lengthFormatted=this._unitFormatter.formatMMValueToUnitString(a.length),t.push(I(a))),this._initData.debug){const e=new THREE.SphereGeometry(.1,32,16),t=new THREE.MeshBasicMaterial({color:16711680}),n=new THREE.Mesh(e,t);n.position.copy(a.fromPosition3d);const i=new THREE.Mesh(e,t);i.position.copy(a.toPosition3d);const s=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:65280}));s.position.copy(a.textPosition3d),this._scene.add(n),this._scene.add(i),this._scene.add(s)}}this._roomlePlannerUiCallback.onUpdateWallDimensions(t)}enableWallDrawing(){if(this._cameraControl instanceof ee){const e=P(this.getBounds(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight);this._cameraControl.zoomToFitBounds(e,!0)}this._drawingEnabled||(this._drawingEnabled=!0,this._scene.add(this._plannerSceneEventHandler.enableWallDrawing()))}disableWallDrawing(){this._drawingEnabled=!1,this._cameraControl.unlock(),this._scene.remove(this._plannerSceneEventHandler.cancelWallDrawing())}escapeDrawing(){this._plannerSceneEventHandler.stopDrawing()}_changeCameraControl(e){super._changeCameraControl(e)}setSceneEvents(e){var t,n;void 0!==e.construction&&(null===(t=this._plannerSceneEventHandler)||void 0===t||t.enableConstructionEvents(e.construction)),void 0!==e.objects&&(null===(n=this._plannerSceneEventHandler)||void 0===n||n.enableObjectEvents(e.objects))}startedDrawing(){this._plannerSceneEventHandler.startDrawing()}stoppedDrawing(){this._plannerSceneEventHandler.stopDrawing()}disableEvents(){super.disableEvents(),this.disablePlannerEvents()}enableEvents(){super.enableEvents(),"planner"===this._configuratorContext.baseContext&&this.enablePlannerEvents()}}i([a],ge.prototype,"_rapiAccess",void 0),i([a],ge.prototype,"_plannerMeshGenerator",void 0),i([a],ge.prototype,"_plannerInputManager",void 0),i([a],ge.prototype,"_roomlePlannerUiCallback",void 0),i([a],ge.prototype,"_localStorageHelper",void 0),i([a],ge.prototype,"_unitFormatter",void 0);const pe={left:0,top:1,right:1,bottom:0};class me{constructor(e){this._hscInstance=null,this._glbInstance=null,this._configurator=null,this._currentMode=1,this._creator_=e,this._kernelAccessCallback.addListener(this)}deleteSelection(){this._sceneManager.deletePlanElementSelection()}rotateSelection(e){this._sceneManager.rotatePlanElementSelection(e)}cancelSelection(){this._sceneManager.cancelPlanElementSelection()}init(e,t,n){return v.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{const i=H(e);(i?this._rapiAccess.getPlanSnapshot(e):this._rapiAccess.getPlan(e)).then(n=>{const a=i?n.plan:n.planObjects;this._plan=this._planInteractionHandler.loadPlanXML(a),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&this._rapiAccess.trackView(e),t(n)},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(D,{id:"gltf-loader"}),n=this._scriptLoader.fetch(L,{id:"draco-loader"}),i=this._scriptLoader.fetch(ne,{id:"tween-js"}),a=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,i,a]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:i,stats:a}=this._initData;this._sceneManager||(this._sceneManager=new ge(this._creator_,pe,this,i)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const s=O.createDynamicLightSettingSource(t,n);a&&this.showStats(),this.enableHD(s),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(e){return new Promise((t,n)=>{const i=()=>{this._sceneManager.enableHD(e),t()};this._threeLoader.fetch().then(()=>Promise.all(ie.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch(ae,{id:"pi-js"}).then(i,n)},n)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){v.showBenchmarks()}getConfiguratorApi(){return this._configurator||(this._configurator=new X(this._creator_),this._configurator.setOverrides(this._initData),this._configurator.initSceneManager(this._sceneManager)),this._configurator}startViewing(){this._sceneManager.startViewing()}startConfiguring(){var e,t;this._sceneManager.startConfiguring();const n=this._sceneManager.currentSelection,i=(null===(e=n.item)||void 0===e?void 0:e.id)||(null===(t=n.configuration)||void 0===t?void 0:t.id);i&&this._configurator.notifyUiAboutNewLabel(i)}async selectPlanObjectById(e){return this._sceneManager.selectPlanObject(e)}backToPlanner(){this._sceneManager.backToPlanner()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-3efc569e.legacy.js").then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().initSceneManager(this._sceneManager),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._currentMode=0,this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-2467aa45.legacy.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._currentMode=2,this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._currentMode=1}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(2===this._currentMode&&this._glbInstance&&this._glbInstance.getApi().clearScene(),0===this._currentMode&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._currentMode=1}backTo(e){console.error("backTo in planner Needs to be implemented later")}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");t&&(t=s(new THREE.Vector3(t.x,t.y,t.z)));const i=await(y(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),a=await this._plannerKernelAccess.addPlanObjectFromItem(i,t,n);return this._sceneManager.updateScene(),a}async insertItemList(e){const t=e.map(e=>y(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);return await this._plannerKernelAccess.insertItems(n)}async insertItems(e){return await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan),t=m(e.objects);return _e(t,this._plannerKernelAccess,this._rapiAccess)}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return m(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e),i=await this.insertItems([n]);if(1!==i.length)throw new Error("More than one object added, abort");return i[0]}enableSnapping(){this._sceneManager.enableSnapping()}disableSnapping(){this._sceneManager.disableSnapping()}async getPartlistOf(e){const t=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(e);if(!t){const e="Object has no partlist because it is not a configuration: "+t;return console.warn(e),Promise.reject(e)}const n=this._plannerKernelAccess.kernelInstance.getPartList(e);return await this._plannerKernelAccess.addUiDataAndPriceToPartList(n,t)}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}drawWalls(e,t={}){var n,i;const a=this._planInteractionHandler;a.startInteraction();const s=[];for(const t of e){const e=a.addNode(t.from),r=a.addNode(t.to),o=a.addWall(e,r);void 0!==(null===(n=t.props)||void 0===n?void 0:n.height)&&a.setWallHeight(o,t.props.height),void 0!==(null===(i=t.props)||void 0===i?void 0:i.thickness)&&a.setWallThickness(o,t.props.thickness),s.push(o)}return t.keepInteractionOpen||a.endInteraction(),this._sceneManager.updateCameraOnDrawWalls(),this._sceneManager.updateScene(),s}async removeElements(e,t={}){const n=this._planInteractionHandler;n.startInteraction();for(const t of e){const e=de(this._plannerKernelAccess,m(t).getId());let n;e&&(n=await _e([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(w.REMOVED,n?n[0]:null),this._planInteractionHandler.removeElement(t)}t.keepInteractionOpen||n.endInteraction()}hasWalls(){const e=this._planInteractionHandler,t=null==e?void 0:e.getPlan();return!(!t||t.getWallCount()<1)}enableWallDrawing(){this._sceneManager.enableWallDrawing()}disableWallDrawing(){this._sceneManager.disableWallDrawing()}getUnitFormatter(){return this._unitFormatter}get PlannerCoreTypes(){return this._plannerKernelAccess.kernelContainer}setSceneEvents(e){this._sceneManager.setSceneEvents(e)}async saveCurrentPlanSnapshot(e){const t=await this.getPlanModelViewHelper(),n=this._planInteractionHandler.getPlan(),i=t.getPlanOverview(n),a={parentId:e||null,planObjects:[],combinedIds:[],plan:n.getPlanXML(!1,2)},s=i.objects,r=s.size();for(let e=0;e<r;e++){const t=s.get(e),n=t.configurationHash||t.catalogItemId,{center:i,dimensions:r,rotation:o}=t,l=JSON.stringify({center:i,dimensions:r,rotation:o});a.planObjects.push({combinedId:n,location:l})}const o=await this._rapiAccess.savePlanSnapshot(a),l=new Promise((e,t)=>{let n=null,i=null;this.preparePerspectiveImage().then(a=>this._rapiAccess.savePlanSnapshotPerspectiveImage(o,a).then(t=>{n=t,i&&(t.topImage=i.topImage,e(t))},t),t),this.prepareTopImage().then(a=>this._rapiAccess.savePlanSnapshotTopImage(o,a).then(t=>{i=t,n&&(t.perspectiveImage=i.perspectiveImage,e(t))},t),t)});try{return await l}catch(e){return console.error(e),o}}getPlanXmlFrom(e){return e?H(e.id)?e.plan:e.planObjects:null}}i([a],me.prototype,"_domHelper",void 0),i([a],me.prototype,"_scriptLoader",void 0),i([a],me.prototype,"_kernelAccessCallback",void 0),i([a],me.prototype,"_plannerKernelAccess",void 0),i([a],me.prototype,"_rapiAccess",void 0),i([a],me.prototype,"_singlePromiseFactory",void 0),i([a],me.prototype,"_roomlePlannerUiCallback",void 0),i([a],me.prototype,"_lifeCycleManager",void 0),i([a],me.prototype,"_threeLoader",void 0),i([a],me.prototype,"_dataSyncer",void 0),i([a],me.prototype,"_initData",void 0),i([a],me.prototype,"_globalInitData",void 0),i([a],me.prototype,"_unitFormatter",void 0);class ue{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const we=[new V("script-loader",se),new V("planner-input-manager",class extends A{_canDrag(e){return!0}},1),new V("logger",T),new V("planner-mesh-generator",R),new V("rapi-access",j),new V("planner-selection-handler",class extends k{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new ue({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),e.deselect(),void this.dispatchEvent(1,new ue({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new ue({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(0,new ue({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),e.deselect(),void this.dispatchEvent(1,new ue({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(0,new ue({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends re{setupGlobals(){}setupDependencies(){x.setup(we),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context).init(0)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new me(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
|
|
2
|
+
//# sourceMappingURL=planner-6f12af94.legacy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-
|
|
1
|
+
{"version":3,"file":"planner-6f12af94.legacy.js","sources":["../../../node_modules/three/examples/js/objects/Sky.js"],"sourcesContent":["export default \"static/Sky-6621935ea8a523af.js\""],"names":[],"mappings":"os6CAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-
|
|
1
|
+
System.register(["./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-41f249eb.legacy.js","./main-thread-to-worker-876e61ea.legacy.js","./roomle-configurator-ee16043c.legacy.js","./planner-6f12af94.legacy.js","./pixotron-c4a9ead0.legacy.js","./script-loader-e0ee81af.legacy.js","./default-light-setting-9d4422ab.legacy.js"],(function(){var e;return{setters:[function(){},function(){},function(){},function(){},function(n){e=n.Planner},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
|
|
2
2
|
//# sourceMappingURL=planner-main.legacy.js.map
|