@roomle/web-sdk 2.60.0 → 2.61.0-bo-mvp.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.releaserc.json +5 -0
  2. package/lib/{configurator-c62d84e8.js → configurator-2350f3d3.js} +2 -2
  3. package/lib/configurator-2350f3d3.js.map +1 -0
  4. package/lib/{configurator-a9c1fe12.nomodule.js → configurator-c0efe42a.nomodule.js} +2 -2
  5. package/lib/configurator-c0efe42a.nomodule.js.map +1 -0
  6. package/lib/{configurator-main-ba699dda.js → configurator-main-4b935814.js} +2 -2
  7. package/lib/configurator-main-4b935814.js.map +1 -0
  8. package/lib/configurator-main.nomodule.js +1 -1
  9. package/lib/definitions/configurator-core/src/roomle-configurator.d.ts +3 -0
  10. package/lib/legacy/{configurator-5d8e9e4c.legacy.js → configurator-2316b444.legacy.js} +2 -2
  11. package/lib/legacy/configurator-2316b444.legacy.js.map +1 -0
  12. package/lib/legacy/configurator-main.legacy.js +1 -1
  13. package/lib/legacy/{planner-a0ef7d31.legacy.js → planner-da20e5b5.legacy.js} +2 -2
  14. package/lib/legacy/{planner-a0ef7d31.legacy.js.map → planner-da20e5b5.legacy.js.map} +1 -1
  15. package/lib/legacy/planner-main.legacy.js +1 -1
  16. package/lib/legacy/{roomle-configurator-7dc323ca.legacy.js → roomle-configurator-285a9f09.legacy.js} +1 -1
  17. package/lib/legacy/roomle-configurator-285a9f09.legacy.js.map +1 -0
  18. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  19. package/lib/{planner-7ec2696d.nomodule.js → planner-196c8b8d.nomodule.js} +2 -2
  20. package/lib/{planner-7ec2696d.nomodule.js.map → planner-196c8b8d.nomodule.js.map} +1 -1
  21. package/lib/{planner-2d7a7b1b.js → planner-d8f3594f.js} +2 -2
  22. package/lib/{planner-2d7a7b1b.js.map → planner-d8f3594f.js.map} +1 -1
  23. package/lib/{planner-main-d56b0156.js → planner-main-26a4e160.js} +2 -2
  24. package/lib/planner-main-26a4e160.js.map +1 -0
  25. package/lib/planner-main.nomodule.js +1 -1
  26. package/lib/{roomle-configurator-b01d2885.nomodule.js → roomle-configurator-140651b8.nomodule.js} +1 -1
  27. package/lib/roomle-configurator-140651b8.nomodule.js.map +1 -0
  28. package/lib/{roomle-configurator-42d4fecc.js → roomle-configurator-ffec540a.js} +1 -1
  29. package/lib/roomle-configurator-ffec540a.js.map +1 -0
  30. package/lib/{roomle-sdk-1ed375ca.js → roomle-sdk-c97d95f8.js} +2 -2
  31. package/lib/roomle-sdk-c97d95f8.js.map +1 -0
  32. package/lib/roomle-sdk.nomodule.js +1 -1
  33. package/package.json +2 -2
  34. package/lib/configurator-a9c1fe12.nomodule.js.map +0 -1
  35. package/lib/configurator-c62d84e8.js.map +0 -1
  36. package/lib/configurator-main-ba699dda.js.map +0 -1
  37. package/lib/legacy/configurator-5d8e9e4c.legacy.js.map +0 -1
  38. package/lib/legacy/roomle-configurator-7dc323ca.legacy.js.map +0 -1
  39. package/lib/planner-main-d56b0156.js.map +0 -1
  40. package/lib/roomle-configurator-42d4fecc.js.map +0 -1
  41. package/lib/roomle-configurator-b01d2885.nomodule.js.map +0 -1
  42. package/lib/roomle-sdk-1ed375ca.js.map +0 -1
package/.releaserc.json CHANGED
@@ -16,6 +16,11 @@
16
16
  "name": "release/test",
17
17
  "channel": "alpha",
18
18
  "prerelease": "alpha"
19
+ },
20
+ {
21
+ "name": "release/bo-mvp",
22
+ "channel": "bo-mvp",
23
+ "prerelease": "bo-mvp"
19
24
  }
20
25
  ],
21
26
  "plugins": [
@@ -1,2 +1,2 @@
1
- import{S as ScriptLoader,M as Main}from"./script-loader-9059c8a6.js";import{D as DependencyInjectionAssignment,L as Logger,R as RapiAccess,a as DataSyncer,C as ConfiguratorViewModel,b as RoomleDependencyInjection,A as AppContext}from"./roomle-dependency-injection-bf64a07e.js";import{C as CameraControl3D,a as CameraControl}from"./scene-manager-d25d6ad2.js";import ComponentRaycastHelper from"./component-raycast-helper-4f91b663.js";import{C as ConfiguratorSceneManager,R as RoomleConfigurator}from"./roomle-configurator-42d4fecc.js";import"./query-params-helper-a271f9dc.js";import"./main-thread-to-worker-30982707.js";import"./default-light-setting-f4f47231.js";const INJECTABLES=[new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("rapi-access",RapiAccess),new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("camera-control-3d",CameraControl3D),new DependencyInjectionAssignment("camera-control",CameraControl),new DependencyInjectionAssignment("data-syncer",DataSyncer),new DependencyInjectionAssignment("configurator-scene-manager",ConfiguratorSceneManager,1),new DependencyInjectionAssignment("configurator-view-model",ConfiguratorViewModel,1),new DependencyInjectionAssignment("component-raycast-helper",ComponentRaycastHelper,0)];class Configurator extends Main{setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),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"),n=this.lookup("rapi-access");this.lookup("dom-helper");const o=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),o&&o.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:o,planObjectId:t}=e||{};AppContext.init({kernelInstance:n,kernelContainer:o,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new RoomleConfigurator(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}}export{Configurator};
2
- //# sourceMappingURL=configurator-c62d84e8.js.map
1
+ import{S as ScriptLoader,M as Main}from"./script-loader-9059c8a6.js";import{D as DependencyInjectionAssignment,L as Logger,R as RapiAccess,a as DataSyncer,C as ConfiguratorViewModel,b as RoomleDependencyInjection,A as AppContext}from"./roomle-dependency-injection-bf64a07e.js";import{C as CameraControl3D,a as CameraControl}from"./scene-manager-d25d6ad2.js";import ComponentRaycastHelper from"./component-raycast-helper-4f91b663.js";import{C as ConfiguratorSceneManager,R as RoomleConfigurator}from"./roomle-configurator-ffec540a.js";import"./query-params-helper-a271f9dc.js";import"./main-thread-to-worker-30982707.js";import"./default-light-setting-f4f47231.js";const INJECTABLES=[new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("rapi-access",RapiAccess),new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("camera-control-3d",CameraControl3D),new DependencyInjectionAssignment("camera-control",CameraControl),new DependencyInjectionAssignment("data-syncer",DataSyncer),new DependencyInjectionAssignment("configurator-scene-manager",ConfiguratorSceneManager,1),new DependencyInjectionAssignment("configurator-view-model",ConfiguratorViewModel,1),new DependencyInjectionAssignment("component-raycast-helper",ComponentRaycastHelper,0)];class Configurator extends Main{setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),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"),n=this.lookup("rapi-access");this.lookup("dom-helper");const o=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),o&&o.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:o,planObjectId:t}=e||{};AppContext.init({kernelInstance:n,kernelContainer:o,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new RoomleConfigurator(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}}export{Configurator};
2
+ //# sourceMappingURL=configurator-2350f3d3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configurator-2350f3d3.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- System.register(["./script-loader-92e1532b.nomodule.js","./roomle-dependency-injection-2583f0dc.nomodule.js","./scene-manager-45fc4ce6.nomodule.js","./component-raycast-helper-ac3b7072.nomodule.js","./roomle-configurator-b01d2885.nomodule.js","./query-params-helper-c231e1b8.nomodule.js","./main-thread-to-worker-5609c757.nomodule.js","./default-light-setting-01a91d0f.nomodule.js"],(function(e){var n,o,t,r,c,i,a,s,l,u,p,d,f,g;return{setters:[function(e){n=e.S,o=e.M},function(e){t=e.D,r=e.L,c=e.R,i=e.a,a=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,g=e.R},function(){},function(){},function(){}],execute:function(){const m=[new t("logger",r),new t("rapi-access",c),new t("script-loader",n),new t("camera-control-3d",u),new t("camera-control",p),new t("data-syncer",i),new t("configurator-scene-manager",f,1),new t("configurator-view-model",a,1),new t("component-raycast-helper",d,0)];e("Configurator",class extends o{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"),n=this.lookup("rapi-access");this.lookup("dom-helper");const o=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),o&&o.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:o,planObjectId:t}=e||{};l.init({kernelInstance:n,kernelContainer:o,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new g(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}})}}}));
2
- //# sourceMappingURL=configurator-a9c1fe12.nomodule.js.map
1
+ System.register(["./script-loader-92e1532b.nomodule.js","./roomle-dependency-injection-2583f0dc.nomodule.js","./scene-manager-45fc4ce6.nomodule.js","./component-raycast-helper-ac3b7072.nomodule.js","./roomle-configurator-140651b8.nomodule.js","./query-params-helper-c231e1b8.nomodule.js","./main-thread-to-worker-5609c757.nomodule.js","./default-light-setting-01a91d0f.nomodule.js"],(function(e){var n,o,t,r,c,i,a,s,l,u,p,d,f,g;return{setters:[function(e){n=e.S,o=e.M},function(e){t=e.D,r=e.L,c=e.R,i=e.a,a=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,g=e.R},function(){},function(){},function(){}],execute:function(){const m=[new t("logger",r),new t("rapi-access",c),new t("script-loader",n),new t("camera-control-3d",u),new t("camera-control",p),new t("data-syncer",i),new t("configurator-scene-manager",f,1),new t("configurator-view-model",a,1),new t("component-raycast-helper",d,0)];e("Configurator",class extends o{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"),n=this.lookup("rapi-access");this.lookup("dom-helper");const o=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),o&&o.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:o,planObjectId:t}=e||{};l.init({kernelInstance:n,kernelContainer:o,planObjectId:t})}getApi(){return this._configurator}bootFinished(){this._configurator=new g(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}})}}}));
2
+ //# sourceMappingURL=configurator-c0efe42a.nomodule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configurator-c0efe42a.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{Configurator}from"./configurator-c62d84e8.js";import"./script-loader-9059c8a6.js";import"./query-params-helper-a271f9dc.js";import"./roomle-dependency-injection-bf64a07e.js";import"./main-thread-to-worker-30982707.js";import"./scene-manager-d25d6ad2.js";import"./component-raycast-helper-4f91b663.js";import"./roomle-configurator-42d4fecc.js";import"./default-light-setting-f4f47231.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-ba699dda.js.map
1
+ import{Configurator}from"./configurator-2350f3d3.js";import"./script-loader-9059c8a6.js";import"./query-params-helper-a271f9dc.js";import"./roomle-dependency-injection-bf64a07e.js";import"./main-thread-to-worker-30982707.js";import"./scene-manager-d25d6ad2.js";import"./component-raycast-helper-4f91b663.js";import"./roomle-configurator-ffec540a.js";import"./default-light-setting-f4f47231.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-4b935814.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configurator-main-4b935814.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- System.register(["./configurator-a9c1fe12.nomodule.js","./script-loader-92e1532b.nomodule.js","./query-params-helper-c231e1b8.nomodule.js","./roomle-dependency-injection-2583f0dc.nomodule.js","./main-thread-to-worker-5609c757.nomodule.js","./scene-manager-45fc4ce6.nomodule.js","./component-raycast-helper-ac3b7072.nomodule.js","./roomle-configurator-b01d2885.nomodule.js","./default-light-setting-01a91d0f.nomodule.js"],(function(){var e;return{setters:[function(n){e=n.Configurator},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
1
+ System.register(["./configurator-c0efe42a.nomodule.js","./script-loader-92e1532b.nomodule.js","./query-params-helper-c231e1b8.nomodule.js","./roomle-dependency-injection-2583f0dc.nomodule.js","./main-thread-to-worker-5609c757.nomodule.js","./scene-manager-45fc4ce6.nomodule.js","./component-raycast-helper-ac3b7072.nomodule.js","./roomle-configurator-140651b8.nomodule.js","./default-light-setting-01a91d0f.nomodule.js"],(function(){var e;return{setters:[function(n){e=n.Configurator},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
2
2
  //# sourceMappingURL=configurator-main.nomodule.js.map
@@ -657,6 +657,9 @@ export default class RoomleConfigurator implements GlobalAPI, Context, KernelUti
657
657
  generateProductionServiceExport(defaultExportDefinition?: string): Promise<any>;
658
658
  generateTCExport(defaultExportDefinition?: string): Promise<any>;
659
659
  generateIMOSiXExport(defaultExportDefinition?: string): Promise<any>;
660
+ /**
661
+ * Generate configuration export
662
+ */
660
663
  generateExport(exportType: ExportType, defaultExportDefinition?: string): Promise<any>;
661
664
  }
662
665
  export {};
@@ -1,2 +1,2 @@
1
- System.register(["./script-loader-35fe01aa.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./scene-manager-079c4752.legacy.js","./component-raycast-helper-e634d9cc.legacy.js","./roomle-configurator-7dc323ca.legacy.js","./query-params-helper-8c00a872.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(e){var n,t,o,c,a,r,i,s,l,u,p,g,d,f;return{setters:[function(e){n=e.S,t=e.M},function(e){o=e.D,c=e.L,a=e.R,r=e.a,i=e.C,s=e.b,l=e.A},function(e){u=e.C,p=e.a},function(e){g=e.default},function(e){d=e.C,f=e.R},function(){},function(){},function(){}],execute:function(){const h=[new o("logger",c),new o("rapi-access",a),new o("script-loader",n),new o("camera-control-3d",u),new o("camera-control",p),new o("data-syncer",r),new o("configurator-scene-manager",d,1),new o("configurator-view-model",i,1),new o("component-raycast-helper",g,0)];e("Configurator",class extends t{setupDependencies(){s.setup(h),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"),n=this.lookup("rapi-access");this.lookup("dom-helper");const t=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),t&&t.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:t,planObjectId:o}=e||{};l.init({kernelInstance:n,kernelContainer:t,planObjectId:o})}getApi(){return this._configurator}bootFinished(){this._configurator=new f(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}})}}}));
2
- //# sourceMappingURL=configurator-5d8e9e4c.legacy.js.map
1
+ System.register(["./script-loader-35fe01aa.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./scene-manager-079c4752.legacy.js","./component-raycast-helper-e634d9cc.legacy.js","./roomle-configurator-285a9f09.legacy.js","./query-params-helper-8c00a872.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(e){var n,t,o,c,a,r,i,s,l,u,p,g,f,d;return{setters:[function(e){n=e.S,t=e.M},function(e){o=e.D,c=e.L,a=e.R,r=e.a,i=e.C,s=e.b,l=e.A},function(e){u=e.C,p=e.a},function(e){g=e.default},function(e){f=e.C,d=e.R},function(){},function(){},function(){}],execute:function(){const h=[new o("logger",c),new o("rapi-access",a),new o("script-loader",n),new o("camera-control-3d",u),new o("camera-control",p),new o("data-syncer",r),new o("configurator-scene-manager",f,1),new o("configurator-view-model",i,1),new o("component-raycast-helper",g,0)];e("Configurator",class extends t{setupDependencies(){s.setup(h),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"),n=this.lookup("rapi-access");this.lookup("dom-helper");const t=this.lookup("configurator-scene-manager");e&&e.cleanUp(),n&&n.cleanUp(),t&&t.cleanUp()}setupGlobals(e){const{kernelInstance:n,kernelContainer:t,planObjectId:o}=e||{};l.init({kernelInstance:n,kernelContainer:t,planObjectId:o})}getApi(){return this._configurator}bootFinished(){this._configurator=new d(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}})}}}));
2
+ //# sourceMappingURL=configurator-2316b444.legacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configurator-2316b444.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- System.register(["./configurator-5d8e9e4c.legacy.js","./script-loader-35fe01aa.legacy.js","./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./scene-manager-079c4752.legacy.js","./component-raycast-helper-e634d9cc.legacy.js","./roomle-configurator-7dc323ca.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(){var e;return{setters:[function(n){e=n.Configurator},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
1
+ System.register(["./configurator-2316b444.legacy.js","./script-loader-35fe01aa.legacy.js","./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./scene-manager-079c4752.legacy.js","./component-raycast-helper-e634d9cc.legacy.js","./roomle-configurator-285a9f09.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(){var e;return{setters:[function(n){e=n.Configurator},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
2
2
  //# sourceMappingURL=configurator-main.legacy.js.map
@@ -1,2 +1,2 @@
1
- System.register(["./script-loader-35fe01aa.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./scene-manager-079c4752.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./roomle-configurator-7dc323ca.legacy.js","./query-params-helper-8c00a872.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(e,t){var n,a,i,s,r,o,l,c,h,d,_,g,p,m,u,v,w,C,f,b,M,E,P,S,y,I,D,O,H,L,A,k,V,j,x,T,R,W,B,F,K,z,G,U,N,Z,q,X,J,Q,Y,$,ee,te,ne,ae,ie,se,re,oe,le,ce,he,de,_e,ge,pe,me,ue,ve,we,Ce,fe,be,Me,Ee,Pe,Se,ye;return{setters:[function(e){n=e.S,a=e.M},function(e){i=e.Z,s=e.E,r=e.W,o=e.F,l=e._,c=e.i,h=e.h,d=e.N,_=e.a8,g=e.e,p=e.a9,m=e.c,u=e.S,v=e.aa,w=e.ab,C=e.j,f=e.O,b=e.ac,M=e.ad,E=e.ae,P=e.af,S=e.k,y=e.V,I=e.ag,D=e.ah,O=e.ai,H=e.d,L=e.aj,A=e.r,k=e.ak,V=e.H,j=e.B,x=e.al,T=e.p,R=e.am,W=e.D,B=e.L,F=e.an,K=e.R,z=e.b},function(e){G=e.L,U=e.B,N=e.C,Z=e.b,q=e.c,X=e.T},function(e){J=e.a,Q=e.A,Y=e.C,$=e.D,ee=e.V,te=e.ai,ne=e.bG,ae=e.at,ie=e.bd,se=e.j,re=e.G,oe=e.aL,le=e.aG,ce=e.ah,he=e.U,de=e._,_e=e.e,ge=e.f,pe=e.b1,me=e.b2,ue=e.bi,ve=e.aD,we=e.h,Ce=e.bW,fe=e.aR,be=e.bX,Me=e.X},function(e){Ee=e.S,Pe=e.C,Se=e.P,ye=e.R},function(){},function(){}],execute:function(){class Ie extends G{constructor(e,t){super(e,t),this._center=new J(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:2,y:1,z:2},color:"#ffffff"}},this._ambientLight=new Q(new Y(this._params.ambientLight.color),.4),this._ambientLight.layers.set(1),this._mainDirLight=new $(new Y(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new ee(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new J));const t=new te;e.getBoundingSphere(t);const n=t.radius,a=new J(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=i();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new Y(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new Y(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new Y(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}const De=e=>e instanceof r||e instanceof o;class Oe{constructor(e){const{planElementViewModel:t,planElementViewModels:n,selectionMode:a,reason:i}=e;this.planElementViewModel=t,this.planElementViewModels=n,this.selectionMode=a,this.reason=i}}class He{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i,reason:s}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i,this.reason=s}}class Le extends Ee{constructor(e,t,n,a){super(e,t,n,a),this._isDrawingEnabled=!1,this._isCurrentlyDrawing=!1,this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0),this._raycastHelper.addEventListener(0,()=>{2!==this._state?this._plannerSelectionHandler.cancelSelection("click_outside"):this.resetState()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new He({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(2,({planElementViewModels:e})=>{this._roomlePlannerUiCallback.onMultiSelectionChange(e)},this),this._plannerSelectionHandler.addEventListener(15,({selectionMode:e})=>{"multiselect"===e&&this._hoveredObject&&this._hoverOnMultiSelect(this._hoveredObject)},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e,reason:t})=>{1!==this._state&&this.setState(0),this.dispatchEvent(1,new He({planElementViewModel:e,reason:t}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}disable(){const e=new ne;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}get planInteractionHandler(){var e;return null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler}enable(){const e=new ne;e.disableAll(),e.enable(3),e.enable(7),e.enable(6),e.enable(9),e.enable(2),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}enableConstructionEvents(e){e?this._raycastHelper.getLayers().enable(9):this._raycastHelper.getLayers().disable(9)}enableObjectEvents(e){e?this._raycastHelper.getLayers().enable(6):this._raycastHelper.getLayers().disable(6)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}addPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getObject(),{hasListener:!0,priority:1,roomleId:e.getId()})}addNodeHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=ae(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=ae(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("double_click",t=>{var n;this._doubleClickElement(e,t.attachment.type,null===(n=t.attachment.intersection)||void 0===n?void 0:n.point)}),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_createFloorMeshWithHandler(){const e=new ie(1e3,1e3,8,8),t=new se;t.visible=!1;const n=new re(e,t);return n.name="2D raycaster floor mesh",n.rotation.set(-Math.PI/2,0,0),n.layers.enable(2),n.userData=ae(n.userData,{hasListener:!0,priority:.9,roomleId:void 0}),n.addEventListener("double_click",e=>{this._doubleClickOnPlane(h(e.attachment.intersection.point),e.attachment.type)}),n.addEventListener("select",e=>{this._isCurrentlyDrawing?this._clickOnPlane(h(e.attachment.intersection.point)):this._plannerSelectionHandler.cancelSelection("select_other")}),n}_clickOnPlane(e){this._createNode(null,e)}_doubleClickOnPlane(e,t=0){this._closeToPoint(e)?this.stopDrawing():this._toggleDrawing(null,e,t)}_closeToPoint(e){let t=!1;for(const n of this._planViewModel.getNodePlanObjectViewModels())this._close(n.getPlanElement().getCenter(),e)&&(t=!0);return t}_close(e,t){return Math.abs(e.x-t.x)<500&&Math.abs(e.y-t.y)<500&&Math.abs(e.z-t.z)<500}_clickElement(e){this._isCurrentlyDrawing||(this._debug&&e.getId(),2!==this._state?(this._plannerSelectionHandler.check(e),this._roomlePlannerUiCallback.onClickElement(e),this._setCursor()):this.resetState())}_doubleClickElement(e,t=0,n){if(!this._isDrawingEnabled||!(e instanceof d||e instanceof r))return;let a;this._debug&&e.getId(),e instanceof r&&this._plannerSelectionHandler.cancelSelection("double_click_wall"),e instanceof d?a=e.getPlanElement().getCenter():n&&(a=h(new J(n.x,0,n.z))),this._isCurrentlyDrawing?this._endWallDrawing(null,a):this._startWallDrawing(null,a,t)}_hoverOn(e){this._isCurrentlyDrawing||("multiselect"===this._plannerSelectionHandler.getSelectionMode()?this._hoverOnMultiSelect(e):this._hoverOnStandard(e))}_hoverOnMultiSelect(e){De(this._hoveredObject)||De(e)?(this._hoveredObject=null,oe("default")):this._hoverOnStandard(e)}_hoverOnStandard(e){e.hoverOn(),this._hoveredObject=e,this.dispatchEvent(3,new He({planElementViewModel:e})),this._interaction(),this._setCursor()}_hoverOff(e){e.hoverOff(),this.dispatchEvent(4,new He({planElementViewModel:e})),this._interaction(),this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?oe("ew-resize"):1===this._state?oe("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?oe("move"):this._hoveredObject?oe("pointer"):3===this._state?oe(_?"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 0 15, auto":"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 3 20, auto"):oe("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(e){this._plannerSelectionHandler.cancelSelection(e)}_dragStart(e){((this._plannerSelectionHandler.isSelected(e.getId())||this._dragIn)&&0===this._state||this._isDrawingEnabled)&&(this.dispatchEvent(8),le(v.DRAG).then(()=>{if(this._inputManager.isMouseUp())return this.setState(0),oe("pointer"),void this.dispatchEvent(12);this._draggedObject=e,this.setState(1),this._roomlePlannerUiCallback.onDragElementStart(),this.dispatchEvent(9,new He({planElementViewModel:e}))}))}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanElement())),n.moveObjectsBy(e,h(a))}else(e instanceof d||e instanceof r||this._planViewModel.cameraType===g.CAMERA_2D)&&(this._plannerSelectionHandler.check(e),t.y=p(e.getPlanElement().getCenter()).y),n.moveElementTo(e.getPlanElement(),h(t));this.dispatchEvent(10,new He({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(11,new He({planElementViewModel:e})),this._dragIn&&this.setDragIn(!1),this._roomlePlannerUiCallback.onDragElementEnd(),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){var t,n;const a=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new He({state:this._state,oldState:a})),this._position=null,2===this._state?null===(t=this.planInteractionHandler)||void 0===t||t.deactivateAllSnappingActivity():2===a&&(null===(n=this.planInteractionHandler)||void 0===n||n.reactivateAllSnappingActivity())}resetState(){this.setState(0)}_move(e){if(3!==this._state&&2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new J(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,s=new ce;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanElement()),s.expandByObject(n.getContainer()))});const r=s.getCenter(new J);this.planInteractionHandler.rotateObjectsBy(i,t,h(r)),this._position.copy(new J(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}async selectPlanElement(e){(e instanceof m||e instanceof u)&&await e.isInitDone(),this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(13,new He({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}enableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!0}disableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!1}enableWallDrawing(){return this._isDrawingEnabled=!0,this._drawingGroup=new he,this._drawingGroup.name="Drawing",this._drawingGroup.add(this._createFloorMeshWithHandler()),this._inputManager.addEventListener(6,this._drawWallOnMouseMove,this),this._inputManager.addEventListener(13,this._endWallDrawing,this),this._drawingGroup}cancelWallDrawing(){return this._isDrawingEnabled=!1,this._setStateAndCursor(0),this._inputManager.removeEventListener(6,this._drawWallOnMouseMove),this._inputManager.removeEventListener(13,this._endWallDrawing),this._raycastHelper.clear(),this._drawingGroup}stopDrawing(e=!0){var t;e&&this.planInteractionHandler.cancelDrawing(),this._raycastHelper.getLayers().enable(9),this._isCurrentlyDrawing=!1,this._setStateAndCursor(0),this.dispatchEvent(7),null===(t=this._continousDrawingHelper)||void 0===t||t.endDrawing()}startDrawing(){var e;this._isCurrentlyDrawing||(this._isCurrentlyDrawing=!0,this._raycastHelper.getLayers().disable(9),this.dispatchEvent(6),this._setStateAndCursor(3),null===(e=this._continousDrawingHelper)||void 0===e||e.update())}_toggleDrawing(e,t,n){this._isCurrentlyDrawing?this._endWallDrawing(e,t):this._startWallDrawing(e,t,n)}_endWallDrawing(e,t){if(this._isCurrentlyDrawing){if(this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle()&&this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle())this.planInteractionHandler.cancelDrawing();else{const{x:n,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.endDrawing({x:n,y:a,z:0})}this.stopDrawing(!1)}}async _startWallDrawing(e,t,n){(e&&2===e.type||2===n)&&(await this._initMobileDrawing(),this._continousDrawingHelper.update());const{x:a,y:i}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.beginDrawing({x:a,y:i,z:0}),this.startDrawing()}async _initMobileDrawing(){if(this.planInteractionHandler.setDrawingType(0),this.planInteractionHandler.setSnapFeedbackWhileDrawing(!0),!this._continousDrawingHelper){const{default:e}=await t.import("./continuous-drawing-helper-d7691e20.legacy.js");this._continousDrawingHelper=new e,this._continousDrawingHelper.init(this._drawingGroup,this.planInteractionHandler.getContinuousDrawingManager(),this._kernelZoomFactor)}}_drawWallOnMouseMove(e){var t;if(!this._isCurrentlyDrawing)return;const{x:n,y:a}=this._getIntersectionPointWithScene(e);this.planInteractionHandler.currentDrawingPosition({x:n,y:a,z:0}),null===(t=this._continousDrawingHelper)||void 0===t||t.update(),this.dispatchEvent(5)}_createNode(e,t){if(!this._isCurrentlyDrawing)return;const{x:n,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.forceNode({x:n,y:a,z:0}),this._raycastHelper.clear()}_getIntersectionPointWithScene(e){return this._raycastHelper.intersectMouseOnScene(e)}_setStateAndCursor(e){this.setState(e),this._setCursor()}setKernelZoomFactor(e){var t;this._kernelZoomFactor=e,null===(t=this._continousDrawingHelper)||void 0===t||t.setKernelZoomFactor(e)}}l([c],Le.prototype,"_plannerSelectionHandler",void 0),l([c],Le.prototype,"_plannerKernelAccess",void 0),l([c],Le.prototype,"_roomlePlannerUiCallback",void 0);const Ae=(e,t,n,a)=>{const i=(new ce).setFromObject(e.getContainer()).getCenter(new J);return{runtimeId:e.getId(),position2d:w(C(i,t,n,a))}};var ke=function(e){de(n,e);var t=_e(n);function n(){var e;ge(this,n);var a=n.SkyShader,i=new pe({name:"SkyShader",fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:me.clone(a.uniforms),side:ue,depthWrite:!1});return(e=t.call(this,new ve(1,1,1),i)).isSky=!0,e}return we(n)}(re);ke.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new J},up:{value:new J(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\n\t\t}"};const Ve=async(e,t,n)=>{let a=[];const i=[],s=[];await Promise.all(e.map(async e=>{const n=f(e);if(n.catalogItemId?i.push(n.catalogItemId):n.configurationHash&&s.push(n.configurationHash),n.parts){const e=n.configurationHash||n.catalogItemId,a=await t.addUiDataAndPriceToPartList(n.parts,e);n.parts=a}n.data=null,a.push(n)}));const[r,o]=await Promise.all([n.getItems(i),n.getConfigurations(s)]),l=[],c=new Map;for(const e of r)c.set(e.id,e);for(const e of o)c.set(e.id,e),l.push(e.rootComponentId);const h=await n.getComponents(l),d=new Map;for(const e of h)d.set(e.id,e);for(const e of a){const t=e.catalogItemId||e.configurationHash,n=c.get(t)||null;if(n&&!n.label&&d.has(n.rootComponentId)){const e=d.get(n.rootComponentId);n.label=e.label}n&&!n.label&&(n.label=t),e.data=n}return a};class je extends Pe{constructor(e,t,n,a){super(e,t,a),this._staticItemGuard=new b,this._configurableItemGuard=new b,this._planCompletelyLoadedGuard=new b,this.currentSelection=null,this._stopRendering=!0,this._configuratorContext.baseContext="planner",this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new Le(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._roomleRenderer.switchToPlanner(M.Mode3D),this._imageRenderer.switchToPlannerSettings(),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e||3===e?(this._cameraControl.lock(),this._onCameraMove()):(this._cameraControl.unlock(),this._onCameraIdle())},this),this._plannerSceneEventHandler.addEventListener(13,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof u&&this._initData.debug&&e.getGLBUrl(),this._highlightPlanElement(e),this._onSelectionChange(e),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(1,({planElementViewModel:e,reason:t})=>{this._highlightPlanElement(null),this._onSelectionCancel(e),this._roomlePlannerUiCallback.onSelectionCancel(t),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(8,()=>{this._cameraControl.lock()},this),this._plannerSceneEventHandler.addEventListener(9,({planElementViewModel:e})=>{this._getKernelAccess().planInteractionHandler.startInteraction(),e instanceof r&&this._sendWallDimensions(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(10,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(11,async({planElementViewModel:e})=>{const t=this._getKernelAccess().planInteractionHandler;t.endInteraction(),this._cameraControl.unlock();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),h(n)),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!1),this._renderEverything();const a=this.getPlanObject(e.getId());let i;a&&(i=await Ve([a],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.CHANGED,i?i[0]:null)},this),this._plannerSceneEventHandler.addEventListener(12,()=>{this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(6,()=>{this._setKernelZoomFactor(),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(5,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(7,()=>this._renderWithoutShadowsAndAO(),this),this._getKernelAccess().addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._renderListener=()=>{this._requestRender()},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this.disableConfiguratorEvents(),this.enablePlannerEvents()}planCleared(){}planHistoryStateChanged(){this._sendWallDimensions()}_getViewModel(){return this._viewModel||(this._viewModel=new Se(this._creator_)),this._viewModel}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new J),a=e.distanceTo(n),i=t.getSize(new J),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new J).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){const t={};if(e instanceof u&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof m&&(t.configurationRuntimeId=e.getConfigurationRuntimeId()),e instanceof r){const n=this._cameraControl.getKernelZoomFactor();t.wall=e.getWallDimension(n)}e instanceof o&&(t.staticItemRuntimeId=e.getPlanElement().getId());let n=(e=>{if(e instanceof u){const t=e.getPlanObject().getObjectType();return"door"!==t&&"window"!==t?"static":t}return e instanceof m?"configuration":e instanceof r?"wall":e instanceof o?"floor":"unknown"})(e);const a=(async()=>{const t={};if(e instanceof u&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof m){await e.isInitDone();const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId();let s,r=i;if(r||(r=this._getKernelAccess().kernelInstance.getHashOfConfiguration(a)),this._configuratorContext.planObjectId=a,this._configuratorContext.planElementId=e.getId(),this._configuratorContext.rootComponentId=e.getRootComponentRuntimeId(),i&&V(i)){const e=await this._rapiAccess.getItem(i);t.item=e,s=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(r);t.configuration=e,s=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+r+", saving configuration...");const n=await this._getKernelAccess().getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(n);t.configuration=i,s=i.rootComponentId?i.rootComponentId:null}if(s){const e=await this._rapiAccess.getComponent(s);t.component=e}t.configurationRuntimeId=a,n="configuration"}return t.planElementId=e.getId(),Ce(t)})();this.currentSelection=Ce(t),this._roomlePlannerUiCallback.onSelectionChange(Ce(this._plannerSceneEventHandler.getSelectionMode()),Ce(n),Ce(t),a,e),(e instanceof r||e instanceof d)&&(this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.show()),this._updateNodeSize()),this._renderWithoutShadowsAndAO()}_onSelectionCancel(e){this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide()),this._renderWithoutShadowsAndAO(),this.resetConfiguratorContext(),this.currentSelection=null}resetConfiguratorContext(){this._configuratorContext.planObjectId=0,this._configuratorContext.planElementId=0,this._configuratorContext.rootComponentId=0,this._configuratorContext.dockingRootComponentId=0}_setupScene(e,t){super._setupScene(e,t,!0),this._initData.legacyLight&&(this._lightSetting=new Ie(this._scene,this._lightSetting)),this._initData.moc||this._addSky(),this._setEnvironment(new U(this._scene,this._environment,new Y(this._initData.colors.DEFAULT_BACKGROUND)))}onBeforeRender(){this._cameraControl instanceof N&&P(this._cameraControl.getCamera(),this._getViewModel().getWallPlanObjectViewModels())&&this._roomleRenderer.forceShadowUpdates(!0)}_getInputManager(){return this._plannerInputManager}createCameraControl(e,t){this.setMode(e)}startViewing(){this._configuratorContext.baseContext="glb-viewer";const e=this._plannerSceneEventHandler.getSelectedIds();if(1===e.length){const t=this._getViewModel().getPlanObjectForId(e[0]);this._cameraControl instanceof N&&this._cameraControl.setObjectRotation(t.getPlanElement().rotation),this._getViewModel().hideAllExcept(t.getId())}this.resetCamera(),this.disablePlannerEvents(),this.updateEnvironment(this.getBounds(),!0)}startConfiguring(){var e;this._configuratorContext.baseContext="configurator";const{planElementId:t}=this._configuratorContext,n=this._getViewModel().getPlanObjectForId(t);n&&(this.setRootComponentId(n.getRootComponentRuntimeId()),this._cameraControl instanceof N&&this._cameraControl.setObjectRotation(n.getPlanElement().rotation));const a=null==n?void 0:n.getConfigurationRuntimeId();this._configuratorContext.planObjectId!==a&&(this._configuratorContext.planObjectId=a),this._getViewModel().hideAllExcept(t),this.resetCamera(),this.disablePlannerEvents(),this.enableConfiguratorEvents(),this._roomleRenderer.switchToConfigurator(),this._imageRenderer.switchToConfiguratorSettings(),this.updateScene(),this._getKernelAccess().updatePlanObjectDependencies(a),this._getKernelAccess().requestPartListAndUpdatePricesOfParts(),this._getKernelAccess().planObjectUpdated(a),this.updateEnvironment(this.getBounds(),!0);const i=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==i||i.startInteraction()}async selectPlanObject(e){if(this._plannerSceneEventHandler.getSelectedIds().includes(e))return;const t=this._getViewModel().getPlanObjectForId(e);await this._plannerSceneEventHandler.selectPlanElement(t),this._onSelectionChange(t)}backToPlanner(){var e;if(this._getViewModel().showAll(),"configurator"===this._configuratorContext.baseContext){const t=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==t||t.endInteraction()}this._configuratorContext.baseContext="planner",this._cameraControl instanceof N&&this._cameraControl.setObjectRotation(0),this.resetCamera(),this.enablePlannerEvents(),this.disableConfiguratorEvents(),this._roomleRenderer.switchToPlanner(this._cameraControl instanceof N?M.Mode3D:M.Mode2D),this._imageRenderer.switchToPlannerSettings(),this.updateScene()}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}_getYRotationOfObject(e){let t=e.getWorldDirection(new J).clone();t.y=0,t.lengthSq()<.01&&(t=new J(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._getViewModel().getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._getKernelAccess().catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=S(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._stopRendering=!1,this._renderEverything(),this.resetCamera(),setTimeout(()=>this._planCompletelyLoadedGuard.resolve(),0),this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide())}handlerSwitchedPlans(e,t){if(this._roomlePlannerUiCallback.onHandlerSwitchedPlans(),this._getViewModel().setReference(t),this._getKernelAccess().coupleReferences(this._getViewModel(),t),this._getViewModel().setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._getViewModel().setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._getViewModel()),e&&this.clearScene(),!this._initData.moc){this._addSky();let e=new ie(1e3,1e3);e.rotateX(-Math.PI/2);let t=y.createMeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0,depthWrite:!1}),n=new re(e,t);n.name="Ground",n.position.y=-.01,n.userData.isFloor=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),this._planCompletelyLoadedGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait(),this._planCompletelyLoadedGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){var e;const t=this._getViewModel().getCorePlan();if(this._roomleRenderer){const n=S(t.getBounds());null===(e=this._roomleRenderer)||void 0===e||e.updateBounds(n)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this.updateEnvironment(this.getBounds(),!0),this._renderEverything()}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{var e;this._scene.add(this._getViewModel().getConstructionGroup()),this._scene.add(this._getViewModel().getCeilingGroup()),this._scene.add(this._getViewModel().getFloorGroup()),(null===(e=this._lightSetting)||void 0===e?void 0:e.needsBounds())&&this._lightSetting.updateBounds(this._getViewModel().getBoundingBox()),this._scene.remove(this._preloadScene)}}async addPlanObjectToScene(e){if(e){const t=e.getContainer();I(t),this._scene.add(t),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender()),this._roomlePlannerUiCallback.onPlanChanged(),await e.isInitDone(),this._zoomToBounds(!1,!1),this.updateEnvironment(this.getBounds()),this._renderEverything();const n=this.getPlanObject(e.getId());let a;n&&(a=await Ve([n],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.ADDED,a?a[0]:null)}}removePlanObjectFromScene(e){(e instanceof r||e instanceof d)&&this._sendWallDimensions(),this._scene.remove(e.getContainer()),e.clear(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!0),this._renderEverything()}async planElementChanged(e,t){if(this._drawingEnabled&&this._sendWallDimensions(!1),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged(),!this._plannerSceneEventHandler.isDragIn()){const e=this.getPlanObject(t.getId());let n;e&&(n=await Ve([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.CHANGED,n?n[0]:null)}}exportGLB(e,t){}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._getViewModel().sceneCleared(),super.clearScene()}_addSky(){if(!this._sky){this._sky=new ke,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._sky.frustumCulled=!1,this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=D(4e5,0,.6);this._sky.material.uniforms.sunPosition.value.copy(e);let t=new re(new fe(2e4,16,8),new se({color:16777215}));t.name="Sunsphere",t.position.y=-7e5,t.visible=!1,t.position.set(e.x,-e.z,e.y)}this._lightSetting instanceof Ie&&this._lightSetting.updateSunPosition(.6,0)}switchTo2D(){var e;if(this._onCameraMove(),!(this._cameraControl instanceof Z)){for(const e of this._getViewModel().getWallPlanObjectViewModels())e.show();this._getViewModel().setCameraType(g.CAMERA_2D),null===(e=this._roomleRenderer)||void 0===e||e.switchToPlanner(M.Mode2D),this._renderEverything(),this._changeCameraControl(new Z(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(g.CAMERA_2D),this._setCameraControlListeners(),this._setKernelZoomFactor(),this._onCameraMove()}}switchTo3D(){var e;this._onCameraMove(),this._cameraControl instanceof N||(this._getViewModel().setCameraType(g.CAMERA_3D),null===(e=this._roomleRenderer)||void 0===e||e.switchToPlanner(M.Mode3D),this._renderEverything(),this._changeCameraControl(new N(this._creator_,this._getInputManager(),new J(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(g.CAMERA_3D),this._setCameraControlListeners())}_setCameraControlListeners(){this._cameraControl.addEventListener(8,()=>{this._onCameraIdle()},this),this._cameraControl.addEventListener(1,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(3,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(4,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(5,()=>{this._onCameraZoomChange()},this)}_onCameraZoomChange(){this._setKernelZoomFactor()}_setKernelZoomFactor(){var e,t;const n=this._cameraControl.getKernelZoomFactor();null===(e=this._getKernelAccess().planInteractionHandler)||void 0===e||e.setZoomFactor(n),null===(t=this._plannerSceneEventHandler)||void 0===t||t.setKernelZoomFactor(n)}_setCeiling(){this._getViewModel()&&(this._cameraControl instanceof q?this._getViewModel().getCeilingGroup().visible=!0:this._getViewModel().getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof N&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof q)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>O(e.material,!1,!1)),this._getViewModel().setCameraType(g.CAMERA_FP),this._renderEverything();let e=new J(0,0,0);this._getViewModel()&&(e=this._getViewModel().getBoundingBox().getCenter(new J)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new q(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(g.CAMERA_FP),this._setCameraControlListeners()}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof N&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof N&&(this._cameraControl.disablePanning(),e.preventDefault()),!e.key||"Escape"!==e.key&&"Esc"!==e.key||this._drawingEnabled&&(this.escapeDrawing(),this._roomlePlannerUiCallback.onDrawCancel())}setMode(e){switch(e){case g.CAMERA_2D:this.switchTo2D();break;case g.CAMERA_3D:this.switchTo3D();break;case g.CAMERA_FP:this.switchToFirstPerson()}}_highlightPlanElement(e){var t;let n=new Set;e instanceof H&&this._cameraControl instanceof Z&&e&&e.getTopViewContainer()?n.add(e.getTopViewContainer()):e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>n.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const t=this._getViewModel().getPlanObjectForId(e);t instanceof H&&this._cameraControl instanceof Z&&t&&t.getTopViewContainer()?n.add(t.getTopViewContainer()):t&&t.getObject()&&t.getObject().children&&t.getObject().children.forEach(e=>n.add(e))}),null===(t=this._roomleRenderer)||void 0===t||t.highlightObjects(Array.from(n))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._getViewModel().removeGeometriesMergedListener()}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._getViewModel().constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&("planner"===this._configuratorContext.baseContext&&this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){e||(e=this.getBounds()),e&&(this._cameraControl instanceof N&&this._cameraControl.updateToBounds(e,!1),this._cameraControl instanceof Z&&this._cameraControl.zoomToFitBounds(L(e,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight,1.1),!0),this._renderEverything())}_zoomToBounds(e,t=!0){const n=this.getBounds();this._cameraControl instanceof N&&(this._getViewModel().getPlanObjectCount()<=1?this._cameraControl.zoomToFitBounds(n,t):this._cameraControl.checkBoundsAndPlaceCamera(n,t)),this._cameraControl instanceof Z&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(n,e,t)}updateCameraOnDrawWalls(){const e=this.getBounds();this._cameraControl instanceof Z&&this._cameraControl.zoomToFitBounds(e,!1,!0),this._cameraControl instanceof N&&this._cameraControl.zoomToFitBounds(e,!0)}getBounds(){return this._getViewModel()?this._getViewModel().getBoundingBox():null}getPlanObject(e){const t=this._getKernelAccess().planInteractionHandler,n=this._plannerKernelAccess.planModelViewHelper,a=t.getPlan();return n.getPlanObject(a,e)}cancelPlanElementSelection(e){this._plannerSceneEventHandler.cancelSelection(e),this._highlightPlanElement(null),this._requestRender()}async deletePlanElementSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelPlanElementSelection("delete_object"),await this.deletePlanElementByIds(e)}async deletePlanElementByIds(e){for(const t of e){const e=this._getViewModel().getPlanObjectForId(t);if(e&&e.getObject()){const t=this.getPlanObject(e.getId());let n;t&&(n=await Ve([t],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.REMOVED,n?n[0]:null),this._getKernelAccess().planInteractionHandler.removeElement(e.getKernelObject())}}}rotatePlanElementSelection(e){const t=new(this._getKernelAccess().kernelContainer.PlanObjectPtrList),n=new ce;let a={x:0,y:0,z:0};if(this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const i=this._getViewModel().getPlanObjectForId(e);i&&i.getObject()&&(a=i.getPlanElement().getCenter(),t.push_back(i.getPlanElement()),n.expandByObject(i.getContainer()))}),t.size()>1){const e=n.getCenter(new J);a=h(e)}const i=this._getKernelAccess().planInteractionHandler.groupObjects(t);this._getKernelAccess().planInteractionHandler.rotateGroupBy(i,e,a)}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{var n,a;let i=this._calculateBoundingBoxOfAllMeshes(.1);null===(n=this._lightSetting)||void 0===n||n.removeFromScene(),this._cameraControl instanceof N&&this._getViewModel().setCameraType(g.CAMERA_2D);let s=await this._imageRenderer.prepareTopImage(this._scene,null,i,e);this._cameraControl instanceof N&&this._getViewModel().setCameraType(g.CAMERA_3D),null===(a=this._lightSetting)||void 0===a||a.addToScene(),this._requestRender(),t(s)})})}preparePerspectiveImage(e={}){return"configurator"===this._configuratorContext.baseContext?super.preparePerspectiveImage(e):new Promise((t,n)=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{var n,a;let i;this._cameraControl instanceof N?i=this._cameraControl.getCamera().clone():(i=this.getPerspectiveOffsetCamera(),this._getViewModel().setCameraType(g.CAMERA_3D)),i.resetOffset();let s=this._calculateBoundingBoxOfAllMeshes();null===(n=this._lightSetting)||void 0===n||n.removeFromScene();const r=await this._imageRenderer.preparePerspectiveImage(this._scene,null,i,s,e);this._cameraControl instanceof Z&&this._getViewModel().setCameraType(g.CAMERA_2D),null===(a=this._lightSetting)||void 0===a||a.addToScene(),this._requestRender(),t(r)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return A.getCameraTargetForBBox(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}enableSnapping(){this._plannerSceneEventHandler.enableSnapping()}disableSnapping(){this._plannerSceneEventHandler.disableSnapping()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}disablePlannerEvents(){this._plannerSceneEventHandler.disable()}enablePlannerEvents(){this._plannerSceneEventHandler.enable()}_onCameraIdle(){return super._onCameraIdle()&&(this._sendWallDimensions(),this._sendPlanObjectPositions(),this._roomlePlannerUiCallback.onCameraIdle()),!0}_onCameraMove(){return super._onCameraMove()&&(this._roomlePlannerUiCallback.disableWallDimensions(),this._roomlePlannerUiCallback.cameraStartsMoving()),this._updateNodeSize(),!0}_updateNodeSize(){if(this._cameraControl instanceof Z){const e=1/this._cameraControl.getCamera().zoom;this._getViewModel().setNodeZoom(e)}}_sendPlanObjectPositions(){if(this._cameraControl.isLocked())return;const{clientWidth:e,clientHeight:t}=this._domHelper.element,n=this._cameraControl.getCamera(),a=[],i={staticPlanObjectViewModels:this._getViewModel().getStaticPlanObjectViewModels(),configurablePlanObjectViewModels:this._getViewModel().getConfigurablePlanObjectViewModels(),constructionPlanObjectViewModels:this._getViewModel().getConstructionPlanObjectViewModels(),wallPlanObjectViewModels:this._getViewModel().getWallPlanObjectViewModels(),floorPlanObjectViewModels:this._getViewModel().getFloorPlanObjectViewModels(),nodePlanObjectViewModels:this._getViewModel().getNodePlanObjectViewModels()};for(const s of Object.values(i))for(const i of s)a.push(Ae(i,n,e,t));this._roomlePlannerUiCallback.onUpdatePlanObjectPositions(a)}_sendWallDimensions(e=!0){if(this._cameraControl.isLocked()&&e)return;const t=[],{clientWidth:n,clientHeight:a}=this._domHelper.element,i=this._getViewModel().getWallPlanObjectViewModels(),s=this._cameraControl.getKernelZoomFactor();for(const e of i){const i=e.getWallDimension(s);if(i.length>0){const e=this._cameraControl.getCamera();i.fromPosition2d=C(i.fromPosition3d,e,n,a),i.toPosition2d=C(i.toPosition3d,e,n,a),i.fromWithoutPadding=C(i.fromWithoutPadding,e,n,a),i.toWithoutPadding=C(i.toWithoutPadding,e,n,a),i.textPosition2d=C(i.textPosition3d,e,n,a),i.lengthFormatted=this._unitFormatter.formatMMValueToUnitString(i.length),t.push(k(i))}if(this._initData.debug){const e=new fe(.1,32,16),t=new se({color:16711680}),n=new re(e,t);n.position.copy(i.fromPosition3d);const a=new re(e,t);a.position.copy(i.toPosition3d);const s=new re(e,new se({color:65280}));s.position.copy(i.textPosition3d),this._scene.add(n),this._scene.add(a),this._scene.add(s)}}this._roomlePlannerUiCallback.onUpdateWallDimensions(t)}enableWallDrawing(){if(this._cameraControl instanceof Z){const e=L(this.getBounds(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight);this._cameraControl.zoomToFitBounds(e,!0)}this._drawingEnabled||(this._drawingEnabled=!0,this._scene.add(this._plannerSceneEventHandler.enableWallDrawing()))}disableWallDrawing(){this._drawingEnabled=!1,this._cameraControl.unlock(),this._scene.remove(this._plannerSceneEventHandler.cancelWallDrawing())}escapeDrawing(){this._plannerSceneEventHandler.stopDrawing()}_changeCameraControl(e){super._changeCameraControl(e)}setSceneEvents(e){var t,n;void 0!==e.construction&&(null===(t=this._plannerSceneEventHandler)||void 0===t||t.enableConstructionEvents(e.construction)),void 0!==e.objects&&(null===(n=this._plannerSceneEventHandler)||void 0===n||n.enableObjectEvents(e.objects))}startedDrawing(){this._plannerSceneEventHandler.startDrawing()}stoppedDrawing(){this._plannerSceneEventHandler.stopDrawing()}disableEvents(){super.disableEvents(),this.disablePlannerEvents()}enableEvents(){super.enableEvents(),"planner"===this._configuratorContext.baseContext&&this.enablePlannerEvents()}resetCameraPositionToStart(e=!0){this._cameraControl instanceof N&&super.resetCameraPositionToStart(e),this._cameraControl instanceof Z&&this._updateCamera()}async moveCamera(e){return this._cameraControl instanceof N?super.moveCamera(e):Promise.reject("Camera can only be moved in 3D")}_setInteriorOrExteriorWallMaterial(e,t){const n=this._getViewModel().getWallPlanObjectViewModels();if(!n.length)return;const a=this._getKernelAccess().planInteractionHandler,i=e=>{a.setWallLeftMaterial(e,be(e.leftMaterial,t))},s=e=>{a.setWallRightMaterial(e,be(e.rightMaterial,t))},r=n.map(e=>e.getKernelObject()),o=this._plannerKernelAccess.kernelContainer.WallType.InnerWall,l=this._plannerKernelAccess.kernelContainer.WallType.OuterWallLeft,c=this._plannerKernelAccess.kernelContainer.WallType.OuterWallRight;for(const t of r)t.wallType===o&&"interior"===e&&(i(t),s(t)),t.wallType===l&&("interior"===e?s(t):i(t)),t.wallType===c&&("exterior"===e?s(t):i(t))}changeInteriorWallsMaterial(e){this._setInteriorOrExteriorWallMaterial("interior",e)}changeExteriorWallsMaterial(e){this._setInteriorOrExteriorWallMaterial("exterior",e)}changeFloorsMaterial(e){const t=this._getViewModel().getFloorPlanObjectViewModels();if(!t.length)return;const n=this._getKernelAccess().planInteractionHandler,a=t.map(e=>e.getKernelObject());for(const t of a)n.setFloorMaterial(t,be(t.material,e))}getWallAngleDegrees(e){if(!(e instanceof r))return 0;const t=this._cameraControl.getCamera(),n=new ee(t.position.x,t.position.z),a=new ee(e.getPosition().x,e.getPosition().z).clone().sub(n).normalize(),i=e.getKernelObject(),s=new ee(Math.sin(i.getAngle()),Math.cos(i.getAngle())),o=a.angle()-s.angle();return Me.radToDeg(o)}moveElementPosition(e,t){const n=this._getKernelAccess().planInteractionHandler;n.setObjectFixedZ(e.getPlanElement(),!0),n.moveElementTo(e.getPlanElement(),t),this._sendPlanObjectPositions()}}l([c],je.prototype,"_rapiAccess",void 0),l([c],je.prototype,"_plannerMeshGenerator",void 0),l([c],je.prototype,"_plannerInputManager",void 0),l([c],je.prototype,"_roomlePlannerUiCallback",void 0),l([c],je.prototype,"_localStorageHelper",void 0),l([c],je.prototype,"_unitFormatter",void 0);const xe={left:0,top:1,right:1,bottom:0};class Te{constructor(e){this._hscInstance=null,this._glbInstance=null,this._configurator=null,this._currentMode=1,this._creator_=e,this._kernelAccessCallback.addListener(this)}deleteSelection(){this._sceneManager.deletePlanElementSelection()}rotateSelection(e){this._sceneManager.rotatePlanElementSelection(e)}cancelSelection(e="unknown"){this._sceneManager.cancelPlanElementSelection(e)}init(e,t,n){return j.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{const a=x(e);(a?this._rapiAccess.getPlanSnapshot(e):this._rapiAccess.getPlan(e)).then(n=>{const i=a?n.plan:n.planObjects;this._plan=this._planInteractionHandler.loadPlanXML(i),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&this._rapiAccess.trackView(e),t(n)},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){Promise.all([this._scriptLoader.fetch(X,{id:"tween-js"})]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:a,stats:i}=this._initData;this._sceneManager||(this._sceneManager=new je(this._creator_,xe,this,a)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const s=T.createDynamicLightSettingSource(t,n);i&&this.showStats(),this._sceneManager.enableHD(s),this._planInteractionHandler&&this._kernelReadyCallback()})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){j.showBenchmarks()}getConfiguratorApi(){return this._configurator||(this._configurator=new ye(this._creator_),this._configurator.setOverrides(this._initData),this._configurator.initSceneManager(this._sceneManager)),this._configurator}startViewing(){this._sceneManager.startViewing()}startConfiguring(){var e,t;this._sceneManager.startConfiguring();const n=this._sceneManager.currentSelection,a=(null===(e=n.item)||void 0===e?void 0:e.id)||(null===(t=n.configuration)||void 0===t?void 0:t.id);a&&this._configurator.notifyUiAboutNewLabel(a)}async selectPlanObjectById(e){return this._sceneManager.selectPlanObject(e)}backToPlanner(){this._sceneManager.backToPlanner()}showGUI(){this._sceneManager.showGUI()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-5d8e9e4c.legacy.js").then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().initSceneManager(this._sceneManager),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._currentMode=0,this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-20b26df0.legacy.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._currentMode=2,this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._currentMode=1}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(2===this._currentMode&&this._glbInstance&&this._glbInstance.getApi().clearScene(),0===this._currentMode&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._currentMode=1}backTo(e){console.error("backTo in planner Needs to be implemented later")}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");t&&(t=h(new J(t.x,t.y,t.z)));const a=await(V(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>V(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);return await this._plannerKernelAccess.insertItems(n)}async insertItems(e){return await this._plannerKernelAccess.insertItems(e)}duplicateItems(e){return this._plannerKernelAccess.duplicateItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan),t=f(e.objects);return Ve(t,this._plannerKernelAccess,this._rapiAccess)}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return f(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}enableMultiselect(){this._sceneManager.getPlannerSceneEventHandler().setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e),a=await this.insertItems([n]);if(1!==a.length)throw new Error("More than one object added, abort");return a[0]}enableSnapping(){this._sceneManager.enableSnapping()}disableSnapping(){this._sceneManager.disableSnapping()}async getPartlistOf(e){const t=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(e);if(!t){const e="Object has no partlist because it is not a configuration: "+t;return console.warn(e),Promise.reject(e)}const n=this._plannerKernelAccess.kernelInstance.getPartList(e);return await this._plannerKernelAccess.addUiDataAndPriceToPartList(n,t)}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}drawWalls(e,t={}){var n,a;const i=this._planInteractionHandler;i.startInteraction();const s=[];for(const t of e){const e=i.addNode(t.from),r=i.addNode(t.to),o=i.addWall(e,r);void 0!==(null===(n=t.props)||void 0===n?void 0:n.height)&&i.setWallHeight(o,t.props.height),void 0!==(null===(a=t.props)||void 0===a?void 0:a.thickness)&&i.setWallThickness(o,t.props.thickness),s.push(o)}return t.keepInteractionOpen||i.endInteraction(),this._sceneManager.updateCameraOnDrawWalls(),this._sceneManager.updateScene(),s}async removeElements(e,t={}){this._sceneManager.lockCamera();const n=this._planInteractionHandler;for(const t of e){const e=this._sceneManager.getPlanObject(t.getId());let n;e&&(n=await Ve([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.REMOVED,n?n[0]:null),this._planInteractionHandler.removeElement(t)}t.keepInteractionOpen||n.endInteraction(),this._sceneManager.unlockCamera()}hasWalls(){const e=this._planInteractionHandler,t=null==e?void 0:e.getPlan();return!(!t||t.getWallCount()<1)}enableWallDrawing(){this._sceneManager.enableWallDrawing()}disableWallDrawing(){this._sceneManager.disableWallDrawing()}getUnitFormatter(){return this._unitFormatter}get PlannerCoreTypes(){return this._plannerKernelAccess.kernelContainer}setSceneEvents(e){this._sceneManager.setSceneEvents(e)}async saveCurrentPlanSnapshot(e){const t=await this.getPlanModelViewHelper(),n=this._planInteractionHandler.getPlan(),a=t.getPlanOverview(n),i={parentId:e||null,planObjects:[],combinedIds:[],plan:n.getPlanXML(!1,2)},s=a.objects,r=s.size();for(let e=0;e<r;e++){const t=s.get(e),n=t.configurationHash||t.catalogItemId,{center:a,dimensions:r,rotation:o}=t,l=JSON.stringify({center:a,dimensions:r,rotation:o});i.planObjects.push({combinedId:n,location:l})}const o=await this._rapiAccess.savePlanSnapshot(i),l=new Promise((e,t)=>{Promise.allSettled([this.preparePerspectiveImage(),this.prepareTopImage()]).then(async([n,a])=>{if("rejected"!==n.status&&"rejected"!==a.status)try{const t=await this._rapiAccess.savePlanSnapshotPerspectiveImage(o,n.value),i=await this._rapiAccess.savePlanSnapshotTopImage(o,a.value);e({...t,...i})}catch(e){t(e)}else t("Could not generate images of plan snapshot")})});try{return await l}catch(e){return console.error(e),o}}getPlanXmlFrom(e){return e?x(e.id)?e.plan:e.planObjects:null}async moveCamera(e){return this._sceneManager.moveCamera(e)}async createNewSerializedConfiguration(e){return Promise.resolve(this._plannerKernelAccess.createNewSerializedConfiguration(e))}changeInteriorWallsMaterial(e){this._sceneManager.changeInteriorWallsMaterial(e)}changeExteriorWallsMaterial(e){this._sceneManager.changeExteriorWallsMaterial(e)}changeFloorsMaterial(e){this._sceneManager.changeFloorsMaterial(e)}getWallAngleDegrees(e){return this._sceneManager.getWallAngleDegrees(e)}calcPartsPriceSum(e){return this._plannerKernelAccess.calcPartsPriceSum(e)}async swapObject(e,t){const n=e.getPosition(),a=e.getRotation();return await this._sceneManager.deletePlanElementByIds([e.getPlanElement().getId()]),this.cancelSelection("swap_object"),await this.insertObject(t,n,a)}exportImageFromCamera(e="image"){this._sceneManager.exportImageFromCamera(e)}moveElementPosition(e,t){this._sceneManager.moveElementPosition(e,t)}async generateProductionServiceExport(e,t=""){try{return Promise.resolve(JSON.parse(this._plannerKernelAccess.kernelInstance.generateProductionServiceExport(e,t)))}catch(e){return console.error(e),Promise.reject("Could not create Blue Ocean MVP JSON")}}}l([c],Te.prototype,"_configuratorContext",void 0),l([c],Te.prototype,"_domHelper",void 0),l([c],Te.prototype,"_scriptLoader",void 0),l([c],Te.prototype,"_kernelAccessCallback",void 0),l([c],Te.prototype,"_plannerKernelAccess",void 0),l([c],Te.prototype,"_rapiAccess",void 0),l([c],Te.prototype,"_singlePromiseFactory",void 0),l([c],Te.prototype,"_roomlePlannerUiCallback",void 0),l([c],Te.prototype,"_lifeCycleManager",void 0),l([c],Te.prototype,"_dataSyncer",void 0),l([c],Te.prototype,"_initData",void 0),l([c],Te.prototype,"_globalInitData",void 0),l([c],Te.prototype,"_unitFormatter",void 0);const Re=[new W("script-loader",n),new W("planner-input-manager",class extends R{_canDrag(e){return!0}},1),new W("logger",B),new W("planner-mesh-generator",F),new W("rapi-access",K),new W("planner-selection-handler",class extends s{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(e){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((t,n)=>{this._selectedPlanElementViewModels.delete(n),t.deselect(),this.dispatchEvent(1,new Oe({planElementViewModel:t,reason:e}))})}_checkStandard(e){this._selectedPlanElementViewModels.has(e.getId())||(this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new Oe({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(0,new Oe({planElementViewModel:e})))}_checkMulti(e){if(!De(e)&&!this._selectedPlanElementViewModels.has(e.getId())){this._selectedPlanElementViewModels.set(e.getId(),e),e.select();const t=Array.from(this._selectedPlanElementViewModels).map(([e,t])=>t);this.dispatchEvent(2,new Oe({planElementViewModels:t})),this.dispatchEvent(0,new Oe({planElementViewModel:e}))}}_deselectWallAndFloorElements(){this._selectedPlanElementViewModels.forEach((e,t)=>{De(e)&&(this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new Oe({planElementViewModel:e})))})}setSelectionMode(e){"multiselect"===e&&this._deselectWallAndFloorElements(),this._selectionMode=e,this.dispatchEvent(15,new Oe({selectionMode:e}))}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends a{setupGlobals(){}setupDependencies(){z.setup(Re),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context).init(0)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new Te(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
2
- //# sourceMappingURL=planner-a0ef7d31.legacy.js.map
1
+ System.register(["./script-loader-35fe01aa.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./scene-manager-079c4752.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./roomle-configurator-285a9f09.legacy.js","./query-params-helper-8c00a872.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(e,t){var n,a,i,s,r,o,l,c,h,d,_,g,p,m,u,v,w,C,f,b,M,E,P,S,y,I,D,O,H,L,A,k,V,j,x,T,R,W,B,F,K,z,G,U,N,Z,q,X,J,Q,Y,$,ee,te,ne,ae,ie,se,re,oe,le,ce,he,de,_e,ge,pe,me,ue,ve,we,Ce,fe,be,Me,Ee,Pe,Se,ye;return{setters:[function(e){n=e.S,a=e.M},function(e){i=e.Z,s=e.E,r=e.W,o=e.F,l=e._,c=e.i,h=e.h,d=e.N,_=e.a8,g=e.e,p=e.a9,m=e.c,u=e.S,v=e.aa,w=e.ab,C=e.j,f=e.O,b=e.ac,M=e.ad,E=e.ae,P=e.af,S=e.k,y=e.V,I=e.ag,D=e.ah,O=e.ai,H=e.d,L=e.aj,A=e.r,k=e.ak,V=e.H,j=e.B,x=e.al,T=e.p,R=e.am,W=e.D,B=e.L,F=e.an,K=e.R,z=e.b},function(e){G=e.L,U=e.B,N=e.C,Z=e.b,q=e.c,X=e.T},function(e){J=e.a,Q=e.A,Y=e.C,$=e.D,ee=e.V,te=e.ai,ne=e.bG,ae=e.at,ie=e.bd,se=e.j,re=e.G,oe=e.aL,le=e.aG,ce=e.ah,he=e.U,de=e._,_e=e.e,ge=e.f,pe=e.b1,me=e.b2,ue=e.bi,ve=e.aD,we=e.h,Ce=e.bW,fe=e.aR,be=e.bX,Me=e.X},function(e){Ee=e.S,Pe=e.C,Se=e.P,ye=e.R},function(){},function(){}],execute:function(){class Ie extends G{constructor(e,t){super(e,t),this._center=new J(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:2,y:1,z:2},color:"#ffffff"}},this._ambientLight=new Q(new Y(this._params.ambientLight.color),.4),this._ambientLight.layers.set(1),this._mainDirLight=new $(new Y(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new ee(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new J));const t=new te;e.getBoundingSphere(t);const n=t.radius,a=new J(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=i();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new Y(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new Y(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new Y(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}const De=e=>e instanceof r||e instanceof o;class Oe{constructor(e){const{planElementViewModel:t,planElementViewModels:n,selectionMode:a,reason:i}=e;this.planElementViewModel=t,this.planElementViewModels=n,this.selectionMode=a,this.reason=i}}class He{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i,reason:s}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i,this.reason=s}}class Le extends Ee{constructor(e,t,n,a){super(e,t,n,a),this._isDrawingEnabled=!1,this._isCurrentlyDrawing=!1,this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0),this._raycastHelper.addEventListener(0,()=>{2!==this._state?this._plannerSelectionHandler.cancelSelection("click_outside"):this.resetState()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new He({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(2,({planElementViewModels:e})=>{this._roomlePlannerUiCallback.onMultiSelectionChange(e)},this),this._plannerSelectionHandler.addEventListener(15,({selectionMode:e})=>{"multiselect"===e&&this._hoveredObject&&this._hoverOnMultiSelect(this._hoveredObject)},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e,reason:t})=>{1!==this._state&&this.setState(0),this.dispatchEvent(1,new He({planElementViewModel:e,reason:t}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}disable(){const e=new ne;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}get planInteractionHandler(){var e;return null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler}enable(){const e=new ne;e.disableAll(),e.enable(3),e.enable(7),e.enable(6),e.enable(9),e.enable(2),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}enableConstructionEvents(e){e?this._raycastHelper.getLayers().enable(9):this._raycastHelper.getLayers().disable(9)}enableObjectEvents(e){e?this._raycastHelper.getLayers().enable(6):this._raycastHelper.getLayers().disable(6)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}addPlanObjectHandlers(e,t){t||(t=e.getBoundingBox());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getObject(),{hasListener:!0,priority:1,roomleId:e.getId()})}addNodeHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=ae(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=ae(t.userData,n),t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("double_click",t=>{var n;this._doubleClickElement(e,t.attachment.type,null===(n=t.attachment.intersection)||void 0===n?void 0:n.point)}),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_createFloorMeshWithHandler(){const e=new ie(1e3,1e3,8,8),t=new se;t.visible=!1;const n=new re(e,t);return n.name="2D raycaster floor mesh",n.rotation.set(-Math.PI/2,0,0),n.layers.enable(2),n.userData=ae(n.userData,{hasListener:!0,priority:.9,roomleId:void 0}),n.addEventListener("double_click",e=>{this._doubleClickOnPlane(h(e.attachment.intersection.point),e.attachment.type)}),n.addEventListener("select",e=>{this._isCurrentlyDrawing?this._clickOnPlane(h(e.attachment.intersection.point)):this._plannerSelectionHandler.cancelSelection("select_other")}),n}_clickOnPlane(e){this._createNode(null,e)}_doubleClickOnPlane(e,t=0){this._closeToPoint(e)?this.stopDrawing():this._toggleDrawing(null,e,t)}_closeToPoint(e){let t=!1;for(const n of this._planViewModel.getNodePlanObjectViewModels())this._close(n.getPlanElement().getCenter(),e)&&(t=!0);return t}_close(e,t){return Math.abs(e.x-t.x)<500&&Math.abs(e.y-t.y)<500&&Math.abs(e.z-t.z)<500}_clickElement(e){this._isCurrentlyDrawing||(this._debug&&e.getId(),2!==this._state?(this._plannerSelectionHandler.check(e),this._roomlePlannerUiCallback.onClickElement(e),this._setCursor()):this.resetState())}_doubleClickElement(e,t=0,n){if(!this._isDrawingEnabled||!(e instanceof d||e instanceof r))return;let a;this._debug&&e.getId(),e instanceof r&&this._plannerSelectionHandler.cancelSelection("double_click_wall"),e instanceof d?a=e.getPlanElement().getCenter():n&&(a=h(new J(n.x,0,n.z))),this._isCurrentlyDrawing?this._endWallDrawing(null,a):this._startWallDrawing(null,a,t)}_hoverOn(e){this._isCurrentlyDrawing||("multiselect"===this._plannerSelectionHandler.getSelectionMode()?this._hoverOnMultiSelect(e):this._hoverOnStandard(e))}_hoverOnMultiSelect(e){De(this._hoveredObject)||De(e)?(this._hoveredObject=null,oe("default")):this._hoverOnStandard(e)}_hoverOnStandard(e){e.hoverOn(),this._hoveredObject=e,this.dispatchEvent(3,new He({planElementViewModel:e})),this._interaction(),this._setCursor()}_hoverOff(e){e.hoverOff(),this.dispatchEvent(4,new He({planElementViewModel:e})),this._interaction(),this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?oe("ew-resize"):1===this._state?oe("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?oe("move"):this._hoveredObject?oe("pointer"):3===this._state?oe(_?"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 0 15, auto":"url('https://res.cloudinary.com/roomle/image/upload/v1664957371/pencil_j5vkhm.svg') 3 20, auto"):oe("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(e){this._plannerSelectionHandler.cancelSelection(e)}_dragStart(e){((this._plannerSelectionHandler.isSelected(e.getId())||this._dragIn)&&0===this._state||this._isDrawingEnabled)&&(this.dispatchEvent(8),le(v.DRAG).then(()=>{if(this._inputManager.isMouseUp())return this.setState(0),oe("pointer"),void this.dispatchEvent(12);this._draggedObject=e,this.setState(1),this._roomlePlannerUiCallback.onDragElementStart(),this.dispatchEvent(9,new He({planElementViewModel:e}))}))}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanElement())),n.moveObjectsBy(e,h(a))}else(e instanceof d||e instanceof r||this._planViewModel.cameraType===g.CAMERA_2D)&&(this._plannerSelectionHandler.check(e),t.y=p(e.getPlanElement().getCenter()).y),n.moveElementTo(e.getPlanElement(),h(t));this.dispatchEvent(10,new He({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(11,new He({planElementViewModel:e})),this._dragIn&&this.setDragIn(!1),this._roomlePlannerUiCallback.onDragElementEnd(),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){var t,n;const a=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new He({state:this._state,oldState:a})),this._position=null,2===this._state?null===(t=this.planInteractionHandler)||void 0===t||t.deactivateAllSnappingActivity():2===a&&(null===(n=this.planInteractionHandler)||void 0===n||n.reactivateAllSnappingActivity())}resetState(){this.setState(0)}_move(e){if(3!==this._state&&2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new J(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,s=new ce;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanElement()),s.expandByObject(n.getContainer()))});const r=s.getCenter(new J);this.planInteractionHandler.rotateObjectsBy(i,t,h(r)),this._position.copy(new J(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}async selectPlanElement(e){(e instanceof m||e instanceof u)&&await e.isInitDone(),this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(13,new He({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}enableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!0}disableSnapping(){this.planInteractionHandler.snapObjectsToWalls=!1}enableWallDrawing(){return this._isDrawingEnabled=!0,this._drawingGroup=new he,this._drawingGroup.name="Drawing",this._drawingGroup.add(this._createFloorMeshWithHandler()),this._inputManager.addEventListener(6,this._drawWallOnMouseMove,this),this._inputManager.addEventListener(13,this._endWallDrawing,this),this._drawingGroup}cancelWallDrawing(){return this._isDrawingEnabled=!1,this._setStateAndCursor(0),this._inputManager.removeEventListener(6,this._drawWallOnMouseMove),this._inputManager.removeEventListener(13,this._endWallDrawing),this._raycastHelper.clear(),this._drawingGroup}stopDrawing(e=!0){var t;e&&this.planInteractionHandler.cancelDrawing(),this._raycastHelper.getLayers().enable(9),this._isCurrentlyDrawing=!1,this._setStateAndCursor(0),this.dispatchEvent(7),null===(t=this._continousDrawingHelper)||void 0===t||t.endDrawing()}startDrawing(){var e;this._isCurrentlyDrawing||(this._isCurrentlyDrawing=!0,this._raycastHelper.getLayers().disable(9),this.dispatchEvent(6),this._setStateAndCursor(3),null===(e=this._continousDrawingHelper)||void 0===e||e.update())}_toggleDrawing(e,t,n){this._isCurrentlyDrawing?this._endWallDrawing(e,t):this._startWallDrawing(e,t,n)}_endWallDrawing(e,t){if(this._isCurrentlyDrawing){if(this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle()&&this.planInteractionHandler.getContinuousDrawingManager().shouldShowCircle())this.planInteractionHandler.cancelDrawing();else{const{x:n,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.endDrawing({x:n,y:a,z:0})}this.stopDrawing(!1)}}async _startWallDrawing(e,t,n){(e&&2===e.type||2===n)&&(await this._initMobileDrawing(),this._continousDrawingHelper.update());const{x:a,y:i}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.beginDrawing({x:a,y:i,z:0}),this.startDrawing()}async _initMobileDrawing(){if(this.planInteractionHandler.setDrawingType(0),this.planInteractionHandler.setSnapFeedbackWhileDrawing(!0),!this._continousDrawingHelper){const{default:e}=await t.import("./continuous-drawing-helper-d7691e20.legacy.js");this._continousDrawingHelper=new e,this._continousDrawingHelper.init(this._drawingGroup,this.planInteractionHandler.getContinuousDrawingManager(),this._kernelZoomFactor)}}_drawWallOnMouseMove(e){var t;if(!this._isCurrentlyDrawing)return;const{x:n,y:a}=this._getIntersectionPointWithScene(e);this.planInteractionHandler.currentDrawingPosition({x:n,y:a,z:0}),null===(t=this._continousDrawingHelper)||void 0===t||t.update(),this.dispatchEvent(5)}_createNode(e,t){if(!this._isCurrentlyDrawing)return;const{x:n,y:a}=t||this._getIntersectionPointWithScene(e);this.planInteractionHandler.forceNode({x:n,y:a,z:0}),this._raycastHelper.clear()}_getIntersectionPointWithScene(e){return this._raycastHelper.intersectMouseOnScene(e)}_setStateAndCursor(e){this.setState(e),this._setCursor()}setKernelZoomFactor(e){var t;this._kernelZoomFactor=e,null===(t=this._continousDrawingHelper)||void 0===t||t.setKernelZoomFactor(e)}}l([c],Le.prototype,"_plannerSelectionHandler",void 0),l([c],Le.prototype,"_plannerKernelAccess",void 0),l([c],Le.prototype,"_roomlePlannerUiCallback",void 0);const Ae=(e,t,n,a)=>{const i=(new ce).setFromObject(e.getContainer()).getCenter(new J);return{runtimeId:e.getId(),position2d:w(C(i,t,n,a))}};var ke=function(e){de(n,e);var t=_e(n);function n(){var e;ge(this,n);var a=n.SkyShader,i=new pe({name:"SkyShader",fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:me.clone(a.uniforms),side:ue,depthWrite:!1});return(e=t.call(this,new ve(1,1,1),i)).isSky=!0,e}return we(n)}(re);ke.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new J},up:{value:new J(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\n\t\t}"};const Ve=async(e,t,n)=>{let a=[];const i=[],s=[];await Promise.all(e.map(async e=>{const n=f(e);if(n.catalogItemId?i.push(n.catalogItemId):n.configurationHash&&s.push(n.configurationHash),n.parts){const e=n.configurationHash||n.catalogItemId,a=await t.addUiDataAndPriceToPartList(n.parts,e);n.parts=a}n.data=null,a.push(n)}));const[r,o]=await Promise.all([n.getItems(i),n.getConfigurations(s)]),l=[],c=new Map;for(const e of r)c.set(e.id,e);for(const e of o)c.set(e.id,e),l.push(e.rootComponentId);const h=await n.getComponents(l),d=new Map;for(const e of h)d.set(e.id,e);for(const e of a){const t=e.catalogItemId||e.configurationHash,n=c.get(t)||null;if(n&&!n.label&&d.has(n.rootComponentId)){const e=d.get(n.rootComponentId);n.label=e.label}n&&!n.label&&(n.label=t),e.data=n}return a};class je extends Pe{constructor(e,t,n,a){super(e,t,a),this._staticItemGuard=new b,this._configurableItemGuard=new b,this._planCompletelyLoadedGuard=new b,this.currentSelection=null,this._stopRendering=!0,this._configuratorContext.baseContext="planner",this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new Le(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._roomleRenderer.switchToPlanner(M.Mode3D),this._imageRenderer.switchToPlannerSettings(),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e||3===e?(this._cameraControl.lock(),this._onCameraMove()):(this._cameraControl.unlock(),this._onCameraIdle())},this),this._plannerSceneEventHandler.addEventListener(13,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof u&&this._initData.debug&&e.getGLBUrl(),this._highlightPlanElement(e),this._onSelectionChange(e),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(1,({planElementViewModel:e,reason:t})=>{this._highlightPlanElement(null),this._onSelectionCancel(e),this._roomlePlannerUiCallback.onSelectionCancel(t),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(8,()=>{this._cameraControl.lock()},this),this._plannerSceneEventHandler.addEventListener(9,({planElementViewModel:e})=>{this._getKernelAccess().planInteractionHandler.startInteraction(),e instanceof r&&this._sendWallDimensions(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(10,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(11,async({planElementViewModel:e})=>{const t=this._getKernelAccess().planInteractionHandler;t.endInteraction(),this._cameraControl.unlock();const n=this._getDragPosition(e.getPosition());n&&t.moveElementTo(e.getPlanElement(),h(n)),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!1),this._renderEverything();const a=this.getPlanObject(e.getId());let i;a&&(i=await Ve([a],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.CHANGED,i?i[0]:null)},this),this._plannerSceneEventHandler.addEventListener(12,()=>{this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(6,()=>{this._setKernelZoomFactor(),this._renderWithoutShadowsAndAO()},this),this._plannerSceneEventHandler.addEventListener(5,()=>this._renderWithoutShadowsAndAO(),this),this._plannerSceneEventHandler.addEventListener(7,()=>this._renderWithoutShadowsAndAO(),this),this._getKernelAccess().addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this),this._renderListener=()=>{this._requestRender()},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this.disableConfiguratorEvents(),this.enablePlannerEvents()}planCleared(){}planHistoryStateChanged(){this._sendWallDimensions()}_getViewModel(){return this._viewModel||(this._viewModel=new Se(this._creator_)),this._viewModel}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new J),a=e.distanceTo(n),i=t.getSize(new J),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new J).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){const t={};if(e instanceof u&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof m&&(t.configurationRuntimeId=e.getConfigurationRuntimeId()),e instanceof r){const n=this._cameraControl.getKernelZoomFactor();t.wall=e.getWallDimension(n)}e instanceof o&&(t.staticItemRuntimeId=e.getPlanElement().getId());let n=(e=>{if(e instanceof u){const t=e.getPlanObject().getObjectType();return"door"!==t&&"window"!==t?"static":t}return e instanceof m?"configuration":e instanceof r?"wall":e instanceof o?"floor":"unknown"})(e);const a=(async()=>{const t={};if(e instanceof u&&(t.item=e.getRapiItem(),t.staticItemRuntimeId=e.getPlanElement().getId()),e instanceof m){await e.isInitDone();const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId();let s,r=i;if(r||(r=this._getKernelAccess().kernelInstance.getHashOfConfiguration(a)),this._configuratorContext.planObjectId=a,this._configuratorContext.planElementId=e.getId(),this._configuratorContext.rootComponentId=e.getRootComponentRuntimeId(),i&&V(i)){const e=await this._rapiAccess.getItem(i);t.item=e,s=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(r);t.configuration=e,s=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+r+", saving configuration...");const n=await this._getKernelAccess().getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(n);t.configuration=i,s=i.rootComponentId?i.rootComponentId:null}if(s){const e=await this._rapiAccess.getComponent(s);t.component=e}t.configurationRuntimeId=a,n="configuration"}return t.planElementId=e.getId(),Ce(t)})();this.currentSelection=Ce(t),this._roomlePlannerUiCallback.onSelectionChange(Ce(this._plannerSceneEventHandler.getSelectionMode()),Ce(n),Ce(t),a,e),(e instanceof r||e instanceof d)&&(this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.show()),this._updateNodeSize()),this._renderWithoutShadowsAndAO()}_onSelectionCancel(e){this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide()),this._renderWithoutShadowsAndAO(),this.resetConfiguratorContext(),this.currentSelection=null}resetConfiguratorContext(){this._configuratorContext.planObjectId=0,this._configuratorContext.planElementId=0,this._configuratorContext.rootComponentId=0,this._configuratorContext.dockingRootComponentId=0}_setupScene(e,t){super._setupScene(e,t,!0),this._initData.legacyLight&&(this._lightSetting=new Ie(this._scene,this._lightSetting)),this._initData.moc||this._addSky(),this._setEnvironment(new U(this._scene,this._environment,new Y(this._initData.colors.DEFAULT_BACKGROUND)))}onBeforeRender(){this._cameraControl instanceof N&&P(this._cameraControl.getCamera(),this._getViewModel().getWallPlanObjectViewModels())&&this._roomleRenderer.forceShadowUpdates(!0)}_getInputManager(){return this._plannerInputManager}createCameraControl(e,t){this.setMode(e)}startViewing(){this._configuratorContext.baseContext="glb-viewer";const e=this._plannerSceneEventHandler.getSelectedIds();if(1===e.length){const t=this._getViewModel().getPlanObjectForId(e[0]);this._cameraControl instanceof N&&this._cameraControl.setObjectRotation(t.getPlanElement().rotation),this._getViewModel().hideAllExcept(t.getId())}this.resetCamera(),this.disablePlannerEvents(),this.updateEnvironment(this.getBounds(),!0)}startConfiguring(){var e;this._configuratorContext.baseContext="configurator";const{planElementId:t}=this._configuratorContext,n=this._getViewModel().getPlanObjectForId(t);n&&(this.setRootComponentId(n.getRootComponentRuntimeId()),this._cameraControl instanceof N&&this._cameraControl.setObjectRotation(n.getPlanElement().rotation));const a=null==n?void 0:n.getConfigurationRuntimeId();this._configuratorContext.planObjectId!==a&&(this._configuratorContext.planObjectId=a),this._getViewModel().hideAllExcept(t),this.resetCamera(),this.disablePlannerEvents(),this.enableConfiguratorEvents(),this._roomleRenderer.switchToConfigurator(),this._imageRenderer.switchToConfiguratorSettings(),this.updateScene(),this._getKernelAccess().updatePlanObjectDependencies(a),this._getKernelAccess().requestPartListAndUpdatePricesOfParts(),this._getKernelAccess().planObjectUpdated(a),this.updateEnvironment(this.getBounds(),!0);const i=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==i||i.startInteraction()}async selectPlanObject(e){if(this._plannerSceneEventHandler.getSelectedIds().includes(e))return;const t=this._getViewModel().getPlanObjectForId(e);await this._plannerSceneEventHandler.selectPlanElement(t),this._onSelectionChange(t)}backToPlanner(){var e;if(this._getViewModel().showAll(),"configurator"===this._configuratorContext.baseContext){const t=null===(e=this._plannerKernelAccess)||void 0===e?void 0:e.planInteractionHandler;null==t||t.endInteraction()}this._configuratorContext.baseContext="planner",this._cameraControl instanceof N&&this._cameraControl.setObjectRotation(0),this.resetCamera(),this.enablePlannerEvents(),this.disableConfiguratorEvents(),this._roomleRenderer.switchToPlanner(this._cameraControl instanceof N?M.Mode3D:M.Mode2D),this._imageRenderer.switchToPlannerSettings(),this.updateScene()}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}_getYRotationOfObject(e){let t=e.getWorldDirection(new J).clone();t.y=0,t.lengthSq()<.01&&(t=new J(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._getViewModel().getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._getKernelAccess().catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=S(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){this._stopRendering=!1,this._renderEverything(),this.resetCamera(),setTimeout(()=>this._planCompletelyLoadedGuard.resolve(),0),this._getViewModel().getNodePlanObjectViewModels().forEach(e=>e.hide())}handlerSwitchedPlans(e,t){if(this._roomlePlannerUiCallback.onHandlerSwitchedPlans(),this._getViewModel().setReference(t),this._getKernelAccess().coupleReferences(this._getViewModel(),t),this._getViewModel().setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._getViewModel().setGeometriesMergedListener(()=>{this._renderEverything()}),this._plannerSceneEventHandler.setPlanViewModel(this._getViewModel()),e&&this.clearScene(),!this._initData.moc){this._addSky();let e=new ie(1e3,1e3);e.rotateX(-Math.PI/2);let t=y.createMeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0,depthWrite:!1}),n=new re(e,t);n.name="Ground",n.position.y=-.01,n.userData.isFloor=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),this._planCompletelyLoadedGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait(),this._planCompletelyLoadedGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){var e;const t=this._getViewModel().getCorePlan();if(this._roomleRenderer){const n=S(t.getBounds());null===(e=this._roomleRenderer)||void 0===e||e.updateBounds(n)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this.updateEnvironment(this.getBounds(),!0),this._renderEverything()}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{var e;this._scene.add(this._getViewModel().getConstructionGroup()),this._scene.add(this._getViewModel().getCeilingGroup()),this._scene.add(this._getViewModel().getFloorGroup()),(null===(e=this._lightSetting)||void 0===e?void 0:e.needsBounds())&&this._lightSetting.updateBounds(this._getViewModel().getBoundingBox()),this._scene.remove(this._preloadScene)}}async addPlanObjectToScene(e){if(e){const t=e.getContainer();I(t),this._scene.add(t),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender()),this._roomlePlannerUiCallback.onPlanChanged(),await e.isInitDone(),this._zoomToBounds(!1,!1),this.updateEnvironment(this.getBounds()),this._renderEverything();const n=this.getPlanObject(e.getId());let a;n&&(a=await Ve([n],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.ADDED,a?a[0]:null)}}removePlanObjectFromScene(e){(e instanceof r||e instanceof d)&&this._sendWallDimensions(),this._scene.remove(e.getContainer()),e.clear(),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds(!0),this._renderEverything()}async planElementChanged(e,t){if(this._drawingEnabled&&this._sendWallDimensions(!1),this.updateEnvironment(this.getBounds(),!0),this._renderEverything(),this._onPlanChanged(),!this._plannerSceneEventHandler.isDragIn()){const e=this.getPlanObject(t.getId());let n;e&&(n=await Ve([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.CHANGED,n?n[0]:null)}}exportGLB(e,t){}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._getViewModel().sceneCleared(),super.clearScene()}_addSky(){if(!this._sky){this._sky=new ke,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._sky.frustumCulled=!1,this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=D(4e5,0,.6);this._sky.material.uniforms.sunPosition.value.copy(e);let t=new re(new fe(2e4,16,8),new se({color:16777215}));t.name="Sunsphere",t.position.y=-7e5,t.visible=!1,t.position.set(e.x,-e.z,e.y)}this._lightSetting instanceof Ie&&this._lightSetting.updateSunPosition(.6,0)}switchTo2D(){var e;if(this._onCameraMove(),!(this._cameraControl instanceof Z)){for(const e of this._getViewModel().getWallPlanObjectViewModels())e.show();this._getViewModel().setCameraType(g.CAMERA_2D),null===(e=this._roomleRenderer)||void 0===e||e.switchToPlanner(M.Mode2D),this._renderEverything(),this._changeCameraControl(new Z(this._creator_,this._getInputManager(),null,this.getOrthographicOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(g.CAMERA_2D),this._setCameraControlListeners(),this._setKernelZoomFactor(),this._onCameraMove()}}switchTo3D(){var e;this._onCameraMove(),this._cameraControl instanceof N||(this._getViewModel().setCameraType(g.CAMERA_3D),null===(e=this._roomleRenderer)||void 0===e||e.switchToPlanner(M.Mode3D),this._renderEverything(),this._changeCameraControl(new N(this._creator_,this._getInputManager(),new J(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(g.CAMERA_3D),this._setCameraControlListeners())}_setCameraControlListeners(){this._cameraControl.addEventListener(8,()=>{this._onCameraIdle()},this),this._cameraControl.addEventListener(1,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(3,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(4,()=>{this._onCameraMove()},this),this._cameraControl.addEventListener(5,()=>{this._onCameraZoomChange()},this)}_onCameraZoomChange(){this._setKernelZoomFactor()}_setKernelZoomFactor(){var e,t;const n=this._cameraControl.getKernelZoomFactor();null===(e=this._getKernelAccess().planInteractionHandler)||void 0===e||e.setZoomFactor(n),null===(t=this._plannerSceneEventHandler)||void 0===t||t.setKernelZoomFactor(n)}_setCeiling(){this._getViewModel()&&(this._cameraControl instanceof q?this._getViewModel().getCeilingGroup().visible=!0:this._getViewModel().getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof N&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof q)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>O(e.material,!1,!1)),this._getViewModel().setCameraType(g.CAMERA_FP),this._renderEverything();let e=new J(0,0,0);this._getViewModel()&&(e=this._getViewModel().getBoundingBox().getCenter(new J)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new q(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged(g.CAMERA_FP),this._setCameraControlListeners()}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof N&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof N&&(this._cameraControl.disablePanning(),e.preventDefault()),!e.key||"Escape"!==e.key&&"Esc"!==e.key||this._drawingEnabled&&(this.escapeDrawing(),this._roomlePlannerUiCallback.onDrawCancel())}setMode(e){switch(e){case g.CAMERA_2D:this.switchTo2D();break;case g.CAMERA_3D:this.switchTo3D();break;case g.CAMERA_FP:this.switchToFirstPerson()}}_highlightPlanElement(e){var t;let n=new Set;e instanceof H&&this._cameraControl instanceof Z&&e&&e.getTopViewContainer()?n.add(e.getTopViewContainer()):e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>n.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const t=this._getViewModel().getPlanObjectForId(e);t instanceof H&&this._cameraControl instanceof Z&&t&&t.getTopViewContainer()?n.add(t.getTopViewContainer()):t&&t.getObject()&&t.getObject().children&&t.getObject().children.forEach(e=>n.add(e))}),null===(t=this._roomleRenderer)||void 0===t||t.highlightObjects(Array.from(n))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._getViewModel().removeGeometriesMergedListener()}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._getViewModel().constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&("planner"===this._configuratorContext.baseContext&&this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){e||(e=this.getBounds()),e&&(this._cameraControl instanceof N&&this._cameraControl.updateToBounds(e,!1),this._cameraControl instanceof Z&&this._cameraControl.zoomToFitBounds(L(e,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight,1.1),!0),this._renderEverything())}_zoomToBounds(e,t=!0){const n=this.getBounds();this._cameraControl instanceof N&&(this._getViewModel().getPlanObjectCount()<=1?this._cameraControl.zoomToFitBounds(n,t):this._cameraControl.checkBoundsAndPlaceCamera(n,t)),this._cameraControl instanceof Z&&!this._drawingEnabled&&this._cameraControl.zoomToFitBounds(n,e,t)}updateCameraOnDrawWalls(){const e=this.getBounds();this._cameraControl instanceof Z&&this._cameraControl.zoomToFitBounds(e,!1,!0),this._cameraControl instanceof N&&this._cameraControl.zoomToFitBounds(e,!0)}getBounds(){return this._getViewModel()?this._getViewModel().getBoundingBox():null}getPlanObject(e){const t=this._getKernelAccess().planInteractionHandler,n=this._plannerKernelAccess.planModelViewHelper,a=t.getPlan();return n.getPlanObject(a,e)}cancelPlanElementSelection(e){this._plannerSceneEventHandler.cancelSelection(e),this._highlightPlanElement(null),this._requestRender()}async deletePlanElementSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelPlanElementSelection("delete_object"),await this.deletePlanElementByIds(e)}async deletePlanElementByIds(e){for(const t of e){const e=this._getViewModel().getPlanObjectForId(t);if(e&&e.getObject()){const t=this.getPlanObject(e.getId());let n;t&&(n=await Ve([t],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.REMOVED,n?n[0]:null),this._getKernelAccess().planInteractionHandler.removeElement(e.getKernelObject())}}}rotatePlanElementSelection(e){const t=new(this._getKernelAccess().kernelContainer.PlanObjectPtrList),n=new ce;let a={x:0,y:0,z:0};if(this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const i=this._getViewModel().getPlanObjectForId(e);i&&i.getObject()&&(a=i.getPlanElement().getCenter(),t.push_back(i.getPlanElement()),n.expandByObject(i.getContainer()))}),t.size()>1){const e=n.getCenter(new J);a=h(e)}const i=this._getKernelAccess().planInteractionHandler.groupObjects(t);this._getKernelAccess().planInteractionHandler.rotateGroupBy(i,e,a)}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender()}planElementRemoved(e){this._onPlanChanged(),this._renderEverything()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{var n,a;let i=this._calculateBoundingBoxOfAllMeshes(.1);null===(n=this._lightSetting)||void 0===n||n.removeFromScene(),this._cameraControl instanceof N&&this._getViewModel().setCameraType(g.CAMERA_2D);let s=await this._imageRenderer.prepareTopImage(this._scene,null,i,e);this._cameraControl instanceof N&&this._getViewModel().setCameraType(g.CAMERA_3D),null===(a=this._lightSetting)||void 0===a||a.addToScene(),this._requestRender(),t(s)})})}preparePerspectiveImage(e={}){return"configurator"===this._configuratorContext.baseContext?super.preparePerspectiveImage(e):new Promise((t,n)=>{this._getViewModel().materialQueue.finished(!0).then(async()=>{var n,a;let i;this._cameraControl instanceof N?i=this._cameraControl.getCamera().clone():(i=this.getPerspectiveOffsetCamera(),this._getViewModel().setCameraType(g.CAMERA_3D)),i.resetOffset();let s=this._calculateBoundingBoxOfAllMeshes();null===(n=this._lightSetting)||void 0===n||n.removeFromScene();const r=await this._imageRenderer.preparePerspectiveImage(this._scene,null,i,s,e);this._cameraControl instanceof Z&&this._getViewModel().setCameraType(g.CAMERA_2D),null===(a=this._lightSetting)||void 0===a||a.addToScene(),this._requestRender(),t(r)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return A.getCameraTargetForBBox(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}enableSnapping(){this._plannerSceneEventHandler.enableSnapping()}disableSnapping(){this._plannerSceneEventHandler.disableSnapping()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}disablePlannerEvents(){this._plannerSceneEventHandler.disable()}enablePlannerEvents(){this._plannerSceneEventHandler.enable()}_onCameraIdle(){return super._onCameraIdle()&&(this._sendWallDimensions(),this._sendPlanObjectPositions(),this._roomlePlannerUiCallback.onCameraIdle()),!0}_onCameraMove(){return super._onCameraMove()&&(this._roomlePlannerUiCallback.disableWallDimensions(),this._roomlePlannerUiCallback.cameraStartsMoving()),this._updateNodeSize(),!0}_updateNodeSize(){if(this._cameraControl instanceof Z){const e=1/this._cameraControl.getCamera().zoom;this._getViewModel().setNodeZoom(e)}}_sendPlanObjectPositions(){if(this._cameraControl.isLocked())return;const{clientWidth:e,clientHeight:t}=this._domHelper.element,n=this._cameraControl.getCamera(),a=[],i={staticPlanObjectViewModels:this._getViewModel().getStaticPlanObjectViewModels(),configurablePlanObjectViewModels:this._getViewModel().getConfigurablePlanObjectViewModels(),constructionPlanObjectViewModels:this._getViewModel().getConstructionPlanObjectViewModels(),wallPlanObjectViewModels:this._getViewModel().getWallPlanObjectViewModels(),floorPlanObjectViewModels:this._getViewModel().getFloorPlanObjectViewModels(),nodePlanObjectViewModels:this._getViewModel().getNodePlanObjectViewModels()};for(const s of Object.values(i))for(const i of s)a.push(Ae(i,n,e,t));this._roomlePlannerUiCallback.onUpdatePlanObjectPositions(a)}_sendWallDimensions(e=!0){if(this._cameraControl.isLocked()&&e)return;const t=[],{clientWidth:n,clientHeight:a}=this._domHelper.element,i=this._getViewModel().getWallPlanObjectViewModels(),s=this._cameraControl.getKernelZoomFactor();for(const e of i){const i=e.getWallDimension(s);if(i.length>0){const e=this._cameraControl.getCamera();i.fromPosition2d=C(i.fromPosition3d,e,n,a),i.toPosition2d=C(i.toPosition3d,e,n,a),i.fromWithoutPadding=C(i.fromWithoutPadding,e,n,a),i.toWithoutPadding=C(i.toWithoutPadding,e,n,a),i.textPosition2d=C(i.textPosition3d,e,n,a),i.lengthFormatted=this._unitFormatter.formatMMValueToUnitString(i.length),t.push(k(i))}if(this._initData.debug){const e=new fe(.1,32,16),t=new se({color:16711680}),n=new re(e,t);n.position.copy(i.fromPosition3d);const a=new re(e,t);a.position.copy(i.toPosition3d);const s=new re(e,new se({color:65280}));s.position.copy(i.textPosition3d),this._scene.add(n),this._scene.add(a),this._scene.add(s)}}this._roomlePlannerUiCallback.onUpdateWallDimensions(t)}enableWallDrawing(){if(this._cameraControl instanceof Z){const e=L(this.getBounds(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight);this._cameraControl.zoomToFitBounds(e,!0)}this._drawingEnabled||(this._drawingEnabled=!0,this._scene.add(this._plannerSceneEventHandler.enableWallDrawing()))}disableWallDrawing(){this._drawingEnabled=!1,this._cameraControl.unlock(),this._scene.remove(this._plannerSceneEventHandler.cancelWallDrawing())}escapeDrawing(){this._plannerSceneEventHandler.stopDrawing()}_changeCameraControl(e){super._changeCameraControl(e)}setSceneEvents(e){var t,n;void 0!==e.construction&&(null===(t=this._plannerSceneEventHandler)||void 0===t||t.enableConstructionEvents(e.construction)),void 0!==e.objects&&(null===(n=this._plannerSceneEventHandler)||void 0===n||n.enableObjectEvents(e.objects))}startedDrawing(){this._plannerSceneEventHandler.startDrawing()}stoppedDrawing(){this._plannerSceneEventHandler.stopDrawing()}disableEvents(){super.disableEvents(),this.disablePlannerEvents()}enableEvents(){super.enableEvents(),"planner"===this._configuratorContext.baseContext&&this.enablePlannerEvents()}resetCameraPositionToStart(e=!0){this._cameraControl instanceof N&&super.resetCameraPositionToStart(e),this._cameraControl instanceof Z&&this._updateCamera()}async moveCamera(e){return this._cameraControl instanceof N?super.moveCamera(e):Promise.reject("Camera can only be moved in 3D")}_setInteriorOrExteriorWallMaterial(e,t){const n=this._getViewModel().getWallPlanObjectViewModels();if(!n.length)return;const a=this._getKernelAccess().planInteractionHandler,i=e=>{a.setWallLeftMaterial(e,be(e.leftMaterial,t))},s=e=>{a.setWallRightMaterial(e,be(e.rightMaterial,t))},r=n.map(e=>e.getKernelObject()),o=this._plannerKernelAccess.kernelContainer.WallType.InnerWall,l=this._plannerKernelAccess.kernelContainer.WallType.OuterWallLeft,c=this._plannerKernelAccess.kernelContainer.WallType.OuterWallRight;for(const t of r)t.wallType===o&&"interior"===e&&(i(t),s(t)),t.wallType===l&&("interior"===e?s(t):i(t)),t.wallType===c&&("exterior"===e?s(t):i(t))}changeInteriorWallsMaterial(e){this._setInteriorOrExteriorWallMaterial("interior",e)}changeExteriorWallsMaterial(e){this._setInteriorOrExteriorWallMaterial("exterior",e)}changeFloorsMaterial(e){const t=this._getViewModel().getFloorPlanObjectViewModels();if(!t.length)return;const n=this._getKernelAccess().planInteractionHandler,a=t.map(e=>e.getKernelObject());for(const t of a)n.setFloorMaterial(t,be(t.material,e))}getWallAngleDegrees(e){if(!(e instanceof r))return 0;const t=this._cameraControl.getCamera(),n=new ee(t.position.x,t.position.z),a=new ee(e.getPosition().x,e.getPosition().z).clone().sub(n).normalize(),i=e.getKernelObject(),s=new ee(Math.sin(i.getAngle()),Math.cos(i.getAngle())),o=a.angle()-s.angle();return Me.radToDeg(o)}moveElementPosition(e,t){const n=this._getKernelAccess().planInteractionHandler;n.setObjectFixedZ(e.getPlanElement(),!0),n.moveElementTo(e.getPlanElement(),t),this._sendPlanObjectPositions()}}l([c],je.prototype,"_rapiAccess",void 0),l([c],je.prototype,"_plannerMeshGenerator",void 0),l([c],je.prototype,"_plannerInputManager",void 0),l([c],je.prototype,"_roomlePlannerUiCallback",void 0),l([c],je.prototype,"_localStorageHelper",void 0),l([c],je.prototype,"_unitFormatter",void 0);const xe={left:0,top:1,right:1,bottom:0};class Te{constructor(e){this._hscInstance=null,this._glbInstance=null,this._configurator=null,this._currentMode=1,this._creator_=e,this._kernelAccessCallback.addListener(this)}deleteSelection(){this._sceneManager.deletePlanElementSelection()}rotateSelection(e){this._sceneManager.rotatePlanElementSelection(e)}cancelSelection(e="unknown"){this._sceneManager.cancelPlanElementSelection(e)}init(e,t,n){return j.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(n=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&(t.id?this._rapiAccess.trackView(t.id):this._rapiAccess.trackView("planXML")),n()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{const a=x(e);(a?this._rapiAccess.getPlanSnapshot(e):this._rapiAccess.getPlan(e)).then(n=>{const i=a?n.plan:n.planObjects;this._plan=this._planInteractionHandler.loadPlanXML(i),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._currentMode=1,this._initData.moc&&this._rapiAccess.trackView(e),t(n)},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){Promise.all([this._scriptLoader.fetch(X,{id:"tween-js"})]).then(()=>{this._kernelReadyCallback=e;const{dls:t,ls:n,mode:a,stats:i}=this._initData;this._sceneManager||(this._sceneManager=new je(this._creator_,xe,this,a)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId);const s=T.createDynamicLightSettingSource(t,n);i&&this.showStats(),this._sceneManager.enableHD(s),this._planInteractionHandler&&this._kernelReadyCallback()})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){j.showBenchmarks()}getConfiguratorApi(){return this._configurator||(this._configurator=new ye(this._creator_),this._configurator.setOverrides(this._initData),this._configurator.initSceneManager(this._sceneManager)),this._configurator}startViewing(){this._sceneManager.startViewing()}startConfiguring(){var e,t;this._sceneManager.startConfiguring();const n=this._sceneManager.currentSelection,a=(null===(e=n.item)||void 0===e?void 0:e.id)||(null===(t=n.configuration)||void 0===t?void 0:t.id);a&&this._configurator.notifyUiAboutNewLabel(a)}async selectPlanObjectById(e){return this._sceneManager.selectPlanObject(e)}backToPlanner(){this._sceneManager.backToPlanner()}showGUI(){this._sceneManager.showGUI()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-2316b444.legacy.js").then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().initSceneManager(this._sceneManager),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._currentMode=0,this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-20b26df0.legacy.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._currentMode=2,this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._currentMode=1}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(2===this._currentMode&&this._glbInstance&&this._glbInstance.getApi().clearScene(),0===this._currentMode&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._currentMode=1}backTo(e){console.error("backTo in planner Needs to be implemented later")}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");t&&(t=h(new J(t.x,t.y,t.z)));const a=await(V(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>V(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);return await this._plannerKernelAccess.insertItems(n)}async insertItems(e){return await this._plannerKernelAccess.insertItems(e)}duplicateItems(e){return this._plannerKernelAccess.duplicateItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan),t=f(e.objects);return Ve(t,this._plannerKernelAccess,this._rapiAccess)}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return f(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}enableMultiselect(){this._sceneManager.getPlannerSceneEventHandler().setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e),a=await this.insertItems([n]);if(1!==a.length)throw new Error("More than one object added, abort");return a[0]}enableSnapping(){this._sceneManager.enableSnapping()}disableSnapping(){this._sceneManager.disableSnapping()}async getPartlistOf(e){const t=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(e);if(!t){const e="Object has no partlist because it is not a configuration: "+t;return console.warn(e),Promise.reject(e)}const n=this._plannerKernelAccess.kernelInstance.getPartList(e);return await this._plannerKernelAccess.addUiDataAndPriceToPartList(n,t)}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}drawWalls(e,t={}){var n,a;const i=this._planInteractionHandler;i.startInteraction();const s=[];for(const t of e){const e=i.addNode(t.from),r=i.addNode(t.to),o=i.addWall(e,r);void 0!==(null===(n=t.props)||void 0===n?void 0:n.height)&&i.setWallHeight(o,t.props.height),void 0!==(null===(a=t.props)||void 0===a?void 0:a.thickness)&&i.setWallThickness(o,t.props.thickness),s.push(o)}return t.keepInteractionOpen||i.endInteraction(),this._sceneManager.updateCameraOnDrawWalls(),this._sceneManager.updateScene(),s}async removeElements(e,t={}){this._sceneManager.lockCamera();const n=this._planInteractionHandler;for(const t of e){const e=this._sceneManager.getPlanObject(t.getId());let n;e&&(n=await Ve([e],this._plannerKernelAccess,this._rapiAccess)),this._roomlePlannerUiCallback.onPlanElementChanged(E.REMOVED,n?n[0]:null),this._planInteractionHandler.removeElement(t)}t.keepInteractionOpen||n.endInteraction(),this._sceneManager.unlockCamera()}hasWalls(){const e=this._planInteractionHandler,t=null==e?void 0:e.getPlan();return!(!t||t.getWallCount()<1)}enableWallDrawing(){this._sceneManager.enableWallDrawing()}disableWallDrawing(){this._sceneManager.disableWallDrawing()}getUnitFormatter(){return this._unitFormatter}get PlannerCoreTypes(){return this._plannerKernelAccess.kernelContainer}setSceneEvents(e){this._sceneManager.setSceneEvents(e)}async saveCurrentPlanSnapshot(e){const t=await this.getPlanModelViewHelper(),n=this._planInteractionHandler.getPlan(),a=t.getPlanOverview(n),i={parentId:e||null,planObjects:[],combinedIds:[],plan:n.getPlanXML(!1,2)},s=a.objects,r=s.size();for(let e=0;e<r;e++){const t=s.get(e),n=t.configurationHash||t.catalogItemId,{center:a,dimensions:r,rotation:o}=t,l=JSON.stringify({center:a,dimensions:r,rotation:o});i.planObjects.push({combinedId:n,location:l})}const o=await this._rapiAccess.savePlanSnapshot(i),l=new Promise((e,t)=>{Promise.allSettled([this.preparePerspectiveImage(),this.prepareTopImage()]).then(async([n,a])=>{if("rejected"!==n.status&&"rejected"!==a.status)try{const t=await this._rapiAccess.savePlanSnapshotPerspectiveImage(o,n.value),i=await this._rapiAccess.savePlanSnapshotTopImage(o,a.value);e({...t,...i})}catch(e){t(e)}else t("Could not generate images of plan snapshot")})});try{return await l}catch(e){return console.error(e),o}}getPlanXmlFrom(e){return e?x(e.id)?e.plan:e.planObjects:null}async moveCamera(e){return this._sceneManager.moveCamera(e)}async createNewSerializedConfiguration(e){return Promise.resolve(this._plannerKernelAccess.createNewSerializedConfiguration(e))}changeInteriorWallsMaterial(e){this._sceneManager.changeInteriorWallsMaterial(e)}changeExteriorWallsMaterial(e){this._sceneManager.changeExteriorWallsMaterial(e)}changeFloorsMaterial(e){this._sceneManager.changeFloorsMaterial(e)}getWallAngleDegrees(e){return this._sceneManager.getWallAngleDegrees(e)}calcPartsPriceSum(e){return this._plannerKernelAccess.calcPartsPriceSum(e)}async swapObject(e,t){const n=e.getPosition(),a=e.getRotation();return await this._sceneManager.deletePlanElementByIds([e.getPlanElement().getId()]),this.cancelSelection("swap_object"),await this.insertObject(t,n,a)}exportImageFromCamera(e="image"){this._sceneManager.exportImageFromCamera(e)}moveElementPosition(e,t){this._sceneManager.moveElementPosition(e,t)}async generateProductionServiceExport(e,t=""){try{return Promise.resolve(JSON.parse(this._plannerKernelAccess.kernelInstance.generateProductionServiceExport(e,t)))}catch(e){return console.error(e),Promise.reject("Could not create Blue Ocean MVP JSON")}}}l([c],Te.prototype,"_configuratorContext",void 0),l([c],Te.prototype,"_domHelper",void 0),l([c],Te.prototype,"_scriptLoader",void 0),l([c],Te.prototype,"_kernelAccessCallback",void 0),l([c],Te.prototype,"_plannerKernelAccess",void 0),l([c],Te.prototype,"_rapiAccess",void 0),l([c],Te.prototype,"_singlePromiseFactory",void 0),l([c],Te.prototype,"_roomlePlannerUiCallback",void 0),l([c],Te.prototype,"_lifeCycleManager",void 0),l([c],Te.prototype,"_dataSyncer",void 0),l([c],Te.prototype,"_initData",void 0),l([c],Te.prototype,"_globalInitData",void 0),l([c],Te.prototype,"_unitFormatter",void 0);const Re=[new W("script-loader",n),new W("planner-input-manager",class extends R{_canDrag(e){return!0}},1),new W("logger",B),new W("planner-mesh-generator",F),new W("rapi-access",K),new W("planner-selection-handler",class extends s{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(e){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((t,n)=>{this._selectedPlanElementViewModels.delete(n),t.deselect(),this.dispatchEvent(1,new Oe({planElementViewModel:t,reason:e}))})}_checkStandard(e){this._selectedPlanElementViewModels.has(e.getId())||(this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new Oe({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),e.select(),this.dispatchEvent(0,new Oe({planElementViewModel:e})))}_checkMulti(e){if(!De(e)&&!this._selectedPlanElementViewModels.has(e.getId())){this._selectedPlanElementViewModels.set(e.getId(),e),e.select();const t=Array.from(this._selectedPlanElementViewModels).map(([e,t])=>t);this.dispatchEvent(2,new Oe({planElementViewModels:t})),this.dispatchEvent(0,new Oe({planElementViewModel:e}))}}_deselectWallAndFloorElements(){this._selectedPlanElementViewModels.forEach((e,t)=>{De(e)&&(this._selectedPlanElementViewModels.delete(t),e.deselect(),this.dispatchEvent(1,new Oe({planElementViewModel:e})))})}setSelectionMode(e){"multiselect"===e&&this._deselectWallAndFloorElements(),this._selectionMode=e,this.dispatchEvent(15,new Oe({selectionMode:e}))}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends a{setupGlobals(){}setupDependencies(){z.setup(Re),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context).init(0)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new Te(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
2
+ //# sourceMappingURL=planner-da20e5b5.legacy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-a0ef7d31.legacy.js","sources":["../../../node_modules/three/examples/jsm/objects/Sky.js"],"sourcesContent":["import {\n\tBackSide,\n\tBoxGeometry,\n\tMesh,\n\tShaderMaterial,\n\tUniformsUtils,\n\tVector3\n} from 'three';\n\n/**\n * Based on \"A Practical Analytic Model for Daylight\"\n * aka The Preetham Model, the de facto standard analytic skydome model\n * https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight\n *\n * First implemented by Simon Wallner\n * http://simonwallner.at/project/atmospheric-scattering/\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nclass Sky extends Mesh {\n\n\tconstructor() {\n\n\t\tconst shader = Sky.SkyShader;\n\n\t\tconst material = new ShaderMaterial( {\n\t\t\tname: 'SkyShader',\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tuniforms: UniformsUtils.clone( shader.uniforms ),\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false\n\t\t} );\n\n\t\tsuper( new BoxGeometry( 1, 1, 1 ), material );\n\n\t\tthis.isSky = true;\n\n\t}\n\n}\n\nSky.SkyShader = {\n\n\tuniforms: {\n\t\t'turbidity': { value: 2 },\n\t\t'rayleigh': { value: 1 },\n\t\t'mieCoefficient': { value: 0.005 },\n\t\t'mieDirectionalG': { value: 0.8 },\n\t\t'sunPosition': { value: new Vector3() },\n\t\t'up': { value: new Vector3( 0, 1, 0 ) }\n\t},\n\n\tvertexShader: /* glsl */`\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}`,\n\n\tfragmentShader: /* glsl */`\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\n\t\t}`\n\n};\n\nexport { Sky };\n"],"names":["Sky","_Mesh","_inherits","_super","_createSuper","_this","_classCallCheck","shader","SkyShader","material","ShaderMaterial","name","fragmentShader","vertexShader","uniforms","UniformsUtils","clone","side","BackSide","depthWrite","call","BoxGeometry","isSky","_createClass","Mesh","turbidity","value","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","Vector3","up"],"mappings":"uvhBASA,IAcMA,YAAGC,GAAAC,GAAAF,EAAAC,GAAA,IAAAE,EAAAC,GAAAJ,GAER,SAAAA,IAAc,IAAAK,EAAAC,QAAAN,GAEb,IAAMO,EAASP,EAAIQ,UAEbC,EAAW,IAAIC,GAAgB,CACpCC,KAAM,YACNC,eAAgBL,EAAOK,eACvBC,aAAcN,EAAOM,aACrBC,SAAUC,GAAcC,MAAOT,EAAOO,UACtCG,KAAMC,GACNC,YAAY,IAKK,OAFlBd,EAAAF,EAAAiB,UAAO,IAAIC,GAAa,EAAG,EAAG,GAAKZ,IAE9Ba,OAAQ,EAAKjB,EAElB,OAAAkB,GAAAvB,IAnBgBwB,IAuBlBxB,GAAIQ,UAAY,CAEfM,SAAU,CACTW,UAAa,CAAEC,MAAO,GACtBC,SAAY,CAAED,MAAO,GACrBE,eAAkB,CAAEF,MAAO,MAC3BG,gBAAmB,CAAEH,MAAO,IAC5BI,YAAe,CAAEJ,MAAO,IAAIK,GAC5BC,GAAM,CAAEN,MAAO,IAAIK,EAAS,EAAG,EAAG,KAGnClB,aAsEG,6gFAEHD,eAAgB"}
1
+ {"version":3,"file":"planner-da20e5b5.legacy.js","sources":["../../../node_modules/three/examples/jsm/objects/Sky.js"],"sourcesContent":["import {\n\tBackSide,\n\tBoxGeometry,\n\tMesh,\n\tShaderMaterial,\n\tUniformsUtils,\n\tVector3\n} from 'three';\n\n/**\n * Based on \"A Practical Analytic Model for Daylight\"\n * aka The Preetham Model, the de facto standard analytic skydome model\n * https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight\n *\n * First implemented by Simon Wallner\n * http://simonwallner.at/project/atmospheric-scattering/\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nclass Sky extends Mesh {\n\n\tconstructor() {\n\n\t\tconst shader = Sky.SkyShader;\n\n\t\tconst material = new ShaderMaterial( {\n\t\t\tname: 'SkyShader',\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tuniforms: UniformsUtils.clone( shader.uniforms ),\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false\n\t\t} );\n\n\t\tsuper( new BoxGeometry( 1, 1, 1 ), material );\n\n\t\tthis.isSky = true;\n\n\t}\n\n}\n\nSky.SkyShader = {\n\n\tuniforms: {\n\t\t'turbidity': { value: 2 },\n\t\t'rayleigh': { value: 1 },\n\t\t'mieCoefficient': { value: 0.005 },\n\t\t'mieDirectionalG': { value: 0.8 },\n\t\t'sunPosition': { value: new Vector3() },\n\t\t'up': { value: new Vector3( 0, 1, 0 ) }\n\t},\n\n\tvertexShader: /* glsl */`\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}`,\n\n\tfragmentShader: /* glsl */`\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\n\t\t}`\n\n};\n\nexport { Sky };\n"],"names":["Sky","_Mesh","_inherits","_super","_createSuper","_this","_classCallCheck","shader","SkyShader","material","ShaderMaterial","name","fragmentShader","vertexShader","uniforms","UniformsUtils","clone","side","BackSide","depthWrite","call","BoxGeometry","isSky","_createClass","Mesh","turbidity","value","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","Vector3","up"],"mappings":"uvhBASA,IAcMA,YAAGC,GAAAC,GAAAF,EAAAC,GAAA,IAAAE,EAAAC,GAAAJ,GAER,SAAAA,IAAc,IAAAK,EAAAC,QAAAN,GAEb,IAAMO,EAASP,EAAIQ,UAEbC,EAAW,IAAIC,GAAgB,CACpCC,KAAM,YACNC,eAAgBL,EAAOK,eACvBC,aAAcN,EAAOM,aACrBC,SAAUC,GAAcC,MAAOT,EAAOO,UACtCG,KAAMC,GACNC,YAAY,IAKK,OAFlBd,EAAAF,EAAAiB,UAAO,IAAIC,GAAa,EAAG,EAAG,GAAKZ,IAE9Ba,OAAQ,EAAKjB,EAElB,OAAAkB,GAAAvB,IAnBgBwB,IAuBlBxB,GAAIQ,UAAY,CAEfM,SAAU,CACTW,UAAa,CAAEC,MAAO,GACtBC,SAAY,CAAED,MAAO,GACrBE,eAAkB,CAAEF,MAAO,MAC3BG,gBAAmB,CAAEH,MAAO,IAC5BI,YAAe,CAAEJ,MAAO,IAAIK,GAC5BC,GAAM,CAAEN,MAAO,IAAIK,EAAS,EAAG,EAAG,KAGnClB,aAsEG,6gFAEHD,eAAgB"}
@@ -1,2 +1,2 @@
1
- System.register(["./planner-a0ef7d31.legacy.js","./script-loader-35fe01aa.legacy.js","./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./scene-manager-079c4752.legacy.js","./roomle-configurator-7dc323ca.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(){var e;return{setters:[function(n){e=n.Planner},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
1
+ System.register(["./planner-da20e5b5.legacy.js","./script-loader-35fe01aa.legacy.js","./query-params-helper-8c00a872.legacy.js","./roomle-dependency-injection-ab58de3d.legacy.js","./main-thread-to-worker-50cdf3d3.legacy.js","./scene-manager-079c4752.legacy.js","./roomle-configurator-285a9f09.legacy.js","./default-light-setting-80b8957f.legacy.js"],(function(){var e;return{setters:[function(n){e=n.Planner},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let n=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-n))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)})}}}));
2
2
  //# sourceMappingURL=planner-main.legacy.js.map