@roomle/web-sdk 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{banana-for-scale-2c3d2d66.nomodule.js → banana-for-scale-42de697a.nomodule.js} +2 -2
- package/lib/{banana-for-scale-2c3d2d66.nomodule.js.map → banana-for-scale-42de697a.nomodule.js.map} +1 -1
- package/lib/{banana-for-scale-b4820033.js → banana-for-scale-b84603f2.js} +2 -2
- package/lib/{banana-for-scale-b4820033.js.map → banana-for-scale-b84603f2.js.map} +1 -1
- package/lib/{budgeteer-measure-4cffd344.js → budgeteer-measure-05dc445d.js} +2 -2
- package/lib/{budgeteer-measure-4cffd344.js.map → budgeteer-measure-05dc445d.js.map} +1 -1
- package/lib/budgeteer-measure.nomodule.js +1 -1
- package/lib/{component-dimensioning-bf032e70.js → component-dimensioning-93634fec.js} +2 -2
- package/lib/component-dimensioning-93634fec.js.map +1 -0
- package/lib/{component-dimensioning-7d6fcd93.nomodule.js → component-dimensioning-c0ac56ff.nomodule.js} +2 -2
- package/lib/component-dimensioning-c0ac56ff.nomodule.js.map +1 -0
- package/lib/configurator-7e58ca7c.js +2 -0
- package/lib/{configurator-e4ba2c2c.js.map → configurator-7e58ca7c.js.map} +1 -1
- package/lib/configurator-c125c3c8.nomodule.js +2 -0
- package/lib/{configurator-202956f4.nomodule.js.map → configurator-c125c3c8.nomodule.js.map} +1 -1
- package/lib/configurator-main-da006b54.js +2 -0
- package/lib/configurator-main-da006b54.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{configurator-mesh-generator-6381a017.nomodule.js → configurator-mesh-generator-2f342c08.nomodule.js} +2 -2
- package/lib/configurator-mesh-generator-2f342c08.nomodule.js.map +1 -0
- package/lib/{configurator-mesh-generator-e0559b97.js → configurator-mesh-generator-b3fb022a.js} +2 -2
- package/lib/configurator-mesh-generator-b3fb022a.js.map +1 -0
- package/lib/{default-light-setting-269087a3.nomodule.js → default-light-setting-2218084f.nomodule.js} +2 -2
- package/lib/default-light-setting-2218084f.nomodule.js.map +1 -0
- package/lib/{default-light-setting-4c54f308.js → default-light-setting-dbb59ba5.js} +2 -2
- package/lib/default-light-setting-dbb59ba5.js.map +1 -0
- package/lib/definitions/common-core/__tests__/{feature-detection.d.ts → utils/rapi-utils.d.ts} +0 -0
- package/lib/definitions/common-core/mock/kernel-instances.d.ts +1 -0
- package/lib/definitions/common-core/src/common-configurator-kernel-callback.d.ts +2 -2
- package/lib/definitions/common-core/src/services/common-kernel-access.d.ts +2 -2
- package/lib/definitions/common-core/src/utils/feature-detection.d.ts +0 -1
- package/lib/definitions/common-core/src/utils/rapi-utils.d.ts +4 -0
- package/lib/definitions/common-core/src/view-model/configurator-view-model.d.ts +2 -2
- package/lib/definitions/common-core/src/webgl/scene-manager.d.ts +12 -1
- package/lib/definitions/planner-core/src/roomle-planner.d.ts +8 -0
- package/lib/definitions/typings/kernel.d.ts +1 -0
- package/lib/{dimensioning-helper-36169ebe.js → dimensioning-helper-1047e166.js} +2 -2
- package/lib/dimensioning-helper-1047e166.js.map +1 -0
- package/lib/{dimensioning-helper-e6459147.nomodule.js → dimensioning-helper-e5a1f92b.nomodule.js} +2 -2
- package/lib/dimensioning-helper-e5a1f92b.nomodule.js.map +1 -0
- package/lib/{glb-viewer-1455d26c.js → glb-viewer-58c75d10.js} +2 -2
- package/lib/{glb-viewer-1455d26c.js.map → glb-viewer-58c75d10.js.map} +1 -1
- package/lib/{glb-viewer-c1eff647.nomodule.js → glb-viewer-b176add0.nomodule.js} +2 -2
- package/lib/{glb-viewer-c1eff647.nomodule.js.map → glb-viewer-b176add0.nomodule.js.map} +1 -1
- package/lib/glb-viewer-main-fd9ff00c.js +2 -0
- package/lib/glb-viewer-main-fd9ff00c.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/image-renderer-7e5f1199.js +2 -0
- package/lib/{image-renderer-eccb80a5.js.map → image-renderer-7e5f1199.js.map} +1 -1
- package/lib/image-renderer-cfd9ed49.nomodule.js +2 -0
- package/lib/{image-renderer-dd3a3b56.nomodule.js.map → image-renderer-cfd9ed49.nomodule.js.map} +1 -1
- package/lib/legacy/banana-for-scale-346de2e4.legacy.js +2 -0
- package/lib/legacy/{banana-for-scale-d9fdb6d4.legacy.js.map → banana-for-scale-346de2e4.legacy.js.map} +1 -1
- package/lib/legacy/budgeteer-measure.legacy.js +1 -1
- package/lib/legacy/{component-dimensioning-104a6bc1.legacy.js → component-dimensioning-629f2f3a.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-629f2f3a.legacy.js.map +1 -0
- package/lib/legacy/configurator-44d35a54.legacy.js +2 -0
- package/lib/legacy/{configurator-6b788202.legacy.js.map → configurator-44d35a54.legacy.js.map} +1 -1
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/configurator-mesh-generator-aeaab699.legacy.js +2 -0
- package/lib/legacy/configurator-mesh-generator-aeaab699.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-78b9795d.legacy.js → default-light-setting-fbdf535e.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-fbdf535e.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-aa9f32c4.legacy.js → dimensioning-helper-6a7e8c77.legacy.js} +2 -2
- package/lib/legacy/dimensioning-helper-6a7e8c77.legacy.js.map +1 -0
- package/lib/legacy/{glb-viewer-47215461.legacy.js → glb-viewer-d5a57e08.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-47215461.legacy.js.map → glb-viewer-d5a57e08.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/image-renderer-49deaae2.legacy.js +2 -0
- package/lib/legacy/{image-renderer-50475591.legacy.js.map → image-renderer-49deaae2.legacy.js.map} +1 -1
- package/lib/legacy/{main-thread-to-worker-66323030.legacy.js → main-thread-to-worker-880d5b78.legacy.js} +2 -2
- package/lib/legacy/main-thread-to-worker-880d5b78.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-2e21a4f7.legacy.js +2 -0
- package/lib/legacy/material-viewer-2e21a4f7.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/mesh-generator-a9938ee3.legacy.js +2 -0
- package/lib/legacy/mesh-generator-a9938ee3.legacy.js.map +1 -0
- package/lib/legacy/{pixotron-e22efd52.legacy.js → pixotron-0b1d662e.legacy.js} +2 -2
- package/lib/legacy/{pixotron-e22efd52.legacy.js.map → pixotron-0b1d662e.legacy.js.map} +1 -1
- package/lib/legacy/planner-e6a2af12.legacy.js +2 -0
- package/lib/legacy/{planner-4e739fba.legacy.js.map → planner-e6a2af12.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/rapi-access-9e79a6ed.legacy.js +16 -0
- package/lib/legacy/{rapi-access-41e0190e.legacy.js.map → rapi-access-9e79a6ed.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/scene-manager-e16780a8.legacy.js +2 -0
- package/lib/legacy/scene-manager-e16780a8.legacy.js.map +1 -0
- package/lib/legacy/static/ConfiguratorKernel-7824c66aefcb2b41.js +137 -0
- package/lib/legacy/static/ConfiguratorKernel-c4705c3beab2c75c.wasm +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-66c44fdd795cfb97.mem +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-dd4ecf875e7d0682.js +185 -0
- package/lib/legacy/static/RoomleCore-6f789e05759fd700.wasm +0 -0
- package/lib/legacy/static/RoomleCore-7bc4605b421746fa.js +150 -0
- package/lib/legacy/static/RoomleCoreJs-208bd06646f38679.mem +0 -0
- package/lib/legacy/static/RoomleCoreJs-344db042f996462a.js +199 -0
- package/lib/legacy/static/shaders-3d797579ff9c12c0.json +1 -0
- package/lib/legacy/{stats-helper-5a5aa20f.legacy.js → stats-helper-b0faba70.legacy.js} +2 -2
- package/lib/legacy/{stats-helper-5a5aa20f.legacy.js.map → stats-helper-b0faba70.legacy.js.map} +1 -1
- package/lib/{main-thread-to-worker-3b2ebd37.js → main-thread-to-worker-91bf9f5e.js} +2 -2
- package/lib/main-thread-to-worker-91bf9f5e.js.map +1 -0
- package/lib/{main-thread-to-worker-35970716.nomodule.js → main-thread-to-worker-bb844d54.nomodule.js} +2 -2
- package/lib/main-thread-to-worker-bb844d54.nomodule.js.map +1 -0
- package/lib/material-viewer-4e03269a.nomodule.js +2 -0
- package/lib/material-viewer-4e03269a.nomodule.js.map +1 -0
- package/lib/material-viewer-f16c52e4.js +2 -0
- package/lib/material-viewer-f16c52e4.js.map +1 -0
- package/lib/material-viewer-main-3b415873.js +2 -0
- package/lib/material-viewer-main-3b415873.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/mesh-generator-64203565.nomodule.js +2 -0
- package/lib/mesh-generator-64203565.nomodule.js.map +1 -0
- package/lib/mesh-generator-c4f97fdc.js +2 -0
- package/lib/mesh-generator-c4f97fdc.js.map +1 -0
- package/lib/{pixotron-17562920.nomodule.js → pixotron-358442c5.nomodule.js} +2 -2
- package/lib/{pixotron-17562920.nomodule.js.map → pixotron-358442c5.nomodule.js.map} +1 -1
- package/lib/{pixotron-75c414e7.js → pixotron-5bb3aafe.js} +2 -2
- package/lib/{pixotron-75c414e7.js.map → pixotron-5bb3aafe.js.map} +1 -1
- package/lib/planner-be62add0.js +2 -0
- package/lib/{planner-981b523b.js.map → planner-be62add0.js.map} +1 -1
- package/lib/planner-eedd4bfc.nomodule.js +2 -0
- package/lib/{planner-d2b5e345.nomodule.js.map → planner-eedd4bfc.nomodule.js.map} +1 -1
- package/lib/planner-main-5b5f72b3.js +2 -0
- package/lib/planner-main-5b5f72b3.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/rapi-access-74fbaf72.nomodule.js +16 -0
- package/lib/{rapi-access-339cccf6.nomodule.js.map → rapi-access-74fbaf72.nomodule.js.map} +1 -1
- package/lib/rapi-access-f8222879.js +16 -0
- package/lib/{rapi-access-56a3e030.js.map → rapi-access-f8222879.js.map} +1 -1
- package/lib/{roomle-sdk-d699b12b.js → roomle-sdk-9ba1a888.js} +2 -2
- package/lib/roomle-sdk-9ba1a888.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/scene-manager-4637ed82.js +2 -0
- package/lib/scene-manager-4637ed82.js.map +1 -0
- package/lib/scene-manager-86fe8139.nomodule.js +2 -0
- package/lib/scene-manager-86fe8139.nomodule.js.map +1 -0
- package/lib/static/ConfiguratorKernel-7824c66aefcb2b41.js +1 -0
- package/lib/static/ConfiguratorKernel-7824c66aefcb2b41.js.map +1 -0
- package/lib/static/ConfiguratorKernel-c4705c3beab2c75c.wasm +0 -0
- package/lib/static/ConfiguratorKernelJs-66c44fdd795cfb97.mem +0 -0
- package/lib/static/ConfiguratorKernelJs-dd4ecf875e7d0682.js +185 -0
- package/lib/static/RoomleCore-6f789e05759fd700.wasm +0 -0
- package/lib/static/RoomleCore-7bc4605b421746fa.js +1 -0
- package/lib/static/RoomleCore-7bc4605b421746fa.js.map +1 -0
- package/lib/static/RoomleCoreJs-208bd06646f38679.mem +0 -0
- package/lib/static/RoomleCoreJs-344db042f996462a.js +199 -0
- package/lib/static/shaders-3d797579ff9c12c0.json +1 -0
- package/lib/{stats-helper-aafa9349.js → stats-helper-1547b5d7.js} +2 -2
- package/lib/{stats-helper-aafa9349.js.map → stats-helper-1547b5d7.js.map} +1 -1
- package/lib/{stats-helper-ba55aea5.nomodule.js → stats-helper-4de133a6.nomodule.js} +2 -2
- package/lib/{stats-helper-ba55aea5.nomodule.js.map → stats-helper-4de133a6.nomodule.js.map} +1 -1
- package/package.json +2 -2
- package/lib/component-dimensioning-7d6fcd93.nomodule.js.map +0 -1
- package/lib/component-dimensioning-bf032e70.js.map +0 -1
- package/lib/configurator-202956f4.nomodule.js +0 -2
- package/lib/configurator-e4ba2c2c.js +0 -2
- package/lib/configurator-main-fda99924.js +0 -2
- package/lib/configurator-main-fda99924.js.map +0 -1
- package/lib/configurator-mesh-generator-6381a017.nomodule.js.map +0 -1
- package/lib/configurator-mesh-generator-e0559b97.js.map +0 -1
- package/lib/default-light-setting-269087a3.nomodule.js.map +0 -1
- package/lib/default-light-setting-4c54f308.js.map +0 -1
- package/lib/dimensioning-helper-36169ebe.js.map +0 -1
- package/lib/dimensioning-helper-e6459147.nomodule.js.map +0 -1
- package/lib/glb-viewer-main-51f2e92b.js +0 -2
- package/lib/glb-viewer-main-51f2e92b.js.map +0 -1
- package/lib/image-renderer-dd3a3b56.nomodule.js +0 -2
- package/lib/image-renderer-eccb80a5.js +0 -2
- package/lib/legacy/banana-for-scale-d9fdb6d4.legacy.js +0 -2
- package/lib/legacy/component-dimensioning-104a6bc1.legacy.js.map +0 -1
- package/lib/legacy/configurator-6b788202.legacy.js +0 -2
- package/lib/legacy/configurator-mesh-generator-7731c94d.legacy.js +0 -2
- package/lib/legacy/configurator-mesh-generator-7731c94d.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-78b9795d.legacy.js.map +0 -1
- package/lib/legacy/dimensioning-helper-aa9f32c4.legacy.js.map +0 -1
- package/lib/legacy/image-renderer-50475591.legacy.js +0 -2
- package/lib/legacy/main-thread-to-worker-66323030.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-af50b7e7.legacy.js +0 -2
- package/lib/legacy/material-viewer-af50b7e7.legacy.js.map +0 -1
- package/lib/legacy/mesh-generator-8b81c1d2.legacy.js +0 -2
- package/lib/legacy/mesh-generator-8b81c1d2.legacy.js.map +0 -1
- package/lib/legacy/planner-4e739fba.legacy.js +0 -2
- package/lib/legacy/rapi-access-41e0190e.legacy.js +0 -16
- package/lib/legacy/scene-manager-7cc3251b.legacy.js +0 -2
- package/lib/legacy/scene-manager-7cc3251b.legacy.js.map +0 -1
- package/lib/legacy/static/ConfiguratorKernel-1b88030d6265aaff.js +0 -136
- package/lib/legacy/static/ConfiguratorKernel-c48bba1fe04aa93a.wasm +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-4dd1f28084d19b35.mem +0 -0
- package/lib/legacy/static/ConfiguratorKernelJs-af670baec2bbb83d.js +0 -185
- package/lib/legacy/static/RoomleCore-88de0e9427c61a4d.js +0 -149
- package/lib/legacy/static/RoomleCore-ea9beee28ea41195.wasm +0 -0
- package/lib/legacy/static/RoomleCoreJs-d698db3fbb66f567.mem +0 -0
- package/lib/legacy/static/RoomleCoreJs-f7aef02e52c95b45.js +0 -199
- package/lib/legacy/static/shaders-4fdbe00cbb7bfae5.json +0 -1
- package/lib/main-thread-to-worker-35970716.nomodule.js.map +0 -1
- package/lib/main-thread-to-worker-3b2ebd37.js.map +0 -1
- package/lib/material-viewer-6f991267.nomodule.js +0 -2
- package/lib/material-viewer-6f991267.nomodule.js.map +0 -1
- package/lib/material-viewer-f802d3e5.js +0 -2
- package/lib/material-viewer-f802d3e5.js.map +0 -1
- package/lib/material-viewer-main-fca4f2f8.js +0 -2
- package/lib/material-viewer-main-fca4f2f8.js.map +0 -1
- package/lib/mesh-generator-8cab5eb7.js +0 -2
- package/lib/mesh-generator-8cab5eb7.js.map +0 -1
- package/lib/mesh-generator-a0bc20a3.nomodule.js +0 -2
- package/lib/mesh-generator-a0bc20a3.nomodule.js.map +0 -1
- package/lib/planner-981b523b.js +0 -2
- package/lib/planner-d2b5e345.nomodule.js +0 -2
- package/lib/planner-main-8a934141.js +0 -2
- package/lib/planner-main-8a934141.js.map +0 -1
- package/lib/rapi-access-339cccf6.nomodule.js +0 -16
- package/lib/rapi-access-56a3e030.js +0 -16
- package/lib/roomle-sdk-d699b12b.js.map +0 -1
- package/lib/scene-manager-7cd0736c.nomodule.js +0 -2
- package/lib/scene-manager-7cd0736c.nomodule.js.map +0 -1
- package/lib/scene-manager-c953c6c0.js +0 -2
- package/lib/scene-manager-c953c6c0.js.map +0 -1
- package/lib/static/ConfiguratorKernel-1b88030d6265aaff.js +0 -1
- package/lib/static/ConfiguratorKernel-1b88030d6265aaff.js.map +0 -1
- package/lib/static/ConfiguratorKernel-c48bba1fe04aa93a.wasm +0 -0
- package/lib/static/ConfiguratorKernelJs-4dd1f28084d19b35.mem +0 -0
- package/lib/static/ConfiguratorKernelJs-af670baec2bbb83d.js +0 -185
- package/lib/static/RoomleCore-88de0e9427c61a4d.js +0 -1
- package/lib/static/RoomleCore-88de0e9427c61a4d.js.map +0 -1
- package/lib/static/RoomleCore-ea9beee28ea41195.wasm +0 -0
- package/lib/static/RoomleCoreJs-d698db3fbb66f567.mem +0 -0
- package/lib/static/RoomleCoreJs-f7aef02e52c95b45.js +0 -199
- package/lib/static/shaders-4fdbe00cbb7bfae5.json +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./rapi-access-339cccf6.nomodule.js","./main-thread-to-worker-35970716.nomodule.js","./pixotron-17562920.nomodule.js","./default-light-setting-269087a3.nomodule.js"],(function(e){var t,n,r,i,o,a,s,l,c,d,h,u,_,p,g,b,m,E,f,C,R,y,j,w,P,O,H,M;return{setters:[function(e){t=e.V,n=e.J,r=e.W,i=e.e,o=e.X,a=e.O,s=e.Y,l=e.Q,c=e.Z,d=e.$,h=e._,u=e.i,_=e.a0,p=e.C,g=e.B,b=e.E,m=e.M,E=e.a1,f=e.s,C=e.j,R=e.a2,y=e.a3,j=e.t,w=e.h},function(e){P=e.k},function(e){O=e.E,H=e.L},function(e){M=e.D}],execute:function(){e("G","static/GLTFExporter-86edae059df3a219.js");class x{constructor(){this._promiseExecutors=[]}create(){return new Promise((e,t)=>{this._promiseExecutors.push({resolve:e,reject:t})})}resolve(e){return new Promise(t=>{this._promiseExecutors.forEach(t=>t.resolve(e)),this._promiseExecutors=[],t(e)})}reject(e){return new Promise((t,n)=>{this._promiseExecutors.forEach(t=>t.reject(e)),this._promiseExecutors=[],n(e)})}}class v extends class{constructor(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getKernelObject(){return this._coreReference}}{constructor(e){super(e),this._objectWaiter=new x;const r=t(e.getCenter());this._container=new THREE.Object3D,this._container.position.copy(r),this._boundingBox=this._generateBoundingBox(this.getSize(),e.customColor),n(this._boundingBox),this._container.add(this._boundingBox),2!==this.getPlanElement().getType().value&&(this._object=new THREE.Object3D,this._container.add(this._object))}getSize(){return this._object?(new THREE.Box3).setFromObject(this._object).getSize(new THREE.Vector3):new THREE.Vector3}update(){this._container.position.copy(t(this.getPlanElement().getCenter()))}getPosition(){return this._container.position}getRotation(){return this._container.rotation.y}getBounds(){let e=new THREE.Box3;return e.setFromObject(this._container),e}getBoundingBox(){return this._boundingBox}getPlanElement(){return this._coreReference}setObject(e){this._object=e,this._objectWaiter.resolve(e)}getObject(){return this._object}async getObjectAsync(){return this._object?Promise.resolve(this._object):this._objectWaiter.create()}addMesh(e){this._object.add(e),this.hidePreviewBox()}getMesh(e){if(!this._object||0===this._object.children.length)return null;const t=r(e,this.getPlanElement().getType());return this._object.children.find(e=>e.userData.material===t)}getContainer(){return this._container}getId(){return this.getPlanElement().getId()}clear(){i(this._container),this._selectionMesh&&i(this._selectionMesh)}hidePreviewBox(){this._container&&this._boundingBox&&(this._boundingBox.material=o())}_generateBoundingBox(e,t){e.addScalar(.01);let n=new THREE.BoxGeometry(e.x,e.y,e.z),r=new THREE.Color(a);t>0&&(r=s(t));let i=new THREE.MeshStandardMaterial({color:r,opacity:l,transparent:!0}),o=new THREE.Mesh(n,i);return o.name="bounding box",o.position.y=e.y/2,o.castShadow=!1,o.receiveShadow=!1,o.layers.set(5),o}select(){if(!this._selectionMesh){let e=new THREE.MeshStandardMaterial({color:this._primaryColor,opacity:l,transparent:!0});const n=t(this.getPlanElement().getCenter());this._selectionMesh=new THREE.Mesh(c(n,this.getSize()),e)}this._container.add(this._selectionMesh)}deselect(){this._selectionMesh&&this._container.remove(this._selectionMesh)}setPrimaryColor(e){this._primaryColor=e}}class T extends v{constructor(e){super(e),this._container.rotation.y=e.rotation}getPlanObject(){return this.getPlanElement()}getSize(){return d(this.getPlanObject().size)}update(){super.update(),this._container.rotation.y=this.getPlanObject().rotation}}class I extends T{constructor(e){super(e),this._container.name="Configurable "+this._container.name}addRootComponent(e){this.setObject(e),this._container.add(this.getObject())}getConfigurationRuntimeId(){return this.getPlanObject().getConfigurationRuntimeId()}}e("C",I);let k=e("b",(()=>{class e extends T{constructor(e){super(e),this._container.name="Static "+this._container.name}setRapiItem(e){return this._addStaticItem(e)}_addStaticItem(e){this._rapiItem=e;let t=this.getPlanObject();this._glbUrl=P(e);let r=e.scaleable?d(t.size):void 0,i=new THREE.Vector3(1,1,1);return t.flipX&&(i.x*=-1),t.flipY&&(i.z*=-1),new Promise(o=>{this._staticItemLoader.loadGLB(this._glbUrl,void 0,void 0,r,i,t.customColor,e.colorable).then(t=>{t.name=e.label,this.setObject(t),_(t,this._glbUrl),n(t),this._container.add(this.getObject()),this.hidePreviewBox(),o()})})}getRapiItem(){return this._rapiItem}needsRapiItem(){return!this._glbUrl}getGLBUrl(){return this._glbUrl}}return h([u],e.prototype,"_staticItemLoader",void 0),e})());class L extends v{constructor(e){super(e),this._container.name="Wall Plan Element"}addMesh(e){super.addMesh(e);const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,t.y,t.z),this._boundingBox.position.y=t.y/2}}class D extends v{constructor(e){super(e),this._container.name="Floor Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}class S extends v{constructor(e){super(e),this._container.name="Ceiling Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}let B=e("P",(()=>{class e extends p{constructor(e){super(e,0),this._plannerKernelCallbackListener=new Set,g.addMeta("kernel_is_ready",{isWasm:this._useWASM}),this._scriptLoader.fetch(this._kernelPath,{id:"kernel"}).then(this._loadSuccess.bind(this),this._loadError.bind(this))}get kernelContainer(){return this._kernelContainer}_loadSuccess(){window.RoomleCore(this._kernelContainer)}_loadError(){console.error("kernel load error")}_createPlanInteractionHandler(){const e=this._kernelContainer;this._planInteractionHandler=new e.PlanInteractionHandler,this._planInteractionHandler.init(this._planInteractionHandler,1,100,!0,!0,e.DrawingType.CLICK_PER_CLICK),this._roomlePlannerUiCallback.onPlanInteractionHandlerCreated(this._planInteractionHandler)}addPlannerListener(e){this._plannerKernelCallbackListener.add(e)}removePlannerListener(e){this._plannerKernelCallbackListener.delete(e)}isReady(){super.isReady(),this.registerCallbacks(),this._roomlePlannerUiCallback.onPlannerKernelIsReady(this._kernelContainer),this._createPlanInteractionHandler();const e=this._planInteractionHandler.getConfiguratorKernel();this._kernelInstance=e,this._roomlePlannerUiCallback.onConfiguratorKernelIsReady(this._kernelContainer,e),b.isProduction||(window.__RML__DEBUG__.ConfiguratorKernel=this._kernelInstance,window.__RML__DEBUG__.PlannerKernelContainer=this._kernelContainer),this._kernelAccessCallback.isReady()}get callbacks(){return this._roomlePlannerUiCallback}get planInteractionHandler(){return this._planInteractionHandler}get planModelViewHelper(){return this._kernelContainer.PlanModelViewHelper}catalogItemLoaded(e){const t=this._rapiItemToKernelItem(e);this._kernelContainer.catalogItemLoaded(t)}async insertItems(e){let t=new this._kernelContainer.CatalogItemPtrList;e.forEach(e=>{let n=e.count||1;for(let r=0;r<n;r++)e.count||(e.count=0),t.push_back(this._rapiItemToKernelItem(e))}),this._planInteractionHandler.addPlanObjects(t);const n=this._planInteractionHandler.getPlan().extRef.jsObject;await Promise.all(n.getStaticPlanObjectViewModels().map(async e=>{if(e.needsRapiItem()){const t=await this._rapiAccess.getItem(e.getPlanObject().getCatalogItemId());e.setRapiItem(t)}}))}_rapiItemToKernelItem(e){let t=new this._kernelContainer.CatalogItem(e.id),n=t.size;return n.x=e.width||0,n.y=e.depth||0,n.z=e.height||0,t.size=n,t.flipable=e.flipable,e.layer&&(t.layer=e.layer),t.orderable=e.orderable,t.scaleable=e.scaleable,t.type=e.type||"other",t.detailType=e.detailType||t.type||"other",t.configuration=e.configuration||"",t}onLoadComponentError(e,t){}configurationLoaded(e,t,n,r,i){}componentDefinitionLoaded(e,t){}componentDefinitionLoadingError(e,t){}configurationLoadingError(){}componentConfigurationUpdated(e){}componentParameters(){}requestComponentDimensions(){}planObjectCreated(e,t){}planObjectUpdated(e){}planObjectConfigurationUpdated(e,t,n){}planObjectDeleted(){}requestPlanObjectDimensions(){}cleanUpCallbacks(){super.cleanUpCallbacks(),this._kernelContainer.unregisterPlannerCallback(this)}registerCallbacks(){super.registerCallbacks(),this._kernelContainer.registerPlannerCallback(this)}async requestExternalMesh(e,t){let n;try{n=await this._rapiAccess.getMesh(e,m,t)}catch(e){throw console.error(e),e}try{const r=await fetch(new Request(this._dataSyncer.requestAsset(n.url,!0))),i=await r.arrayBuffer();await this._handleCortoMesh(i,e,t)}catch(e){throw console.error(e),e}}Editor3dRootComponentCreated(e,t,n,r){this._configuratorKernelCallbackListener.forEach(i=>i.Editor3dComponentCreated(e,t,n,r,!0))}Editor3dPlanObjectConstructionDone(e){}Editor3dBeginGroup(){}Editor3dEndGroup(){}Editor3dSetMaterial(){}Editor3dLoadMaterial(){}Editor3dAddDockPreview(e,t){}Editor3dSetPreviewPointAssociations(e,t){}Editor3dSetPreviewLineAssociations(e,t){}Editor3dPreviewConstructionDone(e,t){}Editor3dTranslateBy(){}Editor3dRotateBy(){}Editor3dRotateAround(){}Editor3dAddCube(){}Editor3dAddCubeUVMod(){}Editor3dAddSphere(){}Editor3dAddSphereUVMod(){}Editor3dAddRectangle(){}Editor3dAddRectangleUVMod(){}Editor3dAddMesh(){}Editor3dAddMeshUVMod(){}Editor3dAddMeshUVCoord(){}Editor3dAddCylinder(){}Editor3dAddCylinderUVMod(){}Editor3dAddPrism(){}Editor3dAddPrismUVMod(){}Editor3dAddFittingPoint(){}Editor3dAddFittingLine(){}Editor3dSelectObject(){}Editor3dCopy(){}Editor3dUpdatePlanObjectPosition(){}Editor3dUpdatePlanObjectRotation(){}Editor3dUpdatePlanObjectTransform(){}Editor3dUpdatePlanComponentPosition(){}Editor3dUpdatePlanComponentRotation(){}Editor3dUpdatePlanComponentTransform(){}planElementRemoved(e){this._plannerKernelCallbackListener.forEach(t=>t.planElementRemoved(e)),this._plannerKernelCallbackListener.forEach(t=>t.removePlanObjectFromScene(e.extRef.jsObject)),this._decoupleReferences(e)}handlerSwitchedPlans(e,t){if(this._decoupleReferences(e),t){let e=new V(this._creator_);e.setReference(t),this._coupleReferences(e,t),this._plannerKernelCallbackListener.forEach(t=>t.handlerSwitchedPlans(e))}}planBoundsChanged(){this._plannerKernelCallbackListener.forEach(e=>e.planBoundsChanged())}planCleared(){}planCompletelyLoaded(e){this._plannerKernelCallbackListener.forEach(t=>t.planCompletelyLoaded(e))}planElement3dMeshChanged(e,t){if(t.extRef){const e=t.extRef.jsObject;for(let t=e.getObject().children.length-1;t>=0;t--)e.getObject().remove(e.getObject().children[t])}this.planModelViewHelper.requestMesh3d(t)}planElementAdded(e,t){if(e&&e.extRef)if(t.getType()===this._kernelContainer.PlanElementType.OBJECT){let n,r=t;r.hasConfiguration()?(n=new I(r),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n)):(n=new k(r),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n)),this._plannerKernelCallbackListener.forEach(e=>e.addPlanObjectToScene(n))}else{let n,r=t;if(t.getType()===this._kernelContainer.PlanElementType.WALL?n=new L(r):t.getType()===this._kernelContainer.PlanElementType.FLOOR?n=new D(r):t.getType()===this._kernelContainer.PlanElementType.CEILING&&(n=new S(r)),!n)return;n.setPrimaryColor(this._initData.colors.PRIMARY),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n),this.planModelViewHelper.requestMesh3d(t)}}planElementChanged(e,t){if(t.extRef){let n=t.extRef.jsObject;n.update(),this._plannerKernelCallbackListener.forEach(t=>t.planElementChanged(e,n))}}planHistoryStateChanged(){}planObjectConfigurationCreated(e,t){}planObjectConfigurationLoaded(e,t,n){e&&e.extRef&&t&&t.extRef&&t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId()>0&&this._plannerKernelCallbackListener.forEach(r=>r.planObjectConfigurationLoaded(e,t,n))}requestCatalogItem(e){}startedDrawing(){}stoppedDrawing(){}updateMesh2d(){}beginConstruction(){}addMesh(e,t,n,r,i,o){this._plannerKernelCallbackListener.forEach(a=>a.addMesh(e,t,n,r,i,o))}endConstruction(){}beginPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.beginPlanConstruction(e))}addPlanMesh(e,t,n,r,i,o,a){this._plannerKernelCallbackListener.forEach(s=>s.addPlanMesh(e,t,n,r,i,o,a))}endPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.endPlanConstruction(e))}addPlanObjectFromItem(e,t,n){if(!t&&!n)return this.insertItems([e]);n=n||0===n?n:0,t=t||{x:0,y:0,z:0};const r=this._rapiItemToKernelItem(e);return this._planInteractionHandler.addPlanObjectFromItem(r,t,n)}_coupleReferences(e,t){let n=new this._kernelContainer.EMSReference;n.jsObject=e,t.extRef=n}_decoupleReferences(e){e&&e.extRef&&(e.extRef.jsObject.clearReference(),e.extRef.jsObject=null,e.extRef.delete(),e.extRef=null)}}return h([u],e.prototype,"_kernelAccessCallback",void 0),h([u],e.prototype,"_roomlePlannerUiCallback",void 0),h([u],e.prototype,"_initData",void 0),e})()),V=(()=>{class e extends E{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionGroup=new THREE.Group,this._constructionGroup.name="Construction",this._ceilingGroup=new THREE.Group,this._getKernelAccess().addPlannerListener(this)}planBoundsChanged(){}_getKernelAccess(){return f.lookup("planner-kernel-access",this._creator_)}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null,super.clearReference()}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof I?this._configurablePlanObjectViewModels.push(e):e instanceof k?(this._staticPlanObjectViewModels.push(e),"door"!==e.getPlanObject().getObjectType()&&"window"!==e.getPlanObject().getObjectType()&&this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof L?(this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),this._constructionGroup.add(e.getContainer())):(e instanceof D||e instanceof S)&&this._constructionGroup.add(e.getContainer())}_addRootComponent(e){const t=this._getPlanObjectViewModelForRuntimeId(e.parentObjectId);t&&t instanceof I&&(t.addRootComponent(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(t),t.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getPlanObjectForId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),this._staticPlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),t}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getBoundingBox(){const e=this.getCorePlan();return e?C(e.getBounds()):(new THREE.Box3).setFromObject(this._constructionGroup)}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}sceneCleared(){this._configurablePlanObjectViewModels.forEach(e=>{e.clear()}),this._staticPlanObjectViewModels.forEach(e=>{e.clear()}),super.sceneCleared()}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getComponent(e){return this._components.get(e)}_generateMesh(e=0,t=null,n,r,i,o,a,s,l){return this._plannerMeshGenerator.generateMesh(t,n,r,i,o,a,s,l)}_setMaterial(e,t,n){this._plannerMeshGenerator.setMaterial(e,t)}Editor3dComponentCreated(e,t,n,r,i){super.Editor3dComponentCreated(e,t,n,r,i),this._getKernelAccess()instanceof B&&this.dockComponent(e,r,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e){this._constructionGroup.clear(),this._ceilingGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,r,i,o,a){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){}addMesh(e,t,n,r,i,o){const a=e.extRef.jsObject;let s=a.getMesh(t);s?s.geometry=this._plannerMeshGenerator.generateGeometry(null,n,r,i,o):(s=this._generateMesh(0,null,t,n,r,i,o,e.getType()),a.addMesh(s))}removePlanObjectFromScene(e){}planElementRemoved(e){if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.OBJECT){let t=e;if(t.hasConfiguration()){const e=t.extRef.jsObject,n=this._configurablePlanObjectViewModels.indexOf(e);n>-1&&this._configurablePlanObjectViewModels.splice(n,1)}else{const e=t.extRef.jsObject,n=this._staticPlanObjectViewModels.indexOf(e);n>-1&&this._staticPlanObjectViewModels.splice(n,1)}}}getMeshGenerator(){return this._plannerMeshGenerator}}return h([u],e.prototype,"_plannerMeshGenerator",void 0),e})();const G=j(30);class A extends O{constructor(e,t,n,r){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===r?1:r,this._scene=e,this._camera=t,this._raycaster=new THREE.Raycaster,this._raycaster.layers.enableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(e){this._raycaster.layers=e}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(6,e=>{this._findHover(e.positionRelative,e.type)},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){this._intersection(e)&&this._inputManager.onElementHit()}_findSelection(e){let t=this._intersection(e);t?t&&t.object.dispatchEvent({type:"select"}):this.dispatchEvent(3)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(e,this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(e,this._camera);let t,n=new THREE.Vector3(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._scene.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t);if(e){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,r=new THREE.Vector3(0,0,0),i=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,r),this._raycaster.ray.intersectPlane(this._planeSide,i);let o,a=this._getDistanceToCamera(i),s=this._getDistanceToCamera(r);return n>=-G&&n<=G?o=t<s?e.clone():r.clone():t<s&&t<a?o=e.clone():s<t&&s<a?o=r.clone():a<t&&a<s&&(o=i.clone()),o}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return R(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new THREE.Vector3).x+e.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(e.getWorldQuaternion(new THREE.Quaternion)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof THREE.Mesh&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&y(this._currentDrag),this._currentHover&&y(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setScene(e){this._scene=e}setMode(e){this._mode=e}}e("S",class extends O{constructor(e,t,n,r){super(),this._debug=!1,this._dragIn=!1,this._inputManager=r,this._raycastHelper=new A(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}});class U extends H{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),1.2),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!1}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=w();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}}}let K=null;const z=()=>(K||(K=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),K.outputEncoding=THREE.sRGBEncoding,K.gammaFactor=2.2),K),F=(e("g",(e,t=0)=>{if(!e){const e=new THREE.Vector3;return{center:e,bounds:e,diagonal:0}}const n=e.getSize(new THREE.Vector3);return n.addScalar(t),{center:e.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}}),e("p",(e,t,n,r={})=>new Promise(i=>{const{size:o=1024}=r,a=z();a.setSize(o,o);const s=e.fog?e.fog.clone():null,l=e.background?e.background.clone():null;e.background=null,e.fog=null;let c=new M(e);t.layers.disable(2),t.layers.disable(5),F(t,n,-20,-30),a.render(e,t);const d=a.domElement.toDataURL();t.layers.enable(2),e.background=l,e.fog=s,c.removeFromScene(),i({image:d,width:o,height:o,blob:null})})),e("r",(e,t,n,r,i,o)=>new Promise(r=>{o||(o=1024);const i=z();i.setSize(o,o);const a=e.fog?e.fog.clone():null,s=e.background?e.background.clone():null;e.background=null,e.fog=null,t.layers.disable(2),t.layers.disable(5),n?F(t,n,-20,-30):(t.aspect=1,t.updateProjectionMatrix()),i.render(e,t);const l=i.domElement.toDataURL();t.layers.enable(2),e.background=s,e.fog=a,r({image:l,width:o,height:o,blob:null})})),(e,t,n,r)=>{e.far=1e3,e.fov=15,e.aspect=1,e.position.copy(t.center),e.rotation.set(0,0,0),e.rotateY(j(r)),e.rotateX(j(n)),e.translateZ(3.8*t.diagonal),e.updateProjectionMatrix()});e("a",(e,t,n,r={})=>{const{showDimensions:i=!1}=r;return new Promise(r=>{const o=z();o.autoClear=!1;let a=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);a.position.copy(n.center),a.rotateX(j(-90)),a.translateZ(n.bounds.y+1),a.far=a.position.y+.5,a.layers.mask=65535;let s=200*n.bounds.x,l=200*n.bounds.z;if(s>4096||l>4096){let e=0;s>4096?e=s/4096:l>4096&&(e=l/4096),s/=e,l/=e}o.setSize(s,l);let c=e.fog?e.fog.clone():null,d=e.background?e.background.clone():null;e.background=null,e.fog=null;let h=i?new U(e):new M(e);a.layers.disable(2),a.layers.disable(5),i?a.layers.enable(7):a.layers.disable(7),o.render(e,a),t&&(o.clearDepth(),o.render(t,a));let u=o.domElement.toDataURL();a.layers.enable(2),a.layers.enable(5),e.background=d,e.fog=c,h.removeFromScene(),r({image:u,width:s,height:l,blob:null})})})}}}));
|
|
2
|
-
//# sourceMappingURL=image-renderer-dd3a3b56.nomodule.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{V as convertToTHREE,J as fadeIn,W as getMaterialId,e as dispose,X as getBoundingBoxMaterial,O as PREVIEW_MATERIAL_COLOR,Y as getColorFromInt,Q as PREVIEW_MATERIAL_OPACITY,Z as getSelectionGeometry,$ as convertToThreeDimensions,_ as __decorate,i as inject,a0 as checkGLB,C as CommonKernelAccess,B as Benchmark,E as Env,M as MESH_DEFAULT_FORMAT,a1 as ConfiguratorViewModel,s as RoomleDependencyInjection,j as kernelBoxToThreeBox,a2 as vectorIsZero,a3 as disposeMesh,t as toRadiant,h as getGUI}from"./rapi-access-56a3e030.js";import{k as getGlbUrl}from"./main-thread-to-worker-3b2ebd37.js";import{E as EventDispatcher,L as LightSetting}from"./pixotron-75c414e7.js";import{D as DefaultLightSetting}from"./default-light-setting-4c54f308.js";var GLTF_EXPORTER_FILE_NAME="static/GLTFExporter-86edae059df3a219.js";class Waiter{constructor(){this._promiseExecutors=[]}create(){return new Promise((e,t)=>{this._promiseExecutors.push({resolve:e,reject:t})})}resolve(e){return new Promise(t=>{this._promiseExecutors.forEach(t=>t.resolve(e)),this._promiseExecutors=[],t(e)})}reject(e){return new Promise((t,n)=>{this._promiseExecutors.forEach(t=>t.reject(e)),this._promiseExecutors=[],n(e)})}}class PlanElementViewModel extends class{constructor(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getKernelObject(){return this._coreReference}}{constructor(e){super(e),this._objectWaiter=new Waiter;const t=convertToTHREE(e.getCenter());this._container=new THREE.Object3D,this._container.position.copy(t),this._boundingBox=this._generateBoundingBox(this.getSize(),e.customColor),fadeIn(this._boundingBox),this._container.add(this._boundingBox),2!==this.getPlanElement().getType().value&&(this._object=new THREE.Object3D,this._container.add(this._object))}getSize(){return this._object?(new THREE.Box3).setFromObject(this._object).getSize(new THREE.Vector3):new THREE.Vector3}update(){this._container.position.copy(convertToTHREE(this.getPlanElement().getCenter()))}getPosition(){return this._container.position}getRotation(){return this._container.rotation.y}getBounds(){let e=new THREE.Box3;return e.setFromObject(this._container),e}getBoundingBox(){return this._boundingBox}getPlanElement(){return this._coreReference}setObject(e){this._object=e,this._objectWaiter.resolve(e)}getObject(){return this._object}async getObjectAsync(){return this._object?Promise.resolve(this._object):this._objectWaiter.create()}addMesh(e){this._object.add(e),this.hidePreviewBox()}getMesh(e){if(!this._object||0===this._object.children.length)return null;const t=getMaterialId(e,this.getPlanElement().getType());return this._object.children.find(e=>e.userData.material===t)}getContainer(){return this._container}getId(){return this.getPlanElement().getId()}clear(){dispose(this._container),this._selectionMesh&&dispose(this._selectionMesh)}hidePreviewBox(){this._container&&this._boundingBox&&(this._boundingBox.material=getBoundingBoxMaterial())}_generateBoundingBox(e,t){e.addScalar(.01);let n=new THREE.BoxGeometry(e.x,e.y,e.z),r=new THREE.Color(PREVIEW_MATERIAL_COLOR);t>0&&(r=getColorFromInt(t));let a=new THREE.MeshStandardMaterial({color:r,opacity:PREVIEW_MATERIAL_OPACITY,transparent:!0}),i=new THREE.Mesh(n,a);return i.name="bounding box",i.position.y=e.y/2,i.castShadow=!1,i.receiveShadow=!1,i.layers.set(5),i}select(){if(!this._selectionMesh){let e=new THREE.MeshStandardMaterial({color:this._primaryColor,opacity:PREVIEW_MATERIAL_OPACITY,transparent:!0});const t=convertToTHREE(this.getPlanElement().getCenter());this._selectionMesh=new THREE.Mesh(getSelectionGeometry(t,this.getSize()),e)}this._container.add(this._selectionMesh)}deselect(){this._selectionMesh&&this._container.remove(this._selectionMesh)}setPrimaryColor(e){this._primaryColor=e}}class PlanObjectViewModel extends PlanElementViewModel{constructor(e){super(e),this._container.rotation.y=e.rotation}getPlanObject(){return this.getPlanElement()}getSize(){return convertToThreeDimensions(this.getPlanObject().size)}update(){super.update(),this._container.rotation.y=this.getPlanObject().rotation}}class ConfiguratorPlanObjectViewModel extends PlanObjectViewModel{constructor(e){super(e),this._container.name="Configurable "+this._container.name}addRootComponent(e){this.setObject(e),this._container.add(this.getObject())}getConfigurationRuntimeId(){return this.getPlanObject().getConfigurationRuntimeId()}}let StaticPlanObjectViewModel=(()=>{class e extends PlanObjectViewModel{constructor(e){super(e),this._container.name="Static "+this._container.name}setRapiItem(e){return this._addStaticItem(e)}_addStaticItem(e){this._rapiItem=e;let t=this.getPlanObject();this._glbUrl=getGlbUrl(e);let n=e.scaleable?convertToThreeDimensions(t.size):void 0,r=new THREE.Vector3(1,1,1);return t.flipX&&(r.x*=-1),t.flipY&&(r.z*=-1),new Promise(a=>{this._staticItemLoader.loadGLB(this._glbUrl,void 0,void 0,n,r,t.customColor,e.colorable).then(t=>{t.name=e.label,this.setObject(t),checkGLB(t,this._glbUrl),fadeIn(t),this._container.add(this.getObject()),this.hidePreviewBox(),a()})})}getRapiItem(){return this._rapiItem}needsRapiItem(){return!this._glbUrl}getGLBUrl(){return this._glbUrl}}return __decorate([inject],e.prototype,"_staticItemLoader",void 0),e})();class WallPlanElementViewModel extends PlanElementViewModel{constructor(e){super(e),this._container.name="Wall Plan Element"}addMesh(e){super.addMesh(e);const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,t.y,t.z),this._boundingBox.position.y=t.y/2}}class FloorPlanElementViewModel extends PlanElementViewModel{constructor(e){super(e),this._container.name="Floor Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}class CeilingPlanElementViewModel extends PlanElementViewModel{constructor(e){super(e),this._container.name="Ceiling Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}let PlannerKernelAccess=(()=>{class e extends CommonKernelAccess{constructor(e){super(e,0),this._plannerKernelCallbackListener=new Set,Benchmark.addMeta("kernel_is_ready",{isWasm:this._useWASM}),this._scriptLoader.fetch(this._kernelPath,{id:"kernel"}).then(this._loadSuccess.bind(this),this._loadError.bind(this))}get kernelContainer(){return this._kernelContainer}_loadSuccess(){window.RoomleCore(this._kernelContainer)}_loadError(){console.error("kernel load error")}_createPlanInteractionHandler(){const e=this._kernelContainer;this._planInteractionHandler=new e.PlanInteractionHandler,this._planInteractionHandler.init(this._planInteractionHandler,1,100,!0,!0,e.DrawingType.CLICK_PER_CLICK),this._roomlePlannerUiCallback.onPlanInteractionHandlerCreated(this._planInteractionHandler)}addPlannerListener(e){this._plannerKernelCallbackListener.add(e)}removePlannerListener(e){this._plannerKernelCallbackListener.delete(e)}isReady(){super.isReady(),this.registerCallbacks(),this._roomlePlannerUiCallback.onPlannerKernelIsReady(this._kernelContainer),this._createPlanInteractionHandler();const e=this._planInteractionHandler.getConfiguratorKernel();this._kernelInstance=e,this._roomlePlannerUiCallback.onConfiguratorKernelIsReady(this._kernelContainer,e),Env.isProduction||(window.__RML__DEBUG__.ConfiguratorKernel=this._kernelInstance,window.__RML__DEBUG__.PlannerKernelContainer=this._kernelContainer),this._kernelAccessCallback.isReady()}get callbacks(){return this._roomlePlannerUiCallback}get planInteractionHandler(){return this._planInteractionHandler}get planModelViewHelper(){return this._kernelContainer.PlanModelViewHelper}catalogItemLoaded(e){const t=this._rapiItemToKernelItem(e);this._kernelContainer.catalogItemLoaded(t)}async insertItems(e){let t=new this._kernelContainer.CatalogItemPtrList;e.forEach(e=>{let n=e.count||1;for(let r=0;r<n;r++)e.count||(e.count=0),t.push_back(this._rapiItemToKernelItem(e))}),this._planInteractionHandler.addPlanObjects(t);const n=this._planInteractionHandler.getPlan().extRef.jsObject;await Promise.all(n.getStaticPlanObjectViewModels().map(async e=>{if(e.needsRapiItem()){const t=await this._rapiAccess.getItem(e.getPlanObject().getCatalogItemId());e.setRapiItem(t)}}))}_rapiItemToKernelItem(e){let t=new this._kernelContainer.CatalogItem(e.id),n=t.size;return n.x=e.width||0,n.y=e.depth||0,n.z=e.height||0,t.size=n,t.flipable=e.flipable,e.layer&&(t.layer=e.layer),t.orderable=e.orderable,t.scaleable=e.scaleable,t.type=e.type||"other",t.detailType=e.detailType||t.type||"other",t.configuration=e.configuration||"",t}onLoadComponentError(e,t){}configurationLoaded(e,t,n,r,a){}componentDefinitionLoaded(e,t){}componentDefinitionLoadingError(e,t){}configurationLoadingError(){}componentConfigurationUpdated(e){}componentParameters(){}requestComponentDimensions(){}planObjectCreated(e,t){}planObjectUpdated(e){}planObjectConfigurationUpdated(e,t,n){}planObjectDeleted(){}requestPlanObjectDimensions(){}cleanUpCallbacks(){super.cleanUpCallbacks(),this._kernelContainer.unregisterPlannerCallback(this)}registerCallbacks(){super.registerCallbacks(),this._kernelContainer.registerPlannerCallback(this)}async requestExternalMesh(e,t){let n;try{n=await this._rapiAccess.getMesh(e,MESH_DEFAULT_FORMAT,t)}catch(e){throw console.error(e),e}try{const r=await fetch(new Request(this._dataSyncer.requestAsset(n.url,!0))),a=await r.arrayBuffer();await this._handleCortoMesh(a,e,t)}catch(e){throw console.error(e),e}}Editor3dRootComponentCreated(e,t,n,r){this._configuratorKernelCallbackListener.forEach(a=>a.Editor3dComponentCreated(e,t,n,r,!0))}Editor3dPlanObjectConstructionDone(e){}Editor3dBeginGroup(){}Editor3dEndGroup(){}Editor3dSetMaterial(){}Editor3dLoadMaterial(){}Editor3dAddDockPreview(e,t){}Editor3dSetPreviewPointAssociations(e,t){}Editor3dSetPreviewLineAssociations(e,t){}Editor3dPreviewConstructionDone(e,t){}Editor3dTranslateBy(){}Editor3dRotateBy(){}Editor3dRotateAround(){}Editor3dAddCube(){}Editor3dAddCubeUVMod(){}Editor3dAddSphere(){}Editor3dAddSphereUVMod(){}Editor3dAddRectangle(){}Editor3dAddRectangleUVMod(){}Editor3dAddMesh(){}Editor3dAddMeshUVMod(){}Editor3dAddMeshUVCoord(){}Editor3dAddCylinder(){}Editor3dAddCylinderUVMod(){}Editor3dAddPrism(){}Editor3dAddPrismUVMod(){}Editor3dAddFittingPoint(){}Editor3dAddFittingLine(){}Editor3dSelectObject(){}Editor3dCopy(){}Editor3dUpdatePlanObjectPosition(){}Editor3dUpdatePlanObjectRotation(){}Editor3dUpdatePlanObjectTransform(){}Editor3dUpdatePlanComponentPosition(){}Editor3dUpdatePlanComponentRotation(){}Editor3dUpdatePlanComponentTransform(){}planElementRemoved(e){this._plannerKernelCallbackListener.forEach(t=>t.planElementRemoved(e)),this._plannerKernelCallbackListener.forEach(t=>t.removePlanObjectFromScene(e.extRef.jsObject)),this._decoupleReferences(e)}handlerSwitchedPlans(e,t){if(this._decoupleReferences(e),t){let e=new PlanViewModel(this._creator_);e.setReference(t),this._coupleReferences(e,t),this._plannerKernelCallbackListener.forEach(t=>t.handlerSwitchedPlans(e))}}planBoundsChanged(){this._plannerKernelCallbackListener.forEach(e=>e.planBoundsChanged())}planCleared(){}planCompletelyLoaded(e){this._plannerKernelCallbackListener.forEach(t=>t.planCompletelyLoaded(e))}planElement3dMeshChanged(e,t){if(t.extRef){const e=t.extRef.jsObject;for(let t=e.getObject().children.length-1;t>=0;t--)e.getObject().remove(e.getObject().children[t])}this.planModelViewHelper.requestMesh3d(t)}planElementAdded(e,t){if(e&&e.extRef)if(t.getType()===this._kernelContainer.PlanElementType.OBJECT){let n,r=t;r.hasConfiguration()?(n=new ConfiguratorPlanObjectViewModel(r),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n)):(n=new StaticPlanObjectViewModel(r),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n)),this._plannerKernelCallbackListener.forEach(e=>e.addPlanObjectToScene(n))}else{let n,r=t;if(t.getType()===this._kernelContainer.PlanElementType.WALL?n=new WallPlanElementViewModel(r):t.getType()===this._kernelContainer.PlanElementType.FLOOR?n=new FloorPlanElementViewModel(r):t.getType()===this._kernelContainer.PlanElementType.CEILING&&(n=new CeilingPlanElementViewModel(r)),!n)return;n.setPrimaryColor(this._initData.colors.PRIMARY),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n),this.planModelViewHelper.requestMesh3d(t)}}planElementChanged(e,t){if(t.extRef){let n=t.extRef.jsObject;n.update(),this._plannerKernelCallbackListener.forEach(t=>t.planElementChanged(e,n))}}planHistoryStateChanged(){}planObjectConfigurationCreated(e,t){}planObjectConfigurationLoaded(e,t,n){e&&e.extRef&&t&&t.extRef&&t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId()>0&&this._plannerKernelCallbackListener.forEach(r=>r.planObjectConfigurationLoaded(e,t,n))}requestCatalogItem(e){}startedDrawing(){}stoppedDrawing(){}updateMesh2d(){}beginConstruction(){}addMesh(e,t,n,r,a,i){this._plannerKernelCallbackListener.forEach(o=>o.addMesh(e,t,n,r,a,i))}endConstruction(){}beginPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.beginPlanConstruction(e))}addPlanMesh(e,t,n,r,a,i,o){this._plannerKernelCallbackListener.forEach(s=>s.addPlanMesh(e,t,n,r,a,i,o))}endPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.endPlanConstruction(e))}addPlanObjectFromItem(e,t,n){if(!t&&!n)return this.insertItems([e]);n=n||0===n?n:0,t=t||{x:0,y:0,z:0};const r=this._rapiItemToKernelItem(e);return this._planInteractionHandler.addPlanObjectFromItem(r,t,n)}_coupleReferences(e,t){let n=new this._kernelContainer.EMSReference;n.jsObject=e,t.extRef=n}_decoupleReferences(e){e&&e.extRef&&(e.extRef.jsObject.clearReference(),e.extRef.jsObject=null,e.extRef.delete(),e.extRef=null)}}return __decorate([inject],e.prototype,"_kernelAccessCallback",void 0),__decorate([inject],e.prototype,"_roomlePlannerUiCallback",void 0),__decorate([inject],e.prototype,"_initData",void 0),e})(),PlanViewModel=(()=>{class e extends ConfiguratorViewModel{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionGroup=new THREE.Group,this._constructionGroup.name="Construction",this._ceilingGroup=new THREE.Group,this._getKernelAccess().addPlannerListener(this)}planBoundsChanged(){}_getKernelAccess(){return RoomleDependencyInjection.lookup("planner-kernel-access",this._creator_)}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null,super.clearReference()}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof ConfiguratorPlanObjectViewModel?this._configurablePlanObjectViewModels.push(e):e instanceof StaticPlanObjectViewModel?(this._staticPlanObjectViewModels.push(e),"door"!==e.getPlanObject().getObjectType()&&"window"!==e.getPlanObject().getObjectType()&&this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof WallPlanElementViewModel?(this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),this._constructionGroup.add(e.getContainer())):(e instanceof FloorPlanElementViewModel||e instanceof CeilingPlanElementViewModel)&&this._constructionGroup.add(e.getContainer())}_addRootComponent(e){const t=this._getPlanObjectViewModelForRuntimeId(e.parentObjectId);t&&t instanceof ConfiguratorPlanObjectViewModel&&(t.addRootComponent(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(t),t.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getPlanObjectForId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),this._staticPlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),t}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getBoundingBox(){const e=this.getCorePlan();return e?kernelBoxToThreeBox(e.getBounds()):(new THREE.Box3).setFromObject(this._constructionGroup)}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}sceneCleared(){this._configurablePlanObjectViewModels.forEach(e=>{e.clear()}),this._staticPlanObjectViewModels.forEach(e=>{e.clear()}),super.sceneCleared()}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getComponent(e){return this._components.get(e)}_generateMesh(e=0,t=null,n,r,a,i,o,s,l){return this._plannerMeshGenerator.generateMesh(t,n,r,a,i,o,s,l)}_setMaterial(e,t,n){this._plannerMeshGenerator.setMaterial(e,t)}Editor3dComponentCreated(e,t,n,r,a){super.Editor3dComponentCreated(e,t,n,r,a),this._getKernelAccess()instanceof PlannerKernelAccess&&this.dockComponent(e,r,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e){this._constructionGroup.clear(),this._ceilingGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,r,a,i,o){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){}addMesh(e,t,n,r,a,i){const o=e.extRef.jsObject;let s=o.getMesh(t);s?s.geometry=this._plannerMeshGenerator.generateGeometry(null,n,r,a,i):(s=this._generateMesh(0,null,t,n,r,a,i,e.getType()),o.addMesh(s))}removePlanObjectFromScene(e){}planElementRemoved(e){if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.OBJECT){let t=e;if(t.hasConfiguration()){const e=t.extRef.jsObject,n=this._configurablePlanObjectViewModels.indexOf(e);n>-1&&this._configurablePlanObjectViewModels.splice(n,1)}else{const e=t.extRef.jsObject,n=this._staticPlanObjectViewModels.indexOf(e);n>-1&&this._staticPlanObjectViewModels.splice(n,1)}}}getMeshGenerator(){return this._plannerMeshGenerator}}return __decorate([inject],e.prototype,"_plannerMeshGenerator",void 0),e})();const ROTATION_TO_DETECT_SIDE=toRadiant(30);class RaycastHelper extends EventDispatcher{constructor(e,t,n,r){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===r?1:r,this._scene=e,this._camera=t,this._raycaster=new THREE.Raycaster,this._raycaster.layers.enableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(e){this._raycaster.layers=e}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(6,e=>{this._findHover(e.positionRelative,e.type)},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){this._intersection(e)&&this._inputManager.onElementHit()}_findSelection(e){let t=this._intersection(e);t?t&&t.object.dispatchEvent({type:"select"}):this.dispatchEvent(3)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(e,this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(e,this._camera);let t,n=new THREE.Vector3(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._scene.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t);if(e){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,r=new THREE.Vector3(0,0,0),a=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,r),this._raycaster.ray.intersectPlane(this._planeSide,a);let i,o=this._getDistanceToCamera(a),s=this._getDistanceToCamera(r);return n>=-ROTATION_TO_DETECT_SIDE&&n<=ROTATION_TO_DETECT_SIDE?i=t<s?e.clone():r.clone():t<s&&t<o?i=e.clone():s<t&&s<o?i=r.clone():o<t&&o<s&&(i=a.clone()),i}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return vectorIsZero(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new THREE.Vector3).x+e.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(e.getWorldQuaternion(new THREE.Quaternion)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof THREE.Mesh&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&disposeMesh(this._currentDrag),this._currentHover&&disposeMesh(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setScene(e){this._scene=e}setMode(e){this._mode=e}}class SceneEventHandler extends EventDispatcher{constructor(e,t,n,r){super(),this._debug=!1,this._dragIn=!1,this._inputManager=r,this._raycastHelper=new RaycastHelper(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}}class TopImageLightSetting extends LightSetting{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),1.2),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!1}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=getGUI();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}}}let imageRenderer=null;const getImageRenderer=()=>(imageRenderer||(imageRenderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),imageRenderer.outputEncoding=THREE.sRGBEncoding,imageRenderer.gammaFactor=2.2),imageRenderer),getCameraTargetForBBox=(e,t=0)=>{if(!e){const e=new THREE.Vector3;return{center:e,bounds:e,diagonal:0}}const n=e.getSize(new THREE.Vector3);return n.addScalar(t),{center:e.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}},preparePerspectiveImage=(e,t,n,r={})=>new Promise(a=>{const{size:i=1024}=r,o=getImageRenderer();o.setSize(i,i);const s=e.fog?e.fog.clone():null,l=e.background?e.background.clone():null;e.background=null,e.fog=null;let c=new DefaultLightSetting(e);t.layers.disable(2),t.layers.disable(5),_placeCameraForPerspectiveImage(t,n,-20,-30),o.render(e,t);const d=o.domElement.toDataURL();t.layers.enable(2),e.background=l,e.fog=s,c.removeFromScene(),a({image:d,width:i,height:i,blob:null})}),renderPerspectiveImage=(e,t,n,r,a,i)=>new Promise(r=>{i||(i=1024);const a=getImageRenderer();a.setSize(i,i);const o=e.fog?e.fog.clone():null,s=e.background?e.background.clone():null;e.background=null,e.fog=null,t.layers.disable(2),t.layers.disable(5),n?_placeCameraForPerspectiveImage(t,n,-20,-30):(t.aspect=1,t.updateProjectionMatrix()),a.render(e,t);const l=a.domElement.toDataURL();t.layers.enable(2),e.background=s,e.fog=o,r({image:l,width:i,height:i,blob:null})}),_placeCameraForPerspectiveImage=(e,t,n,r)=>{e.far=1e3,e.fov=15,e.aspect=1,e.position.copy(t.center),e.rotation.set(0,0,0),e.rotateY(toRadiant(r)),e.rotateX(toRadiant(n)),e.translateZ(3.8*t.diagonal),e.updateProjectionMatrix()},prepareTopImage=(e,t,n,r={})=>{const{showDimensions:a=!1}=r;return new Promise(r=>{const i=getImageRenderer();i.autoClear=!1;let o=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);o.position.copy(n.center),o.rotateX(toRadiant(-90)),o.translateZ(n.bounds.y+1),o.far=o.position.y+.5,o.layers.mask=65535;let s=200*n.bounds.x,l=200*n.bounds.z;if(s>4096||l>4096){let e=0;s>4096?e=s/4096:l>4096&&(e=l/4096),s/=e,l/=e}i.setSize(s,l);let c=e.fog?e.fog.clone():null,d=e.background?e.background.clone():null;e.background=null,e.fog=null;let h=a?new TopImageLightSetting(e):new DefaultLightSetting(e);o.layers.disable(2),o.layers.disable(5),a?o.layers.enable(7):o.layers.disable(7),i.render(e,o),t&&(i.clearDepth(),i.render(t,o));let _=i.domElement.toDataURL();o.layers.enable(2),o.layers.enable(5),e.background=d,e.fog=c,h.removeFromScene(),r({image:_,width:s,height:l,blob:null})})};export{ConfiguratorPlanObjectViewModel as C,GLTF_EXPORTER_FILE_NAME as G,PlannerKernelAccess as P,SceneEventHandler as S,prepareTopImage as a,StaticPlanObjectViewModel as b,getCameraTargetForBBox as g,preparePerspectiveImage as p,renderPerspectiveImage as r};
|
|
2
|
-
//# sourceMappingURL=image-renderer-eccb80a5.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./query-params-helper-8c00a872.legacy.js","./rapi-access-41e0190e.legacy.js","./main-thread-to-worker-66323030.legacy.js","./image-renderer-50475591.legacy.js","./pixotron-e22efd52.legacy.js","./configurator-6b788202.legacy.js","./mesh-generator-8b81c1d2.legacy.js","./configurator-mesh-generator-7731c94d.legacy.js","./default-light-setting-78b9795d.legacy.js"],(function(e){var n,t,a,s;return{setters:[function(){},function(e){n=e._,t=e.i},function(e){a=e.g},function(){},function(){},function(e){s=e.S},function(){},function(){},function(){}],execute:function(){e("default",(()=>{class e extends s{setScene(e){this._scene=e,this._staticItemLoader.loadGLB(a()+"static/banana_div2-1351c98ec2986be1.glb").then(e=>{this._banana=e,this.updateBounds(null)})}updateBounds(e){if(e&&(this._bounds=e),this._bounds){if(this._banana){const e=this._bounds.getSize(new THREE.Vector3),n=this._bounds.getCenter(new THREE.Vector3).clone();n.x-=e.x/2+.18,n.z+=e.z/2+.05,n.y=0;let t=.03;this._banana.scale.copy(new THREE.Vector3(t,t,t)),this._banana.rotation.y=.6,this._banana.position.copy(n)}this._scene.children.includes(this._banana)||this.addToScene()}}clearScene(e,n){super.clearScene(e,n),this.removeFromScene()}addToScene(){this._scene&&this._banana&&this._scene.add(this._banana)}removeFromScene(){this._scene&&this._banana&&this._scene.remove(this._banana)}}return n([t],e.prototype,"_staticItemLoader",void 0),e})())}}}));
|
|
2
|
-
//# sourceMappingURL=banana-for-scale-d9fdb6d4.legacy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-dimensioning-104a6bc1.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./rapi-access-41e0190e.legacy.js","./main-thread-to-worker-66323030.legacy.js","./image-renderer-50475591.legacy.js","./pixotron-e22efd52.legacy.js","./mesh-generator-8b81c1d2.legacy.js","./configurator-mesh-generator-7731c94d.legacy.js","./default-light-setting-78b9795d.legacy.js"],(function(e,t){var n,i,o,s,r,a,l,h,c,d,_,p,u,m,g,C,f,v,y,b,w,E,S,P,I,k,H,R,M,D,O,T,A,L,x,U,V,B,F,j,G,q,z,K,N,W,Q,J,X,Y,Z,$,ee,te,ne,ie,oe,se,re,ae,le,he,ce,de,_e;return{setters:[function(e){n=e._,i=e.i,o=e.C,s=e.B,r=e.A,a=e.a,l=e.D,h=e.b,c=e.k,d=e.E,_=e.c,p=e.M,u=e.U,m=e.G,g=e.g,C=e.d,f=e.R,v=e.e,y=e.t,b=e.f,w=e.P,E=e.h,S=e.j,P=e.l,I=e.m,k=e.n,H=e.L,R=e.o,M=e.p,D=e.q,O=e.r,T=e.s},function(e){A=e.o,L=e.g,x=e.s,U=e.i,V=e.r,B=e.t},function(e){F=e.S,j=e.p,G=e.r,q=e.g,z=e.a,K=e.G},function(e){N=e.E,W=e.I,Q=e.C,J=e.D,X=e.B,Y=e.a,Z=e.F,$=e.G,ee=e.P,te=e.b,ne=e.c,ie=e.S,oe=e.d,se=e.e,re=e.T,ae=e.f,le=e.g,he=e.M},function(e){ce=e.P},function(e){de=e.C},function(e){_e=e.D}],execute:function(){const pe=function(e){return e.validRange&&"string"==typeof e.validRange.type},ue=function(e){return e.validValues&&e.validValues.length>0},me=function(e){return"length"===e.unitType||"area"===e.unitType},ge=function(e){return"Material"===e.type};let Ce={InchFeet:null,MM:null,CM:null},fe={NoUnitString:null,LongUnitString:null,ShortUnitString:null},ve=(()=>{class e{constructor(e){this._formatter=null,this._precision=0,this._creator_=e}init(e){const t=new e.UnitMeasureFormatter;Ce=e.Unit,fe=e.UnitStringType,this._initActualUnit(),this._initActualUnitStringType();const{precisionCm:n,precisionInch:i}=this._initData;this._actualUnit===Ce.InchFeet?this._precision=void 0!==i?parseInt(i,10):2:this._actualUnit===Ce.CM&&(this._precision=void 0!==n?parseInt(n,10):1),t.init("mm","cm","'","ft",'"',"inch","m²","sqft",!0,this._precision),this._formatter=t}_initActualUnit(){const{unit:e}=this._initData;switch(e){case"cm":this._actualUnit=Ce.CM;break;case"mm":this._actualUnit=Ce.MM;break;case"inchfeet":this._actualUnit=Ce.InchFeet;break;default:this._actualUnit=Ce.CM}}_initActualUnitStringType(){const{unitStringType:e}=this._initData;switch(e){case"none":this._actualUnitStringType=fe.NoUnitString;break;case"long":this._actualUnitStringType=fe.LongUnitString;break;case"short":this._actualUnitStringType=fe.ShortUnitString;break;default:this._actualUnitStringType=fe.ShortUnitString}}_isFormatterReady(){return!!this._formatter||(console.warn("Formatter is not ready..."),!1)}formatAngleValueToUnitString(e,t){const n="Integer"===t.type?0:2;return e.toFixed(n)+"°"}parseAngleValueFromUnitString(e){return e.replace("°","").replace(/\s/g,"")}parseValue(e,t){return null===t.unitType||"unknown"===t.unitType||"count"===t.unitType?e:"length"===t.unitType?this.parseMMValueFromUnitString(e,t.unitType):"angle"===t.unitType||"area"===t.unitType?this.parseAngleValueFromUnitString(e):e}formatValueToUnitString(e,t){return null===t.unitType||"unknown"===t.unitType||"count"===t.unitType?"Integer"===t.type?e.toString():parseFloat(e.toString()).toFixed(2):"length"===t.unitType?this.formatMMValueToUnitString(e,t.unitType):"angle"===t.unitType?this.formatAngleValueToUnitString(e,t):"area"===t.unitType?this.formatSquareMMValueToUnitString(e):e}isParseableNumber(e){return this._isFormatterReady()?this._formatter.isParseableNumber(e):null}isParseableUnitString(e,t){return this._isFormatterReady()?"angle"===t.unitType?this._formatter.isParseableUnitString(this.parseAngleValueFromUnitString(e),this._actualUnit):this._formatter.isParseableUnitString(e,this._actualUnit):null}parseMMValueFromUnitString(e,t){return this._isFormatterReady()?"count"===t?parseFloat(e):this._formatter.parseMMValueFromUnitString(e,this._actualUnit):null}parseNumber(e){return this._isFormatterReady()?this._formatter.parseNumber(e):null}formatNumber(e,t=0){return this._isFormatterReady()?this._formatter.formatNumber(e,t):null}formatSquareMMValueToUnitString(e){return this._isFormatterReady()?this._formatter.formatSquareMMValueToUnitString(e,this._actualUnit):null}formatMMValueToUnitString(e,t){return this._isFormatterReady()?"count"===t?e.toString():this._formatter.formatMMValueToUnitString(e,this._actualUnit,this._actualUnitStringType):null}formatMMValueWithReqMaxLength(e,t){return this._isFormatterReady()?this._formatter.formatMMValueWithReqMaxLength(e,this._actualUnit,t):null}_formatParameterValue(e,t){return"length"===t?this.formatMMValueToUnitString(parseFloat(e)):"area"===t?this.formatSquareMMValueToUnitString(parseFloat(e)):e}formatPartListParameter(e){me(e)&&(e.valueLabel=this._formatParameterValue(e.value,e.unitType))}formatParameter(e){if(me(e)&&Array.isArray(e.validValues)&&e.validValues.forEach(({value:t},n)=>{e.validValues[n].label=this._formatParameterValue(t,e.unitType)}),e.valueLabel=this._formatParameterValue(e.value,e.unitType),ge(e))e.uiType="Material";else if(function(e){return"Boolean"===e.type}(e))e.uiType="Boolean";else if(pe(e)){e.uiType="Range";const t=null!==e.validRange.valueFrom?e.validRange.valueFrom:Number.MIN_SAFE_INTEGER,n=null!==e.validRange.valueTo?e.validRange.valueTo:Number.MAX_SAFE_INTEGER;e.validRangeLabels={valueFrom:this._formatParameterValue(t.toString(),e.unitType),valueTo:this._formatParameterValue(n.toString(),e.unitType),type:e.validRange.type}}else ue(e)?(e.uiType="Options",function(e){return!!ue(e)&&Array.isArray(e.validValues)&&e.validValues.length>0&&"string"==typeof e.validValues[0].thumbnail}(e)&&(e.uiType="Thumbnails")):(console.error("Could not detect uiType of param"),e.uiType=null)}isInch(){return this._actualUnit===Ce.InchFeet}getPrecision(){return this._precision}getAllowedDelta(){const e=1/Math.pow(10,this._precision);return this.isInch()?25.4*e:e}}return n([i],e.prototype,"_initData",void 0),e})();const ye=["material"];let be=(()=>{class e extends o{constructor(e){super(e,1),this.externalMeshQueue=new ce,this.muteKernelCallbacks=!1,this.listOfVariants=(e,t)=>{},s.addMeta("kernel_is_ready",{isWasm:this._useWASM}),r.kernelInstance?(this._kernelContainer=r.kernelContainer,setTimeout(()=>this._loadSuccess(),0)):this._scriptLoader.fetch(this._kernelPath,{id:"kernel"}).then(this._loadSuccess.bind(this),this._loadError.bind(this))}_loadSuccess(){s.start("kernel_is_ready"),r.kernelInstance?setTimeout(()=>this.isReady(),0):(window.ConfiguratorKernel(this._kernelContainer),window.ConfiguratorKernel=null)}_loadError(){this._configuratorKernelAccessCallback.loadError()}selectedComponent(e){this._updateComponentDependencies(e)}uiRequestConfiguration(e){const t=this._kernelInstance.getSerializedConfiguration(e);a.finishOperation(1,t)}_updateComponentParameters(e){let t=this._kernelInstance.getComponentParameters(e);const n=this._kernelInstance.getComponent(e);this._configuratorKernelAccessCallback.updateParameters(t,n.parameterGroups,e,1)}selectionChange(e,t){let n=!1,i=[];if(e){let t=this._kernelInstance.getComponent(e);t.componentId=this._kernelInstance.getComponentId(e),t&&t.childIds&&t.childIds.length>0&&(n=!0),i.push(t)}this._configuratorUiCallbacks.onSelectionChange("standard",t,n,i)}multiSelectionChange(e,t){this._updateCommonComponentDependencies(e);let n=!1,i=!1,o=[];e&&e.forEach(e=>{let s=this._kernelInstance.getComponent(e);s.componentId=this._kernelInstance.getComponentId(e),s&&s.childIds&&s.childIds.length>0&&(n=!0),s.id===t&&(i=!0),o.push(s)}),this._configuratorUiCallbacks.onSelectionChange("multiselect",i,n,o)}_updateCommonComponentDependencies(e){const{parameters:t,parameterGroups:n}=this._kernelInstance.getCommonPlanComponentParameters(this._utilityToLongArray(e));this._configuratorKernelAccessCallback.updateParameters(t,n,e,2)}_updateComponentChildren(e){const t=this._kernelInstance.getPlanComponentPossibleChildren(e);this._configuratorKernelAccessCallback.updatePossibleChildren(e,t,1)}_updateComponentDependencies(e){this._updateComponentParameters(e),this._updateComponentChildren(e)}_updatePlanObjectParameters(e){let t,n=this._kernelInstance.getPlanObjectParameters(e);if(0===n.length){let i=this._kernelInstance.getRootPlanComponentIdFromObjectId(e);n=this._kernelInstance.getComponentParameters(i),this._enableRootComponentParametersAsGlobal(),t=this._kernelInstance.getComponent(i)}else this._configuratorContext.rootComponentParametersAsGlobal=!1,t=this._kernelInstance.getPlanObject(e);this._configuratorKernelAccessCallback.updateParameters(n,t.parameterGroups,e,0)}_enableRootComponentParametersAsGlobal(){this._configuratorContext.selectedRuntimeComponentId||(this._configuratorContext.rootComponentParametersAsGlobal=!0)}_updatePlanObjectChildren(e){const t=this._kernelInstance.getPlanObjectPossibleChildren(e);this._configuratorKernelAccessCallback.updatePossibleChildren(e,t,0)}updatePlanObjectDependencies(e){this._updatePlanObjectParameters(e),this._updatePlanObjectChildren(e)}_updateConfigurationHasChildren(e,t=null){t||(t=this._kernelInstance.getComponent(this._kernelInstance.getRootPlanComponentIdFromObjectId(e)));const n=t.childIds.size?t.childIds.size():t.childIds.length;this._configuratorUiCallbacks.onConfigurationHasChildren(n>0)}dockComponent(e,t,n,i){const o=this._kernelInstance.getComponentId(n),s=this._kernelInstance.getComponentId(e);this._kernelInstance.dockComponent(n,i,e,t),this._configuratorUiCallbacks.onUserInitiatedDockDone(o,i,s,t,null)}changeUseOfHDGeometry(e,t){this._rapiAccess.changeUseOfHDGeometry();const n=e.planObjectId,i=e.lastLoadedRapiId?e.lastLoadedRapiId:this._kernelInstance.getComponentId(n),o=this._kernelInstance.getSerializedConfiguration(n);this._kernelInstance.clearAll(),this._kernelInstance.useHDGeometry(t),a.finishOperation(3,[o,i])}webGlPreviewDockings(e,t){a.waitFor(4).then(({componentId:n})=>{t&&this.requestPlanComponentConstruction(n),this._kernelInstance.requestPreviewGeometry(n,e.planObjectId)}),e.lastPossibleChild&&e.lastPossibleChild.isComponent&&(this._kernelIo.setMeta({componentId:e.lastPossibleChild.id}),this._kernelInstance.loadPlainComponent(l,e.lastPossibleChild.id,e.lastPossibleChild.configuration)),e.lastPossibleChild&&e.lastPossibleChild.isItem&&this._kernelInstance.loadFreeFlyingConfiguration(l,e.lastPossibleChild.configuration)}previewDockingsWithDrag(e,t){this._kernelInstance.requestPreviewGeometry(e,t)}loadConfiguration(e){this._initData.id?this._memoryManager.loadingConfiguration(this._initData.id):this._memoryManager.loadingConfigurationString(),this._memoryManager.shouldHardReset()?this._kernelInstance.clearAll():this._kernelInstance.clearScene(),this._kernelInstance.loadConfiguration(h,e,{x:0,y:0,z:0})}changeCommonComponentParameter(e,t,n,i,o,s){"string"==typeof i?this._kernelInstance.setPlanComponentParameters(this._utilityToLongArray(e),t,i):console.warn("tried to set a parameter to a none string value!",i,t,n),this._finishParameterChange(n,o,s),this._updateCommonComponentDependencies(e)}changeComponentParameter(e,t,n,i,o,s){"string"==typeof i?this._kernelInstance.setComponentParameter(e,t,i):console.warn("tried to set a parameter to a none string value!",i,t,n),this._finishParameterChange(n,o,s),this._updateComponentDependencies(e)}changePlanObjectParameter(e,t,n,i,o,s){"string"==typeof i?this._kernelInstance.setPlanObjectParameter(e,t,i):console.warn("tried to set a parameter to a none string value!",i,t,n),this._finishParameterChange(n,o,s)}_finishParameterChange(e,t,n){-1===ye.indexOf(e)?setTimeout(()=>t(),0):this._configuratorKernelCallbackListener.forEach(e=>e.finishParameterChange(t,n))}requestDeleteComponents(e){e&&this._kernelInstance.deletePlanComponents(this._utilityToLongArray(e))}_calcPrice(){const e=new Map;if(this._initData.useRoomlePrice){let e=this._kernelInstance.getFullPartList();if(e&&e.fullList&&e.fullList.length){const t=e.fullList[0].currencySymbol,n=e.fullList.reduce((e,t)=>e+(t.count?t.count:0)*(t.price?t.price:0),0);this._configuratorUiCallbacks.onUpdatePrice(t,n)}}else if(this._initData.usePriceService){let t=this._kernelInstance.getFullPartList();if(t&&t.fullList&&t.fullList.length){const n=t.fullList.reduce((t,n)=>{const i=c(n);return i&&(e.set(i,n),t.push(i)),t},[]);return new Promise((i,o)=>{this._rapiAccess.getPrices(n).then(n=>{if(!n.length)return o(new Error("prices are empty"));const s=A(n,"priceId");let r=0;return t.fullList.forEach(e=>{const t=c(e);if(!s.has(t))return void console.warn("PriceId: "+t+" has no corresponding kernel-part");const{price:n,currencySymbol:i}=s.get(t);e.price=n,e.currencySymbol=i,r+=n*e.count}),this._configuratorUiCallbacks.onUpdatePrice(n[0].currencySymbol,r),i({totalSum:r,partMap:e})},e=>{console.error(e),o(e)})})}}return Promise.resolve({totalSum:0,partMap:e})}loadComponentIntoKernel(e,t){this._kernelIo.setMeta({componentId:t}),this._kernelInstance.loadComponentDefinition(10,e)}async addUiDataAndPriceToPartList(e,t){const{fullList:n,originPart:i}=e,o=e.perMainComponent;let s;this.addUiDataToPartList(n,t);try{const e=await this._calcPrice();s=e.partMap}catch(e){console.error(e),s=new Map}const r=this._initData.usePriceService||this._initData.useRoomlePrice,a=e=>{r||(e.price=null,e.currencySymbol=null);const t=c(e);if(!t)return;if(!s.has(t))return;const{price:n,currencySymbol:i}=s.get(t);"number"==typeof n&&(e.price=n,e.currencySymbol=i)};return n.forEach(a),o.forEach(({fullList:e,perMainComponent:n})=>{n.length>0&&console.error("Not implemented! perMainComponent is deeper than one level"),this.addUiDataToPartList(e,t),e.forEach(a)}),{fullList:n,perMainComponent:o,originPart:i}}async requestPartListAndUpdatePricesOfParts(e,t){let n=this._kernelInstance.getFullPartList();e||(e=this._kernelInstance.getHashOfConfiguration(this._configuratorContext.planObjectId));const i=await this.addUiDataAndPriceToPartList(n,e);this._configuratorUiCallbacks.onPartListUpdate(i,btoa(e))}addUiDataToPartList(e,t){const n=[];return e.forEach(e=>{const t=this._rapiAccess.peekComponent(e.componentId);!t||e.labelIsCalculated&&e.label||(e.label=t.label),e.parameters.forEach(e=>{if(this._unitFormatter.formatPartListParameter(e),ge(e)){const t=this._rapiAccess.peekMaterial(e.value);t?e.valueLabel=t.label||t.name||e.value:-1===n.indexOf(e.value)&&n.push(e.value)}})}),n.length&&this._rapiAccess.getMaterials(n).then(e=>{const n=this._lastPartListHash!==t;Array.isArray(e)&&e.length&&n&&(this._lastPartListHash=t,this.requestPartListAndUpdatePricesOfParts())}),e}requestSync(e,t){this.planObjectCreated(e,t),this._kernelInstance.syncPlanObjectToView(e,t)}getGlobalParameters(e,t){return new Promise(n=>{let i=this._kernelInstance.getPlanObjectParameters,o=e;t&&(i=this._kernelInstance.getComponentParameters,o=this._kernelInstance.getRootPlanComponentIdFromObjectId(e)),n(i.apply(this._kernelInstance,[o]))})}getPartList(){return new Promise(e=>{e(this._kernelInstance.getFullPartList())})}getConfigurationHash(e){return new Promise(t=>t(this._kernelInstance.getHashOfConfiguration(e.planObjectId)))}requestPlanObjectConstruction(e){this._kernelInstance.requestPlanObjectConstruction(e)}isReady(){super.isReady(),s.end("kernel_is_ready"),s.start("kernel_create_instance"),r.kernelInstance?this._kernelInstance=r.kernelInstance:this._kernelInstance=new this._kernelContainer.Kernel,this._kernelContainer.registerConfiguratorCallback(this),s.end("kernel_create_instance");const{overrideCountry:e,locale:t}=this._globalInitData;e&&(this._kernelInstance.resetPriceListIds(),this._kernelInstance.addPriceList(e)),d.isProduction||(window.__RML__DEBUG__.Kernel=this._kernelInstance,window.__RML__DEBUG__.KernelContainer=this._kernelContainer,window.__RML__DEBUG__.Helper={convertCObject:_}),this._kernelInstance.setEnvironmentVariable("language",t),this._unitFormatter.init(this._kernelContainer),this._configuratorKernelAccessCallback.isReady(),this._configuratorUiCallbacks.onConfiguratorKernelIsReady(this._kernelContainer,this._kernelInstance),r.planObjectId&&this.planObjectCreated(-1,r.planObjectId)}onLoadComponentError(e,t){this._configuratorUiCallbacks.onComponentLoadError(e,t)}configurationLoaded(e,t,n,i,o){a.finishOperation(4,{conversationId:e,objectId:t,componentId:n,hash:i,errors:_(o)}),this._configuratorKernelCallbackListener.forEach(s=>s.configurationLoaded(e,t,n,i,o))}componentDefinitionLoaded(e,t){a.finishOperation(0,t)}componentDefinitionLoadingError(e,t){this._kernelIo.error(t),a.failOperation(0,new Error(t))}configurationLoadingError(e,t){let n="Configuration loading error";if(t){const e=_(t);Array.isArray(e)&&(n=e.join("\n"),e.forEach(e=>this._kernelIo.error(e)))}a.failOperation(4,new Error(n)),a.failOperation(2,new Error(n))}componentConfigurationUpdated(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.componentConfigurationUpdated(e,t)),this._kernelInstance.requestDeltaPlanComponentConstruction(e)}setActiveGroupInView(e){this._kernelInstance.setActiveGroupInView(e)}componentParameters(){}requestComponentDimensions(){}planObjectCreated(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.planObjectCreated(e,t))}planObjectUpdated(e){const t=this._kernelInstance.getPlanObject(e);this._onBoundsUpdate(t),this._configuratorKernelCallbackListener.forEach(e=>e.planObjectUpdated(t))}planObjectConfigurationUpdated(e,t,n){this.updatePlanObjectDependencies(e);let i=this._kernelInstance.getComponent(this._kernelInstance.getRootPlanComponentIdFromObjectId(e));this._configuratorKernelCallbackListener.forEach(i=>i.planObjectConfigurationUpdated(e,t,n));const o=this._kernelInstance.getPlanObject(e);return this._onBoundsUpdate(o),this._updateConfigurationHasChildren(e,i),this.requestPartListAndUpdatePricesOfParts(n)}_onBoundsUpdate(e){if(!e.boxForMeasurement)return;const t={width:this._unitFormatter.formatMMValueToUnitString(e.boxForMeasurement.size.x),height:this._unitFormatter.formatMMValueToUnitString(e.boxForMeasurement.size.z),depth:this._unitFormatter.formatMMValueToUnitString(e.boxForMeasurement.size.y),kernelBounds:e.boxForMeasurement};this._configuratorUiCallbacks.onBoundsUpdate(t)}planObjectDeleted(){}requestPlanObjectDimensions(){}async requestExternalMesh(e,t){let n=()=>{};const i=new Promise((e,t)=>{n=e});let o;this.externalMeshQueue.push(i);try{o=await this._rapiAccess.getMesh(e,p,t)}catch(t){throw this._configuratorUiCallbacks.onError(new Error(`Mesh with id "${e}" can not be loaded. "${t}"`)),console.error(t),t}try{const i=await fetch(new Request(this._dataSyncer.requestAsset(o.url,!0))),s=await i.arrayBuffer();await this._handleCortoMesh(s,e,t),n()}catch(t){throw this._configuratorUiCallbacks.onError(new Error(`Mesh with id "${e}" breaks. "${t}"`)),console.error(t),t}}Editor3dComponentCreated(e,t,n,i){this._configuratorKernelCallbackListener.forEach(o=>o.Editor3dComponentCreated(e,t,n,i,!1)),i&&i>0&&this._configuratorKernelCallbackListener.forEach(o=>o.Editor3dComponentDocked(e,i,t,n))}Editor3dRootComponentCreated(e,t,n,i){this._configuratorKernelCallbackListener.forEach(o=>o.Editor3dComponentCreated(e,t,n,i,!0))}Editor3dGeometryNotReady(e){this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dGeometryNotReady(e))}Editor3dPlanObjectConstructionDone(e){return this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dPlanObjectConstructionDone(e)),this.updatePlanObjectDependencies(e),this._updateConfigurationHasChildren(e),s.end("ui_load_configuration"),this._calcPrice()}Editor3dBeginGroup(){}Editor3dEndGroup(){}Editor3dSetMaterial(){}Editor3dLoadMaterial(){}Editor3dAddDockPreview(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dAddDockPreview(e,t))}Editor3dSetPreviewPointAssociations(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dSetPreviewPointAssociations(e,t))}Editor3dSetPreviewLineAssociations(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dSetPreviewLineAssociations(e,t))}Editor3dPreviewConstructionDone(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dPreviewConstructionDone(e,t))}Editor3dTranslateBy(){}Editor3dRotateBy(){}Editor3dRotateAround(){}Editor3dAddCube(){}Editor3dAddCubeUVMod(){}Editor3dAddSphere(){}Editor3dAddSphereUVMod(){}Editor3dAddRectangle(){}Editor3dAddRectangleUVMod(){}Editor3dAddMesh(){}Editor3dAddMeshUVMod(){}Editor3dAddMeshUVCoord(){}Editor3dAddCylinder(){}Editor3dAddCylinderUVMod(){}Editor3dAddPrism(){}Editor3dAddPrismUVMod(){}Editor3dAddFittingPoint(){}Editor3dAddFittingLine(){}Editor3dSelectObject(){}Editor3dCopy(){}Editor3dUpdatePlanObjectPosition(){}Editor3dUpdatePlanObjectRotation(){}Editor3dUpdatePlanObjectTransform(){}Editor3dUpdatePlanComponentPosition(){}Editor3dUpdatePlanComponentRotation(){}Editor3dUpdatePlanComponentTransform(){}getRuntimeComponentIdOfRootComponent(e){return this._kernelInstance?this._kernelInstance.getRootPlanComponentIdFromObjectId(e):(console.warn("this._kernelInstance not ready now"),0)}getRuntimeComponentId(e){return this._kernelInstance.getComponentId(e)}getParameterGroups(){if(!this._configuratorContext.planObjectId)return[];const e=this._kernelInstance.getRootPlanComponentIdFromObjectId(this._configuratorContext.planObjectId);return this._kernelInstance.getComponent(e).parameterGroups}resume(){this.muteKernelCallbacks||super.resume()}getSerializedConfiguration(e){return this._kernelInstance.getSerializedConfiguration(e)}getCurrentConfigurationHash(e){return this._kernelInstance.getHashOfConfiguration(e)}listOfVariantsError(e,t){this._kernelIo.setMeta({rapiId:e}),this._kernelIo.error(t)}}return n([i],e.prototype,"_unitFormatter",void 0),n([i],e.prototype,"_memoryManager",void 0),n([i],e.prototype,"_configuratorKernelAccessCallback",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_initData",void 0),n([i],e.prototype,"_globalInitData",void 0),e})();class we{constructor(e){const{component:t,resetCamera:n,consecutive:i}=e;this.component=t,this.resetCamera=void 0===n||n,this.consecutive=void 0===i||i}}const Ee=new Map,Se=new Map;class Pe{static loadFont(e){if(Se.has(e))return new Promise(t=>{t(Se.get(e))});if(Ee.has(e))return new Promise((t,n)=>{Ee.get(e).push({resolve:t,reject:n})});let t=new THREE.FontLoader;return new Promise((n,i)=>{Ee.set(e,[{resolve:n,reject:i}]),t.load(L()+e,t=>{Se.set(e,t),Pe._resolveAll(e,t)})})}static _resolveAll(e,t){Ee.has(e)&&Ee.get(e).forEach(e=>e.resolve(t)),Ee.delete(e)}}e("A",Pe);var Ie=e("R","static/rubik_regular_sub-eb3f3b61078695cc.json");let ke=(()=>{class e{constructor(e,t){this._addOnSpotIcons=new Map,this.previewGhostEnabled=!1,this.addOnSpotsEnabled=!1,this._state=3,this._camera=e,this._textMaterial=new THREE.MeshStandardMaterial({color:8947848});let n=new THREE.Geometry;this._plusText=new THREE.Mesh(n,this._textMaterial),this._plusText.layers.set(4),Pe.loadFont(Ie).then(e=>{this._font=e;let t={font:this._font,size:.05,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001};this._plusTextGeometry=new THREE.TextGeometry("+",t),this._plusTextGeometry.computeBoundingBox(),this._plusText.geometry=this._plusTextGeometry}),this._plusButtonPromise=new Promise((e,n)=>{t.fetch(m,{id:"gltf-loader-js"}).then(()=>{(new THREE.GLTFLoader).load(L()+"static/AddButtonRound-8004fa7dffdf7501.glb",t=>{t&&t.scene&&t.scene.children&&t.scene.children.length>0?(this._onPlusButtonLoaded(t.scene.children[0]),e()):n("loaded scene has no childrens")},e=>{},e=>{console.error(e),n(e)})})})}_onPlusButtonLoaded(e){e&&(this._plusButton=e,this._plusButton.material=this._textMaterial,this._plusButton.layers.set(4),this._plusButton.scale.copy(new THREE.Vector3(.08,.08,.08)))}_performUpdate(e){if(this.addOnSpotsEnabled)for(let e of this._addOnSpotIcons.values())e.forEach(e=>{e.geometry.center();let t=new THREE.Vector3(0,1,0);t.applyQuaternion(this._camera.quaternion),e.up.copy(t),e.lookAt(this._camera.position)})}addAddOnSpots(e,t){Promise.all([this._plusButtonPromise]).then(()=>{this.addOnSpotsEnabled&&this._plusButton&&(this.deleteAddonPointsForComponent(e.roomleId),t.forEach(t=>{const n=this._plusButton.clone();n.name="addOnSpot "+e.roomleId,n.layers.set(8),n.position.copy(this.getPositionForAddOnPosition(new THREE.Vector3(t.position.x,t.position.y,t.position.z))),this._addOnSpotIcons.has(e.roomleId)?this._addOnSpotIcons.get(e.roomleId).push(n):this._addOnSpotIcons.set(e.roomleId,[n]),n.geometry.computeBoundingBox();const i=n.geometry.boundingBox,o=i.getSize(new THREE.Vector3),s=new THREE.BoxGeometry(o.x,o.y,o.z),r=new THREE.Mesh(s,new THREE.MeshStandardMaterial({color:"#FFFFFF",transparent:!0,opacity:0,polygonOffset:!0,polygonOffsetFactor:-1}));r.layers.set(4),r.translateOnAxis(i.getCenter(new THREE.Vector3),1),r.renderOrder=3,r.visible=!0,n.add(r),r.userData={hasListener:!0,priority:3,roomleId:e.roomleId},r.addEventListener("select",()=>{this._onAddonClick&&this._onAddonClick()}),r.addEventListener("hover_on",()=>{x("pointer"),this._configuratorUiCallbacks.onAddonPlusHover()}),r.addEventListener("hover_off",()=>{x("default"),this._configuratorUiCallbacks.onAddonPlusHoverOff()}),e.add(n)}))})}deleteAddonPointsForComponent(e){this.addOnSpotsEnabled&&this._addOnSpotIcons.has(e)&&(this._addOnSpotIcons.get(e).forEach(e=>{e.parent.remove(e)}),this._addOnSpotIcons.delete(e))}getPositionForAddOnPosition(e){let t=new THREE.Vector3;return t.set(e.x/1e3,e.z/1e3,e.y/-1e3),t}update(e=!1){this._performUpdate(e)}changePreviewGhostVisibility(e,t){this.previewGhostEnabled&&(t?(e.add(this._plusText),this._plusText.position.copy((new THREE.Vector3).add(e.boundingBox.getCenter(new THREE.Vector3))),this._plusText.geometry.center()):e.remove(this._plusText))}_changeAddOnSpotVisibility(e){this.addOnSpotsEnabled&&this._addOnSpotsVisible!==e&&(this._addOnSpotsVisible=e)}isAddOnSpotVisible(){return this._addOnSpotsVisible&&this.addOnSpotsEnabled}onAddonClick(e){this._onAddonClick=e}setState(e){1===this._state&&2!==e||1===e&&5===this._state||3!==e&&5===this._state||(4!==e&&1!==e&&5!==e||this._changeAddOnSpotVisibility(!1),3!==e&&2!==e&&0!==e||this._changeAddOnSpotVisibility(!0),this._state=e)}}return n([i],e.prototype,"_configuratorUiCallbacks",void 0),e})();class He{constructor(e){const{component:t,preview:n,resetCamera:i,consecutive:o,type:s,forceRender:r}=e;this.component=t,this.preview=n,this.resetCamera=void 0===i||i,this.consecutive=void 0===o||o,this.type=s||0,this.forceRender=void 0!==r&&r}}let Re=(()=>{class e extends F{constructor(e,t,n,i,o){super(e,t,n,i),this._cameraMoving=!1,this._addonHelper=o,this._raycastHelper.addEventListener(3,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(0,({component:e,consecutive:t})=>{this.dispatchEvent(8,new He({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new He({component:e,resetCamera:t}))},this),this._addInputListeners(this._inputManager)}_addInputListeners(e){e.addEventListener(7,e=>this._interaction(),this),e.addEventListener(8,e=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.roomleId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:2,roomleId:e.roomleId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.roomleId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,n){t.userData.hasListener||(Object.assign(t.userData,n),t.addEventListener("select",()=>this.clickComponent(e)),t.addEventListener("hover_on",t=>this._hoverOn(e,t.attachment.type)),t.addEventListener("hover_off",t=>this._hoverOff(e,t.attachment.type)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData={hasListener:!0,priority:3,roomleId:e.roomleId},t.addEventListener("select",()=>this._clickPreview(e)),t.addEventListener("hover_on",()=>this._hoverOnPreview(e)),t.addEventListener("hover_off",()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData={hasListener:!0,priority:4,roomleId:e.roomleId},t.addEventListener("select",()=>this._clickPreviewLine(e)),t.addEventListener("hover_on",t=>this._hoverOnPreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_move",t=>this._hoverMovePreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_off",()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new He({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new He({preview:e}))}clickComponent(e){this._debug&&e.roomleId,this._selectionHandler.check(e)}_clickOutside(){this._selectionHandler.cancelSelection(),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.roomleId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new He({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.roomleId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new He({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e,this._addonHelper&&this._addonHelper.changePreviewGhostVisibility(e,!0)}_hoverOffPreview(e){e.hoverOff(),this._interaction(!0),this._hoveredPreview=null,this._addonHelper&&this._addonHelper.changePreviewGhostVisibility(e,!1)}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let n=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=n,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(n))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){this._draggedComponent.traverse(t=>{if(t instanceof THREE.Mesh){const n=t;e&&void 0!==n.castShadowOld?(n.receiveShadow=n.receiveShadowOld,n.castShadow=n.castShadowOld):(n.receiveShadowOld=t.receiveShadow,n.castShadowOld=t.castShadow,n.receiveShadow=!1,n.castShadow=!1)}})}_dragStart(e){e&&(this._selectionHandler.isSelected(e)||this.isDragIn())&&(this._dragStartPosition=e.position.clone(),this._dragStartRotation=e.rotation.clone(),this._draggedComponent=e,this._setDragComponentShadow(!1),this.dispatchEvent(4,new He({component:e})),this._interaction())}_drag(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(e&&!this._draggedComponent&&(this._draggedComponent=e),this._previewLineIntersection){let e=this._hoveredPreview,t=e.getPositionForIntersectionPoint(this._previewLineIntersection),n=e.parent.localToWorld(t);this._draggedComponent.position.copy(this._draggedComponent.parent.worldToLocal(n)),this._draggedComponent.rotation.copy(e.docklineRotation),e.hideSelectionLine()}else e.parent?e.position.copy(e.parent.worldToLocal(t)):e.position.copy(t);this._hoveredPreview?e.visible=!1:e.visible=!0,this.dispatchEvent(5,new He({component:e})),this._interaction()}}_dragEnd(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(this._hoveredPreview)if(this._previewLineIntersection){let t=this._hoveredPreview,n=t.getPositionForIntersectionPoint(this._previewLineIntersection),i=t.parent.localToWorld(n);e.position.copy(e.parent.worldToLocal(i)),e.rotation.copy(t.docklineRotation)}else e.position.copy(t);else this._dragStartPosition&&this._dragStartRotation&&(e.position.copy(this._dragStartPosition),e.rotation.copy(this._dragStartRotation),this._dragStartPosition=null,this._dragStartRotation=null,this.addComponentHandlers(e));e.visible=!0,this._setDragComponentShadow(!0),this._draggedComponent=null,this._previewLineIntersection=null,this.dispatchEvent(6,new He({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new He({forceRender:e}))}hasSelection(){return this._selectionHandler.hasSelection()}update(e,t,n){this._raycastHelper.update(e,t,n)}isDragIn(){return this._dragIn}isDragging(){return null!=this._draggedComponent}setRootComponentId(e){this._raycastHelper.setRootComponentId(e)}cancelSelection(){this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection()}setSelectionMode(e){this._selectionHandler.setSelectionMode(e)}getSelectionMode(){return this._selectionHandler.getSelectionMode()}getSelectedRuntimeComponentIds(){return this._selectionHandler.getSelectedRuntimeComponentIds()}setCameraMoving(e){e&&this._hoveredComponent&&this._hoverOff(this._hoveredComponent,0),this._cameraMoving=e}}return n([i],e.prototype,"_selectionHandler",void 0),e})();class Me extends N{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let i=new THREE.Vector3(-e.x/2,0,-e.z/2),o=new THREE.Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new THREE.Box3(i,o),this._clientWidth=t,this._clientHeight=n;let s=this._boundingBox.getSize(new THREE.Vector3);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new THREE.Vector3(s.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new THREE.Vector3(s.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(null==this._boundingBox||null==this._offset)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let n=0;this.floorEnvironment?(e=["left","right","bottom"],n=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),n|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),n|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),n|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),n|=4),n!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=n)}_checkPaddings(){let e={left:this._clientWidth/2,top:this._clientHeight/2,right:this._clientWidth/2,bottom:this._clientHeight/2};return this._boxVertices.forEach(t=>{let n=g(t,this._camera,this._clientWidth,this._clientHeight);n.x<e.left&&(e.left=n.x),n.x>e.right&&(e.right=n.x),n.y<e.top&&(e.top=n.y),n.y>e.bottom&&(e.bottom=n.y)}),e}}let De=(()=>{class e{constructor(e,t){this._forceRender=!1,this._updateShadowsAndAO=!0,this._maxAnisotropy=1,this._clock=new THREE.Clock,this._delta=0,this._depthWriteMaterial=new THREE.MeshBasicMaterial({colorWrite:!1}),this._lastChange=Date.now(),this._running=!1,this._onAfterRender=()=>{},this._creator_=e,this._setupScene(t),this._configuratorViewModel.setListener(this),this._lifeCycleManager.addEventListener(this);const{plusInPreview:n,addOnSpots:i}=this._initData;(n||i)&&(this._addonHelper=new ke(this._camera,this._scriptLoader),i&&(this._addonHelper.onAddonClick(()=>{this._configuratorUiCallbacks.onOpenAddOns()}),this._addonHelper.addOnSpotsEnabled=i),this._addonHelper.previewGhostEnabled=n),this._cameraControl=new Q(this._creator_,this._configuratorInputManager,null,this._camera),this._sceneEventHandler=new Re(this._creator_,this._scene,this._camera,this._configuratorInputManager,this._addonHelper),this._sceneEventHandler.addEventListener(0,({forceRender:e})=>{this._uiIntersectionHelper.calculateUIIntersection(),this._addonHelper&&this._addonHelper.setState(0),e&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(1,({component:e,type:t})=>this._onHoverOn(e,t),this),this._sceneEventHandler.addEventListener(2,({component:e,type:t})=>this._onHoverOff(e,t),this),this._sceneEventHandler.addEventListener(3,()=>{this._configuratorUiCallbacks.onClickOutside(),this._cameraControl.unlock(),this._cancelDockings(!1,null,this._configuratorViewModel.hasPreviews(),!0,!1),this.cancelSelection(!0),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._configuratorViewModel),this._requestRender()},this),this._sceneEventHandler.addEventListener(8,({component:e,consecutive:t})=>{this._configuratorViewModel.hasPreviews()&&this._cancelDockings(!1,null,this._configuratorViewModel.hasPreviews(),!0,!1),this._selectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(9,({component:e,resetCamera:t})=>{this._deselectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelSelection(),this._requestDockingsPreviewWithDrag(e.roomleId),this._cameraControl.lock(),this._requestRender()},this),this._sceneEventHandler.addEventListener(5,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(6,({component:e,preview:t})=>{if(t){let n=t;this._configuratorViewModel.isPreviewLine(n)?this._configuratorViewModel.dockComponentWithPosition(n,e):this._configuratorViewModel.isPreview(n)&&this._dockComponent(n),this._cancelDockings(!t,e,!0,!0)}else{let t=this._sceneEventHandler.isDragIn()?e:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),t,!1,!0);const n=this._configuratorViewModel.getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))}this._cameraControl.unlock(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(7,({preview:e})=>{this._configuratorViewModel.isPreview(e)&&(this._configuratorViewModel.isPreviewLine(e)?this._configuratorViewModel.dockComponentWithPosition(e):this._dockComponent(e),this._cancelDockings(!1,null,!this._configuratorViewModel.hasPreviews(),!1,!1),this.requestDockingsPreview(!1),this._requestRender())},this),this._cameraControl.addEventListener(0,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),this._addonHelper&&this._addonHelper.setState(1),this._pixotronUtil.movingCameraStarts(),this._requestRender()},this),this._cameraControl.addEventListener(1,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._configuratorViewModel),this._requestRender()},this),this._cameraControl.addEventListener(2,()=>{this._sceneEventHandler.setCameraMoving(!1),this._addonHelper&&this._addonHelper.setState(2),this._pixotronUtil.movingCameraStops(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(5,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this._cameraControl.addEventListener(3,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(4,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(7,()=>{this._pluginSystem.moveCameraStart(this._camera.position)},this),this._cameraControl.addEventListener(8,()=>{this._pluginSystem.moveCameraEnd(this._camera.position)},this),d.isProduction||(window.__RML__DEBUG__.SceneHelper=this),this._initOptionalModules()}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:e}=await Promise.resolve().then((function(){return Le}));this._componentRaycastHelper=new e,this._componentRaycastHelper.init(this._scene,this._camera)}}_showDockings(){}cancelDockings(){this._cancelDockings(!0,null,!0,!0),this._renderEverything()}_cancelDockings(e,t,n,i,o=!0){e&&(this._sceneEventHandler.setDragIn(!1),this._configuratorViewModel.removeDockingComponent(),t&&this._scene.remove(t)),this._configuratorViewModel.removePreviews(),n&&o&&this._updateCameraToBounds(),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._addonHelper&&this._addonHelper.setState(3),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}stopRenderLoop(){this._running=!1}_onHoverOn(e,t){2!==t&&this._highlight(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.add(e)&&this._renderEverything()}_onHoverOff(e,t){2!==t&&this._highlight(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._componentDimensioningHelper.remove(e),this._renderEverything()),this._requestRender()}_highlight(e=null,t=[]){if(!this._shouldHighlight())return;this._pixotron&&((null==t?void 0:t.length)?this._pixotron.getHighLightPass().transparency=.8:this._pixotron.getHighLightPass().transparency=1,this._pixotron.getHighLightPass().needsUpdate=!0);const n=[],i=this._initData.meshSelection;e?i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh):t&&t.length||(t=this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._configuratorViewModel.getComponentsForIds(t).forEach(e=>{e&&(i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh))}),this._pixotron?this._pixotron.highlightObjects(n):this._outlinePass.selectedObjects=n}_shouldRenderUi(){return this._pluginSystem&&this._pluginSystem.needsUiScene()}_renderUi(){const e=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this._camera),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this._camera),this._renderer.autoClear=t,this._scene.background=e}_renderEverything(){this._pixotron&&(this._forceRender=!0,this._updateShadowsAndAO=!0),this._requestRender()}_renderWithoutShadowsAndAO(){this._pixotron&&(this._forceRender=!0,this._updateShadowsAndAO=!1),this._requestRender()}_requestRender(){const e=()=>{this._delta=this._clock.getDelta(),this._animateCamera(),this._camera.layers.mask=65535,this._statsHelper&&this._statsHelper.updateRenderInfo(this._renderer.info),this._pixotron?(this._pixotron.autoShadowsClear=this._updateShadowsAndAO,this._pixotron.autoSAOClear=this._updateShadowsAndAO,this._forceRender&&(this._pixotron.needsUpdate=!0),this._checkLayers(),this._pixotron.render(this._renderer,this._scene,this._camera,this._renderTarget),this._forceRender=!1,this._updateShadowsAndAO=!0,this._pixotron.blit(),this._shouldRenderUi()&&this._renderUi()):(this._renderer.clear(),this._checkLayers(),this._composer.render(),this._renderer.clearDepth(),this._renderer.render(this._uiScene,this._camera),this._renderer.clearDepth()),this._onAfterRender(),this._addonHelper&&this._addonHelper.update(),window.TWEEN&&TWEEN.update(),this._addonHelper&&this._lastChange+1500<Date.now()&&this._addonHelper.isAddOnSpotVisible()&&this._addonHelper.setState(4),this._lastChange+3e3<Date.now()?this._running=!1:(this._running=!0,requestAnimationFrame(e))};if(this._lastChange=Date.now(),!this._running){if(this._running=!0,this._addonHelper&&!this._addonHelper.isAddOnSpotVisible()){let e=this._configuratorViewModel.hasPreviews()?5:3;this._addonHelper.setState(e)}requestAnimationFrame(e)}}_checkLayers(){this._addonHelper&&this._addonHelper.isAddOnSpotVisible()?(this._camera.layers.enable(8),this._configuratorUiCallbacks.onAddonPlusShown()):(this._camera.layers.disable(8),this._configuratorUiCallbacks.onAddonPlusHidden())}_animateCamera(){this._cameraControl&&(this._cameraControl.animateCamera(this._delta)?(this._lightSetting instanceof J&&this._lightSetting.update(this._camera,this._cameraControl.getTargetPosition()),this._pixotron&&(this._pixotron.needsUpdate=!0)):!this._pixotron||this._sceneEventHandler.isDragging()||this._forceRender||(this._pixotron.autoShadowsClear=!1,this._pixotron.autoSAOClear=!1)),this._environment.needsCamera()&&this._environment.updateCamera(this._camera)}resume(){let e=this._domHelper.getClientDimensions(),t=e.x,n=e.y;if(this._renderTarget){const e=Math.floor(t*window.devicePixelRatio),i=Math.floor(n*window.devicePixelRatio);this._renderTarget.setSize(e,i)}this._renderer.domElement.classList.add(C.HSC),this._domHelper.element.appendChild(this._renderer.domElement),this._configuratorInputManager.addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._renderEverything(),this._configuratorViewModel.materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._applySSR(),this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything(),this._applySSR(),this._environment instanceof X&&this._environment.update()}_applySSR(){this._initData.ssr&&this._pixotron&&this._configuratorViewModel.getComponent(this._configuratorContext.rootComponentId).traverse(e=>{e instanceof THREE.Mesh&&!e.material.ssrPass&&this._pixotron.fixMaterial(e)})}pause(){this._configuratorInputManager.removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this),this._configuratorViewModel.materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}destroy(){this.pause(),this.cleanUp()}_setupScene(e){const t=this._domHelper.getClientDimensions(),n=t.x,i=t.y;this._scene=new THREE.Scene,this._scene.background=new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND),this._uiScene=new THREE.Scene,this._componentFactory=f(),this._camera=this._componentFactory.createCamera(30,n/i,.1,20,e),this._camera.position.copy(new THREE.Vector3(0,.5,5)),this._uiIntersectionHelper=new Me(this._camera),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(0,e=>{this._configuratorUiCallbacks.onUiIntersectionChange(e)},this),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(5),this._camera.layers.enable(4);const o={format:THREE.RGBAFormat,minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter},s=THREE.sRGBEncoding,r=Math.floor(n*window.devicePixelRatio),a=Math.floor(i*window.devicePixelRatio);U()?this._renderTarget=new THREE.WebGLMultisampleRenderTarget(r,a,o):this._renderTarget=new THREE.WebGLRenderTarget(r,a,o),this._renderTarget.texture.encoding=s,this._renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(n,i),this._renderer.outputEncoding=s,this._renderer.toneMapping=THREE.LinearToneMapping,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=THREE.PCFSoftShadowMap,this._environmentLoader.setRendererAndScene(this._renderer,this._scene),this._environmentLoader.registerEnvironmentChangedCallback(()=>this._renderEverything()),this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._renderer.domElement.classList.add(C.HSC),this._domHelper.element.appendChild(this._renderer.domElement),this._configuratorInputManager.addEvents(this._renderer.domElement),this._lightSetting=new _e(this._scene),this._composer=new THREE.EffectComposer(this._renderer);let l=new THREE.RenderPass(this._scene,this._camera,null,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND),0);this._composer.addPass(l),this._outlinePass=new THREE.OutlinePass(new THREE.Vector2(n,i),this._scene,this._camera),this._outlinePass.renderToScreen=!0,this._outlinePass.visibleEdgeColor=new THREE.Color(this._initData.colors.SELECTION),this._outlinePass.hiddenEdgeColor=new THREE.Color(this._initData.colors.SELECTION),this._outlinePass.edgeStrength=3,this._outlinePass.edgeThickness=1,this._outlinePass.edgeGlow=0,this._composer.addPass(this._outlinePass),this._composer.setSize(n,i),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._setEnvironment(new Y(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))),this._pluginSystem.init(this._scene,this._uiScene,this._camera.position),this._configuratorViewModel.materialQueue.registerCallback(()=>this._materialLoaded())}_tabVisible(){this.updateSize(!1)}sceneCleared(){this._internalClearScene()}display(e){this._scene.add(e),this._sceneEventHandler.setRootComponentId(e.roomleId),this._requestRender()}debugSceneGraph(e){this._configuratorViewModel.debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){e.material&&e.material.opacity,e.type,e.id,e.roomleId,e.children.length>0&&e.children.forEach(e=>{let n=t+" ";this._printObjectGraph(e,n)})}clearScene(){var e;this._cameraControl.clear(),this._internalClearScene(),this._pixotronUtil&&this._pixotronUtil.lockAdapter(),null===(e=this._sceneEventHandler)||void 0===e||e.cancelSelection(),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this._camera)}_internalClearScene(){this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type&&"Line"!==e.type||this._scene.remove(e)}),this._uiScene.children.forEach(e=>{this._uiScene.remove(e)}),this._configuratorViewModel.sceneCleared(),this._memoryManager.shouldHardReset()&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}async preparePerspectiveImage(e={}){await this._externalMeshesAndMaterialsReady(),this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let t=this._camera.clone(),n=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const i=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();i&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const o=await j(this._scene,t,n,e);return i&&this._dimensionHelper.enableDimensions(),this._lightSetting.addToScene(),this._requestRender(),o}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._configuratorViewModel.getPreviews()&&this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let t=this._camera,n=null;e.useCurrentPerspective||(t=this._camera.clone(),n=this._calculateBoundingBoxOfAllMeshes());const i=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();i&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const o=await G(this._scene,t,n,this._pixotron,this._renderer);return i&&this._dimensionHelper.enableDimensions(),this._requestRender(),o}async preparePartImage(e,t){return new Promise((n,i)=>{this._configuratorViewModel.requestSubPartConstruction(e).then(async e=>{t.size||(t.size=256);let i=this._camera.clone(),o=q((new THREE.Box3).setFromObject(e));const s=new THREE.Scene;s.add(e);const r=await j(s,i,o,t);v(s),n(r)},i)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._configuratorViewModel.getBoundingBox(),q(n,e)}async _externalMeshesAndMaterialsReady(){await this._kernelAccess.externalMeshQueue.finished(!0),await this._configuratorViewModel.materialQueue.finished(!0)}async prepareTopImage(e={}){await this._externalMeshesAndMaterialsReady();const{showDimensions:t=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers(),t&&(await this._initDimensions(),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();let n=this._calculateBoundingBoxOfAllMeshes(.1,t);this._lightSetting.removeFromScene();let i=await z(this._scene,this._uiScene,n,e);return t&&this._dimensionHelper.disableTopDimensions(),this._lightSetting.addToScene(),this._requestRender(),i}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}_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}zoomToComponent(e){this._cameraControl.saveState(!1);let t=e.boundingBox.getSize(new THREE.Vector3),n=this._getYRotationOfObject(e),i=new THREE.Euler(0,n,0),o=e.getWorldPosition(new THREE.Vector3).clone().add(e.boundingBox.getCenter(new THREE.Vector3).applyEuler(i));const s=new THREE.Vector2;this._renderer.getSize(s),this._cameraControl.zoomTo(t,s.width,s.height,i.y,y(15),o)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart(!1)}resetCameraToState(){this._cameraControl.hasSavedState()&&this._cameraControl.resetToState()}resetCameraPositionToStart(e=!0){this._requestRender();const t=this._configuratorViewModel.getBoundingBox();t&&this._cameraControl.reset(t,void 0,void 0,void 0,e)}_clearSelectionAndHovers(){this.cancelSelection(),this._configuratorViewModel.clearRootComponent()}resetPreviews(){this._configuratorViewModel.removePreviews(),this._addonHelper&&this._addonHelper.setState(5),this._requestRender()}changeOffset(e){this._camera.offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}_onWindowResize(){this._configuratorInputManager&&this._configuratorInputManager.updateSize(),this.updateSize()}updateSize(e=!0){const{x:t,y:n}=this._domHelper.getClientDimensions();this._renderer.setSize(t,n),this._camera.aspect=t/n,this._camera.updateProjectionMatrix(),this._updateCameraToBounds(null,e);const i=this._renderer.getPixelRatio();if(this._renderTarget){const e=Math.floor(t*i),o=Math.floor(n*i);this._renderTarget.setSize(e,o)}if(this._pixotron)try{this._pixotron.setSize(t,n)}catch(e){console.warn(e)}this._renderEverything()}setCameraOffset(e){this._camera.offset&&(this._camera.offset=e,this._renderEverything())}getCameraOffset(){return JSON.parse(JSON.stringify(this._camera.offset))}_onKeyDown(e){!e.key||"Escape"!==e.key&&"Esc"!==e.key||(this.cancelSelection(),e.preventDefault()),e.key&&e.key.includes("Shift")&&(this._cameraControl.enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&("Backspace"===e.key||"Delete"===e.key)&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e){e.key&&e.key.includes("Shift")&&(this._cameraControl.disablePanning(),e.preventDefault())}cancelPreviousDockings(){this._cancelDockings(!0,null,!1,!1)}cancelSelection(e){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e)}_cancelSelection(e){this._sceneEventHandler.cancelSelection(),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._configuratorViewModel.removePreviews(),e&&!this._initData.debug&&this.resetCameraToState(),this._kernelAccess.updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel()}_selectComponent(e,t){this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),t||("standard"===this._sceneEventHandler.getSelectionMode()?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds())),this._highlight(e),!this._initData.debug&&t&&this.zoomToComponent(e)}_deselectComponent(e,t){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t),this._highlight()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t),this._highlight())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return g(e,this._camera,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}cleanUp(){this.stopRenderLoop()}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return this._environment&&this._environment instanceof Z||(this._environment=new Z(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),new Promise((t,n)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},n)})}enableHD(e){this._renderer.capabilities.maxTextures>8&&(e?e&&this.loadDynamicLightSetting(e):this.loadDynamicLightSetting(b.createDynamicLightSettingSource(null,w.CAMERA))),this._environment instanceof $&&(this._environment.removeFromScene(),this._environment.loadBackground(L()+ee,new THREE.MeshStandardMaterial)),this.reEnableHD()}reEnableHD(){let e={saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:1.5},shadowparams:{shadowMapResolution:1024,shadowRadius:1,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:50,side:THREE.FrontSide},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:1,edgeThickness:2}};this._pixotron=new window.PIXOTRON.Pixotron(e),this._pixotron.enableAA=!1,this._pixotronUtil=new te(this._pixotron),this._initData.autoQuality&&this._enableAutoQuality(),this._environment instanceof X&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),this._requestRender()}_enableAutoQuality(){this._pixotronUtil.enablePixotronAutoQuality();const e=this._pixotronUtil.getAutoAdapter();this._pixotronUtil.onAutoQualityChange((t,n)=>{this._statsHelper&&this._statsHelper.updateQualityInfo(t);const i=this._pixotronUtil.getLowestQualitySetting();if(this._enableSSR(t.ssr),n&&t.getQuality()<n.getQuality()&&e.getAverageFps()<5&&e.setQualitySetting(i),this._renderer.getPixelRatio()>1&&!t.useDevicePixelRatio){this._renderer.setPixelRatio(1);const{x:e,y:t}=this._domHelper.getClientDimensions();try{this._pixotron.setSize(e,t)}catch(e){console.warn(e)}this._renderTarget&&this._renderTarget.setSize(e,t)}}),this._pixotronUtil.onManualQualityChange((e,t)=>{this._statsHelper&&this._statsHelper.updateQualityInfo(e),this._enableSSR(e.ssr)})}_enableSSR(e=!1){const t=void 0!==this._initData.ssr&&this._initData.ssr;this._pixotron.getSSRPass().enabled=!!t&&e}async loadDynamicLightSetting(e){this._lightSetting=new J(this._scene,this._lightSetting);let t=!1;if(e.url)await this._lightSetting.loadFromURL(e.url),t=!0;else if(e.json)await this._lightSetting.loadFromJSON(e.json),t=!0;else if(e.object)await this._lightSetting.loadFromObject(e.object),t=!0;else if(e.ls){const n=b.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(n.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._renderEverything()}exportGLB(){this._scriptLoader.fetch(K,{id:"gltf-exporter"}).then(()=>{let e=new THREE.GLTFExporter,t=[];this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type||t.push(e)}),e.parse(t,e=>{let t=document.createElement("a");const n=new Blob([e],{type:"model/gltf-binary"});t.href=URL.createObjectURL(n),t.download="scene.glb",t.style.display="none",document.body.appendChild(t),t.click()},{binary:!0,embedImages:!0,forceIndices:!0})})}showGUI(){let e=E();e&&(this._lightSetting&&this._lightSetting.showGUI(),this._pixotron&&this._pixotronUtil.showGUI(),this._environment&&this._environment.showGUI(),this._addGUIListener(e))}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let n=t[e];n.__folders&&Object.keys(n.__folders).forEach(e=>{let n=t[e];this._addGUIListener(n)}),n.__controllers&&n.__controllers.forEach(e=>{e.onFinishChange(()=>{this._requestRender()})})})}zoomIn(e){this._cameraControl.zoomIn(e),this._renderEverything()}zoomOut(e){this._cameraControl.zoomOut(e),this._renderEverything()}showStats(){t.import("./stats-helper-5a5aa20f.legacy.js").then(({default:e})=>this._statsHelper=new e)}async showDimensions(){await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._renderEverything()}async _initDimensions(){this._dimensionHelper||await t.import("./dimensioning-helper-aa9f32c4.legacy.js").then(({default:e})=>{this._dimensionHelper=new e(this._creator_),this._pluginSystem.addPlugin(this._dimensionHelper)})}hideDimensions(){this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}loadSceneSettings(e){let t=new Promise(t=>{(new ne).load(this._scene,this._renderer.domElement,this._environment,e).then(e=>{e&&this._setEnvironment(e),t()})});this._lightSetting=new J(this._scene,this._lightSetting);let n=this._lightSetting.loadFromObject(e);return new Promise((e,i)=>{Promise.all([t,n]).then(()=>{this._renderEverything(),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof Z,e()},i)})}setBackgroundColor(e){this._setEnvironment(new Y(this._scene,this._environment,new THREE.Color(e)))}setBackgroundImage(e){this._setEnvironment(new Y(this._scene,this._environment,null,this._renderer.domElement,e))}setBakedShadow(e,t){this._setEnvironment(new Y(this._scene,this._environment,new THREE.Color(e),this._renderer.domElement,t))}_setEnvironment(e){this._environment=e,this._environment instanceof X&&(this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._renderEverything(),500))),this._renderEverything()}handleEvent(e){switch(e.type){case"resize":this._onWindowResize();break;case"keydown":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyDown(e);break;case"keyup":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyUp(e);break;case"visibilitychange":this._tabVisible()}}_updateCameraToBounds(e,t=!0){e||(e=this._configuratorViewModel.getBoundingBox()),e&&(this._cameraControl.updateToBounds(e,!1,t),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition())}requestDockingsPreview(e,t,n,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelSelection(),i&&this.enableDragIn(n),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._kernelAccess.webGlPreviewDockings(this._configuratorContext,i),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._kernelAccess.previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){const t=s.start("dock_component_"+e.childId);this._kernelAccess.dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null,s.end(t)}_onSelectedRuntimeComponentsChange(e){this._kernelAccess.multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,n=null;e&&(t=e.roomleId===this._configuratorContext.rootComponentId,n=e.roomleId),this._kernelAccess.selectionChange(n,t),e&&this._kernelAccess.selectedComponent(e.roomleId)}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(Array.isArray(e)&&0!==e.length&&t&&-1===e.indexOf(t)){switch(this._configuratorContext.selectionMode){case"standard":this.resetCamera(),this._kernelAccess.requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case"multiselect":this.resetCamera(),this._kernelAccess.requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds)}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){if(e.roomleId===this._configuratorContext.rootComponentId){let t=new THREE.Vector3(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,t,null)}this._addonHelper&&e&&t.addOnSpots&&this._addonHelper.addAddOnSpots(e,t.addOnSpots),void 0===e.geometryChanged||e.geometryChanged?this._renderEverything():this._renderWithoutShadowsAndAO()}planObjectUpdated(e,t){if(e.bounds){if(this._configuratorContext.planObjectId===e.id){const n=S(e.boxForMeasurement);this._updateBounds(n,t)}this._highlight(),this._requestRender()}}componentDeleted(e){this._addonHelper&&this._addonHelper.deleteAddonPointsForComponent(e.roomleId),-1===this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.roomleId)&&"multiselect"!==this._sceneEventHandler.getSelectionMode()||this.cancelSelection()}previewConstructionDone(e,t){const n=this._configuratorViewModel.getBoundingBoxWithPreviews();t||(this._cancelDockings(!0,null,!1,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());let i=!0;this._componentRaycastHelper&&(i=!this._componentRaycastHelper.areAllPreviewsVisible(this._configuratorViewModel)),this._configuratorContext.requestPreviewsIsUserInitiated&&i&&this._updateCameraToBounds(n),this._lightSetting&&this._lightSetting.needsBounds()&&(this._lightSetting.updateBounds(n),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._configuratorViewModel)}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new THREE.Vector3(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):t||this._initData.debug||this.resetCamera(),this._pixotronUtil&&this._configuratorViewModel.materialQueue.finished(!0).then(()=>{this._pixotronUtil.unLockAdapter()}),this._environment&&this._environment.reload()}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks.onComponentPositionsUpdated)return;const e=[];this._configuratorViewModel.getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const n=(new THREE.Box3).setFromObject(t.boundingBoxMesh);let i=this._kernelAccess.kernelInstance.getComponent(t.roomleId);const o=i.parameters||i.possibleChildren?["edit"]:[];e.push({id:t.roomleId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"component",actions:o})}),this._configuratorViewModel.getPreviews().forEach(t=>{const n=(new THREE.Box3).setFromObject(t);e.push({id:t.roomleId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"preview",actions:["add"]})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}getScene(){return this._scene}_updateBounds(e,t=!1){let n=e.getSize(new THREE.Vector3);if(this._sceneEventHandler.hasSelection()||this._updateCameraToBounds(e,!1),this._sceneEventHandler.update(n,null,null),this._uiIntersectionHelper.updateToBounds(n,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._environment.needsBounds()&&this._environment.updateBounds(n,t),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._pixotron&&this._pixotron.getShadowPass().setShadowRecieverBBox(e),this._pixotronUtil){const t=new THREE.Sphere;e.getBoundingSphere(t),this._pixotronUtil.updateBounds(t)}this._camera.updateProjectionMatrix(),this._pluginSystem.updateBounds(e)}updateScene(){const e=this._configuratorViewModel.getBoundingBox();this._updateBounds(e),this._renderEverything()}async moveCamera(e){return this._cameraControl.moveCamera(e)}selectComponent(e){if(!e)return;const t=this._configuratorViewModel.getComponents().find(({roomleId:t})=>t===e);t?this._sceneEventHandler.clickComponent(t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlight(null,e),this._requestRender()}_shouldHighlight(){return this._kernelAccess.kernelInstance.getPlanComponentPossibleChildren(this._configuratorContext.rootComponentId).length>0}}return n([i],e.prototype,"_domHelper",void 0),n([i],e.prototype,"_scriptLoader",void 0),n([i],e.prototype,"_configuratorInputManager",void 0),n([i],e.prototype,"_configuratorUiCallbacks",void 0),n([i],e.prototype,"_configuratorMeshGenerator",void 0),n([i],e.prototype,"_memoryManager",void 0),n([i],e.prototype,"_lifeCycleManager",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_kernelAccess",void 0),n([i],e.prototype,"_componentDimensioningHelper",void 0),n([i],e.prototype,"_configuratorViewModel",void 0),n([i],e.prototype,"_environmentLoader",void 0),n([i],e.prototype,"_pluginSystem",void 0),n([i],e.prototype,"_initData",void 0),e})(),Oe=(()=>{class e{constructor(e){this._activeComponents=[],this._creator_=e}setCamera(e){this._camera=e}add(e){const n=this._kernelAccess.kernelInstance.getComponent(e.roomleId);if(!n)return!1;const i=n.dimensionings;if(!i||0===i.length||this._camera.position.z<0)return!1;const o=S(n.boxForMeasurement),s={x:this._camera.position.x,y:this._camera.position.z};return t.import("./component-dimensioning-104a6bc1.legacy.js").then(t=>{Pe.loadFont("static/rubik_regular-75bd7bb699e9e39d.json").then(n=>{i.forEach(i=>{e.add(new t.default(P(i),o,n,s))})})}),this._activeComponents.push(e),!0}remove(e,n=!0){return new Promise(i=>{t.import("./component-dimensioning-104a6bc1.legacy.js").then(t=>{let o=[];e.children.forEach(e=>{e instanceof t.default&&o.push(e)}),o.forEach(t=>{e.remove(t),v(t)}),n&&V(this._activeComponents,e),i()})})}hasComponentDimensions(){return this._activeComponents.length>0}async reset(){for(const e of this._activeComponents)await this.remove(e);this._activeComponents=[]}clear(){}}return n([i],e.prototype,"_kernelAccess",void 0),e})();e("S",class{constructor(e){this._creator_=e}setScene(e){}setUiScene(e){}updateBounds(e){}clearScene(e,t){}moveCameraEnd(e){}moveCameraStart(e){}needsUiScene(){return!1}});let Te=(()=>{class e{constructor(e){this._plugins=[],this._creator_=e}async init(e,n,i){this._scene=e,this._uiScene=n,this._cameraPosition=i;const{bananaForScale:o}=this._initData;o&&await t.import("./banana-for-scale-d9fdb6d4.legacy.js").then(({default:e})=>this._plugins.push(new e(this._creator_))),this._plugins.forEach(e=>e.setScene(this._scene)),this._plugins.forEach(e=>e.setUiScene(this._uiScene)),this._plugins.forEach(e=>e.updateBounds(this._bounds)),this._plugins.forEach(e=>e.moveCameraEnd(this._cameraPosition))}addPlugin(e){this._plugins.push(e),e.setScene(this._scene),e.setUiScene(this._uiScene),e.updateBounds(this._bounds),e.moveCameraEnd(this._cameraPosition)}updateBounds(e){this._bounds=e,this._plugins.forEach(t=>t.updateBounds(e))}clearScene(e,t){this._plugins.forEach(n=>n.clearScene(e,t))}getActivePlugins(){return this._plugins}getPlugin(e){for(let t of this._plugins)if(t instanceof e)return t;return null}moveCameraEnd(e){this._cameraPosition=e,this._plugins.forEach(t=>t.moveCameraEnd(e))}moveCameraStart(e){this._cameraPosition=e,this._plugins.forEach(t=>t.moveCameraStart(e))}needsUiScene(){return this._plugins.map(e=>e.needsUiScene()).reduce((e,t)=>e||t,!1)}}return n([i],e.prototype,"_initData",void 0),e})();class Ae{constructor(){this._nonTransparentComponent=null,this._raycaster=new THREE.Raycaster,this._raycaster.near=.1,this._raycaster.layers.enable(3)}init(e,t){this._scene=e,this._camera=t,this.checkComponentVisibility=B(this.checkComponentVisibility,100).bind(this),this.checkPreviewVisibility=B(this.checkPreviewVisibility,100).bind(this)}changeMaterialsOnSelect(e,t,n=!1){t!==this._nonTransparentComponent&&(this._nonTransparentComponent=t,this._changeMaterialsOnSelect(e,t,n))}_changeMaterialsOnSelect(e,t,n=!1){if(e.children.length>0&&e.children.forEach(i=>{const o=t&&e.id===t.id||n,s=!(i instanceof THREE.Mesh);this._changeMaterialsOnSelect(i,t,(!o||!s)&&o)}),t)e instanceof THREE.Mesh&&e.material instanceof THREE.MeshStandardMaterial&&!e.userData.oldMaterial&&(e.userData.oldMaterial=e.material,e.material=e.material.clone(),n||I(e,{opacity:.2,transparent:!0}));else if(e.userData.oldMaterial&&e instanceof THREE.Mesh&&e.material instanceof THREE.MeshStandardMaterial){const{opacity:t,transparent:n}=e.userData.oldMaterial;I(e,{opacity:t,transparent:n}),e.userData.oldMaterial=void 0}}isComponentVisible(e){const t=[];e.traverse(e=>t.push(e.uuid));const n=(new THREE.Box3).setFromObject(e).getCenter(new THREE.Vector3),i=(new THREE.Vector3).subVectors(n,this._camera.position).normalize();this._raycaster.set(this._camera.position,i),this._raycaster.far=this._camera.position.distanceTo(n);const o=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{e.object.material.visible&&(t.includes(e.object.uuid)||e.object.userData.ignoreComponentRaycast||o.push(e))}),0===o.length}checkComponentAndPreviewVisibility(e,t){e.hasSelection()?this.checkComponentVisibility(e,t):t.hasPreviews()?this.checkPreviewVisibility(t):this.changeMaterialsOnSelect(this._scene,null)}checkComponentVisibility(e,t){if(!e.hasSelection())return;const n=t.getComponentsForIds(e.getSelectedRuntimeComponentIds());if(n.length>1)return;const i=n[0];this.isComponentVisible(i)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,i)}areAllPreviewsVisible(e){if(!e.hasPreviews())return!0;const t=e.getPreviews();return 0===t.length||t.map(e=>this.isComponentVisible(e)).reduce((e,t)=>e&&t)}checkPreviewVisibility(e){this.areAllPreviewsVisible(e)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,{id:-1})}}var Le=Object.freeze({__proto__:null,default:Ae});const xe=[new k("kernel-access",be),new k("logger",H),new k("rapi-access",R),new k("script-loader",ie),new k("unit-formatter",ve),new k("camera-control-3d",Q),new k("camera-control",oe),new k("configurator-input-manager",class extends W{},1),new k("data-syncer",M),new k("selection-handler",class extends N{constructor(){super(...arguments),this._selectionMode="standard",this._selectedComponents=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedComponents.size&&this._selectedComponents.forEach((e,t)=>{e.deselect(),this._selectedComponents.delete(t),this.dispatchEvent(1,new we({component:e}))})}_checkStandard(e){this._selectedComponents.has(e.roomleId)?this.dispatchEvent(0,new we({component:e,consecutive:!0})):(this._selectedComponents.size>0&&this._selectedComponents.forEach((e,t)=>{this._selectedComponents.delete(t),this.dispatchEvent(1,new we({component:e,resetCamera:!1}))}),this._selectedComponents.set(e.roomleId,e),this.dispatchEvent(0,new we({component:e,consecutive:!1})))}_checkMulti(e){if(this._selectedComponents.has(e.roomleId))return this._selectedComponents.delete(e.roomleId),void this.dispatchEvent(1,new we({component:e,resetCamera:0===this._selectedComponents.size}));this._selectedComponents.set(e.roomleId,e),this.dispatchEvent(0,new we({component:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedComponents.size>0}getSelectedRuntimeComponentIds(){let e=[];return this._selectedComponents.forEach(t=>e.push(t.roomleId)),e}isSelected(e){return this._selectedComponents.has(e.roomleId)}},1),new k("configurator-mesh-generator",de),new k("configurator-ui-callbacks",class extends u{constructor(e){super(e),this.onKernelIsReady=null,this.onComponentPositionsUpdated=null,this.onUpdateParameters=e=>{},this.onUpdatePossibleChildren=(e,t)=>{},this.onUpdatePrice=(e,t)=>{},this.onSelectionChange=(e,t,n,i)=>{},this.onSelectionCancel=()=>{},this.onPartListUpdate=(e,t)=>{},this.onBoundsUpdate=e=>{},this.onLoadConfiguration=()=>{},this.onConfigurationReady=(e,t,n)=>{},this.onOpenTag=e=>{},this.onOpenAddOns=()=>{},this.onClickOutside=()=>{},this.onNoDockingsAvailable=()=>{},this.onUiIntersectionChange=e=>{},this.onZoomChange=(e,t)=>{},this.onDimensionsVisibilityChange=e=>{},this.onErrorDueToOffline=e=>{},this.onError=e=>{},this.onDockingsPreviewRemoved=()=>{},this.onConfigurationHasChildren=e=>{},this.onTrackTiming=(e,t,n,i)=>{},this.onUserInitiatedDockDone=(e,t,n,i,o)=>{},this.onAddonPlusHover=()=>{},this.onAddonPlusHoverOff=()=>{},this.onAddonPlusShown=()=>{},this.onAddonPlusHidden=()=>{},this.onContentProblem=e=>{},this.onSyncStarted=()=>{},this.onSyncDone=()=>{},this.onOpenFloorMaterials=()=>{},this.onOpenPartList=()=>{},this.onComponentLoadError=(e,t)=>{},this.onConfigurationLoadError=()=>{},this.onChangeTypeChangeTag=e=>{},this.onRemoveTypeChangeTag=e=>{},this.onConfigurationLabelChange=(e,t,n)=>{},this.onMemoryCorruption=()=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onConfigurationSaved=e=>{},this.onCameraPositionChanges=()=>{}}},1),new k("scene-helper",De,1),new k("component-dimensioning-helper",Oe,1),new k("plugin-system",Te,1),new k("component-raycast-helper",Ae,0)],Ue=(e,t)=>e.sort||t.sort?e.sort?t.sort?e.sort-t.sort:-1:1:0,Ve=(e,t)=>e&&!t?1:!e&&t?-1:e&&t?e.localeCompare(t):0;let Be=(()=>{class e{constructor(e){this._onInitDoneCollection=[],this._isKernelReady=!1,this._isWebGlReady=!1,this._isPreloadReady=!0,this._isLoadError=!1,this._isReloading=!1,this._needsSync=!1,this._creator_=e,this._configuratorKernelAccessCallback.addListener(this);const t=this._errorHandler;t.subscribe(0,e=>this._configuratorUiCallbacks.onErrorDueToOffline(e)),t.subscribe(1,e=>this._configuratorUiCallbacks.onError(e)),t.subscribe(2,(e,t)=>this._configuratorUiCallbacks.onContentProblem({rapiPath:e,ids:t,message:"Could not load the ids"}))}_isInitDone(){return this._isKernelReady&&this._isWebGlReady&&this._isPreloadReady}_checkInitDone(){this._isInitDone()&&(this._onInitDoneCollection.forEach(e=>e()),this._onInitDoneCollection=[])}_onInitDone(e){this._isInitDone()?e():this._onInitDoneCollection.push(e)}getScene(){return this._sceneHelper.getScene()}updateScene(){this._sceneHelper.updateScene()}_loadWebGlLib(e,t){this._threeLoader.fetch().then(()=>Promise.all(se.map(e=>this._scriptLoader.fetch(e,{id:e}))).then(this._loadingWebGlSuccess(e,t).bind(this),this.loadError.bind(this)),this.loadError.bind(this))}_loadingWebGlSuccess(e,t){return()=>{t&&this._sceneHelper.changeOffset(t);const{initialFloorMaterial:e,dls:n,ls:i,stats:o}=this._initData;let s=b.createDynamicLightSettingSource(n,i);this._enableHD(s),o&&this.showStats(),this._needsSync&&(this._needsSync=!1,this._kernelAccess.requestSync(h,this._configuratorContext.planObjectId));const r=[this._scriptLoader.fetch(re,{id:"tween-js"})];e&&r.push(this._rapiAccess.getMaterial(e).then(e=>this._sceneHelper.changeFloorMaterial(e))),Promise.all(r).then(this._webGlIsReady.bind(this),this.loadError.bind(this))}}_webGlIsReady(){this._isWebGlReady=!0,this._checkInitDone()}_initPromiseCallback(e,t){this._isInitDone()?e():this._isLoadError?t("_initPromiseCallback failed"):(this._onInitDone(()=>e()),this._rejectOnLoadError=t)}_notifyOnConfigurationReady(e){return async t=>{const n=await this._kernelAccess.addUiDataAndPriceToPartList(t.partList,t.hash);t.partList=n,e(t),this._configuratorUiCallbacks.onConfigurationReady(n,t.hash,t.rootComponentLabel)}}_notifyOnConfigurationLoadingError(e){return t=>{this._configuratorUiCallbacks.onConfigurationLoadError(),e(t)}}_loadItemOrConfigById(e,t){this._configuratorContext.lastLoadedRapiId=e,this._onLoadConfiguration(),this._preloadPackage(e),this._clearScene();const{offlineSync:n}=this._initData;if(n){const t=D(e);t&&this._dataSyncer.start(t)}return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(t=>{t&&t.configuration?this._loadConfiguration(t.configuration).then(e=>{const i=this._notifyOnConfigurationReady(n);t.label?this._notifyUiAboutNewItem(t,e.rootComponentLabel):this._notifyUiAboutNewConfiguration(t),i(e)},this._notifyOnConfigurationLoadingError(i).bind(this)):i(new Error("Could not load item or config with id "+e))},i)})}_shouldBroadcastToUi(e){return!(0===e&&this._configuratorContext.selectedRuntimeComponentId||1===e&&!this._configuratorContext.selectedRuntimeComponentId||2===e&&!this._configuratorContext.selectedRuntimeComponentIds.length)}_isCorrectResponse(e,t){if(0===e)return t===this._configuratorContext.planObjectId;if(1===e)return t===this._configuratorContext.selectedRuntimeComponentId;const n=t.length;if(n!==this._configuratorContext.selectedRuntimeComponentIds.length)return!1;for(let e=0;e<n;e++)if(t[e]!==this._configuratorContext.selectedRuntimeComponentIds[e])return!1;return!0}_onLoadConfiguration(){this._clearScene(),this._configuratorUiCallbacks.onLoadConfiguration()}_clearScene(){this._sceneHelper&&this._sceneHelper.clearScene()}_notifyUiAboutNewItem(e,t){this._rapiAccess.getCatalog(e.catalog).then(n=>this._configuratorUiCallbacks.onConfigurationLabelChange(n.name,e.label,t))}_notifyUiAboutNewConfiguration(e){Promise.all([this._rapiAccess.getCatalog(e.catalog),this._rapiAccess.getComponent(e.rootComponentId)]).then(([e,t])=>this._configuratorUiCallbacks.onConfigurationLabelChange(e.name,null,t.label))}_getMaterialGroups(e){const t=(e,t)=>{let n=Ue(e,t);return 0!==n?n:(n=Ve(e.label,t.label),0!==n?n:Ve(e.id,t.id))},n=e=>(e.sort(t),e.forEach(e=>e.materials.sort(t)),e);if(e.validGroups.length>0)return new Promise((t,i)=>this._rapiAccess.getMaterialsByGroup(e.validGroups).then(e=>t(n(e)),i));const i=[];return e.validValues.forEach(e=>i.push(e.value)),new Promise((e,t)=>{this._rapiAccess.getMaterials(i).then(t=>{this._rapiAccess.combineMaterialsToGroups(t).then(t=>{e(n(t))})},t)})}_loadConfiguration(e){return this._kernelAccess.externalMeshQueue.clear(),new Promise((t,n)=>{const i=()=>{const{x:i,y:o}=this._domHelper.getClientDimensions();if(i<=0&&o<=0){let e="Size of canvas is 0/0! When using embedding set correct size or remove id to load in idle mode!";return console.error(e),n(e)}this.resumeKernelCallbacks(),s.start("ui_load_configuration");const r=[];if(this._initData.applyCurrentGlobalParameters){const e=this._configuratorContext.planObjectId,t=this._configuratorContext.rootComponentParametersAsGlobal;r.push(this._kernelAccess.getGlobalParameters(e,t))}Promise.all(r).then(([i])=>{const o=[a.waitFor(4),a.waitFor(2)];Promise.all(o).then(([e,[n,o,s,r]])=>{const a=[];i&&this._initData.applyCurrentGlobalParameters&&i.forEach(e=>a.push(this.setParameter(e,e.value,!0)));const l=this._rapiAccess.peekComponent(r);Promise.all(a).then(()=>{const n=[];a.length&&(n.push(this._kernelAccess.getPartList()),n.push(this._kernelAccess.getConfigurationHash(this._configuratorContext))),Promise.all(n).then(async n=>{const i=n&&n[0]?n[0]:o,r=n&&n[1]?n[1]:s,a=await this._kernelAccess.addUiDataAndPriceToPartList(i,r);let h=e.errors;const c=h?_(h):[];t({partList:a,hash:r,rootComponentLabel:l?l.label:"",errors:c})})})},n),this._kernelAccess.loadConfiguration(e)},n)};this._onInitDone(()=>i())})}_preLoadItemOrConfig(e,t){return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(n,i)})}_preloadPackage(e){this._isPreloadReady=!1;let t=null;t=O(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),s.start("rapi_preloads");const n=()=>{s.end("rapi_preloads");const t=s.getMeasure("rapi_preloads");if(Array.isArray(t)&&1===t.length){const n=t[0];this._configuratorUiCallbacks.onTrackTiming("Timing","RapiPreloads",Math.round(n.duration),{id:e})}};t(e).then(()=>{this._isPreloadReady=!0,this._checkInitDone(),n()},e=>{this._isPreloadReady=!0,this._checkInitDone(),console.error(e),n()})}_reloadConfiguration(e,t,n,i){return this._performLoadConfiguration(e).then(e=>{this._isReloading=!1,n(e)},e=>{this._isReloading=!1,i(e)})}_performLoadConfiguration(e){return this._onLoadConfiguration(),new Promise((t,n)=>{this._initData.preloadHint?this._preloadPackage(this._initData.preloadHint):console.warn("When loading a configuration string you have to supply a preloadHint to use fast loading!"),setTimeout(()=>{this._loadConfiguration(e).then(this._notifyOnConfigurationReady(t).bind(this),this._notifyOnConfigurationLoadingError(n).bind(this))},0)})}_changeHDGeometry(e){return new Promise((t,n)=>e===r.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,a.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,t,n)},n),r.useHDGeometry=e,void this._kernelAccess.changeUseOfHDGeometry(this._configuratorContext,r.useHDGeometry)))}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}init(e,t){this.setOverrides(t);const{preloadHint:n,offset:i,startTag:o}=this._initData;return this._domHelper.setDomElement(e),n?this._preloadPackage(n):console.warn("No preload hint! Therefore no preload during init!!"),o&&this.getTagById(o,{include:["items"]}).then(e=>this._configuratorUiCallbacks.onOpenTag(e),e=>console.error(e)),this._loadWebGlLib(e,i),new Promise(this._initPromiseCallback.bind(this))}cancelSelection(){this._sceneHelper.cancelSelection()}enableHDGeometry(){return this._changeHDGeometry(!0)}disableHDGeometry(){return this._changeHDGeometry(!1)}changeOffset(e){this._sceneHelper.changeOffset(e)}previewDockings(e,t,n){this._sceneHelper.requestDockingsPreview(!0,e,t,n)}cancelDockings(){this._sceneHelper.cancelDockings()}requestDeleteComponent(){this._sceneHelper.requestDeleteSelectedComponent()}renderImage(e){return this._sceneHelper.renderImage(e)}preparePerspectiveImage(e={}){return this._sceneHelper.preparePerspectiveImage(e)}preparePartImage(e,t){let n={};return"number"==typeof t?n.size=t:(t||(t={}),"number"!=typeof t.size&&(t.size=256),n=t),this._sceneHelper.preparePartImage(e,n)}saveCurrentConfiguration(){return new Promise((e,t)=>{this._kernelAccess.getConfigurationData(this._configuratorContext.planObjectId).then(n=>{this._rapiAccess.saveConfiguration(n).then(n=>{this._configuratorUiCallbacks.onConfigurationSaved(n.configurationHash),this._rapiAccess.getComponent(n.rootComponentId).then(i=>{let o=!0,s=!0,r=n.perspectiveImage,a=n.topImage;n.perspectiveImage||(o=!1,this._sceneHelper.preparePerspectiveImage().then(l=>{this._rapiAccess.savePerspectiveImage(n,l).then(t=>{o=!0,r=t.perspectiveImage,s&&(t.label=i.label,t.topImage=a,e(t))},t)})),n.topImage||(s=!1,this._sceneHelper.prepareTopImage().then(l=>{this._rapiAccess.saveTopImage(n,l).then(t=>{s=!0,a=t.topImage,o&&(t.label=i.label,t.perspectiveImage=r,e(t))},t)})),o&&s&&(n.label=i.label,e(n))},e=>{throw new Error(e)})},t)}).catch(t)})}generateImagesOfCurrentConfiguration(){return new Promise((e,t)=>this.saveCurrentConfiguration().then(t=>e({topImage:t.topImage,perspectiveImage:t.perspectiveImage,isLocally:t.isLocally}),t))}prepareTopImage(e){let t={};return"boolean"==typeof e?t.showDimensions=e:(e||(e={}),"boolean"!=typeof e.showDimensions&&(e.showDimensions=!1),t=e),this._sceneHelper.prepareTopImage(t)}resetCameraPosition(){this._sceneHelper.resetCameraPositionToStart()}showBenchmarks(e){s.showBenchmarks(e)}debugSceneGraph(e){this._sceneHelper.debugSceneGraph(e)}async loadConfiguration(e,t){this.setOverrides(t),this._configuratorContext.lastLoadedRapiId=null,this._sceneHelper&&this._sceneHelper.clearScene();const n=await this._performLoadConfiguration(e);return this._rapiAccess.trackView("configuration string"),n}async loadConfigurationById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!0);return this._rapiAccess.trackView(e),n}syncPlanObjectToView(e,t){this.resumeKernelCallbacks(),this._kernelAccess.requestSync(e,t),this._kernelAccess.requestPlanObjectConstruction(t);const n=this._kernelAccess.getSerializedConfiguration(t),i=this._kernelAccess.getCurrentConfigurationHash(t);this._kernelAccess.planObjectConfigurationUpdated(t,n,i),this._sceneHelper.resetCameraPositionToStart(!1)}async loadConfigurableItemById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!1);return this._rapiAccess.trackView(e),n}preLoadConfigurationById(e){return this._preLoadItemOrConfig(e,!0)}preLoadConfigurableItemById(e){return this._preLoadItemOrConfig(e,!1)}_getTag(e){return this._rapiAccess.getTag(e)}_dispatchSetParameter(e,t,n,i,o){const r=this._configuratorContext.selectedRuntimeComponentId?"local":"global",a=s.start("kernel_change_param_"+r+"_"+e);switch(this._configuratorContext.selectionMode){case"standard":if(this._configuratorContext.selectedRuntimeComponentId||this._configuratorContext.rootComponentParametersAsGlobal){let s=this._configuratorContext.selectedRuntimeComponentId?this._configuratorContext.selectedRuntimeComponentId:this._configuratorContext.rootComponentId;this._kernelAccess.changeComponentParameter(s,e,t,n,i,o)}else this._kernelAccess.changePlanObjectParameter(this._configuratorContext.planObjectId,e,t,n,i,o);break;case"multiselect":this._kernelAccess.changeCommonComponentParameter(this._configuratorContext.selectedRuntimeComponentIds,e,t,n,i,o)}s.end(a)}setParameter(e,t,n=!1){return new Promise((i,o)=>{const{key:s,type:r}=e;if(pe(e)){if(!n&&!this._unitFormatter.isParseableUnitString(t,e))return o(new SyntaxError('Value "'+t+'" is not parseable'));const i=n?t:this._unitFormatter.parseValue(t,e),{valueFrom:s,valueTo:a}=e.validRange,l=this._unitFormatter.getAllowedDelta();if(!Number.isNaN(s)&&i<s-l)return o(new RangeError('Value "'+t+'" is too small, min-val "'+s+'"'));if(!Number.isNaN(a)&&i>a+l)return o(new RangeError('Value "'+t+'" is too big, max-val "'+a+'"'));t="Integer"===r&&"number"==typeof i?i.toFixed():i.toString()}this._sceneHelper.cancelDockings(),this._dispatchSetParameter(s,r,t,i,o)})}setParameterOfPlanObject(e,t){return new Promise((n,i)=>{const{planObjectId:o,rootComponentId:s,rootComponentParametersAsGlobal:r}=this._configuratorContext,{type:a,key:l}=e;r?this._kernelAccess.changeComponentParameter(s,l,a,t,n,i):this._kernelAccess.changePlanObjectParameter(o,l,a,t,n,i)})}getParametersOfPlanObject(){const{planObjectId:e,rootComponentParametersAsGlobal:t}=this._configuratorContext;return this._kernelAccess.getGlobalParameters(e,t)}setParameterOfRootComponent(e,t){return new Promise((n,i)=>{const{rootComponentId:o}=this._configuratorContext,{type:s,key:r}=e;this._kernelAccess.changeComponentParameter(o,r,s,t,n,i)})}getParametersOfRootComponent(){const{planObjectId:e}=this._configuratorContext;return this._kernelAccess.getGlobalParameters(e,!0)}enableMultiselect(){this._sceneHelper.setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneHelper.setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}getCurrentConfiguration(){return a.waitFor(1,()=>this._kernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return a.waitFor(0,()=>{let t=null;try{if(t=JSON.parse(e).id,!t)throw new Error("Component string has no ID")}catch(e){return this._configuratorUiCallbacks.onContentProblem({rapiPath:"components",ids:[t],message:"Component string is not a valid JSON or has no ID"}),void a.failOperation(0,e)}this._kernelIo.setMeta({componentId:t}),this._kernelAccess.loadComponentIntoKernel(e,t)})}getShortUrlOfCurrentConfiguration(){return new Promise((e,t)=>{this.saveCurrentConfiguration().then(n=>navigator.onLine?this._rapiAccess.getShortUrl(n.id,3).then(t=>{const n=t.shortId,i=d.APP.SHORTENER_URL+n;e(i)},t):t("Can not generate short url when offline"),t)})}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}getTagById(e,t){return new Promise((n,i)=>{this._getTag(e).then(e=>{let o=Promise.resolve([]),s=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(o=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(s=this._rapiAccess.getItems(e.items))}),Promise.all([o,s]).then(([t,i])=>(i.sort(Ue),t.sort(Ue),n({...e,items:i,materials:t})),i)},i)})}requestAsset(e){return this._dataSyncer.requestAsset(e)}changeFloorMaterial(e){return this._sceneHelper.changeFloorMaterial(e)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._sceneHelper.changeFloorMaterial(t)}openFloorMaterials(){this._configuratorUiCallbacks.onOpenFloorMaterials()}openPartList(){this._configuratorUiCallbacks.onOpenPartList()}getAdditionalContentsOf(e){return this._rapiAccess.getAdditionalContentsOfItems(e)}changeTypeChangeTag(e){navigator.onLine&&this._initData.offlineSync&&this._dataSyncer.syncTypeChangeTag(e),this._configuratorUiCallbacks.onChangeTypeChangeTag(e)}removeTypeChangeTag(e){this._configuratorUiCallbacks.onRemoveTypeChangeTag(e)}showGUI(){const e=document.createElement("style");e.innerText=".dg.ac {right:auto!important}",document.head.appendChild(e),this._scriptLoader.fetch(ae,{id:"dat-gui-js"}).then(()=>this._sceneHelper.showGUI(),e=>console.error(e))}showStats(){this._sceneHelper.showStats()}showDimensions(){this._sceneHelper.showDimensions()}hideDimensions(){this._sceneHelper.hideDimensions()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}syncFloorTag(e){return this._dataSyncer.syncFloorTag(e)}syncTypeChangeTag(e){return this._dataSyncer.syncTypeChangeTag(e)}loadDynamicLightSetting(e){return this._sceneHelper.loadDynamicLightSetting(e)}setBackgroundColor(e){this._sceneHelper.setBackgroundColor(e)}setBackgroundImage(e){this._sceneHelper.setBackgroundImage(e)}setBakedShadow(e,t){this._sceneHelper.setBakedShadow(e,t)}loadSceneSetting(e){return this._sceneHelper.loadSceneSettings(e)}enableMeshSelection(e){this._initData.meshSelection=e}updateSize(){this._sceneHelper.updateSize()}setCameraOffset(e){this._sceneHelper.setCameraOffset(e)}getCameraOffset(){return this._sceneHelper.getCameraOffset()}getMain(){}cleanup(){this._configuratorContext.selectedRuntimeComponentIds=[],this._sceneHelper.sceneCleared(),this._kernelAccess.cleanUpCallbacks()}resumeTest(e){e&&this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}zoomIn(e){this._sceneHelper.zoomIn(e)}zoomOut(e){this._sceneHelper.zoomOut(e)}get callbacks(){return this._configuratorUiCallbacks}get globalCallbacks(){return this._globalCallback}getRuntimeComponentIdOfRootComponent(){const e=this._configuratorContext.planObjectId;return e?this._kernelAccess.getRuntimeComponentIdOfRootComponent(e):(console.warn("planObjectId not set"),0)}getCurrentConfigurationHash(){return this._kernelAccess.getConfigurationHash(this._configuratorContext)}getCurrentSelection(){let e=this._configuratorContext.selectedRuntimeComponentIds;return e&&e.length||(e=[this._configuratorContext.rootComponentId]),e.map(e=>this._kernelAccess.getRuntimeComponentId(e))}_enableHD(e){return new Promise((t,n)=>{this._scriptLoader.fetch(le,{id:"pi-js"}).then(()=>{this._sceneHelper.enableHD(e),t()},n)})}isReady(){const e=s.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=s.getMeta("kernel_is_ready");this._configuratorUiCallbacks.onTrackTiming("Timing","KernelIsReady",Math.round(t.duration),Object.assign(n,{startTime:t.startTime}))}this._isKernelReady=!0,this._checkInitDone(),"function"==typeof this._configuratorUiCallbacks.onKernelIsReady&&this._configuratorUiCallbacks.onKernelIsReady()}updatePossibleChildren(e,t,n){const i=[],o=[];let s;const r=new Map,a=new Map;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n.possible)continue;let l=n.itemId;n.itemId?(o.push(n.itemId),a.set(n.itemId,n)):(i.push(n.componentId),r.set(n.componentId,n),l=n.componentId),n.isDefault&&!s&&(s=l)}Promise.all([this._rapiAccess.getComponents(i),this._rapiAccess.getItems(o)]).then(e=>{const t=[],n=e[0],i=e[1];let o;for(let e=0,i=n.length;e<i;e++){const i=n[e];i.isItem=!1,i.isComponent=!0;const a=r.get(i.id);a&&(i.group=a.group),i.id===s&&(i.isDefault=!0,o=i),t.push(i)}for(let e=0,n=i.length;e<n;e++){const n=i[e];n.isItem=!0,n.isComponent=!1;const r=a.get(n.id);r&&(n.group=r.group),n.id===s&&(n.isDefault=!0,o=n),t.push(n)}return t.sort(Ue),{possibleChildren:t,defaultChild:o||null}}).then(({possibleChildren:e,defaultChild:t})=>{const n=[],i=new Map,o=[];for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.tags;if(s.tags&&Array.isArray(s.tags)&&s.tags.length)for(let e=0,t=s.tags.length;e<t;e++){const t=r[e];-1===n.indexOf(t)&&n.push(t);let o=i.get(t);if(!o){const e=[];i.set(t,e),o=i.get(t)}o.push(s)}else o.push(s)}return{tagIds:n,associations:i,defaultChild:t,noTagChilds:o}}).then(({tagIds:t,associations:i,defaultChild:o,noTagChilds:s})=>{this._rapiAccess.getTags(t).then(t=>{if(this._isCorrectResponse(n,e)&&this._shouldBroadcastToUi(n)){for(let e=0,n=t.length;e<n;e++){const n=t[e];n.possibleChildren=i.get(n.id)}t.sort(Ue),s.length&&t.unshift({id:"",externalIdentifier:"",global:!1,created:(new Date).toISOString(),updated:(new Date).toISOString(),language:this._globalInitData.locale,catalog:null,tags:[],parents:[],materials:[],items:[],possibleChildren:s}),this._configuratorUiCallbacks.onUpdatePossibleChildren(t,o)}},e=>{console.error("Couldnt load tags of possible children"),console.error(e)})},e=>console.error(e))}updateParameters(e,t,n,i){const o={};t||(t=[],console.warn("Kernel returned no parameter groups! Check why!")),t.forEach(e=>{o[e.key]=e}),e.sort(Ue),e.forEach(e=>{e.group?e.grouping=o[e.group]:e.grouping=null,this._unitFormatter.formatParameter(e),ge(e)&&Object.defineProperty(e,"groups",{get:()=>new Promise((t,o)=>{this._getMaterialGroups(e).then(e=>{this._isCorrectResponse(i,n)&&this._shouldBroadcastToUi(i)?t(e):o("Response does not match to ids")},o)})})}),this._shouldBroadcastToUi(i)&&this._configuratorUiCallbacks.onUpdateParameters(e)}loadError(e){this._isLoadError=!0,this._rejectOnLoadError&&this._rejectOnLoadError(e)}resumeKernelCallbacks(){this._kernelAccess.muteKernelCallbacks=!1,this._kernelAccess.resume()}pauseKernelCallbacks(){this._kernelAccess.muteKernelCallbacks=!0,this._kernelAccess.pause()}setActiveGroupInView(e){this._kernelAccess.setActiveGroupInView(e)}getParameterGroups(){return this._kernelAccess.getParameterGroups()}async getConfiguratorSettings(e){return this._rapiAccess.getConfiguratorSettings(e)}async moveCamera(e){return this._sceneHelper.moveCamera(e)}selectComponent(e){return this._configuratorContext.selectedRuntimeComponentId===e?Promise.resolve():Promise.resolve(this._sceneHelper.selectComponent(e))}setComponentParameter(e,t,n){const{key:i,type:o}=t;return new Promise((t,s)=>this._kernelAccess.changeComponentParameter(e,i,o,n,t,s))}highlightParts(e){this._sceneHelper.highlightParts(e)}}return n([i],e.prototype,"_rapiAccess",void 0),n([i],e.prototype,"_dataSyncer",void 0),n([i],e.prototype,"_errorHandler",void 0),n([i],e.prototype,"_unitFormatter",void 0),n([i],e.prototype,"_domHelper",void 0),n([i],e.prototype,"_configuratorUiCallbacks",void 0),n([i],e.prototype,"_configuratorKernelAccessCallback",void 0),n([i],e.prototype,"_lifeCycleManager",void 0),n([i],e.prototype,"_kernelAccess",void 0),n([i],e.prototype,"_threeLoader",void 0),n([i],e.prototype,"_scriptLoader",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_sceneHelper",void 0),n([i],e.prototype,"_initData",void 0),n([i],e.prototype,"_globalInitData",void 0),n([i],e.prototype,"_globalCallback",void 0),n([i],e.prototype,"_kernelIo",void 0),e})();class Fe extends he{setupDependencies(){T.setup(xe),this.lookup("kernel-access",this._context),this.lookup("rapi-access",this._context),this.lookup("script-loader",this._context),this.lookup("logger",this._context)}cleanUpGlobals(){delete window.RoomleConfigurator}cleanUpDependencies(){const e=this.lookup("script-loader"),t=this.lookup("rapi-access"),n=(this.lookup("dom-helper"),this.lookup("scene-helper"));e&&e.cleanUp(),t&&t.cleanUp(),n&&n.cleanUp()}setupGlobals(e){const{kernelInstance:t,kernelContainer:n,planObjectId:i}=e||{};r.init({kernelInstance:t,kernelContainer:n,planObjectId:i})}getApi(){return this._configurator}bootFinished(){this._configurator=new Be(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}}e("C",Fe),e("c",Object.freeze({__proto__:null,Configurator:Fe}))}}}));
|
|
2
|
-
//# sourceMappingURL=configurator-6b788202.legacy.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./rapi-access-41e0190e.legacy.js","./mesh-generator-8b81c1d2.legacy.js"],(function(e){var t,r,a,s;return{setters:[function(e){t=e.O,r=e.Q,a=e.S},function(e){s=e.M}],execute:function(){e("C",class extends s{constructor(e){super(e),this._geometryComponentMaterialCache=new Map,this._configuratorPreviewMaterial=new THREE.MeshStandardMaterial({color:t,transparent:!0,opacity:r,roughness:a,envMap:null}),this._environmentLoader.setEnvMap(this._configuratorPreviewMaterial)}generateMesh(e=0,t=null,r,a,s,n,i,o=!1){let h;h=o?this._generateGeometry(t,a,s,n,i).clone():this._generateGeometry(t,a,s,n,i);const c=this._createMesh(e,t,h);return c.userData.materialId=r,c.layers.set(3),r&&this.materialQueue.push(this._assignMaterial(c,r).then(()=>{e&&t&&this._geometryComponentMaterialCache.set(this._getComponentMeshId(e,t),r)})),c}_createMesh(e,t,r){if(e&&t){const a=this._getComponentMeshId(e,t);if(this._geometryComponentMaterialCache.has(a)){const e=this._geometryComponentMaterialCache.get(a);if(this._cacheHolder.materialCache.has(e)){const t=this._cacheHolder.materialCache.get(e);return new THREE.Mesh(r,t)}}}return new THREE.Mesh(r,this._configuratorPreviewMaterial.clone())}_getComponentMeshId(e,t){return e+"_"+t}setMaterial(e,t,r){return this._assignMaterial(e,t)}loadMaterial(e,t,r){return super._loadMaterial(e,t,r)}loadTextures(e,t,r,a){return super._loadTextures(e,t,r,a)}})}}}));
|
|
2
|
-
//# sourceMappingURL=configurator-mesh-generator-7731c94d.legacy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configurator-mesh-generator-7731c94d.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-light-setting-78b9795d.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dimensioning-helper-aa9f32c4.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./rapi-access-41e0190e.legacy.js","./main-thread-to-worker-66323030.legacy.js","./pixotron-e22efd52.legacy.js","./default-light-setting-78b9795d.legacy.js"],(function(e){var t,n,r,i,o,a,s,l,c,d,h,u,_,p,g,b,m,E,f,C,y,R,j,w,P,O,H,M;return{setters:[function(e){t=e.V,n=e.J,r=e.W,i=e.e,o=e.X,a=e.O,s=e.Y,l=e.Q,c=e.Z,d=e.$,h=e._,u=e.i,_=e.a0,p=e.C,g=e.B,b=e.E,m=e.M,E=e.a1,f=e.s,C=e.j,y=e.a2,R=e.a3,j=e.t,w=e.h},function(e){P=e.k},function(e){O=e.E,H=e.L},function(e){M=e.D}],execute:function(){e("G","static/GLTFExporter-86edae059df3a219.js");class x{constructor(){this._promiseExecutors=[]}create(){return new Promise((e,t)=>{this._promiseExecutors.push({resolve:e,reject:t})})}resolve(e){return new Promise(t=>{this._promiseExecutors.forEach(t=>t.resolve(e)),this._promiseExecutors=[],t(e)})}reject(e){return new Promise((t,n)=>{this._promiseExecutors.forEach(t=>t.reject(e)),this._promiseExecutors=[],n(e)})}}class v extends class{constructor(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getKernelObject(){return this._coreReference}}{constructor(e){super(e),this._objectWaiter=new x;const r=t(e.getCenter());this._container=new THREE.Object3D,this._container.position.copy(r),this._boundingBox=this._generateBoundingBox(this.getSize(),e.customColor),n(this._boundingBox),this._container.add(this._boundingBox),2!==this.getPlanElement().getType().value&&(this._object=new THREE.Object3D,this._container.add(this._object))}getSize(){return this._object?(new THREE.Box3).setFromObject(this._object).getSize(new THREE.Vector3):new THREE.Vector3}update(){this._container.position.copy(t(this.getPlanElement().getCenter()))}getPosition(){return this._container.position}getRotation(){return this._container.rotation.y}getBounds(){let e=new THREE.Box3;return e.setFromObject(this._container),e}getBoundingBox(){return this._boundingBox}getPlanElement(){return this._coreReference}setObject(e){this._object=e,this._objectWaiter.resolve(e)}getObject(){return this._object}async getObjectAsync(){return this._object?Promise.resolve(this._object):this._objectWaiter.create()}addMesh(e){this._object.add(e),this.hidePreviewBox()}getMesh(e){if(!this._object||0===this._object.children.length)return null;const t=r(e,this.getPlanElement().getType());return this._object.children.find(e=>e.userData.material===t)}getContainer(){return this._container}getId(){return this.getPlanElement().getId()}clear(){i(this._container),this._selectionMesh&&i(this._selectionMesh)}hidePreviewBox(){this._container&&this._boundingBox&&(this._boundingBox.material=o())}_generateBoundingBox(e,t){e.addScalar(.01);let n=new THREE.BoxGeometry(e.x,e.y,e.z),r=new THREE.Color(a);t>0&&(r=s(t));let i=new THREE.MeshStandardMaterial({color:r,opacity:l,transparent:!0}),o=new THREE.Mesh(n,i);return o.name="bounding box",o.position.y=e.y/2,o.castShadow=!1,o.receiveShadow=!1,o.layers.set(5),o}select(){if(!this._selectionMesh){let e=new THREE.MeshStandardMaterial({color:this._primaryColor,opacity:l,transparent:!0});const n=t(this.getPlanElement().getCenter());this._selectionMesh=new THREE.Mesh(c(n,this.getSize()),e)}this._container.add(this._selectionMesh)}deselect(){this._selectionMesh&&this._container.remove(this._selectionMesh)}setPrimaryColor(e){this._primaryColor=e}}class T extends v{constructor(e){super(e),this._container.rotation.y=e.rotation}getPlanObject(){return this.getPlanElement()}getSize(){return d(this.getPlanObject().size)}update(){super.update(),this._container.rotation.y=this.getPlanObject().rotation}}class I extends T{constructor(e){super(e),this._container.name="Configurable "+this._container.name}addRootComponent(e){this.setObject(e),this._container.add(this.getObject())}getConfigurationRuntimeId(){return this.getPlanObject().getConfigurationRuntimeId()}}e("C",I);let k=e("b",(()=>{class e extends T{constructor(e){super(e),this._container.name="Static "+this._container.name}setRapiItem(e){return this._addStaticItem(e)}_addStaticItem(e){this._rapiItem=e;let t=this.getPlanObject();this._glbUrl=P(e);let r=e.scaleable?d(t.size):void 0,i=new THREE.Vector3(1,1,1);return t.flipX&&(i.x*=-1),t.flipY&&(i.z*=-1),new Promise(o=>{this._staticItemLoader.loadGLB(this._glbUrl,void 0,void 0,r,i,t.customColor,e.colorable).then(t=>{t.name=e.label,this.setObject(t),_(t,this._glbUrl),n(t),this._container.add(this.getObject()),this.hidePreviewBox(),o()})})}getRapiItem(){return this._rapiItem}needsRapiItem(){return!this._glbUrl}getGLBUrl(){return this._glbUrl}}return h([u],e.prototype,"_staticItemLoader",void 0),e})());class L extends v{constructor(e){super(e),this._container.name="Wall Plan Element"}addMesh(e){super.addMesh(e);const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,t.y,t.z),this._boundingBox.position.y=t.y/2}}class D extends v{constructor(e){super(e),this._container.name="Floor Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}class S extends v{constructor(e){super(e),this._container.name="Ceiling Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}let B=e("P",(()=>{class e extends p{constructor(e){super(e,0),this._plannerKernelCallbackListener=new Set,g.addMeta("kernel_is_ready",{isWasm:this._useWASM}),this._scriptLoader.fetch(this._kernelPath,{id:"kernel"}).then(this._loadSuccess.bind(this),this._loadError.bind(this))}get kernelContainer(){return this._kernelContainer}_loadSuccess(){window.RoomleCore(this._kernelContainer)}_loadError(){console.error("kernel load error")}_createPlanInteractionHandler(){const e=this._kernelContainer;this._planInteractionHandler=new e.PlanInteractionHandler,this._planInteractionHandler.init(this._planInteractionHandler,1,100,!0,!0,e.DrawingType.CLICK_PER_CLICK),this._roomlePlannerUiCallback.onPlanInteractionHandlerCreated(this._planInteractionHandler)}addPlannerListener(e){this._plannerKernelCallbackListener.add(e)}removePlannerListener(e){this._plannerKernelCallbackListener.delete(e)}isReady(){super.isReady(),this.registerCallbacks(),this._roomlePlannerUiCallback.onPlannerKernelIsReady(this._kernelContainer),this._createPlanInteractionHandler();const e=this._planInteractionHandler.getConfiguratorKernel();this._kernelInstance=e,this._roomlePlannerUiCallback.onConfiguratorKernelIsReady(this._kernelContainer,e),b.isProduction||(window.__RML__DEBUG__.ConfiguratorKernel=this._kernelInstance,window.__RML__DEBUG__.PlannerKernelContainer=this._kernelContainer),this._kernelAccessCallback.isReady()}get callbacks(){return this._roomlePlannerUiCallback}get planInteractionHandler(){return this._planInteractionHandler}get planModelViewHelper(){return this._kernelContainer.PlanModelViewHelper}catalogItemLoaded(e){const t=this._rapiItemToKernelItem(e);this._kernelContainer.catalogItemLoaded(t)}async insertItems(e){let t=new this._kernelContainer.CatalogItemPtrList;e.forEach(e=>{let n=e.count||1;for(let r=0;r<n;r++)e.count||(e.count=0),t.push_back(this._rapiItemToKernelItem(e))}),this._planInteractionHandler.addPlanObjects(t);const n=this._planInteractionHandler.getPlan().extRef.jsObject;await Promise.all(n.getStaticPlanObjectViewModels().map(async e=>{if(e.needsRapiItem()){const t=await this._rapiAccess.getItem(e.getPlanObject().getCatalogItemId());e.setRapiItem(t)}}))}_rapiItemToKernelItem(e){let t=new this._kernelContainer.CatalogItem(e.id),n=t.size;return n.x=e.width||0,n.y=e.depth||0,n.z=e.height||0,t.size=n,t.flipable=e.flipable,e.layer&&(t.layer=e.layer),t.orderable=e.orderable,t.scaleable=e.scaleable,t.type=e.type||"other",t.detailType=e.detailType||t.type||"other",t.configuration=e.configuration||"",t}onLoadComponentError(e,t){}configurationLoaded(e,t,n,r,i){}componentDefinitionLoaded(e,t){}componentDefinitionLoadingError(e,t){}configurationLoadingError(){}componentConfigurationUpdated(e){}componentParameters(){}requestComponentDimensions(){}planObjectCreated(e,t){}planObjectUpdated(e){}planObjectConfigurationUpdated(e,t,n){}planObjectDeleted(){}requestPlanObjectDimensions(){}cleanUpCallbacks(){super.cleanUpCallbacks(),this._kernelContainer.unregisterPlannerCallback(this)}registerCallbacks(){super.registerCallbacks(),this._kernelContainer.registerPlannerCallback(this)}async requestExternalMesh(e,t){let n;try{n=await this._rapiAccess.getMesh(e,m,t)}catch(e){throw console.error(e),e}try{const r=await fetch(new Request(this._dataSyncer.requestAsset(n.url,!0))),i=await r.arrayBuffer();await this._handleCortoMesh(i,e,t)}catch(e){throw console.error(e),e}}Editor3dRootComponentCreated(e,t,n,r){this._configuratorKernelCallbackListener.forEach(i=>i.Editor3dComponentCreated(e,t,n,r,!0))}Editor3dPlanObjectConstructionDone(e){}Editor3dBeginGroup(){}Editor3dEndGroup(){}Editor3dSetMaterial(){}Editor3dLoadMaterial(){}Editor3dAddDockPreview(e,t){}Editor3dSetPreviewPointAssociations(e,t){}Editor3dSetPreviewLineAssociations(e,t){}Editor3dPreviewConstructionDone(e,t){}Editor3dTranslateBy(){}Editor3dRotateBy(){}Editor3dRotateAround(){}Editor3dAddCube(){}Editor3dAddCubeUVMod(){}Editor3dAddSphere(){}Editor3dAddSphereUVMod(){}Editor3dAddRectangle(){}Editor3dAddRectangleUVMod(){}Editor3dAddMesh(){}Editor3dAddMeshUVMod(){}Editor3dAddMeshUVCoord(){}Editor3dAddCylinder(){}Editor3dAddCylinderUVMod(){}Editor3dAddPrism(){}Editor3dAddPrismUVMod(){}Editor3dAddFittingPoint(){}Editor3dAddFittingLine(){}Editor3dSelectObject(){}Editor3dCopy(){}Editor3dUpdatePlanObjectPosition(){}Editor3dUpdatePlanObjectRotation(){}Editor3dUpdatePlanObjectTransform(){}Editor3dUpdatePlanComponentPosition(){}Editor3dUpdatePlanComponentRotation(){}Editor3dUpdatePlanComponentTransform(){}planElementRemoved(e){this._plannerKernelCallbackListener.forEach(t=>t.planElementRemoved(e)),this._plannerKernelCallbackListener.forEach(t=>t.removePlanObjectFromScene(e.extRef.jsObject)),this._decoupleReferences(e)}handlerSwitchedPlans(e,t){if(this._decoupleReferences(e),t){let e=new V(this._creator_);e.setReference(t),this._coupleReferences(e,t),this._plannerKernelCallbackListener.forEach(t=>t.handlerSwitchedPlans(e))}}planBoundsChanged(){this._plannerKernelCallbackListener.forEach(e=>e.planBoundsChanged())}planCleared(){}planCompletelyLoaded(e){this._plannerKernelCallbackListener.forEach(t=>t.planCompletelyLoaded(e))}planElement3dMeshChanged(e,t){if(t.extRef){const e=t.extRef.jsObject;for(let t=e.getObject().children.length-1;t>=0;t--)e.getObject().remove(e.getObject().children[t])}this.planModelViewHelper.requestMesh3d(t)}planElementAdded(e,t){if(e&&e.extRef)if(t.getType()===this._kernelContainer.PlanElementType.OBJECT){let n,r=t;r.hasConfiguration()?(n=new I(r),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n)):(n=new k(r),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n)),this._plannerKernelCallbackListener.forEach(e=>e.addPlanObjectToScene(n))}else{let n,r=t;if(t.getType()===this._kernelContainer.PlanElementType.WALL?n=new L(r):t.getType()===this._kernelContainer.PlanElementType.FLOOR?n=new D(r):t.getType()===this._kernelContainer.PlanElementType.CEILING&&(n=new S(r)),!n)return;n.setPrimaryColor(this._initData.colors.PRIMARY),this._coupleReferences(n,r),e.extRef.jsObject.addPlanElementViewModel(n),this.planModelViewHelper.requestMesh3d(t)}}planElementChanged(e,t){if(t.extRef){let n=t.extRef.jsObject;n.update(),this._plannerKernelCallbackListener.forEach(t=>t.planElementChanged(e,n))}}planHistoryStateChanged(){}planObjectConfigurationCreated(e,t){}planObjectConfigurationLoaded(e,t,n){e&&e.extRef&&t&&t.extRef&&t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId()>0&&this._plannerKernelCallbackListener.forEach(r=>r.planObjectConfigurationLoaded(e,t,n))}requestCatalogItem(e){}startedDrawing(){}stoppedDrawing(){}updateMesh2d(){}beginConstruction(){}addMesh(e,t,n,r,i,o){this._plannerKernelCallbackListener.forEach(a=>a.addMesh(e,t,n,r,i,o))}endConstruction(){}beginPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.beginPlanConstruction(e))}addPlanMesh(e,t,n,r,i,o,a){this._plannerKernelCallbackListener.forEach(s=>s.addPlanMesh(e,t,n,r,i,o,a))}endPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.endPlanConstruction(e))}addPlanObjectFromItem(e,t,n){if(!t&&!n)return this.insertItems([e]);n=n||0===n?n:0,t=t||{x:0,y:0,z:0};const r=this._rapiItemToKernelItem(e);return this._planInteractionHandler.addPlanObjectFromItem(r,t,n)}_coupleReferences(e,t){let n=new this._kernelContainer.EMSReference;n.jsObject=e,t.extRef=n}_decoupleReferences(e){e&&e.extRef&&(e.extRef.jsObject.clearReference(),e.extRef.jsObject=null,e.extRef.delete(),e.extRef=null)}}return h([u],e.prototype,"_kernelAccessCallback",void 0),h([u],e.prototype,"_roomlePlannerUiCallback",void 0),h([u],e.prototype,"_initData",void 0),e})()),V=(()=>{class e extends E{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionGroup=new THREE.Group,this._constructionGroup.name="Construction",this._ceilingGroup=new THREE.Group,this._getKernelAccess().addPlannerListener(this)}planBoundsChanged(){}_getKernelAccess(){return f.lookup("planner-kernel-access",this._creator_)}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null,super.clearReference()}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof I?this._configurablePlanObjectViewModels.push(e):e instanceof k?(this._staticPlanObjectViewModels.push(e),"door"!==e.getPlanObject().getObjectType()&&"window"!==e.getPlanObject().getObjectType()&&this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof L?(this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),this._constructionGroup.add(e.getContainer())):(e instanceof D||e instanceof S)&&this._constructionGroup.add(e.getContainer())}_addRootComponent(e){const t=this._getPlanObjectViewModelForRuntimeId(e.parentObjectId);t&&t instanceof I&&(t.addRootComponent(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(t),t.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getPlanObjectForId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),this._staticPlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),t}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getBoundingBox(){const e=this.getCorePlan();return e?C(e.getBounds()):(new THREE.Box3).setFromObject(this._constructionGroup)}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}sceneCleared(){this._configurablePlanObjectViewModels.forEach(e=>{e.clear()}),this._staticPlanObjectViewModels.forEach(e=>{e.clear()}),super.sceneCleared()}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getComponent(e){return this._components.get(e)}_generateMesh(e=0,t=null,n,r,i,o,a,s,l){return this._plannerMeshGenerator.generateMesh(t,n,r,i,o,a,s,l)}_setMaterial(e,t,n){this._plannerMeshGenerator.setMaterial(e,t)}Editor3dComponentCreated(e,t,n,r,i){super.Editor3dComponentCreated(e,t,n,r,i),this._getKernelAccess()instanceof B&&this.dockComponent(e,r,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e){this._constructionGroup.clear(),this._ceilingGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,r,i,o,a){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){}addMesh(e,t,n,r,i,o){const a=e.extRef.jsObject;let s=a.getMesh(t);s?s.geometry=this._plannerMeshGenerator.generateGeometry(null,n,r,i,o):(s=this._generateMesh(0,null,t,n,r,i,o,e.getType()),a.addMesh(s))}removePlanObjectFromScene(e){}planElementRemoved(e){if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.OBJECT){let t=e;if(t.hasConfiguration()){const e=t.extRef.jsObject,n=this._configurablePlanObjectViewModels.indexOf(e);n>-1&&this._configurablePlanObjectViewModels.splice(n,1)}else{const e=t.extRef.jsObject,n=this._staticPlanObjectViewModels.indexOf(e);n>-1&&this._staticPlanObjectViewModels.splice(n,1)}}}getMeshGenerator(){return this._plannerMeshGenerator}}return h([u],e.prototype,"_plannerMeshGenerator",void 0),e})();const G=j(30);class A extends O{constructor(e,t,n,r){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===r?1:r,this._scene=e,this._camera=t,this._raycaster=new THREE.Raycaster,this._raycaster.layers.enableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(e){this._raycaster.layers=e}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(6,e=>{this._findHover(e.positionRelative,e.type)},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){this._intersection(e)&&this._inputManager.onElementHit()}_findSelection(e){let t=this._intersection(e);t?t&&t.object.dispatchEvent({type:"select"}):this.dispatchEvent(3)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(e,this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(e,this._camera);let t,n=new THREE.Vector3(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._scene.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t);if(e){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,r=new THREE.Vector3(0,0,0),i=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,r),this._raycaster.ray.intersectPlane(this._planeSide,i);let o,a=this._getDistanceToCamera(i),s=this._getDistanceToCamera(r);return n>=-G&&n<=G?o=t<s?e.clone():r.clone():t<s&&t<a?o=e.clone():s<t&&s<a?o=r.clone():a<t&&a<s&&(o=i.clone()),o}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return y(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new THREE.Vector3).x+e.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(e.getWorldQuaternion(new THREE.Quaternion)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof THREE.Mesh&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&R(this._currentDrag),this._currentHover&&R(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setScene(e){this._scene=e}setMode(e){this._mode=e}}e("S",class extends O{constructor(e,t,n,r){super(),this._debug=!1,this._dragIn=!1,this._inputManager=r,this._raycastHelper=new A(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}});class U extends H{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),1.2),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!1}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=w();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}}}let K=null;const z=()=>(K||(K=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),K.outputEncoding=THREE.sRGBEncoding,K.gammaFactor=2.2),K),F=(e("g",(e,t=0)=>{if(!e){const e=new THREE.Vector3;return{center:e,bounds:e,diagonal:0}}const n=e.getSize(new THREE.Vector3);return n.addScalar(t),{center:e.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}}),e("p",(e,t,n,r={})=>new Promise(i=>{const{size:o=1024}=r,a=z();a.setSize(o,o);const s=e.fog?e.fog.clone():null,l=e.background?e.background.clone():null;e.background=null,e.fog=null;let c=new M(e);t.layers.disable(2),t.layers.disable(5),F(t,n,-20,-30),a.render(e,t);const d=a.domElement.toDataURL();t.layers.enable(2),e.background=l,e.fog=s,c.removeFromScene(),i({image:d,width:o,height:o,blob:null})})),e("r",(e,t,n,r,i,o)=>new Promise(r=>{o||(o=1024);const i=z();i.setSize(o,o);const a=e.fog?e.fog.clone():null,s=e.background?e.background.clone():null;e.background=null,e.fog=null,t.layers.disable(2),t.layers.disable(5),n?F(t,n,-20,-30):(t.aspect=1,t.updateProjectionMatrix()),i.render(e,t);const l=i.domElement.toDataURL();t.layers.enable(2),e.background=s,e.fog=a,r({image:l,width:o,height:o,blob:null})})),(e,t,n,r)=>{e.far=1e3,e.fov=15,e.aspect=1,e.position.copy(t.center),e.rotation.set(0,0,0),e.rotateY(j(r)),e.rotateX(j(n)),e.translateZ(3.8*t.diagonal),e.updateProjectionMatrix()});e("a",(e,t,n,r={})=>{const{showDimensions:i=!1}=r;return new Promise(r=>{const o=z();o.autoClear=!1;let a=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);a.position.copy(n.center),a.rotateX(j(-90)),a.translateZ(n.bounds.y+1),a.far=a.position.y+.5,a.layers.mask=65535;let s=200*n.bounds.x,l=200*n.bounds.z;if(s>4096||l>4096){let e=0;s>4096?e=s/4096:l>4096&&(e=l/4096),s/=e,l/=e}o.setSize(s,l);let c=e.fog?e.fog.clone():null,d=e.background?e.background.clone():null;e.background=null,e.fog=null;let h=i?new U(e):new M(e);a.layers.disable(2),a.layers.disable(5),i?a.layers.enable(7):a.layers.disable(7),o.render(e,a),t&&(o.clearDepth(),o.render(t,a));let u=o.domElement.toDataURL();a.layers.enable(2),a.layers.enable(5),e.background=d,e.fog=c,h.removeFromScene(),r({image:u,width:s,height:l,blob:null})})})}}}));
|
|
2
|
-
//# sourceMappingURL=image-renderer-50475591.legacy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main-thread-to-worker-66323030.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./query-params-helper-8c00a872.legacy.js","./rapi-access-41e0190e.legacy.js","./main-thread-to-worker-66323030.legacy.js","./pixotron-e22efd52.legacy.js","./mesh-generator-8b81c1d2.legacy.js","./configurator-mesh-generator-7731c94d.legacy.js","./scene-manager-7cc3251b.legacy.js"],(function(e){var t,a,i,r,s,n,o,h,l,m,_,c,d,g,p,u,M,w,y,C,f,S,P,E,v,x,R,T,b;return{setters:[function(){},function(e){t=e._,a=e.i,i=e.d,r=e.f,s=e.P,n=e.K,o=e.ab,h=e.ac,l=e.h,m=e.ad,_=e.N,c=e.G,d=e.U,g=e.n,p=e.L,u=e.ae,M=e.o,w=e.s},function(){},function(e){y=e.a,C=e.C,f=e.F,S=e.T,P=e.e,E=e.g,v=e.S,x=e.I,R=e.M},function(){},function(e){T=e.C},function(e){b=e.S}],execute:function(){let G=(()=>{class e extends b{constructor(e,t){super(e,t,i.RMV,"3D",!1),this._sceneParams={type:"cube"},this._materialParams={color:"#ffffff",metallic:.5,alpha:0,alphaCutoff:0,doubleSided:!1},this._renderer.capabilities.maxTextures>8&&this.loadDynamicLightSetting(r.createDynamicLightSettingSource(null,s.CAMERA)),this._initScene()}_initScene(){const e=new THREE.BoxGeometry(1,1,1,100,100,100),t=new THREE.MeshPhysicalMaterial({color:this._initData.colors.PRIMARY});this._environmentLoader.setEnvMap(t),this._setMaterial(t),this._mesh=new THREE.Mesh(e,this._material),this._mesh.castShadow=!0,this._mesh.position.setY(.5),this._scene.add(this._mesh);const{initialFloorMaterial:a}=this._initData;if(a?this.changeFloorMaterialById(a):this._environment=new y(this._scene,null,new THREE.Color(16777215)),this._cameraControl instanceof C){const e=new THREE.Box3;e.setFromObject(this._mesh),this._cameraControl.updateAndReset(e.getSize(new THREE.Vector3),e.getCenter(new THREE.Vector3))}this.showGUI()}loadMaterialId(e){return new Promise(t=>{this._configuratorMeshGenerator.loadMaterial(e,1e3,1e3).then(e=>{this._setMaterial(e),this._mesh.material=this._material,this._updateGUI(),this._requestRender(!0),t()})})}loadMaterial(e){return new Promise(t=>{e.__rapi_path__||(e.__rapi_path__="materials"),this._setMaterial(n(e,this._environmentLoader)),this._mesh.material=this._material,this._configuratorMeshGenerator.loadTextures(e,this._material,100,100).then(()=>{this._updateGUI(),this._requestRender(!0)}),t()})}loadMaterialShading(e){return new Promise(t=>{let a={shading:e};this._setMaterial(o(this._material,a,this._environmentLoader)),this._mesh.material=this._material,this._updateGUI(),this._requestRender(!0),t()})}_setMaterial(e){this._material=e,this._materialParams.alpha=e.opacity,this._materialParams.alphaCutoff=e.alphaTest,this._materialParams.color="#"+e.color.getHexString(),this._materialParams.doubleSided=e.side===THREE.DoubleSide,this._materialParams.metallic=1===e.metalness?1:e.reflectivity}getMaterialShading(){return h(this._material)}createCameraControl(e){this._cameraControl=new C(this._creator_,this._getInputManager(),new THREE.Vector3(-1,1,1))}_getInputManager(){return this._inputManager}sceneChanged(){}getPixotronParams(){return{saoparams:{intensity:.25,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:200,accumulative:!0},shadowparams:{shadowMapResolution:1024,shadowRadius:1,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:50,side:THREE.FrontSide}}}getBakedShadowParams(){return{enable:!1,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4}}getBounds(){return this._mesh?(new THREE.Box3).setFromObject(this._mesh):null}_guiLoaded(){this._updateGUI()}_updateGUI(){let e=l();e&&(this._guiGeometryFolder||(this._guiGeometryFolder=e.addFolder("Geometry"),this._guiGeometryFolder.add(this._sceneParams,"type",{Cube:"cube",Sphere:"sphere",PlaneVertical:"plane_vertical",PlaneHorizontal:"plane_horizontal"}).onChange(e=>{this._setGeometry()})),this._material&&(this._guiMaterialFolder&&e.removeFolder(this._guiMaterialFolder),this._guiMaterialFolder=e.addFolder("Material"),this._guiMaterialFolder.addColor(this._materialParams,"color").onChange(e=>{this._material.color=new THREE.Color(e),this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"metallic").min(0).max(1).step(.01).onChange(e=>{this._material.metalness=1===e?1:.5,this._material.reflectivity=e||.5,this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"roughness").min(0).max(1).step(.01).onChange(e=>{this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"transmission").min(0).max(1).step(.01).onChange(e=>{this._material.transmission=e,e>0&&(this._material.opacity=1,this._material.alphaTest=.5,this._material.depthWrite=!1,this._material.transparent=!0,this._material.metalness=0),this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alpha").min(0).max(1).step(.01).onChange(e=>{this._material.transparent=e<1,this._material.opacity=e,this._material.depthWrite=e>=1,this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alphaCutoff").min(0).max(1).step(.01).onChange(e=>{this._material.alphaTest=e||0,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"doubleSided").onChange(e=>{this._material.side=e?THREE.DoubleSide:THREE.FrontSide,this._shadingChanged()})),this._addGUIListener(e))}_shadingChanged(){this._roomleMaterialViewerUiCallback.onMaterialShadingChanged(h(this._material))}setGeometry(e){this._sceneParams.type=e,this._setGeometry()}_setGeometry(){let e;"cube"===this._sceneParams.type&&(e=new THREE.BoxGeometry(1,1,1,100,100,100)),"sphere"===this._sceneParams.type&&(e=new THREE.SphereGeometry(.5,100,100)),"plane_horizontal"===this._sceneParams.type&&(e=new THREE.PlaneGeometry(1,1),e.rotateX(-Math.PI/2)),"plane_vertical"===this._sceneParams.type&&(e=new THREE.PlaneGeometry(1,1)),this._mesh.geometry=e,this._requestRender(!0)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._environment&&this._environment instanceof f||(this._environment=new f(this._scene,this._environment,!0)),this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),new Promise((e,a)=>{this._environment.changeFloorMaterial(t,this._maxAnisotropy).then(()=>{this._requestRender(),e()},a)})}async addTexture(e,t){const a=100/(0===e.mmWidth?1:e.mmWidth),i=100/(0===e.mmHeight?1:e.mmHeight);if(t){const r=new Image;r.src=t;const s=new THREE.Texture;s.image=r,r.onload=function(){s.needsUpdate=!0},m(s,e,this._material,this._maxAnisotropy,a,i,this._renderer.capabilities.maxTextures)}else await _(e.image,e,this._material,this._maxAnisotropy,a,i,this._renderer.capabilities.maxTextures);this._requestRender()}removeTexture(e){"ORM"===e.mapping&&(this._material.aoMap=null,this._material.roughnessMap=null,this._material.metalnessMap=null),"RGB"!==e.mapping&&"RGBA"!==e.mapping||(this._material.map=null),"XYZ"===e.mapping&&(this._material.normalMap=null),this._material.needsUpdate=!0,this._requestRender()}clearCache(){this._configuratorMeshGenerator.clear()}}return t([a],e.prototype,"_inputManager",void 0),t([a],e.prototype,"_configuratorMeshGenerator",void 0),t([a],e.prototype,"_roomleMaterialViewerUiCallback",void 0),t([a],e.prototype,"_rapiAccess",void 0),e})(),F=(()=>{class e{constructor(e){this._creator_=e}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}init(e){return this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):new Promise(this._initPromiseCallback.bind(this))}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(c,{id:"gltf-loader"}),a=this._scriptLoader.fetch(S,{id:"tween-js"});Promise.all([t,a]).then(()=>{this._sceneManager=new G(this._creator_,{left:0,top:1,right:1,bottom:0}),this.enableHD(),e()})})}enableHD(){return new Promise((e,t)=>{const a=()=>{this._sceneManager.enableHD(),e()};Promise.all(P.map(e=>this._scriptLoader.fetch(e,{id:e}))).then(()=>{this._scriptLoader.fetch(E,{id:"pi-js"}).then(a,t)},t)})}get callbacks(){return this._roomleMaterialViewerUiCallback}set callbacks(e){this._roomleMaterialViewerUiCallback=e}loadMaterialShading(e){return this._sceneManager.loadMaterialShading(e)}loadMaterial(e,t={}){return t.flushCache&&this._clearCaches(),this._sceneManager.loadMaterial(e)}loadMaterialId(e,t={}){return t.flushCache&&this._clearCaches(),this._sceneManager.loadMaterialId(e)}getMaterialShading(){return this._sceneManager.getMaterialShading()}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}loadQualitySetting(e){this._sceneManager.loadQualitySetting(e)}setOverrides(e){e&&this._initData.setOverrides(e)}updateSize(){this._sceneManager.updateCamera()}getMain(){}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}showGUI(){this._sceneManager.showGUI()}async changeFloorMaterialById(e){return this._sceneManager.changeFloorMaterialById(e)}setGeometry(e){this._sceneManager.setGeometry(e)}async addTexture(e,t){return this._sceneManager.addTexture(e,t)}removeTexture(e){return this._sceneManager.removeTexture(e)}_clearCaches(){this._rapiAccess.cleanUp(),this._sceneManager.clearCache()}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}}return t([a],e.prototype,"_domHelper",void 0),t([a],e.prototype,"_scriptLoader",void 0),t([a],e.prototype,"_lifeCycleManager",void 0),t([a],e.prototype,"_threeLoader",void 0),t([a],e.prototype,"_roomleMaterialViewerUiCallback",void 0),t([a],e.prototype,"_initData",void 0),t([a],e.prototype,"_rapiAccess",void 0),e})();const H=[new g("script-loader",v),new g("logger",p),new g("input-manager",x,1),new g("environment-loader",u),new g("configurator-mesh-generator",T),new g("rapi-access",M),new g("roomle-material-viewer-ui-callback",class extends d{constructor(e){super(e),this.onMaterialShadingChanged=e=>{}}},1)];e("MaterialViewer",class extends R{setupGlobals(){}setupDependencies(){w.setup(H),this.lookup("logger",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._viewer=new F(this._context),window.RoomleMaterialViewer||(window.RoomleMaterialViewer=this._viewer)}getApi(){return this._viewer}getContextName(){return"material-viewer"}})}}}));
|
|
2
|
-
//# sourceMappingURL=material-viewer-af50b7e7.legacy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"material-viewer-af50b7e7.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./rapi-access-41e0190e.legacy.js","./main-thread-to-worker-66323030.legacy.js"],(function(e){var t,a,r,s,i,o,h,l,c;return{setters:[function(e){t=e._,a=e.i,r=e.O,s=e.S,i=e.T,o=e.K,h=e.N},function(e){l=e.f,c=e.j}],execute:function(){class n{constructor(e,t){this._waitingPromises=[],this._finishPromiseExecutor=[],this._errorCallback=()=>{},Promise.allSettled=Promise.allSettled||(e=>Promise.all(e.map(e=>e.then(e=>({status:"fulfilled",value:e})).catch(e=>({status:"rejected",reason:e}))))),e&&this.registerCallback(e),t&&(this._errorCallback=t)}push(e){this._waitingPromises.push(e),Promise.all(this._waitingPromises).then(e=>{e.length===this._waitingPromises.length&&(this._callback&&this._callback(e),this._waitingPromises=[])},this._errorCallback)}finished(e=!1){return new Promise((t,a)=>{this._finishPromiseExecutor.push({resolve:t,reject:a});const r=e?"allSettled":"all";Promise[r](this._waitingPromises).then(e=>{if("allSettled"===r){const t=[];e.forEach(({value:e,status:a})=>{"fulfilled"===a&&t.push(e)}),this._resolveAllExecutors(t)}else this._resolveAllExecutors(e)},e=>{this._rejectAllExecutors(e)})})}registerCallback(e){this._callback=e}unregisterCallback(){this._callback=null}_resolveAllExecutors(e){this._finishPromiseExecutor.forEach(({resolve:t})=>t(e)),this._finishPromiseExecutor=[]}_rejectAllExecutors(e){this._finishPromiseExecutor.forEach(({reject:t})=>t(e)),this._finishPromiseExecutor=[]}clear(){const e=this._waitingPromises.length>0;this._waitingPromises=[],e?this._rejectAllExecutors(new Error("Promise queue has been cleared")):this._resolveAllExecutors([])}get length(){return this._waitingPromises.length}}e("P",n),e("M",(()=>{class e{constructor(e){this.materialQueue=new n,this._maxAnisotropy=1,this._maxTextures=16,this._textureLoader=new THREE.TextureLoader,this._creator_=e,this._previewMaterial=new THREE.MeshStandardMaterial({color:r,roughness:s,metalness:i}),this._environmentLoader.setEnvMap(this._previewMaterial)}_generateGeometry(e,t,a,r,s){let i;if(e&&this._cacheHolder.geometryCache.has(e))i=this._cacheHolder.geometryCache.get(e);else{i=new THREE.Geometry,i.faceVertexUvs=[],i.faceVertexUvs[0]=[];for(let e=0,a=t.length;e<a;e+=3)i.vertices.push(new THREE.Vector3(t[e]/1e3,t[e+2]/1e3,t[e+1]/-1e3));let o=0,h=0,l=0,c=0,n=0,m=0,_=0,d=0,u=0,g=0,p=[];for(let e=0,t=a.length;e<t;e+=3)h=e,l=e+1,c=e+2,n=3*a[h],m=3*a[l],_=3*a[c],p=[new THREE.Vector3(s[n],s[n+2],-1*s[n+1]),new THREE.Vector3(s[m],s[m+2],-1*s[m+1]),new THREE.Vector3(s[_],s[_+2],-1*s[_+1])],i.faces.push(new THREE.Face3(a[h],a[l],a[c],p)),d=2*a[h],u=2*a[l],g=2*a[c],i.faceVertexUvs[0][o]=[],i.faceVertexUvs[0][o][0]=new THREE.Vector2(r[d],r[d+1]),i.faceVertexUvs[0][o][1]=new THREE.Vector2(r[u],r[u+1]),i.faceVertexUvs[0][o][2]=new THREE.Vector2(r[g],r[g+1]),o++;e&&this._cacheHolder.geometryCache.set(e,i)}return i}changeMaterialOfMesh(e,t){e&&t?(e.material=t,e.material.transparent||0===e.material.opacity||e.material.transmission>0?(e.castShadow=!1,e.receiveShadow=!1):(e.castShadow=!0,e.receiveShadow=!0),e.material.needsUpdate=!0,this._materialLoaded&&this._materialLoaded(t)):console.warn("could not assign material to mesh",{mesh:e},{material:t})}_createMaterial(e,t,a,r,s){if(this._cacheHolder.materialCache.has(e))t();else if(e.startsWith("benchmarkMaterial")){let i=l(e),h=o(i,this._environmentLoader);this._loadBenchmarkTextures(i,h,r,s).then(t,a)}else this._rapiAccess.getMaterial(e).then(e=>{let i=o(e,this._environmentLoader);this._loadTextures(e,i,r,s).then(t,a)},a)}_loadBenchmarkTextures(e,t,a=1,r=1){return new Promise((s,i)=>{const o=c(e.id);h(this._dataSyncer.requestAsset(o.image,!0),o,t,this._maxAnisotropy,a/(0===o.mmWidth?1:o.mmWidth),r/(0===o.mmHeight?1:o.mmHeight),this._maxTextures).then(()=>{this._cacheHolder.materialCache.set(e.id,t),s()},i)})}_loadTextures(e,t,a=1,r=1){return new Promise((s,i)=>{if(!e.textures||e.textures&&0===e.textures.length)return this._cacheHolder.materialCache.set(e.id,t),s();this._rapiAccess.getTexturesOf(e).then(o=>{let l=[];o.forEach(e=>{l.push(h(this._dataSyncer.requestAsset(e.image,!0),e,t,this._maxAnisotropy,a/(0===e.mmWidth?1:e.mmWidth),r/(0===e.mmHeight?1:e.mmHeight),this._maxTextures))}),Promise.all(l).then(()=>{this._cacheHolder.materialCache.set(e.id,t),s()},i)})})}_loadMaterial(e,t,a){return new Promise((r,s)=>{this._singlePromiseFactory.create(6,e,(r,s)=>this._createMaterial(e,r,s,t,a)).then(()=>{setTimeout(()=>r(this._cacheHolder.materialCache.get(e)),0)},s)})}_assignMaterial(e,t){return this._cacheHolder.materialCache.has(t)?(this.changeMaterialOfMesh(e,this._cacheHolder.materialCache.get(t)),Promise.resolve()):new Promise((a,r)=>{this._loadMaterial(t).then(r=>{e.userData.materialId===t&&this.changeMaterialOfMesh(e,r),a()},r)})}get maxAnisotropy(){return this._maxAnisotropy}set maxAnisotropy(e){this._maxAnisotropy=e}get maxTextures(){return this._maxTextures}set maxTextures(e){this._maxTextures=e}clear(){this._cacheHolder.clear()}_assignRGB(e,t){return new Promise(a=>{let r,s="rbg"+JSON.stringify(t);this._cacheHolder.materialCache.has(s)?r=this._cacheHolder.materialCache.get(s):(r=new THREE.MeshStandardMaterial({color:t}),this._environmentLoader.setEnvMap(r),this._cacheHolder.materialCache.set(s,r)),this.changeMaterialOfMesh(e,r),setTimeout(()=>a(),0)})}_assignItem(e,t){return new Promise((a,r)=>{if(this._cacheHolder.materialCache.has(t))return this.changeMaterialOfMesh(e,this._cacheHolder.materialCache.get(t)),void a();this._rapiAccess.getItem(t).then(s=>{if(s.topImage)this._textureLoader.load(s.topImage,r=>{r.anisotropy=this._maxAnisotropy,r.wrapS=THREE.RepeatWrapping,r.wrapT=THREE.RepeatWrapping;let i=new THREE.Vector2(1,1);s.width>0&&(i.x=1/s.width),s.depth>0&&(i.y=1/s.depth),r.repeat.set(i.x,i.y);const o=new THREE.MeshPhysicalMaterial({map:r,roughness:.5,metalness:.1});this._environmentLoader.setEnvMap(o),this._cacheHolder.materialCache.set(t,o),this.changeMaterialOfMesh(e,o),setTimeout(()=>a(),0)});else{const e="can not set material, catalog item top image is not set";console.warn(e),r(e)}},r)})}setMaterialLoadedListener(e){this._materialLoaded=e}removeMaterialLoadedListener(){this._materialLoaded=void 0}}return t([a],e.prototype,"_rapiAccess",void 0),t([a],e.prototype,"_environmentLoader",void 0),t([a],e.prototype,"_dataSyncer",void 0),t([a],e.prototype,"_singlePromiseFactory",void 0),t([a],e.prototype,"_cacheHolder",void 0),t([a],e.prototype,"_plannerMeshGenerator",void 0),e})())}}}));
|
|
2
|
-
//# sourceMappingURL=mesh-generator-8b81c1d2.legacy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-generator-8b81c1d2.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|