@roomle/web-sdk 2.40.0 → 2.41.0-alpha.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 (169) hide show
  1. package/lib/{banana-for-scale-c621dcfe.nomodule.js → banana-for-scale-95514b92.nomodule.js} +2 -2
  2. package/lib/{banana-for-scale-c621dcfe.nomodule.js.map → banana-for-scale-95514b92.nomodule.js.map} +1 -1
  3. package/lib/{banana-for-scale-ce67e362.js → banana-for-scale-e02087d3.js} +2 -2
  4. package/lib/{banana-for-scale-ce67e362.js.map → banana-for-scale-e02087d3.js.map} +1 -1
  5. package/lib/{component-dimensioning-fb979ea7.js → component-dimensioning-102e0242.js} +2 -2
  6. package/lib/component-dimensioning-102e0242.js.map +1 -0
  7. package/lib/{component-dimensioning-14f19e11.nomodule.js → component-dimensioning-2360ad1e.nomodule.js} +2 -2
  8. package/lib/component-dimensioning-2360ad1e.nomodule.js.map +1 -0
  9. package/lib/{component-raycast-helper-d2abcbf9.js → component-raycast-helper-802c12f4.js} +2 -2
  10. package/lib/component-raycast-helper-802c12f4.js.map +1 -0
  11. package/lib/{component-raycast-helper-721352bc.nomodule.js → component-raycast-helper-9d77abef.nomodule.js} +2 -2
  12. package/lib/component-raycast-helper-9d77abef.nomodule.js.map +1 -0
  13. package/lib/{configurator-7503e734.nomodule.js → configurator-30aa513e.nomodule.js} +2 -2
  14. package/lib/configurator-30aa513e.nomodule.js.map +1 -0
  15. package/lib/{configurator-8ae6f5f3.js → configurator-61f348ff.js} +2 -2
  16. package/lib/configurator-61f348ff.js.map +1 -0
  17. package/lib/configurator-main-1be0bd38.js +2 -0
  18. package/lib/configurator-main-1be0bd38.js.map +1 -0
  19. package/lib/configurator-main.nomodule.js +1 -1
  20. package/lib/{default-light-setting-0ce92cb9.js → default-light-setting-1cab1c97.js} +2 -2
  21. package/lib/default-light-setting-1cab1c97.js.map +1 -0
  22. package/lib/{default-light-setting-e50585c5.nomodule.js → default-light-setting-cc99e778.nomodule.js} +2 -2
  23. package/lib/default-light-setting-cc99e778.nomodule.js.map +1 -0
  24. package/lib/definitions/common-core/src/configurator-kernel-access.d.ts +1 -0
  25. package/lib/definitions/planner-core/src/services/planner-kernel-access.d.ts +2 -0
  26. package/lib/definitions/planner-core/src/view-model/plan-view-model.d.ts +1 -1
  27. package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +1 -0
  28. package/lib/{dimensioning-helper-4c7422f4.nomodule.js → dimensioning-helper-b05c39cf.nomodule.js} +2 -2
  29. package/lib/{dimensioning-helper-4c7422f4.nomodule.js.map → dimensioning-helper-b05c39cf.nomodule.js.map} +1 -1
  30. package/lib/{dimensioning-helper-2d4839c5.js → dimensioning-helper-ef1b4f03.js} +2 -2
  31. package/lib/{dimensioning-helper-2d4839c5.js.map → dimensioning-helper-ef1b4f03.js.map} +1 -1
  32. package/lib/{glb-viewer-eb8a2e36.js → glb-viewer-6d8eb279.js} +2 -2
  33. package/lib/{glb-viewer-eb8a2e36.js.map → glb-viewer-6d8eb279.js.map} +1 -1
  34. package/lib/{glb-viewer-8535af71.nomodule.js → glb-viewer-7379eb67.nomodule.js} +2 -2
  35. package/lib/{glb-viewer-8535af71.nomodule.js.map → glb-viewer-7379eb67.nomodule.js.map} +1 -1
  36. package/lib/glb-viewer-main-e6e5b7df.js +2 -0
  37. package/lib/glb-viewer-main-e6e5b7df.js.map +1 -0
  38. package/lib/glb-viewer-main.nomodule.js +1 -1
  39. package/lib/legacy/{banana-for-scale-d7cf7eac.legacy.js → banana-for-scale-ebbb1878.legacy.js} +2 -2
  40. package/lib/legacy/{banana-for-scale-d7cf7eac.legacy.js.map → banana-for-scale-ebbb1878.legacy.js.map} +1 -1
  41. package/lib/legacy/{component-dimensioning-789aca86.legacy.js → component-dimensioning-ce6017de.legacy.js} +2 -2
  42. package/lib/legacy/component-dimensioning-ce6017de.legacy.js.map +1 -0
  43. package/lib/legacy/{component-raycast-helper-806ded3e.legacy.js → component-raycast-helper-0bae1d70.legacy.js} +2 -2
  44. package/lib/legacy/component-raycast-helper-0bae1d70.legacy.js.map +1 -0
  45. package/lib/legacy/{configurator-6edf0fdb.legacy.js → configurator-0729be40.legacy.js} +2 -2
  46. package/lib/legacy/configurator-0729be40.legacy.js.map +1 -0
  47. package/lib/legacy/configurator-main.legacy.js +1 -1
  48. package/lib/legacy/{default-light-setting-ccc032ee.legacy.js → default-light-setting-d7ca0b4c.legacy.js} +2 -2
  49. package/lib/legacy/default-light-setting-d7ca0b4c.legacy.js.map +1 -0
  50. package/lib/legacy/{dimensioning-helper-6c0f6bc0.legacy.js → dimensioning-helper-27a3fea0.legacy.js} +2 -2
  51. package/lib/legacy/{dimensioning-helper-6c0f6bc0.legacy.js.map → dimensioning-helper-27a3fea0.legacy.js.map} +1 -1
  52. package/lib/legacy/{glb-viewer-710dce16.legacy.js → glb-viewer-45115dc6.legacy.js} +2 -2
  53. package/lib/legacy/{glb-viewer-710dce16.legacy.js.map → glb-viewer-45115dc6.legacy.js.map} +1 -1
  54. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  55. package/lib/legacy/{material-viewer-df6e0f8b.legacy.js → material-viewer-5d97a969.legacy.js} +2 -2
  56. package/lib/legacy/material-viewer-5d97a969.legacy.js.map +1 -0
  57. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  58. package/lib/legacy/{pixotron-1d7bc380.legacy.js → pixotron-539e1b6f.legacy.js} +2 -2
  59. package/lib/legacy/{pixotron-1d7bc380.legacy.js.map → pixotron-539e1b6f.legacy.js.map} +1 -1
  60. package/lib/legacy/planner-7cd40df3.legacy.js +2 -0
  61. package/lib/legacy/{planner-4731aa02.legacy.js.map → planner-7cd40df3.legacy.js.map} +1 -1
  62. package/lib/legacy/planner-main.legacy.js +1 -1
  63. package/lib/legacy/roomle-configurator-6ef21d45.legacy.js +2 -0
  64. package/lib/legacy/{roomle-configurator-ca286400.legacy.js.map → roomle-configurator-6ef21d45.legacy.js.map} +1 -1
  65. package/lib/legacy/{roomle-dependency-injection-06b92c13.legacy.js → roomle-dependency-injection-f45c15bd.legacy.js} +2 -2
  66. package/lib/legacy/{roomle-dependency-injection-06b92c13.legacy.js.map → roomle-dependency-injection-f45c15bd.legacy.js.map} +1 -1
  67. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  68. package/lib/legacy/static/{ConfiguratorKernel-972c03a46bd17b65.js → ConfiguratorKernel-215360ca0dfeb825.js} +71 -71
  69. package/lib/legacy/static/ConfiguratorKernel-ae7e275bc715fd26.wasm +0 -0
  70. package/lib/legacy/static/ConfiguratorKernelJs-7c1047a033b225d4.js +146 -0
  71. package/lib/legacy/static/ConfiguratorKernelJs-d3e4f60672162604.mem +0 -0
  72. package/lib/legacy/static/RoomleCore-49461a0dcc73733f.wasm +0 -0
  73. package/lib/legacy/static/{RoomleCore-2043adeb3adfa54b.js → RoomleCore-a796c84902378c4e.js} +59 -58
  74. package/lib/legacy/static/RoomleCoreJs-5893fc7ffafdc689.mem +0 -0
  75. package/lib/legacy/static/RoomleCoreJs-726cd014804a7c9c.js +154 -0
  76. package/lib/legacy/static/shaders-9ac60c8341c5988d.json +1 -0
  77. package/lib/legacy/{stats-helper-7160871d.legacy.js → stats-helper-8ca68872.legacy.js} +2 -2
  78. package/lib/legacy/{stats-helper-7160871d.legacy.js.map → stats-helper-8ca68872.legacy.js.map} +1 -1
  79. package/lib/{material-viewer-2d41fd5b.js → material-viewer-1de16225.js} +2 -2
  80. package/lib/material-viewer-1de16225.js.map +1 -0
  81. package/lib/{material-viewer-b5dc2c23.nomodule.js → material-viewer-bffa5198.nomodule.js} +2 -2
  82. package/lib/material-viewer-bffa5198.nomodule.js.map +1 -0
  83. package/lib/material-viewer-main-174aa7c1.js +2 -0
  84. package/lib/material-viewer-main-174aa7c1.js.map +1 -0
  85. package/lib/material-viewer-main.nomodule.js +1 -1
  86. package/lib/{pixotron-d48cdf07.js → pixotron-26b58435.js} +2 -2
  87. package/lib/{pixotron-d48cdf07.js.map → pixotron-26b58435.js.map} +1 -1
  88. package/lib/{pixotron-7b645940.nomodule.js → pixotron-2f0ac917.nomodule.js} +2 -2
  89. package/lib/{pixotron-7b645940.nomodule.js.map → pixotron-2f0ac917.nomodule.js.map} +1 -1
  90. package/lib/planner-6dc2e904.js +2 -0
  91. package/lib/{planner-31eff338.js.map → planner-6dc2e904.js.map} +1 -1
  92. package/lib/planner-fd6740fd.nomodule.js +2 -0
  93. package/lib/{planner-c461687e.nomodule.js.map → planner-fd6740fd.nomodule.js.map} +1 -1
  94. package/lib/{planner-main-36d2a4d1.js → planner-main-f7bb0a67.js} +2 -2
  95. package/lib/planner-main-f7bb0a67.js.map +1 -0
  96. package/lib/planner-main.nomodule.js +1 -1
  97. package/lib/roomle-configurator-d20a6542.js +2 -0
  98. package/lib/{roomle-configurator-729fec35.js.map → roomle-configurator-d20a6542.js.map} +1 -1
  99. package/lib/roomle-configurator-faa8734b.nomodule.js +2 -0
  100. package/lib/{roomle-configurator-442a410a.nomodule.js.map → roomle-configurator-faa8734b.nomodule.js.map} +1 -1
  101. package/lib/{roomle-dependency-injection-d856bd23.nomodule.js → roomle-dependency-injection-2dcb414f.nomodule.js} +2 -2
  102. package/lib/{roomle-dependency-injection-d856bd23.nomodule.js.map → roomle-dependency-injection-2dcb414f.nomodule.js.map} +1 -1
  103. package/lib/{roomle-dependency-injection-fe719e2d.js → roomle-dependency-injection-b6b3455b.js} +2 -2
  104. package/lib/{roomle-dependency-injection-fe719e2d.js.map → roomle-dependency-injection-b6b3455b.js.map} +1 -1
  105. package/lib/{roomle-sdk-3895e33e.js → roomle-sdk-d0aece12.js} +2 -2
  106. package/lib/roomle-sdk-d0aece12.js.map +1 -0
  107. package/lib/roomle-sdk.nomodule.js +1 -1
  108. package/lib/static/ConfiguratorKernel-215360ca0dfeb825.js +1 -0
  109. package/lib/static/ConfiguratorKernel-215360ca0dfeb825.js.map +1 -0
  110. package/lib/static/ConfiguratorKernel-ae7e275bc715fd26.wasm +0 -0
  111. package/lib/static/ConfiguratorKernelJs-7c1047a033b225d4.js +146 -0
  112. package/lib/static/ConfiguratorKernelJs-d3e4f60672162604.mem +0 -0
  113. package/lib/static/RoomleCore-49461a0dcc73733f.wasm +0 -0
  114. package/lib/static/{RoomleCore-2043adeb3adfa54b.js → RoomleCore-a796c84902378c4e.js} +1 -1
  115. package/lib/static/RoomleCore-a796c84902378c4e.js.map +1 -0
  116. package/lib/static/RoomleCoreJs-5893fc7ffafdc689.mem +0 -0
  117. package/lib/static/RoomleCoreJs-726cd014804a7c9c.js +154 -0
  118. package/lib/static/shaders-9ac60c8341c5988d.json +1 -0
  119. package/lib/{stats-helper-2f31fc65.js → stats-helper-1f7cdc77.js} +2 -2
  120. package/lib/{stats-helper-2f31fc65.js.map → stats-helper-1f7cdc77.js.map} +1 -1
  121. package/lib/{stats-helper-2320382c.nomodule.js → stats-helper-b338fbf1.nomodule.js} +2 -2
  122. package/lib/{stats-helper-2320382c.nomodule.js.map → stats-helper-b338fbf1.nomodule.js.map} +1 -1
  123. package/package.json +2 -2
  124. package/lib/component-dimensioning-14f19e11.nomodule.js.map +0 -1
  125. package/lib/component-dimensioning-fb979ea7.js.map +0 -1
  126. package/lib/component-raycast-helper-721352bc.nomodule.js.map +0 -1
  127. package/lib/component-raycast-helper-d2abcbf9.js.map +0 -1
  128. package/lib/configurator-7503e734.nomodule.js.map +0 -1
  129. package/lib/configurator-8ae6f5f3.js.map +0 -1
  130. package/lib/configurator-main-12d65fa7.js +0 -2
  131. package/lib/configurator-main-12d65fa7.js.map +0 -1
  132. package/lib/default-light-setting-0ce92cb9.js.map +0 -1
  133. package/lib/default-light-setting-e50585c5.nomodule.js.map +0 -1
  134. package/lib/glb-viewer-main-7ad8db3a.js +0 -2
  135. package/lib/glb-viewer-main-7ad8db3a.js.map +0 -1
  136. package/lib/legacy/component-dimensioning-789aca86.legacy.js.map +0 -1
  137. package/lib/legacy/component-raycast-helper-806ded3e.legacy.js.map +0 -1
  138. package/lib/legacy/configurator-6edf0fdb.legacy.js.map +0 -1
  139. package/lib/legacy/default-light-setting-ccc032ee.legacy.js.map +0 -1
  140. package/lib/legacy/material-viewer-df6e0f8b.legacy.js.map +0 -1
  141. package/lib/legacy/planner-4731aa02.legacy.js +0 -2
  142. package/lib/legacy/roomle-configurator-ca286400.legacy.js +0 -2
  143. package/lib/legacy/static/ConfiguratorKernel-7c35ec56ec215268.wasm +0 -0
  144. package/lib/legacy/static/ConfiguratorKernelJs-1d8867cbd07ee974.mem +0 -0
  145. package/lib/legacy/static/ConfiguratorKernelJs-339c53cbe53f5be8.js +0 -146
  146. package/lib/legacy/static/RoomleCore-dcf19f7ef832b982.wasm +0 -0
  147. package/lib/legacy/static/RoomleCoreJs-944326ec25ba15c1.js +0 -154
  148. package/lib/legacy/static/RoomleCoreJs-d2f6aa70dd52d4a6.mem +0 -0
  149. package/lib/legacy/static/shaders-1e02a401be3330ee.json +0 -1
  150. package/lib/material-viewer-2d41fd5b.js.map +0 -1
  151. package/lib/material-viewer-b5dc2c23.nomodule.js.map +0 -1
  152. package/lib/material-viewer-main-e665307d.js +0 -2
  153. package/lib/material-viewer-main-e665307d.js.map +0 -1
  154. package/lib/planner-31eff338.js +0 -2
  155. package/lib/planner-c461687e.nomodule.js +0 -2
  156. package/lib/planner-main-36d2a4d1.js.map +0 -1
  157. package/lib/roomle-configurator-442a410a.nomodule.js +0 -2
  158. package/lib/roomle-configurator-729fec35.js +0 -2
  159. package/lib/roomle-sdk-3895e33e.js.map +0 -1
  160. package/lib/static/ConfiguratorKernel-7c35ec56ec215268.wasm +0 -0
  161. package/lib/static/ConfiguratorKernel-972c03a46bd17b65.js +0 -1
  162. package/lib/static/ConfiguratorKernel-972c03a46bd17b65.js.map +0 -1
  163. package/lib/static/ConfiguratorKernelJs-1d8867cbd07ee974.mem +0 -0
  164. package/lib/static/ConfiguratorKernelJs-339c53cbe53f5be8.js +0 -146
  165. package/lib/static/RoomleCore-2043adeb3adfa54b.js.map +0 -1
  166. package/lib/static/RoomleCore-dcf19f7ef832b982.wasm +0 -0
  167. package/lib/static/RoomleCoreJs-944326ec25ba15c1.js +0 -154
  168. package/lib/static/RoomleCoreJs-d2f6aa70dd52d4a6.mem +0 -0
  169. package/lib/static/shaders-1e02a401be3330ee.json +0 -1
@@ -1,2 +0,0 @@
1
- System.register(["./roomle-dependency-injection-d856bd23.nomodule.js","./main-thread-to-worker-6c735cca.nomodule.js","./pixotron-7b645940.nomodule.js","./default-light-setting-e50585c5.nomodule.js"],(function(e,t){var n,i,o,s,r,a,l,c,h,d,_,g,p,u,m,C,f,v,b,y,w,E,P,H,I,S,M,D,R,O,x,k,L,T,A,V,j,B,G,U,K,F,z,q,W,N,Q,J;return{setters:[function(e){n=e._,i=e.i,o=e.C,s=e.u,r=e.S,a=e.W,l=e.F,c=e.w,h=e.x,d=e.P,_=e.E,g=e.y,p=e.z,u=e.G,m=e.t,C=e.H,f=e.l,v=e.e,b=e.J,y=e.K,w=e.b,E=e.o,P=e.N,H=e.n,I=e.O,S=e.B,M=e.q,D=e.Q,R=e.T,O=e.U,x=e.A,k=e.V,L=e.X,T=e.Y,A=e.Z},function(e){V=e.b,j=e.l,B=e.d},function(e){G=e.L,U=e.b,K=e.B,F=e.c,z=e.C,q=e.F,W=e.P,N=e.T,Q=e.d},function(e){J=e.D}],execute:function(){var X=e("G","static/GLTFExporter-86edae059df3a219.js");e("P",(()=>{class e extends o{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._constructionGroup=new THREE.Group,this._constructionGroup.name="Construction",this._ceilingGroup=new THREE.Group,this._ceilingGroup.name="Ceiling",this._floorGroup=new THREE.Group,this._ceilingGroup.name="Ceiling",this._getKernelAccess().addPlannerListener(this)}planBoundsChanged(){}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null,super.clearReference()}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof s?this._configurablePlanObjectViewModels.push(e):e instanceof r?(this._staticPlanObjectViewModels.push(e),"door"!==e.getPlanObject().getObjectType()&&"window"!==e.getPlanObject().getObjectType()&&this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof a?(this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView("2D"===this._cameraType),this._wallPlanObjectViewModels.push(e),this._constructionGroup.add(e.getContainer())):e instanceof l?this._floorGroup.add(e.getContainer()):e instanceof c&&this._ceilingGroup.add(e.getContainer())}_addRootComponent(e){const t=this._getPlanObjectViewModelForRuntimeId(e.parentObjectId);t&&t instanceof s&&(t.addRootComponent(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(t),t.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getPlanObjectForId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),this._staticPlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),t}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getFloorGroup(){return this._floorGroup}getBoundingBox(){if("configurator"===this._configuratorContext.baseContext){const e=this.getPlanObjectForId(this._configuratorContext.planElementId);if(e)return e.getBounds()}if("glb-viewer"===this._configuratorContext.baseContext){const e=this._plannerSceneEventHandler.getSelectedIds();if(e&&1===e.length){const t=this.getPlanObjectForId(e[0]);if(t)return t.getBounds()}}const e=this.getCorePlan();if(e)try{return h(e.getBounds())}catch(e){console.error(e)}return(new THREE.Box3).setFromObject(this._constructionGroup)}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}sceneCleared(){this._configurablePlanObjectViewModels.forEach(e=>{e.remove()}),this._staticPlanObjectViewModels.forEach(e=>{e.remove()}),this._wallPlanObjectViewModels.forEach(e=>{e.remove()}),super.sceneCleared()}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getConfigurablePlanObjectViewModels(){return this._configurablePlanObjectViewModels}getWallPlanObjectViewModels(){return this._wallPlanObjectViewModels}_generateMesh(e=0,t=null,n,i,o,s,r,a,l){return this._plannerMeshGenerator.generateMesh(e,t,n,i,o,s,r,a,l)}_setMaterial(e,t,n){this._plannerMeshGenerator.setMaterial(e,t)}Editor3dComponentCreated(e,t,n,i,o){super.Editor3dComponentCreated(e,t,n,i,o),this._getKernelAccess()instanceof d&&this.dockComponent(e,i,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,o,s,r){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){}addMesh(e,t,n,i,o,s){const r=e.extRef.jsObject;let a=r.getMesh(t);a?a.geometry=this._plannerMeshGenerator.generateGeometry(null,n,i,o,s):(a=this._generateMesh(0,null,t,n,i,o,s,e.getType()),r.addMesh(a))}removePlanObjectFromScene(e){const t=e.getPlanElement().getType();this._isConstructionType(t)?this._constructionGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.FLOOR?this._floorGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.CEILING&&this._ceilingGroup.remove(e.getContainer()),e.clear()}_isConstructionType(e){return e===this._getKernelAccess().kernelContainer.PlanElementType.WALL||e===this._getKernelAccess().kernelContainer.PlanElementType.NODE}planElementRemoved(e){if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.OBJECT){let t=e;if(t.hasConfiguration()){const e=t.extRef.jsObject,n=this._configurablePlanObjectViewModels.indexOf(e);n>-1&&this._configurablePlanObjectViewModels.splice(n,1)}else{const e=t.extRef.jsObject,n=this._staticPlanObjectViewModels.indexOf(e);n>-1&&this._staticPlanObjectViewModels.splice(n,1)}}if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.WALL){const t=e.extRef.jsObject,n=this._wallPlanObjectViewModels.indexOf(t);n>-1&&this._wallPlanObjectViewModels.splice(n,1)}}getMeshGenerator(){return this._plannerMeshGenerator}componentConfigurationUpdated(e,t){super.componentConfigurationUpdated(e,t),this._roomlePlannerUiCallback.onPlanElementChanged()}hideAllExcept(e){this._ceilingGroup.visible=!1,this._floorGroup.visible=!1,this._constructionGroup.visible=!1,this._staticPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurablePlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)})}showAll(){this._ceilingGroup.visible=!0,this._floorGroup.visible=!0,this._constructionGroup.visible=!0,this._staticPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurablePlanObjectViewModels.forEach(e=>e.getContainer().visible=!0)}planHistoryStateChanged(){}setCameraType(e){this._cameraType=e,this._wallPlanObjectViewModels.forEach(e=>e.setTopView("2D"===this._cameraType))}}return n([i],e.prototype,"_plannerMeshGenerator",void 0),n([i],e.prototype,"_roomlePlannerUiCallback",void 0),e})());const Y=m(30);class Z extends _{constructor(e,t,n,i){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===i?1:i,this._scene=e,this._camera=t,this._raycaster=new THREE.Raycaster,this._raycaster.layers.disableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(e){this._raycaster.layers=e}getLayers(){return this._raycaster.layers}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(6,e=>{this._findHover(e.positionRelative,e.type)},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){this._intersection(e)&&this._inputManager.onElementHit()}_findSelection(e){let t=this._intersection(e);t?t&&t.object.dispatchEvent({type:"select"}):this.dispatchEvent(3)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(e,this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(e,this._camera);let t,n=new THREE.Vector3(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._scene.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t);if(e){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,i=new THREE.Vector3(0,0,0),o=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,i),this._raycaster.ray.intersectPlane(this._planeSide,o);let s,r=this._getDistanceToCamera(o),a=this._getDistanceToCamera(i);return n>=-Y&&n<=Y?s=t<a?e.clone():i.clone():t<a&&t<r?s=e.clone():a<t&&a<r?s=i.clone():r<t&&r<a&&(s=o.clone()),s}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return g(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new THREE.Vector3).x+e.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(e.getWorldQuaternion(new THREE.Quaternion)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof THREE.Mesh&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&p(this._currentDrag),this._currentHover&&p(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setScene(e){this._scene=e}setMode(e){this._mode=e}intersectMouseOnScene(e){const t=new THREE.Plane,n=new THREE.Vector3;return n.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(n,this._scene.position),this._raycaster.setFromCamera(e.positionRelative,this._camera),u(this._raycaster.ray.intersectPlane(t,new THREE.Vector3))}}class $ extends _{constructor(e,t,n,i){super(),this._debug=!1,this._dragIn=!1,this._inputManager=i,this._raycastHelper=new Z(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}}e("S",$);class ee{constructor(e){const{component:t,preview:n,resetCamera:i,consecutive:o,type:s,forceRender:r}=e;this.component=t,this.preview=n,this.resetCamera=void 0===i||i,this.consecutive=void 0===o||o,this.type=s||0,this.forceRender=void 0!==r&&r}}let te=(()=>{class e extends ${constructor(e,t,n,i){super(e,t,n,i),this._cameraMoving=!1,this._raycastHelper.addEventListener(3,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(0,({component:e,consecutive:t})=>{this.dispatchEvent(8,new ee({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new ee({component:e,resetCamera:t}))},this),this._addInputListeners(this._inputManager)}disable(){const e=new THREE.Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}enable(){const e=new THREE.Layers;e.enable(4),e.enable(5),e.enable(7),e.enable(8),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}_addInputListeners(e){e.addEventListener(7,e=>this._interaction(),this),e.addEventListener(8,e=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:2,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.runtimeId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,n){t.userData.hasListener||(Object.assign(t.userData,n),t.addEventListener("select",()=>this.clickComponent(e)),t.addEventListener("hover_on",t=>this._hoverOn(e,t.attachment.type)),t.addEventListener("hover_off",t=>this._hoverOff(e,t.attachment.type)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData=V(t.userData,{hasListener:!0,priority:3,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreview(e)),t.addEventListener("hover_on",()=>this._hoverOnPreview(e)),t.addEventListener("hover_off",()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData=V(t.userData,{hasListener:!0,priority:4,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreviewLine(e)),t.addEventListener("hover_on",t=>this._hoverOnPreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_move",t=>this._hoverMovePreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_off",()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new ee({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new ee({preview:e}))}clickComponent(e){this._debug&&e.runtimeId,this._selectionHandler.check(e)}_clickOutside(){this._selectionHandler.cancelSelection(),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new ee({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new ee({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e}_hoverOffPreview(e){e.hoverOff(),this._interaction(!0),this._hoveredPreview=null}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let n=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=n,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(n))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){this._draggedComponent.traverse(t=>{if(t instanceof THREE.Mesh){const n=t;e&&void 0!==n.castShadowOld?(n.receiveShadow=n.receiveShadowOld,n.castShadow=n.castShadowOld):(n.receiveShadowOld=t.receiveShadow,n.castShadowOld=t.castShadow,n.receiveShadow=!1,n.castShadow=!1)}})}_dragStart(e){e&&(this._selectionHandler.isSelected(e)||this.isDragIn())&&(this._dragStartPosition=e.position.clone(),this._dragStartRotation=e.rotation.clone(),this._draggedComponent=e,this._setDragComponentShadow(!1),this.dispatchEvent(4,new ee({component:e})),this._interaction())}_drag(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(e&&!this._draggedComponent&&(this._draggedComponent=e),this._previewLineIntersection){let e=this._hoveredPreview,t=e.getPositionForIntersectionPoint(this._previewLineIntersection),n=e.parent.localToWorld(t);this._draggedComponent.position.copy(this._draggedComponent.parent.worldToLocal(n)),this._draggedComponent.rotation.copy(e.docklineRotation),e.hideSelectionLine()}else e.parent?e.position.copy(e.parent.worldToLocal(t)):e.position.copy(t);this._hoveredPreview?e.visible=!1:e.visible=!0,this.dispatchEvent(5,new ee({component:e})),this._interaction()}}_dragEnd(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(this._hoveredPreview)if(this._previewLineIntersection){let t=this._hoveredPreview,n=t.getPositionForIntersectionPoint(this._previewLineIntersection),i=t.parent.localToWorld(n);e.position.copy(e.parent.worldToLocal(i)),e.rotation.copy(t.docklineRotation)}else e.position.copy(t);else this._dragStartPosition&&this._dragStartRotation&&(e.position.copy(this._dragStartPosition),e.rotation.copy(this._dragStartRotation),this._dragStartPosition=null,this._dragStartRotation=null,this.addComponentHandlers(e));e.visible=!0,this._setDragComponentShadow(!0),this._draggedComponent=null,this._previewLineIntersection=null,this.dispatchEvent(6,new ee({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new ee({forceRender:e}))}hasSelection(){return this._selectionHandler.hasSelection()}update(e,t,n){this._raycastHelper.update(e,t,n)}isDragIn(){return this._dragIn}isDragging(){return null!=this._draggedComponent}setRootComponentId(e){this._raycastHelper.setRootComponentId(e)}cancelSelection(){this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection()}setSelectionMode(e){this._selectionHandler.setSelectionMode(e)}getSelectionMode(){return this._selectionHandler.getSelectionMode()}getSelectedRuntimeComponentIds(){return this._selectionHandler.getSelectedRuntimeComponentIds()}setCameraMoving(e){e&&this._hoveredComponent&&this._hoverOff(this._hoveredComponent,0),this._cameraMoving=e}}return n([i],e.prototype,"_selectionHandler",void 0),e})();class ne extends _{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let i=new THREE.Vector3(-e.x/2,0,-e.z/2),o=new THREE.Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new THREE.Box3(i,o),this._clientWidth=t,this._clientHeight=n;let s=this._boundingBox.getSize(new THREE.Vector3);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new THREE.Vector3(s.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new THREE.Vector3(s.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(null==this._boundingBox||null==this._offset)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let n=0;this.floorEnvironment?(e=["left","right","bottom"],n=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),n|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),n|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),n|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),n|=4),n!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=n)}_checkPaddings(){let e={left:this._clientWidth/2,top:this._clientHeight/2,right:this._clientWidth/2,bottom:this._clientHeight/2};return this._boxVertices.forEach(t=>{let n=C(t,this._camera,this._clientWidth,this._clientHeight);n.x<e.left&&(e.left=n.x),n.x>e.right&&(e.right=n.x),n.y<e.top&&(e.top=n.y),n.y>e.bottom&&(e.bottom=n.y)}),e}}class ie extends G{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),1.2),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!1}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=f();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}}}let oe=null;const se=()=>(oe||(oe=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),oe.outputEncoding=THREE.sRGBEncoding),oe.autoClear=!0,oe),re=e("g",(e,t=0)=>{if(!e){const e=new THREE.Vector3;return{center:e,bounds:e,diagonal:0}}const n=e.getSize(new THREE.Vector3);return n.addScalar(t),{center:e.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}}),ae=e("a",(e,t,n,i,o={},s=0)=>new Promise(r=>{const{size:a=1024,showDimensions:l}=o,c=se();c.setSize(a,a);const h=e.fog?e.fog.clone():null,d=e.background?e.background.clone():null;e.background=null,e.fog=null;let _=new J(e);n.layers.disable(2),n.layers.disable(6),n.layers.disable(5),l?n.layers.enable(8):n.layers.disable(8);const g=-30+v(s);le(n,i,-20,g),c.render(e,n),t&&(c.autoClear=!1,c.clearDepth(),c.render(t,n));const p=c.domElement.toDataURL();n.layers.enable(2),n.layers.enable(6),n.layers.enable(5),e.background=d,e.fog=h,_.removeFromScene(),r({image:p,width:a,height:a,blob:null})})),le=(e,t,n,i)=>{e.far=1e3,e.fov=15,e.aspect=1,e.position.copy(t.center),e.rotation.set(0,0,0),e.rotateY(m(i)),e.rotateX(m(n)),e.translateZ(3.8*t.diagonal),e.updateProjectionMatrix()},ce=e("p",(e,t,n,i={})=>{const{showDimensions:o=!1}=i;return new Promise(i=>{const s=se();s.autoClear=!1;let r=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);r.position.copy(n.center),r.rotateX(m(-90)),r.translateZ(n.bounds.y+1),r.far=r.position.y+.5,r.layers.mask=65535;let a=200*n.bounds.x,l=200*n.bounds.z;if(a>4096||l>4096){let e=0;a>4096?e=a/4096:l>4096&&(e=l/4096),a/=e,l/=e}s.setSize(a,l);let c=e.fog?e.fog.clone():null,h=e.background?e.background.clone():null;e.background=null,e.fog=null;let d=o?new ie(e):new J(e);r.layers.disable(2),r.layers.disable(6),r.layers.disable(5),o?r.layers.enable(8):r.layers.disable(8),s.render(e,r),t&&(s.clearDepth(),s.render(t,r));let _=s.domElement.toDataURL();r.layers.enable(2),r.layers.enable(6),r.layers.enable(5),e.background=h,e.fog=c,d.removeFromScene(),i({image:_,width:a,height:l,blob:null})})});e("C",(()=>{class e extends U{constructor(e,t,n="3D"){super(e,t,b.HSC,n),this._getViewModel().setListener(this),this._sceneEventHandler=new te(this._creator_,this._scene,this._getCameraControl().getCamera(),this._getInputManager()),this._sceneEventHandler.addEventListener(0,({forceRender:e})=>{this._uiIntersectionHelper.calculateUIIntersection(),e&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(1,({component:e,type:t})=>this._onHoverOn(e,t),this),this._sceneEventHandler.addEventListener(2,({component:e,type:t})=>this._onHoverOff(e,t),this),this._sceneEventHandler.addEventListener(3,()=>{this._configuratorUiCallbacks.onClickOutside(),this._cameraControl.unlock(),this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this.cancelComponentSelection(!0),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._sceneEventHandler.addEventListener(8,({component:e,consecutive:t})=>{this._getViewModel().hasPreviews()&&this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this._selectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(9,({component:e,resetCamera:t})=>{this._deselectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelComponentSelection(),this._requestDockingsPreviewWithDrag(e.runtimeId),this._cameraControl.lock(),this._requestRender()},this),this._sceneEventHandler.addEventListener(5,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(6,({component:e,preview:t})=>{if(t){let n=t;this._getViewModel().isPreviewLine(n)?this._getViewModel().dockComponentWithPosition(n,e):this._getViewModel().isPreview(n)&&this._dockComponent(n),this._cancelDockings(!t,e,!0,!0)}else{let t=this._sceneEventHandler.isDragIn()?e:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),t,!1,!0);const n=this._getViewModel().getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))}this._cameraControl.unlock(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(7,({preview:e})=>{this._getViewModel().isPreview(e)&&(this._getViewModel().isPreviewLine(e)?this._getViewModel().dockComponentWithPosition(e):this._dockComponent(e),this._cancelDockings(!1,null,!this._getViewModel().hasPreviews(),!1,!1),this.requestDockingsPreview(!1),this._requestRender())},this),this._cameraControl.addEventListener(0,()=>{var e;this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),null===(e=this._pixotronUtil)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this._cameraControl.addEventListener(1,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._cameraControl.addEventListener(2,()=>{var e;this._sceneEventHandler.setCameraMoving(!1),null===(e=this._pixotronUtil)||void 0===e||e.movingCameraStops(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(5,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this._cameraControl.addEventListener(3,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(4,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(7,()=>{this._pluginSystem.moveCameraStart(this._getCameraControl().getCamera().position)},this),this._cameraControl.addEventListener(8,()=>{this._pluginSystem.moveCameraEnd(this._getCameraControl().getCamera().position)},this),y.isProduction||(window.__RML__DEBUG__.SceneHelper=this),this.enableConfiguratorEvents(),this._initOptionalModules(),this._offsetAnimationStart=j(this._offsetAnimationStart.bind(this),250),this._offsetAnimationEnd=B(this._offsetAnimationEnd.bind(this),32)}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:e}=await t.import("./component-raycast-helper-721352bc.nomodule.js");this._componentRaycastHelper=new e,this._componentRaycastHelper.init(this._scene,this._getCameraControl().getCamera())}}enableConfiguratorEvents(){this._sceneEventHandler.enable()}disableConfiguratorEvents(){this._sceneEventHandler.disable()}_getViewModel(){return this._viewModel||(this._viewModel=w.lookup("configurator-view-model",this._creator_)),this._viewModel}_getKernelAccess(){return this._plannerKernelAccess}_showDockings(){}cancelDockings(){this._cancelDockings(!0,null,!0,!0,!1),this._renderEverything()}_cancelDockings(e,t,n,i,o=!0){e&&(this._sceneEventHandler.setDragIn(!1),this._getViewModel().removeDockingComponent(),t&&this._scene.remove(t)),this._getViewModel().removePreviews(),n&&o&&this._updateCameraToBounds(),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}_onHoverOn(e,t){2!==t&&this._highlightComponent(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.add(e)&&this._renderEverything()}_onHoverOff(e,t){2!==t&&this._highlightComponent(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._componentDimensioningHelper.remove(e),this._renderEverything()),this._requestRender()}_highlightComponent(e=null,t=[]){if(!this._shouldHighlight())return;this._pixotron&&((null==t?void 0:t.length)?this._pixotron.getHighLightPass().transparency=.8:this._pixotron.getHighLightPass().transparency=1,this._pixotron.getHighLightPass().needsUpdate=!0);const n=[],i=this._initData.meshSelection;e?i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh):t&&t.length||(t=this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._getViewModel().getComponentsForIds(t).forEach(e=>{e&&(i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh))}),this._pixotron&&this._pixotron.highlightObjects(n)}shouldClearShadowsAndAO(){return super.shouldClearShadowsAndAO()||!this._sceneEventHandler.isDragging()}resume(){super.resume(),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._applySSR(),this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything(),this._applySSR(),this._environment instanceof K&&this._environment.update()}_applySSR(){this._initData.ssr&&this._pixotron&&this._getViewModel().getComponent(this._configuratorContext.rootComponentId).traverse(e=>{e instanceof THREE.Mesh&&!e.material.ssrPass&&this._pixotron.fixMaterial(e)})}pause(){super.pause(),this._getViewModel().materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}_setupScene(e,t,n){super._setupScene(e,t),this._uiIntersectionHelper=new ne(this._getCameraControl().getCamera()),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(0,e=>{this._configuratorUiCallbacks.onUiIntersectionChange(e)},this),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._domHelper.element.appendChild(this._renderer.domElement),n||(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(E.createDynamicLightSettingSource(null,P.CAMERA)):this._lightSetting=new J(this._scene,this._lightSetting)),this._requestRender(),this._setEnvironment(new F(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded())}sceneCleared(e){this._internalClearScene(e)}display(e){this._scene.add(e),this._sceneEventHandler.setRootComponentId(e.runtimeId),this._requestRender()}debugSceneGraph(e){this._getViewModel().debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){e.material&&e.material.opacity,e.type,e.id,e.runtimeId,e.children.length>0&&e.children.forEach(e=>{let n=t+" ";this._printObjectGraph(e,n)})}clearScene(){var e;this._getCameraControl().clear(),this._internalClearScene(!1),this._pixotronUtil&&this._pixotronUtil.lockAdapter(),null===(e=this._sceneEventHandler)||void 0===e||e.cancelSelection(),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this._getCameraControl().getCamera())}_internalClearScene(e){var t;this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type&&"Line"!==e.type||this._scene.remove(e)}),this._uiScene.children.forEach(e=>{this._uiScene.remove(e)}),this._getViewModel().sceneCleared(),null===(t=this._componentDimensioningHelper)||void 0===t||t.invalidateDimensioningsCache(),(e||this._memoryManager.shouldHardReset())&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}async preparePerspectiveImage(e={}){await this._externalMeshesAndMaterialsReady();const{showDimensions:t=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let n=this._getCameraControl().getCamera().clone(),i=this._calculateBoundingBoxOfAllMeshes(0,t);this._lightSetting.removeFromScene();const o=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();o&&this._dimensionHelper.disableDimensions();const s=this._getCameraControl().getObjectRotation();if(t){await this._initDimensions(),await this._dimensionHelper.isInitialized();const e=-30+v(s);le(n,i,-20,e),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(n.position),i=this._calculateBoundingBoxOfAllMeshes(0,t)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const r=await ae(this._scene,this._uiScene,n,i,e,s);return o?this._dimensionHelper.enableDimensions():t&&this._dimensionHelper.disableDimensions(),this._lightSetting.addToScene(),this._requestRender(),r}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let t=this._getCameraControl().getCamera(),n=null;e.useCurrentPerspective||(t=this._getCameraControl().getCamera().clone(),n=this._calculateBoundingBoxOfAllMeshes());const i=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();i&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const o=await((e,t,n,i,o,s)=>new Promise(i=>{s||(s=1024);const o=se();o.setSize(s,s);const r=e.fog?e.fog.clone():null,a=e.background?e.background.clone():null;e.background=null,e.fog=null,t.layers.disable(2),t.layers.disable(6),t.layers.disable(5),n?le(t,n,-20,-30):(t.aspect=1,t.updateProjectionMatrix()),o.render(e,t);const l=o.domElement.toDataURL();t.layers.enable(2),t.layers.enable(6),t.layers.enable(5),e.background=a,e.fog=r,i({image:l,width:s,height:s,blob:null})}))(this._scene,t,n,this._pixotron,this._renderer);return i&&this._dimensionHelper.enableDimensions(),this._requestRender(),o}async preparePartImage(e,t){return new Promise((n,i)=>{this._getViewModel().requestSubPartConstruction(e).then(async e=>{t.size||(t.size=256);let i=this._getCameraControl().getCamera().clone(),o=re((new THREE.Box3).setFromObject(e));const s=new THREE.Scene;s.add(e);const r=await ae(s,null,i,o,t);H(s),n(r)},i)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._getViewModel().getBoundingBox(),re(n,e)}async _externalMeshesAndMaterialsReady(){await this._getKernelAccess().externalMeshQueue.finished(!0),await this._getViewModel().materialQueue.finished(!0)}async prepareTopImage(e={}){await this._externalMeshesAndMaterialsReady();const{showDimensions:t=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers(),t&&(await this._initDimensions(),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();let n=this._calculateBoundingBoxOfAllMeshes(.1,t);this._lightSetting.removeFromScene();let i=await ce(this._scene,this._uiScene,n,e);return t&&this._dimensionHelper.disableTopDimensions(),this._lightSetting.addToScene(),this._requestRender(),i}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}zoomToComponent(e){this._cameraControl.saveState(!1);let t=e.boundingBox.getSize(new THREE.Vector3),n=I(e),i=new THREE.Euler(0,n,0),o=e.getWorldPosition(new THREE.Vector3).clone().add(e.boundingBox.getCenter(new THREE.Vector3).applyEuler(i));const s=new THREE.Vector2;this._renderer.getSize(s),this._getCameraControl().zoomTo(t,s.width,s.height,i.y,m(15),o)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart(!1)}resetCameraToState(){this._cameraControl.hasSavedState()&&this._cameraControl.resetToState()}resetCameraPositionToStart(e=!0){this._requestRender();const t=this._getViewModel().getBoundingBox();t&&this._cameraControl instanceof z&&this._getCameraControl().reset(t,void 0,void 0,void 0,e)}_clearSelectionAndHovers(){this.cancelComponentSelection(),this._getViewModel().clearRootComponent()}resetPreviews(){this._getViewModel().removePreviews(),this._requestRender()}changeOffset(e){this._getCameraControl().getCamera().offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}updateCamera(e=!0){super.updateCamera(),this._updateCameraToBounds(null,e)}setCameraOffset(e){this._offsetAnimationStart(),this._getCameraControl().getCamera().offset&&(this._getCameraControl().getCamera().offset=e,this._renderEverything()),this._offsetAnimationEnd()}_offsetAnimationStart(){this._onCameraMove()}_offsetAnimationEnd(){this._onCameraIdle()}getCameraOffset(){var e,t;return(null===(t=null===(e=this._getCameraControl())||void 0===e?void 0:e.getCamera())||void 0===t?void 0:t.offset)?JSON.parse(JSON.stringify(this._getCameraControl().getCamera().offset)):{left:0,top:1,right:1,bottom:0}}_onKeyDown(e){super._onKeyDown(e),!e.key||"Escape"!==e.key&&"Esc"!==e.key||(this.cancelComponentSelection(),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof z&&(this._getCameraControl().enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&("Backspace"===e.key||"Delete"===e.key)&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e){super._onKeyUp(e),e.key&&e.key.includes("Shift")&&(this._getCameraControl().disablePanning(),e.preventDefault())}cancelPreviousDockings(){this._cancelDockings(!0,null,!1,!1)}cancelComponentSelection(e){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e)}_cancelSelection(e){this._sceneEventHandler.cancelSelection(),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.resetCameraToState(),this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel()}_selectComponent(e,t){this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),t||("standard"===this._sceneEventHandler.getSelectionMode()?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds())),this._highlightComponent(e),!this._initData.debug&&t&&this.zoomToComponent(e)}_deselectComponent(e,t){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t),this._highlightComponent()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t),this._highlightComponent())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return C(e,this._getCameraControl().getCamera(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return this._environment&&this._environment instanceof q||(this._environment=new q(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),new Promise((t,n)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},n)})}exportGLB(){this._scriptLoader.fetch(X,{id:"gltf-exporter"}).then(()=>{let e=new THREE.GLTFExporter,t=[];this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type||t.push(e)}),e.parse(t,e=>{let t=document.createElement("a");const n=new Blob([e],{type:"model/gltf-binary"});t.href=URL.createObjectURL(n),t.download="scene.glb",t.style.display="none",document.body.appendChild(t),t.click()},{binary:!0,embedImages:!0,forceIndices:!0})})}zoomIn(e){this._getCameraControl().zoomIn(e),this._renderEverything()}zoomOut(e){this._getCameraControl().zoomOut(e),this._renderEverything()}async showDimensions(){await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._renderEverything()}async _initDimensions(){this._dimensionHelper||await t.import("./dimensioning-helper-4c7422f4.nomodule.js").then(({default:e})=>{this._dimensionHelper=new e(this._creator_),this._pluginSystem.addPlugin(this._dimensionHelper)})}hideDimensions(){this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}async loadSceneSettings(e){await super.loadSceneSettings(e),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof q}_updateCameraToBounds(e,t=!0){e||(e=this._getViewModel().getBoundingBox()),e&&this._cameraControl instanceof z&&(this._getCameraControl().updateToBounds(e,!1,t),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition())}requestDockingsPreview(e,t,n,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(),i&&this.enableDragIn(n),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._getKernelAccess().webGlPreviewDockings(this._configuratorContext,i),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._getKernelAccess().previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){const t=S.start("dock_component_"+e.childId);this._getKernelAccess().dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null,S.end(t)}_onSelectedRuntimeComponentsChange(e){this._getKernelAccess().multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,n=null;e&&(t=e.runtimeId===this._configuratorContext.rootComponentId,n=e.runtimeId),this._getKernelAccess().selectionChange(n,t),e&&this._getKernelAccess().selectedComponent(e.runtimeId)}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(Array.isArray(e)&&0!==e.length&&t&&-1===e.indexOf(t)){switch(this._configuratorContext.selectionMode){case"standard":this.resetCamera(),this._getKernelAccess().requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case"multiselect":this.resetCamera(),this._getKernelAccess().requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds)}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){var n;if(e.runtimeId===this._configuratorContext.rootComponentId){let t=new THREE.Vector3(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,t,null)}void 0===e.geometryChanged||e.geometryChanged?this._renderEverything():this._renderWithoutShadowsAndAO(),null===(n=this._componentDimensioningHelper)||void 0===n||n.invalidateDimensioningsCache(e.runtimeId)}planObjectUpdated(e,t){const n=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId);if(this._configuratorHistory.push(n),e.bounds){if(this._configuratorContext.planObjectId===e.id){const e=this._getViewModel().getBoundingBox();this._updateBounds(e,t)}this._highlightComponent(),this._requestRender()}}componentDeleted(e){-1===this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.runtimeId)&&"multiselect"!==this._sceneEventHandler.getSelectionMode()||this.cancelComponentSelection()}previewConstructionDone(e,t){const n=this._getViewModel().getBoundingBoxWithPreviews();t||(this._cancelDockings(!0,null,!1,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());let i=!0;this._componentRaycastHelper&&(i=!this._componentRaycastHelper.areAllPreviewsVisible(this._getViewModel())),this._configuratorContext.requestPreviewsIsUserInitiated&&i&&this._updateCameraToBounds(n),this._lightSetting&&this._lightSetting.needsBounds()&&(this._lightSetting.updateBounds(n),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new THREE.Vector3(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):t||this._initData.debug||this._initData.moc||this.resetCamera(),this._pixotronUtil&&Promise.all([new Promise(e=>setTimeout(e,3e3)),this._getViewModel().materialQueue.finished(!0)]).then(()=>{this._pixotronUtil.unLockAdapter()}),this._environment&&this._environment.reload()}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks.onComponentPositionsUpdated)return;const e=[];this._getViewModel().getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const n=(new THREE.Box3).setFromObject(t.boundingBoxMesh);let i=this._getKernelAccess().kernelInstance.getComponent(t.runtimeId);const o=i.parameters||i.possibleChildren?["edit"]:[];e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"component",actions:o})}),this._getViewModel().getPreviews().forEach(t=>{const n=(new THREE.Box3).setFromObject(t);e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"preview",actions:["add"]})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}_updateBounds(e,t=!1){if(super._updateBounds(e,t),!e)return;let n=e.getSize(new THREE.Vector3);this._sceneEventHandler.hasSelection()||this._updateCameraToBounds(e,!1),this._sceneEventHandler.update(n,null,null),this._uiIntersectionHelper.updateToBounds(n,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._pixotron&&this._pixotron.getShadowPass().setShadowRecieverBBox(e),this._getCameraControl().getCamera().updateProjectionMatrix()}async moveCamera(e){return this._getCameraControl().moveCamera(e)}selectComponent(e){if(!e)return;const t=this._getViewModel().getComponents().find(t=>t.runtimeId===e);t?this._sceneEventHandler.clickComponent(t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlight(){return this._getViewModel().getNumberOfPossibleChildrenForComponent(this._configuratorContext.rootComponentId)>0}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=M();const n=this._domHelper.getClientDimensions(),i=n.x,o=n.y,s=this._componentFactory.createPerspectiveCamera(30,i/o,.1,20,t);s.layers.set(3),s.layers.enable(1),s.layers.enable(2),s.layers.enable(6),s.layers.enable(5),s.position.copy(new THREE.Vector3(0,.5,5)),this._changeCameraControl(new z(this._creator_,this._getInputManager(),null,s))}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}getBounds(){return this._getViewModel().getBoundingBox()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:1.5},shadowparams:{shadowMapResolution:1024,shadowRadius:1,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:50,side:THREE.FrontSide},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:1,edgeThickness:2}}}sceneChanged(){}_getCameraControl(){return this._cameraControl}_onCameraIdle(){return super._onCameraIdle()}_onCameraMove(){return super._onCameraMove()}getComponent(e){return this._plannerKernelAccess.kernelInstance.getComponent(e)}}return n([i],e.prototype,"_configuratorInputManager",void 0),n([i],e.prototype,"_configuratorUiCallbacks",void 0),n([i],e.prototype,"_configuratorMeshGenerator",void 0),n([i],e.prototype,"_memoryManager",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_componentDimensioningHelper",void 0),n([i],e.prototype,"_configuratorViewModel",void 0),n([i],e.prototype,"_configuratorHistory",void 0),n([i],e.prototype,"_plannerKernelAccess",void 0),e})());const he=(e,t)=>e.sort||t.sort?e.sort?t.sort?e.sort-t.sort:-1:1:0,de=(e,t)=>e&&!t?1:!e&&t?-1:e&&t?e.localeCompare(t):0;e("R",(()=>{class e{constructor(e){this._onInitDoneCollection=[],this._isKernelReady=!1,this._isWebGlReady=!1,this._isPreloadReady=!0,this._isLoadError=!1,this._isReloading=!1,this._needsSync=!1,this._creator_=e,this._configuratorKernelAccessCallback.addListener(this);const t=this._errorHandler;t.subscribe(0,e=>this._configuratorUiCallbacks.onErrorDueToOffline(e)),t.subscribe(1,e=>this._configuratorUiCallbacks.onError(e)),t.subscribe(2,(e,t)=>this._configuratorUiCallbacks.onContentProblem({rapiPath:e,ids:t,message:"Could not load the ids"}))}_isInitDone(){return this._isKernelReady&&this._isWebGlReady&&this._isPreloadReady}_checkInitDone(){this._isInitDone()&&(this._onInitDoneCollection.forEach(e=>e()),this._onInitDoneCollection=[])}_onInitDone(e){this._isInitDone()?e():this._onInitDoneCollection.push(e)}initSceneManager(e){this._sceneManager=e||w.lookup("configurator-scene-manager",this._creator_)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}_loadWebGlLib(e,t){this._threeLoader.fetch().then(()=>Promise.all(W.map(e=>this._scriptLoader.fetch(e,{id:e}))).then(this._loadingWebGlSuccess(e,t).bind(this),this.loadError.bind(this)),this.loadError.bind(this))}_loadingWebGlSuccess(e,t){return()=>{this.initSceneManager(),t&&this._sceneManager.changeOffset(t);const{initialFloorMaterial:e,dls:n,ls:i,stats:o}=this._initData,s=E.createDynamicLightSettingSource(n,i);o&&this.showStats(),this._enableHD(s),this._needsSync&&(this._needsSync=!1,this._plannerKernelAccess.requestSync(D,this._configuratorContext.planObjectId));const r=[this._scriptLoader.fetch(N,{id:"tween-js"})];e&&r.push(this._rapiAccess.getMaterial(e).then(e=>this._sceneManager.changeFloorMaterial(e))),Promise.all(r).then(this._webGlIsReady.bind(this),this.loadError.bind(this))}}_webGlIsReady(){this._isWebGlReady=!0,this._checkInitDone()}_initPromiseCallback(e,t){this._isInitDone()?e():this._isLoadError?t("_initPromiseCallback failed"):(this._onInitDone(()=>e()),this._rejectOnLoadError=t)}_notifyOnConfigurationReady(e){return async t=>{const n=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t.partList,t.hash);t.partList=n,e(t),this._configuratorUiCallbacks.onConfigurationReady(n,t.hash,t.rootComponentLabel)}}_notifyOnConfigurationLoadingError(e){return t=>{this._configuratorUiCallbacks.onConfigurationLoadError(),e(t)}}_loadItemOrConfigById(e,t){this._configuratorContext.lastLoadedRapiId=e,this._onLoadConfiguration(),this._preloadPackage(e),this._clearScene();const{offlineSync:n}=this._initData;if(n){const t=R(e);t&&this._dataSyncer.start(t)}return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(t=>{t&&t.configuration?this._loadConfiguration(t.configuration).then(e=>{const i=this._notifyOnConfigurationReady(n);t.label?this._notifyUiAboutNewItem(t,e.rootComponentLabel):this._notifyUiAboutNewConfiguration(t),i(e)},this._notifyOnConfigurationLoadingError(i).bind(this)):i(new Error("Could not load item or config with id "+e))},i)})}_shouldBroadcastToUi(e){return!(0===e&&this._configuratorContext.selectedRuntimeComponentId||1===e&&!this._configuratorContext.selectedRuntimeComponentId||2===e&&!this._configuratorContext.selectedRuntimeComponentIds.length)}_isCorrectResponse(e,t){if(0===e)return t===this._configuratorContext.planObjectId;if(1===e)return t===this._configuratorContext.selectedRuntimeComponentId;const n=t.length;if(n!==this._configuratorContext.selectedRuntimeComponentIds.length)return!1;for(let e=0;e<n;e++)if(t[e]!==this._configuratorContext.selectedRuntimeComponentIds[e])return!1;return!0}_onLoadConfiguration(){this._clearScene(),this._configuratorUiCallbacks.onLoadConfiguration()}_clearScene(){this._sceneManager&&this._sceneManager.clearScene()}_notifyUiAboutNewItem(e,t){this._rapiAccess.getCatalog(e.catalog).then(n=>this._configuratorUiCallbacks.onConfigurationLabelChange(n.name,e.label,t))}_notifyUiAboutNewConfiguration(e){Promise.all([this._rapiAccess.getCatalog(e.catalog),this._rapiAccess.getComponent(e.rootComponentId)]).then(([e,t])=>this._configuratorUiCallbacks.onConfigurationLabelChange(e.name,null,t.label))}notifyUiAboutNewLabel(e){if(O(e)){const t=this._rapiAccess.peekItem(e),n=this._rapiAccess.peekComponent(t.rootComponentId);this._notifyUiAboutNewItem(t,n.label)}else this._notifyUiAboutNewConfiguration(this._rapiAccess.peekConfiguration(e))}_getMaterialGroups(e){const t=(e,t)=>{let n=he(e,t);return 0!==n?n:(n=de(e.label,t.label),0!==n?n:de(e.id,t.id))},n=e=>(e.sort(t),e.forEach(e=>e.materials.sort(t)),e);if(e.validGroups.length>0)return new Promise((t,i)=>this._rapiAccess.getMaterialsByGroup(e.validGroups).then(e=>t(n(e)),i));const i=[];return e.validValues.forEach(e=>i.push(e.value)),new Promise((e,t)=>{this._rapiAccess.getMaterials(i).then(t=>{this._rapiAccess.combineMaterialsToGroups(t).then(t=>{e(n(t))})},t)})}_loadConfiguration(e){return this._plannerKernelAccess.externalMeshQueue.clear(),new Promise((t,n)=>{const i=()=>{const{x:i,y:o}=this._domHelper.getClientDimensions();if(i<=0&&o<=0){let e="Size of canvas is 0/0! When using embedding set correct size or remove id to load in idle mode!";return console.error(e),n(e)}this.resumeKernelCallbacks(),S.start("ui_load_configuration");const s=[];if(this._initData.applyCurrentGlobalParameters){const e=this._configuratorContext.planObjectId,t=this._configuratorContext.rootComponentParametersAsGlobal;s.push(this._plannerKernelAccess.getGlobalParameters(e,t))}Promise.all(s).then(([i])=>{const o=[k.waitFor(4),k.waitFor(2)];Promise.all(o).then(([e,[n,o,s,r]])=>{const a=[];i&&this._initData.applyCurrentGlobalParameters&&i.forEach(e=>a.push(this.setParameter(e,e.value,!0)));const l=this._rapiAccess.peekComponent(r);Promise.all(a).then(()=>{const n=[];a.length&&(n.push(this._plannerKernelAccess.getPartList()),n.push(this._plannerKernelAccess.getConfigurationHash(this._configuratorContext))),Promise.all(n).then(async n=>{const i=n&&n[0]?n[0]:o,r=n&&n[1]?n[1]:s,a=await this._plannerKernelAccess.addUiDataAndPriceToPartList(i,r);let c=e.errors;const h=c?A(c):[];t({partList:a,hash:r,rootComponentLabel:l?l.label:"",errors:h})})})},n),this._plannerKernelAccess.loadConfiguration(e)},n)};this._onInitDone(()=>i())})}_preLoadItemOrConfig(e,t){return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(n,i)})}_preloadPackage(e){this._isPreloadReady=!1;let t=null;t=O(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),S.start("rapi_preloads");const n=()=>{S.end("rapi_preloads");const t=S.getMeasure("rapi_preloads");if(Array.isArray(t)&&1===t.length){const n=t[0];this._configuratorUiCallbacks.onTrackTiming("Timing","RapiPreloads",Math.round(n.duration),{id:e})}};t(e).then(()=>{this._isPreloadReady=!0,this._checkInitDone(),n()},e=>{this._isPreloadReady=!0,this._checkInitDone(),console.error(e),n()})}_reloadConfiguration(e,t,n,i){return this._performLoadConfiguration(e).then(e=>{this._isReloading=!1,n(e)},e=>{this._isReloading=!1,i(e)})}_performLoadConfiguration(e){return this._onLoadConfiguration(),new Promise((t,n)=>{this._initData.preloadHint?this._preloadPackage(this._initData.preloadHint):console.warn("When loading a configuration string you have to supply a preloadHint to use fast loading!"),setTimeout(()=>{this._loadConfiguration(e).then(this._notifyOnConfigurationReady(t).bind(this),this._notifyOnConfigurationLoadingError(n).bind(this))},0)})}_changeHDGeometry(e){return new Promise((t,n)=>e===x.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,k.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,t,n)},n),x.useHDGeometry=e,void this._plannerKernelAccess.changeUseOfHDGeometry(this._configuratorContext,x.useHDGeometry)))}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}init(e,t){this.setOverrides(t);const{preloadHint:n,offset:i,startTag:o}=this._initData;return this._domHelper.setDomElement(e),n?this._preloadPackage(n):console.warn("No preload hint! Therefore no preload during init!!"),o&&this.getTagById(o,{include:["items"]}).then(e=>this._configuratorUiCallbacks.onOpenTag(e),e=>console.error(e)),this._loadWebGlLib(e,i),new Promise(this._initPromiseCallback.bind(this))}cancelSelection(){this._sceneManager.cancelComponentSelection()}enableHDGeometry(){return this._changeHDGeometry(!0)}disableHDGeometry(){return this._changeHDGeometry(!1)}changeOffset(e){this._sceneManager.changeOffset(e)}previewDockings(e,t,n){this._sceneManager.requestDockingsPreview(!0,e,t,n)}cancelDockings(){this._sceneManager.cancelDockings()}requestDeleteComponent(){this._sceneManager.requestDeleteSelectedComponent()}renderImage(e){return this._sceneManager.renderImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}preparePartImage(e,t){let n={};return"number"==typeof t?n.size=t:(t||(t={}),"number"!=typeof t.size&&(t.size=256),n=t),this._sceneManager.preparePartImage(e,n)}saveCurrentConfiguration(){return new Promise((e,t)=>{this._plannerKernelAccess.getConfigurationData(this._configuratorContext.planObjectId).then(n=>{this._rapiAccess.saveConfiguration(n).then(n=>{this._configuratorUiCallbacks.onConfigurationSaved(n.configurationHash),this._rapiAccess.getComponent(n.rootComponentId).then(i=>{let o=!0,s=!0,r=n.perspectiveImage,a=n.topImage;n.perspectiveImage||(o=!1,this._sceneManager.preparePerspectiveImage().then(l=>{this._rapiAccess.savePerspectiveImage(n,l).then(t=>{o=!0,r=t.perspectiveImage,s&&(t.label=i.label,t.topImage=a,e(t))},t)})),n.topImage||(s=!1,this._sceneManager.prepareTopImage().then(l=>{this._rapiAccess.saveTopImage(n,l).then(t=>{s=!0,a=t.topImage,o&&(t.label=i.label,t.perspectiveImage=r,e(t))},t)})),o&&s&&(n.label=i.label,e(n))},e=>{throw new Error(e)})},t)}).catch(t)})}generateImagesOfCurrentConfiguration(){return new Promise((e,t)=>this.saveCurrentConfiguration().then(t=>e({topImage:t.topImage,perspectiveImage:t.perspectiveImage,isLocally:t.isLocally}),t))}prepareTopImage(e){let t={};return"boolean"==typeof e?t.showDimensions=e:(e||(e={}),"boolean"!=typeof e.showDimensions&&(e.showDimensions=!1),t=e),this._sceneManager.prepareTopImage(t)}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}showBenchmarks(e){S.showBenchmarks(e)}debugSceneGraph(e){this._sceneManager.debugSceneGraph(e)}async loadConfiguration(e,t){this.setOverrides(t),this._configuratorContext.lastLoadedRapiId=null,this._sceneManager&&this._sceneManager.clearScene();const n=await this._performLoadConfiguration(e);return this._rapiAccess.trackView("configuration string"),n}async loadConfigurationById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!0);return this._rapiAccess.trackView(e),n}syncPlanObjectToView(e,t){this.resumeKernelCallbacks(),this._plannerKernelAccess.requestSync(e,t),this._plannerKernelAccess.requestPlanObjectConstruction(t);const n=this._plannerKernelAccess.getSerializedConfiguration(t),i=this._plannerKernelAccess.getCurrentConfigurationHash(t);this._plannerKernelAccess.planObjectConfigurationUpdated(t,n,i),this._sceneManager.resetCameraPositionToStart(!1)}async loadConfigurableItemById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!1);return this._rapiAccess.trackView(e),n}preLoadConfigurationById(e){return this._preLoadItemOrConfig(e,!0)}preLoadConfigurableItemById(e){return this._preLoadItemOrConfig(e,!1)}_getTag(e){return this._rapiAccess.getTag(e)}_dispatchSetParameter(e,t,n,i,o){const s=this._configuratorContext.selectedRuntimeComponentId?"local":"global",r=S.start("kernel_change_param_"+s+"_"+e);switch(this._configuratorContext.selectionMode){case"standard":if(this._configuratorContext.selectedRuntimeComponentId||this._configuratorContext.rootComponentParametersAsGlobal){let s=this._configuratorContext.selectedRuntimeComponentId?this._configuratorContext.selectedRuntimeComponentId:this._configuratorContext.rootComponentId;this._plannerKernelAccess.changeComponentParameter(s,e,t,n,i,o)}else this._plannerKernelAccess.changePlanObjectParameter(this._configuratorContext.planObjectId,e,t,n,i,o);break;case"multiselect":this._plannerKernelAccess.changeCommonComponentParameter(this._configuratorContext.selectedRuntimeComponentIds,e,t,n,i,o)}S.end(r)}setParameter(e,t,n=!1){return new Promise((i,o)=>{const{key:s,type:r}=e;if(L(e)){if(!n&&!this._unitFormatter.isParseableUnitString(t,e))return o(new SyntaxError('Value "'+t+'" is not parseable'));const i=n?t:this._unitFormatter.parseValue(t,e),{valueFrom:s,valueTo:a}=e.validRange,l=this._unitFormatter.getAllowedDelta();if(!Number.isNaN(s)&&i<s-l)return o(new RangeError('Value "'+t+'" is too small, min-val "'+s+'"'));if(!Number.isNaN(a)&&i>a+l)return o(new RangeError('Value "'+t+'" is too big, max-val "'+a+'"'));t="Integer"===r&&"number"==typeof i?i.toFixed():i.toString()}this._sceneManager.cancelDockings(),this._dispatchSetParameter(s,r,t,i,o)})}setParameterOfPlanObject(e,t){return new Promise((n,i)=>{const{planObjectId:o,rootComponentId:s,rootComponentParametersAsGlobal:r}=this._configuratorContext,{type:a,key:l}=e;r?this._plannerKernelAccess.changeComponentParameter(s,l,a,t,n,i):this._plannerKernelAccess.changePlanObjectParameter(o,l,a,t,n,i)})}getParametersOfPlanObject(){const{planObjectId:e,rootComponentParametersAsGlobal:t}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,t)}setParameterOfRootComponent(e,t){return new Promise((n,i)=>{const{rootComponentId:o}=this._configuratorContext,{type:s,key:r}=e;this._plannerKernelAccess.changeComponentParameter(o,r,s,t,n,i)})}getParametersOfRootComponent(){const{planObjectId:e}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,!0)}enableMultiselect(){this._sceneManager.setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneManager.setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}getCurrentConfiguration(){return k.waitFor(1,()=>this._plannerKernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return k.waitFor(0,()=>{let t=null;try{if(t=JSON.parse(e).id,!t)throw new Error("Component string has no ID")}catch(e){return this._configuratorUiCallbacks.onContentProblem({rapiPath:"components",ids:[t],message:"Component string is not a valid JSON or has no ID"}),void k.failOperation(0,e)}this._kernelIo.setMeta({componentId:t}),this._plannerKernelAccess.loadComponentIntoKernel(e,t)})}getShortUrlOfCurrentConfiguration(){return new Promise((e,t)=>{this.saveCurrentConfiguration().then(n=>navigator.onLine?this._rapiAccess.getShortUrl(n.id,3).then(t=>{const n=t.shortId,i=y.APP.SHORTENER_URL+n;e(i)},t):t("Can not generate short url when offline"),t)})}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}getTagById(e,t){return new Promise((n,i)=>{this._getTag(e).then(e=>{let o=Promise.resolve([]),s=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(o=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(s=this._rapiAccess.getItems(e.items))}),Promise.all([o,s]).then(([t,i])=>(i.sort(he),t.sort(he),n({...e,items:i,materials:t})),i)},i)})}requestAsset(e){return this._dataSyncer.requestAsset(e)}changeFloorMaterial(e){return this._sceneManager.changeFloorMaterial(e)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._sceneManager.changeFloorMaterial(t)}openFloorMaterials(){this._configuratorUiCallbacks.onOpenFloorMaterials()}openPartList(){this._configuratorUiCallbacks.onOpenPartList()}getAdditionalContentsOf(e){return this._rapiAccess.getAdditionalContentsOfItems(e)}changeTypeChangeTag(e){navigator.onLine&&this._initData.offlineSync&&this._dataSyncer.syncTypeChangeTag(e),this._configuratorUiCallbacks.onChangeTypeChangeTag(e)}removeTypeChangeTag(e){this._configuratorUiCallbacks.onRemoveTypeChangeTag(e)}showGUI(){this._sceneManager.showGUI()}showStats(){this._sceneManager.showStats()}showDimensions(){this._sceneManager.showDimensions()}hideDimensions(){this._sceneManager.hideDimensions()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}syncFloorTag(e){return this._dataSyncer.syncFloorTag(e)}syncTypeChangeTag(e){return this._dataSyncer.syncTypeChangeTag(e)}loadDynamicLightSetting(e){return this._sceneManager.loadDynamicLightSetting(e)}setBackgroundColor(e){this._sceneManager.setBackgroundColor(e)}setBackgroundImage(e){this._sceneManager.setBackgroundImage(e)}setBakedShadow(e,t){this._sceneManager.setBakedShadow(e,t)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}enableMeshSelection(e){this._initData.meshSelection=e}updateSize(){this._sceneManager.updateCamera()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}getMain(){}cleanup(e={}){this._configuratorContext.selectedRuntimeComponentIds=[],this._plannerKernelAccess.cleanUpCallbacks(),this._sceneManager.sceneCleared(!!e.resetMeshCache),e.resetCoreCache&&this._plannerKernelAccess.kernelInstance.clearAll(),e.resetApiCache&&this._rapiAccess.cleanUp()}resumeTest(e){e&&this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}zoomIn(e){this._sceneManager.zoomIn(e)}zoomOut(e){this._sceneManager.zoomOut(e)}get callbacks(){return this._configuratorUiCallbacks}get globalCallbacks(){return this._globalCallback}getRuntimeComponentIdOfRootComponent(){const e=this._configuratorContext.planObjectId;return e?this._plannerKernelAccess.getRuntimeComponentIdOfRootComponent(e):(console.warn("planObjectId not set"),0)}getCurrentConfigurationHash(){return this._plannerKernelAccess.getConfigurationHash(this._configuratorContext)}getCurrentSelection(){let e=this._configuratorContext.selectedRuntimeComponentIds;return e&&e.length||(e=[this._configuratorContext.rootComponentId]),e.map(e=>this._plannerKernelAccess.getRuntimeComponentId(e))}_enableHD(e){return new Promise((t,n)=>{this._scriptLoader.fetch(Q,{id:"pi-js"}).then(()=>{this._sceneManager.enableHD(e),t()},n)})}isReady(){const e=S.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=S.getMeta("kernel_is_ready");this._configuratorUiCallbacks.onTrackTiming("Timing","KernelIsReady",Math.round(t.duration),Object.assign(n,{startTime:t.startTime}))}this._isKernelReady=!0,this._checkInitDone(),"function"==typeof this._configuratorUiCallbacks.onKernelIsReady&&this._configuratorUiCallbacks.onKernelIsReady()}async updatePossibleChildren(e,t,n){const i=await this._addAdditionalInfoToPossibleChildren(e,t,n);if(i){const{tags:e,defaultChild:t}=i;this._shouldBroadcastToUi(n)&&this._configuratorUiCallbacks.onUpdatePossibleChildren(e,t)}}updateParameters(e,t,n,i){this._addGroupsToParameters(n,e,t,i),this._shouldBroadcastToUi(i)&&this._configuratorUiCallbacks.onUpdateParameters(e)}loadError(e){this._isLoadError=!0,this._rejectOnLoadError&&this._rejectOnLoadError(e)}resumeKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!1,this._plannerKernelAccess.resume()}pauseKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!0,this._plannerKernelAccess.pause()}setActiveGroupInView(e){this._plannerKernelAccess.setActiveGroupInView(e)}getParameterGroups(){return this._plannerKernelAccess.getParameterGroups()}async getConfiguratorSettings(e){return this._rapiAccess.getConfiguratorSettings(e)}async moveCamera(e){return this._sceneManager.moveCamera(e)}selectComponent(e){return this._configuratorContext.selectedRuntimeComponentId===e?Promise.resolve():Promise.resolve(this._sceneManager.selectComponent(e))}setComponentParameter(e,t,n){const{key:i,type:o}=t;return new Promise((t,s)=>this._plannerKernelAccess.changeComponentParameter(e,i,o,n,t,s))}highlightParts(e){this._sceneManager.highlightParts(e)}undo(){const e=this._configuratorHistory.undo();e&&this._plannerKernelAccess.loadConfiguration(e)}redo(){const e=this._configuratorHistory.redo();e&&this._plannerKernelAccess.loadConfiguration(e)}clearHistory(){this._configuratorHistory.clearHistory()}getHashOfSerializedConfiguration(e){return this._plannerKernelAccess.kernelInstance.getHashOfSerializedConfiguration(e)}getParametersOfComponent(e){const t=this._plannerKernelAccess.kernelInstance.getComponentParameters(e),n=this.getParameterGroups();return this._addGroupsToParameters(e,t,n,1)}_addGroupsToParameters(e,t,n,i){n||(n=[],console.warn("Kernel returned no parameter groups! Check why!"));const o={};return n.forEach(e=>{o[e.key]=e}),t.sort(he),t.forEach(t=>{t.group?t.grouping=o[t.group]:t.grouping=null,this._unitFormatter.formatParameter(t),T(t)&&Object.defineProperty(t,"groups",{get:()=>new Promise((n,o)=>{this._getMaterialGroups(t).then(t=>{this._isCorrectResponse(i,e)&&this._shouldBroadcastToUi(i)?n(t):o("Response does not match to ids")},o)})})}),t}async getPossibleChildrenOfComponent(e){const t=this._plannerKernelAccess.kernelInstance.getPlanComponentPossibleChildren(e);return await this._addAdditionalInfoToPossibleChildren(e,t,2,!1)}async _addAdditionalInfoToPossibleChildren(e,t,n,i=!0){const{possibleChildren:o,defaultChild:s}=await this._getPossibleChildrenForKernelPossibleChildren(t),r=[],a=new Map,l=[];if(o.forEach(e=>{const t=e.tags;if(e.tags&&Array.isArray(e.tags)&&e.tags.length)for(let n=0,i=e.tags.length;n<i;n++){const i=t[n];-1===r.indexOf(i)&&r.push(i);let o=a.get(i);if(!o){const e=[];a.set(i,e),o=a.get(i)}o.push(e)}else l.push(e)}),this._isCorrectResponse(n,e)||!i){let e;try{e=await this._rapiAccess.getTags(r)}catch(e){console.error("Couldnt load tags of possible children"),console.error(e)}return e.forEach(e=>{e.possibleChildren=a.get(e.id)}),e.sort(he),l.length&&e.unshift({id:"",externalIdentifier:"",global:!1,created:(new Date).toISOString(),updated:(new Date).toISOString(),language:this._globalInitData.locale,catalog:null,tags:[],parents:[],materials:[],items:[],possibleChildren:l}),{tags:e,defaultChild:s}}return null}async _getPossibleChildrenForKernelPossibleChildren(e){const t=[],n=[];let i;const o=new Map,s=new Map;e.forEach(e=>{if(!e.possible)return;let r=e.itemId;e.itemId?(n.push(e.itemId),s.set(e.itemId,e)):(t.push(e.componentId),o.set(e.componentId,e),r=e.componentId),e.isDefault&&!i&&(i=r)});const r=await Promise.all([this._rapiAccess.getComponents(t),this._rapiAccess.getItems(n)]),a=r[0],l=r[1],c=[];let h=null;return a.forEach(e=>{e.isItem=!1,e.isComponent=!0;const t=o.get(e.id);t&&(e.group=t.group),e.id===i&&(e.isDefault=!0,h=e),c.push(e)}),l.forEach(e=>{e.isItem=!0,e.isComponent=!1;const t=s.get(e.id);t&&(e.group=t.group),e.id===i&&(e.isDefault=!0,h=e),c.push(e)}),c.sort(he),{possibleChildren:c,defaultChild:h}}getUnitFormatter(){return this._unitFormatter}getComponent(e){return this._sceneManager.getComponent(e)}}return n([i],e.prototype,"_rapiAccess",void 0),n([i],e.prototype,"_dataSyncer",void 0),n([i],e.prototype,"_errorHandler",void 0),n([i],e.prototype,"_unitFormatter",void 0),n([i],e.prototype,"_domHelper",void 0),n([i],e.prototype,"_configuratorUiCallbacks",void 0),n([i],e.prototype,"_configuratorKernelAccessCallback",void 0),n([i],e.prototype,"_lifeCycleManager",void 0),n([i],e.prototype,"_plannerKernelAccess",void 0),n([i],e.prototype,"_threeLoader",void 0),n([i],e.prototype,"_scriptLoader",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_initData",void 0),n([i],e.prototype,"_globalInitData",void 0),n([i],e.prototype,"_globalCallback",void 0),n([i],e.prototype,"_kernelIo",void 0),n([i],e.prototype,"_configuratorHistory",void 0),e})())}}}));
2
- //# sourceMappingURL=roomle-configurator-442a410a.nomodule.js.map
@@ -1,2 +0,0 @@
1
- import{_ as __decorate,i as inject,C as ConfiguratorViewModel,u as ConfiguratorPlanObjectViewModel,S as StaticPlanObjectViewModel,W as WallPlanElementViewModel,F as FloorPlanElementViewModel,w as CeilingPlanElementViewModel,x as kernelBoxToThreeBox,P as PlannerKernelAccess,E as EventDispatcher,y as vectorIsZero,z as disposeMesh,G as convertToKernel,t as toRadiant,H as getScreenXY,l as getGUI,e as toDegrees,J as CANVAS_ID,K as Env,b as RoomleDependencyInjection,o as DynamicLightSettingLoader,N as PREDEFINED_LIGHTSETTING,n as dispose,O as getYRotationOfObject,B as Benchmark,q as RoomleComponentFactoryInitializer,Q as DEFAULT_CONVERSATION_ID,T as getCatalogIdFromItemOrConfigurationId,U as isIdItemId,A as AppContext,V as AsyncHelper,X as isRange,Y as isMaterial,Z as convertCObject}from"./roomle-dependency-injection-fe719e2d.js";import{b as deepMerge,l as callAgainAfter,d as debounce}from"./main-thread-to-worker-0c7d537f.js";import{L as LightSetting,b as SceneManager,B as BakedShadowEnvironment,c as BackgroundEnvironment,C as CameraControl3D,F as FloorEnvironment,P as PIXOTRON_EFFETCS,T as TWEEN_FILE_NAME,d as PIXOTRON_FILE_NAME}from"./pixotron-d48cdf07.js";import{D as DefaultLightSetting}from"./default-light-setting-0ce92cb9.js";var GLTF_EXPORTER_FILE_NAME="static/GLTFExporter-86edae059df3a219.js";let PlanViewModel=(()=>{class e extends ConfiguratorViewModel{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._constructionGroup=new THREE.Group,this._constructionGroup.name="Construction",this._ceilingGroup=new THREE.Group,this._ceilingGroup.name="Ceiling",this._floorGroup=new THREE.Group,this._ceilingGroup.name="Ceiling",this._getKernelAccess().addPlannerListener(this)}planBoundsChanged(){}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null,super.clearReference()}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof ConfiguratorPlanObjectViewModel?this._configurablePlanObjectViewModels.push(e):e instanceof StaticPlanObjectViewModel?(this._staticPlanObjectViewModels.push(e),"door"!==e.getPlanObject().getObjectType()&&"window"!==e.getPlanObject().getObjectType()&&this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof WallPlanElementViewModel?(this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView("2D"===this._cameraType),this._wallPlanObjectViewModels.push(e),this._constructionGroup.add(e.getContainer())):e instanceof FloorPlanElementViewModel?this._floorGroup.add(e.getContainer()):e instanceof CeilingPlanElementViewModel&&this._ceilingGroup.add(e.getContainer())}_addRootComponent(e){const t=this._getPlanObjectViewModelForRuntimeId(e.parentObjectId);t&&t instanceof ConfiguratorPlanObjectViewModel&&(t.addRootComponent(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(t),t.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getPlanObjectForId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),this._staticPlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),t}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getFloorGroup(){return this._floorGroup}getBoundingBox(){if("configurator"===this._configuratorContext.baseContext){const e=this.getPlanObjectForId(this._configuratorContext.planElementId);if(e)return e.getBounds()}if("glb-viewer"===this._configuratorContext.baseContext){const e=this._plannerSceneEventHandler.getSelectedIds();if(e&&1===e.length){const t=this.getPlanObjectForId(e[0]);if(t)return t.getBounds()}}const e=this.getCorePlan();if(e)try{return kernelBoxToThreeBox(e.getBounds())}catch(e){console.error(e)}return(new THREE.Box3).setFromObject(this._constructionGroup)}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}sceneCleared(){this._configurablePlanObjectViewModels.forEach(e=>{e.remove()}),this._staticPlanObjectViewModels.forEach(e=>{e.remove()}),this._wallPlanObjectViewModels.forEach(e=>{e.remove()}),super.sceneCleared()}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getConfigurablePlanObjectViewModels(){return this._configurablePlanObjectViewModels}getWallPlanObjectViewModels(){return this._wallPlanObjectViewModels}_generateMesh(e=0,t=null,n,i,o,s,r,a,c){return this._plannerMeshGenerator.generateMesh(e,t,n,i,o,s,r,a,c)}_setMaterial(e,t,n){this._plannerMeshGenerator.setMaterial(e,t)}Editor3dComponentCreated(e,t,n,i,o){super.Editor3dComponentCreated(e,t,n,i,o),this._getKernelAccess()instanceof PlannerKernelAccess&&this.dockComponent(e,i,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,i,o,s,r){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){}addMesh(e,t,n,i,o,s){const r=e.extRef.jsObject;let a=r.getMesh(t);a?a.geometry=this._plannerMeshGenerator.generateGeometry(null,n,i,o,s):(a=this._generateMesh(0,null,t,n,i,o,s,e.getType()),r.addMesh(a))}removePlanObjectFromScene(e){const t=e.getPlanElement().getType();this._isConstructionType(t)?this._constructionGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.FLOOR?this._floorGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.CEILING&&this._ceilingGroup.remove(e.getContainer()),e.clear()}_isConstructionType(e){return e===this._getKernelAccess().kernelContainer.PlanElementType.WALL||e===this._getKernelAccess().kernelContainer.PlanElementType.NODE}planElementRemoved(e){if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.OBJECT){let t=e;if(t.hasConfiguration()){const e=t.extRef.jsObject,n=this._configurablePlanObjectViewModels.indexOf(e);n>-1&&this._configurablePlanObjectViewModels.splice(n,1)}else{const e=t.extRef.jsObject,n=this._staticPlanObjectViewModels.indexOf(e);n>-1&&this._staticPlanObjectViewModels.splice(n,1)}}if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.WALL){const t=e.extRef.jsObject,n=this._wallPlanObjectViewModels.indexOf(t);n>-1&&this._wallPlanObjectViewModels.splice(n,1)}}getMeshGenerator(){return this._plannerMeshGenerator}componentConfigurationUpdated(e,t){super.componentConfigurationUpdated(e,t),this._roomlePlannerUiCallback.onPlanElementChanged()}hideAllExcept(e){this._ceilingGroup.visible=!1,this._floorGroup.visible=!1,this._constructionGroup.visible=!1,this._staticPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurablePlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)})}showAll(){this._ceilingGroup.visible=!0,this._floorGroup.visible=!0,this._constructionGroup.visible=!0,this._staticPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurablePlanObjectViewModels.forEach(e=>e.getContainer().visible=!0)}planHistoryStateChanged(){}setCameraType(e){this._cameraType=e,this._wallPlanObjectViewModels.forEach(e=>e.setTopView("2D"===this._cameraType))}}return __decorate([inject],e.prototype,"_plannerMeshGenerator",void 0),__decorate([inject],e.prototype,"_roomlePlannerUiCallback",void 0),e})();const ROTATION_TO_DETECT_SIDE=toRadiant(30);class RaycastHelper extends EventDispatcher{constructor(e,t,n,i){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===i?1:i,this._scene=e,this._camera=t,this._raycaster=new THREE.Raycaster,this._raycaster.layers.disableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(e){this._raycaster.layers=e}getLayers(){return this._raycaster.layers}_addInputListeners(e){e.addEventListener(3,e=>{this._findCandidate(e.positionRelative)},this),e.addEventListener(5,e=>{this._findSelection(e.positionRelative)},this),e.addEventListener(6,e=>{this._findHover(e.positionRelative,e.type)},this),e.addEventListener(0,e=>{this._onDragStart(e.positionRelative)},this),e.addEventListener(1,e=>{this._onDrag(e.positionRelative)},this),e.addEventListener(2,e=>{this._onDragEnd(e.positionRelative)},this),e.addEventListener(9,e=>{this._onRotate(e.positionRelative,e.rotation)},this),e.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(e){this._intersection(e)&&this._inputManager.onElementHit()}_findSelection(e){let t=this._intersection(e);t?t&&t.object.dispatchEvent({type:"select"}):this.dispatchEvent(3)}_findHover(e,t){const n=this._intersection(e);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:t}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:t}})))}_intersection(e){const t=this._intersect(e);if(t.length<=0)return null;let n=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(e=>{e.object.id===this._currentHover.id&&e.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=e.object.userData.priority&&(n=e)}),n}_intersect(e){this._raycaster.setFromCamera(e,this._camera);const t=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{const n=this._findObjectWithHandler(e.object);n&&(e.object=n,t.push(e))}),t.length>=0?t.sort((e,t)=>e.object.userData.priority!==t.object.userData.priority?t.object.userData.priority-e.object.userData.priority:e.distance-t.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag)return;if(t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(e,this._camera);let t,n=new THREE.Vector3(0,0,-5);if(this._raycaster.ray.intersectPlane(this._planeBottom,n),0===this._mode){const e=this._scene.children.find(({type:e,name:t})=>"Group"===e&&"Construction"===t);if(e){const t=this._raycaster.intersectObjects(e.children,!0);if(t.length){const e=t[0].point.clone();return void this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}}t=n.clone(),t.y=this._currentDrag.parent.position.y}else t=this._getIntersectionPosition(n),t.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:t}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),n=this._camera.userData.yaw,i=new THREE.Vector3(0,0,0),o=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,i),this._raycaster.ray.intersectPlane(this._planeSide,o);let s,r=this._getDistanceToCamera(o),a=this._getDistanceToCamera(i);return n>=-ROTATION_TO_DETECT_SIDE&&n<=ROTATION_TO_DETECT_SIDE?s=t<a?e.clone():i.clone():t<a&&t<r?s=e.clone():a<t&&a<r?s=i.clone():r<t&&r<a&&(s=o.clone()),s}_getDistanceToCamera(e){let t=e.clone().sub(this._camera.position).length();return vectorIsZero(e)&&(t=Number.POSITIVE_INFINITY),t}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let t=this._intersection(e);if(!t)return;this._currentRotate=t.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-e.boundingBox.getSize(new THREE.Vector3).x+e.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(e.getWorldQuaternion(new THREE.Quaternion)))}update(e,t,n){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),n){this._backgroundScene=n;let e=this._backgroundScene.children[0];e instanceof THREE.Mesh&&e.geometry.computeBoundingBox()}}clear(){this._currentDrag&&disposeMesh(this._currentDrag),this._currentHover&&disposeMesh(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setScene(e){this._scene=e}setMode(e){this._mode=e}intersectMouseOnScene(e){const t=new THREE.Plane,n=new THREE.Vector3;return n.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(n,this._scene.position),this._raycaster.setFromCamera(e.positionRelative,this._camera),convertToKernel(this._raycaster.ray.intersectPlane(t,new THREE.Vector3))}}class SceneEventHandler extends EventDispatcher{constructor(e,t,n,i){super(),this._debug=!1,this._dragIn=!1,this._inputManager=i,this._raycastHelper=new RaycastHelper(t,n,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}}class SceneEventInfo{constructor(e){const{component:t,preview:n,resetCamera:i,consecutive:o,type:s,forceRender:r}=e;this.component=t,this.preview=n,this.resetCamera=void 0===i||i,this.consecutive=void 0===o||o,this.type=s||0,this.forceRender=void 0!==r&&r}}let ConfiguratorSceneEventHandler=(()=>{class e extends SceneEventHandler{constructor(e,t,n,i){super(e,t,n,i),this._cameraMoving=!1,this._raycastHelper.addEventListener(3,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(0,({component:e,consecutive:t})=>{this.dispatchEvent(8,new SceneEventInfo({component:e,consecutive:t})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new SceneEventInfo({component:e,resetCamera:t}))},this),this._addInputListeners(this._inputManager)}disable(){const e=new THREE.Layers;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}enable(){const e=new THREE.Layers;e.enable(4),e.enable(5),e.enable(7),e.enable(8),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}_addInputListeners(e){e.addEventListener(7,e=>this._interaction(),this),e.addEventListener(8,e=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:2,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.runtimeId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,n){t.userData.hasListener||(Object.assign(t.userData,n),t.addEventListener("select",()=>this.clickComponent(e)),t.addEventListener("hover_on",t=>this._hoverOn(e,t.attachment.type)),t.addEventListener("hover_off",t=>this._hoverOff(e,t.attachment.type)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData=deepMerge(t.userData,{hasListener:!0,priority:3,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreview(e)),t.addEventListener("hover_on",()=>this._hoverOnPreview(e)),t.addEventListener("hover_off",()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData=deepMerge(t.userData,{hasListener:!0,priority:4,roomleId:e.runtimeId}),t.addEventListener("select",()=>this._clickPreviewLine(e)),t.addEventListener("hover_on",t=>this._hoverOnPreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_move",t=>this._hoverMovePreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_off",()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new SceneEventInfo({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new SceneEventInfo({preview:e}))}clickComponent(e){this._debug&&e.runtimeId,this._selectionHandler.check(e)}_clickOutside(){this._selectionHandler.cancelSelection(),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new SceneEventInfo({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.runtimeId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new SceneEventInfo({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e}_hoverOffPreview(e){e.hoverOff(),this._interaction(!0),this._hoveredPreview=null}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let n=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=n,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(n))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){this._draggedComponent.traverse(t=>{if(t instanceof THREE.Mesh){const n=t;e&&void 0!==n.castShadowOld?(n.receiveShadow=n.receiveShadowOld,n.castShadow=n.castShadowOld):(n.receiveShadowOld=t.receiveShadow,n.castShadowOld=t.castShadow,n.receiveShadow=!1,n.castShadow=!1)}})}_dragStart(e){e&&(this._selectionHandler.isSelected(e)||this.isDragIn())&&(this._dragStartPosition=e.position.clone(),this._dragStartRotation=e.rotation.clone(),this._draggedComponent=e,this._setDragComponentShadow(!1),this.dispatchEvent(4,new SceneEventInfo({component:e})),this._interaction())}_drag(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(e&&!this._draggedComponent&&(this._draggedComponent=e),this._previewLineIntersection){let e=this._hoveredPreview,t=e.getPositionForIntersectionPoint(this._previewLineIntersection),n=e.parent.localToWorld(t);this._draggedComponent.position.copy(this._draggedComponent.parent.worldToLocal(n)),this._draggedComponent.rotation.copy(e.docklineRotation),e.hideSelectionLine()}else e.parent?e.position.copy(e.parent.worldToLocal(t)):e.position.copy(t);this._hoveredPreview?e.visible=!1:e.visible=!0,this.dispatchEvent(5,new SceneEventInfo({component:e})),this._interaction()}}_dragEnd(e,t){if(e&&(this._selectionHandler.isSelected(e)||this.isDragIn())){if(this._hoveredPreview)if(this._previewLineIntersection){let t=this._hoveredPreview,n=t.getPositionForIntersectionPoint(this._previewLineIntersection),i=t.parent.localToWorld(n);e.position.copy(e.parent.worldToLocal(i)),e.rotation.copy(t.docklineRotation)}else e.position.copy(t);else this._dragStartPosition&&this._dragStartRotation&&(e.position.copy(this._dragStartPosition),e.rotation.copy(this._dragStartRotation),this._dragStartPosition=null,this._dragStartRotation=null,this.addComponentHandlers(e));e.visible=!0,this._setDragComponentShadow(!0),this._draggedComponent=null,this._previewLineIntersection=null,this.dispatchEvent(6,new SceneEventInfo({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new SceneEventInfo({forceRender:e}))}hasSelection(){return this._selectionHandler.hasSelection()}update(e,t,n){this._raycastHelper.update(e,t,n)}isDragIn(){return this._dragIn}isDragging(){return null!=this._draggedComponent}setRootComponentId(e){this._raycastHelper.setRootComponentId(e)}cancelSelection(){this._selectionHandler.setSelectionMode("standard"),this._selectionHandler.cancelSelection()}setSelectionMode(e){this._selectionHandler.setSelectionMode(e)}getSelectionMode(){return this._selectionHandler.getSelectionMode()}getSelectedRuntimeComponentIds(){return this._selectionHandler.getSelectedRuntimeComponentIds()}setCameraMoving(e){e&&this._hoveredComponent&&this._hoverOff(this._hoveredComponent,0),this._cameraMoving=e}}return __decorate([inject],e.prototype,"_selectionHandler",void 0),e})();class UiIntersectionHelper extends EventDispatcher{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let i=new THREE.Vector3(-e.x/2,0,-e.z/2),o=new THREE.Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new THREE.Box3(i,o),this._clientWidth=t,this._clientHeight=n;let s=this._boundingBox.getSize(new THREE.Vector3);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new THREE.Vector3(s.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new THREE.Vector3(s.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(null==this._boundingBox||null==this._offset)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let n=0;this.floorEnvironment?(e=["left","right","bottom"],n=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),n|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),n|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),n|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),n|=4),n!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=n)}_checkPaddings(){let e={left:this._clientWidth/2,top:this._clientHeight/2,right:this._clientWidth/2,bottom:this._clientHeight/2};return this._boxVertices.forEach(t=>{let n=getScreenXY(t,this._camera,this._clientWidth,this._clientHeight);n.x<e.left&&(e.left=n.x),n.x>e.right&&(e.right=n.x),n.y<e.top&&(e.top=n.y),n.y>e.bottom&&(e.bottom=n.y)}),e}}class TopImageLightSetting extends LightSetting{constructor(e,t){super(e,t),this._params={ambientLight:{color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),1.2),this._ambientLight.layers.set(1),this.addToScene()}needsBounds(){return!1}addToScene(){this._scene.add(this._ambientLight)}removeFromScene(){this._scene.remove(this._ambientLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let e=getGUI();if(e&&this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}}}let imageRenderer=null;const getImageRenderer=()=>(imageRenderer||(imageRenderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),imageRenderer.outputEncoding=THREE.sRGBEncoding),imageRenderer.autoClear=!0,imageRenderer),getCameraTargetForBBox=(e,t=0)=>{if(!e){const e=new THREE.Vector3;return{center:e,bounds:e,diagonal:0}}const n=e.getSize(new THREE.Vector3);return n.addScalar(t),{center:e.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}},preparePerspectiveImage=(e,t,n,i,o={},s=0)=>new Promise(r=>{const{size:a=1024,showDimensions:c}=o,l=getImageRenderer();l.setSize(a,a);const h=e.fog?e.fog.clone():null,d=e.background?e.background.clone():null;e.background=null,e.fog=null;let _=new DefaultLightSetting(e);n.layers.disable(2),n.layers.disable(6),n.layers.disable(5),c?n.layers.enable(8):n.layers.disable(8);const g=-30+toDegrees(s);placeCameraForPerspectiveImage(n,i,-20,g),l.render(e,n),t&&(l.autoClear=!1,l.clearDepth(),l.render(t,n));const p=l.domElement.toDataURL();n.layers.enable(2),n.layers.enable(6),n.layers.enable(5),e.background=d,e.fog=h,_.removeFromScene(),r({image:p,width:a,height:a,blob:null})}),placeCameraForPerspectiveImage=(e,t,n,i)=>{e.far=1e3,e.fov=15,e.aspect=1,e.position.copy(t.center),e.rotation.set(0,0,0),e.rotateY(toRadiant(i)),e.rotateX(toRadiant(n)),e.translateZ(3.8*t.diagonal),e.updateProjectionMatrix()},prepareTopImage=(e,t,n,i={})=>{const{showDimensions:o=!1}=i;return new Promise(i=>{const s=getImageRenderer();s.autoClear=!1;let r=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);r.position.copy(n.center),r.rotateX(toRadiant(-90)),r.translateZ(n.bounds.y+1),r.far=r.position.y+.5,r.layers.mask=65535;let a=200*n.bounds.x,c=200*n.bounds.z;if(a>4096||c>4096){let e=0;a>4096?e=a/4096:c>4096&&(e=c/4096),a/=e,c/=e}s.setSize(a,c);let l=e.fog?e.fog.clone():null,h=e.background?e.background.clone():null;e.background=null,e.fog=null;let d=o?new TopImageLightSetting(e):new DefaultLightSetting(e);r.layers.disable(2),r.layers.disable(6),r.layers.disable(5),o?r.layers.enable(8):r.layers.disable(8),s.render(e,r),t&&(s.clearDepth(),s.render(t,r));let _=s.domElement.toDataURL();r.layers.enable(2),r.layers.enable(6),r.layers.enable(5),e.background=h,e.fog=l,d.removeFromScene(),i({image:_,width:a,height:c,blob:null})})};let ConfiguratorSceneManager=(()=>{class e extends SceneManager{constructor(e,t,n="3D"){super(e,t,CANVAS_ID.HSC,n),this._getViewModel().setListener(this),this._sceneEventHandler=new ConfiguratorSceneEventHandler(this._creator_,this._scene,this._getCameraControl().getCamera(),this._getInputManager()),this._sceneEventHandler.addEventListener(0,({forceRender:e})=>{this._uiIntersectionHelper.calculateUIIntersection(),e&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(1,({component:e,type:t})=>this._onHoverOn(e,t),this),this._sceneEventHandler.addEventListener(2,({component:e,type:t})=>this._onHoverOff(e,t),this),this._sceneEventHandler.addEventListener(3,()=>{this._configuratorUiCallbacks.onClickOutside(),this._cameraControl.unlock(),this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this.cancelComponentSelection(!0),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._sceneEventHandler.addEventListener(8,({component:e,consecutive:t})=>{this._getViewModel().hasPreviews()&&this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this._selectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(9,({component:e,resetCamera:t})=>{this._deselectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelComponentSelection(),this._requestDockingsPreviewWithDrag(e.runtimeId),this._cameraControl.lock(),this._requestRender()},this),this._sceneEventHandler.addEventListener(5,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(6,({component:e,preview:t})=>{if(t){let n=t;this._getViewModel().isPreviewLine(n)?this._getViewModel().dockComponentWithPosition(n,e):this._getViewModel().isPreview(n)&&this._dockComponent(n),this._cancelDockings(!t,e,!0,!0)}else{let t=this._sceneEventHandler.isDragIn()?e:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),t,!1,!0);const n=this._getViewModel().getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))}this._cameraControl.unlock(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(7,({preview:e})=>{this._getViewModel().isPreview(e)&&(this._getViewModel().isPreviewLine(e)?this._getViewModel().dockComponentWithPosition(e):this._dockComponent(e),this._cancelDockings(!1,null,!this._getViewModel().hasPreviews(),!1,!1),this.requestDockingsPreview(!1),this._requestRender())},this),this._cameraControl.addEventListener(0,()=>{var e;this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),null===(e=this._pixotronUtil)||void 0===e||e.movingCameraStarts(),this._requestRender()},this),this._cameraControl.addEventListener(1,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._cameraControl.addEventListener(2,()=>{var e;this._sceneEventHandler.setCameraMoving(!1),null===(e=this._pixotronUtil)||void 0===e||e.movingCameraStops(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(5,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this._cameraControl.addEventListener(3,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(4,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(7,()=>{this._pluginSystem.moveCameraStart(this._getCameraControl().getCamera().position)},this),this._cameraControl.addEventListener(8,()=>{this._pluginSystem.moveCameraEnd(this._getCameraControl().getCamera().position)},this),Env.isProduction||(window.__RML__DEBUG__.SceneHelper=this),this.enableConfiguratorEvents(),this._initOptionalModules(),this._offsetAnimationStart=callAgainAfter(this._offsetAnimationStart.bind(this),250),this._offsetAnimationEnd=debounce(this._offsetAnimationEnd.bind(this),32)}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:e}=await import("./component-raycast-helper-d2abcbf9.js");this._componentRaycastHelper=new e,this._componentRaycastHelper.init(this._scene,this._getCameraControl().getCamera())}}enableConfiguratorEvents(){this._sceneEventHandler.enable()}disableConfiguratorEvents(){this._sceneEventHandler.disable()}_getViewModel(){return this._viewModel||(this._viewModel=RoomleDependencyInjection.lookup("configurator-view-model",this._creator_)),this._viewModel}_getKernelAccess(){return this._plannerKernelAccess}_showDockings(){}cancelDockings(){this._cancelDockings(!0,null,!0,!0,!1),this._renderEverything()}_cancelDockings(e,t,n,i,o=!0){e&&(this._sceneEventHandler.setDragIn(!1),this._getViewModel().removeDockingComponent(),t&&this._scene.remove(t)),this._getViewModel().removePreviews(),n&&o&&this._updateCameraToBounds(),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}_onHoverOn(e,t){2!==t&&this._highlightComponent(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.add(e)&&this._renderEverything()}_onHoverOff(e,t){2!==t&&this._highlightComponent(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._componentDimensioningHelper.remove(e),this._renderEverything()),this._requestRender()}_highlightComponent(e=null,t=[]){if(!this._shouldHighlight())return;this._pixotron&&((null==t?void 0:t.length)?this._pixotron.getHighLightPass().transparency=.8:this._pixotron.getHighLightPass().transparency=1,this._pixotron.getHighLightPass().needsUpdate=!0);const n=[],i=this._initData.meshSelection;e?i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh):t&&t.length||(t=this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._getViewModel().getComponentsForIds(t).forEach(e=>{e&&(i?n.push(...e.meshes):e.boundingBoxMesh&&n.push(e.boundingBoxMesh))}),this._pixotron&&this._pixotron.highlightObjects(n)}shouldClearShadowsAndAO(){return super.shouldClearShadowsAndAO()||!this._sceneEventHandler.isDragging()}resume(){super.resume(),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._applySSR(),this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything(),this._applySSR(),this._environment instanceof BakedShadowEnvironment&&this._environment.update()}_applySSR(){this._initData.ssr&&this._pixotron&&this._getViewModel().getComponent(this._configuratorContext.rootComponentId).traverse(e=>{e instanceof THREE.Mesh&&!e.material.ssrPass&&this._pixotron.fixMaterial(e)})}pause(){super.pause(),this._getViewModel().materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}_setupScene(e,t,n){super._setupScene(e,t),this._uiIntersectionHelper=new UiIntersectionHelper(this._getCameraControl().getCamera()),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(0,e=>{this._configuratorUiCallbacks.onUiIntersectionChange(e)},this),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._domHelper.element.appendChild(this._renderer.domElement),n||(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(DynamicLightSettingLoader.createDynamicLightSettingSource(null,PREDEFINED_LIGHTSETTING.CAMERA)):this._lightSetting=new DefaultLightSetting(this._scene,this._lightSetting)),this._requestRender(),this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded())}sceneCleared(e){this._internalClearScene(e)}display(e){this._scene.add(e),this._sceneEventHandler.setRootComponentId(e.runtimeId),this._requestRender()}debugSceneGraph(e){this._getViewModel().debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){e.material&&e.material.opacity,e.type,e.id,e.runtimeId,e.children.length>0&&e.children.forEach(e=>{let n=t+" ";this._printObjectGraph(e,n)})}clearScene(){var e;this._getCameraControl().clear(),this._internalClearScene(!1),this._pixotronUtil&&this._pixotronUtil.lockAdapter(),null===(e=this._sceneEventHandler)||void 0===e||e.cancelSelection(),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this._getCameraControl().getCamera())}_internalClearScene(e){var t;this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type&&"Line"!==e.type||this._scene.remove(e)}),this._uiScene.children.forEach(e=>{this._uiScene.remove(e)}),this._getViewModel().sceneCleared(),null===(t=this._componentDimensioningHelper)||void 0===t||t.invalidateDimensioningsCache(),(e||this._memoryManager.shouldHardReset())&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}async preparePerspectiveImage(e={}){await this._externalMeshesAndMaterialsReady();const{showDimensions:t=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let n=this._getCameraControl().getCamera().clone(),i=this._calculateBoundingBoxOfAllMeshes(0,t);this._lightSetting.removeFromScene();const o=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();o&&this._dimensionHelper.disableDimensions();const s=this._getCameraControl().getObjectRotation();if(t){await this._initDimensions(),await this._dimensionHelper.isInitialized();const e=-30+toDegrees(s);placeCameraForPerspectiveImage(n,i,-20,e),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(n.position),i=this._calculateBoundingBoxOfAllMeshes(0,t)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const r=await preparePerspectiveImage(this._scene,this._uiScene,n,i,e,s);return o?this._dimensionHelper.enableDimensions():t&&this._dimensionHelper.disableDimensions(),this._lightSetting.addToScene(),this._requestRender(),r}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let t=this._getCameraControl().getCamera(),n=null;e.useCurrentPerspective||(t=this._getCameraControl().getCamera().clone(),n=this._calculateBoundingBoxOfAllMeshes());const i=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();i&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const o=await((e,t,n,i,o,s)=>new Promise(i=>{s||(s=1024);const o=getImageRenderer();o.setSize(s,s);const r=e.fog?e.fog.clone():null,a=e.background?e.background.clone():null;e.background=null,e.fog=null,t.layers.disable(2),t.layers.disable(6),t.layers.disable(5),n?placeCameraForPerspectiveImage(t,n,-20,-30):(t.aspect=1,t.updateProjectionMatrix()),o.render(e,t);const c=o.domElement.toDataURL();t.layers.enable(2),t.layers.enable(6),t.layers.enable(5),e.background=a,e.fog=r,i({image:c,width:s,height:s,blob:null})}))(this._scene,t,n,this._pixotron,this._renderer);return i&&this._dimensionHelper.enableDimensions(),this._requestRender(),o}async preparePartImage(e,t){return new Promise((n,i)=>{this._getViewModel().requestSubPartConstruction(e).then(async e=>{t.size||(t.size=256);let i=this._getCameraControl().getCamera().clone(),o=getCameraTargetForBBox((new THREE.Box3).setFromObject(e));const s=new THREE.Scene;s.add(e);const r=await preparePerspectiveImage(s,null,i,o,t);dispose(s),n(r)},i)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._getViewModel().getBoundingBox(),getCameraTargetForBBox(n,e)}async _externalMeshesAndMaterialsReady(){await this._getKernelAccess().externalMeshQueue.finished(!0),await this._getViewModel().materialQueue.finished(!0)}async prepareTopImage(e={}){await this._externalMeshesAndMaterialsReady();const{showDimensions:t=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers(),t&&(await this._initDimensions(),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();let n=this._calculateBoundingBoxOfAllMeshes(.1,t);this._lightSetting.removeFromScene();let i=await prepareTopImage(this._scene,this._uiScene,n,e);return t&&this._dimensionHelper.disableTopDimensions(),this._lightSetting.addToScene(),this._requestRender(),i}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}zoomToComponent(e){this._cameraControl.saveState(!1);let t=e.boundingBox.getSize(new THREE.Vector3),n=getYRotationOfObject(e),i=new THREE.Euler(0,n,0),o=e.getWorldPosition(new THREE.Vector3).clone().add(e.boundingBox.getCenter(new THREE.Vector3).applyEuler(i));const s=new THREE.Vector2;this._renderer.getSize(s),this._getCameraControl().zoomTo(t,s.width,s.height,i.y,toRadiant(15),o)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart(!1)}resetCameraToState(){this._cameraControl.hasSavedState()&&this._cameraControl.resetToState()}resetCameraPositionToStart(e=!0){this._requestRender();const t=this._getViewModel().getBoundingBox();t&&this._cameraControl instanceof CameraControl3D&&this._getCameraControl().reset(t,void 0,void 0,void 0,e)}_clearSelectionAndHovers(){this.cancelComponentSelection(),this._getViewModel().clearRootComponent()}resetPreviews(){this._getViewModel().removePreviews(),this._requestRender()}changeOffset(e){this._getCameraControl().getCamera().offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}updateCamera(e=!0){super.updateCamera(),this._updateCameraToBounds(null,e)}setCameraOffset(e){this._offsetAnimationStart(),this._getCameraControl().getCamera().offset&&(this._getCameraControl().getCamera().offset=e,this._renderEverything()),this._offsetAnimationEnd()}_offsetAnimationStart(){this._onCameraMove()}_offsetAnimationEnd(){this._onCameraIdle()}getCameraOffset(){var e,t;return(null===(t=null===(e=this._getCameraControl())||void 0===e?void 0:e.getCamera())||void 0===t?void 0:t.offset)?JSON.parse(JSON.stringify(this._getCameraControl().getCamera().offset)):{left:0,top:1,right:1,bottom:0}}_onKeyDown(e){super._onKeyDown(e),!e.key||"Escape"!==e.key&&"Esc"!==e.key||(this.cancelComponentSelection(),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof CameraControl3D&&(this._getCameraControl().enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&("Backspace"===e.key||"Delete"===e.key)&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e){super._onKeyUp(e),e.key&&e.key.includes("Shift")&&(this._getCameraControl().disablePanning(),e.preventDefault())}cancelPreviousDockings(){this._cancelDockings(!0,null,!1,!1)}cancelComponentSelection(e){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e)}_cancelSelection(e){this._sceneEventHandler.cancelSelection(),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.resetCameraToState(),this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel()}_selectComponent(e,t){this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),t||("standard"===this._sceneEventHandler.getSelectionMode()?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds())),this._highlightComponent(e),!this._initData.debug&&t&&this.zoomToComponent(e)}_deselectComponent(e,t){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t),this._highlightComponent()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t),this._highlightComponent())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return getScreenXY(e,this._getCameraControl().getCamera(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return this._environment&&this._environment instanceof FloorEnvironment||(this._environment=new FloorEnvironment(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),new Promise((t,n)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},n)})}exportGLB(){this._scriptLoader.fetch("static/GLTFExporter-86edae059df3a219.js",{id:"gltf-exporter"}).then(()=>{let e=new THREE.GLTFExporter,t=[];this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type||t.push(e)}),e.parse(t,e=>{let t=document.createElement("a");const n=new Blob([e],{type:"model/gltf-binary"});t.href=URL.createObjectURL(n),t.download="scene.glb",t.style.display="none",document.body.appendChild(t),t.click()},{binary:!0,embedImages:!0,forceIndices:!0})})}zoomIn(e){this._getCameraControl().zoomIn(e),this._renderEverything()}zoomOut(e){this._getCameraControl().zoomOut(e),this._renderEverything()}async showDimensions(){await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._renderEverything()}async _initDimensions(){this._dimensionHelper||await import("./dimensioning-helper-2d4839c5.js").then(({default:e})=>{this._dimensionHelper=new e(this._creator_),this._pluginSystem.addPlugin(this._dimensionHelper)})}hideDimensions(){this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}async loadSceneSettings(e){await super.loadSceneSettings(e),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof FloorEnvironment}_updateCameraToBounds(e,t=!0){e||(e=this._getViewModel().getBoundingBox()),e&&this._cameraControl instanceof CameraControl3D&&(this._getCameraControl().updateToBounds(e,!1,t),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition())}requestDockingsPreview(e,t,n,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(),i&&this.enableDragIn(n),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._getKernelAccess().webGlPreviewDockings(this._configuratorContext,i),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._getKernelAccess().previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){const t=Benchmark.start("dock_component_"+e.childId);this._getKernelAccess().dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null,Benchmark.end(t)}_onSelectedRuntimeComponentsChange(e){this._getKernelAccess().multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,n=null;e&&(t=e.runtimeId===this._configuratorContext.rootComponentId,n=e.runtimeId),this._getKernelAccess().selectionChange(n,t),e&&this._getKernelAccess().selectedComponent(e.runtimeId)}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(Array.isArray(e)&&0!==e.length&&t&&-1===e.indexOf(t)){switch(this._configuratorContext.selectionMode){case"standard":this.resetCamera(),this._getKernelAccess().requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case"multiselect":this.resetCamera(),this._getKernelAccess().requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds)}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){var n;if(e.runtimeId===this._configuratorContext.rootComponentId){let t=new THREE.Vector3(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,t,null)}void 0===e.geometryChanged||e.geometryChanged?this._renderEverything():this._renderWithoutShadowsAndAO(),null===(n=this._componentDimensioningHelper)||void 0===n||n.invalidateDimensioningsCache(e.runtimeId)}planObjectUpdated(e,t){const n=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId);if(this._configuratorHistory.push(n),e.bounds){if(this._configuratorContext.planObjectId===e.id){const e=this._getViewModel().getBoundingBox();this._updateBounds(e,t)}this._highlightComponent(),this._requestRender()}}componentDeleted(e){-1===this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.runtimeId)&&"multiselect"!==this._sceneEventHandler.getSelectionMode()||this.cancelComponentSelection()}previewConstructionDone(e,t){const n=this._getViewModel().getBoundingBoxWithPreviews();t||(this._cancelDockings(!0,null,!1,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());let i=!0;this._componentRaycastHelper&&(i=!this._componentRaycastHelper.areAllPreviewsVisible(this._getViewModel())),this._configuratorContext.requestPreviewsIsUserInitiated&&i&&this._updateCameraToBounds(n),this._lightSetting&&this._lightSetting.needsBounds()&&(this._lightSetting.updateBounds(n),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new THREE.Vector3(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):t||this._initData.debug||this._initData.moc||this.resetCamera(),this._pixotronUtil&&Promise.all([new Promise(e=>setTimeout(e,3e3)),this._getViewModel().materialQueue.finished(!0)]).then(()=>{this._pixotronUtil.unLockAdapter()}),this._environment&&this._environment.reload()}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks.onComponentPositionsUpdated)return;const e=[];this._getViewModel().getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const n=(new THREE.Box3).setFromObject(t.boundingBoxMesh);let i=this._getKernelAccess().kernelInstance.getComponent(t.runtimeId);const o=i.parameters||i.possibleChildren?["edit"]:[];e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"component",actions:o})}),this._getViewModel().getPreviews().forEach(t=>{const n=(new THREE.Box3).setFromObject(t);e.push({id:t.runtimeId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"preview",actions:["add"]})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}_updateBounds(e,t=!1){if(super._updateBounds(e,t),!e)return;let n=e.getSize(new THREE.Vector3);this._sceneEventHandler.hasSelection()||this._updateCameraToBounds(e,!1),this._sceneEventHandler.update(n,null,null),this._uiIntersectionHelper.updateToBounds(n,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._pixotron&&this._pixotron.getShadowPass().setShadowRecieverBBox(e),this._getCameraControl().getCamera().updateProjectionMatrix()}async moveCamera(e){return this._getCameraControl().moveCamera(e)}selectComponent(e){if(!e)return;const t=this._getViewModel().getComponents().find(t=>t.runtimeId===e);t?this._sceneEventHandler.clickComponent(t):console.warn('Can not select "'+e+'" because it was not found')}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlight(){return this._getViewModel().getNumberOfPossibleChildrenForComponent(this._configuratorContext.rootComponentId)>0}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=RoomleComponentFactoryInitializer();const n=this._domHelper.getClientDimensions(),i=n.x,o=n.y,s=this._componentFactory.createPerspectiveCamera(30,i/o,.1,20,t);s.layers.set(3),s.layers.enable(1),s.layers.enable(2),s.layers.enable(6),s.layers.enable(5),s.position.copy(new THREE.Vector3(0,.5,5)),this._changeCameraControl(new CameraControl3D(this._creator_,this._getInputManager(),null,s))}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}getBounds(){return this._getViewModel().getBoundingBox()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:1.5},shadowparams:{shadowMapResolution:1024,shadowRadius:1,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:50,side:THREE.FrontSide},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:1,edgeThickness:2}}}sceneChanged(){}_getCameraControl(){return this._cameraControl}_onCameraIdle(){return super._onCameraIdle()}_onCameraMove(){return super._onCameraMove()}getComponent(e){return this._plannerKernelAccess.kernelInstance.getComponent(e)}}return __decorate([inject],e.prototype,"_configuratorInputManager",void 0),__decorate([inject],e.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],e.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],e.prototype,"_memoryManager",void 0),__decorate([inject],e.prototype,"_configuratorContext",void 0),__decorate([inject],e.prototype,"_componentDimensioningHelper",void 0),__decorate([inject],e.prototype,"_configuratorViewModel",void 0),__decorate([inject],e.prototype,"_configuratorHistory",void 0),__decorate([inject],e.prototype,"_plannerKernelAccess",void 0),e})();const sortBySort=(e,t)=>e.sort||t.sort?e.sort?t.sort?e.sort-t.sort:-1:1:0,sortByString=(e,t)=>e&&!t?1:!e&&t?-1:e&&t?e.localeCompare(t):0;let RoomleConfigurator=(()=>{class e{constructor(e){this._onInitDoneCollection=[],this._isKernelReady=!1,this._isWebGlReady=!1,this._isPreloadReady=!0,this._isLoadError=!1,this._isReloading=!1,this._needsSync=!1,this._creator_=e,this._configuratorKernelAccessCallback.addListener(this);const t=this._errorHandler;t.subscribe(0,e=>this._configuratorUiCallbacks.onErrorDueToOffline(e)),t.subscribe(1,e=>this._configuratorUiCallbacks.onError(e)),t.subscribe(2,(e,t)=>this._configuratorUiCallbacks.onContentProblem({rapiPath:e,ids:t,message:"Could not load the ids"}))}_isInitDone(){return this._isKernelReady&&this._isWebGlReady&&this._isPreloadReady}_checkInitDone(){this._isInitDone()&&(this._onInitDoneCollection.forEach(e=>e()),this._onInitDoneCollection=[])}_onInitDone(e){this._isInitDone()?e():this._onInitDoneCollection.push(e)}initSceneManager(e){this._sceneManager=e||RoomleDependencyInjection.lookup("configurator-scene-manager",this._creator_)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}_loadWebGlLib(e,t){this._threeLoader.fetch().then(()=>Promise.all(PIXOTRON_EFFETCS.map(e=>this._scriptLoader.fetch(e,{id:e}))).then(this._loadingWebGlSuccess(e,t).bind(this),this.loadError.bind(this)),this.loadError.bind(this))}_loadingWebGlSuccess(e,t){return()=>{this.initSceneManager(),t&&this._sceneManager.changeOffset(t);const{initialFloorMaterial:e,dls:n,ls:i,stats:o}=this._initData,s=DynamicLightSettingLoader.createDynamicLightSettingSource(n,i);o&&this.showStats(),this._enableHD(s),this._needsSync&&(this._needsSync=!1,this._plannerKernelAccess.requestSync(DEFAULT_CONVERSATION_ID,this._configuratorContext.planObjectId));const r=[this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"})];e&&r.push(this._rapiAccess.getMaterial(e).then(e=>this._sceneManager.changeFloorMaterial(e))),Promise.all(r).then(this._webGlIsReady.bind(this),this.loadError.bind(this))}}_webGlIsReady(){this._isWebGlReady=!0,this._checkInitDone()}_initPromiseCallback(e,t){this._isInitDone()?e():this._isLoadError?t("_initPromiseCallback failed"):(this._onInitDone(()=>e()),this._rejectOnLoadError=t)}_notifyOnConfigurationReady(e){return async t=>{const n=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t.partList,t.hash);t.partList=n,e(t),this._configuratorUiCallbacks.onConfigurationReady(n,t.hash,t.rootComponentLabel)}}_notifyOnConfigurationLoadingError(e){return t=>{this._configuratorUiCallbacks.onConfigurationLoadError(),e(t)}}_loadItemOrConfigById(e,t){this._configuratorContext.lastLoadedRapiId=e,this._onLoadConfiguration(),this._preloadPackage(e),this._clearScene();const{offlineSync:n}=this._initData;if(n){const t=getCatalogIdFromItemOrConfigurationId(e);t&&this._dataSyncer.start(t)}return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(t=>{t&&t.configuration?this._loadConfiguration(t.configuration).then(e=>{const i=this._notifyOnConfigurationReady(n);t.label?this._notifyUiAboutNewItem(t,e.rootComponentLabel):this._notifyUiAboutNewConfiguration(t),i(e)},this._notifyOnConfigurationLoadingError(i).bind(this)):i(new Error("Could not load item or config with id "+e))},i)})}_shouldBroadcastToUi(e){return!(0===e&&this._configuratorContext.selectedRuntimeComponentId||1===e&&!this._configuratorContext.selectedRuntimeComponentId||2===e&&!this._configuratorContext.selectedRuntimeComponentIds.length)}_isCorrectResponse(e,t){if(0===e)return t===this._configuratorContext.planObjectId;if(1===e)return t===this._configuratorContext.selectedRuntimeComponentId;const n=t.length;if(n!==this._configuratorContext.selectedRuntimeComponentIds.length)return!1;for(let e=0;e<n;e++)if(t[e]!==this._configuratorContext.selectedRuntimeComponentIds[e])return!1;return!0}_onLoadConfiguration(){this._clearScene(),this._configuratorUiCallbacks.onLoadConfiguration()}_clearScene(){this._sceneManager&&this._sceneManager.clearScene()}_notifyUiAboutNewItem(e,t){this._rapiAccess.getCatalog(e.catalog).then(n=>this._configuratorUiCallbacks.onConfigurationLabelChange(n.name,e.label,t))}_notifyUiAboutNewConfiguration(e){Promise.all([this._rapiAccess.getCatalog(e.catalog),this._rapiAccess.getComponent(e.rootComponentId)]).then(([e,t])=>this._configuratorUiCallbacks.onConfigurationLabelChange(e.name,null,t.label))}notifyUiAboutNewLabel(e){if(isIdItemId(e)){const t=this._rapiAccess.peekItem(e),n=this._rapiAccess.peekComponent(t.rootComponentId);this._notifyUiAboutNewItem(t,n.label)}else this._notifyUiAboutNewConfiguration(this._rapiAccess.peekConfiguration(e))}_getMaterialGroups(e){const t=(e,t)=>{let n=sortBySort(e,t);return 0!==n?n:(n=sortByString(e.label,t.label),0!==n?n:sortByString(e.id,t.id))},n=e=>(e.sort(t),e.forEach(e=>e.materials.sort(t)),e);if(e.validGroups.length>0)return new Promise((t,i)=>this._rapiAccess.getMaterialsByGroup(e.validGroups).then(e=>t(n(e)),i));const i=[];return e.validValues.forEach(e=>i.push(e.value)),new Promise((e,t)=>{this._rapiAccess.getMaterials(i).then(t=>{this._rapiAccess.combineMaterialsToGroups(t).then(t=>{e(n(t))})},t)})}_loadConfiguration(e){return this._plannerKernelAccess.externalMeshQueue.clear(),new Promise((t,n)=>{const i=()=>{const{x:i,y:o}=this._domHelper.getClientDimensions();if(i<=0&&o<=0){let e="Size of canvas is 0/0! When using embedding set correct size or remove id to load in idle mode!";return console.error(e),n(e)}this.resumeKernelCallbacks(),Benchmark.start("ui_load_configuration");const s=[];if(this._initData.applyCurrentGlobalParameters){const e=this._configuratorContext.planObjectId,t=this._configuratorContext.rootComponentParametersAsGlobal;s.push(this._plannerKernelAccess.getGlobalParameters(e,t))}Promise.all(s).then(([i])=>{const o=[AsyncHelper.waitFor(4),AsyncHelper.waitFor(2)];Promise.all(o).then(([e,[n,o,s,r]])=>{const a=[];i&&this._initData.applyCurrentGlobalParameters&&i.forEach(e=>a.push(this.setParameter(e,e.value,!0)));const c=this._rapiAccess.peekComponent(r);Promise.all(a).then(()=>{const n=[];a.length&&(n.push(this._plannerKernelAccess.getPartList()),n.push(this._plannerKernelAccess.getConfigurationHash(this._configuratorContext))),Promise.all(n).then(async n=>{const i=n&&n[0]?n[0]:o,r=n&&n[1]?n[1]:s,a=await this._plannerKernelAccess.addUiDataAndPriceToPartList(i,r);let l=e.errors;const h=l?convertCObject(l):[];t({partList:a,hash:r,rootComponentLabel:c?c.label:"",errors:h})})})},n),this._plannerKernelAccess.loadConfiguration(e)},n)};this._onInitDone(()=>i())})}_preLoadItemOrConfig(e,t){return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(n,i)})}_preloadPackage(e){this._isPreloadReady=!1;let t=null;t=isIdItemId(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),Benchmark.start("rapi_preloads");const n=()=>{Benchmark.end("rapi_preloads");const t=Benchmark.getMeasure("rapi_preloads");if(Array.isArray(t)&&1===t.length){const n=t[0];this._configuratorUiCallbacks.onTrackTiming("Timing","RapiPreloads",Math.round(n.duration),{id:e})}};t(e).then(()=>{this._isPreloadReady=!0,this._checkInitDone(),n()},e=>{this._isPreloadReady=!0,this._checkInitDone(),console.error(e),n()})}_reloadConfiguration(e,t,n,i){return this._performLoadConfiguration(e).then(e=>{this._isReloading=!1,n(e)},e=>{this._isReloading=!1,i(e)})}_performLoadConfiguration(e){return this._onLoadConfiguration(),new Promise((t,n)=>{this._initData.preloadHint?this._preloadPackage(this._initData.preloadHint):console.warn("When loading a configuration string you have to supply a preloadHint to use fast loading!"),setTimeout(()=>{this._loadConfiguration(e).then(this._notifyOnConfigurationReady(t).bind(this),this._notifyOnConfigurationLoadingError(n).bind(this))},0)})}_changeHDGeometry(e){return new Promise((t,n)=>e===AppContext.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,AsyncHelper.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,t,n)},n),AppContext.useHDGeometry=e,void this._plannerKernelAccess.changeUseOfHDGeometry(this._configuratorContext,AppContext.useHDGeometry)))}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}init(e,t){this.setOverrides(t);const{preloadHint:n,offset:i,startTag:o}=this._initData;return this._domHelper.setDomElement(e),n?this._preloadPackage(n):console.warn("No preload hint! Therefore no preload during init!!"),o&&this.getTagById(o,{include:["items"]}).then(e=>this._configuratorUiCallbacks.onOpenTag(e),e=>console.error(e)),this._loadWebGlLib(e,i),new Promise(this._initPromiseCallback.bind(this))}cancelSelection(){this._sceneManager.cancelComponentSelection()}enableHDGeometry(){return this._changeHDGeometry(!0)}disableHDGeometry(){return this._changeHDGeometry(!1)}changeOffset(e){this._sceneManager.changeOffset(e)}previewDockings(e,t,n){this._sceneManager.requestDockingsPreview(!0,e,t,n)}cancelDockings(){this._sceneManager.cancelDockings()}requestDeleteComponent(){this._sceneManager.requestDeleteSelectedComponent()}renderImage(e){return this._sceneManager.renderImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}preparePartImage(e,t){let n={};return"number"==typeof t?n.size=t:(t||(t={}),"number"!=typeof t.size&&(t.size=256),n=t),this._sceneManager.preparePartImage(e,n)}saveCurrentConfiguration(){return new Promise((e,t)=>{this._plannerKernelAccess.getConfigurationData(this._configuratorContext.planObjectId).then(n=>{this._rapiAccess.saveConfiguration(n).then(n=>{this._configuratorUiCallbacks.onConfigurationSaved(n.configurationHash),this._rapiAccess.getComponent(n.rootComponentId).then(i=>{let o=!0,s=!0,r=n.perspectiveImage,a=n.topImage;n.perspectiveImage||(o=!1,this._sceneManager.preparePerspectiveImage().then(c=>{this._rapiAccess.savePerspectiveImage(n,c).then(t=>{o=!0,r=t.perspectiveImage,s&&(t.label=i.label,t.topImage=a,e(t))},t)})),n.topImage||(s=!1,this._sceneManager.prepareTopImage().then(c=>{this._rapiAccess.saveTopImage(n,c).then(t=>{s=!0,a=t.topImage,o&&(t.label=i.label,t.perspectiveImage=r,e(t))},t)})),o&&s&&(n.label=i.label,e(n))},e=>{throw new Error(e)})},t)}).catch(t)})}generateImagesOfCurrentConfiguration(){return new Promise((e,t)=>this.saveCurrentConfiguration().then(t=>e({topImage:t.topImage,perspectiveImage:t.perspectiveImage,isLocally:t.isLocally}),t))}prepareTopImage(e){let t={};return"boolean"==typeof e?t.showDimensions=e:(e||(e={}),"boolean"!=typeof e.showDimensions&&(e.showDimensions=!1),t=e),this._sceneManager.prepareTopImage(t)}resetCameraPosition(){this._sceneManager.resetCameraPositionToStart()}showBenchmarks(e){Benchmark.showBenchmarks(e)}debugSceneGraph(e){this._sceneManager.debugSceneGraph(e)}async loadConfiguration(e,t){this.setOverrides(t),this._configuratorContext.lastLoadedRapiId=null,this._sceneManager&&this._sceneManager.clearScene();const n=await this._performLoadConfiguration(e);return this._rapiAccess.trackView("configuration string"),n}async loadConfigurationById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!0);return this._rapiAccess.trackView(e),n}syncPlanObjectToView(e,t){this.resumeKernelCallbacks(),this._plannerKernelAccess.requestSync(e,t),this._plannerKernelAccess.requestPlanObjectConstruction(t);const n=this._plannerKernelAccess.getSerializedConfiguration(t),i=this._plannerKernelAccess.getCurrentConfigurationHash(t);this._plannerKernelAccess.planObjectConfigurationUpdated(t,n,i),this._sceneManager.resetCameraPositionToStart(!1)}async loadConfigurableItemById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!1);return this._rapiAccess.trackView(e),n}preLoadConfigurationById(e){return this._preLoadItemOrConfig(e,!0)}preLoadConfigurableItemById(e){return this._preLoadItemOrConfig(e,!1)}_getTag(e){return this._rapiAccess.getTag(e)}_dispatchSetParameter(e,t,n,i,o){const s=this._configuratorContext.selectedRuntimeComponentId?"local":"global",r=Benchmark.start("kernel_change_param_"+s+"_"+e);switch(this._configuratorContext.selectionMode){case"standard":if(this._configuratorContext.selectedRuntimeComponentId||this._configuratorContext.rootComponentParametersAsGlobal){let s=this._configuratorContext.selectedRuntimeComponentId?this._configuratorContext.selectedRuntimeComponentId:this._configuratorContext.rootComponentId;this._plannerKernelAccess.changeComponentParameter(s,e,t,n,i,o)}else this._plannerKernelAccess.changePlanObjectParameter(this._configuratorContext.planObjectId,e,t,n,i,o);break;case"multiselect":this._plannerKernelAccess.changeCommonComponentParameter(this._configuratorContext.selectedRuntimeComponentIds,e,t,n,i,o)}Benchmark.end(r)}setParameter(e,t,n=!1){return new Promise((i,o)=>{const{key:s,type:r}=e;if(isRange(e)){if(!n&&!this._unitFormatter.isParseableUnitString(t,e))return o(new SyntaxError('Value "'+t+'" is not parseable'));const i=n?t:this._unitFormatter.parseValue(t,e),{valueFrom:s,valueTo:a}=e.validRange,c=this._unitFormatter.getAllowedDelta();if(!Number.isNaN(s)&&i<s-c)return o(new RangeError('Value "'+t+'" is too small, min-val "'+s+'"'));if(!Number.isNaN(a)&&i>a+c)return o(new RangeError('Value "'+t+'" is too big, max-val "'+a+'"'));t="Integer"===r&&"number"==typeof i?i.toFixed():i.toString()}this._sceneManager.cancelDockings(),this._dispatchSetParameter(s,r,t,i,o)})}setParameterOfPlanObject(e,t){return new Promise((n,i)=>{const{planObjectId:o,rootComponentId:s,rootComponentParametersAsGlobal:r}=this._configuratorContext,{type:a,key:c}=e;r?this._plannerKernelAccess.changeComponentParameter(s,c,a,t,n,i):this._plannerKernelAccess.changePlanObjectParameter(o,c,a,t,n,i)})}getParametersOfPlanObject(){const{planObjectId:e,rootComponentParametersAsGlobal:t}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,t)}setParameterOfRootComponent(e,t){return new Promise((n,i)=>{const{rootComponentId:o}=this._configuratorContext,{type:s,key:r}=e;this._plannerKernelAccess.changeComponentParameter(o,r,s,t,n,i)})}getParametersOfRootComponent(){const{planObjectId:e}=this._configuratorContext;return this._plannerKernelAccess.getGlobalParameters(e,!0)}enableMultiselect(){this._sceneManager.setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneManager.setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}getCurrentConfiguration(){return AsyncHelper.waitFor(1,()=>this._plannerKernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return AsyncHelper.waitFor(0,()=>{let t=null;try{if(t=JSON.parse(e).id,!t)throw new Error("Component string has no ID")}catch(e){return this._configuratorUiCallbacks.onContentProblem({rapiPath:"components",ids:[t],message:"Component string is not a valid JSON or has no ID"}),void AsyncHelper.failOperation(0,e)}this._kernelIo.setMeta({componentId:t}),this._plannerKernelAccess.loadComponentIntoKernel(e,t)})}getShortUrlOfCurrentConfiguration(){return new Promise((e,t)=>{this.saveCurrentConfiguration().then(n=>navigator.onLine?this._rapiAccess.getShortUrl(n.id,3).then(t=>{const n=t.shortId,i=Env.APP.SHORTENER_URL+n;e(i)},t):t("Can not generate short url when offline"),t)})}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}getTagById(e,t){return new Promise((n,i)=>{this._getTag(e).then(e=>{let o=Promise.resolve([]),s=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(o=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(s=this._rapiAccess.getItems(e.items))}),Promise.all([o,s]).then(([t,i])=>(i.sort(sortBySort),t.sort(sortBySort),n({...e,items:i,materials:t})),i)},i)})}requestAsset(e){return this._dataSyncer.requestAsset(e)}changeFloorMaterial(e){return this._sceneManager.changeFloorMaterial(e)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._sceneManager.changeFloorMaterial(t)}openFloorMaterials(){this._configuratorUiCallbacks.onOpenFloorMaterials()}openPartList(){this._configuratorUiCallbacks.onOpenPartList()}getAdditionalContentsOf(e){return this._rapiAccess.getAdditionalContentsOfItems(e)}changeTypeChangeTag(e){navigator.onLine&&this._initData.offlineSync&&this._dataSyncer.syncTypeChangeTag(e),this._configuratorUiCallbacks.onChangeTypeChangeTag(e)}removeTypeChangeTag(e){this._configuratorUiCallbacks.onRemoveTypeChangeTag(e)}showGUI(){this._sceneManager.showGUI()}showStats(){this._sceneManager.showStats()}showDimensions(){this._sceneManager.showDimensions()}hideDimensions(){this._sceneManager.hideDimensions()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}syncFloorTag(e){return this._dataSyncer.syncFloorTag(e)}syncTypeChangeTag(e){return this._dataSyncer.syncTypeChangeTag(e)}loadDynamicLightSetting(e){return this._sceneManager.loadDynamicLightSetting(e)}setBackgroundColor(e){this._sceneManager.setBackgroundColor(e)}setBackgroundImage(e){this._sceneManager.setBackgroundImage(e)}setBakedShadow(e,t){this._sceneManager.setBakedShadow(e,t)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}enableMeshSelection(e){this._initData.meshSelection=e}updateSize(){this._sceneManager.updateCamera()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}getMain(){}cleanup(e={}){this._configuratorContext.selectedRuntimeComponentIds=[],this._plannerKernelAccess.cleanUpCallbacks(),this._sceneManager.sceneCleared(!!e.resetMeshCache),e.resetCoreCache&&this._plannerKernelAccess.kernelInstance.clearAll(),e.resetApiCache&&this._rapiAccess.cleanUp()}resumeTest(e){e&&this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}zoomIn(e){this._sceneManager.zoomIn(e)}zoomOut(e){this._sceneManager.zoomOut(e)}get callbacks(){return this._configuratorUiCallbacks}get globalCallbacks(){return this._globalCallback}getRuntimeComponentIdOfRootComponent(){const e=this._configuratorContext.planObjectId;return e?this._plannerKernelAccess.getRuntimeComponentIdOfRootComponent(e):(console.warn("planObjectId not set"),0)}getCurrentConfigurationHash(){return this._plannerKernelAccess.getConfigurationHash(this._configuratorContext)}getCurrentSelection(){let e=this._configuratorContext.selectedRuntimeComponentIds;return e&&e.length||(e=[this._configuratorContext.rootComponentId]),e.map(e=>this._plannerKernelAccess.getRuntimeComponentId(e))}_enableHD(e){return new Promise((t,n)=>{this._scriptLoader.fetch(PIXOTRON_FILE_NAME,{id:"pi-js"}).then(()=>{this._sceneManager.enableHD(e),t()},n)})}isReady(){const e=Benchmark.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=Benchmark.getMeta("kernel_is_ready");this._configuratorUiCallbacks.onTrackTiming("Timing","KernelIsReady",Math.round(t.duration),Object.assign(n,{startTime:t.startTime}))}this._isKernelReady=!0,this._checkInitDone(),"function"==typeof this._configuratorUiCallbacks.onKernelIsReady&&this._configuratorUiCallbacks.onKernelIsReady()}async updatePossibleChildren(e,t,n){const i=await this._addAdditionalInfoToPossibleChildren(e,t,n);if(i){const{tags:e,defaultChild:t}=i;this._shouldBroadcastToUi(n)&&this._configuratorUiCallbacks.onUpdatePossibleChildren(e,t)}}updateParameters(e,t,n,i){this._addGroupsToParameters(n,e,t,i),this._shouldBroadcastToUi(i)&&this._configuratorUiCallbacks.onUpdateParameters(e)}loadError(e){this._isLoadError=!0,this._rejectOnLoadError&&this._rejectOnLoadError(e)}resumeKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!1,this._plannerKernelAccess.resume()}pauseKernelCallbacks(){this._plannerKernelAccess.muteKernelCallbacks=!0,this._plannerKernelAccess.pause()}setActiveGroupInView(e){this._plannerKernelAccess.setActiveGroupInView(e)}getParameterGroups(){return this._plannerKernelAccess.getParameterGroups()}async getConfiguratorSettings(e){return this._rapiAccess.getConfiguratorSettings(e)}async moveCamera(e){return this._sceneManager.moveCamera(e)}selectComponent(e){return this._configuratorContext.selectedRuntimeComponentId===e?Promise.resolve():Promise.resolve(this._sceneManager.selectComponent(e))}setComponentParameter(e,t,n){const{key:i,type:o}=t;return new Promise((t,s)=>this._plannerKernelAccess.changeComponentParameter(e,i,o,n,t,s))}highlightParts(e){this._sceneManager.highlightParts(e)}undo(){const e=this._configuratorHistory.undo();e&&this._plannerKernelAccess.loadConfiguration(e)}redo(){const e=this._configuratorHistory.redo();e&&this._plannerKernelAccess.loadConfiguration(e)}clearHistory(){this._configuratorHistory.clearHistory()}getHashOfSerializedConfiguration(e){return this._plannerKernelAccess.kernelInstance.getHashOfSerializedConfiguration(e)}getParametersOfComponent(e){const t=this._plannerKernelAccess.kernelInstance.getComponentParameters(e),n=this.getParameterGroups();return this._addGroupsToParameters(e,t,n,1)}_addGroupsToParameters(e,t,n,i){n||(n=[],console.warn("Kernel returned no parameter groups! Check why!"));const o={};return n.forEach(e=>{o[e.key]=e}),t.sort(sortBySort),t.forEach(t=>{t.group?t.grouping=o[t.group]:t.grouping=null,this._unitFormatter.formatParameter(t),isMaterial(t)&&Object.defineProperty(t,"groups",{get:()=>new Promise((n,o)=>{this._getMaterialGroups(t).then(t=>{this._isCorrectResponse(i,e)&&this._shouldBroadcastToUi(i)?n(t):o("Response does not match to ids")},o)})})}),t}async getPossibleChildrenOfComponent(e){const t=this._plannerKernelAccess.kernelInstance.getPlanComponentPossibleChildren(e);return await this._addAdditionalInfoToPossibleChildren(e,t,2,!1)}async _addAdditionalInfoToPossibleChildren(e,t,n,i=!0){const{possibleChildren:o,defaultChild:s}=await this._getPossibleChildrenForKernelPossibleChildren(t),r=[],a=new Map,c=[];if(o.forEach(e=>{const t=e.tags;if(e.tags&&Array.isArray(e.tags)&&e.tags.length)for(let n=0,i=e.tags.length;n<i;n++){const i=t[n];-1===r.indexOf(i)&&r.push(i);let o=a.get(i);if(!o){const e=[];a.set(i,e),o=a.get(i)}o.push(e)}else c.push(e)}),this._isCorrectResponse(n,e)||!i){let e;try{e=await this._rapiAccess.getTags(r)}catch(e){console.error("Couldnt load tags of possible children"),console.error(e)}return e.forEach(e=>{e.possibleChildren=a.get(e.id)}),e.sort(sortBySort),c.length&&e.unshift({id:"",externalIdentifier:"",global:!1,created:(new Date).toISOString(),updated:(new Date).toISOString(),language:this._globalInitData.locale,catalog:null,tags:[],parents:[],materials:[],items:[],possibleChildren:c}),{tags:e,defaultChild:s}}return null}async _getPossibleChildrenForKernelPossibleChildren(e){const t=[],n=[];let i;const o=new Map,s=new Map;e.forEach(e=>{if(!e.possible)return;let r=e.itemId;e.itemId?(n.push(e.itemId),s.set(e.itemId,e)):(t.push(e.componentId),o.set(e.componentId,e),r=e.componentId),e.isDefault&&!i&&(i=r)});const r=await Promise.all([this._rapiAccess.getComponents(t),this._rapiAccess.getItems(n)]),a=r[0],c=r[1],l=[];let h=null;return a.forEach(e=>{e.isItem=!1,e.isComponent=!0;const t=o.get(e.id);t&&(e.group=t.group),e.id===i&&(e.isDefault=!0,h=e),l.push(e)}),c.forEach(e=>{e.isItem=!0,e.isComponent=!1;const t=s.get(e.id);t&&(e.group=t.group),e.id===i&&(e.isDefault=!0,h=e),l.push(e)}),l.sort(sortBySort),{possibleChildren:l,defaultChild:h}}getUnitFormatter(){return this._unitFormatter}getComponent(e){return this._sceneManager.getComponent(e)}}return __decorate([inject],e.prototype,"_rapiAccess",void 0),__decorate([inject],e.prototype,"_dataSyncer",void 0),__decorate([inject],e.prototype,"_errorHandler",void 0),__decorate([inject],e.prototype,"_unitFormatter",void 0),__decorate([inject],e.prototype,"_domHelper",void 0),__decorate([inject],e.prototype,"_configuratorUiCallbacks",void 0),__decorate([inject],e.prototype,"_configuratorKernelAccessCallback",void 0),__decorate([inject],e.prototype,"_lifeCycleManager",void 0),__decorate([inject],e.prototype,"_plannerKernelAccess",void 0),__decorate([inject],e.prototype,"_threeLoader",void 0),__decorate([inject],e.prototype,"_scriptLoader",void 0),__decorate([inject],e.prototype,"_configuratorContext",void 0),__decorate([inject],e.prototype,"_initData",void 0),__decorate([inject],e.prototype,"_globalInitData",void 0),__decorate([inject],e.prototype,"_globalCallback",void 0),__decorate([inject],e.prototype,"_kernelIo",void 0),__decorate([inject],e.prototype,"_configuratorHistory",void 0),e})();export{ConfiguratorSceneManager as C,GLTF_EXPORTER_FILE_NAME as G,PlanViewModel as P,RoomleConfigurator as R,SceneEventHandler as S,preparePerspectiveImage as a,getCameraTargetForBBox as g,prepareTopImage as p};
2
- //# sourceMappingURL=roomle-configurator-729fec35.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"roomle-sdk-3895e33e.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- var _scriptDir,ConfiguratorKernel=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t){var n,r,e;t=t||{},n||(n=void 0!==t?t:{}),n.ready=new Promise((function(t,n){r=t,e=n}));var i=Object.assign({},n),a="./this.program",o=(t,n)=>{throw n},c="";"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),_scriptDir&&(c=_scriptDir),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"";var u=n.print||console.log.bind(console),f=n.printErr||console.warn.bind(console);Object.assign(n,i),i=null,n.thisProgram&&(a=n.thisProgram),n.quit&&(o=n.quit);var s,l=0;n.wasmBinary&&(s=n.wasmBinary);var h=n.noExitRuntime||!0;"object"!=typeof WebAssembly&&$("no native wasm support detected");var b,v=!1,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function y(t,n,r){var e=n+r;for(r=n;t[r]&&!(r>=e);)++r;if(16<r-n&&t.subarray&&p)return p.decode(t.subarray(n,r));for(e="";n<r;){var i=t[n++];if(128&i){var a=63&t[n++];if(192==(224&i))e+=String.fromCharCode((31&i)<<6|a);else{var o=63&t[n++];65536>(i=224==(240&i)?(15&i)<<12|a<<6|o:(7&i)<<18|a<<12|o<<6|63&t[n++])?e+=String.fromCharCode(i):(i-=65536,e+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else e+=String.fromCharCode(i)}return e}function d(t,n,r,e){if(0<e){e=r+e-1;for(var i=0;i<t.length;++i){var a=t.charCodeAt(i);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i)),127>=a){if(r>=e)break;n[r++]=a}else{if(2047>=a){if(r+1>=e)break;n[r++]=192|a>>6}else{if(65535>=a){if(r+2>=e)break;n[r++]=224|a>>12}else{if(r+3>=e)break;n[r++]=240|a>>18,n[r++]=128|a>>12&63}n[r++]=128|a>>6&63}n[r++]=128|63&a}}n[r]=0}}function g(t){for(var n=0,r=0;r<t.length;++r){var e=t.charCodeAt(r);55296<=e&&57343>=e&&(e=65536+((1023&e)<<10)|1023&t.charCodeAt(++r)),127>=e?++n:n=2047>=e?n+2:65535>=e?n+3:n+4}return n}var m,w,T,_,R,A,C,S,W,j="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function P(t,n){for(var r=t>>1,e=r+n/2;!(r>=e)&&R[r];)++r;if(32<(r<<=1)-t&&j)return j.decode(T.subarray(t,r));for(r="",e=0;!(e>=n/2);++e){var i=_[t+2*e>>1];if(0==i)break;r+=String.fromCharCode(i)}return r}function k(t,n,r){if(void 0===r&&(r=2147483647),2>r)return 0;var e=n;r=(r-=2)<2*t.length?r/2:t.length;for(var i=0;i<r;++i)_[n>>1]=t.charCodeAt(i),n+=2;return _[n>>1]=0,n-e}function Q(t){return 2*t.length}function D(t,n){for(var r=0,e="";!(r>=n/4);){var i=A[t+4*r>>2];if(0==i)break;++r,65536<=i?(i-=65536,e+=String.fromCharCode(55296|i>>10,56320|1023&i)):e+=String.fromCharCode(i)}return e}function F(t,n,r){if(void 0===r&&(r=2147483647),4>r)return 0;var e=n;r=e+r-4;for(var i=0;i<t.length;++i){var a=t.charCodeAt(i);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i)),A[n>>2]=a,(n+=4)+4>r)break}return A[n>>2]=0,n-e}function E(t){for(var n=0,r=0;r<t.length;++r){var e=t.charCodeAt(r);55296<=e&&57343>=e&&++r,n+=4}return n}function O(){var t=b.buffer;m=t,n.HEAP8=w=new Int8Array(t),n.HEAP16=_=new Int16Array(t),n.HEAP32=A=new Int32Array(t),n.HEAPU8=T=new Uint8Array(t),n.HEAPU16=R=new Uint16Array(t),n.HEAPU32=C=new Uint32Array(t),n.HEAPF32=S=new Float32Array(t),n.HEAPF64=W=new Float64Array(t)}var U,M=[],x=[],Y=[],I=[];function V(){var t=n.preRun.shift();M.unshift(t)}var H,B=0,X=null,Z=null;function $(t){throw n.onAbort&&n.onAbort(t),f(t="Aborted("+t+")"),v=!0,t=new WebAssembly.RuntimeError(t+". Build with -s ASSERTIONS=1 for more info."),e(t),t}function z(){return H.startsWith("data:application/octet-stream;base64,")}if(n.preloadedImages={},n.preloadedAudios={},H="ConfiguratorKernel.wasm",!z()){var q=H;H=n.locateFile?n.locateFile(q,c):c+q}function N(){var t=H;try{if(t==H&&s)return new Uint8Array(s);throw"both async and sync fetching of the wasm failed"}catch(t){$(t)}}function K(t){for(;0<t.length;){var r=t.shift();if("function"==typeof r)r(n);else{var e=r.hd;"number"==typeof e?void 0===r.xc?L(e)():L(e)(r.xc):e(void 0===r.xc?null:r.xc)}}}function L(t){return U.get(t)}function G(t){this.Ec=t,this.Rb=t-16,this.vc=function(t){A[this.Rb+4>>2]=t},this.kc=function(){return A[this.Rb+4>>2]},this.bc=function(t){A[this.Rb+8>>2]=t},this.Pc=function(){return A[this.Rb+8>>2]},this.dc=function(){A[this.Rb>>2]=0},this.Cc=function(t){w[this.Rb+12>>0]=t?1:0},this.Oc=function(){return 0!=w[this.Rb+12>>0]},this.rc=function(t){w[this.Rb+13>>0]=t?1:0},this.Gc=function(){return 0!=w[this.Rb+13>>0]},this.ac=function(t,n){this.vc(t),this.bc(n),this.dc(),this.Cc(!1),this.rc(!1)},this.wc=function(){A[this.Rb>>2]+=1},this.Yc=function(){var t=A[this.Rb>>2];return A[this.Rb>>2]=t-1,1===t}}function J(t){this.yc=function(){Pn(this.Rb),this.Rb=0},this.bc=function(t){A[this.Rb>>2]=t},this.fc=function(){return A[this.Rb>>2]},this.ac=function(t){A[this.Rb+4>>2]=t},this.dc=function(){return this.Rb+4},this.vc=function(){return A[this.Rb+4>>2]},this.Ic=function(){if(Mn(this.hc().kc()))return A[this.fc()>>2];var t=this.vc();return 0!==t?t:this.fc()},this.hc=function(){return new G(this.fc())},void 0===t?(this.Rb=kn(8),this.ac(0)):this.Rb=t}var tt=[],nt=0;function rt(t){return Pn(new G(t).Rb)}function et(t){if(t.Yc()&&!t.Gc()){var n=t.Pc();n&&L(n)(t.Ec),rt(t.Ec)}}var it=0;function at(){var t=tt.pop();t||$("no exception to throw");var n=t.hc(),r=t.fc();throw n.Gc()?t.yc():(tt.push(t),n.rc(!0),n.Cc(!1),nt++),it=r,r}var ot={};function ct(t){for(;t.length;){var n=t.pop();t.pop()(n)}}function ut(t){return this.fromWireType(C[t>>2])}var ft={},st={},lt={};function ht(t){if(void 0===t)return"_unknown";var n=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=n&&57>=n?"_"+t:t}function bt(t,n){return t=ht(t),new Function("body","return function "+t+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(n)}function vt(t){var n=Error,r=bt(t,(function(n){this.name=t,this.message=n,void 0!==(n=Error(n).stack)&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var pt=void 0;function yt(t){throw new pt(t)}function dt(t,n,r){function e(n){(n=r(n)).length!==t.length&&yt("Mismatched type converter count");for(var e=0;e<t.length;++e)Rt(t[e],n[e])}t.forEach((function(t){lt[t]=n}));var i=Array(n.length),a=[],o=0;n.forEach((function(t,n){st.hasOwnProperty(t)?i[n]=st[t]:(a.push(t),ft.hasOwnProperty(t)||(ft[t]=[]),ft[t].push((function(){i[n]=st[t],++o===a.length&&e(i)})))})),0===a.length&&e(i)}function gt(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}var mt=void 0;function wt(t){for(var n="";T[t];)n+=mt[T[t++]];return n}var Tt=void 0;function _t(t){throw new Tt(t)}function Rt(t,n,r={}){if(!("argPackAdvance"in n))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=n.name;if(t||_t('type "'+e+'" must have a positive integer typeid pointer'),st.hasOwnProperty(t)){if(r.Tc)return;_t("Cannot register type '"+e+"' twice")}st[t]=n,delete lt[t],ft.hasOwnProperty(t)&&(n=ft[t],delete ft[t],n.forEach((function(t){t()})))}function At(t){_t(t.Qb.Tb.Sb.name+" instance already deleted")}var Ct=!1;function St(){}function Wt(t){--t.count.value,0===t.count.value&&(t.Vb?t.Yb.$b(t.Vb):t.Tb.Sb.$b(t.Rb))}var jt={},Pt=[];function kt(){for(;Pt.length;){var t=Pt.pop();t.Qb.ec=!1,t.delete()}}var Qt=void 0,Dt={};function Ft(t,n){return n.Tb&&n.Rb||yt("makeClassHandle requires ptr and ptrType"),!!n.Yb!=!!n.Vb&&yt("Both smartPtrType and smartPtr must be specified"),n.count={value:1},Et(Object.create(t,{Qb:{value:n}}))}function Et(t){return"undefined"==typeof FinalizationRegistry?(Et=t=>t,t):(Ct=new FinalizationRegistry(t=>{Wt(t.Qb)}),St=t=>{Ct.unregister(t)},(Et=t=>{var n=t.Qb;return n.Vb&&Ct.register(t,{Qb:n},t),t})(t))}function Ot(){}function Ut(t,n,r){if(void 0===t[n].Ub){var e=t[n];t[n]=function(){return t[n].Ub.hasOwnProperty(arguments.length)||_t("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[n].Ub+")!"),t[n].Ub[arguments.length].apply(this,arguments)},t[n].Ub=[],t[n].Ub[e.oc]=e}}function Mt(t,r,e){n.hasOwnProperty(t)?((void 0===e||void 0!==n[t].Ub&&void 0!==n[t].Ub[e])&&_t("Cannot register public name '"+t+"' twice"),Ut(n,t,t),n.hasOwnProperty(e)&&_t("Cannot register multiple overloads of a function with the same number of arguments ("+e+")!"),n[t].Ub[e]=r):(n[t]=r,void 0!==e&&(n[t].kd=e))}function xt(t,n,r,e,i,a,o,c){this.name=t,this.constructor=n,this.ic=r,this.$b=e,this.Zb=i,this.Mc=a,this.nc=o,this.Kc=c,this.Wc=[]}function Yt(t,n,r){for(;n!==r;)n.nc||_t("Expected null or instance of "+r.name+", got an instance of "+n.name),t=n.nc(t),n=n.Zb;return t}function It(t,n){return null===n?(this.zc&&_t("null is not a valid "+this.name),0):(n.Qb||_t('Cannot pass "'+on(n)+'" as a '+this.name),n.Qb.Rb||_t("Cannot pass deleted object as a pointer of type "+this.name),Yt(n.Qb.Rb,n.Qb.Tb.Sb,this.Sb))}function Vt(t,n){if(null===n){if(this.zc&&_t("null is not a valid "+this.name),this.qc){var r=this.Ac();return null!==t&&t.push(this.$b,r),r}return 0}if(n.Qb||_t('Cannot pass "'+on(n)+'" as a '+this.name),n.Qb.Rb||_t("Cannot pass deleted object as a pointer of type "+this.name),!this.pc&&n.Qb.Tb.pc&&_t("Cannot convert argument of type "+(n.Qb.Yb?n.Qb.Yb.name:n.Qb.Tb.name)+" to parameter type "+this.name),r=Yt(n.Qb.Rb,n.Qb.Tb.Sb,this.Sb),this.qc)switch(void 0===n.Qb.Vb&&_t("Passing raw pointer to smart pointer is illegal"),this.bd){case 0:n.Qb.Yb===this?r=n.Qb.Vb:_t("Cannot convert argument of type "+(n.Qb.Yb?n.Qb.Yb.name:n.Qb.Tb.name)+" to parameter type "+this.name);break;case 1:r=n.Qb.Vb;break;case 2:if(n.Qb.Yb===this)r=n.Qb.Vb;else{var e=n.clone();r=this.Xc(r,rn((function(){e.delete()}))),null!==t&&t.push(this.$b,r)}break;default:_t("Unsupporting sharing policy")}return r}function Ht(t,n){return null===n?(this.zc&&_t("null is not a valid "+this.name),0):(n.Qb||_t('Cannot pass "'+on(n)+'" as a '+this.name),n.Qb.Rb||_t("Cannot pass deleted object as a pointer of type "+this.name),n.Qb.Tb.pc&&_t("Cannot convert argument of type "+n.Qb.Tb.name+" to parameter type "+this.name),Yt(n.Qb.Rb,n.Qb.Tb.Sb,this.Sb))}function Bt(t,n,r,e,i,a,o,c,u,f,s){this.name=t,this.Sb=n,this.zc=r,this.pc=e,this.qc=i,this.Vc=a,this.bd=o,this.Hc=c,this.Ac=u,this.Xc=f,this.$b=s,i||void 0!==n.Zb?this.toWireType=Vt:(this.toWireType=e?It:Ht,this.Xb=null)}function Xt(t,r,e){n.hasOwnProperty(t)||yt("Replacing nonexistant public symbol"),void 0!==n[t].Ub&&void 0!==e?n[t].Ub[e]=r:(n[t]=r,n[t].oc=e)}function Zt(t,r){var e=(t=wt(t)).includes("j")?function(t,r){var e=[];return function(){if(e.length=0,Object.assign(e,arguments),t.includes("j")){var i=n["dynCall_"+t];i=e&&e.length?i.apply(null,[r].concat(e)):i.call(null,r)}else i=L(r).apply(null,e);return i}}(t,r):L(r);return"function"!=typeof e&&_t("unknown function pointer with signature "+t+": "+r),e}var $t=void 0;function zt(t){var n=wt(t=Qn(t));return Pn(t),n}function qt(t,n){var r=[],e={};throw n.forEach((function t(n){e[n]||st[n]||(lt[n]?lt[n].forEach(t):(r.push(n),e[n]=!0))})),new $t(t+": "+r.map(zt).join([", "]))}function Nt(t,n){for(var r=[],e=0;e<t;e++)r.push(A[(n>>2)+e]);return r}function Kt(t){var n=Function;if(!(n instanceof Function))throw new TypeError("new_ called with constructor type "+typeof n+" which is not a function");var r=bt(n.name||"unknownFunctionName",(function(){}));return r.prototype=n.prototype,r=new r,(t=n.apply(r,t))instanceof Object?t:r}function Lt(t,n,r,e,i){var a=n.length;2>a&&_t("argTypes array size mismatch! Must at least get return value and 'this' types!");var o=null!==n[1]&&null!==r,c=!1;for(r=1;r<n.length;++r)if(null!==n[r]&&void 0===n[r].Xb){c=!0;break}var u="void"!==n[0].name,f="",s="";for(r=0;r<a-2;++r)f+=(0!==r?", ":"")+"arg"+r,s+=(0!==r?", ":"")+"arg"+r+"Wired";t="return function "+ht(t)+"("+f+") {\nif (arguments.length !== "+(a-2)+") {\nthrowBindingError('function "+t+" called with ' + arguments.length + ' arguments, expected "+(a-2)+" args!');\n}\n",c&&(t+="var destructors = [];\n");var l=c?"destructors":"null";for(f="throwBindingError invoker fn runDestructors retType classParam".split(" "),e=[_t,e,i,ct,n[0],n[1]],o&&(t+="var thisWired = classParam.toWireType("+l+", this);\n"),r=0;r<a-2;++r)t+="var arg"+r+"Wired = argType"+r+".toWireType("+l+", arg"+r+"); // "+n[r+2].name+"\n",f.push("argType"+r),e.push(n[r+2]);if(o&&(s="thisWired"+(0<s.length?", ":"")+s),t+=(u?"var rv = ":"")+"invoker(fn"+(0<s.length?", ":"")+s+");\n",c)t+="runDestructors(destructors);\n";else for(r=o?1:2;r<n.length;++r)a=1===r?"thisWired":"arg"+(r-2)+"Wired",null!==n[r].Xb&&(t+=a+"_dtor("+a+"); // "+n[r].name+"\n",f.push(a+"_dtor"),e.push(n[r].Xb));return u&&(t+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),f.push(t+"}\n"),Kt(f).apply(null,e)}var Gt=[],Jt=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function tn(t){4<t&&0==--Jt[t].Bc&&(Jt[t]=void 0,Gt.push(t))}function nn(t){return t||_t("Cannot use deleted val. handle = "+t),Jt[t].value}function rn(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var n=Gt.length?Gt.pop():Jt.length;return Jt[n]={Bc:1,value:t},n}}function en(t,n,r){switch(n){case 0:return function(t){return this.fromWireType((r?w:T)[t])};case 1:return function(t){return this.fromWireType((r?_:R)[t>>1])};case 2:return function(t){return this.fromWireType((r?A:C)[t>>2])};default:throw new TypeError("Unknown integer type: "+t)}}function an(t,n){var r=st[t];return void 0===r&&_t(n+" has unknown type "+zt(t)),r}function on(t){if(null===t)return"null";var n=typeof t;return"object"===n||"array"===n||"function"===n?t.toString():""+t}function cn(t,n){switch(n){case 2:return function(t){return this.fromWireType(S[t>>2])};case 3:return function(t){return this.fromWireType(W[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function un(t,n,r){switch(n){case 0:return r?function(t){return w[t]}:function(t){return T[t]};case 1:return r?function(t){return _[t>>1]}:function(t){return R[t>>1]};case 2:return r?function(t){return A[t>>2]}:function(t){return C[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function fn(t,n){for(var r=Array(t),e=0;e<t;++e)r[e]=an(A[(n>>2)+e],"parameter "+e);return r}var sn={};function ln(t){var n=sn[t];return void 0===n?wt(t):n}var hn=[];function bn(){return"object"==typeof globalThis?globalThis:Function("return this")()}var vn=[],pn={},yn={};function dn(){if(!gn){var t,n={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:a||"./this.program"};for(t in yn)void 0===yn[t]?delete n[t]:n[t]=yn[t];var r=[];for(t in n)r.push(t+"="+n[t]);gn=r}return gn}var gn,mn=[null,[],[]],wn={};function Tn(t){return 0==t%4&&(0!=t%100||0==t%400)}function _n(t,n){for(var r=0,e=0;e<=n;r+=t[e++]);return r}var Rn=[31,29,31,30,31,30,31,31,30,31,30,31],An=[31,28,31,30,31,30,31,31,30,31,30,31];function Cn(t,n){for(t=new Date(t.getTime());0<n;){var r=t.getMonth(),e=(Tn(t.getFullYear())?Rn:An)[r];if(!(n>e-t.getDate())){t.setDate(t.getDate()+n);break}n-=e-t.getDate()+1,t.setDate(1),11>r?t.setMonth(r+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t}pt=n.InternalError=vt("InternalError");for(var Sn=Array(256),Wn=0;256>Wn;++Wn)Sn[Wn]=String.fromCharCode(Wn);mt=Sn,Tt=n.BindingError=vt("BindingError"),Ot.prototype.isAliasOf=function(t){if(!(this instanceof Ot&&t instanceof Ot))return!1;var n=this.Qb.Tb.Sb,r=this.Qb.Rb,e=t.Qb.Tb.Sb;for(t=t.Qb.Rb;n.Zb;)r=n.nc(r),n=n.Zb;for(;e.Zb;)t=e.nc(t),e=e.Zb;return n===e&&r===t},Ot.prototype.clone=function(){if(this.Qb.Rb||At(this),this.Qb.lc)return this.Qb.count.value+=1,this;var t=Et,n=Object,r=n.create,e=Object.getPrototypeOf(this),i=this.Qb;return(t=t(r.call(n,e,{Qb:{value:{count:i.count,ec:i.ec,lc:i.lc,Rb:i.Rb,Tb:i.Tb,Vb:i.Vb,Yb:i.Yb}}}))).Qb.count.value+=1,t.Qb.ec=!1,t},Ot.prototype.delete=function(){this.Qb.Rb||At(this),this.Qb.ec&&!this.Qb.lc&&_t("Object already scheduled for deletion"),St(this),Wt(this.Qb),this.Qb.lc||(this.Qb.Vb=void 0,this.Qb.Rb=void 0)},Ot.prototype.isDeleted=function(){return!this.Qb.Rb},Ot.prototype.deleteLater=function(){return this.Qb.Rb||At(this),this.Qb.ec&&!this.Qb.lc&&_t("Object already scheduled for deletion"),Pt.push(this),1===Pt.length&&Qt&&Qt(kt),this.Qb.ec=!0,this},n.getInheritedInstanceCount=function(){return Object.keys(Dt).length},n.getLiveInheritedInstances=function(){var t,n=[];for(t in Dt)Dt.hasOwnProperty(t)&&n.push(Dt[t]);return n},n.flushPendingDeletes=kt,n.setDelayFunction=function(t){Qt=t,Pt.length&&Qt&&Qt(kt)},Bt.prototype.Nc=function(t){return this.Hc&&(t=this.Hc(t)),t},Bt.prototype.Dc=function(t){this.$b&&this.$b(t)},Bt.prototype.argPackAdvance=8,Bt.prototype.readValueFromPointer=ut,Bt.prototype.deleteObject=function(t){null!==t&&t.delete()},Bt.prototype.fromWireType=function(t){function n(){return this.qc?Ft(this.Sb.ic,{Tb:this.Vc,Rb:r,Yb:this,Vb:t}):Ft(this.Sb.ic,{Tb:this,Rb:t})}var r=this.Nc(t);if(!r)return this.Dc(t),null;var e=function(t,n){for(void 0===n&&_t("ptr should not be undefined");t.Zb;)n=t.nc(n),t=t.Zb;return Dt[n]}(this.Sb,r);if(void 0!==e)return 0===e.Qb.count.value?(e.Qb.Rb=r,e.Qb.Vb=t,e.clone()):(e=e.clone(),this.Dc(t),e);if(e=this.Sb.Mc(r),!(e=jt[e]))return n.call(this);e=this.pc?e.Jc:e.pointerType;var i=function t(n,r,e){return r===e?n:void 0===e.Zb||null===(n=t(n,r,e.Zb))?null:e.Kc(n)}(r,this.Sb,e.Sb);return null===i?n.call(this):this.qc?Ft(e.Sb.ic,{Tb:e,Rb:i,Yb:this,Vb:t}):Ft(e.Sb.ic,{Tb:e,Rb:i})},$t=n.UnboundTypeError=vt("UnboundTypeError"),n.count_emval_handles=function(){for(var t=0,n=5;n<Jt.length;++n)void 0!==Jt[n]&&++t;return t},n.get_first_emval=function(){for(var t=5;t<Jt.length;++t)if(void 0!==Jt[t])return Jt[t];return null};var jn={n:function(t){return kn(t+16)+16},p:function(t){var n=(t=new J(t)).hc();return n.Oc()||(n.Cc(!0),nt--),n.rc(!1),tt.push(t),n.wc(),t.Ic()},Ma:function(t){throw f("Unexpected exception thrown, this is not properly supported - aborting"),v=!0,t},Sa:function(){if(!tt.length)return 0;var t=tt[tt.length-1];return t.hc().wc(),t.fc()},ua:function(t){t&&et(new G(t))},u:function(){Fn(0);var t=tt.pop();et(t.hc()),t.yc(),it=0},b:function(){var t=it;if(!t)return l=0;var n=new G(t).kc(),r=new J;if(r.bc(t),r.ac(t),!n)return l=0,0|r.Rb;t=Array.prototype.slice.call(arguments);for(var e=0;e<t.length;e++){var i=t[e];if(0===i||i===n)break;if(Un(i,n,r.dc()))return l=i,0|r.Rb}return l=n,0|r.Rb},h:function(){var t=it;if(!t)return l=0;var n=new G(t).kc(),r=new J;if(r.bc(t),r.ac(t),!n)return l=0,0|r.Rb;t=Array.prototype.slice.call(arguments);for(var e=0;e<t.length;e++){var i=t[e];if(0===i||i===n)break;if(Un(i,n,r.dc()))return l=i,0|r.Rb}return l=n,0|r.Rb},F:function(){var t=it;if(!t)return l=0;var n=new G(t).kc(),r=new J;if(r.bc(t),r.ac(t),!n)return l=0,0|r.Rb;t=Array.prototype.slice.call(arguments);for(var e=0;e<t.length;e++){var i=t[e];if(0===i||i===n)break;if(Un(i,n,r.dc()))return l=i,0|r.Rb}return l=n,0|r.Rb},Aa:function(){var t=it;if(!t)return l=0;var n=new G(t).kc(),r=new J;if(r.bc(t),r.ac(t),!n)return l=0,0|r.Rb;t=Array.prototype.slice.call(arguments);for(var e=0;e<t.length;e++){var i=t[e];if(0===i||i===n)break;if(Un(i,n,r.dc()))return l=i,0|r.Rb}return l=n,0|r.Rb},o:rt,ta:function(t){t&&new G(t).wc()},sa:at,Ra:function(t){if(t){var n=new J;n.bc(t),t=n.hc(),tt.push(n),t.rc(!0),at()}},H:function(t,n,r){throw new G(t).ac(n,r),it=t,nt++,t},Ta:function(){return nt},e:function(t){var n=(t=new J(t)).fc();throw it||(it=n),t.yc(),n},ab:function(t){var n=ot[t];delete ot[t];var r=n.Ac,e=n.$b,i=n.Fc;dt([t],i.map((function(t){return t.Sc})).concat(i.map((function(t){return t.$c}))),(function(t){var a={};return i.forEach((function(n,r){var e=t[r],o=n.Qc,c=n.Rc,u=t[r+i.length],f=n.Zc,s=n.ad;a[n.Lc]={read:function(t){return e.fromWireType(o(c,t))},write:function(t,n){var r=[];f(s,t,u.toWireType(r,n)),ct(r)}}})),[{name:n.name,fromWireType:function(t){var n,r={};for(n in a)r[n]=a[n].read(t);return e(t),r},toWireType:function(t,n){for(var i in a)if(!(i in n))throw new TypeError('Missing field: "'+i+'"');var o=r();for(i in a)a[i].write(o,n[i]);return null!==t&&t.push(e,o),o},argPackAdvance:8,readValueFromPointer:ut,Xb:e}]}))},jb:function(){},Xa:function(t,n,r,e,i){var a=gt(r);Rt(t,{name:n=wt(n),fromWireType:function(t){return!!t},toWireType:function(t,n){return n?e:i},argPackAdvance:8,readValueFromPointer:function(t){if(1===r)var e=w;else if(2===r)e=_;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+n);e=A}return this.fromWireType(e[t>>a])},Xb:null})},A:function(t,n,r,e,i,a,o,c,u,f,s,l,h){s=wt(s),a=Zt(i,a),c&&(c=Zt(o,c)),f&&(f=Zt(u,f)),h=Zt(l,h);var b=ht(s);Mt(b,(function(){qt("Cannot construct "+s+" due to unbound types",[e])})),dt([t,n,r],e?[e]:[],(function(n){if(n=n[0],e)var r=n.Sb,i=r.ic;else i=Ot.prototype;n=bt(b,(function(){if(Object.getPrototypeOf(this)!==o)throw new Tt("Use 'new' to construct "+s);if(void 0===u.cc)throw new Tt(s+" has no accessible constructor");var t=u.cc[arguments.length];if(void 0===t)throw new Tt("Tried to invoke ctor of "+s+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(u.cc).toString()+") parameters instead!");return t.apply(this,arguments)}));var o=Object.create(i,{constructor:{value:n}});n.prototype=o;var u=new xt(s,n,o,h,r,a,c,f);r=new Bt(s,u,!0,!1,!1),i=new Bt(s+"*",u,!1,!1,!1);var l=new Bt(s+" const*",u,!1,!0,!1);return jt[t]={pointerType:i,Jc:l},Xt(b,n),[r,i,l]}))},z:function(t,n,r,e,i,a){0<n||$(void 0);var o=Nt(n,r);i=Zt(e,i),dt([],[t],(function(t){var r="constructor "+(t=t[0]).name;if(void 0===t.Sb.cc&&(t.Sb.cc=[]),void 0!==t.Sb.cc[n-1])throw new Tt("Cannot register multiple constructors with identical number of parameters ("+(n-1)+") for class '"+t.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return t.Sb.cc[n-1]=()=>{qt("Cannot construct "+t.name+" due to unbound types",o)},dt([],o,(function(e){return e.splice(1,0,null),t.Sb.cc[n-1]=Lt(r,e,null,i,a),[]})),[]}))},m:function(t,n,r,e,i,a,o,c){var u=Nt(r,e);n=wt(n),a=Zt(i,a),dt([],[t],(function(t){function e(){qt("Cannot call "+i+" due to unbound types",u)}var i=(t=t[0]).name+"."+n;n.startsWith("@@")&&(n=Symbol[n.substring(2)]),c&&t.Sb.Wc.push(n);var f=t.Sb.ic,s=f[n];return void 0===s||void 0===s.Ub&&s.className!==t.name&&s.oc===r-2?(e.oc=r-2,e.className=t.name,f[n]=e):(Ut(f,n,i),f[n].Ub[r-2]=e),dt([],u,(function(e){return e=Lt(i,e,t,a,o),void 0===f[n].Ub?(e.oc=r-2,f[n]=e):f[n].Ub[r-2]=e,[]})),[]}))},Wa:function(t,n){Rt(t,{name:n=wt(n),fromWireType:function(t){var n=nn(t);return tn(t),n},toWireType:function(t,n){return rn(n)},argPackAdvance:8,readValueFromPointer:ut,Xb:null})},Z:function(t,n,r,e){function i(){}r=gt(r),n=wt(n),i.values={},Rt(t,{name:n,constructor:i,fromWireType:function(t){return this.constructor.values[t]},toWireType:function(t,n){return n.value},argPackAdvance:8,readValueFromPointer:en(n,r,e),Xb:null}),Mt(n,i)},Y:function(t,n,r){var e=an(t,"enum");n=wt(n),t=e.constructor,e=Object.create(e.constructor.prototype,{value:{value:r},constructor:{value:bt(e.name+"_"+n,(function(){}))}}),t.values[r]=e,t[n]=e},va:function(t,n,r){r=gt(r),Rt(t,{name:n=wt(n),fromWireType:function(t){return t},toWireType:function(t,n){return n},argPackAdvance:8,readValueFromPointer:cn(n,r),Xb:null})},X:function(t,n,r,e,i,a){var o=Nt(n,r);t=wt(t),i=Zt(e,i),Mt(t,(function(){qt("Cannot call "+t+" due to unbound types",o)}),n-1),dt([],o,(function(r){return Xt(t,Lt(t,[r[0],null].concat(r.slice(1)),null,i,a),n-1),[]}))},O:function(t,n,r,e,i){n=wt(n),-1===i&&(i=4294967295),i=gt(r);var a=t=>t;if(0===e){var o=32-8*r;a=t=>t<<o>>>o}r=n.includes("unsigned")?function(t,n){return n>>>0}:function(t,n){return n},Rt(t,{name:n,fromWireType:a,toWireType:r,argPackAdvance:8,readValueFromPointer:un(n,i,0!==e),Xb:null})},I:function(t,n,r){function e(t){var n=C;return new i(m,n[1+(t>>=2)],n[t])}var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][n];Rt(t,{name:r=wt(r),fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{Tc:!0})},xa:function(t,n,r,e,i,a,o,c,u,f,s,l){r=wt(r),a=Zt(i,a),c=Zt(o,c),f=Zt(u,f),l=Zt(s,l),dt([t],[n],(function(t){return t=t[0],[new Bt(r,t.Sb,!1,!1,!0,t,e,a,c,f,l)]}))},wa:function(t,n){var r="std::string"===(n=wt(n));Rt(t,{name:n,fromWireType:function(t){var n=C[t>>2];if(r)for(var e=t+4,i=0;i<=n;++i){var a=t+4+i;if(i==n||0==T[a]){if(e=e?y(T,e,a-e):"",void 0===o)var o=e;else o+=String.fromCharCode(0),o+=e;e=a+1}}else{for(o=Array(n),i=0;i<n;++i)o[i]=String.fromCharCode(T[t+4+i]);o=o.join("")}return Pn(t),o},toWireType:function(t,n){n instanceof ArrayBuffer&&(n=new Uint8Array(n));var e="string"==typeof n;e||n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int8Array||_t("Cannot pass non-string to std::string");var i=(r&&e?()=>g(n):()=>n.length)(),a=kn(4+i+1);if(C[a>>2]=i,r&&e)d(n,T,a+4,i+1);else if(e)for(e=0;e<i;++e){var o=n.charCodeAt(e);255<o&&(Pn(a),_t("String has UTF-16 code units that do not fit in 8 bits")),T[a+4+e]=o}else for(e=0;e<i;++e)T[a+4+e]=n[e];return null!==t&&t.push(Pn,a),a},argPackAdvance:8,readValueFromPointer:ut,Xb:function(t){Pn(t)}})},ha:function(t,n,r){if(r=wt(r),2===n)var e=P,i=k,a=Q,o=()=>R,c=1;else 4===n&&(e=D,i=F,a=E,o=()=>C,c=2);Rt(t,{name:r,fromWireType:function(t){for(var r,i=C[t>>2],a=o(),u=t+4,f=0;f<=i;++f){var s=t+4+f*n;f!=i&&0!=a[s>>c]||(u=e(u,s-u),void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),u=s+n)}return Pn(t),r},toWireType:function(t,e){"string"!=typeof e&&_t("Cannot pass non-string to C++ string type "+r);var o=a(e),u=kn(4+o+n);return C[u>>2]=o>>c,i(e,u+4,o+n),null!==t&&t.push(Pn,u),u},argPackAdvance:8,readValueFromPointer:ut,Xb:function(t){Pn(t)}})},C:function(t,n,r,e,i,a){ot[t]={name:wt(n),Ac:Zt(r,e),$b:Zt(i,a),Fc:[]}},s:function(t,n,r,e,i,a,o,c,u,f){ot[t].Fc.push({Lc:wt(n),Sc:r,Qc:Zt(e,i),Rc:a,$c:o,Zc:Zt(c,u),ad:f})},Ya:function(t,n){Rt(t,{Uc:!0,name:n=wt(n),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},ka:function(t,n,r){t=nn(t),n=an(n,"emval::as");var e=[],i=rn(e);return A[r>>2]=i,n.toWireType(e,t)},$a:function(t,n,r,e){t=nn(t),r=fn(n,r);for(var i=Array(n),a=0;a<n;++a){var o=r[a];i[a]=o.readValueFromPointer(e),e+=o.argPackAdvance}return rn(t=t.apply(void 0,i))},T:function(t,n,r,e,i){t=hn[t],n=nn(n),r=ln(r);var a=[];return A[e>>2]=rn(a),t(n,r,a,i)},E:function(t,n,r,e){(t=hn[t])(n=nn(n),r=ln(r),null,e)},ia:tn,Za:function(t){return 0===t?rn(bn()):(t=ln(t),rn(bn()[t]))},x:function(t,n){var r=fn(t,n),e=r[0];n=e.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$";var i=vn[n];if(void 0!==i)return i;i=["retType"];for(var a=[e],o="",c=0;c<t-1;++c)o+=(0!==c?", ":"")+"arg"+c,i.push("argType"+c),a.push(r[1+c]);var u="return function "+ht("methodCaller_"+n)+"(handle, name, destructors, args) {\n",f=0;for(c=0;c<t-1;++c)u+=" var arg"+c+" = argType"+c+".readValueFromPointer(args"+(f?"+"+f:"")+");\n",f+=r[c+1].argPackAdvance;for(u+=" var rv = handle[name]("+o+");\n",c=0;c<t-1;++c)r[c+1].deleteObject&&(u+=" argType"+c+".deleteObject(arg"+c+");\n");return e.Uc||(u+=" return retType.toWireType(destructors, rv);\n"),i.push(u+"};\n"),i=function(t){var n=hn.length;return hn.push(t),n}(t=Kt(i).apply(null,a)),vn[n]=i},db:function(t){return t=ln(t),rn(n[t])},Ha:function(t,n){return rn((t=nn(t))[n=nn(n)])},ja:function(t){4<t&&(Jt[t].Bc+=1)},cb:function(t,r,e,i){t=nn(t);var a=pn[r];if(!a){a="";for(var o=0;o<r;++o)a+=(0!==o?", ":"")+"arg"+o;var c="return function emval_allocator_"+r+"(constructor, argTypes, args) {\n";for(o=0;o<r;++o)c+="var argType"+o+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+o+'], "parameter '+o+'");\nvar arg'+o+" = argType"+o+".readValueFromPointer(args);\nargs += argType"+o+"['argPackAdvance'];\n";a=new Function("requireRegisteredType","Module","valueToHandle",c+"var obj = new constructor("+a+");\nreturn valueToHandle(obj);\n}\n")(an,n,rn),pn[r]=a}return a(t,e,i)},_a:function(){return rn([])},tb:function(t){return rn(ln(t))},Ka:function(t){ct(nn(t)),tn(t)},bb:function(t,n){return(t=nn(t))===nn(n)},B:function(t,n){return rn(t=(t=an(t,"_emval_take_value")).readValueFromPointer(n))},fa:function(){$("")},ga:function(t){var n=T.length;if(2147483648<(t>>>=0))return!1;for(var r=1;4>=r;r*=2){var e=n*(1+.2/r);e=Math.min(e,t+100663296);var i=Math;e=Math.max(t,e),i=i.min.call(i,2147483648,e+(65536-e%65536)%65536);t:{try{b.grow(i-m.byteLength+65535>>>16),O();var a=1;break t}catch(t){}a=void 0}if(a)return!0}return!1},Ua:function(t,n){var r=0;return dn().forEach((function(e,i){var a=n+r;for(i=A[t+4*i>>2]=a,a=0;a<e.length;++a)w[i++>>0]=e.charCodeAt(a);w[i>>0]=0,r+=e.length+1})),0},Va:function(t,n){var r=dn();A[t>>2]=r.length;var e=0;return r.forEach((function(t){e+=t.length+1})),A[n>>2]=e,0},Oa:function(){return 0},Qa:function(t,n,r,e){return t=wn.jd(t),n=wn.gd(t,n,r),A[e>>2]=n,0},ib:function(){},Pa:function(t,n,r,e){for(var i=0,a=0;a<r;a++){var o=A[n>>2],c=A[n+4>>2];n+=8;for(var s=0;s<c;s++){var l=T[o+s],h=mn[t];0===l||10===l?((1===t?u:f)(y(h,0)),h.length=0):h.push(l)}i+=c}return A[e>>2]=i,0},a:function(){return l},La:function(t,n){var r=En();try{return L(t)(n)}catch(t){if(On(r),t!==t+0)throw t;Fn(1,0)}},ca:function(t,n,r){var e=En();try{return L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},Ca:function(t,n,r,e){var i=En();try{return L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},M:function(t,n){var r=En();try{return L(t)(n)}catch(t){if(On(r),t!==t+0)throw t;Fn(1,0)}},nb:function(t,n,r){var e=En();try{return L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},G:function(t,n,r){var e=En();try{return L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},pb:function(t,n,r,e,i){var a=En();try{return L(t)(n,r,e,i)}catch(t){if(On(a),t!==t+0)throw t;Fn(1,0)}},J:function(t,n,r,e){var i=En();try{return L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},W:function(t){var n=En();try{return L(t)()}catch(t){if(On(n),t!==t+0)throw t;Fn(1,0)}},V:function(t,n){var r=En();try{return L(t)(n)}catch(t){if(On(r),t!==t+0)throw t;Fn(1,0)}},Ja:function(t,n,r,e){var i=En();try{return L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},g:function(t,n){var r=En();try{return L(t)(n)}catch(t){if(On(r),t!==t+0)throw t;Fn(1,0)}},ea:function(t,n,r){var e=En();try{return L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},P:function(t,n,r){var e=En();try{return L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},c:function(t,n,r){var e=En();try{return L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},ob:function(t,n,r,e,i){var a=En();try{return L(t)(n,r,e,i)}catch(t){if(On(a),t!==t+0)throw t;Fn(1,0)}},pa:function(t,n,r,e,i,a,o){var c=En();try{return L(t)(n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},i:function(t,n,r,e){var i=En();try{return L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},Ga:function(t,n,r,e,i,a,o,c,u,f,s,l,h,b){var v=En();try{return L(t)(n,r,e,i,a,o,c,u,f,s,l,h,b)}catch(t){if(On(v),t!==t+0)throw t;Fn(1,0)}},q:function(t,n,r,e,i){var a=En();try{return L(t)(n,r,e,i)}catch(t){if(On(a),t!==t+0)throw t;Fn(1,0)}},za:function(t,n,r,e,i,a){var o=En();try{return L(t)(n,r,e,i,a)}catch(t){if(On(o),t!==t+0)throw t;Fn(1,0)}},w:function(t,n,r,e,i,a){var o=En();try{return L(t)(n,r,e,i,a)}catch(t){if(On(o),t!==t+0)throw t;Fn(1,0)}},y:function(t,n,r,e,i,a,o){var c=En();try{return L(t)(n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},K:function(t,n,r,e,i,a,o,c){var u=En();try{return L(t)(n,r,e,i,a,o,c)}catch(t){if(On(u),t!==t+0)throw t;Fn(1,0)}},ba:function(t,n,r,e,i,a,o,c,u){var f=En();try{return L(t)(n,r,e,i,a,o,c,u)}catch(t){if(On(f),t!==t+0)throw t;Fn(1,0)}},_:function(t,n,r,e,i,a,o,c,u,f){var s=En();try{return L(t)(n,r,e,i,a,o,c,u,f)}catch(t){if(On(s),t!==t+0)throw t;Fn(1,0)}},aa:function(t,n,r,e,i,a,o,c,u,f,s,l){var h=En();try{return L(t)(n,r,e,i,a,o,c,u,f,s,l)}catch(t){if(On(h),t!==t+0)throw t;Fn(1,0)}},eb:function(t,n,r,e){var i=En();try{return In(t,n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},hb:function(t,n,r){var e=En();try{return xn(t,n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},j:function(t){var n=En();try{L(t)()}catch(t){if(On(n),t!==t+0)throw t;Fn(1,0)}},l:function(t,n){var r=En();try{L(t)(n)}catch(t){if(On(r),t!==t+0)throw t;Fn(1,0)}},la:function(t,n,r){var e=En();try{L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},qa:function(t,n,r,e){var i=En();try{L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},Fa:function(t,n,r){var e=En();try{L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},ra:function(t,n,r,e,i,a,o,c,u,f){var s=En();try{L(t)(n,r,e,i,a,o,c,u,f)}catch(t){if(On(s),t!==t+0)throw t;Fn(1,0)}},rb:function(t,n,r,e){var i=En();try{L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},qb:function(t,n,r,e,i,a,o,c){var u=En();try{L(t)(n,r,e,i,a,o,c)}catch(t){if(On(u),t!==t+0)throw t;Fn(1,0)}},ma:function(t,n,r,e,i,a,o){var c=En();try{L(t)(n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},d:function(t,n,r){var e=En();try{L(t)(n,r)}catch(t){if(On(e),t!==t+0)throw t;Fn(1,0)}},na:function(t,n,r,e){var i=En();try{L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},S:function(t,n,r,e,i){var a=En();try{L(t)(n,r,e,i)}catch(t){if(On(a),t!==t+0)throw t;Fn(1,0)}},R:function(t,n,r,e,i,a){var o=En();try{L(t)(n,r,e,i,a)}catch(t){if(On(o),t!==t+0)throw t;Fn(1,0)}},Da:function(t,n,r,e){var i=En();try{L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},oa:function(t,n,r,e,i,a){var o=En();try{L(t)(n,r,e,i,a)}catch(t){if(On(o),t!==t+0)throw t;Fn(1,0)}},kb:function(t,n,r,e,i){var a=En();try{L(t)(n,r,e,i)}catch(t){if(On(a),t!==t+0)throw t;Fn(1,0)}},Ia:function(t,n,r,e,i,a,o){var c=En();try{L(t)(n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},f:function(t,n,r,e){var i=En();try{L(t)(n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},mb:function(t,n,r,e,i){var a=En();try{L(t)(n,r,e,i)}catch(t){if(On(a),t!==t+0)throw t;Fn(1,0)}},L:function(t,n,r,e,i,a,o){var c=En();try{L(t)(n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},sb:function(t,n,r,e,i,a){var o=En();try{L(t)(n,r,e,i,a)}catch(t){if(On(o),t!==t+0)throw t;Fn(1,0)}},k:function(t,n,r,e,i){var a=En();try{L(t)(n,r,e,i)}catch(t){if(On(a),t!==t+0)throw t;Fn(1,0)}},da:function(t,n,r,e,i,a){var o=En();try{L(t)(n,r,e,i,a)}catch(t){if(On(o),t!==t+0)throw t;Fn(1,0)}},lb:function(t,n,r,e,i,a,o,c){var u=En();try{L(t)(n,r,e,i,a,o,c)}catch(t){if(On(u),t!==t+0)throw t;Fn(1,0)}},Ea:function(t,n,r,e,i,a,o){var c=En();try{L(t)(n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},t:function(t,n,r,e,i,a){var o=En();try{L(t)(n,r,e,i,a)}catch(t){if(On(o),t!==t+0)throw t;Fn(1,0)}},v:function(t,n,r,e,i,a,o){var c=En();try{L(t)(n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},D:function(t,n,r,e,i,a,o,c){var u=En();try{L(t)(n,r,e,i,a,o,c)}catch(t){if(On(u),t!==t+0)throw t;Fn(1,0)}},Q:function(t,n,r,e,i,a,o,c,u){var f=En();try{L(t)(n,r,e,i,a,o,c,u)}catch(t){if(On(f),t!==t+0)throw t;Fn(1,0)}},U:function(t,n,r,e,i,a,o,c,u,f){var s=En();try{L(t)(n,r,e,i,a,o,c,u,f)}catch(t){if(On(s),t!==t+0)throw t;Fn(1,0)}},N:function(t,n,r,e,i,a,o,c,u,f,s){var l=En();try{L(t)(n,r,e,i,a,o,c,u,f,s)}catch(t){if(On(l),t!==t+0)throw t;Fn(1,0)}},Ba:function(t,n,r,e,i,a,o,c,u,f,s,l){var h=En();try{L(t)(n,r,e,i,a,o,c,u,f,s,l)}catch(t){if(On(h),t!==t+0)throw t;Fn(1,0)}},$:function(t,n,r,e,i,a,o,c,u,f,s,l,h,b,v,p){var y=En();try{L(t)(n,r,e,i,a,o,c,u,f,s,l,h,b,v,p)}catch(t){if(On(y),t!==t+0)throw t;Fn(1,0)}},fb:function(t,n,r,e,i,a,o){var c=En();try{Yn(t,n,r,e,i,a,o)}catch(t){if(On(c),t!==t+0)throw t;Fn(1,0)}},gb:function(t,n,r,e){var i=En();try{Vn(t,n,r,e)}catch(t){if(On(i),t!==t+0)throw t;Fn(1,0)}},r:function(t){return t},ya:function(t){l=t},Na:function(t,n,r,e){return function(t,n,r,e){function i(t,n,r){for(t="number"==typeof t?t.toString():t||"";t.length<n;)t=r[0]+t;return t}function a(t,n){return i(t,n,"0")}function o(t,n){function r(t){return 0>t?-1:0<t?1:0}var e;return 0===(e=r(t.getFullYear()-n.getFullYear()))&&0===(e=r(t.getMonth()-n.getMonth()))&&(e=r(t.getDate()-n.getDate())),e}function c(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function u(t){t=Cn(new Date(t.Wb+1900,0,1),t.uc);var n=new Date(t.getFullYear()+1,0,4),r=c(new Date(t.getFullYear(),0,4));return n=c(n),0>=o(r,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=A[e+40>>2];for(var s in e={ed:A[e>>2],dd:A[e+4>>2],sc:A[e+8>>2],mc:A[e+12>>2],jc:A[e+16>>2],Wb:A[e+20>>2],tc:A[e+24>>2],uc:A[e+28>>2],ld:A[e+32>>2],cd:A[e+36>>2],fd:f&&f?y(T,f,void 0):""},r=r?y(T,r,void 0):"",f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(s,"g"),f[s]);var l="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),h="January February March April May June July August September October November December".split(" ");for(s in f={"%a":function(t){return l[t.tc].substring(0,3)},"%A":function(t){return l[t.tc]},"%b":function(t){return h[t.jc].substring(0,3)},"%B":function(t){return h[t.jc]},"%C":function(t){return a((t.Wb+1900)/100|0,2)},"%d":function(t){return a(t.mc,2)},"%e":function(t){return i(t.mc,2," ")},"%g":function(t){return u(t).toString().substring(2)},"%G":function(t){return u(t)},"%H":function(t){return a(t.sc,2)},"%I":function(t){return 0==(t=t.sc)?t=12:12<t&&(t-=12),a(t,2)},"%j":function(t){return a(t.mc+_n(Tn(t.Wb+1900)?Rn:An,t.jc-1),3)},"%m":function(t){return a(t.jc+1,2)},"%M":function(t){return a(t.dd,2)},"%n":function(){return"\n"},"%p":function(t){return 0<=t.sc&&12>t.sc?"AM":"PM"},"%S":function(t){return a(t.ed,2)},"%t":function(){return"\t"},"%u":function(t){return t.tc||7},"%U":function(t){var n=new Date(t.Wb+1900,0,1),r=0===n.getDay()?n:Cn(n,7-n.getDay());return 0>o(r,t=new Date(t.Wb+1900,t.jc,t.mc))?a(Math.ceil((31-r.getDate()+(_n(Tn(t.getFullYear())?Rn:An,t.getMonth()-1)-31)+t.getDate())/7),2):0===o(r,n)?"01":"00"},"%V":function(t){var n=new Date(t.Wb+1901,0,4),r=c(new Date(t.Wb+1900,0,4));n=c(n);var e=Cn(new Date(t.Wb+1900,0,1),t.uc);return 0>o(e,r)?"53":0>=o(n,e)?"01":a(Math.ceil((r.getFullYear()<t.Wb+1900?t.uc+32-r.getDate():t.uc+1-r.getDate())/7),2)},"%w":function(t){return t.tc},"%W":function(t){var n=new Date(t.Wb,0,1),r=1===n.getDay()?n:Cn(n,0===n.getDay()?1:7-n.getDay()+1);return 0>o(r,t=new Date(t.Wb+1900,t.jc,t.mc))?a(Math.ceil((31-r.getDate()+(_n(Tn(t.getFullYear())?Rn:An,t.getMonth()-1)-31)+t.getDate())/7),2):0===o(r,n)?"01":"00"},"%y":function(t){return(t.Wb+1900).toString().substring(2)},"%Y":function(t){return t.Wb+1900},"%z":function(t){var n=0<=(t=t.cd);return t=Math.abs(t)/60,(n?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.fd},"%%":function(){return"%"}},r=r.replace(/%%/g,"\0\0"),f)r.includes(s)&&(r=r.replace(new RegExp(s,"g"),f[s](e)));return(s=function(t){var n=Array(g(t)+1);return d(t,n,0,n.length),n}(r=r.replace(/\0\0/g,"%"))).length>n?0:(w.set(s,t),s.length-1)}(t,n,r,e)}};!function(){function t(t){n.asm=t.exports,b=n.asm.ub,O(),U=n.asm.Bb,x.unshift(n.asm.vb),B--,n.monitorRunDependencies&&n.monitorRunDependencies(B),0==B&&(null!==X&&(clearInterval(X),X=null),Z&&(t=Z,Z=null,t()))}function r(n){t(n.instance)}function i(t){return(s||"function"!=typeof fetch?Promise.resolve().then((function(){return N()})):fetch(H,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+H+"'";return t.arrayBuffer()})).catch((function(){return N()}))).then((function(t){return WebAssembly.instantiate(t,a)})).then((function(t){return t})).then(t,(function(t){f("failed to asynchronously prepare wasm: "+t),$(t)}))}var a={a:jn};if(B++,n.monitorRunDependencies&&n.monitorRunDependencies(B),n.instantiateWasm)try{return n.instantiateWasm(a,t)}catch(t){return f("Module.instantiateWasm callback failed with error: "+t),!1}(s||"function"!=typeof WebAssembly.instantiateStreaming||z()||"function"!=typeof fetch?i(r):fetch(H,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,a).then(r,(function(t){return f("wasm streaming compile failed: "+t),f("falling back to ArrayBuffer instantiation"),i(r)}))}))).catch(e)}(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.vb).apply(null,arguments)};var Pn=n._free=function(){return(Pn=n._free=n.asm.wb).apply(null,arguments)},kn=n._malloc=function(){return(kn=n._malloc=n.asm.xb).apply(null,arguments)};n._main=function(){return(n._main=n.asm.yb).apply(null,arguments)};var Qn=n.___getTypeName=function(){return(Qn=n.___getTypeName=n.asm.zb).apply(null,arguments)};n.___embind_register_native_and_builtin_types=function(){return(n.___embind_register_native_and_builtin_types=n.asm.Ab).apply(null,arguments)};var Dn,Fn=n._setThrew=function(){return(Fn=n._setThrew=n.asm.Cb).apply(null,arguments)},En=n.stackSave=function(){return(En=n.stackSave=n.asm.Db).apply(null,arguments)},On=n.stackRestore=function(){return(On=n.stackRestore=n.asm.Eb).apply(null,arguments)},Un=n.___cxa_can_catch=function(){return(Un=n.___cxa_can_catch=n.asm.Fb).apply(null,arguments)},Mn=n.___cxa_is_pointer_type=function(){return(Mn=n.___cxa_is_pointer_type=n.asm.Gb).apply(null,arguments)},xn=n.dynCall_jii=function(){return(xn=n.dynCall_jii=n.asm.Hb).apply(null,arguments)},Yn=n.dynCall_viiiji=function(){return(Yn=n.dynCall_viiiji=n.asm.Ib).apply(null,arguments)},In=n.dynCall_iij=function(){return(In=n.dynCall_iij=n.asm.Jb).apply(null,arguments)},Vn=n.dynCall_vij=function(){return(Vn=n.dynCall_vij=n.asm.Kb).apply(null,arguments)};function Hn(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Bn(){function t(){if(!Dn&&(Dn=!0,n.calledRun=!0,!v)){if(K(x),K(Y),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),Xn){var t=n._main;try{var e=t(0,0);h||(n.onExit&&n.onExit(e),v=!0),o(e,new Hn(e))}catch(t){t instanceof Hn||"unwind"==t||o(1,t)}}if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)t=n.postRun.shift(),I.unshift(t);K(I)}}if(!(0<B)){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)V();K(M),0<B||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),t()}),1)):t())}}if(n.dynCall_viijii=function(){return(n.dynCall_viijii=n.asm.Lb).apply(null,arguments)},n.dynCall_jiji=function(){return(n.dynCall_jiji=n.asm.Mb).apply(null,arguments)},n.dynCall_iiiiij=function(){return(n.dynCall_iiiiij=n.asm.Nb).apply(null,arguments)},n.dynCall_iiiiijj=function(){return(n.dynCall_iiiiijj=n.asm.Ob).apply(null,arguments)},n.dynCall_iiiiiijj=function(){return(n.dynCall_iiiiiijj=n.asm.Pb).apply(null,arguments)},Z=function t(){Dn||Bn(),Dn||(Z=t)},n.run=Bn,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.pop()();var Xn=!0;return n.noInitialRun&&(Xn=!1),Bn(),t.ready});"object"==typeof exports&&"object"==typeof module?module.exports=ConfiguratorKernel:"function"==typeof define&&define.amd?define([],(function(){return ConfiguratorKernel})):"object"==typeof exports&&(exports.ConfiguratorKernel=ConfiguratorKernel);