@roomle/web-sdk 2.80.0-alpha.2 → 2.80.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{TextGeometry-b57a793b.nomodule.js → TextGeometry-2cd7a69b.nomodule.js} +2 -2
- package/lib/{TextGeometry-b57a793b.nomodule.js.map → TextGeometry-2cd7a69b.nomodule.js.map} +1 -1
- package/lib/{TextGeometry-f0a85d6a.js → TextGeometry-afd21a68.js} +2 -2
- package/lib/{TextGeometry-f0a85d6a.js.map → TextGeometry-afd21a68.js.map} +1 -1
- package/lib/{banana-for-scale-12147338.js → banana-for-scale-c6be07b2.js} +2 -2
- package/lib/{banana-for-scale-12147338.js.map → banana-for-scale-c6be07b2.js.map} +1 -1
- package/lib/{banana-for-scale-8c9b8e0d.nomodule.js → banana-for-scale-e3b08724.nomodule.js} +2 -2
- package/lib/{banana-for-scale-8c9b8e0d.nomodule.js.map → banana-for-scale-e3b08724.nomodule.js.map} +1 -1
- package/lib/{budgeteer-measure-d54121c4.js → budgeteer-measure-d2fdd2ca.js} +2 -2
- package/lib/{budgeteer-measure-d54121c4.js.map → budgeteer-measure-d2fdd2ca.js.map} +1 -1
- package/lib/budgeteer-measure.nomodule.js +1 -1
- package/lib/camera-behaviour-0329b404.nomodule.js +2 -0
- package/lib/{camera-behaviour-1b0b7853.nomodule.js.map → camera-behaviour-0329b404.nomodule.js.map} +1 -1
- package/lib/camera-behaviour-972fe21d.js +2 -0
- package/lib/{camera-behaviour-4d4e7e7c.js.map → camera-behaviour-972fe21d.js.map} +1 -1
- package/lib/{component-dimensioning-bdbf6729.js → component-dimensioning-a6fc3d62.js} +2 -2
- package/lib/component-dimensioning-a6fc3d62.js.map +1 -0
- package/lib/{component-dimensioning-36a1e68e.nomodule.js → component-dimensioning-aea51ade.nomodule.js} +2 -2
- package/lib/component-dimensioning-aea51ade.nomodule.js.map +1 -0
- package/lib/{component-raycast-helper-40363857.js → component-raycast-helper-f481b986.js} +2 -2
- package/lib/component-raycast-helper-f481b986.js.map +1 -0
- package/lib/{component-raycast-helper-67f9a0e9.nomodule.js → component-raycast-helper-ff575981.nomodule.js} +2 -2
- package/lib/component-raycast-helper-ff575981.nomodule.js.map +1 -0
- package/lib/{configurator-7fce117f.js → configurator-6c9aeb1b.js} +2 -2
- package/lib/configurator-6c9aeb1b.js.map +1 -0
- package/lib/configurator-c1a02325.nomodule.js +2 -0
- package/lib/configurator-c1a02325.nomodule.js.map +1 -0
- package/lib/configurator-main-49a46b97.js +2 -0
- package/lib/configurator-main-49a46b97.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{continuous-drawing-helper-094fdf93.js → continuous-drawing-helper-1fb7e734.js} +2 -2
- package/lib/continuous-drawing-helper-1fb7e734.js.map +1 -0
- package/lib/{continuous-drawing-helper-f2aea1db.nomodule.js → continuous-drawing-helper-533ccfe3.nomodule.js} +2 -2
- package/lib/continuous-drawing-helper-533ccfe3.nomodule.js.map +1 -0
- package/lib/{default-light-setting-ad52e6de.js → default-light-setting-0ce87ae6.js} +2 -2
- package/lib/default-light-setting-0ce87ae6.js.map +1 -0
- package/lib/{default-light-setting-7f113f35.nomodule.js → default-light-setting-2a836593.nomodule.js} +2 -2
- package/lib/default-light-setting-2a836593.nomodule.js.map +1 -0
- package/lib/definitions/common-core/src/configurator-kernel-access.d.ts +7 -0
- package/lib/definitions/common-core/src/utils/shims.d.ts +5 -0
- package/lib/definitions/common-core/src/utils/threejs-utils.d.ts +10 -1
- package/lib/definitions/common-core/src/view-model/configurator-view-model.d.ts +12 -4
- package/lib/definitions/common-core/src/view-model/helpers/constants.d.ts +2 -0
- package/lib/definitions/common-core/src/webgl/roomle-component-factory.d.ts +2 -0
- package/lib/definitions/configurator-core/src/utils/raycast-helper.d.ts +4 -4
- package/lib/definitions/configurator-core/src/webgl/configurator-scene-event-handler.d.ts +2 -1
- package/lib/definitions/configurator-core/src/webgl/configurator-scene-manager.d.ts +2 -0
- package/lib/definitions/planner-core/src/roomle-planner.d.ts +5 -0
- package/lib/definitions/planner-core/src/view-model/construction-plan-object-view-model.d.ts +0 -1
- package/lib/definitions/planner-core/src/view-model/node-plan-element-view-model.d.ts +0 -2
- package/lib/definitions/planner-core/src/webgl/construction-top-view.d.ts +1 -0
- package/lib/definitions/planner-core/src/webgl/draggable-node.d.ts +1 -0
- package/lib/definitions/planner-core/src/webgl/planner-scene-event-handler.d.ts +8 -3
- package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +6 -0
- package/lib/definitions/typings/planner.d.ts +3 -1
- package/lib/definitions/typings/rapi-types.d.ts +1 -1
- package/lib/dimensioning-helper-0c79ee09.js +2 -0
- package/lib/{dimensioning-helper-7494fb28.js.map → dimensioning-helper-0c79ee09.js.map} +1 -1
- package/lib/dimensioning-helper-7969ecfa.nomodule.js +2 -0
- package/lib/dimensioning-helper-7969ecfa.nomodule.js.map +1 -0
- package/lib/{glb-viewer-0fd5cc99.nomodule.js → glb-viewer-06b84005.nomodule.js} +2 -2
- package/lib/{glb-viewer-0fd5cc99.nomodule.js.map → glb-viewer-06b84005.nomodule.js.map} +1 -1
- package/lib/{glb-viewer-039ccdb1.js → glb-viewer-280a0756.js} +2 -2
- package/lib/{glb-viewer-039ccdb1.js.map → glb-viewer-280a0756.js.map} +1 -1
- package/lib/{glb-viewer-camera-behaviour-21363fa3.js → glb-viewer-camera-behaviour-43286746.js} +2 -2
- package/lib/glb-viewer-camera-behaviour-43286746.js.map +1 -0
- package/lib/{glb-viewer-camera-behaviour-c43375cf.nomodule.js → glb-viewer-camera-behaviour-d481d001.nomodule.js} +2 -2
- package/lib/glb-viewer-camera-behaviour-d481d001.nomodule.js.map +1 -0
- package/lib/glb-viewer-main-bd498d45.js +2 -0
- package/lib/glb-viewer-main-bd498d45.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/legacy/{TextGeometry-8862f872.legacy.js → TextGeometry-bd959010.legacy.js} +2 -2
- package/lib/legacy/{TextGeometry-8862f872.legacy.js.map → TextGeometry-bd959010.legacy.js.map} +1 -1
- package/lib/legacy/{banana-for-scale-ade37173.legacy.js → banana-for-scale-5221217c.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-ade37173.legacy.js.map → banana-for-scale-5221217c.legacy.js.map} +1 -1
- package/lib/legacy/budgeteer-measure.legacy.js +1 -1
- package/lib/legacy/camera-behaviour-08a1b1f8.legacy.js +2 -0
- package/lib/legacy/{camera-behaviour-ba624fdd.legacy.js.map → camera-behaviour-08a1b1f8.legacy.js.map} +1 -1
- package/lib/legacy/{component-dimensioning-d6f65e0d.legacy.js → component-dimensioning-ae40fa2c.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-ae40fa2c.legacy.js.map +1 -0
- package/lib/legacy/{component-raycast-helper-f8241e23.legacy.js → component-raycast-helper-657f7e52.legacy.js} +2 -2
- package/lib/legacy/component-raycast-helper-657f7e52.legacy.js.map +1 -0
- package/lib/legacy/configurator-1da2e934.legacy.js +2 -0
- package/lib/legacy/configurator-1da2e934.legacy.js.map +1 -0
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{continuous-drawing-helper-8f4235b4.legacy.js → continuous-drawing-helper-b63ea19a.legacy.js} +2 -2
- package/lib/legacy/continuous-drawing-helper-b63ea19a.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-1e175f7c.legacy.js → default-light-setting-0056678b.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-0056678b.legacy.js.map +1 -0
- package/lib/legacy/dimensioning-helper-7932528d.legacy.js +2 -0
- package/lib/legacy/dimensioning-helper-7932528d.legacy.js.map +1 -0
- package/lib/legacy/{glb-viewer-camera-behaviour-6f853358.legacy.js → glb-viewer-camera-behaviour-4a3207ca.legacy.js} +2 -2
- package/lib/legacy/glb-viewer-camera-behaviour-4a3207ca.legacy.js.map +1 -0
- package/lib/legacy/{glb-viewer-53726809.legacy.js → glb-viewer-f8d71d82.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-53726809.legacy.js.map → glb-viewer-f8d71d82.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{main-thread-to-worker-63c62382.legacy.js → main-thread-to-worker-6dc921e1.legacy.js} +3 -3
- package/lib/legacy/{main-thread-to-worker-63c62382.legacy.js.map → main-thread-to-worker-6dc921e1.legacy.js.map} +1 -1
- package/lib/legacy/material-viewer-bdaccf05.legacy.js +2 -0
- package/lib/legacy/material-viewer-bdaccf05.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/planner-d966d884.legacy.js +2 -0
- package/lib/legacy/{planner-20fc10ce.legacy.js.map → planner-d966d884.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/{query-params-helper-a1e70858.legacy.js → query-params-helper-a47f6cfb.legacy.js} +2 -2
- package/lib/legacy/query-params-helper-a47f6cfb.legacy.js.map +1 -0
- package/lib/legacy/roomle-configurator-94640ec7.legacy.js +2 -0
- package/lib/legacy/roomle-configurator-94640ec7.legacy.js.map +1 -0
- package/lib/legacy/roomle-dependency-injection-9ff2d391.legacy.js +9 -0
- package/lib/legacy/{roomle-dependency-injection-3542b35a.legacy.js.map → roomle-dependency-injection-9ff2d391.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/{script-loader-25518980.legacy.js → script-loader-43bc75b7.legacy.js} +2 -2
- package/lib/legacy/script-loader-43bc75b7.legacy.js.map +1 -0
- package/lib/legacy/static/ConfiguratorKernel-9403812aa995fcd7.wasm +0 -0
- package/lib/legacy/static/RoomleCore-f33eb92207b5e4a7.wasm +0 -0
- package/lib/{static/RoomleToolsCore-19282746bbb98ca2.wasm → legacy/static/RoomleToolsCore-3d0f3623cdc5bdbc.wasm} +0 -0
- package/lib/legacy/{stats-helper-4dd75b8d.legacy.js → stats-helper-51cdb198.legacy.js} +2 -2
- package/lib/legacy/stats-helper-51cdb198.legacy.js.map +1 -0
- package/lib/legacy/{tools-core-5dd3b7d4.legacy.js → tools-core-0f121ca0.legacy.js} +2 -2
- package/lib/legacy/tools-core-0f121ca0.legacy.js.map +1 -0
- package/lib/{main-thread-to-worker-82b32425.js → main-thread-to-worker-ab187cd2.js} +2 -2
- package/lib/{main-thread-to-worker-82b32425.js.map → main-thread-to-worker-ab187cd2.js.map} +1 -1
- package/lib/{main-thread-to-worker-ff04af1e.nomodule.js → main-thread-to-worker-e424b0c2.nomodule.js} +2 -2
- package/lib/{main-thread-to-worker-ff04af1e.nomodule.js.map → main-thread-to-worker-e424b0c2.nomodule.js.map} +1 -1
- package/lib/material-viewer-0ad28eb6.nomodule.js +2 -0
- package/lib/material-viewer-0ad28eb6.nomodule.js.map +1 -0
- package/lib/material-viewer-bafd1ed5.js +2 -0
- package/lib/material-viewer-bafd1ed5.js.map +1 -0
- package/lib/material-viewer-main-6e8de17f.js +2 -0
- package/lib/material-viewer-main-6e8de17f.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/planner-900bbcef.js +2 -0
- package/lib/{planner-ce25224e.js.map → planner-900bbcef.js.map} +1 -1
- package/lib/planner-d9f349f6.nomodule.js +2 -0
- package/lib/{planner-75145ec2.nomodule.js.map → planner-d9f349f6.nomodule.js.map} +1 -1
- package/lib/planner-main-75f83b54.js +2 -0
- package/lib/planner-main-75f83b54.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/{query-params-helper-68ed40a6.js → query-params-helper-9d7ce8f1.js} +2 -2
- package/lib/query-params-helper-9d7ce8f1.js.map +1 -0
- package/lib/{query-params-helper-712890e0.nomodule.js → query-params-helper-fb60ee8f.nomodule.js} +2 -2
- package/lib/query-params-helper-fb60ee8f.nomodule.js.map +1 -0
- package/lib/roomle-configurator-0998b7f6.js +2 -0
- package/lib/roomle-configurator-0998b7f6.js.map +1 -0
- package/lib/roomle-configurator-d1699781.nomodule.js +2 -0
- package/lib/roomle-configurator-d1699781.nomodule.js.map +1 -0
- package/lib/roomle-dependency-injection-61a634e1.js +9 -0
- package/lib/{roomle-dependency-injection-56db2f22.js.map → roomle-dependency-injection-61a634e1.js.map} +1 -1
- package/lib/roomle-dependency-injection-9dd7ed00.nomodule.js +9 -0
- package/lib/{roomle-dependency-injection-c12e4c00.nomodule.js.map → roomle-dependency-injection-9dd7ed00.nomodule.js.map} +1 -1
- package/lib/{roomle-sdk-d2dbfbba.js → roomle-sdk-fa9dfd96.js} +2 -2
- package/lib/roomle-sdk-fa9dfd96.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/{script-loader-98a17bbb.nomodule.js → script-loader-171a2eef.nomodule.js} +2 -2
- package/lib/script-loader-171a2eef.nomodule.js.map +1 -0
- package/lib/{script-loader-ef092985.js → script-loader-77e91d11.js} +2 -2
- package/lib/script-loader-77e91d11.js.map +1 -0
- package/lib/static/ConfiguratorKernel-9403812aa995fcd7.wasm +0 -0
- package/lib/static/RoomleCore-f33eb92207b5e4a7.wasm +0 -0
- package/lib/{legacy/static/RoomleToolsCore-19282746bbb98ca2.wasm → static/RoomleToolsCore-3d0f3623cdc5bdbc.wasm} +0 -0
- package/lib/{stats-helper-efe5bf85.nomodule.js → stats-helper-65ca4b44.nomodule.js} +2 -2
- package/lib/stats-helper-65ca4b44.nomodule.js.map +1 -0
- package/lib/{stats-helper-c0748092.js → stats-helper-ae6d8e53.js} +2 -2
- package/lib/stats-helper-ae6d8e53.js.map +1 -0
- package/lib/{tools-core-c31d15d3.nomodule.js → tools-core-1f401c76.nomodule.js} +2 -2
- package/lib/tools-core-1f401c76.nomodule.js.map +1 -0
- package/lib/{tools-core-2e800d36.js → tools-core-7c28e1d3.js} +2 -2
- package/lib/tools-core-7c28e1d3.js.map +1 -0
- package/package.json +2 -2
- package/lib/camera-behaviour-1b0b7853.nomodule.js +0 -2
- package/lib/camera-behaviour-4d4e7e7c.js +0 -2
- package/lib/component-dimensioning-36a1e68e.nomodule.js.map +0 -1
- package/lib/component-dimensioning-bdbf6729.js.map +0 -1
- package/lib/component-raycast-helper-40363857.js.map +0 -1
- package/lib/component-raycast-helper-67f9a0e9.nomodule.js.map +0 -1
- package/lib/configurator-04e3b0ec.nomodule.js +0 -2
- package/lib/configurator-04e3b0ec.nomodule.js.map +0 -1
- package/lib/configurator-7fce117f.js.map +0 -1
- package/lib/configurator-main-16e36fb1.js +0 -2
- package/lib/configurator-main-16e36fb1.js.map +0 -1
- package/lib/continuous-drawing-helper-094fdf93.js.map +0 -1
- package/lib/continuous-drawing-helper-f2aea1db.nomodule.js.map +0 -1
- package/lib/default-light-setting-7f113f35.nomodule.js.map +0 -1
- package/lib/default-light-setting-ad52e6de.js.map +0 -1
- package/lib/dimensioning-helper-7494fb28.js +0 -2
- package/lib/dimensioning-helper-b9377b93.nomodule.js +0 -2
- package/lib/dimensioning-helper-b9377b93.nomodule.js.map +0 -1
- package/lib/glb-viewer-camera-behaviour-21363fa3.js.map +0 -1
- package/lib/glb-viewer-camera-behaviour-c43375cf.nomodule.js.map +0 -1
- package/lib/glb-viewer-main-ca829f73.js +0 -2
- package/lib/glb-viewer-main-ca829f73.js.map +0 -1
- package/lib/legacy/camera-behaviour-ba624fdd.legacy.js +0 -2
- package/lib/legacy/component-dimensioning-d6f65e0d.legacy.js.map +0 -1
- package/lib/legacy/component-raycast-helper-f8241e23.legacy.js.map +0 -1
- package/lib/legacy/configurator-9881273c.legacy.js +0 -2
- package/lib/legacy/configurator-9881273c.legacy.js.map +0 -1
- package/lib/legacy/continuous-drawing-helper-8f4235b4.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-1e175f7c.legacy.js.map +0 -1
- package/lib/legacy/dimensioning-helper-5c4c4754.legacy.js +0 -2
- package/lib/legacy/dimensioning-helper-5c4c4754.legacy.js.map +0 -1
- package/lib/legacy/glb-viewer-camera-behaviour-6f853358.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-40206245.legacy.js +0 -2
- package/lib/legacy/material-viewer-40206245.legacy.js.map +0 -1
- package/lib/legacy/planner-20fc10ce.legacy.js +0 -2
- package/lib/legacy/query-params-helper-a1e70858.legacy.js.map +0 -1
- package/lib/legacy/roomle-configurator-34ae3e86.legacy.js +0 -2
- package/lib/legacy/roomle-configurator-34ae3e86.legacy.js.map +0 -1
- package/lib/legacy/roomle-dependency-injection-3542b35a.legacy.js +0 -9
- package/lib/legacy/script-loader-25518980.legacy.js.map +0 -1
- package/lib/legacy/static/ConfiguratorKernel-d8ae2b5e3db74698.wasm +0 -0
- package/lib/legacy/static/RoomleCore-09101ce4c57050b0.wasm +0 -0
- package/lib/legacy/stats-helper-4dd75b8d.legacy.js.map +0 -1
- package/lib/legacy/tools-core-5dd3b7d4.legacy.js.map +0 -1
- package/lib/material-viewer-3271df96.nomodule.js +0 -2
- package/lib/material-viewer-3271df96.nomodule.js.map +0 -1
- package/lib/material-viewer-8b817d3e.js +0 -2
- package/lib/material-viewer-8b817d3e.js.map +0 -1
- package/lib/material-viewer-main-d05716e9.js +0 -2
- package/lib/material-viewer-main-d05716e9.js.map +0 -1
- package/lib/planner-75145ec2.nomodule.js +0 -2
- package/lib/planner-ce25224e.js +0 -2
- package/lib/planner-main-f5484b07.js +0 -2
- package/lib/planner-main-f5484b07.js.map +0 -1
- package/lib/query-params-helper-68ed40a6.js.map +0 -1
- package/lib/query-params-helper-712890e0.nomodule.js.map +0 -1
- package/lib/roomle-configurator-96729652.nomodule.js +0 -2
- package/lib/roomle-configurator-96729652.nomodule.js.map +0 -1
- package/lib/roomle-configurator-e867d909.js +0 -2
- package/lib/roomle-configurator-e867d909.js.map +0 -1
- package/lib/roomle-dependency-injection-56db2f22.js +0 -9
- package/lib/roomle-dependency-injection-c12e4c00.nomodule.js +0 -9
- package/lib/roomle-sdk-d2dbfbba.js.map +0 -1
- package/lib/script-loader-98a17bbb.nomodule.js.map +0 -1
- package/lib/script-loader-ef092985.js.map +0 -1
- package/lib/static/ConfiguratorKernel-d8ae2b5e3db74698.wasm +0 -0
- package/lib/static/RoomleCore-09101ce4c57050b0.wasm +0 -0
- package/lib/stats-helper-c0748092.js.map +0 -1
- package/lib/stats-helper-efe5bf85.nomodule.js.map +0 -1
- package/lib/tools-core-2e800d36.js.map +0 -1
- package/lib/tools-core-c31d15d3.nomodule.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as RoomleDependencyInjection,D as DependencyInjectionAssignment,R as RapiAccess,
|
|
2
|
-
//# sourceMappingURL=roomle-sdk-
|
|
1
|
+
import{b as RoomleDependencyInjection,D as DependencyInjectionAssignment,R as RapiAccess,aP as GlobalCallback,aQ as GlobalInitData,aR as InitData}from"./roomle-dependency-injection-61a634e1.js";import"./main-thread-to-worker-ab187cd2.js";class RoomleSdk{static getConfigurator(e,n){return n=this._setupDI("configurator",e,n),new Promise((e,t)=>import("./configurator-6c9aeb1b.js").then(({Configurator:t})=>e(new t(n)),t))}static getPlanner(e,n){return n=this._setupDI("planner",e,n),new Promise((e,t)=>import("./planner-900bbcef.js").then(({Planner:t})=>e(new t(n)),t))}static async getGlbViewer(e,n){return n=this._setupDI("glb-viewer",e,n),new Promise((e,t)=>import("./glb-viewer-280a0756.js").then(({GlbViewer:t})=>e(new t(n)),t))}static getMaterialViewer(e,n){return n=this._setupDI("configurator",e,n),new Promise((e,t)=>import("./material-viewer-bafd1ed5.js").then(({MaterialViewer:t})=>e(new t(n)),t))}static getCoreTools(e,n){return n=this._setupDI("tools-core",e,n),new Promise((e,t)=>import("./tools-core-7c28e1d3.js").then(({ToolsCore:t})=>{const o=new t(n);o.boot(),e(o)},t))}static getRapiAccess(){return RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("rapi-access",RapiAccess,0),new DependencyInjectionAssignment("global-callback",GlobalCallback,0)]),Promise.resolve(RoomleDependencyInjection.lookup("rapi-access"))}static get callbacks(){return RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("global-callback",GlobalCallback,0)]),Promise.resolve(RoomleDependencyInjection.lookup("global-callback"))}static setGlobalInitData(e){e&&(RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("global-init-data",GlobalInitData,0)]),RoomleDependencyInjection.lookup("global-init-data").setOverrides(e))}static getContext(e){return RoomleDependencyInjection.getContext(e)}static _setupDI(e,n,t){return n&&(RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("init-data",InitData,1)]),t||(t=RoomleDependencyInjection.getContext(e)),RoomleDependencyInjection.lookup("init-data",t).setOverrides(n)),t}}export{RoomleSdk as default};
|
|
2
|
+
//# sourceMappingURL=roomle-sdk-fa9dfd96.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roomle-sdk-fa9dfd96.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
1
|
+
System.register(["./roomle-dependency-injection-9dd7ed00.nomodule.js","./main-thread-to-worker-e424b0c2.nomodule.js"],(function(e,t){var o,n,r,a,i,s;return{setters:[function(e){o=e.b,n=e.D,r=e.R,a=e.aP,i=e.aQ,s=e.aR},function(){}],execute:function(){e("default",class{static getConfigurator(e,o){return o=this._setupDI("configurator",e,o),new Promise((e,n)=>t.import("./configurator-c1a02325.nomodule.js").then(({Configurator:t})=>e(new t(o)),n))}static getPlanner(e,o){return o=this._setupDI("planner",e,o),new Promise((e,n)=>t.import("./planner-d9f349f6.nomodule.js").then(({Planner:t})=>e(new t(o)),n))}static async getGlbViewer(e,o){return o=this._setupDI("glb-viewer",e,o),new Promise((e,n)=>t.import("./glb-viewer-06b84005.nomodule.js").then(({GlbViewer:t})=>e(new t(o)),n))}static getMaterialViewer(e,o){return o=this._setupDI("configurator",e,o),new Promise((e,n)=>t.import("./material-viewer-0ad28eb6.nomodule.js").then(({MaterialViewer:t})=>e(new t(o)),n))}static getCoreTools(e,o){return o=this._setupDI("tools-core",e,o),new Promise((e,n)=>t.import("./tools-core-1f401c76.nomodule.js").then(({ToolsCore:t})=>{const n=new t(o);n.boot(),e(n)},n))}static getRapiAccess(){return o.addToContainer([new n("rapi-access",r,0),new n("global-callback",a,0)]),Promise.resolve(o.lookup("rapi-access"))}static get callbacks(){return o.addToContainer([new n("global-callback",a,0)]),Promise.resolve(o.lookup("global-callback"))}static setGlobalInitData(e){e&&(o.addToContainer([new n("global-init-data",i,0)]),o.lookup("global-init-data").setOverrides(e))}static getContext(e){return o.getContext(e)}static _setupDI(e,t,r){return t&&(o.addToContainer([new n("init-data",s,1)]),r||(r=o.getContext(e)),o.lookup("init-data",r).setOverrides(t)),r}})}}}));
|
|
2
2
|
//# sourceMappingURL=roomle-sdk.nomodule.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./query-params-helper-
|
|
2
|
-
//# sourceMappingURL=script-loader-
|
|
1
|
+
System.register(["./query-params-helper-fb60ee8f.nomodule.js","./roomle-dependency-injection-9dd7ed00.nomodule.js","./main-thread-to-worker-e424b0c2.nomodule.js"],(function(e){var t,o,n,i,_,s,r;return{setters:[function(e){t=e.g},function(e){o=e.b,n=e.B,i=e.I,_=e._,s=e.i},function(e){r=e.g}],execute:function(){e("M",class{constructor(e){this._context=e||o.getContext(this.getContextName()),n.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){o.setup(i);const e=t();this.lookup("global-init-data").setOverrides(e),this.lookup("init-data",this._context).setOverrides(e)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const e in window.THREE)if(window.hasOwnProperty(e))try{delete window.THREE[e]}catch(e){console.error(e)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(e){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(e),this.setupDependencies(),this.bootFinished()}lookup(e,t){return window.__RML__DI__.lookup(e,t)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(e){e&&this.lookup("dom-helper",this._context).setDomElement(e),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),o.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}});let l={},c={};class d{constructor(e){this._creator_=e}fetch(e,t){return this._singlePromiseFactory.create(5,e,(o,i)=>{!function(e,t,o,i){if(-1===e.indexOf("http")&&(e=r()+e),l[e])return o();if(t.id&&c[t.id])return i(new Error('There is already a script with ID "'+t.id+'"'));n.start("load_"+t.id.replace(/-/g,"_"));const _=document.createElement("script");_.async=!1,_.src=e,_.id=t.id,_.onload=()=>{l[e]=!0,c[t.id]=!0,Object.defineProperty(o,"name",{value:"resolve-"+t.id}),o()},_.onerror=e=>{i(e)},document.body.appendChild(_)}(e,t,o,i)})}loadScripts(e){const t=[];return e.forEach(e=>{let o=this.fetch(e.name,{id:e.id});t.push(o)}),Promise.all(t)}cleanUp(){for(let e in c)if(c.hasOwnProperty(e)){const t=document.getElementById(e);t&&t.parentElement.removeChild(t)}l={},c={}}}e("S",d),_([s],d.prototype,"_singlePromiseFactory",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=script-loader-171a2eef.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-loader-171a2eef.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as getAllParameters}from"./query-params-helper-
|
|
2
|
-
//# sourceMappingURL=script-loader-
|
|
1
|
+
import{g as getAllParameters}from"./query-params-helper-9d7ce8f1.js";import{b as RoomleDependencyInjection,B as Benchmark,I as INJECTABLES,_ as __decorate,i as inject}from"./roomle-dependency-injection-61a634e1.js";import{g as getAssetPath}from"./main-thread-to-worker-ab187cd2.js";class Main{constructor(e){this._context=e||RoomleDependencyInjection.getContext(this.getContextName()),Benchmark.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){RoomleDependencyInjection.setup(INJECTABLES);const e=getAllParameters();this.lookup("global-init-data").setOverrides(e),this.lookup("init-data",this._context).setOverrides(e)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const e in window.THREE)if(window.hasOwnProperty(e))try{delete window.THREE[e]}catch(e){console.error(e)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(e){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(e),this.setupDependencies(),this.bootFinished()}lookup(e,t){return window.__RML__DI__.lookup(e,t)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(e){e&&this.lookup("dom-helper",this._context).setDomElement(e),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),RoomleDependencyInjection.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}}let _scriptCache={},_idCache={};class ScriptLoader{constructor(e){this._creator_=e}fetch(e,t){return this._singlePromiseFactory.create(5,e,(o,n)=>{!function(e,t,o,n){if(-1===e.indexOf("http")&&(e=getAssetPath()+e),_scriptCache[e])return o();if(t.id&&_idCache[t.id])return n(new Error('There is already a script with ID "'+t.id+'"'));Benchmark.start("load_"+t.id.replace(/-/g,"_"));const i=document.createElement("script");i.async=!1,i.src=e,i.id=t.id,i.onload=()=>{_scriptCache[e]=!0,_idCache[t.id]=!0,Object.defineProperty(o,"name",{value:"resolve-"+t.id}),o()},i.onerror=e=>{n(e)},document.body.appendChild(i)}(e,t,o,n)})}loadScripts(e){const t=[];return e.forEach(e=>{let o=this.fetch(e.name,{id:e.id});t.push(o)}),Promise.all(t)}cleanUp(){for(let e in _idCache)if(_idCache.hasOwnProperty(e)){const t=document.getElementById(e);t&&t.parentElement.removeChild(t)}_scriptCache={},_idCache={}}}__decorate([inject],ScriptLoader.prototype,"_singlePromiseFactory",void 0);export{Main as M,ScriptLoader as S};
|
|
2
|
+
//# sourceMappingURL=script-loader-77e91d11.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-loader-77e91d11.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=stats-helper-
|
|
1
|
+
System.register(["./roomle-dependency-injection-9dd7ed00.nomodule.js","./main-thread-to-worker-e424b0c2.nomodule.js"],(function(e){var t,s;return{setters:[function(e){t=e._,s=e.i},function(){}],execute:function(){class a{constructor(){this._statPanels=[]}_init(){let e=new Stats;e.showPanel(0),e.dom.style.cssText="position:absolute;top:0px;left:0px;z-index:110;",document.body.appendChild(e.dom),this._statPanels.push(e);let t=new Stats;t.showPanel(2),t.dom.style.cssText="position:absolute;top:50px;left:0px;z-index:110;",document.body.appendChild(t.dom),this._statPanels.push(t);let s=new Stats;this._drawPanel=s.addPanel(new Stats.Panel("draw","#0f0","#000")),s.showPanel(3),s.dom.style.cssText="position:absolute;top:100px;left:0px;z-index:110;",document.body.appendChild(s.dom),this._statPanels.push(s);let a=new Stats;this._trianglesPanel=a.addPanel(new Stats.Panel("poly","#0f0","#000")),a.showPanel(3),a.dom.style.cssText="position:absolute;top:150px;left:0px;z-index:110;",document.body.appendChild(a.dom),this._statPanels.push(a);let n=new Stats;this._geometryPanel=n.addPanel(new Stats.Panel("geo","#f00","#000")),n.showPanel(3),n.dom.style.cssText="position:absolute;top:200px;left:0px;z-index:110;",document.body.appendChild(n.dom),this._statPanels.push(n);let l=new Stats;this._texturePanel=l.addPanel(new Stats.Panel("tex","#f00","#000")),l.showPanel(3),l.dom.style.cssText="position:absolute;top:250px;left:0px;z-index:110;",document.body.appendChild(l.dom),this._statPanels.push(l);let o=new Stats;this._materialPanel=o.addPanel(new Stats.Panel("mat","#f00","#000")),o.showPanel(3),o.dom.style.cssText="position:absolute;top:300px;left:0px;z-index:110;",document.body.appendChild(o.dom),this._statPanels.push(o);let d=new Stats;this._qualityPanel=d.addPanel(new Stats.Panel("quality","#fff","#000")),d.showPanel(3),d.dom.style.cssText="position:absolute;top:350px;left:0px;z-index:110;",document.body.appendChild(d.dom),this._statPanels.push(d)}updateRenderInfo(e){this._drawPanel&&e.render.calls>0&&this._drawPanel.update(e.render.calls,500),this._trianglesPanel&&e.render.triangles>0&&this._trianglesPanel.update(e.render.triangles,1e4),this._geometryPanel&&e.memory.geometries>0&&this._geometryPanel.update(e.memory.geometries,1e4),this._texturePanel&&e.memory.textures>0&&this._texturePanel.update(e.memory.textures,1e4),this._materialPanel&&this._cacheHolder.materialCache.size>0&&this._materialPanel.update(this._cacheHolder.materialCache.size,1e3),this._statPanels.length>0&&this._statPanels.forEach(e=>e.update())}updateQualityInfo(e){this._qualityPanel&&e&&this._qualityPanel.update(e.getQuality(),5)}}e("default",a),t([s],a.prototype,"_cacheHolder",void 0)}}}));
|
|
2
|
+
//# sourceMappingURL=stats-helper-65ca4b44.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats-helper-65ca4b44.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as __decorate,i as inject}from"./roomle-dependency-injection-
|
|
2
|
-
//# sourceMappingURL=stats-helper-
|
|
1
|
+
import{_ as __decorate,i as inject}from"./roomle-dependency-injection-61a634e1.js";import"./main-thread-to-worker-ab187cd2.js";class StatsHelper{constructor(){this._statPanels=[]}_init(){let e=new Stats;e.showPanel(0),e.dom.style.cssText="position:absolute;top:0px;left:0px;z-index:110;",document.body.appendChild(e.dom),this._statPanels.push(e);let t=new Stats;t.showPanel(2),t.dom.style.cssText="position:absolute;top:50px;left:0px;z-index:110;",document.body.appendChild(t.dom),this._statPanels.push(t);let a=new Stats;this._drawPanel=a.addPanel(new Stats.Panel("draw","#0f0","#000")),a.showPanel(3),a.dom.style.cssText="position:absolute;top:100px;left:0px;z-index:110;",document.body.appendChild(a.dom),this._statPanels.push(a);let s=new Stats;this._trianglesPanel=s.addPanel(new Stats.Panel("poly","#0f0","#000")),s.showPanel(3),s.dom.style.cssText="position:absolute;top:150px;left:0px;z-index:110;",document.body.appendChild(s.dom),this._statPanels.push(s);let l=new Stats;this._geometryPanel=l.addPanel(new Stats.Panel("geo","#f00","#000")),l.showPanel(3),l.dom.style.cssText="position:absolute;top:200px;left:0px;z-index:110;",document.body.appendChild(l.dom),this._statPanels.push(l);let n=new Stats;this._texturePanel=n.addPanel(new Stats.Panel("tex","#f00","#000")),n.showPanel(3),n.dom.style.cssText="position:absolute;top:250px;left:0px;z-index:110;",document.body.appendChild(n.dom),this._statPanels.push(n);let o=new Stats;this._materialPanel=o.addPanel(new Stats.Panel("mat","#f00","#000")),o.showPanel(3),o.dom.style.cssText="position:absolute;top:300px;left:0px;z-index:110;",document.body.appendChild(o.dom),this._statPanels.push(o);let d=new Stats;this._qualityPanel=d.addPanel(new Stats.Panel("quality","#fff","#000")),d.showPanel(3),d.dom.style.cssText="position:absolute;top:350px;left:0px;z-index:110;",document.body.appendChild(d.dom),this._statPanels.push(d)}updateRenderInfo(e){this._drawPanel&&e.render.calls>0&&this._drawPanel.update(e.render.calls,500),this._trianglesPanel&&e.render.triangles>0&&this._trianglesPanel.update(e.render.triangles,1e4),this._geometryPanel&&e.memory.geometries>0&&this._geometryPanel.update(e.memory.geometries,1e4),this._texturePanel&&e.memory.textures>0&&this._texturePanel.update(e.memory.textures,1e4),this._materialPanel&&this._cacheHolder.materialCache.size>0&&this._materialPanel.update(this._cacheHolder.materialCache.size,1e3),this._statPanels.length>0&&this._statPanels.forEach(e=>e.update())}updateQualityInfo(e){this._qualityPanel&&e&&this._qualityPanel.update(e.getQuality(),5)}}__decorate([inject],StatsHelper.prototype,"_cacheHolder",void 0);export{StatsHelper as default};
|
|
2
|
+
//# sourceMappingURL=stats-helper-ae6d8e53.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats-helper-ae6d8e53.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./script-loader-
|
|
2
|
-
//# sourceMappingURL=tools-core-
|
|
1
|
+
System.register(["./script-loader-171a2eef.nomodule.js","./roomle-dependency-injection-9dd7ed00.nomodule.js","./query-params-helper-fb60ee8f.nomodule.js","./main-thread-to-worker-e424b0c2.nomodule.js"],(function(o){var e,t,s,n;return{setters:[function(o){e=o.S,t=o.M},function(o){s=o.D,n=o.b},function(){},function(){}],execute:function(){const l=[new s("script-loader",e)];o("ToolsCore",class extends t{setupGlobals(){}setupDependencies(){n.setup(l),this.lookup("logger",this._context)}cleanUpGlobals(){this._tools=void 0,window.RoomleToolsCore&&delete window.RoomleToolsCore}cleanUpDependencies(){const o=this.lookup("script-loader");o&&o.cleanUp()}bootFinished(){this._tools=this.lookup("roomle-tools-core",this._context),window.RoomleToolsCore||(window.RoomleToolsCore=this._tools)}getApi(){return this._tools}getContextName(){return"tools-core"}})}}}));
|
|
2
|
+
//# sourceMappingURL=tools-core-1f401c76.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-core-1f401c76.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as ScriptLoader,M as Main}from"./script-loader-
|
|
2
|
-
//# sourceMappingURL=tools-core-
|
|
1
|
+
import{S as ScriptLoader,M as Main}from"./script-loader-77e91d11.js";import{D as DependencyInjectionAssignment,b as RoomleDependencyInjection}from"./roomle-dependency-injection-61a634e1.js";import"./query-params-helper-9d7ce8f1.js";import"./main-thread-to-worker-ab187cd2.js";const INJECTABLES=[new DependencyInjectionAssignment("script-loader",ScriptLoader)];class ToolsCore extends Main{setupGlobals(){}setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("logger",this._context)}cleanUpGlobals(){this._tools=void 0,window.RoomleToolsCore&&delete window.RoomleToolsCore}cleanUpDependencies(){const o=this.lookup("script-loader");o&&o.cleanUp()}bootFinished(){this._tools=this.lookup("roomle-tools-core",this._context),window.RoomleToolsCore||(window.RoomleToolsCore=this._tools)}getApi(){return this._tools}getContextName(){return"tools-core"}}export{ToolsCore};
|
|
2
|
+
//# sourceMappingURL=tools-core-7c28e1d3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-core-7c28e1d3.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/web-sdk",
|
|
3
|
-
"version": "2.80.0-alpha.
|
|
3
|
+
"version": "2.80.0-alpha.4",
|
|
4
4
|
"description": "Roomle Web SDK",
|
|
5
5
|
"author": "Roomle Development",
|
|
6
|
-
"main": "lib/roomle-sdk-
|
|
6
|
+
"main": "lib/roomle-sdk-fa9dfd96.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"release": "semantic-release && cd ../packages/eslint-plugin-roomle && npm i && npm run release && cd ../../dist",
|
|
9
9
|
"postinstall": "node scripts/copy-assets-sdk.js"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./roomle-dependency-injection-c12e4c00.nomodule.js","./main-thread-to-worker-ff04af1e.nomodule.js"],(function(e,t){var i,s,n,a,r,o,h,c,d,_,l,m,u,g,p,v,y,w,f,C,b,x,S,P,M,L,E,D,I,k,T,R,B,z,A,O,F,U,G,H,N,q,j,Z,K,W,Y,V,X,J,Q,$,ee,te,ie,se,ne,ae,re,oe,he,ce,de,_e,le,me,ue,ge,pe,ve,ye;return{setters:[function(e){i=e._,s=e.i,n=e.E,a=e.t,r=e.X,o=e.Y,h=e.g,c=e.y,d=e.H,_=e.Z,l=e.$,m=e.a0,u=e.a1,g=e.a2,p=e.a3,v=e.a4,y=e.a5,w=e.a6,f=e.a7,C=e.a8,b=e.a9,x=e.w,S=e.q,P=e.G},function(e){M=e.a,L=e.bD,E=e.N,D=e.V,I=e.bE,k=e.ae,T=e.ag,R=e.Q,B=e.aC,z=e.O,A=e.z,O=e.bG,F=e.bH,U=e.bI,G=e.m,H=e.bJ,N=e.C,q=e.r,j=e.w,Z=e.aX,K=e.S,W=e.A,Y=e.D,V=e.R,X=e.b1,J=e.h,Q=e.bc,$=e.b3,ee=e.u,te=e.B,ie=e.E,se=e.bK,ne=e.ap,ae=e.ao,re=e.av,oe=e.ah,he=e.a9,ce=e.al,de=e.aP,_e=e.a$,le=e.bL,me=e.bF,ue=e.bz,ge=e.i,pe=e.bo,ve=e.bM,ye=e.bN}],execute:function(){e("T","static/Tween-d57ee5d181fce582.js");class we extends n{constructor(e,t,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=a(10),this._yaw=a(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=e,this._inputManager=t,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new M,this._targetPosition=new M,i?this._cameraPosition.copy(i):this._cameraPosition=new M(0,.5,3),this._initData.debug){const e=this.getDebugCameraPosition();e&&this._setCurrentCameraParameters(e)}let s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=L(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.addEventListener(e.key,e.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.removeEventListener(e.key,e.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(e){let t=this._cameraPosition;if(!t||r(t,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._globalInitData.e2e)this.getCamera().position.copy(t);else{let i=this.getCamera().position.clone();const s=Math.min(10*e,1);i.lerp(t,s),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(e,t,i=!1){return this._globalInitData.e2e?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new M(t.targetX,t.targetY,t.targetZ),i),this.dispatchEvent(1,3),this.dispatchEvent(2,3),this.dispatchEvent(8,3),Promise.resolve()):new Promise(s=>{if(t.yaw-e.yaw<=-Math.PI?e.yaw-=2*Math.PI:t.yaw-e.yaw>=Math.PI&&(e.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=t,new TWEEN.Tween(e).to(t,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new M(e.targetX,e.targetY,e.targetZ),i)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,s()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const e=this.getCamera();if(e instanceof E){const t=Math.max(.1,this._distance/6);e.near=t}}getCurrentCameraParameters(){const e=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z}}_setCurrentCameraParameters(e){this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._targetPosition.copy(new M(e.targetX,e.targetY,e.targetZ))}_rotateHorizontal(e){this._yaw-=e,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(e){this._pitch+=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(e){if(e||!this._stateSaved){let e=this._yaw,t=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:t,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let e=this._getCamera();this._stateSaved.fov=e.fov,this._stateSaved.near=e.near,this._stateSaved.far=e.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let e=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z},this._stateSaved,!0)}this._stateSaved=null}setToState(e,t){this._tweenCameraParameter(e,t,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(e){const{x:t,y:i}=this._domHelper.getClientDimensions();return new M(e.x/t*2-1,-e.y/i*2+1,.5)}addLightContainer(e){e.name="lights";const t=this._getCamera(),i=t.children.find(e=>"lights"===e.name);i&&t.remove(i),t.add(e)}checkNearFarDistance(e){if(!e)return;const t=this._cameraPosition.distanceTo(e),i=this._getCamera();i instanceof E&&t>i.far&&(i.far=t+1)}setBounds(e){this._boundingBox=e}get domHelper(){return this._domHelper}}e("a",we),i([s],we.prototype,"_domHelper",void 0),i([s],we.prototype,"_initData",void 0),i([s],we.prototype,"_globalInitData",void 0);class fe{constructor(e,t){this.minZoom=!1,this.maxZoom=!1,this.minZoom=e,this.maxZoom=t}}e("Z",fe),e("D",2.725);class Ce extends we{constructor(e,t,i,s){super(e,t,i),this._bounds=new M,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=a(0),this.maxPolarAngle=a(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:n,zoomDistance:r,minVerticalCameraAngle:o,maxVerticalCameraAngle:h,minHorizontalCameraAngle:c,maxHorizontalCameraAngle:d}=this._initData;if(r&&(this._zoomDistance=r/100),void 0!==o&&(this.minPolarAngle=a(o<0?o:-1*o)),void 0!==h&&(this.maxPolarAngle=a(h)),void 0!==c&&(this.minAzimuthAngle=a(c<0?c:-1*c)),void 0!==d&&(this.maxAzimuthAngle=a(d)),void 0!==n){let e=Math.abs(a(n));this.minAzimuthAngle=-e,this.maxAzimuthAngle=e,this.maxPolarAngle=Math.min(e,a(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new E,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(e){this._objectRotation=e}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}animateCamera(e){if(!super.animateCamera(e))return!1;let t=this._targetPosition;return!!t&&(this.getCamera().lookAt(t),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:e=>{var t,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(t=e.event)||void 0===t?void 0:t.shiftKey)&&(null===(i=e.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new D(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:11,fun:e=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new D(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2,e.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:e})=>{this._maxZoomedIn||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:e})=>{this._maxZoomedOut||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomOut())}})}_panTargetPosition(e){const t=e.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),n=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-t.x/i.clientHeight*n,s.y=s.y+t.y/i.clientHeight*n,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(e,t){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0,t)),this._panTargetPosition(e),o(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}_move(e,t){this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0,t));const i=e.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(e):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),o(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}checkBoundsAndPlaceCamera(e,t=!0){this._boundingBox&&h(e,this._boundingBox)<=0?this.setBounds(e):this.zoomToFitBounds(e,t)}adjustToBoundsWithoutChangingDistance(e){this.setBounds(e);const t=e.getSize(new M);if(this._initData.debug||t.x+t.y+t.z===0)return;const i=this.getCurrentCameraParameters(),s=e.getCenter(new M);this._setDistanceAndRangesBasedOnBounds(t,!1);const n={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:s.x,targetY:s.y,targetZ:s.z};I(i,n)||this._tweenCameraParameter(i,n,!1)}zoomToFitBounds(e,t=!0){this.setBounds(e);const i=e.getSize(new M);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),n=e.getCenter(new M),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(e,a);const r={yaw:t?this._yaw:s.yaw,pitch:t?this._pitch:s.pitch,distance:a,targetX:n.x,targetY:n.y,targetZ:n.z};I(s,r)||this._tweenCameraParameter(s,r,!1)}updateToBounds(e,t,i=!0,s){if(this.setBounds(e),this._initData.debug)return;const n=e.getCenter(new M);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new M(n.x,n.y,n.z));const a=this.getCurrentCameraParameters(),r=e.getSize(new M);if(i){const i=this._setDistanceAndRangesBasedOnBounds(r);this._distance=i,this._checkZoomDistance(e,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},t):this._update()}else this._setDistanceAndRangesBasedOnBounds(r,!1);this._update()}_checkZoomDistance(e,t){const i=e.getBoundingSphere(new k);t-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=t-i.radius)}_setDistanceAndRangesBasedOnBounds(e,t=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(e);const{cameraSpacing:n}=this._initData;e.addScalar(n/100),this.minDistance=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);const a=Math.max(e.x,e.y),{x:r,y:o}=this._getMargin(i,s),h=c(e.x+r,e.y+o,e.z,this._camera.fov,i,s);return this._distance<h&&t&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:e,offsetHeight:t}=this._getOffset(),{x:i,y:s}=this._getMargin(e,t);return c(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,e,t)}_getOffset(){const e=this._domHelper.getClientDimensions(),t=e.x,i=e.y;return{offsetWidth:this._camera.offset?t-t*this._camera.offset.left-t*(1-this._camera.offset.right):t,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(e,t){let i=this._bounds.x/2,s=this._bounds.y/2;return e>1080&&(i+=this._bounds.x<.3?.1:0,i+=this._bounds.x*(e/1080-1)),t>1080&&(i+=this._bounds.y<.3?.1:0,s+=this._bounds.y*(t/1080-1)),{x:i,y:s}}reset(e,t,i,s,n=!0){const r=e.getSize(new M);if(r){if(t)this._targetPosition.copy(t);else{const t=e.getCenter(new M);this._targetPosition.copy(t)}const o=this.getCurrentCameraParameters();if(i||(i=-30),s||(s=10),i+=d(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(r),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(r);const h=this._setDistanceAndRangesBasedOnBounds(r),c=a(s),_=a(i);let l=this._targetPosition.clone();n?this._tweenCameraParameter(o,{yaw:_,pitch:c,distance:h,targetX:l.x,targetY:l.y,targetZ:l.z},!0):(this._pitch=c,this._yaw=_,this._distance=h,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateAndReset(e,t=!0){const i=e.getSize(new M),s=e.getCenter(new M);this.setBounds(e),this._targetPosition.copy(s),-1===this._distance&&(this._distance=this._setDistanceAndRangesBasedOnBounds(i));const n=this.getCurrentCameraParameters();this._pitch=a(10),this._yaw=a(-30+d(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(i);let r=this._targetPosition.clone();t?this._tweenCameraParameter(n,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:r.x,targetY:r.y,targetZ:r.z},!0):this._update(this._targetPosition)}_update(e,t){this._initData.debug?this._pitch=Math.max(a(-89),Math.min(a(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const i=new T(-this._pitch,this._yaw,0,"ZYX"),s=(new R).setFromEuler(i),n=new M(0,0,-1);n.applyQuaternion(s),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),e&&this._targetPosition.copy(e);const r=this._targetPosition.clone().sub(n.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(r),this._zoomChanged(!1,!1);else if(t)this._cameraPosition.copy(r);else{const e=this._getCameraSphere(r);null!=this._boundingBox&&this._boundingBox.intersectsSphere(e)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(e)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(r),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(e,t){let i=e+""+t;0===this._currentZoomHash.length||this._currentZoomHash!==i?(this.dispatchEvent(5,new fe(e,t)),this._currentZoomHash=i):e||t||this.dispatchEvent(5,new fe(e,t)),this._maxZoomedIn=t,this._maxZoomedOut=e}zoomTo(e){return this._tweenCameraParameter(this.getCurrentCameraParameters(),e,!0)}_getCameraSphere(e){const t=Math.max(this._bounds.x,this._bounds.y),i=Math.max(t/10,this._zoomDistance);return new k(e,i)}zoomIn(e){this._lerpEnabled=!0,this._scale*=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(e){this._lerpEnabled=!0,this._scale/=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(e){const{x:t,y:i,z:s}=this._boundingBox.getCenter(new M);e.targetX=e.targetX||t,e.targetY=e.targetY||i,e.targetZ=e.targetZ||s,e.distance=e.distance||this._getIdealDistance();const n=this.getCurrentCameraParameters(),a=B(JSON.parse(JSON.stringify(n)),e);return this._tweenCameraParameter(n,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}e("C",Ce);class be{constructor(e,t){this._scene=e,t&&(t.removeFromScene(),t.cleanUp())}updateCamera(e){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(e,t){this._bounds=e}cleanUp(){this._scene=null}}class xe{constructor(e){this._innerSize=1,this._outerSize=100,this._plane=new z,this._plane.rotation.x=-Math.PI/2;const t=_.createMeshStandardMaterial({});this._innerPlaneMesh=new A,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=t,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new A,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=t,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=e,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(e){this._innerSize=e,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(e,t){const i=new O;i.moveTo(-e/2,-e/2),i.lineTo(-e/2,e/2),i.lineTo(e/2,e/2),i.lineTo(e/2,-e/2),i.lineTo(-e/2,-e/2);const s=new O;s.moveTo(-t/2,-t/2),s.lineTo(-t/2,t/2),s.lineTo(t/2,t/2),s.lineTo(t/2,-t/2),s.lineTo(-t/2,-t/2);const n=new F;n.moveTo(-e/2,-e/2),n.lineTo(-e/2,e/2),n.lineTo(e/2,e/2),n.lineTo(e/2,-e/2),n.lineTo(-e/2,-e/2),s.holes.push(n);const a=new U(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const r=new U(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=r;const o=a.attributes.uv.clone();a.setAttribute("uv2",o);const h=a.attributes.uv2.array;for(let e=0;e<h.length;++e)h[e]+=.5}}class Se extends be{constructor(e,t,i){super(e,t),this._longestSide=2,this._bakedShadowPlane=new xe(100),this._fog=i||!1,this._textureLoader=new G,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(e){return super.updateBounds(e),this._longestSide=Math.max(e.x,e.z),this._update(),!0}updateCamera(e){this._cameraDistance=e.position.distanceTo(new M(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let e=this._longestSide/2;this._scene.fog=new H(16185078,this._cameraDistance+e+3,this._cameraDistance+e+3+1),this._scene.background=new N(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let e=this._width/1e3,t=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=q,this._floorTexture.wrapT=q,this._floorTexture.repeat.set(100/e,100/t));let i=_.createMeshStandardMaterial({map:this._floorTexture,side:j});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(e,t,i,s){return this._width=t,this._height=i,this._repeatable=s,this._floorPromise=new Promise((t,i)=>{this._textureLoader.load(e,e=>{this._floorTexture=e,t()},null,i)}),new Promise((e,t)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),e()},t)})}changeFloorMaterial(e,t){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=l(e),this._rapiAccess.getTexturesOf(e).then(e=>{if(e.length>0){let n=[];e.forEach(e=>{n.push(m(this._dataSyncer.requestAsset(e.image,!0),e,this._floorMaterial,t,1,1))}),Promise.all(n).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((e,t)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),e()},t)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let e=u();if(!e)return;let t=e.addFolder("Floor");t.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),t.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),t.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}e("F",Se),i([s],Se.prototype,"_rapiAccess",void 0),i([s],Se.prototype,"_dataSyncer",void 0);const Pe=Math.PI/4;class Me extends we{constructor(e,t,i,s){super(e,t,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=a(-60),this.maxPolarAngle=a(60),this._camera=s||new E,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new M,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new R,this._pitch=0,this._yaw=0;let n=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(e){this.startButtonPressListener()}_gamepadDisconnected(e){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let e=navigator.getGamepads()[0];this._checkRightStick(e),this._checkLeftStick(e),this._checkButtons(e),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(e){let t=e.axes[2],i=e.axes[3];Math.abs(t)>.2&&(this._rotateHorizontal(.01*Pe*t),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*Pe*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(e){let t=e.axes[0],i=e.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):e.buttons&&e.buttons[12]&&e.buttons[12].pressed?this._keyMap.set(87,!0):e.buttons&&e.buttons[13]&&e.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(t)>.2?t<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(e){e.buttons&&e.buttons[6]&&e.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),e.buttons&&e.buttons[14]&&e.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),e.buttons&&e.buttons[15]&&e.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(e){let t=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=r(t,s.position),a=g(i,s.quaternion);if(!t||n&&a)return!1;let o=this.getCamera().position.clone(),h=Math.min(10*e,1);o.lerp(t,h),this.getCamera().position.copy(o);let c=this.getCamera().quaternion.clone(),d=Math.min(5*e,1);c.slerp(i,d),this.getCamera().setRotationFromQuaternion(c);let _=!1;return this._keyMap.forEach(e=>{e&&(_=!0)}),_&&this._processKeyMap(this._keyMap,e),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),window.addEventListener("keyup",this._onKeyChanged,!1),window.addEventListener("keydown",this._onKeyChanged,!1),this._inputListeners.push({key:3,fun:e=>{this._down(e)}}),this._inputListeners.push({key:6,fun:e=>{this._move(e)}}),this._inputListeners.push({key:4,fun:e=>{this._up(e)}})}_removeInputListener(){window.removeEventListener("keyup",this._onKeyChanged,!1),window.removeEventListener("keydown",this._onKeyChanged,!1)}_down(e){this._downPosition=e.position,this._position=e.position,this._state=1,2===e.type&&window.setTimeout(this._onLongDown.bind(this),350),2===e.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(e){this._position=e.position,1!==this._state||this._locked||this._orbit(new D(e.position.x,e.position.y)),2!==this._state||this._locked||(this._orbit(new D(e.position.x,e.position.y)),this._moveForward())}_up(e){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){p(this._downPosition,this._position)<v&&1===this._state&&(this._state=2,this._orbit(new D(this._position.x,this._position.y)),this._moveForward())}_update(e){let t=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(t)}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}_onKeyChanged(e){this._keyMap.set(e.keyCode,"keydown"===e.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&e.preventDefault()}_processKeyMap(e,t){t=Math.min(t,.1);let i=new M(0,0,0),s=!1;return this._processUpDown(e,i,t),e.get(65)&&(i.x=-1*t),e.get(68)&&(i.x=1*t),e.get(37)&&(this._rotateHorizontal(-Pe*this._rotationSpeed*t),s=!0),e.get(39)&&(this._rotateHorizontal(Pe*this._rotationSpeed*t),s=!0),e.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new M(i.x,0,i.z)),this._update(),0))}_processUpDown(e,t,i){(e.get(87)||e.get(38))&&(t.z=-1*i),(e.get(83)||e.get(40))&&(t.z=1*i)}_orbit(e){this._orbitPosition||(this._orbitPosition=new D(e.x,e.y),this.dispatchEvent(0));let t=e.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;t.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*t.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*t.y/i.clientHeight*1),o(this._orbitPosition,e)||this.dispatchEvent(1),this._orbitPosition.copy(e),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(e){let t=this._pitch+e;t>this.maxPolarAngle||t<this.minPolarAngle||(this._pitch=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}cleanUp(){super.cleanUp(),this._removeInputListener()}}e("c",Me);class Le extends be{constructor(e,t,i,s,n){if(super(e,t),this._color=i,this._oldBackground=e.background,s&&n){this._canvas=s,this._style=document.createElement("style");let e='background-image: url("'+n+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+e+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}e("B",Le);class Ee{parse(e,t,i,s,n){let a=JSON.parse(s);return a.environment?this.load(e,t,i,a,n):null}load(e,t,i,s,n){let a,r=s.environment;if(!r)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(r.type){case"color":a=new Promise(t=>t(new Le(e,i,new N(r.details.color))));break;case"image":a=new Promise(s=>s(new Le(e,i,null,t,r.details.imageUrl)));break;case"floor":a=new Promise(t=>{this._rapiAccess.getMaterial(r.details.material).then(s=>{let a=void 0===r.details.fog||r.details.fog,o=new Se(e,i,a);o.changeFloorMaterial(s,n).then(()=>{t(o)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(e=>e(i))}return a}}i([s],Ee.prototype,"_rapiAccess",void 0);class De{constructor(e,t){this._scene=e,t&&t.removeFromScene()}needsBounds(){return!1}updateBounds(e){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new z),this._cameraContainer}}e("L",De);class Ie extends De{constructor(e,t){super(e,t),this._lights=[]}needsBounds(){return!0}updateBounds(e){if(this._cameraLight){const t=this._cameraLight,i=new M;e.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,t.shadow.camera.top=s/2,t.shadow.camera.bottom=-s/2,t.shadow.camera.left=-s/2,t.shadow.camera.right=s/2,t.shadow.camera.updateProjectionMatrix()}}loadFromJSON(e){return new Promise(t=>{this._lights=this._dynamicLightSettingLoader.parse(e),this.addToScene(),t()})}loadFromObject(e){return new Promise(t=>{(null==e?void 0:e.lights)||t(),this._lights=this._dynamicLightSettingLoader.load(e),this._lights.forEach((e,t)=>{e.userData.movesWithCamera&&(this._cameraLight=e,this._lights.splice(t,1))}),this.addToScene(),t()})}loadFromURL(e){return new Promise((t,i)=>{fetch(new Request(e,{method:"GET"})).then(Z).then(e=>this.loadFromObject(e).then(t,i))})}addToScene(){this._lights.forEach(e=>{this._scene.add(e)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(e,t){if(!this._cameraLight)return;let i=new M;e.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=t.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(e=>{this._scene.remove(e)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=u();this._cameraLight&&this._addToGUI(e,this._cameraLight),this._lights.forEach(t=>{this._addToGUI(e,t)})}_addToGUI(e,t){e&&(t instanceof K&&this._addSpotLightToGUI(e,t),t instanceof W&&this._addAmbientLightToGUI(e,t),t instanceof Y&&this._addDirectionalLightToGUI(e,t),t instanceof V&&this._addRectAreaLightToGUI(e,t))}_addRectAreaLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),intensity:t.intensity*(t.width*t.height)};i.add(t,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(e=>{t.intensity=e/(t.width*t.height)}),i.add(t,"castShadow"),i.addColor(s,"color").onChange(e=>{t.color=new N(e)}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}_addSpotLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString(),angle:180*t.angle/Math.PI};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.add(t,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new N(e)}),i.add(s,"angle").min(10).max(180).step(1).onChange(e=>{t.angle=e*Math.PI/180}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}_addAmbientLightToGUI(e,t){let i={name:t.name,color:"#"+t.color.getHexString()},s=e.addFolder(t.name);s.add(t,"visible"),s.add(t,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(e=>{t.color=new N(e)})}_addDirectionalLightToGUI(e,t){let i=e.addFolder(t.name),s={name:t.name,color:"#"+t.color.getHexString()};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(e=>{t.color=new N(e)}),i.add(t,"castShadow"),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new M(0,0,0))})}}i([s],Ie.prototype,"_dynamicLightSettingLoader",void 0);class ke extends A{constructor(e,t,i,s=128){if(t<=0||i<=0||s<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const n=new X(i,2*s,s);n.scale(1,1,-1);const a=n.getAttribute("position"),r=new M;for(let e=0;e<a.count;++e)if(r.fromBufferAttribute(a,e),r.y<0){const i=3*-t/2,s=r.y<i?-t/r.y:1-r.y*r.y/(3*i*i);r.multiplyScalar(s),r.toArray(a.array,3*e)}a.needsUpdate=!0,super(n,new J({map:e,depthWrite:!1}))}}class Te extends be{constructor(e,t,i){super(e,t),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(e){e&&(this._environmentTexture=e,this._skybox=new ke(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(e){let t=u();if(!t)return;let i=t.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(e),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(e)}}class Re{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const i=new Q(2,1),s=null!=t?t:new J({color:12632256,side:j}),n=new A(i,s);return n.position.z=-.1,e.add(n),n}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,i,s){const n=[],a=[];for(let e=0;e<this._lightSourceDetector.lightGraph.noOfNodes;++e)0===i.adjacent[e].length?n.push(t[e]):a.push(t[e]);const r=n.map(e=>e.uv),o=a.map(e=>e.uv),h=e.filter(e=>!r.includes(e)&&!o.includes(e));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(r,.01,255),this._createSamplePointsInMap(o,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map(e=>e.uv);this._createSamplePointsInMap(c,.015,16776960);let d=this._lightSourceDetector.lightSources;void 0!==s&&s>=0&&s<d.length&&(d=d.slice(0,s)),this._createCirclesInMap(d,8421376)}_createSamplePointsInMap(e,t,i){const s=new $(t,8,4),n=new J({color:i});e.forEach(e=>{var t;const i=new A(s,n);i.position.copy(this._uvToMapPosition(e)),i.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(i)})}_createCirclesInMap(e,t){const i=new J({color:t,transparent:!0,opacity:.5});e.forEach(e=>{var t;const s=new $(e.size,8,4),n=new A(s,i);n.position.copy(this._uvToMapPosition(e.uv)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)})}_createClusterLinesInMap(e,t,i){var s;const n=new ee({color:i}),a=[];t.forEach(t=>{for(let i=1;i<t.length;i++){const s=e[t[0]].uv,n=e[t[i]].uv;if(a.push(this._uvToMapPosition(s)),Math.abs(s.x-n.x)>.5){const e=(s.y+n.y)/2,t=s.x<n.x?0:1;a.push(this._uvToMapPosition(new D(t,e))),a.push(this._uvToMapPosition(new D(1-t,e)))}a.push(this._uvToMapPosition(n))}});const r=(new te).setFromPoints(a),o=new ie(r,n);o.name="clusterLine",null===(s=this._scene)||void 0===s||s.add(o)}_uvToMapPosition(e){return new M(2*e.x-1,e.y-.5,0)}}class Be extends se{constructor(e){super(e),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(e,t){var i,s;const n=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,a=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(n),0,-Math.sin(n),0,1,0,Math.sin(n),0,Math.cos(n)),super.fromEquirectangular(e)}_createEquirectMaterial(){const e=new ne({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new ae}},vertexShader:ze,fragmentShader:Ae,blending:re,depthTest:!1,depthWrite:!1});return this._equirectMaterial=e,e}}const ze="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",Ae="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class Oe{}class Fe{get lightSources(){return this._lightSources}set rotation(e){this._rotation!==e&&(this._rotation=e,this.needsUpdate=!0)}set intensity(e){this._intensity!==e&&(this._intensity=e,this.needsUpdate=!0)}set maxNoOfLightSources(e){this._maxNoOfLightSources!==e&&(this._maxNoOfLightSources=e,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(e,t){var i,s;this.needsUpdate=!0,this._lightSources=[],e instanceof Oe?this.environmentSceneGenerator=e:e instanceof oe?this.cubeTexture=e:e instanceof he&&(this.equirectangularTexture=e),(null==t?void 0:t.textureData)&&(this.textureData=null==t?void 0:t.textureData),this._rotation=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,this._intensity=null!==(s=null==t?void 0:t.intensity)&&void 0!==s?s:1,void 0!==(null==t?void 0:t.maxNoOfLightSources)&&(this._maxNoOfLightSources=t.maxNoOfLightSources),this._parameters=t,this._environment=e}clone(){return new Fe(this._environment,this._parameters)}createNewEnvironment(e){const t=this._createPmremTexture(e),i=this._detectLightSources(e,t);return this._lightSources=i.lightSources,null!=t?t:null}_getTextureOffset(){const e=this._rotation/(2*Math.PI)%1;return new D(e,0)}_createPmremTexture(e){const t=new Be(e);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=t.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=t.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const e=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=t.fromScene(e,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(e,t){const i=new y;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(e,this.equirectangularTexture,this.textureData):t&&i.detectLightSources(e,t),i}createDebugScene(e,t,i){const s=null!=i?i:-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new ce;const n=new w(!0,!1);n.setSourceTexture(t.environment),Re.createPlane(this._debugScene,n);const a=this._detectLightSources(e,t.environment);return new Re(a).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}class Ue extends Oe{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const i=new Ge({...this._parameters,lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)});return i.rotation.y=t,i}}class Ge extends ce{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:"all_around",this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const i="front"===this._type?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||i,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new de,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new _e(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(e);break;case"front":this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new N(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);t%2==0?this._createReflector(e,new D(s,n),3,1,.8,.2):this._createSideLight(e,new D(s,n),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new N(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);if(0===t){this._createReflector(e,new D(s,n),1.1,.6,.8,-.4);for(let i=0;i<2;i++){const s=(t-.3+.6*i)*Math.PI*2/6,n=Math.sin(s),a=Math.cos(s);this._createSideLight(e,new D(n,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new D(s,n),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,i){const s=new J;return s.color.set(e,null!=t?t:e,null!=i?i:e),s}_createTopLight(e,t,i){const s=new A(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),e.add(s)}_createSideLight(e,t,i,s,n,a,r){for(let o=0;o<3;o++){const h=s*this._sideLightIntensity,c=new A(this._lightGeometry,this._createAreaLightMaterial((o+i)%3==0?h:h*(1-this._colorVariation),(o+i)%3==1?h:h*(1-this._colorVariation),(o+i)%3==2?h:h*(1-this._colorVariation))),d=(1===o?-t.y:2===o?t.y:0)/Math.sqrt(2),_=0===o?0:1,l=(1===o?t.x:2===o?-t.x:0)/Math.sqrt(2);c.position.set(t.x*r*15+1.1*d*n,15*a+1.1*_*n,t.y*r*15+1.1*l*n),c.rotation.set(0,Math.atan2(t.x,t.y),0),c.scale.setScalar(n),e.add(c)}}_createReflector(e,t,i,s,n,a){const r=new A(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));r.position.set(15*t.x,10*a,15*t.y),r.scale.set(10*s,10*n,10*s),e.add(r)}}class He{get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}constructor(e,t,i,s){this._depthWriteMaterial=new J({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new le,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=e,this._canvasID=i,this._renderListener=()=>{this._requestRender()},this.createCameraControl(me(s),t),this._setupScene(t,this._initData.transparentBackground),this._lifeCycleManager.addEventListener(this)}addEventListener(e){throw new Error("Method not implemented.")}removeEventListener(e){throw new Error("Method not implemented.")}_changeCameraBehaviour(e){this._cameraBehaviour&&(this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this.cameraBehaviour.cameraControl instanceof Me&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener))),this._cameraBehaviour=e,this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),e.cameraControl instanceof Me&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(0,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const e=()=>{var t,i;if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=TWEEN.getAll();for(const t of e)t.end()}if(this._roomleRenderer)null===(t=this._statsHelper)||void 0===t||t.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_shouldRenderUi(){var e;return null===(e=this._pluginSystem)||void 0===e?void 0:e.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.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=t,this._scene.background=e}_animateCamera(){this.cameraBehaviour.cameraControl&&(this.cameraBehaviour.cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof Ie&&this.cameraBehaviour.cameraControl.getCamera()instanceof E&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof Ce&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(e,t){var i;const{x:s,y:n}=this._domHelper.getClientDimensions();this._scene=new ce,this._uiScene=new ce,(t=t||!1)||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new ue({antialias:!this._globalInitData.e2e,alpha:!0});const a=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(a),this._renderer.setSize(s,n),this._renderer.outputColorSpace=ge,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=pe,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new f(this._renderer,s,n),this._roomleRenderer.setQualityMap(C),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),null===(i=this._roomleRenderer)||void 0===i||i.setSize(s,n)),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(e=>{this._setEnvMap(e)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(e){await this._hdrEnvironmentLoader.loadUrl(this._renderer,e)}_setDefaultEnvironmentScene(){const e=this._initData.sceneLight;this._scene.userData.environmentDefinition=new Fe(new Ue({type:e}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(e){const{url:t,environmentMap:i}=e;this._scene.environment=i,this._scene.userData.environmentDefinition=new Fe(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof Te&&this._environment.updateEnvironmentTexture(i),t!==b||this._globalInitData.e2e||window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const e=["Shift","Meta","Control","Escape"];for(const t of e){const e=new KeyboardEvent("keyup",{key:t});this._onKeyUp(e,!0)}}updateCamera(e=!0){var t;const{x:i,y:s}=this._domHelper.getClientDimensions();null===(t=this._roomleRenderer)||void 0===t||t.setSize(i,s),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const e=this._getInputManager();e&&e.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(e){return"Object3D"===e.type||"Mesh"===e.type||"GLB"===e.type||"GLTF"===e.type||"Group"===e.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let e=[];this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)}),e.forEach(e=>{x(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(e){this._renderer.capabilities.maxTextures>8&&e&&this.loadDynamicLightSetting(e),this._requestRender()}_loadGLTF(e,t,i,s,n,a,r){return new Promise((o,h)=>{this._staticItemLoader.loadGLTF(e,t,i,s,n,a,null,r).then(e=>{o(e.scene)},h)})}_loadGLB(e,t,i,s,n,a,r,o){return new Promise((h,c)=>{this._staticItemLoader.loadGLB(e,t,i,s,n,a,r,o).then(e=>{h(e.scene)},c)})}showGUI(){if(this._initData.disableDebugGUI)return;const e=document.createElement("style");e.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(e);let t=u(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())}_guiLoaded(){let e=u();if(!e)return;const t=e.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};t.add(i,"intensity",0,4,.01).name("env map intensity").onChange(e=>{this.changeEnvironmentMapIntensity(e),this._requestRender()}),t.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(e=>{this._scene.userData.environmentDefinition.rotation=e,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(e)}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let i=t[e];i.__folders&&Object.keys(i.__folders).forEach(e=>{let t=i.__folders[e];this._addGUIListener(t)}),i.__controllers&&i.__controllers.forEach(e=>{e.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){t.import("./stats-helper-efe5bf85.nomodule.js").then(e=>this._statsHelper=new e.default)}_onKeyDown(e){}_onKeyUp(e,t=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}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(),this._releaseKeystrokeStates()}}async loadSceneSettings(e){let t,i;return t=e.environment?new Promise(t=>{(new Ee).load(this._scene,this._renderer.domElement,this._environment,e,this._maxAnisotropy).then(e=>{this._setEnvironment(e),t()})}):Promise.resolve(),e.lights?(this._lightSetting=new Ie(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(e)):i=Promise.resolve(),new Promise((e,s)=>{Promise.all([t,i]).then(()=>{this._renderEverything(),e()},s)})}setBackgroundColor(e){this._setEnvironment(new Le(this._scene,this._environment,new N(e)))}setBackgroundImage(e){this._setEnvironment(new Le(this._scene,this._environment,null,this._renderer.domElement,e))}_setEnvironment(e){this._environment=e,this._renderEverything()}async loadDynamicLightSetting(e){this._lightSetting=new Ie(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 i=S.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(i.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var e;this._updateBounds(this.getBounds(),this.getGeometryBounds()),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(e,t,i=!1){var s;if(!e)return;const n=null!=t?t:e;this.updateEnvironment(n,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),null===(s=this._roomleRenderer)||void 0===s||s.updateBounds(n),this._requestRender(),this._pluginSystem.updateBounds(e)}setCameraOffset(e){const t=this.cameraBehaviour.cameraControl.getCamera(),i=t||t;(null==i?void 0:i.offset)?(i.offset=e,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){var e,t;const i=null===(t=null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera(),s=i||i;return(null==s?void 0:s.offset)?JSON.parse(JSON.stringify(s.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=5;let s=t.x/t.y*i,n=i;const a=P();this._orthographicOffsetCamera=a.createOrthographicCamera(s/-2,s/2,n/2,n/-2,1,1e3,e),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new M(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=t.x,s=t.y,n=P();this._perspectiveOffsetCamera=n.createPerspectiveCamera(30,i/s,.1,20,e)}return this._perspectiveOffsetCamera}updateEnvironment(e,t=!1){var i;if(e&&this._environment&&this._environment.needsBounds()){const i=e.getSize(new M);(i.x+i.y+i.z!==0||t)&&this._environment.updateBounds(e.getSize(new M),t)}null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportImageFromCamera(e,t=!1){return t&&await this._waitForAssets(),new Promise((t,i)=>{this._onAfterRender=()=>{const s=this._renderer.domElement.toDataURL("image/jpeg",1),{left:n,right:a,top:r,bottom:o}=this.getCameraOffset(),h=a-n,c=r-o;if(1===h&&1===c)return ve(e,s),this._onAfterRender=()=>{},void t();const d=new Image;d.src=s,d.onload=()=>{const{naturalWidth:i,naturalHeight:s}=d,a=document.createElement("canvas");a.width=i*h,a.height=s*c;const o=a.getContext("2d"),_=i*n*-1,l=s*(1-r)*-1;o.drawImage(d,_,l),o.save(),ve(e,a.toDataURL("image/jpeg",1)),t(),this._onAfterRender=()=>{}},d.onerror=i},this._requestRender()})}changeEnvironmentMapIntensity(e){this._scene.userData.environmentDefinition.intensity=e}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(e,t,i,s){void 0!==e&&this._hdrEnvironmentLoader.loadUrl(this._renderer,e),void 0!==t&&(this._scene.userData.environmentDefinition.intensity=t),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==s&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}}e("S",He),i([s],He.prototype,"_domHelper",void 0),i([s],He.prototype,"_scriptLoader",void 0),i([s],He.prototype,"_lifeCycleManager",void 0),i([s],He.prototype,"_staticItemLoader",void 0),i([s],He.prototype,"_hdrEnvironmentLoader",void 0),i([s],He.prototype,"_initData",void 0),i([s],He.prototype,"_globalInitData",void 0),i([s],He.prototype,"_idbManager",void 0),i([s],He.prototype,"_pluginSystem",void 0),i([s],He.prototype,"_imageRenderer",void 0),i([s],He.prototype,"_cameraBehaviourState",void 0),e("b",class{constructor(e,t){return this._debug=!1,this._state=null,this._cameraChangeListener=null,this._cameraControl=e,this._state=t,this._debug?ye(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(e){this._cameraChangeListener=e}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}})}}}));
|
|
2
|
-
//# sourceMappingURL=camera-behaviour-1b0b7853.nomodule.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as __decorate,i as inject,E as EventDispatcher,t as toRadiant,X as position3VectorsAreEqual,Y as position2VectorsAreEqual,g as compareBox3Size,y as getIdealDistance,H as toDegrees,Z as MaterialCreator,$ as createMaterial,a0 as addTexture,a1 as getGUI,a2 as rotationQuaternionsAreEqual,a3 as getDelta,a4 as MIN_MOVE_DISTANCE,a5 as LightSourceDetector,a6 as EnvironmentMapDecodeMaterial,a7 as RoomleWebGLRenderer,a8 as standaloneConfiguratorQualityLevels,a9 as ENV_HDR_256_FILE_NAME,w as dispose,q as DynamicLightSettingLoader,G as RoomleComponentFactoryInitializer}from"./roomle-dependency-injection-56db2f22.js";import{a as Vector3,bD as debounce,N as PerspectiveCamera,V as Vector2,bE as areCameraParametersEqual,ae as Sphere,ag as Euler,Q as Quaternion,aC as deepMerge,O as Object3D,z as Mesh,bG as Shape,bH as Path,bI as ShapeGeometry,m as TextureLoader,bJ as Fog,C as Color,r as RepeatWrapping,w as DoubleSide,aX as handleJsonResponse,S as SpotLight,A as AmbientLight,D as DirectionalLight,R as RectAreaLight,b1 as SphereGeometry,h as MeshBasicMaterial,bc as PlaneGeometry,b3 as CircleGeometry,u as LineBasicMaterial,B as BufferGeometry,E as LineSegments,bK as PMREMGenerator,ap as ShaderMaterial,ao as Matrix3,av as NoBlending,ah as CubeTexture,a9 as Texture,al as Scene,aP as BoxGeometry,a$ as CylinderGeometry,bL as Clock,bF as sanitizedCameraMode,bz as WebGLRenderer,i as SRGBColorSpace,bo as PCFSoftShadowMap,bM as download,bN as traceMethodCalls}from"./main-thread-to-worker-82b32425.js";var TWEEN_FILE_NAME="static/Tween-d57ee5d181fce582.js";class CameraControl extends EventDispatcher{constructor(e,t,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=toRadiant(10),this._yaw=toRadiant(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=e,this._inputManager=t,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new Vector3,this._targetPosition=new Vector3,i?this._cameraPosition.copy(i):this._cameraPosition=new Vector3(0,.5,3),this._initData.debug){const e=this.getDebugCameraPosition();e&&this._setCurrentCameraParameters(e)}let n=this._domHelper.getClientDimensions();this._width=n.x,this._height=n.y,this._dispatchCameraIdle=debounce(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.addEventListener(e.key,e.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(e=>{this._inputManager.removeEventListener(e.key,e.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(e){let t=this._cameraPosition;if(!t||position3VectorsAreEqual(t,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._globalInitData.e2e)this.getCamera().position.copy(t);else{let i=this.getCamera().position.clone();const n=Math.min(10*e,1);i.lerp(t,n),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(e,t,i=!1){return this._globalInitData.e2e?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new Vector3(t.targetX,t.targetY,t.targetZ),i),this.dispatchEvent(1,3),this.dispatchEvent(2,3),this.dispatchEvent(8,3),Promise.resolve()):new Promise(n=>{if(t.yaw-e.yaw<=-Math.PI?e.yaw-=2*Math.PI:t.yaw-e.yaw>=Math.PI&&(e.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=t,new TWEEN.Tween(e).to(t,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new Vector3(e.targetX,e.targetY,e.targetZ),i)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,n()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const e=this.getCamera();if(e instanceof PerspectiveCamera){const t=Math.max(.1,this._distance/6);e.near=t}}getCurrentCameraParameters(){const e=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z}}_setCurrentCameraParameters(e){this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._targetPosition.copy(new Vector3(e.targetX,e.targetY,e.targetZ))}_rotateHorizontal(e){this._yaw-=e,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(e){this._pitch+=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(e){if(e||!this._stateSaved){let e=this._yaw,t=this._pitch,i=this._distance,n=this._targetPosition.clone();if(this._stateSaved={yaw:e,pitch:t,distance:i,targetX:n.x,targetY:n.y,targetZ:n.z,blockOtherTweens:!0},this._getCamera().fov){let e=this._getCamera();this._stateSaved.fov=e.fov,this._stateSaved.near=e.near,this._stateSaved.far=e.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let e=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:e.x,targetY:e.y,targetZ:e.z},this._stateSaved,!0)}this._stateSaved=null}setToState(e,t){this._tweenCameraParameter(e,t,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(e){const{x:t,y:i}=this._domHelper.getClientDimensions();return new Vector3(e.x/t*2-1,-e.y/i*2+1,.5)}addLightContainer(e){e.name="lights";const t=this._getCamera(),i=t.children.find(e=>"lights"===e.name);i&&t.remove(i),t.add(e)}checkNearFarDistance(e){if(!e)return;const t=this._cameraPosition.distanceTo(e),i=this._getCamera();i instanceof PerspectiveCamera&&t>i.far&&(i.far=t+1)}setBounds(e){this._boundingBox=e}get domHelper(){return this._domHelper}}__decorate([inject],CameraControl.prototype,"_domHelper",void 0),__decorate([inject],CameraControl.prototype,"_initData",void 0),__decorate([inject],CameraControl.prototype,"_globalInitData",void 0);class ZoomChangeEvent{constructor(e,t){this.minZoom=!1,this.maxZoom=!1,this.minZoom=e,this.maxZoom=t}}const DISTANCE_FACTOR=2.725;class CameraControl3D extends CameraControl{constructor(e,t,i,n){super(e,t,i),this._bounds=new Vector3,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=toRadiant(0),this.maxPolarAngle=toRadiant(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,n?this._camera=n:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new Vector3(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:a,zoomDistance:s,minVerticalCameraAngle:r,maxVerticalCameraAngle:o,minHorizontalCameraAngle:h,maxHorizontalCameraAngle:c}=this._initData;if(s&&(this._zoomDistance=s/100),void 0!==r&&(this.minPolarAngle=toRadiant(r<0?r:-1*r)),void 0!==o&&(this.maxPolarAngle=toRadiant(o)),void 0!==h&&(this.minAzimuthAngle=toRadiant(h<0?h:-1*h)),void 0!==c&&(this.maxAzimuthAngle=toRadiant(c)),void 0!==a){let e=Math.abs(toRadiant(a));this.minAzimuthAngle=-e,this.maxAzimuthAngle=e,this.maxPolarAngle=Math.min(e,toRadiant(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new PerspectiveCamera,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(e){this._objectRotation=e}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}animateCamera(e){if(!super.animateCamera(e))return!1;let t=this._targetPosition;return!!t&&(this.getCamera().lookAt(t),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:e=>{var t,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(t=e.event)||void 0===t?void 0:t.shiftKey)&&(null===(i=e.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new Vector2(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:11,fun:e=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new Vector2(e.position.x,e.position.y),e.type))}}),this._inputListeners.push({key:4,fun:e=>{1===this._state&&this.dispatchEvent(2,e.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:e})=>{this._maxZoomedIn||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:e})=>{this._maxZoomedOut||(e&&(e.preventDefault(),e.stopPropagation()),this.zoomOut())}})}_panTargetPosition(e){const t=e.clone().sub(this._orbitPosition),i=this._domHelper.element,n=this._targetPosition.project(this._camera),a=Math.max(2,4*(1-this._distance/this.maxDistance));n.x=n.x-t.x/i.clientHeight*a,n.y=n.y+t.y/i.clientHeight*a,this._targetPositionIsPanned=!0,this._targetPosition.copy(n.unproject(this._camera))}_pan(e,t){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new Vector2(e.x,e.y),this.dispatchEvent(0,t)),this._panTargetPosition(e),position2VectorsAreEqual(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}_move(e,t){this._orbitPosition||(this._orbitPosition=new Vector2(e.x,e.y),this.dispatchEvent(0,t));const i=e.clone().sub(this._orbitPosition),n=this._domHelper.element;this._panningEnabled?this._panTargetPosition(e):(this._rotateHorizontal(2*Math.PI*i.x/n.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/n.clientHeight*1)),position2VectorsAreEqual(this._orbitPosition,e)||this.dispatchEvent(1,t),this._orbitPosition.copy(e),this._update()}checkBoundsAndPlaceCamera(e,t=!0){this._boundingBox&&compareBox3Size(e,this._boundingBox)<=0?this.setBounds(e):this.zoomToFitBounds(e,t)}adjustToBoundsWithoutChangingDistance(e){this.setBounds(e);const t=e.getSize(new Vector3);if(this._initData.debug||t.x+t.y+t.z===0)return;const i=this.getCurrentCameraParameters(),n=e.getCenter(new Vector3);this._setDistanceAndRangesBasedOnBounds(t,!1);const a={yaw:i.yaw,pitch:i.pitch,distance:this._distance,targetX:n.x,targetY:n.y,targetZ:n.z};areCameraParametersEqual(i,a)||this._tweenCameraParameter(i,a,!1)}zoomToFitBounds(e,t=!0){this.setBounds(e);const i=e.getSize(new Vector3);if(this._initData.debug||i.x+i.y+i.z===0)return;const n=this.getCurrentCameraParameters(),a=e.getCenter(new Vector3),s=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(e,s);const r={yaw:t?this._yaw:n.yaw,pitch:t?this._pitch:n.pitch,distance:s,targetX:a.x,targetY:a.y,targetZ:a.z};areCameraParametersEqual(n,r)||this._tweenCameraParameter(n,r,!1)}updateToBounds(e,t,i=!0,n){if(this.setBounds(e),this._initData.debug)return;const a=e.getCenter(new Vector3);n?(this._targetPosition=n.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new Vector3(a.x,a.y,a.z));const s=this.getCurrentCameraParameters(),r=e.getSize(new Vector3);if(i){const i=this._setDistanceAndRangesBasedOnBounds(r);this._distance=i,this._checkZoomDistance(e,i),this._userInteraction?this._tweenCameraParameter(s,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},t):this._update()}else this._setDistanceAndRangesBasedOnBounds(r,!1);this._update()}_checkZoomDistance(e,t){const i=e.getBoundingSphere(new Sphere);t-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=t-i.radius)}_setDistanceAndRangesBasedOnBounds(e,t=!0){const{offsetWidth:i,offsetHeight:n}=this._getOffset();this._bounds.copy(e);const{cameraSpacing:a}=this._initData;e.addScalar(a/100),this.minDistance=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);const s=Math.max(e.x,e.y),{x:r,y:o}=this._getMargin(i,n),h=getIdealDistance(e.x+r,e.y+o,e.z,this._camera.fov,i,n);return this._distance<h&&t&&(this._distance=h),this.maxDistance=h+s,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:e,offsetHeight:t}=this._getOffset(),{x:i,y:n}=this._getMargin(e,t);return getIdealDistance(this._bounds.x+i,this._bounds.y+n,this._bounds.z,this._camera.fov,e,t)}_getOffset(){const e=this._domHelper.getClientDimensions(),t=e.x,i=e.y;return{offsetWidth:this._camera.offset?t-t*this._camera.offset.left-t*(1-this._camera.offset.right):t,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(e,t){let i=this._bounds.x/2,n=this._bounds.y/2;return e>1080&&(i+=this._bounds.x<.3?.1:0,i+=this._bounds.x*(e/1080-1)),t>1080&&(i+=this._bounds.y<.3?.1:0,n+=this._bounds.y*(t/1080-1)),{x:i,y:n}}reset(e,t,i,n,a=!0){const s=e.getSize(new Vector3);if(s){if(t)this._targetPosition.copy(t);else{const t=e.getCenter(new Vector3);this._targetPosition.copy(t)}const r=this.getCurrentCameraParameters();if(i||(i=-30),n||(n=10),i+=toDegrees(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(s),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(s);const o=this._setDistanceAndRangesBasedOnBounds(s),h=toRadiant(n),c=toRadiant(i);let d=this._targetPosition.clone();a?this._tweenCameraParameter(r,{yaw:c,pitch:h,distance:o,targetX:d.x,targetY:d.y,targetZ:d.z},!0):(this._pitch=h,this._yaw=c,this._distance=o,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateAndReset(e,t=!0){const i=e.getSize(new Vector3),n=e.getCenter(new Vector3);this.setBounds(e),this._targetPosition.copy(n),-1===this._distance&&(this._distance=this._setDistanceAndRangesBasedOnBounds(i));const a=this.getCurrentCameraParameters();this._pitch=toRadiant(10),this._yaw=toRadiant(-30+toDegrees(this._objectRotation)),this._setDistanceAndRangesBasedOnBounds(i);let s=this._targetPosition.clone();t?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:s.x,targetY:s.y,targetZ:s.z},!0):this._update(this._targetPosition)}_update(e,t){this._initData.debug?this._pitch=Math.max(toRadiant(-89),Math.min(toRadiant(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const i=new Euler(-this._pitch,this._yaw,0,"ZYX"),n=(new Quaternion).setFromEuler(i),a=new Vector3(0,0,-1);a.applyQuaternion(n),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),e&&this._targetPosition.copy(e);const s=this._targetPosition.clone().sub(a.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(s),this._zoomChanged(!1,!1);else if(t)this._cameraPosition.copy(s);else{const e=this._getCameraSphere(s);null!=this._boundingBox&&this._boundingBox.intersectsSphere(e)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(e)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(s),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(e,t){let i=e+""+t;0===this._currentZoomHash.length||this._currentZoomHash!==i?(this.dispatchEvent(5,new ZoomChangeEvent(e,t)),this._currentZoomHash=i):e||t||this.dispatchEvent(5,new ZoomChangeEvent(e,t)),this._maxZoomedIn=t,this._maxZoomedOut=e}zoomTo(e){return this._tweenCameraParameter(this.getCurrentCameraParameters(),e,!0)}_getCameraSphere(e){const t=Math.max(this._bounds.x,this._bounds.y),i=Math.max(t/10,this._zoomDistance);return new Sphere(e,i)}zoomIn(e){this._lerpEnabled=!0,this._scale*=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(e){this._lerpEnabled=!0,this._scale/=e?Math.pow(.95,e):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new Vector3(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(e){const{x:t,y:i,z:n}=this._boundingBox.getCenter(new Vector3);e.targetX=e.targetX||t,e.targetY=e.targetY||i,e.targetZ=e.targetZ||n,e.distance=e.distance||this._getIdealDistance();const a=this.getCurrentCameraParameters(),s=deepMerge(JSON.parse(JSON.stringify(a)),e);return this._tweenCameraParameter(a,s,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const e=this.maxDistance;return 1-this._distance/(e-2)+.2}}class Environment{constructor(e,t){this._scene=e,t&&(t.removeFromScene(),t.cleanUp())}updateCamera(e){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(e,t){this._bounds=e}cleanUp(){this._scene=null}}class BakedShadowPlane{constructor(e){this._innerSize=1,this._outerSize=100,this._plane=new Object3D,this._plane.rotation.x=-Math.PI/2;const t=MaterialCreator.createMeshStandardMaterial({});this._innerPlaneMesh=new Mesh,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=t,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new Mesh,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=t,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=e,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(e){this._innerSize=e,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(e,t){const i=new Shape;i.moveTo(-e/2,-e/2),i.lineTo(-e/2,e/2),i.lineTo(e/2,e/2),i.lineTo(e/2,-e/2),i.lineTo(-e/2,-e/2);const n=new Shape;n.moveTo(-t/2,-t/2),n.lineTo(-t/2,t/2),n.lineTo(t/2,t/2),n.lineTo(t/2,-t/2),n.lineTo(-t/2,-t/2);const a=new Path;a.moveTo(-e/2,-e/2),a.lineTo(-e/2,e/2),a.lineTo(e/2,e/2),a.lineTo(e/2,-e/2),a.lineTo(-e/2,-e/2),n.holes.push(a);const s=new ShapeGeometry(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=s;const r=new ShapeGeometry(n);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=r;const o=s.attributes.uv.clone();s.setAttribute("uv2",o);const h=s.attributes.uv2.array;for(let e=0;e<h.length;++e)h[e]+=.5}}class FloorEnvironment extends Environment{constructor(e,t,i){super(e,t),this._longestSide=2,this._bakedShadowPlane=new BakedShadowPlane(100),this._fog=i||!1,this._textureLoader=new TextureLoader,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(e){return super.updateBounds(e),this._longestSide=Math.max(e.x,e.z),this._update(),!0}updateCamera(e){this._cameraDistance=e.position.distanceTo(new Vector3(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let e=this._longestSide/2;this._scene.fog=new Fog(16185078,this._cameraDistance+e+3,this._cameraDistance+e+3+1),this._scene.background=new Color(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let e=this._width/1e3,t=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=RepeatWrapping,this._floorTexture.wrapT=RepeatWrapping,this._floorTexture.repeat.set(100/e,100/t));let i=MaterialCreator.createMeshStandardMaterial({map:this._floorTexture,side:DoubleSide});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(e,t,i,n){return this._width=t,this._height=i,this._repeatable=n,this._floorPromise=new Promise((t,i)=>{this._textureLoader.load(e,e=>{this._floorTexture=e,t()},null,i)}),new Promise((e,t)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),e()},t)})}changeFloorMaterial(e,t){this._floorPromise=new Promise((i,n)=>{this._floorMaterial=createMaterial(e),this._rapiAccess.getTexturesOf(e).then(e=>{if(e.length>0){let a=[];e.forEach(e=>{a.push(addTexture(this._dataSyncer.requestAsset(e.image,!0),e,this._floorMaterial,t,1,1))}),Promise.all(a).then(()=>{setTimeout(()=>i(),0)},n)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((e,t)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),e()},t)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let e=getGUI();if(!e)return;let t=e.addFolder("Floor");t.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),t.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),t.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),t.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),t.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}__decorate([inject],FloorEnvironment.prototype,"_rapiAccess",void 0),__decorate([inject],FloorEnvironment.prototype,"_dataSyncer",void 0);const KEYBOARD_ROTATION_ANGLE=Math.PI/4;class CameraControlFirstPerson extends CameraControl{constructor(e,t,i,n){super(e,t,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=toRadiant(-60),this.maxPolarAngle=toRadiant(60),this._camera=n||new PerspectiveCamera,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new Vector3,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new Quaternion,this._pitch=0,this._yaw=0;let a=new Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(a),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(e){this.startButtonPressListener()}_gamepadDisconnected(e){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let e=navigator.getGamepads()[0];this._checkRightStick(e),this._checkLeftStick(e),this._checkButtons(e),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(e){let t=e.axes[2],i=e.axes[3];Math.abs(t)>.2&&(this._rotateHorizontal(.01*KEYBOARD_ROTATION_ANGLE*t),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*KEYBOARD_ROTATION_ANGLE*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(e){let t=e.axes[0],i=e.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):e.buttons&&e.buttons[12]&&e.buttons[12].pressed?this._keyMap.set(87,!0):e.buttons&&e.buttons[13]&&e.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(t)>.2?t<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(e){e.buttons&&e.buttons[6]&&e.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),e.buttons&&e.buttons[14]&&e.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),e.buttons&&e.buttons[15]&&e.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(e){let t=this._cameraPosition,i=this._cameraRotation,n=this.getCamera(),a=position3VectorsAreEqual(t,n.position),s=rotationQuaternionsAreEqual(i,n.quaternion);if(!t||a&&s)return!1;let r=this.getCamera().position.clone(),o=Math.min(10*e,1);r.lerp(t,o),this.getCamera().position.copy(r);let h=this.getCamera().quaternion.clone(),c=Math.min(5*e,1);h.slerp(i,c),this.getCamera().setRotationFromQuaternion(h);let d=!1;return this._keyMap.forEach(e=>{e&&(d=!0)}),d&&this._processKeyMap(this._keyMap,e),!0}_getCamera(){return this._camera}_initInputListener(){this._onKeyChanged=this._onKeyChanged.bind(this),window.addEventListener("keyup",this._onKeyChanged,!1),window.addEventListener("keydown",this._onKeyChanged,!1),this._inputListeners.push({key:3,fun:e=>{this._down(e)}}),this._inputListeners.push({key:6,fun:e=>{this._move(e)}}),this._inputListeners.push({key:4,fun:e=>{this._up(e)}})}_removeInputListener(){window.removeEventListener("keyup",this._onKeyChanged,!1),window.removeEventListener("keydown",this._onKeyChanged,!1)}_down(e){this._downPosition=e.position,this._position=e.position,this._state=1,2===e.type&&window.setTimeout(this._onLongDown.bind(this),350),2===e.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(e){this._position=e.position,1!==this._state||this._locked||this._orbit(new Vector2(e.position.x,e.position.y)),2!==this._state||this._locked||(this._orbit(new Vector2(e.position.x,e.position.y)),this._moveForward())}_up(e){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){getDelta(this._downPosition,this._position)<MIN_MOVE_DISTANCE&&1===this._state&&(this._state=2,this._orbit(new Vector2(this._position.x,this._position.y)),this._moveForward())}_update(e){let t=new Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(t)}updateCamera(){let{x:e,y:t}=this._domHelper.getClientDimensions();this._camera.aspect=e/t,this._camera.updateProjectionMatrix()}_onKeyChanged(e){this._keyMap.set(e.keyCode,"keydown"===e.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&e.preventDefault()}_processKeyMap(e,t){t=Math.min(t,.1);let i=new Vector3(0,0,0),n=!1;return this._processUpDown(e,i,t),e.get(65)&&(i.x=-1*t),e.get(68)&&(i.x=1*t),e.get(37)&&(this._rotateHorizontal(-KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*t),n=!0),e.get(39)&&(this._rotateHorizontal(KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*t),n=!0),e.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!n||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new Vector3(i.x,0,i.z)),this._update(),0))}_processUpDown(e,t,i){(e.get(87)||e.get(38))&&(t.z=-1*i),(e.get(83)||e.get(40))&&(t.z=1*i)}_orbit(e){this._orbitPosition||(this._orbitPosition=new Vector2(e.x,e.y),this.dispatchEvent(0));let t=e.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;t.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*t.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*t.y/i.clientHeight*1),position2VectorsAreEqual(this._orbitPosition,e)||this.dispatchEvent(1),this._orbitPosition.copy(e),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(e){let t=this._pitch+e;t>this.maxPolarAngle||t<this.minPolarAngle||(this._pitch=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}cleanUp(){super.cleanUp(),this._removeInputListener()}}class BackgroundEnvironment extends Environment{constructor(e,t,i,n,a){if(super(e,t),this._color=i,this._oldBackground=e.background,n&&a){this._canvas=n,this._style=document.createElement("style");let e='background-image: url("'+a+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+e+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}class DynamicEnvironmentSettingLoader{parse(e,t,i,n,a){let s=JSON.parse(n);return s.environment?this.load(e,t,i,s,a):null}load(e,t,i,n,a){let s,r=n.environment;if(!r)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(r.type){case"color":s=new Promise(t=>t(new BackgroundEnvironment(e,i,new Color(r.details.color))));break;case"image":s=new Promise(n=>n(new BackgroundEnvironment(e,i,null,t,r.details.imageUrl)));break;case"floor":s=new Promise(t=>{this._rapiAccess.getMaterial(r.details.material).then(n=>{let s=void 0===r.details.fog||r.details.fog,o=new FloorEnvironment(e,i,s);o.changeFloorMaterial(n,a).then(()=>{t(o)})})});break;default:console.warn("Could not load environment, return old environment"),s=new Promise(e=>e(i))}return s}}__decorate([inject],DynamicEnvironmentSettingLoader.prototype,"_rapiAccess",void 0);class LightSetting{constructor(e,t){this._scene=e,t&&t.removeFromScene()}needsBounds(){return!1}updateBounds(e){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new Object3D),this._cameraContainer}}class DynamicLightSetting extends LightSetting{constructor(e,t){super(e,t),this._lights=[]}needsBounds(){return!0}updateBounds(e){if(this._cameraLight){const t=this._cameraLight,i=new Vector3;e.getSize(i);const n=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=n,t.shadow.camera.top=n/2,t.shadow.camera.bottom=-n/2,t.shadow.camera.left=-n/2,t.shadow.camera.right=n/2,t.shadow.camera.updateProjectionMatrix()}}loadFromJSON(e){return new Promise(t=>{this._lights=this._dynamicLightSettingLoader.parse(e),this.addToScene(),t()})}loadFromObject(e){return new Promise(t=>{(null==e?void 0:e.lights)||t(),this._lights=this._dynamicLightSettingLoader.load(e),this._lights.forEach((e,t)=>{e.userData.movesWithCamera&&(this._cameraLight=e,this._lights.splice(t,1))}),this.addToScene(),t()})}loadFromURL(e){return new Promise((t,i)=>{fetch(new Request(e,{method:"GET"})).then(handleJsonResponse).then(e=>this.loadFromObject(e).then(t,i))})}addToScene(){this._lights.forEach(e=>{this._scene.add(e)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(e,t){if(!this._cameraLight)return;let i=new Vector3;e.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let n=t.clone().add(i);this._cameraLight.position.copy(n)}removeFromScene(){this._lights.forEach(e=>{this._scene.remove(e)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=getGUI();this._cameraLight&&this._addToGUI(e,this._cameraLight),this._lights.forEach(t=>{this._addToGUI(e,t)})}_addToGUI(e,t){e&&(t instanceof SpotLight&&this._addSpotLightToGUI(e,t),t instanceof AmbientLight&&this._addAmbientLightToGUI(e,t),t instanceof DirectionalLight&&this._addDirectionalLightToGUI(e,t),t instanceof RectAreaLight&&this._addRectAreaLightToGUI(e,t))}_addRectAreaLightToGUI(e,t){let i=e.addFolder(t.name),n={name:t.name,color:"#"+t.color.getHexString(),intensity:t.intensity*(t.width*t.height)};i.add(t,"visible"),i.add(n,"intensity").min(10).max(400).step(10).onChange(e=>{t.intensity=e/(t.width*t.height)}),i.add(t,"castShadow"),i.addColor(n,"color").onChange(e=>{t.color=new Color(e)}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))})}_addSpotLightToGUI(e,t){let i=e.addFolder(t.name),n={name:t.name,color:"#"+t.color.getHexString(),angle:180*t.angle/Math.PI};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.add(t,"penumbra").min(0).max(1).step(.1),i.addColor(n,"color").onChange(e=>{t.color=new Color(e)}),i.add(n,"angle").min(10).max(180).step(1).onChange(e=>{t.angle=e*Math.PI/180}),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))})}_addAmbientLightToGUI(e,t){let i={name:t.name,color:"#"+t.color.getHexString()},n=e.addFolder(t.name);n.add(t,"visible"),n.add(t,"intensity").min(0).max(5).step(.1),n.addColor(i,"color").onChange(e=>{t.color=new Color(e)})}_addDirectionalLightToGUI(e,t){let i=e.addFolder(t.name),n={name:t.name,color:"#"+t.color.getHexString()};i.add(t,"visible"),i.add(t,"intensity").min(0).max(5).step(.1),i.addColor(n,"color").onChange(e=>{t.color=new Color(e)}),i.add(t,"castShadow"),i.add(t.position,"x").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"y").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))}),i.add(t.position,"z").min(-10).max(10).step(.1).onChange(()=>{t.lookAt(new Vector3(0,0,0))})}}__decorate([inject],DynamicLightSetting.prototype,"_dynamicLightSettingLoader",void 0);class GroundedSkybox extends Mesh{constructor(e,t,i,n=128){if(t<=0||i<=0||n<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const a=new SphereGeometry(i,2*n,n);a.scale(1,1,-1);const s=a.getAttribute("position"),r=new Vector3;for(let e=0;e<s.count;++e)if(r.fromBufferAttribute(s,e),r.y<0){const i=3*-t/2,n=r.y<i?-t/r.y:1-r.y*r.y/(3*i*i);r.multiplyScalar(n),r.toArray(s.array,3*e)}s.needsUpdate=!0,super(a,new MeshBasicMaterial({map:e,depthWrite:!1}))}}class GroundProjectedEnvironment extends Environment{constructor(e,t,i){super(e,t),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(e){e&&(this._environmentTexture=e,this._skybox=new GroundedSkybox(this._environmentTexture,15,100),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(e){let t=getGUI();if(!t)return;let i=t.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(e),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(e)}}class LightSourceDetectorDebug{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const i=new PlaneGeometry(2,1),n=null!=t?t:new MeshBasicMaterial({color:12632256,side:DoubleSide}),a=new Mesh(i,n);return a.position.z=-.1,e.add(a),a}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,i,n){const a=[],s=[];for(let e=0;e<this._lightSourceDetector.lightGraph.noOfNodes;++e)0===i.adjacent[e].length?a.push(t[e]):s.push(t[e]);const r=a.map(e=>e.uv),o=s.map(e=>e.uv),h=e.filter(e=>!r.includes(e)&&!o.includes(e));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(r,.01,255),this._createSamplePointsInMap(o,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map(e=>e.uv);this._createSamplePointsInMap(c,.015,16776960);let d=this._lightSourceDetector.lightSources;void 0!==n&&n>=0&&n<d.length&&(d=d.slice(0,n)),this._createCirclesInMap(d,8421376)}_createSamplePointsInMap(e,t,i){const n=new CircleGeometry(t,8,4),a=new MeshBasicMaterial({color:i});e.forEach(e=>{var t;const i=new Mesh(n,a);i.position.copy(this._uvToMapPosition(e)),i.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(i)})}_createCirclesInMap(e,t){const i=new MeshBasicMaterial({color:t,transparent:!0,opacity:.5});e.forEach(e=>{var t;const n=new CircleGeometry(e.size,8,4),a=new Mesh(n,i);a.position.copy(this._uvToMapPosition(e.uv)),a.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(a)})}_createClusterLinesInMap(e,t,i){var n;const a=new LineBasicMaterial({color:i}),s=[];t.forEach(t=>{for(let i=1;i<t.length;i++){const n=e[t[0]].uv,a=e[t[i]].uv;if(s.push(this._uvToMapPosition(n)),Math.abs(n.x-a.x)>.5){const e=(n.y+a.y)/2,t=n.x<a.x?0:1;s.push(this._uvToMapPosition(new Vector2(t,e))),s.push(this._uvToMapPosition(new Vector2(1-t,e)))}s.push(this._uvToMapPosition(a))}});const r=(new BufferGeometry).setFromPoints(s),o=new LineSegments(r,a);o.name="clusterLine",null===(n=this._scene)||void 0===n||n.add(o)}_uvToMapPosition(e){return new Vector3(2*e.x-1,e.y-.5,0)}}class EnvironmentPmremGenertor extends PMREMGenerator{constructor(e){super(e),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(e,t){var i,n;const a=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,s=null!==(n=null==t?void 0:t.intensity)&&void 0!==n?n:1;return this._extendedEquirectMaterial.uniforms.intensity.value=s,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(a),0,-Math.sin(a),0,1,0,Math.sin(a),0,Math.cos(a)),super.fromEquirectangular(e)}_createEquirectMaterial(){const e=new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new Matrix3}},vertexShader:equilateralVertexShader,fragmentShader:equilateralFragmentShader,blending:NoBlending,depthTest:!1,depthWrite:!1});return this._equirectMaterial=e,e}}const equilateralVertexShader="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",equilateralFragmentShader="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class EnvironmentSceneGenerator{}class EnvironmentDefinition{get lightSources(){return this._lightSources}set rotation(e){this._rotation!==e&&(this._rotation=e,this.needsUpdate=!0)}set intensity(e){this._intensity!==e&&(this._intensity=e,this.needsUpdate=!0)}set maxNoOfLightSources(e){this._maxNoOfLightSources!==e&&(this._maxNoOfLightSources=e,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(e,t){var i,n;this.needsUpdate=!0,this._lightSources=[],e instanceof EnvironmentSceneGenerator?this.environmentSceneGenerator=e:e instanceof CubeTexture?this.cubeTexture=e:e instanceof Texture&&(this.equirectangularTexture=e),(null==t?void 0:t.textureData)&&(this.textureData=null==t?void 0:t.textureData),this._rotation=null!==(i=null==t?void 0:t.rotation)&&void 0!==i?i:0,this._intensity=null!==(n=null==t?void 0:t.intensity)&&void 0!==n?n:1,void 0!==(null==t?void 0:t.maxNoOfLightSources)&&(this._maxNoOfLightSources=t.maxNoOfLightSources),this._parameters=t,this._environment=e}clone(){return new EnvironmentDefinition(this._environment,this._parameters)}createNewEnvironment(e){const t=this._createPmremTexture(e),i=this._detectLightSources(e,t);return this._lightSources=i.lightSources,null!=t?t:null}_getTextureOffset(){const e=this._rotation/(2*Math.PI)%1;return new Vector2(e,0)}_createPmremTexture(e){const t=new EnvironmentPmremGenertor(e);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=t.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=t.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const e=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=t.fromScene(e,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(e,t){const i=new LightSourceDetector;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(e,this.equirectangularTexture,this.textureData):t&&i.detectLightSources(e,t),i}createDebugScene(e,t,i){const n=null!=i?i:-1;if(this._debugScene&&n===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new Scene;const a=new EnvironmentMapDecodeMaterial(!0,!1);a.setSourceTexture(t.environment),LightSourceDetectorDebug.createPlane(this._debugScene,a);const s=this._detectLightSources(e,t.environment);return new LightSourceDetectorDebug(s).createDebugScene(this._debugScene,n),this._debugScene.userData.maximumNumberOfLightSources=n,this._debugScene}}class DefaultEnvironmentSceneGenerator extends EnvironmentSceneGenerator{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const i=new DefaultEnvironmentScene({...this._parameters,lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)});return i.rotation.y=t,i}}class DefaultEnvironmentScene extends Scene{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:"all_around",this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const i="front"===this._type?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||i,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new BoxGeometry,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new CylinderGeometry(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(e);break;case"front":this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new Color(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,n=Math.sin(i),a=Math.cos(i);t%2==0?this._createReflector(e,new Vector2(n,a),3,1,.8,.2):this._createSideLight(e,new Vector2(n,a),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new Color(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const i=t*Math.PI*2/6,n=Math.sin(i),a=Math.cos(i);if(0===t){this._createReflector(e,new Vector2(n,a),1.1,.6,.8,-.4);for(let i=0;i<2;i++){const n=(t-.3+.6*i)*Math.PI*2/6,a=Math.sin(n),s=Math.cos(n);this._createSideLight(e,new Vector2(a,s),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new Vector2(n,a),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,i){const n=new MeshBasicMaterial;return n.color.set(e,null!=t?t:e,null!=i?i:e),n}_createTopLight(e,t,i){const n=new Mesh(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));n.position.set(0,20,0),n.scale.set(5*i,.1,5*i),e.add(n)}_createSideLight(e,t,i,n,a,s,r){for(let o=0;o<3;o++){const h=n*this._sideLightIntensity,c=new Mesh(this._lightGeometry,this._createAreaLightMaterial((o+i)%3==0?h:h*(1-this._colorVariation),(o+i)%3==1?h:h*(1-this._colorVariation),(o+i)%3==2?h:h*(1-this._colorVariation))),d=(1===o?-t.y:2===o?t.y:0)/Math.sqrt(2),_=0===o?0:1,l=(1===o?t.x:2===o?-t.x:0)/Math.sqrt(2);c.position.set(t.x*r*15+1.1*d*a,15*s+1.1*_*a,t.y*r*15+1.1*l*a),c.rotation.set(0,Math.atan2(t.x,t.y),0),c.scale.setScalar(a),e.add(c)}}_createReflector(e,t,i,n,a,s){const r=new Mesh(this._reflectorLightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));r.position.set(15*t.x,10*s,15*t.y),r.scale.set(10*n,10*a,10*n),e.add(r)}}class SceneManager{get cameraBehaviour(){return this._cameraBehaviour}onBeforeRender(){}constructor(e,t,i,n){this._depthWriteMaterial=new MeshBasicMaterial({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new Clock,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._roomleRenderer=null,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=e,this._canvasID=i,this._renderListener=()=>{this._requestRender()},this.createCameraControl(sanitizedCameraMode(n),t),this._setupScene(t,this._initData.transparentBackground),this._lifeCycleManager.addEventListener(this)}addEventListener(e){throw new Error("Method not implemented.")}removeEventListener(e){throw new Error("Method not implemented.")}_changeCameraBehaviour(e){this._cameraBehaviour&&(this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this.cameraBehaviour.cameraControl instanceof CameraControlFirstPerson&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener))),this._cameraBehaviour=e,this._cameraBehaviour.setCameraChangeListener(this.onCameraChanged.bind(this)),e.cameraControl instanceof CameraControlFirstPerson&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this.cameraBehaviourChanged()}onCameraChanged(){}cameraBehaviourChanged(){}_addCameraControlListener(){this.cameraBehaviour.cameraControl.addEventListener(0,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(1,this._requestRender,this),this.cameraBehaviour.cameraControl.addEventListener(2,()=>{var e;null===(e=this._roomleRenderer)||void 0===e||e.movingCameraStops(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){this._roomleRenderer&&(this._forceRender=!0,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const e=()=>{var t,i;if(this._delta=this._clock.getDelta(),this._animateCamera(),this.cameraBehaviour.cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._globalInitData.e2e&&window.TWEEN){const e=TWEEN.getAll();for(const t of e)t.end()}if(this._roomleRenderer)null===(t=this._statsHelper)||void 0===t||t.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this.cameraBehaviour.cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi();else{null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info);const e=this.cameraBehaviour.cameraControl.getCamera();e.updateMatrixWorld(),e.updateProjectionMatrix(),this._renderer.render(this._scene,e)}this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_shouldRenderUi(){var e;return null===(e=this._pluginSystem)||void 0===e?void 0:e.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.cameraBehaviour.cameraControl.getCamera()),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this.cameraBehaviour.cameraControl.getCamera()),this._renderer.autoClear=t,this._scene.background=e}_animateCamera(){this.cameraBehaviour.cameraControl&&(this.cameraBehaviour.cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof DynamicLightSetting&&this.cameraBehaviour.cameraControl.getCamera()instanceof PerspectiveCamera&&this._lightSetting.update(this.cameraBehaviour.cameraControl.getCamera(),this.cameraBehaviour.cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this.cameraBehaviour.cameraControl instanceof CameraControl3D&&this._environment.updateCamera(this.cameraBehaviour.cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(e,t){var i;const{x:n,y:a}=this._domHelper.getClientDimensions();this._scene=new Scene,this._uiScene=new Scene,(t=t||!1)||(this._scene.background=this._initData.colors.DEFAULT_BACKGROUND),this._renderer=new WebGLRenderer({antialias:!this._globalInitData.e2e,alpha:!0});const s=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(s),this._renderer.setSize(n,a),this._renderer.outputColorSpace=SRGBColorSpace,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=PCFSoftShadowMap,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._globalInitData.e2e||(this._roomleRenderer=new RoomleWebGLRenderer(this._renderer,n,a),this._roomleRenderer.setQualityMap(standaloneConfiguratorQualityLevels),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),this._roomleRenderer.setCustomShadingParameters(this._initData.customShading,this._initData.customShadingMoc),null===(i=this._roomleRenderer)||void 0===i||i.setSize(n,a)),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(e=>{this._setEnvMap(e)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this.cameraBehaviour.cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(e){await this._hdrEnvironmentLoader.loadUrl(this._renderer,e)}_setDefaultEnvironmentScene(){const e=this._initData.sceneLight;this._scene.userData.environmentDefinition=new EnvironmentDefinition(new DefaultEnvironmentSceneGenerator({type:e}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(e){const{url:t,environmentMap:i}=e;this._scene.environment=i,this._scene.userData.environmentDefinition=new EnvironmentDefinition(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof GroundProjectedEnvironment&&this._environment.updateEnvironmentTexture(i),t!==ENV_HDR_256_FILE_NAME||this._globalInitData.e2e||window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const e=["Shift","Meta","Control","Escape"];for(const t of e){const e=new KeyboardEvent("keyup",{key:t});this._onKeyUp(e,!0)}}updateCamera(e=!0){var t;const{x:i,y:n}=this._domHelper.getClientDimensions();null===(t=this._roomleRenderer)||void 0===t||t.setSize(i,n),this.cameraBehaviour.cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const e=this._getInputManager();e&&e.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(e){return"Object3D"===e.type||"Mesh"===e.type||"GLB"===e.type||"GLTF"===e.type||"Group"===e.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this.cameraBehaviour.cameraControl&&this.cameraBehaviour.cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let e=[];this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)}),e.forEach(e=>{dispose(e),this._scene.remove(e)}),this._renderer.renderLists.dispose()}enableHD(e){this._renderer.capabilities.maxTextures>8&&e&&this.loadDynamicLightSetting(e),this._requestRender()}_loadGLTF(e,t,i,n,a,s,r){return new Promise((o,h)=>{this._staticItemLoader.loadGLTF(e,t,i,n,a,s,null,r).then(e=>{o(e.scene)},h)})}_loadGLB(e,t,i,n,a,s,r,o){return new Promise((h,c)=>{this._staticItemLoader.loadGLB(e,t,i,n,a,s,r,o).then(e=>{h(e.scene)},c)})}showGUI(){if(this._initData.disableDebugGUI)return;const e=document.createElement("style");e.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(e);let t=getGUI(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())}_guiLoaded(){let e=getGUI();if(!e)return;const t=e.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};t.add(i,"intensity",0,4,.01).name("env map intensity").onChange(e=>{this.changeEnvironmentMapIntensity(e),this._requestRender()}),t.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(e=>{this._scene.userData.environmentDefinition.rotation=e,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(e)}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let i=t[e];i.__folders&&Object.keys(i.__folders).forEach(e=>{let t=i.__folders[e];this._addGUIListener(t)}),i.__controllers&&i.__controllers.forEach(e=>{e.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){import("./stats-helper-c0748092.js").then(e=>this._statsHelper=new e.default)}_onKeyDown(e){}_onKeyUp(e,t=!1){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}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(),this._releaseKeystrokeStates()}}async loadSceneSettings(e){let t,i;return t=e.environment?new Promise(t=>{(new DynamicEnvironmentSettingLoader).load(this._scene,this._renderer.domElement,this._environment,e,this._maxAnisotropy).then(e=>{this._setEnvironment(e),t()})}):Promise.resolve(),e.lights?(this._lightSetting=new DynamicLightSetting(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(e)):i=Promise.resolve(),new Promise((e,n)=>{Promise.all([t,i]).then(()=>{this._renderEverything(),e()},n)})}setBackgroundColor(e){this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,new Color(e)))}setBackgroundImage(e){this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,null,this._renderer.domElement,e))}_setEnvironment(e){this._environment=e,this._renderEverything()}async loadDynamicLightSetting(e){this._lightSetting=new DynamicLightSetting(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 i=DynamicLightSettingLoader.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(i.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var e;this._updateBounds(this.getBounds(),this.getGeometryBounds()),null===(e=this._roomleRenderer)||void 0===e||e.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(e,t,i=!1){var n;if(!e)return;const a=null!=t?t:e;this.updateEnvironment(a,i),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),null===(n=this._roomleRenderer)||void 0===n||n.updateBounds(a),this._requestRender(),this._pluginSystem.updateBounds(e)}setCameraOffset(e){const t=this.cameraBehaviour.cameraControl.getCamera(),i=t||t;(null==i?void 0:i.offset)?(i.offset=e,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){var e,t;const i=null===(t=null===(e=this.cameraBehaviour)||void 0===e?void 0:e.cameraControl)||void 0===t?void 0:t.getCamera(),n=i||i;return(null==n?void 0:n.offset)?JSON.parse(JSON.stringify(n.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=5;let n=t.x/t.y*i,a=i;const s=RoomleComponentFactoryInitializer();this._orthographicOffsetCamera=s.createOrthographicCamera(n/-2,n/2,a/2,a/-2,1,1e3,e),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new Vector3(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const e=this.getCameraOffset(),t=this._domHelper.getClientDimensions(),i=t.x,n=t.y,a=RoomleComponentFactoryInitializer();this._perspectiveOffsetCamera=a.createPerspectiveCamera(30,i/n,.1,20,e)}return this._perspectiveOffsetCamera}updateEnvironment(e,t=!1){var i;if(e&&this._environment&&this._environment.needsBounds()){const i=e.getSize(new Vector3);(i.x+i.y+i.z!==0||t)&&this._environment.updateBounds(e.getSize(new Vector3),t)}null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}_waitForAssets(){return Promise.resolve()}async exportImageFromCamera(e,t=!1){return t&&await this._waitForAssets(),new Promise((t,i)=>{this._onAfterRender=()=>{const n=this._renderer.domElement.toDataURL("image/jpeg",1),{left:a,right:s,top:r,bottom:o}=this.getCameraOffset(),h=s-a,c=r-o;if(1===h&&1===c)return download(e,n),this._onAfterRender=()=>{},void t();const d=new Image;d.src=n,d.onload=()=>{const{naturalWidth:i,naturalHeight:n}=d,s=document.createElement("canvas");s.width=i*h,s.height=n*c;const o=s.getContext("2d"),_=i*a*-1,l=n*(1-r)*-1;o.drawImage(d,_,l),o.save(),download(e,s.toDataURL("image/jpeg",1)),t(),this._onAfterRender=()=>{}},d.onerror=i},this._requestRender()})}changeEnvironmentMapIntensity(e){this._scene.userData.environmentDefinition.intensity=e}lockCamera(){this.cameraBehaviour.cameraControl.lock()}unlockCamera(){this.cameraBehaviour.cameraControl.unlock()}setEnvironmentMap(e,t,i,n){void 0!==e&&this._hdrEnvironmentLoader.loadUrl(this._renderer,e),void 0!==t&&(this._scene.userData.environmentDefinition.intensity=t),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==n&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=n,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}}__decorate([inject],SceneManager.prototype,"_domHelper",void 0),__decorate([inject],SceneManager.prototype,"_scriptLoader",void 0),__decorate([inject],SceneManager.prototype,"_lifeCycleManager",void 0),__decorate([inject],SceneManager.prototype,"_staticItemLoader",void 0),__decorate([inject],SceneManager.prototype,"_hdrEnvironmentLoader",void 0),__decorate([inject],SceneManager.prototype,"_initData",void 0),__decorate([inject],SceneManager.prototype,"_globalInitData",void 0),__decorate([inject],SceneManager.prototype,"_idbManager",void 0),__decorate([inject],SceneManager.prototype,"_pluginSystem",void 0),__decorate([inject],SceneManager.prototype,"_imageRenderer",void 0),__decorate([inject],SceneManager.prototype,"_cameraBehaviourState",void 0);class CameraBehaviour{constructor(e,t){return this._debug=!1,this._state=null,this._cameraChangeListener=null,this._cameraControl=e,this._state=t,this._debug?traceMethodCalls(this,"CameraBehaviour"):this}get state(){return this._state}setCameraChangeListener(e){this._cameraChangeListener=e}removeCameraChangeListener(){this._cameraChangeListener=null}_onCameraChanged(){this._cameraChangeListener&&this._cameraChangeListener()}}export{BackgroundEnvironment as B,CameraControl3D as C,DISTANCE_FACTOR as D,FloorEnvironment as F,LightSetting as L,SceneManager as S,TWEEN_FILE_NAME as T,ZoomChangeEvent as Z,CameraControl as a,CameraBehaviour as b,CameraControlFirstPerson as c};
|
|
2
|
-
//# sourceMappingURL=camera-behaviour-4d4e7e7c.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-dimensioning-36a1e68e.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-dimensioning-bdbf6729.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-raycast-helper-40363857.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-raycast-helper-67f9a0e9.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./script-loader-98a17bbb.nomodule.js","./roomle-dependency-injection-c12e4c00.nomodule.js","./camera-behaviour-1b0b7853.nomodule.js","./component-raycast-helper-67f9a0e9.nomodule.js","./roomle-configurator-96729652.nomodule.js","./query-params-helper-712890e0.nomodule.js","./main-thread-to-worker-ff04af1e.nomodule.js","./default-light-setting-7f113f35.nomodule.js"],(function(e){var o,n,t,r,i,a,c,s,l,u,p,d,f,h;return{setters:[function(e){o=e.S,n=e.M},function(e){t=e.D,r=e.L,i=e.R,a=e.a,c=e.C,s=e.b,l=e.A},function(e){u=e.C,p=e.a},function(e){d=e.default},function(e){f=e.C,h=e.R},function(){},function(){},function(){}],execute:function(){const m=[new t("logger",r),new t("rapi-access",i),new t("script-loader",o),new t("camera-control-3d",u),new t("camera-control",p),new t("data-syncer",a),new t("configurator-scene-manager",f,1),new t("configurator-view-model",c,1),new t("component-raycast-helper",d,0)];e("Configurator",class extends n{setupDependencies(){s.setup(m),this.lookup("planner-kernel-access",this._context).init(1),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"),o=this.lookup("rapi-access");this.lookup("dom-helper");const n=this.lookup("configurator-scene-manager");e&&e.cleanUp(),o&&o.cleanUp(),n&&n.cleanUp()}setupGlobals(e){const{kernelInstance:o,kernelContainer:n,planObjectId:t}=e||{};l.init({kernelInstance:o,kernelContainer:n,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new h(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}})}}}));
|
|
2
|
-
//# sourceMappingURL=configurator-04e3b0ec.nomodule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configurator-04e3b0ec.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configurator-7fce117f.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Configurator}from"./configurator-7fce117f.js";import"./script-loader-ef092985.js";import"./query-params-helper-68ed40a6.js";import"./main-thread-to-worker-82b32425.js";import"./roomle-dependency-injection-56db2f22.js";import"./camera-behaviour-4d4e7e7c.js";import"./component-raycast-helper-40363857.js";import"./roomle-configurator-e867d909.js";import"./default-light-setting-ad52e6de.js";(new Configurator).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let o=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-o))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)});
|
|
2
|
-
//# sourceMappingURL=configurator-main-16e36fb1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configurator-main-16e36fb1.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"continuous-drawing-helper-094fdf93.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"continuous-drawing-helper-f2aea1db.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-light-setting-7f113f35.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-light-setting-ad52e6de.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{aG as normalizeRotation,w as dispose,_ as __decorate,i as inject,ah as AsyncGuard,aH as AsyncDependencyLoader,ad as convertToTHREE}from"./roomle-dependency-injection-56db2f22.js";import{O as Object3D,a as Vector3,h as MeshBasicMaterial,w as DoubleSide,br as MeshPhongMaterial,B as BufferGeometry,z as Mesh,Q as Quaternion,bc as PlaneGeometry,K as Group,u as LineBasicMaterial,G as Line,b as BufferAttribute,b0 as Line3,ad as Box3}from"./main-thread-to-worker-82b32425.js";import{T as TextGeometry}from"./TextGeometry-f0a85d6a.js";const PLANE_MATERIAL="component_dimensioning_plane_material",TEXT_MATERIAL="component_dimensioning_text_material";class TextWithBackground extends Object3D{constructor(e){super(),this._label="",this._parameters={font:null,size:.1,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001},this.topDown=!1,this._parameters.font=e,this._position=new Vector3,this._initMaterials(),this._init(),this._update()}_initMaterials(){this._cacheHolder.materialCache.has(PLANE_MATERIAL)?this._planeMaterial=this._cacheHolder.materialCache.get(PLANE_MATERIAL):(this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),this._cacheHolder.materialCache.set(PLANE_MATERIAL,this._planeMaterial)),this._cacheHolder.materialCache.has(TEXT_MATERIAL)?this._textMaterial=this._cacheHolder.materialCache.get(TEXT_MATERIAL):(this._textMaterial=new MeshPhongMaterial({color:3618615}),this._cacheHolder.materialCache.set(TEXT_MATERIAL,this._textMaterial))}_init(){let e=new BufferGeometry;this._text=new Mesh(e,this._textMaterial),this._text.userData.ignoreComponentRaycast=!0,this._text.name="text with background text "+this._label,this._plane=new Mesh(e,this._planeMaterial),this._plane.userData.ignoreComponentRaycast=!0,this._plane.name="text with background plane "+this._label,this._textGeometry=new TextGeometry(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this.add(this._text),this.add(this._plane)}update(e,t,i){this._position.copy(e),this._cameraPosition=i,this._label=t;const s=this.getWorldPosition(new Vector3),n=this._cameraPosition.distanceTo(s),o=Math.max(.01,n/150),h=Math.max(5e-4,n/5e3);this._parameters.bevelThickness=h,this._parameters.bevelSize=h,this._parameters.size=o,this._textGeometry=new TextGeometry(this._label,this._parameters),this._textGeometry.computeBoundingBox(),this._text.geometry=this._textGeometry,this._update()}_update(){if(this.topDown){let e=new Quaternion;e.setFromAxisAngle(new Vector3(-1,0,0),Math.PI/2),this._updateText(this._textGeometry,e,new Vector3)}else if(this._updateText(this._textGeometry,new Quaternion,new Vector3),this._cameraPosition){const e=this.getWorldPosition(new Vector3),t=normalizeRotation(Math.atan2(this._cameraPosition.x-e.x,this._cameraPosition.z-e.z)-this.parent.rotation.y);this._text.rotation.y=t,this._plane.rotation.y=t}}_updateText(e,t,i){let s=new Vector3;s.copy(this._position),i.x*=this._getXSign(),s.add(i);let n=e.boundingBox.getSize(new Vector3);e.center(),this._text.position.copy(s),t&&this._text.quaternion.copy(t);let o=new PlaneGeometry(n.x+.02,n.y+.02,32);o.center(),this._plane.geometry=o,this._plane.position.copy(s),t&&this._plane.quaternion.copy(t)}_getXSign(){return!this._cameraPosition||this._cameraPosition.x>=0?1:-1}dispose(){dispose(this)}}__decorate([inject],TextWithBackground.prototype,"_cacheHolder",void 0);class DimensioningHelper{constructor(e){this._objectRotation=0,this._cameraPosition=new Vector3,this._topDimensions=!1,this._initialized=new AsyncGuard,this._enabled=!1,this._dimensionsVisible=!1,this._dimensionLineGroup=new Group,this._dimensionTextGroup=new Object3D,this._creator_=e,this._lineMaterial=new LineBasicMaterial({color:3618615,linewidth:2});let t=new BufferGeometry;this._widthLine=new Line(t,this._lineMaterial),this._widthLine.userData.ignoreComponentRaycast=!0,this._widthLine.name="dimension width line",this._dimensionLineGroup.add(this._widthLine),this._heightLine=new Line(t,this._lineMaterial),this._heightLine.userData.ignoreComponentRaycast=!0,this._heightLine.name="dimension height line",this._dimensionLineGroup.add(this._heightLine),this._depthLine=new Line(t,this._lineMaterial),this._depthLine.userData.ignoreComponentRaycast=!0,this._depthLine.name="dimension depth line",this._dimensionLineGroup.add(this._depthLine),this._planeMaterial=new MeshBasicMaterial({color:16777215,side:DoubleSide,opacity:.8,transparent:!0}),AsyncDependencyLoader.loadFont("static/lato_regular_sub-d4b30187185acc59.json").then(e=>{this._font=e,this._loaded()})}_loaded(){this.update(!1),this.addToObject(this._object),this.addToUiScene(this._uiScene),this._initialized.resolve()}_performUpdate(e){this._enabled&&(this._dimensions||e)&&this._font&&(this._updateHeight(),this._updateWidth(),this._updateDepth())}_updateWidth(){let e=new BufferGeometry,t=this._getWidthEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._widthLine.geometry.dispose(),this._widthLine.geometry=e;let s=t.getCenter(new Vector3);this._widthText||(this._widthText=new TextWithBackground(this._font),this._dimensionTextGroup.add(this._widthText)),this._widthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.x);this._widthText.update(s,n,this._cameraPosition)}_updateHeight(){let e=new BufferGeometry,t=this._getHeightEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._heightLine.geometry.dispose(),this._heightLine.geometry=e;let s=t.getCenter(new Vector3);this._heightText||(this._heightText=new TextWithBackground(this._font),this._dimensionTextGroup.add(this._heightText)),this._heightText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(1e3*this._dimensions.y);this._heightText.update(s,n,this._cameraPosition)}_updateDepth(){let e=new BufferGeometry,t=this._getDepthEdge(),i=[t.start.x,t.start.y,t.start.z,t.end.x,t.end.y,t.end.z];e.setAttribute("position",new BufferAttribute(new Float32Array(i),3)),this._depthLine.geometry.dispose(),this._depthLine.geometry=e;let s=t.getCenter(new Vector3);this._depthText||(this._depthText=new TextWithBackground(this._font),this._dimensionTextGroup.add(this._depthText)),this._depthText.topDown=this._topDimensions;const n=this._unitFormatter.formatMMValueToUnitString(-1e3*this._dimensions.z);this._depthText.update(s,n,this._cameraPosition)}updateSize(e){this._origin=convertToTHREE(e.origin),this._dimensionLineGroup.position.x=this._origin.x-this._object.position.x,this._dimensionLineGroup.position.y=this._origin.y-this._object.position.y,this._dimensionLineGroup.position.z=this._origin.z-this._object.position.z,this._dimensions=convertToTHREE(e.size);const t=this._dimensionLineGroup.localToWorld(new Vector3);this._dimensionTextGroup.position.copy(t),this.update()}update(e=!1){this._enabled&&!this._dimensionsVisible&&(this._dimensionsVisible=!0,this._visibilityChangedCallback()),this._performUpdate(e)}addToObject(e){this._widthText&&this._widthLine&&this._heightText&&this._heightLine&&this._heightText&&this._heightLine&&e.add(this._dimensionLineGroup)}removeFromObject(e){e.remove(this._dimensionLineGroup),this.update()}addToUiScene(e){if(!(this._widthText&&this._heightText&&this._depthText&&this._object))return;const t=this._dimensionLineGroup.localToWorld(new Vector3);this._dimensionTextGroup.position.copy(t),this._dimensionTextGroup.rotation.y=this._objectRotation,e.add(this._dimensionTextGroup),this.update()}removeFromUiScene(e){e.remove(this._dimensionTextGroup),this.update()}_getWidthEdge(){const e=this._getRotation();return e>Math.PI/2||e<-Math.PI/2?new Line3(new Vector3(-.05,0,this._dimensions.z-.05),new Vector3(this._dimensions.x+.05,0,this._dimensions.z-.05)):new Line3(new Vector3(-.05,0,.05),new Vector3(this._dimensions.x+.05,0,.05))}_getDepthEdge(){return this._getRotation()>0?new Line3(new Vector3(.05+this._dimensions.x,0,.05),new Vector3(.05+this._dimensions.x,0,this._dimensions.z-.05)):new Line3(new Vector3(-.05,0,.05),new Vector3(-.05,0,this._dimensions.z-.05))}_getHeightEdge(){const e=this._getRotation();return e>0&&e<Math.PI/2?new Line3(new Vector3(-.05,0,.05),new Vector3(-.05,this._dimensions.y+.05,.05)):e>Math.PI/2?new Line3(new Vector3(-.05,0,this._dimensions.z-.05),new Vector3(-.05,this._dimensions.y+.05,this._dimensions.z-.05)):e<-Math.PI/2?new Line3(new Vector3(.05+this._dimensions.x,0,this._dimensions.z-.05),new Vector3(.05+this._dimensions.x,this._dimensions.y+.05,this._dimensions.z-.05)):new Line3(new Vector3(.05+this._dimensions.x,0,.05),new Vector3(.05+this._dimensions.x,this._dimensions.y+.05,.05))}onDimensionsVisibilityChanged(e){this._onChange=e}enableTopDimensions(){this._topDimensions=!0,this.enableDimensions(),this._heightLine.visible=!1,this._heightText.visible=!1,this.update(!0)}disableTopDimensions(){this._topDimensions=!1,this._heightLine.visible=!0,this._heightText.visible=!0,this.disableDimensions()}enableDimensions(){this._enabled=!0,this.update(!0),this.addToObject(this._object),this.addToUiScene(this._uiScene)}disableDimensions(){this._enabled=!1,this._dimensionsVisible&&(this._dimensionsVisible=!1,this._visibilityChangedCallback()),this.removeFromUiScene(this._uiScene),this.removeFromObject(this._object)}_visibilityChangedCallback(){this._onChange&&this._onChange(this._dimensionsVisible)}_clear(){this._lineMaterial.dispose(),this._planeMaterial.dispose(),this._widthLine.geometry.dispose(),this._heightLine.geometry.dispose(),this._depthLine.geometry.dispose(),this._heightText.dispose(),this._heightText.dispose(),this._depthText.dispose()}getBoundingBox(){const e=new Box3;return e.expandByObject(this._widthLine),e.expandByObject(this._widthText),e.expandByObject(this._heightLine),e.expandByObject(this._heightText),e.expandByObject(this._depthLine),e.expandByObject(this._depthText),e}setVisibility(e){this._dimensionLineGroup&&this._dimensionTextGroup&&(this._dimensionLineGroup.visible=e,this._dimensionTextGroup.visible=e)}moveCameraStart(e){this.setVisibility(!1),this._cameraPosition=e,this.update()}moveCameraEnd(e){this.setVisibility(!0),this._cameraPosition=e,this.update()}clearScene(e){this._clear()}setObject(e,t=0){this._object=e,this._objectRotation=t}setUiScene(e){this._uiScene=e}isInitialized(){return this._initialized.wait()}areDimensionsEnabled(){return this._enabled}_getRotation(){const e=this._object.getWorldPosition(new Vector3);return normalizeRotation(Math.atan2(this._cameraPosition.x-e.x,this._cameraPosition.z-e.z)-this._objectRotation)}}__decorate([inject],DimensioningHelper.prototype,"_unitFormatter",void 0);export{DimensioningHelper as default};
|
|
2
|
-
//# sourceMappingURL=dimensioning-helper-7494fb28.js.map
|