@roomle/web-sdk 2.19.0-alpha.1 → 2.19.0-alpha.5

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 (199) hide show
  1. package/lib/{banana-for-scale-a07b26b1.js → banana-for-scale-355fcf91.js} +2 -2
  2. package/lib/{banana-for-scale-a07b26b1.js.map → banana-for-scale-355fcf91.js.map} +1 -1
  3. package/lib/{banana-for-scale-c4c531c7.nomodule.js → banana-for-scale-9de01393.nomodule.js} +2 -2
  4. package/lib/{banana-for-scale-c4c531c7.nomodule.js.map → banana-for-scale-9de01393.nomodule.js.map} +1 -1
  5. package/lib/{component-dimensioning-57fff7bc.nomodule.js → component-dimensioning-4d83a9c3.nomodule.js} +2 -2
  6. package/lib/component-dimensioning-4d83a9c3.nomodule.js.map +1 -0
  7. package/lib/{component-dimensioning-d7dd5f83.js → component-dimensioning-d00ca4a8.js} +2 -2
  8. package/lib/component-dimensioning-d00ca4a8.js.map +1 -0
  9. package/lib/configurator-77a25cc9.js +2 -0
  10. package/lib/{configurator-b44d4749.js.map → configurator-77a25cc9.js.map} +1 -1
  11. package/lib/configurator-a858be94.nomodule.js +2 -0
  12. package/lib/{configurator-b17d82a9.nomodule.js.map → configurator-a858be94.nomodule.js.map} +1 -1
  13. package/lib/configurator-main-3f04dd5c.js +2 -0
  14. package/lib/configurator-main-3f04dd5c.js.map +1 -0
  15. package/lib/configurator-main.nomodule.js +1 -1
  16. package/lib/{configurator-mesh-generator-2440898b.js → configurator-mesh-generator-d464ec75.js} +2 -2
  17. package/lib/configurator-mesh-generator-d464ec75.js.map +1 -0
  18. package/lib/{configurator-mesh-generator-70ad08b0.nomodule.js → configurator-mesh-generator-ea5536da.nomodule.js} +2 -2
  19. package/lib/configurator-mesh-generator-ea5536da.nomodule.js.map +1 -0
  20. package/lib/{default-light-setting-8903ac89.js → default-light-setting-10439bcd.js} +2 -2
  21. package/lib/default-light-setting-10439bcd.js.map +1 -0
  22. package/lib/{default-light-setting-ace35a21.nomodule.js → default-light-setting-94cc064d.nomodule.js} +2 -2
  23. package/lib/default-light-setting-94cc064d.nomodule.js.map +1 -0
  24. package/lib/definitions/common-core/mock/tween-mock.d.ts +4 -0
  25. package/lib/definitions/common-core/src/cameracontrol/camera-control-3d.d.ts +0 -1
  26. package/lib/definitions/common-core/src/utils/threejs-utils.d.ts +4 -0
  27. package/lib/definitions/configurator-core/src/utils/component-raycast-helper.d.ts +2 -0
  28. package/lib/definitions/configurator-core/src/utils/raycast-helper.d.ts +2 -2
  29. package/lib/definitions/configurator-core/src/utils/selection-handler.d.ts +2 -0
  30. package/lib/definitions/configurator-core/src/webgl/configurator-scene-event-handler.d.ts +2 -0
  31. package/lib/definitions/planner-core/src/view-model/plan-view-model.d.ts +1 -0
  32. package/lib/{dimensioning-helper-bb822d6f.js → dimensioning-helper-4f07dfb2.js} +2 -2
  33. package/lib/dimensioning-helper-4f07dfb2.js.map +1 -0
  34. package/lib/{dimensioning-helper-1851ef1b.nomodule.js → dimensioning-helper-bfb68dda.nomodule.js} +2 -2
  35. package/lib/dimensioning-helper-bfb68dda.nomodule.js.map +1 -0
  36. package/lib/{glb-viewer-eacfa20c.js → glb-viewer-5203b4c3.js} +2 -2
  37. package/lib/{glb-viewer-eacfa20c.js.map → glb-viewer-5203b4c3.js.map} +1 -1
  38. package/lib/{glb-viewer-07c67d99.nomodule.js → glb-viewer-6fae9993.nomodule.js} +2 -2
  39. package/lib/{glb-viewer-07c67d99.nomodule.js.map → glb-viewer-6fae9993.nomodule.js.map} +1 -1
  40. package/lib/glb-viewer-main-8db04fe8.js +2 -0
  41. package/lib/glb-viewer-main-8db04fe8.js.map +1 -0
  42. package/lib/glb-viewer-main.nomodule.js +1 -1
  43. package/lib/image-renderer-1c2de902.nomodule.js +2 -0
  44. package/lib/{image-renderer-cad9cce5.nomodule.js.map → image-renderer-1c2de902.nomodule.js.map} +1 -1
  45. package/lib/image-renderer-7eba536d.js +2 -0
  46. package/lib/{image-renderer-8b621134.js.map → image-renderer-7eba536d.js.map} +1 -1
  47. package/lib/legacy/{banana-for-scale-8e37587e.legacy.js → banana-for-scale-3e0c928c.legacy.js} +2 -2
  48. package/lib/legacy/{banana-for-scale-8e37587e.legacy.js.map → banana-for-scale-3e0c928c.legacy.js.map} +1 -1
  49. package/lib/legacy/{component-dimensioning-7702446a.legacy.js → component-dimensioning-a3aa8660.legacy.js} +2 -2
  50. package/lib/legacy/component-dimensioning-a3aa8660.legacy.js.map +1 -0
  51. package/lib/legacy/configurator-575211fd.legacy.js +2 -0
  52. package/lib/legacy/{configurator-f6d8647d.legacy.js.map → configurator-575211fd.legacy.js.map} +1 -1
  53. package/lib/legacy/configurator-main.legacy.js +1 -1
  54. package/lib/legacy/{configurator-mesh-generator-210e5ffe.legacy.js → configurator-mesh-generator-00d7df37.legacy.js} +2 -2
  55. package/lib/legacy/configurator-mesh-generator-00d7df37.legacy.js.map +1 -0
  56. package/lib/legacy/{default-light-setting-92bb70ce.legacy.js → default-light-setting-b10dcc3b.legacy.js} +2 -2
  57. package/lib/legacy/default-light-setting-b10dcc3b.legacy.js.map +1 -0
  58. package/lib/legacy/{dimensioning-helper-71f8c8cf.legacy.js → dimensioning-helper-61dc4ccb.legacy.js} +2 -2
  59. package/lib/legacy/dimensioning-helper-61dc4ccb.legacy.js.map +1 -0
  60. package/lib/legacy/{glb-viewer-c541bffb.legacy.js → glb-viewer-0ddafc07.legacy.js} +2 -2
  61. package/lib/legacy/{glb-viewer-c541bffb.legacy.js.map → glb-viewer-0ddafc07.legacy.js.map} +1 -1
  62. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  63. package/lib/legacy/image-renderer-dc9f270b.legacy.js +2 -0
  64. package/lib/legacy/{image-renderer-c831cb02.legacy.js.map → image-renderer-dc9f270b.legacy.js.map} +1 -1
  65. package/lib/legacy/{material-viewer-9d5181b8.legacy.js → material-viewer-21e51b88.legacy.js} +2 -2
  66. package/lib/legacy/material-viewer-21e51b88.legacy.js.map +1 -0
  67. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  68. package/lib/legacy/{mesh-generator-ddb18de3.legacy.js → mesh-generator-53ccff60.legacy.js} +2 -2
  69. package/lib/legacy/mesh-generator-53ccff60.legacy.js.map +1 -0
  70. package/lib/legacy/pixotron-8a5609ec.legacy.js +2 -0
  71. package/lib/legacy/{pixotron-769d1fe5.legacy.js.map → pixotron-8a5609ec.legacy.js.map} +1 -1
  72. package/lib/legacy/planner-97c9b4fa.legacy.js +2 -0
  73. package/lib/legacy/{planner-5818e32b.legacy.js.map → planner-97c9b4fa.legacy.js.map} +1 -1
  74. package/lib/legacy/planner-main.legacy.js +1 -1
  75. package/lib/legacy/{rapi-access-1db44eda.legacy.js → rapi-access-d7e49c75.legacy.js} +3 -3
  76. package/lib/legacy/{rapi-access-1db44eda.legacy.js.map → rapi-access-d7e49c75.legacy.js.map} +1 -1
  77. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  78. package/lib/legacy/{scene-manager-2bb96268.legacy.js → scene-manager-b17faa96.legacy.js} +2 -2
  79. package/lib/legacy/scene-manager-b17faa96.legacy.js.map +1 -0
  80. package/lib/legacy/static/{ConfiguratorKernel-40b689d07289b673.js → ConfiguratorKernel-5b0df4117228a3b3.js} +6 -6
  81. package/lib/legacy/static/ConfiguratorKernel-6f506effcdf62da4.wasm +0 -0
  82. package/lib/legacy/static/ConfiguratorKernelJs-38320d4e8f22ad34.mem +0 -0
  83. package/lib/legacy/static/ConfiguratorKernelJs-51de0d49f85185e3.js +183 -0
  84. package/lib/legacy/static/RoomleCore-0ac3d29f9bd4c5d7.js +147 -0
  85. package/lib/legacy/static/RoomleCore-48e64f95ef7bff41.wasm +0 -0
  86. package/lib/legacy/static/RoomleCoreJs-973e591d820f477b.mem +0 -0
  87. package/lib/legacy/static/RoomleCoreJs-da15526d821d8696.js +198 -0
  88. package/lib/legacy/static/shaders-1f34237810f50436.json +1 -0
  89. package/lib/legacy/{stats-helper-f3d5141e.legacy.js → stats-helper-45acb364.legacy.js} +2 -2
  90. package/lib/legacy/{stats-helper-f3d5141e.legacy.js.map → stats-helper-45acb364.legacy.js.map} +1 -1
  91. package/lib/{material-viewer-771c5d31.nomodule.js → material-viewer-366f947f.nomodule.js} +2 -2
  92. package/lib/material-viewer-366f947f.nomodule.js.map +1 -0
  93. package/lib/{material-viewer-de8c3416.js → material-viewer-70151465.js} +2 -2
  94. package/lib/material-viewer-70151465.js.map +1 -0
  95. package/lib/material-viewer-main-5d012646.js +2 -0
  96. package/lib/material-viewer-main-5d012646.js.map +1 -0
  97. package/lib/material-viewer-main.nomodule.js +1 -1
  98. package/lib/{mesh-generator-e479dd88.nomodule.js → mesh-generator-ab71fd1a.nomodule.js} +2 -2
  99. package/lib/mesh-generator-ab71fd1a.nomodule.js.map +1 -0
  100. package/lib/{mesh-generator-9db153b3.js → mesh-generator-eb2be854.js} +2 -2
  101. package/lib/mesh-generator-eb2be854.js.map +1 -0
  102. package/lib/pixotron-4211bd0a.js +2 -0
  103. package/lib/{pixotron-c552d639.js.map → pixotron-4211bd0a.js.map} +1 -1
  104. package/lib/pixotron-d0258bc6.nomodule.js +2 -0
  105. package/lib/{pixotron-8125b43b.nomodule.js.map → pixotron-d0258bc6.nomodule.js.map} +1 -1
  106. package/lib/planner-3a4f0927.js +2 -0
  107. package/lib/{planner-82e7e808.js.map → planner-3a4f0927.js.map} +1 -1
  108. package/lib/planner-6f67ecc9.nomodule.js +2 -0
  109. package/lib/{planner-969b7c00.nomodule.js.map → planner-6f67ecc9.nomodule.js.map} +1 -1
  110. package/lib/planner-main-5a4d30e7.js +2 -0
  111. package/lib/planner-main-5a4d30e7.js.map +1 -0
  112. package/lib/planner-main.nomodule.js +1 -1
  113. package/lib/{rapi-access-482df27d.js → rapi-access-8fc227f2.js} +3 -3
  114. package/lib/{rapi-access-482df27d.js.map → rapi-access-8fc227f2.js.map} +1 -1
  115. package/lib/{rapi-access-e27314d5.nomodule.js → rapi-access-f2154541.nomodule.js} +3 -3
  116. package/lib/{rapi-access-e27314d5.nomodule.js.map → rapi-access-f2154541.nomodule.js.map} +1 -1
  117. package/lib/{roomle-sdk-c187aef7.js → roomle-sdk-0a5a228a.js} +2 -2
  118. package/lib/roomle-sdk-0a5a228a.js.map +1 -0
  119. package/lib/roomle-sdk.nomodule.js +1 -1
  120. package/lib/{scene-manager-0ab80786.nomodule.js → scene-manager-358e5a19.nomodule.js} +2 -2
  121. package/lib/scene-manager-358e5a19.nomodule.js.map +1 -0
  122. package/lib/{scene-manager-e9c40231.js → scene-manager-dd75a06a.js} +2 -2
  123. package/lib/scene-manager-dd75a06a.js.map +1 -0
  124. package/lib/static/ConfiguratorKernel-5b0df4117228a3b3.js +1 -0
  125. package/lib/static/{ConfiguratorKernel-40b689d07289b673.js.map → ConfiguratorKernel-5b0df4117228a3b3.js.map} +1 -1
  126. package/lib/static/ConfiguratorKernel-6f506effcdf62da4.wasm +0 -0
  127. package/lib/static/ConfiguratorKernelJs-38320d4e8f22ad34.mem +0 -0
  128. package/lib/static/ConfiguratorKernelJs-51de0d49f85185e3.js +183 -0
  129. package/lib/static/RoomleCore-0ac3d29f9bd4c5d7.js +1 -0
  130. package/lib/static/RoomleCore-0ac3d29f9bd4c5d7.js.map +1 -0
  131. package/lib/static/RoomleCore-48e64f95ef7bff41.wasm +0 -0
  132. package/lib/static/RoomleCoreJs-973e591d820f477b.mem +0 -0
  133. package/lib/static/RoomleCoreJs-da15526d821d8696.js +198 -0
  134. package/lib/static/shaders-1f34237810f50436.json +1 -0
  135. package/lib/{stats-helper-4afb7056.js → stats-helper-4d7bf878.js} +2 -2
  136. package/lib/{stats-helper-4afb7056.js.map → stats-helper-4d7bf878.js.map} +1 -1
  137. package/lib/{stats-helper-dc6eaf67.nomodule.js → stats-helper-8b411909.nomodule.js} +2 -2
  138. package/lib/{stats-helper-dc6eaf67.nomodule.js.map → stats-helper-8b411909.nomodule.js.map} +1 -1
  139. package/package.json +2 -2
  140. package/lib/component-dimensioning-57fff7bc.nomodule.js.map +0 -1
  141. package/lib/component-dimensioning-d7dd5f83.js.map +0 -1
  142. package/lib/configurator-b17d82a9.nomodule.js +0 -2
  143. package/lib/configurator-b44d4749.js +0 -2
  144. package/lib/configurator-main-7dbbbe6f.js +0 -2
  145. package/lib/configurator-main-7dbbbe6f.js.map +0 -1
  146. package/lib/configurator-mesh-generator-2440898b.js.map +0 -1
  147. package/lib/configurator-mesh-generator-70ad08b0.nomodule.js.map +0 -1
  148. package/lib/default-light-setting-8903ac89.js.map +0 -1
  149. package/lib/default-light-setting-ace35a21.nomodule.js.map +0 -1
  150. package/lib/dimensioning-helper-1851ef1b.nomodule.js.map +0 -1
  151. package/lib/dimensioning-helper-bb822d6f.js.map +0 -1
  152. package/lib/glb-viewer-main-495501bb.js +0 -2
  153. package/lib/glb-viewer-main-495501bb.js.map +0 -1
  154. package/lib/image-renderer-8b621134.js +0 -2
  155. package/lib/image-renderer-cad9cce5.nomodule.js +0 -2
  156. package/lib/legacy/component-dimensioning-7702446a.legacy.js.map +0 -1
  157. package/lib/legacy/configurator-f6d8647d.legacy.js +0 -2
  158. package/lib/legacy/configurator-mesh-generator-210e5ffe.legacy.js.map +0 -1
  159. package/lib/legacy/default-light-setting-92bb70ce.legacy.js.map +0 -1
  160. package/lib/legacy/dimensioning-helper-71f8c8cf.legacy.js.map +0 -1
  161. package/lib/legacy/image-renderer-c831cb02.legacy.js +0 -2
  162. package/lib/legacy/material-viewer-9d5181b8.legacy.js.map +0 -1
  163. package/lib/legacy/mesh-generator-ddb18de3.legacy.js.map +0 -1
  164. package/lib/legacy/pixotron-769d1fe5.legacy.js +0 -2
  165. package/lib/legacy/planner-5818e32b.legacy.js +0 -2
  166. package/lib/legacy/scene-manager-2bb96268.legacy.js.map +0 -1
  167. package/lib/legacy/static/ConfiguratorKernel-ed501b2f4963cf8d.wasm +0 -0
  168. package/lib/legacy/static/ConfiguratorKernelJs-0be227f14fe2e673.mem +0 -0
  169. package/lib/legacy/static/ConfiguratorKernelJs-4fd6b79d456c6dca.js +0 -183
  170. package/lib/legacy/static/RoomleCore-05f5edf8c36dcc71.wasm +0 -0
  171. package/lib/legacy/static/RoomleCore-1f77b9044f56b8c2.js +0 -147
  172. package/lib/legacy/static/RoomleCoreJs-29688f673479bbaf.mem +0 -0
  173. package/lib/legacy/static/RoomleCoreJs-3e36d829df9822ea.js +0 -197
  174. package/lib/legacy/static/shaders-0331cd7d06525760.json +0 -1
  175. package/lib/material-viewer-771c5d31.nomodule.js.map +0 -1
  176. package/lib/material-viewer-de8c3416.js.map +0 -1
  177. package/lib/material-viewer-main-a62694c1.js +0 -2
  178. package/lib/material-viewer-main-a62694c1.js.map +0 -1
  179. package/lib/mesh-generator-9db153b3.js.map +0 -1
  180. package/lib/mesh-generator-e479dd88.nomodule.js.map +0 -1
  181. package/lib/pixotron-8125b43b.nomodule.js +0 -2
  182. package/lib/pixotron-c552d639.js +0 -2
  183. package/lib/planner-82e7e808.js +0 -2
  184. package/lib/planner-969b7c00.nomodule.js +0 -2
  185. package/lib/planner-main-f7817887.js +0 -2
  186. package/lib/planner-main-f7817887.js.map +0 -1
  187. package/lib/roomle-sdk-c187aef7.js.map +0 -1
  188. package/lib/scene-manager-0ab80786.nomodule.js.map +0 -1
  189. package/lib/scene-manager-e9c40231.js.map +0 -1
  190. package/lib/static/ConfiguratorKernel-40b689d07289b673.js +0 -1
  191. package/lib/static/ConfiguratorKernel-ed501b2f4963cf8d.wasm +0 -0
  192. package/lib/static/ConfiguratorKernelJs-0be227f14fe2e673.mem +0 -0
  193. package/lib/static/ConfiguratorKernelJs-4fd6b79d456c6dca.js +0 -183
  194. package/lib/static/RoomleCore-05f5edf8c36dcc71.wasm +0 -0
  195. package/lib/static/RoomleCore-1f77b9044f56b8c2.js +0 -1
  196. package/lib/static/RoomleCore-1f77b9044f56b8c2.js.map +0 -1
  197. package/lib/static/RoomleCoreJs-29688f673479bbaf.mem +0 -0
  198. package/lib/static/RoomleCoreJs-3e36d829df9822ea.js +0 -197
  199. package/lib/static/shaders-0331cd7d06525760.json +0 -1
@@ -1,2 +0,0 @@
1
- System.register(["./rapi-access-e27314d5.nomodule.js","./pixotron-8125b43b.nomodule.js","./default-light-setting-ace35a21.nomodule.js"],(function(t){var e,n,r,i,a,o,s;return{setters:[function(t){e=t.T,n=t.V,r=t.t,i=t.h},function(t){a=t.E,o=t.L},function(t){s=t.D}],execute:function(){t("G","static/GLTFExporter-86edae059df3a219.js");const c=r(30);class h extends a{constructor(t,e,n,r){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===r?1:r,this._scene=t,this._camera=e,this._raycaster=new THREE.Raycaster,this._raycaster.layers.enableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(t){this._raycaster.layers=t}_addInputListeners(t){t.addEventListener(3,t=>{this._findCandidate(t.positionRelative)},this),t.addEventListener(5,t=>{this._findSelection(t.positionRelative)},this),t.addEventListener(6,t=>{this._findHover(t.positionRelative,t.type)},this),t.addEventListener(0,t=>{this._onDragStart(t.positionRelative)},this),t.addEventListener(1,t=>{this._onDrag(t.positionRelative)},this),t.addEventListener(2,t=>{this._onDragEnd(t.positionRelative)},this),t.addEventListener(9,t=>{this._onRotate(t.positionRelative,t.rotation)},this),t.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(t){this._intersection(t)&&this._inputManager.onElementHit()}_findSelection(t){let e=this._intersection(t);e?e&&e.object.dispatchEvent({type:"select"}):this.dispatchEvent(3)}_findHover(t,e){const n=this._intersection(t);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:e}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:e}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:e}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:e}})))}_intersection(t){const e=this._intersect(t);if(e.length<=0)return null;let n=e[0];return e.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&e.forEach(t=>{t.object.id===this._currentHover.id&&t.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=t.object.userData.priority&&(n=t)}),n}_intersect(t){this._raycaster.setFromCamera(t,this._camera);const e=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(t=>{const n=this._findObjectWithHandler(t.object);n&&(t.object=n,e.push(t))}),e.length>=0?e.sort((t,e)=>t.object.userData.priority!==e.object.userData.priority?e.object.userData.priority-t.object.userData.priority:t.distance-e.distance):[]}_findObjectWithHandler(t){return t.userData.hasListener?t:t.parent?this._findObjectWithHandler(t.parent):null}_onDragStart(t){let e=this._intersection(t);if(!e&&!this._currentDrag)return;if(e&&e.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&e&&(this._currentDrag=e.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(t){if(!this._currentDrag)return;this._raycaster.setFromCamera(t,this._camera);let e,n=new THREE.Vector3(0,0,-5);this._raycaster.ray.intersectPlane(this._planeBottom,n);let r=this._getDistanceToCamera(n),i=this._camera.userData.yaw;if(0===this._mode)e=n.clone(),e.y=this._currentDrag.parent.position.y;else{let t=new THREE.Vector3(0,0,0),a=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,t),this._raycaster.ray.intersectPlane(this._planeSide,a);let o=this._getDistanceToCamera(a),s=this._getDistanceToCamera(t);i>=-c&&i<=c?e=r<s?n.clone():t.clone():r<s&&r<o?e=n.clone():s<r&&s<o?e=t.clone():o<r&&o<s&&(e=a.clone()),e.sub(this._offset)}this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}_getDistanceToCamera(t){let n=t.clone().sub(this._camera.position).length();return e(t)&&(n=Number.POSITIVE_INFINITY),n}_onDragEnd(t){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:t}}),this._currentDrag=null)}_onRotate(t,e){if(!this._currentRotate){let e=this._intersection(t);if(!e)return;this._currentRotate=e.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:e}})}_positionPlanes(t){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):t&&t.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-t.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-t.boundingBox.getSize(new THREE.Vector3).x+t.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+t.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(t){t&&t.boundingBox&&(this._offset.copy(t.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(t.getWorldQuaternion(new THREE.Quaternion)))}update(t,e,n){if(t&&(this._bounds=t),e&&(this._rootComponentPosition=e),n){this._backgroundScene=n;let t=this._backgroundScene.children[0];t instanceof THREE.Mesh&&t.geometry.computeBoundingBox()}}clear(){this._currentDrag&&n(this._currentDrag),this._currentHover&&n(this._currentHover)}enableDragIn(t){this._currentDrag=t}setRootComponentId(t){this._rootComponentId=t}setCamera(t){this._camera=t}setScene(t){this._scene=t}setMode(t){this._mode=t}}t("S",class extends a{constructor(t,e,n,r){super(),this._debug=!1,this._dragIn=!1,this._inputManager=r,this._raycastHelper=new h(e,n,this._inputManager),this._creator_=t}isDragIn(){return this._dragIn}setDragIn(t,e){this._dragIn=t,t?this._inputManager.enableDragIn(e):this._raycastHelper.clear(),this._interaction()}});class l extends o{constructor(t,e){super(t,e),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 t=i();if(t&&this._ambientLight){let e=t.addFolder("Ambient Light");e.add(this._ambientLight,"visible"),e.add(this._ambientLight,"intensity").min(0).max(5).step(.1),e.addColor(this._params.ambientLight,"color").onChange(t=>this._ambientLight.color=new THREE.Color(t))}}}let d=null;const u=()=>(d||(d=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),d.outputEncoding=THREE.sRGBEncoding,d.gammaFactor=2.2),d),_=(t("g",(t,e=0)=>{if(!t){const t=new THREE.Vector3;return{center:t,bounds:t,diagonal:0}}const n=t.getSize(new THREE.Vector3);return n.addScalar(e),{center:t.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}}),t("p",(t,e,n,r={})=>new Promise(i=>{const{size:a=1024}=r,o=u();o.setSize(a,a);const c=t.fog?t.fog.clone():null,h=t.background?t.background.clone():null;t.background=null,t.fog=null;let l=new s(t);e.layers.disable(2),e.layers.disable(5),_(e,n,-20,-30),o.render(t,e);const d=o.domElement.toDataURL();e.layers.enable(2),t.background=h,t.fog=c,l.removeFromScene(),i({image:d,width:a,height:a,blob:null})})),t("r",(t,e,n,r,i,a)=>new Promise(r=>{a||(a=1024);const i=u();i.setSize(a,a);const o=t.fog?t.fog.clone():null,s=t.background?t.background.clone():null;t.background=null,t.fog=null,e.layers.disable(2),e.layers.disable(5),n?_(e,n,-20,-30):(e.aspect=1,e.updateProjectionMatrix()),i.render(t,e);const c=i.domElement.toDataURL();e.layers.enable(2),t.background=s,t.fog=o,r({image:c,width:a,height:a,blob:null})})),(t,e,n,i)=>{t.far=1e3,t.fov=15,t.aspect=1,t.position.copy(e.center),t.rotation.set(0,0,0),t.rotateY(r(i)),t.rotateX(r(n)),t.translateZ(3.8*e.diagonal),t.updateProjectionMatrix()});t("a",(t,e,n,i={})=>{const{showDimensions:a=!1}=i;return new Promise(i=>{const o=u();o.autoClear=!1;let c=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);c.position.copy(n.center),c.rotateX(r(-90)),c.translateZ(n.bounds.y+1),c.far=c.position.y+.5,c.layers.mask=65535;let h=200*n.bounds.x,d=200*n.bounds.z;if(h>4096||d>4096){let t=0;h>4096?t=h/4096:d>4096&&(t=d/4096),h/=t,d/=t}o.setSize(h,d);let _=t.fog?t.fog.clone():null,g=t.background?t.background.clone():null;t.background=null,t.fog=null;let p=a?new l(t):new s(t);c.layers.disable(2),c.layers.disable(5),a?c.layers.enable(7):c.layers.disable(7),o.render(t,c),e&&(o.clearDepth(),o.render(e,c));let m=o.domElement.toDataURL();c.layers.enable(2),c.layers.enable(5),t.background=g,t.fog=_,p.removeFromScene(),i({image:m,width:h,height:d,blob:null})})})}}}));
2
- //# sourceMappingURL=image-renderer-cad9cce5.nomodule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-dimensioning-7702446a.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- System.register(["./rapi-access-1db44eda.legacy.js","./main-thread-to-worker-45106055.legacy.js","./image-renderer-c831cb02.legacy.js","./pixotron-769d1fe5.legacy.js","./configurator-mesh-generator-210e5ffe.legacy.js","./default-light-setting-92bb70ce.legacy.js"],(function(e,t){var n,i,o,s,r,a,l,h,c,d,_,p,u,m,g,f,C,v,b,y,E,w,S,P,I,k,H,R,M,D,O,T,L,A,x,U,V,B,F,j,G,q,z,K,N,W,Q,J,X,Y,Z,$,ee,te,ne,ie,oe,se,re,ae,le,he;return{setters:[function(e){n=e._,i=e.i,o=e.C,s=e.B,r=e.A,a=e.a,l=e.D,h=e.b,c=e.k,d=e.E,_=e.c,p=e.M,u=e.U,m=e.G,g=e.g,f=e.d,C=e.R,v=e.e,b=e.t,y=e.f,E=e.P,w=e.h,S=e.j,P=e.l,I=e.m,k=e.L,H=e.n,R=e.o,M=e.p,D=e.q,O=e.r},function(e){T=e.o,L=e.g,A=e.s,x=e.r,U=e.t},function(e){V=e.S,B=e.p,F=e.r,j=e.g,G=e.a,q=e.G},function(e){z=e.E,K=e.I,N=e.C,W=e.D,Q=e.B,J=e.a,X=e.F,Y=e.G,Z=e.P,$=e.b,ee=e.c,te=e.S,ne=e.d,ie=e.e,oe=e.T,se=e.f,re=e.g,ae=e.M},function(e){le=e.C},function(e){he=e.D}],execute:function(){const ce=function(e){return e.validRange&&"string"==typeof e.validRange.type},de=function(e){return e.validValues&&e.validValues.length>0},_e=function(e){return"length"===e.unitType||"area"===e.unitType},pe=function(e){return"Material"===e.type};let ue={InchFeet:null,MM:null,CM:null},me={NoUnitString:null,LongUnitString:null,ShortUnitString:null},ge=(()=>{class e{constructor(e){this._formatter=null,this._precision=0,this._creator_=e}init(e){const t=new e.UnitMeasureFormatter;ue=e.Unit,me=e.UnitStringType,this._initActualUnit(),this._initActualUnitStringType();const{precisionCm:n,precisionInch:i}=this._initData;this._actualUnit===ue.InchFeet?this._precision=void 0!==i?parseInt(i,10):2:this._actualUnit===ue.CM&&(this._precision=void 0!==n?parseInt(n,10):1),t.init("mm","cm","'","ft",'"',"inch","m²","sqft",!0,this._precision),this._formatter=t}_initActualUnit(){const{unit:e}=this._initData;switch(e){case"cm":this._actualUnit=ue.CM;break;case"mm":this._actualUnit=ue.MM;break;case"inchfeet":this._actualUnit=ue.InchFeet;break;default:this._actualUnit=ue.CM}}_initActualUnitStringType(){const{unitStringType:e}=this._initData;switch(e){case"none":this._actualUnitStringType=me.NoUnitString;break;case"long":this._actualUnitStringType=me.LongUnitString;break;case"short":this._actualUnitStringType=me.ShortUnitString;break;default:this._actualUnitStringType=me.ShortUnitString}}_isFormatterReady(){return!!this._formatter||(console.warn("Formatter is not ready..."),!1)}formatAngleValueToUnitString(e,t){const n="Integer"===t.type?0:2;return e.toFixed(n)+"°"}parseAngleValueFromUnitString(e){return e.replace("°","").replace(/\s/g,"")}parseValue(e,t){return null===t.unitType||"unknown"===t.unitType||"count"===t.unitType?e:"length"===t.unitType?this.parseMMValueFromUnitString(e,t.unitType):"angle"===t.unitType||"area"===t.unitType?this.parseAngleValueFromUnitString(e):e}formatValueToUnitString(e,t){return null===t.unitType||"unknown"===t.unitType||"count"===t.unitType?"Integer"===t.type?e.toString():parseFloat(e.toString()).toFixed(2):"length"===t.unitType?this.formatMMValueToUnitString(e,t.unitType):"angle"===t.unitType?this.formatAngleValueToUnitString(e,t):"area"===t.unitType?this.formatSquareMMValueToUnitString(e):e}isParseableNumber(e){return this._isFormatterReady()?this._formatter.isParseableNumber(e):null}isParseableUnitString(e,t){return this._isFormatterReady()?"angle"===t.unitType?this._formatter.isParseableUnitString(this.parseAngleValueFromUnitString(e),this._actualUnit):this._formatter.isParseableUnitString(e,this._actualUnit):null}parseMMValueFromUnitString(e,t){return this._isFormatterReady()?"count"===t?parseFloat(e):this._formatter.parseMMValueFromUnitString(e,this._actualUnit):null}parseNumber(e){return this._isFormatterReady()?this._formatter.parseNumber(e):null}formatNumber(e,t=0){return this._isFormatterReady()?this._formatter.formatNumber(e,t):null}formatSquareMMValueToUnitString(e){return this._isFormatterReady()?this._formatter.formatSquareMMValueToUnitString(e,this._actualUnit):null}formatMMValueToUnitString(e,t){return this._isFormatterReady()?"count"===t?e.toString():this._formatter.formatMMValueToUnitString(e,this._actualUnit,this._actualUnitStringType):null}formatMMValueWithReqMaxLength(e,t){return this._isFormatterReady()?this._formatter.formatMMValueWithReqMaxLength(e,this._actualUnit,t):null}_formatParameterValue(e,t){return"length"===t?this.formatMMValueToUnitString(parseFloat(e)):"area"===t?this.formatSquareMMValueToUnitString(parseFloat(e)):e}formatPartListParameter(e){_e(e)&&(e.valueLabel=this._formatParameterValue(e.value,e.unitType))}formatParameter(e){if(_e(e)&&Array.isArray(e.validValues)&&e.validValues.forEach(({value:t},n)=>{e.validValues[n].label=this._formatParameterValue(t,e.unitType)}),e.valueLabel=this._formatParameterValue(e.value,e.unitType),pe(e))e.uiType="Material";else if(function(e){return"Boolean"===e.type}(e))e.uiType="Boolean";else if(ce(e)){e.uiType="Range";const t=null!==e.validRange.valueFrom?e.validRange.valueFrom:Number.MIN_SAFE_INTEGER,n=null!==e.validRange.valueTo?e.validRange.valueTo:Number.MAX_SAFE_INTEGER;e.validRangeLabels={valueFrom:this._formatParameterValue(t.toString(),e.unitType),valueTo:this._formatParameterValue(n.toString(),e.unitType),type:e.validRange.type}}else de(e)?(e.uiType="Options",function(e){return!!de(e)&&Array.isArray(e.validValues)&&e.validValues.length>0&&"string"==typeof e.validValues[0].thumbnail}(e)&&(e.uiType="Thumbnails")):(console.error("Could not detect uiType of param"),e.uiType=null)}isInch(){return this._actualUnit===ue.InchFeet}getPrecision(){return this._precision}getAllowedDelta(){const e=1/Math.pow(10,this._precision);return this.isInch()?25.4*e:e}}return n([i],e.prototype,"_initData",void 0),e})();const fe=["material"];let Ce=(()=>{class e extends o{constructor(e){super(e,1),this.muteKernelCallbacks=!1,this.listOfVariants=(e,t)=>{},s.addMeta("kernel_is_ready",{isWasm:this._useWASM}),r.kernelInstance?(this._kernelContainer=r.kernelContainer,setTimeout(()=>this._loadSuccess(),0)):this._scriptLoader.fetch(this._kernelPath,{id:"kernel"}).then(this._loadSuccess.bind(this),this._loadError.bind(this))}_loadSuccess(){s.start("kernel_is_ready"),r.kernelInstance?setTimeout(()=>this.isReady(),0):(window.ConfiguratorKernel(this._kernelContainer),window.ConfiguratorKernel=null)}_loadError(){this._configuratorKernelAccessCallback.loadError()}selectedComponent(e){this._updateComponentDependencies(e)}uiRequestConfiguration(e){const t=this._kernelInstance.getSerializedConfiguration(e);a.finishOperation(1,t)}_updateComponentParameters(e){let t=this._kernelInstance.getComponentParameters(e);const n=this._kernelInstance.getComponent(e);this._configuratorKernelAccessCallback.updateParameters(t,n.parameterGroups,e,1)}selectionChange(e,t){let n=!1,i=[];if(e){let t=this._kernelInstance.getComponent(e);t.componentId=this._kernelInstance.getComponentId(e),t&&t.childIds&&t.childIds.length>0&&(n=!0),i.push(t)}this._configuratorUiCallbacks.onSelectionChange("standard",t,n,i)}multiSelectionChange(e,t){this._updateCommonComponentDependencies(e);let n=!1,i=!1,o=[];e&&e.forEach(e=>{let s=this._kernelInstance.getComponent(e);s.componentId=this._kernelInstance.getComponentId(e),s&&s.childIds&&s.childIds.length>0&&(n=!0),s.id===t&&(i=!0),o.push(s)}),this._configuratorUiCallbacks.onSelectionChange("multiselect",i,n,o)}_updateCommonComponentDependencies(e){const{parameters:t,parameterGroups:n}=this._kernelInstance.getCommonPlanComponentParameters(this._utilityToLongArray(e));this._configuratorKernelAccessCallback.updateParameters(t,n,e,2)}_updateComponentChildren(e){const t=this._kernelInstance.getPlanComponentPossibleChildren(e);this._configuratorKernelAccessCallback.updatePossibleChildren(e,t,1)}_updateComponentDependencies(e){this._updateComponentParameters(e),this._updateComponentChildren(e)}_updatePlanObjectParameters(e){let t,n=this._kernelInstance.getPlanObjectParameters(e);if(0===n.length){let i=this._kernelInstance.getRootPlanComponentIdFromObjectId(e);n=this._kernelInstance.getComponentParameters(i),this._enableRootComponentParametersAsGlobal(),t=this._kernelInstance.getComponent(i)}else this._configuratorContext.rootComponentParametersAsGlobal=!1,t=this._kernelInstance.getPlanObject(e);this._configuratorKernelAccessCallback.updateParameters(n,t.parameterGroups,e,0)}_enableRootComponentParametersAsGlobal(){this._configuratorContext.selectedRuntimeComponentId||(this._configuratorContext.rootComponentParametersAsGlobal=!0)}_updatePlanObjectChildren(e){const t=this._kernelInstance.getPlanObjectPossibleChildren(e);this._configuratorKernelAccessCallback.updatePossibleChildren(e,t,0)}updatePlanObjectDependencies(e){this._updatePlanObjectParameters(e),this._updatePlanObjectChildren(e)}_updateConfigurationHasChildren(e,t=null){t||(t=this._kernelInstance.getComponent(this._kernelInstance.getRootPlanComponentIdFromObjectId(e)));const n=t.childIds.size?t.childIds.size():t.childIds.length;this._configuratorUiCallbacks.onConfigurationHasChildren(n>0)}dockComponent(e,t,n,i){const o=this._kernelInstance.getComponentId(n),s=this._kernelInstance.getComponentId(e);this._kernelInstance.dockComponent(n,i,e,t),this._configuratorUiCallbacks.onUserInitiatedDockDone(o,i,s,t,null)}changeUseOfHDGeometry(e,t){this._rapiAccess.changeUseOfHDGeometry();const n=e.planObjectId,i=e.lastLoadedRapiId?e.lastLoadedRapiId:this._kernelInstance.getComponentId(n),o=this._kernelInstance.getSerializedConfiguration(n);this._kernelInstance.clearAll(),this._kernelInstance.useHDGeometry(t),a.finishOperation(3,[o,i])}webGlPreviewDockings(e,t){a.waitFor(4).then(({componentId:n})=>{t&&this.requestPlanComponentConstruction(n),this._kernelInstance.requestPreviewGeometry(n,e.planObjectId)}),e.lastPossibleChild&&e.lastPossibleChild.isComponent&&(this._kernelIo.setMeta({componentId:e.lastPossibleChild.id}),this._kernelInstance.loadPlainComponent(l,e.lastPossibleChild.id,e.lastPossibleChild.configuration)),e.lastPossibleChild&&e.lastPossibleChild.isItem&&this._kernelInstance.loadFreeFlyingConfiguration(l,e.lastPossibleChild.configuration)}previewDockingsWithDrag(e,t){this._kernelInstance.requestPreviewGeometry(e,t)}loadConfiguration(e){this._initData.id?this._memoryManager.loadingConfiguration(this._initData.id):this._memoryManager.loadingConfigurationString(),this._memoryManager.shouldHardReset()?this._kernelInstance.clearAll():this._kernelInstance.clearScene(),this._kernelInstance.loadConfiguration(h,e,{x:0,y:0,z:0})}changeCommonComponentParameter(e,t,n,i,o,s){"string"==typeof i?this._kernelInstance.setPlanComponentParameters(this._utilityToLongArray(e),t,i):console.warn("tried to set a parameter to a none string value!",i,t,n),this._finishParameterChange(n,o,s),this._updateCommonComponentDependencies(e)}changeComponentParameter(e,t,n,i,o,s){"string"==typeof i?this._kernelInstance.setComponentParameter(e,t,i):console.warn("tried to set a parameter to a none string value!",i,t,n),this._finishParameterChange(n,o,s),this._updateComponentDependencies(e)}changePlanObjectParameter(e,t,n,i,o,s){"string"==typeof i?this._kernelInstance.setPlanObjectParameter(e,t,i):console.warn("tried to set a parameter to a none string value!",i,t,n),this._finishParameterChange(n,o,s)}_finishParameterChange(e,t,n){-1===fe.indexOf(e)?setTimeout(()=>t(),0):this._configuratorKernelCallbackListener.forEach(e=>e.finishParameterChange(t,n))}requestDeleteComponents(e){e&&this._kernelInstance.deletePlanComponents(this._utilityToLongArray(e))}_calcPrice(){const e=new Map;if(this._initData.useRoomlePrice){let e=this._kernelInstance.getFullPartList();if(e&&e.fullList&&e.fullList.length){const t=e.fullList[0].currencySymbol,n=e.fullList.reduce((e,t)=>e+(t.count?t.count:0)*(t.price?t.price:0),0);this._configuratorUiCallbacks.onUpdatePrice(t,n)}}else if(this._initData.usePriceService){let t=this._kernelInstance.getFullPartList();if(t&&t.fullList&&t.fullList.length){const n=t.fullList.reduce((t,n)=>{const i=c(n);return i&&(e.set(i,n),t.push(i)),t},[]);return new Promise((i,o)=>{this._rapiAccess.getPrices(n).then(n=>{if(!n.length)return o(new Error("prices are empty"));const s=T(n,"priceId");let r=0;return t.fullList.forEach(e=>{const t=c(e);if(!s.has(t))return void console.warn("PriceId: "+t+" has no corresponding kernel-part");const{price:n,currencySymbol:i}=s.get(t);e.price=n,e.currencySymbol=i,r+=n*e.count}),this._configuratorUiCallbacks.onUpdatePrice(n[0].currencySymbol,r),i({totalSum:r,partMap:e})},e=>{console.error(e),o(e)})})}}return Promise.resolve({totalSum:0,partMap:e})}loadComponentIntoKernel(e,t){this._kernelIo.setMeta({componentId:t}),this._kernelInstance.loadComponentDefinition(10,e)}async addUiDataAndPriceToPartList(e,t){const{fullList:n,originPart:i}=e,o=e.perMainComponent;let s;this.addUiDataToPartList(n,t);try{const e=await this._calcPrice();s=e.partMap}catch(e){console.error(e),s=new Map}const r=this._initData.usePriceService||this._initData.useRoomlePrice,a=e=>{r||(e.price=null,e.currencySymbol=null);const t=c(e);if(!t)return;if(!s.has(t))return;const{price:n,currencySymbol:i}=s.get(t);"number"==typeof n&&(e.price=n,e.currencySymbol=i)};return n.forEach(a),o.forEach(({fullList:e,perMainComponent:n})=>{n.length>0&&console.error("Not implemented! perMainComponent is deeper than one level"),this.addUiDataToPartList(e,t),e.forEach(a)}),{fullList:n,perMainComponent:o,originPart:i}}async requestPartListAndUpdatePricesOfParts(e,t){let n=this._kernelInstance.getFullPartList();e||(e=this._kernelInstance.getHashOfConfiguration(this._configuratorContext.planObjectId));const i=await this.addUiDataAndPriceToPartList(n,e);this._configuratorUiCallbacks.onPartListUpdate(i,btoa(e))}addUiDataToPartList(e,t){const n=[];return e.forEach(e=>{const t=this._rapiAccess.peekComponent(e.componentId);!t||e.labelIsCalculated&&e.label||(e.label=t.label),e.parameters.forEach(e=>{if(this._unitFormatter.formatPartListParameter(e),pe(e)){const t=this._rapiAccess.peekMaterial(e.value);t?e.valueLabel=t.label||t.name||e.value:-1===n.indexOf(e.value)&&n.push(e.value)}})}),n.length&&this._rapiAccess.getMaterials(n).then(e=>{const n=this._lastPartListHash!==t;Array.isArray(e)&&e.length&&n&&(this._lastPartListHash=t,this.requestPartListAndUpdatePricesOfParts())}),e}requestSync(e,t){this.planObjectCreated(e,t),this._kernelInstance.syncPlanObjectToView(e,t)}getGlobalParameters(e,t){return new Promise(n=>{let i=this._kernelInstance.getPlanObjectParameters,o=e;t&&(i=this._kernelInstance.getComponentParameters,o=this._kernelInstance.getRootPlanComponentIdFromObjectId(e)),n(i.apply(this._kernelInstance,[o]))})}getPartList(){return new Promise(e=>{e(this._kernelInstance.getFullPartList())})}getConfigurationHash(e){return new Promise(t=>t(this._kernelInstance.getHashOfConfiguration(e.planObjectId)))}requestPlanObjectConstruction(e){this._kernelInstance.requestPlanObjectConstruction(e)}isReady(){super.isReady(),s.end("kernel_is_ready"),s.start("kernel_create_instance"),r.kernelInstance?this._kernelInstance=r.kernelInstance:this._kernelInstance=new this._kernelContainer.Kernel,this._kernelContainer.registerConfiguratorCallback(this),s.end("kernel_create_instance");const{overrideCountry:e,locale:t}=this._globalInitData;e&&(this._kernelInstance.resetPriceListIds(),this._kernelInstance.addPriceList(e)),d.isProduction||(window.__RML__DEBUG__.Kernel=this._kernelInstance,window.__RML__DEBUG__.KernelContainer=this._kernelContainer,window.__RML__DEBUG__.Helper={convertCObject:_}),this._kernelInstance.setEnvironmentVariable("language",t),this._unitFormatter.init(this._kernelContainer),this._configuratorKernelAccessCallback.isReady(),this._configuratorUiCallbacks.onConfiguratorKernelIsReady(this._kernelContainer,this._kernelInstance),r.planObjectId&&this.planObjectCreated(-1,r.planObjectId)}onLoadComponentError(e,t){this._configuratorUiCallbacks.onComponentLoadError(e,t)}configurationLoaded(e,t,n,i,o){a.finishOperation(4,{conversationId:e,objectId:t,componentId:n,hash:i,errors:_(o)}),this._configuratorKernelCallbackListener.forEach(s=>s.configurationLoaded(e,t,n,i,o))}componentDefinitionLoaded(e,t){a.finishOperation(0,t)}componentDefinitionLoadingError(e,t){this._kernelIo.error(t),a.failOperation(0,new Error(t))}configurationLoadingError(e,t){let n="Configuration loading error";if(t){const e=_(t);Array.isArray(e)&&(n=e.join("\n"),e.forEach(e=>this._kernelIo.error(e)))}a.failOperation(4,new Error(n)),a.failOperation(2,new Error(n))}componentConfigurationUpdated(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.componentConfigurationUpdated(e,t)),this._kernelInstance.requestDeltaPlanComponentConstruction(e)}setActiveGroupInView(e){this._kernelInstance.setActiveGroupInView(e)}componentParameters(){}requestComponentDimensions(){}planObjectCreated(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.planObjectCreated(e,t))}planObjectUpdated(e){const t=this._kernelInstance.getPlanObject(e);this._onBoundsUpdate(t),this._configuratorKernelCallbackListener.forEach(e=>e.planObjectUpdated(t))}planObjectConfigurationUpdated(e,t,n){this.updatePlanObjectDependencies(e);let i=this._kernelInstance.getComponent(this._kernelInstance.getRootPlanComponentIdFromObjectId(e));this._configuratorKernelCallbackListener.forEach(i=>i.planObjectConfigurationUpdated(e,t,n));const o=this._kernelInstance.getPlanObject(e);return this._onBoundsUpdate(o),this._updateConfigurationHasChildren(e,i),this.requestPartListAndUpdatePricesOfParts(n)}_onBoundsUpdate(e){if(!e.boxForMeasurement)return;const t={width:this._unitFormatter.formatMMValueToUnitString(e.boxForMeasurement.size.x),height:this._unitFormatter.formatMMValueToUnitString(e.boxForMeasurement.size.z),depth:this._unitFormatter.formatMMValueToUnitString(e.boxForMeasurement.size.y),kernelBounds:e.boxForMeasurement};this._configuratorUiCallbacks.onBoundsUpdate(t)}planObjectDeleted(){}requestPlanObjectDimensions(){}requestExternalMesh(e,t){return new Promise((n,i)=>{this._rapiAccess.getMesh(e,p,t).then(o=>{fetch(new Request(this._dataSyncer.requestAsset(o.url,!0))).then(e=>e.arrayBuffer()).then(i=>this._handleCortoMesh(i,e,t,n)).catch(t=>{this._configuratorUiCallbacks.onError(new Error(`Mesh with id "${e}" breaks. "${t}"`)),console.error(t),i(t)})},t=>{this._configuratorUiCallbacks.onError(new Error(`Mesh with id "${e}" can not be loaded. "${t}"`)),console.error(t),i(t)})})}Editor3dComponentCreated(e,t,n,i){this._configuratorKernelCallbackListener.forEach(o=>o.Editor3dComponentCreated(e,t,n,i,!1)),i&&i>0&&this._configuratorKernelCallbackListener.forEach(o=>o.Editor3dComponentDocked(e,i,t,n))}Editor3dRootComponentCreated(e,t,n,i){this._configuratorKernelCallbackListener.forEach(o=>o.Editor3dComponentCreated(e,t,n,i,!0))}Editor3dGeometryReady(e){this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dGeometryReady(e)),this.requestPlanComponentConstruction(e)}Editor3dGeometryNotReady(e){this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dGeometryNotReady(e))}Editor3dPlanObjectConstructionDone(e){return this._configuratorKernelCallbackListener.forEach(t=>t.Editor3dPlanObjectConstructionDone(e)),this.updatePlanObjectDependencies(e),this._updateConfigurationHasChildren(e),s.end("ui_load_configuration"),this._calcPrice()}Editor3dBeginGroup(){}Editor3dEndGroup(){}Editor3dSetMaterial(){}Editor3dLoadMaterial(){}Editor3dAddDockPreview(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dAddDockPreview(e,t))}Editor3dSetPreviewPointAssociations(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dSetPreviewPointAssociations(e,t))}Editor3dSetPreviewLineAssociations(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dSetPreviewLineAssociations(e,t))}Editor3dPreviewConstructionDone(e,t){this._configuratorKernelCallbackListener.forEach(n=>n.Editor3dPreviewConstructionDone(e,t))}Editor3dTranslateBy(){}Editor3dRotateBy(){}Editor3dRotateAround(){}Editor3dAddCube(){}Editor3dAddCubeUVMod(){}Editor3dAddSphere(){}Editor3dAddSphereUVMod(){}Editor3dAddRectangle(){}Editor3dAddRectangleUVMod(){}Editor3dAddMesh(){}Editor3dAddMeshUVMod(){}Editor3dAddMeshUVCoord(){}Editor3dAddCylinder(){}Editor3dAddCylinderUVMod(){}Editor3dAddPrism(){}Editor3dAddPrismUVMod(){}Editor3dAddFittingPoint(){}Editor3dAddFittingLine(){}Editor3dSelectObject(){}Editor3dCopy(){}Editor3dUpdatePlanObjectPosition(){}Editor3dUpdatePlanObjectRotation(){}Editor3dUpdatePlanObjectTransform(){}Editor3dUpdatePlanComponentPosition(){}Editor3dUpdatePlanComponentRotation(){}Editor3dUpdatePlanComponentTransform(){}getRuntimeComponentIdOfRootComponent(e){return this._kernelInstance?this._kernelInstance.getRootPlanComponentIdFromObjectId(e):(console.warn("this._kernelInstance not ready now"),0)}getRuntimeComponentId(e){return this._kernelInstance.getComponentId(e)}getParameterGroups(){if(!this._configuratorContext.planObjectId)return[];const e=this._kernelInstance.getRootPlanComponentIdFromObjectId(this._configuratorContext.planObjectId);return this._kernelInstance.getComponent(e).parameterGroups}resume(){this.muteKernelCallbacks||super.resume()}getSerializedConfiguration(e){return this._kernelInstance.getSerializedConfiguration(e)}getCurrentConfigurationHash(e){return this._kernelInstance.getHashOfConfiguration(e)}listOfVariantsError(e,t){this._kernelIo.setMeta({rapiId:e}),this._kernelIo.error(t)}}return n([i],e.prototype,"_unitFormatter",void 0),n([i],e.prototype,"_memoryManager",void 0),n([i],e.prototype,"_configuratorKernelAccessCallback",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_initData",void 0),n([i],e.prototype,"_globalInitData",void 0),e})();class ve{constructor(e){const{component:t,resetCamera:n}=e;this.component=t,this.resetCamera=void 0===n||n}}const be=new Map,ye=new Map;class Ee{static loadFont(e){if(ye.has(e))return new Promise(t=>{t(ye.get(e))});if(be.has(e))return new Promise((t,n)=>{be.get(e).push({resolve:t,reject:n})});let t=new THREE.FontLoader;return new Promise((n,i)=>{be.set(e,[{resolve:n,reject:i}]),t.load(L()+e,t=>{ye.set(e,t),Ee._resolveAll(e,t)})})}static _resolveAll(e,t){be.has(e)&&be.get(e).forEach(e=>e.resolve(t)),be.delete(e)}}e("A",Ee);var we=e("R","static/rubik_regular_sub-eb3f3b61078695cc.json");let Se=(()=>{class e{constructor(e,t){this._addOnSpotIcons=new Map,this.previewGhostEnabled=!1,this.addOnSpotsEnabled=!1,this._state=3,this._camera=e,this._textMaterial=new THREE.MeshStandardMaterial({color:8947848});let n=new THREE.Geometry;this._plusText=new THREE.Mesh(n,this._textMaterial),this._plusText.layers.set(4),Ee.loadFont(we).then(e=>{this._font=e;let t={font:this._font,size:.05,height:.001,curveSegments:2,bevelEnabled:!0,bevelThickness:.001,bevelSize:.001};this._plusTextGeometry=new THREE.TextGeometry("+",t),this._plusTextGeometry.computeBoundingBox(),this._plusText.geometry=this._plusTextGeometry}),this._plusButtonPromise=new Promise((e,n)=>{t.fetch(m,{id:"gltf-loader-js"}).then(()=>{(new THREE.GLTFLoader).load(L()+"static/AddButtonRound-8004fa7dffdf7501.glb",t=>{t&&t.scene&&t.scene.children&&t.scene.children.length>0?(this._onPlusButtonLoaded(t.scene.children[0]),e()):n("loaded scene has no childrens")},e=>{},e=>{console.error(e),n(e)})})})}_onPlusButtonLoaded(e){e&&(this._plusButton=e,this._plusButton.material=this._textMaterial,this._plusButton.layers.set(4),this._plusButton.scale.copy(new THREE.Vector3(.08,.08,.08)))}_performUpdate(e){if(this.addOnSpotsEnabled)for(let e of this._addOnSpotIcons.values())e.forEach(e=>{e.geometry.center();let t=new THREE.Vector3(0,1,0);t.applyQuaternion(this._camera.quaternion),e.up.copy(t),e.lookAt(this._camera.position)})}addAddOnSpots(e,t){Promise.all([this._plusButtonPromise]).then(()=>{this.addOnSpotsEnabled&&this._plusButton&&(this.deleteAddonPointsForComponent(e.roomleId),t.forEach(t=>{const n=this._plusButton.clone();n.name="addOnSpot "+e.roomleId,n.layers.set(8),n.position.copy(this.getPositionForAddOnPosition(new THREE.Vector3(t.position.x,t.position.y,t.position.z))),this._addOnSpotIcons.has(e.roomleId)?this._addOnSpotIcons.get(e.roomleId).push(n):this._addOnSpotIcons.set(e.roomleId,[n]),n.geometry.computeBoundingBox();const i=n.geometry.boundingBox,o=i.getSize(new THREE.Vector3),s=new THREE.BoxGeometry(o.x,o.y,o.z),r=new THREE.Mesh(s,new THREE.MeshStandardMaterial({color:"#FFFFFF",transparent:!0,opacity:0,polygonOffset:!0,polygonOffsetFactor:-1}));r.layers.set(4),r.translateOnAxis(i.getCenter(new THREE.Vector3),1),r.renderOrder=3,r.visible=!0,n.add(r),r.userData={hasListener:!0,priority:3,roomleId:e.roomleId},r.addEventListener("select",()=>{this._onAddonClick&&this._onAddonClick()}),r.addEventListener("hover_on",()=>{A("pointer"),this._configuratorUiCallbacks.onAddonPlusHover()}),r.addEventListener("hover_off",()=>{A("default"),this._configuratorUiCallbacks.onAddonPlusHoverOff()}),e.add(n)}))})}deleteAddonPointsForComponent(e){this.addOnSpotsEnabled&&this._addOnSpotIcons.has(e)&&(this._addOnSpotIcons.get(e).forEach(e=>{e.parent.remove(e)}),this._addOnSpotIcons.delete(e))}getPositionForAddOnPosition(e){let t=new THREE.Vector3;return t.set(e.x/1e3,e.z/1e3,e.y/-1e3),t}update(e=!1){this._performUpdate(e)}changePreviewGhostVisibility(e,t){this.previewGhostEnabled&&(t?(e.add(this._plusText),this._plusText.position.copy((new THREE.Vector3).add(e.boundingBox.getCenter(new THREE.Vector3))),this._plusText.geometry.center()):e.remove(this._plusText))}_changeAddOnSpotVisibility(e){this.addOnSpotsEnabled&&this._addOnSpotsVisible!==e&&(this._addOnSpotsVisible=e)}isAddOnSpotVisible(){return this._addOnSpotsVisible&&this.addOnSpotsEnabled}onAddonClick(e){this._onAddonClick=e}setState(e){1===this._state&&2!==e||1===e&&5===this._state||3!==e&&5===this._state||(4!==e&&1!==e&&5!==e||this._changeAddOnSpotVisibility(!1),3!==e&&2!==e&&0!==e||this._changeAddOnSpotVisibility(!0),this._state=e)}}return n([i],e.prototype,"_configuratorUiCallbacks",void 0),e})();class Pe{constructor(e){const{component:t,preview:n,resetCamera:i,type:o,forceRender:s}=e;this.component=t,this.preview=n,this.resetCamera=void 0===i||i,this.type=o||0,this.forceRender=void 0!==s&&s}}let Ie=(()=>{class e extends V{constructor(e,t,n,i,o){super(e,t,n,i),this._cameraMoving=!1,this._addonHelper=o,this._raycastHelper.addEventListener(3,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(0,({component:e})=>{this.dispatchEvent(8,new Pe({component:e})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(1,({component:e,resetCamera:t})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new Pe({component:e,resetCamera:t}))},this),this._addInputListeners(this._inputManager)}_addInputListeners(e){e.addEventListener(7,e=>this._interaction(),this),e.addEventListener(8,e=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.roomleId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:2,roomleId:e.roomleId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:1,roomleId:e.roomleId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,n){t.userData.hasListener||(Object.assign(t.userData,n),t.addEventListener("select",()=>this._clickComponent(e)),t.addEventListener("hover_on",t=>this._hoverOn(e,t.attachment.type)),t.addEventListener("hover_off",t=>this._hoverOff(e,t.attachment.type)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData={hasListener:!0,priority:3,roomleId:e.roomleId},t.addEventListener("select",()=>this._clickPreview(e)),t.addEventListener("hover_on",()=>this._hoverOnPreview(e)),t.addEventListener("hover_off",()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData={hasListener:!0,priority:4,roomleId:e.roomleId},t.addEventListener("select",()=>this._clickPreviewLine(e)),t.addEventListener("hover_on",t=>this._hoverOnPreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_move",t=>this._hoverMovePreviewLine(e,t.attachment.intersection)),t.addEventListener("hover_off",()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new Pe({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new Pe({preview:e}))}_clickComponent(e){this._debug&&e.roomleId,this._selectionHandler.check(e)}_clickOutside(){this._selectionHandler.cancelSelection(),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&e.roomleId,e.hoverOn(),this._interaction(),this.dispatchEvent(1,new Pe({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&e.roomleId,e.hoverOff(),this._interaction(),this.dispatchEvent(2,new Pe({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e,this._addonHelper&&this._addonHelper.changePreviewGhostVisibility(e,!0)}_hoverOffPreview(e){e.hoverOff(),this._interaction(!0),this._hoveredPreview=null,this._addonHelper&&this._addonHelper.changePreviewGhostVisibility(e,!1)}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let n=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=n,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(n))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){this._draggedComponent.traverse(t=>{if(t instanceof THREE.Mesh){const n=t;e&&void 0!==n.castShadowOld?(n.receiveShadow=n.receiveShadowOld,n.castShadow=n.castShadowOld):(n.receiveShadowOld=t.receiveShadow,n.castShadowOld=t.castShadow,n.receiveShadow=!1,n.castShadow=!1)}})}_dragStart(e){e&&(this._selectionHandler.isSelected(e)||this.isDragIn())&&(this._dragStartPosition=e.position.clone(),this._dragStartRotation=e.rotation.clone(),this._draggedComponent=e,this._setDragComponentShadow(!1),this.dispatchEvent(4,new Pe({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 Pe({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 Pe({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new Pe({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 ke extends z{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,n){let i=new THREE.Vector3(-e.x/2,0,-e.z/2),o=new THREE.Vector3(e.x/2,e.y,e.z/2);this._boundingBox=new THREE.Box3(i,o),this._clientWidth=t,this._clientHeight=n;let s=this._boundingBox.getSize(new THREE.Vector3);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new THREE.Vector3(s.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new THREE.Vector3(s.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(null==this._boundingBox||null==this._offset)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let n=0;this.floorEnvironment?(e=["left","right","bottom"],n=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),n|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),n|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),n|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),n|=4),n!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=n)}_checkPaddings(){let e={left:this._clientWidth/2,top:this._clientHeight/2,right:this._clientWidth/2,bottom:this._clientHeight/2};return this._boxVertices.forEach(t=>{let n=g(t,this._camera,this._clientWidth,this._clientHeight);n.x<e.left&&(e.left=n.x),n.x>e.right&&(e.right=n.x),n.y<e.top&&(e.top=n.y),n.y>e.bottom&&(e.bottom=n.y)}),e}}let He=(()=>{class e{constructor(e,t){this._forceRender=!1,this._updateShadowsAndAO=!0,this._maxAnisotropy=1,this._clock=new THREE.Clock,this._delta=0,this._depthWriteMaterial=new THREE.MeshBasicMaterial({colorWrite:!1}),this._lastChange=Date.now(),this._running=!1,this._onAfterRender=()=>{},this._creator_=e,this._setupScene(t),this._configuratorViewModel.setListener(this),this._lifeCycleManager.addEventListener(this);const{plusInPreview:n,addOnSpots:i}=this._initData;(n||i)&&(this._addonHelper=new Se(this._camera,this._scriptLoader),i&&(this._addonHelper.onAddonClick(()=>{this._configuratorUiCallbacks.onOpenAddOns()}),this._addonHelper.addOnSpotsEnabled=i),this._addonHelper.previewGhostEnabled=n),this._cameraControl=new N(this._creator_,this._configuratorInputManager,null,this._camera),this._sceneEventHandler=new Ie(this._creator_,this._scene,this._camera,this._configuratorInputManager,this._addonHelper),this._sceneEventHandler.addEventListener(0,({forceRender:e})=>{this._uiIntersectionHelper.calculateUIIntersection(),this._addonHelper&&this._addonHelper.setState(0),e&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(1,({component:e,type:t})=>this._onHoverOn(e,t),this),this._sceneEventHandler.addEventListener(2,({component:e,type:t})=>this._onHoverOff(e,t),this),this._sceneEventHandler.addEventListener(3,()=>{this._configuratorUiCallbacks.onClickOutside(),this._cameraControl.unlock(),this._cancelDockings(!1,null,this._configuratorViewModel.hasPreviews(),!0),this.cancelSelection(!0),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._configuratorViewModel),this._requestRender()},this),this._sceneEventHandler.addEventListener(8,({component:e})=>{this._configuratorViewModel.hasPreviews()&&this._cancelDockings(!1,null,this._configuratorViewModel.hasPreviews(),!0),this._selectComponent(e),this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),"standard"===this._sceneEventHandler.getSelectionMode()?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._requestRender()},this),this._sceneEventHandler.addEventListener(9,({component:e,resetCamera:t})=>{this._deselectComponent(e,t),this._requestRender()},this),this._sceneEventHandler.addEventListener(4,({component:e})=>{"multiselect"===this._sceneEventHandler.getSelectionMode()&&this.cancelSelection(),this._requestDockingsPreviewWithDrag(e.roomleId),this._cameraControl.lock(),this._requestRender()},this),this._sceneEventHandler.addEventListener(5,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(6,({component:e,preview:t})=>{if(t){let n=t;this._configuratorViewModel.isPreviewLine(n)?this._configuratorViewModel.dockComponentWithPosition(n,e):this._configuratorViewModel.isPreview(n)&&this._dockComponent(n),this._cancelDockings(!t,e,!0,!0)}else{let t=this._sceneEventHandler.isDragIn()?e:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),t,!1,!0);const n=this._configuratorViewModel.getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3))}this._cameraControl.unlock(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(7,({preview:e})=>{this._configuratorViewModel.isPreview(e)&&(this._configuratorViewModel.isPreviewLine(e)?this._configuratorViewModel.dockComponentWithPosition(e):this._dockComponent(e),this._cancelDockings(!1,null,!this._configuratorViewModel.hasPreviews(),!1),this.requestDockingsPreview(!1),this._requestRender())},this),this._cameraControl.addEventListener(0,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),this._addonHelper&&this._addonHelper.setState(1),this._pixotronUtil.movingCameraStarts(),this._requestRender()},this),this._cameraControl.addEventListener(1,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._configuratorViewModel),this._requestRender()},this),this._cameraControl.addEventListener(2,()=>{this._sceneEventHandler.setCameraMoving(!1),this._addonHelper&&this._addonHelper.setState(2),this._pixotronUtil.movingCameraStops(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(5,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this._cameraControl.addEventListener(3,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(4,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition(),this._requestRender()},this),this._cameraControl.addEventListener(7,()=>{this._pluginSystem.moveCameraStart(this._camera.position)},this),this._cameraControl.addEventListener(8,()=>{this._pluginSystem.moveCameraEnd(this._camera.position)},this),d.isProduction||(window.__RML__DEBUG__.SceneHelper=this),this._initOptionalModules()}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;e&&(await Promise.resolve().then((function(){return Oe})).then(({default:e})=>this._componentRaycastHelper=new e),this._componentRaycastHelper.init(this._scene,this._camera))}_showDockings(){}cancelDockings(){this._cancelDockings(!0,null,!0,!0),this._renderEverything()}_cancelDockings(e,t,n,i){e&&(this._sceneEventHandler.setDragIn(!1),this._configuratorViewModel.removeDockingComponent(),t&&this._scene.remove(t)),this._configuratorViewModel.removePreviews(),n&&this._updateCameraToBounds(),i&&n&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._addonHelper&&this._addonHelper.setState(3),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}stopRenderLoop(){this._running=!1}_onHoverOn(e,t){2!==t&&this._highlight(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.add(e)&&this._renderEverything()}_onHoverOff(e,t){2!==t&&this._highlight(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._componentDimensioningHelper.remove(e),this._renderEverything()),this._requestRender()}_highlight(e=null){const t=[];if(1!==this._configuratorViewModel.getComponents().length){const n=this._initData.meshSelection;e&&(n?t.push(...e.meshes):e.boundingBoxMesh&&t.push(e.boundingBoxMesh)),this._configuratorViewModel.getComponentsForIds(this._sceneEventHandler.getSelectedRuntimeComponentIds()).forEach(e=>{e&&(n?t.push(...e.meshes):e.boundingBoxMesh&&t.push(e.boundingBoxMesh))})}this._pixotron?this._pixotron.highlightObjects(t):this._outlinePass.selectedObjects=t}_shouldRenderUi(){return this._pluginSystem&&this._pluginSystem.needsUiScene()}_renderUi(){const e=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this._camera),this._scene.overrideMaterial=null;const t=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this._camera),this._renderer.autoClear=t,this._scene.background=e}_renderEverything(){this._pixotron&&(this._forceRender=!0,this._updateShadowsAndAO=!0),this._requestRender()}_renderWithoutShadowsAndAO(){this._pixotron&&(this._forceRender=!0,this._updateShadowsAndAO=!1),this._requestRender()}_requestRender(){const e=()=>{this._delta=this._clock.getDelta(),this._animateCamera(),this._camera.layers.mask=65535,this._statsHelper&&this._statsHelper.updateRenderInfo(this._renderer.info),this._pixotron?(this._pixotron.autoShadowsClear=this._updateShadowsAndAO,this._pixotron.autoSAOClear=this._updateShadowsAndAO,this._forceRender&&(this._pixotron.needsUpdate=!0),this._checkLayers(),this._pixotron.render(this._renderer,this._scene,this._camera,this._renderTarget),this._forceRender=!1,this._updateShadowsAndAO=!0,this._pixotron.blit(),this._shouldRenderUi()&&this._renderUi()):(this._renderer.clear(),this._checkLayers(),this._composer.render(),this._renderer.clearDepth(),this._renderer.render(this._uiScene,this._camera),this._renderer.clearDepth()),this._onAfterRender(),this._addonHelper&&this._addonHelper.update(),window.TWEEN&&TWEEN.update(),this._addonHelper&&this._lastChange+1500<Date.now()&&this._addonHelper.isAddOnSpotVisible()&&this._addonHelper.setState(4),this._lastChange+3e3<Date.now()?this._running=!1:(this._running=!0,requestAnimationFrame(e))};if(this._lastChange=Date.now(),!this._running){if(this._running=!0,this._addonHelper&&!this._addonHelper.isAddOnSpotVisible()){let e=this._configuratorViewModel.hasPreviews()?5:3;this._addonHelper.setState(e)}requestAnimationFrame(e)}}_checkLayers(){this._addonHelper&&this._addonHelper.isAddOnSpotVisible()?(this._camera.layers.enable(8),this._configuratorUiCallbacks.onAddonPlusShown()):(this._camera.layers.disable(8),this._configuratorUiCallbacks.onAddonPlusHidden())}_animateCamera(){this._cameraControl&&(this._cameraControl.animateCamera(this._delta)?(this._lightSetting instanceof W&&this._lightSetting.update(this._camera,this._cameraControl.getTargetPosition()),this._pixotron&&(this._pixotron.needsUpdate=!0)):!this._pixotron||this._sceneEventHandler.isDragging()||this._forceRender||(this._pixotron.autoShadowsClear=!1,this._pixotron.autoSAOClear=!1)),this._environment.needsCamera()&&this._environment.updateCamera(this._camera)}resume(){let e=this._domHelper.getClientDimensions(),t=e.x,n=e.y;if(this._renderTarget){const e=Math.floor(t*window.devicePixelRatio),i=Math.floor(n*window.devicePixelRatio);this._renderTarget.setSize(e,i)}this._renderer.domElement.classList.add(f.HSC),this._domHelper.element.appendChild(this._renderer.domElement),this._configuratorInputManager.addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._renderEverything(),this._configuratorViewModel.materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything(),this._environment instanceof Q&&this._environment.update()}pause(){this._configuratorInputManager.removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this),this._configuratorViewModel.materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}destroy(){this.pause(),this.cleanUp()}_setupScene(e){const t=this._domHelper.getClientDimensions(),n=t.x,i=t.y;this._scene=new THREE.Scene,this._scene.background=new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND),this._uiScene=new THREE.Scene,this._componentFactory=C(),this._camera=this._componentFactory.createCamera(30,n/i,.1,20,e),this._camera.position.copy(new THREE.Vector3(0,.5,5)),this._uiIntersectionHelper=new ke(this._camera),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(0,e=>{this._configuratorUiCallbacks.onUiIntersectionChange(e)},this),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(5),this._camera.layers.enable(4);const o={format:THREE.RGBAFormat,minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter},s=THREE.sRGBEncoding,r=Math.floor(n*window.devicePixelRatio),a=Math.floor(i*window.devicePixelRatio);this._renderTarget=new THREE.WebGLRenderTarget(r,a,o),this._renderTarget.texture.encoding=s,this._renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(n,i),this._renderer.outputEncoding=s,this._renderer.gammaFactor=2.2,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=THREE.PCFSoftShadowMap,this._environmentLoader.setRendererAndScene(this._renderer,this._scene),this._environmentLoader.registerEnvironmentChangedCallback(()=>this._renderEverything()),this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._renderer.domElement.classList.add(f.HSC),this._domHelper.element.appendChild(this._renderer.domElement),this._configuratorInputManager.addEvents(this._renderer.domElement),this._lightSetting=new he(this._scene),this._composer=new THREE.EffectComposer(this._renderer);let l=new THREE.RenderPass(this._scene,this._camera,null,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND),0);this._composer.addPass(l),this._outlinePass=new THREE.OutlinePass(new THREE.Vector2(n,i),this._scene,this._camera),this._outlinePass.renderToScreen=!0,this._outlinePass.visibleEdgeColor=new THREE.Color(this._initData.colors.SELECTION),this._outlinePass.hiddenEdgeColor=new THREE.Color(this._initData.colors.SELECTION),this._outlinePass.edgeStrength=3,this._outlinePass.edgeThickness=1,this._outlinePass.edgeGlow=0,this._composer.addPass(this._outlinePass),this._composer.setSize(n,i),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._setEnvironment(new J(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND))),this._pluginSystem.init(this._scene,this._uiScene,this._camera.position),this._configuratorViewModel.materialQueue.registerCallback(()=>this._materialLoaded())}_tabVisible(){this.updateSize(!1)}sceneCleared(){this._internalClearScene()}display(e){this._scene.add(e),this._sceneEventHandler.setRootComponentId(e.roomleId),this._requestRender()}debugSceneGraph(e){this._configuratorViewModel.debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){e.material&&e.material.opacity,e.type,e.id,e.roomleId,e.children.length>0&&e.children.forEach(e=>{let n=t+" ";this._printObjectGraph(e,n)})}clearScene(){this._cameraControl.clear(),this._internalClearScene(),this._pixotronUtil&&this._pixotronUtil.lockAdapter(),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this._camera)}_internalClearScene(){this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type&&"Line"!==e.type||this._scene.remove(e)}),this._uiScene.children.forEach(e=>{this._uiScene.remove(e)}),this._configuratorViewModel.sceneCleared(),this._memoryManager.shouldHardReset()&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}preparePerspectiveImage(e={}){return new Promise((t,n)=>{this._configuratorViewModel.materialQueue.finished(!0).then(async()=>{this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let n=this._camera.clone(),i=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const o=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();o&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const s=await B(this._scene,n,i,e);o&&this._dimensionHelper.enableDimensions(),this._lightSetting.addToScene(),this._requestRender(),t(s)},n)})}renderImage(e){return new Promise((t,n)=>{this._configuratorViewModel.materialQueue.finished().then(async()=>{this._configuratorViewModel.getPreviews()&&this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers();let n=this._camera,i=null;e.useCurrentPerspective||(n=this._camera.clone(),i=this._calculateBoundingBoxOfAllMeshes());const o=!!this._dimensionHelper&&this._dimensionHelper.areDimensionsEnabled();o&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const s=await F(this._scene,n,i,this._pixotron,this._renderer);o&&this._dimensionHelper.enableDimensions(),this._requestRender(),t(s)},n)})}async preparePartImage(e,t){return new Promise((n,i)=>{this._configuratorViewModel.requestSubPartConstruction(e).then(async e=>{t.size||(t.size=256);let i=this._camera.clone(),o=j((new THREE.Box3).setFromObject(e));const s=new THREE.Scene;s.add(e);const r=await B(s,i,o,t);v(s),n(r)},i)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let n=null;return n=t&&this._dimensionHelper?this._dimensionHelper.getBoundingBox():this._configuratorViewModel.getBoundingBox(),j(n,e)}prepareTopImage(e={}){return new Promise(t=>{this._configuratorViewModel.materialQueue.finished(!0).then(async()=>{const{showDimensions:n=!1}=e;this._cancelDockings(!0,null,!0,!0),this._clearSelectionAndHovers(),n&&(await this._initDimensions(),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();let i=this._calculateBoundingBoxOfAllMeshes(.1,n);this._lightSetting.removeFromScene();let o=await G(this._scene,this._uiScene,i,e);n&&this._dimensionHelper.disableTopDimensions(),this._lightSetting.addToScene(),this._requestRender(),t(o)})})}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}zoomToComponent(e){this._cameraControl.saveState(!1);let t=e.boundingBox.getSize(new THREE.Vector3),n=this._getYRotationOfObject(e),i=new THREE.Euler(0,n,0),o=e.getWorldPosition(new THREE.Vector3).clone().add(e.boundingBox.getCenter(new THREE.Vector3).applyEuler(i));const s=new THREE.Vector2;this._renderer.getSize(s),this._cameraControl.zoomTo(t,s.width,s.height,i.y,b(15),o)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart(!1)}resetCameraToState(){this._cameraControl.resetToState()}resetCameraPositionToStart(e=!0){this._requestRender();const t=this._configuratorViewModel.getBoundingBox();t&&this._cameraControl.reset(t.getSize(new THREE.Vector3),void 0,void 0,void 0,e)}_clearSelectionAndHovers(){this.cancelSelection(),this._configuratorViewModel.clearRootComponent()}resetPreviews(){this._configuratorViewModel.removePreviews(),this._addonHelper&&this._addonHelper.setState(5),this._requestRender()}changeOffset(e){this._camera.offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}_onWindowResize(){this._configuratorInputManager&&this._configuratorInputManager.updateSize(),this.updateSize()}updateSize(e=!0){const{x:t,y:n}=this._domHelper.getClientDimensions();this._renderer.setSize(t,n),this._camera.aspect=t/n,this._camera.updateProjectionMatrix(),this._updateCameraToBounds(null,e);const i=this._renderer.getPixelRatio();if(this._renderTarget){const e=Math.floor(t*i),o=Math.floor(n*i);this._renderTarget.setSize(e,o)}if(this._pixotron)try{this._pixotron.setSize(t,n)}catch(e){console.warn(e)}this._renderEverything()}setCameraOffset(e){this._camera.offset&&(this._camera.offset=e,this._renderEverything())}getCameraOffset(){return JSON.parse(JSON.stringify(this._camera.offset))}_onKeyDown(e){!e.key||"Escape"!==e.key&&"Esc"!==e.key||(this.cancelSelection(),e.preventDefault()),e.key&&e.key.includes("Shift")&&(this._cameraControl.enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&("Backspace"===e.key||"Delete"===e.key)&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e){e.key&&e.key.includes("Shift")&&(this._cameraControl.disablePanning(),e.preventDefault())}cancelPreviousDockings(){this._cancelDockings(!0,null,!1,!1)}cancelSelection(e){(this._sceneEventHandler.hasSelection()||"standard"!==this._sceneEventHandler.getSelectionMode())&&this._cancelSelection(e)}_cancelSelection(e){this._sceneEventHandler.cancelSelection(),this._configuratorContext.selectionMode="standard",this._configuratorContext.selectedRuntimeComponentIds=[],this._configuratorViewModel.removePreviews(),e&&!this._initData.debug&&this.resetCamera(),this._kernelAccess.updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel()}_selectComponent(e){this._highlight(e)}_deselectComponent(e,t){"standard"===this._sceneEventHandler.getSelectionMode()&&(this._cancelSelection(t),this._highlight()),"multiselect"===this._sceneEventHandler.getSelectionMode()&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t),this._highlight())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return g(e,this._camera,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}cleanUp(){this.stopRenderLoop()}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return this._environment&&this._environment instanceof X||(this._environment=new X(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),new Promise((t,n)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},n)})}enableHD(e){this._renderer.capabilities.maxTextures>8&&(e?e&&this.loadDynamicLightSetting(e):this.loadDynamicLightSetting(y.createDynamicLightSettingSource(null,E.CAMERA))),this._environment instanceof Y&&(this._environment.removeFromScene(),this._environment.loadBackground(L()+Z,new THREE.MeshStandardMaterial)),this.reEnableHD()}reEnableHD(){let e={saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:1.5},shadowparams:{shadowMapResolution:1024,shadowRadius:1,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:50,side:THREE.FrontSide},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}};this._pixotron=new window.PIXOTRON.Pixotron(e),this._pixotron.enableAA=!1,this._pixotronUtil=new $(this._pixotron),this._initData.autoQuality&&this._enableAutoQuality(),this._environment instanceof Q&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),this._requestRender()}_enableAutoQuality(){this._pixotronUtil.enablePixotronAutoQuality();const e=this._pixotronUtil.getAutoAdapter();let t=this._renderer.getPixelRatio();if(t>1){let n=this._pixotronUtil.getHighPixelRatioQualitySetting();e.addQuality(n),n.onExit(()=>{if(t=this._renderer.getPixelRatio(),1!==t&&e.getAverageFps()<20&&t>1){this._renderer.setPixelRatio(1);const{x:e,y:n}=this._domHelper.getClientDimensions();try{this._pixotron.setSize(e,n)}catch(e){console.warn(e)}this._renderTarget&&this._renderTarget.setSize(e,n),t=1}})}this._pixotronUtil.onAutoQualityChange((t,n)=>{this._statsHelper&&this._statsHelper.updateQualityInfo(t);const i=this._pixotronUtil.getLowestQualitySetting();n&&t.getQuality()<n.getQuality()&&e.getAverageFps()<5&&e.setQualitySetting(i)}),this._pixotronUtil.onManualQualityChange((e,t)=>{this._statsHelper&&this._statsHelper.updateQualityInfo(e)}),this._configuratorViewModel.materialQueue.finished(!0).then(()=>this._pixotronUtil.unLockAdapter())}disableHD(){this._pixotron=null,this._lightSetting=new he(this._scene,this._lightSetting)}async loadDynamicLightSetting(e){this._lightSetting=new W(this._scene,this._lightSetting);let t=!1;if(e.url)await this._lightSetting.loadFromURL(e.url),t=!0;else if(e.json)await this._lightSetting.loadFromJSON(e.json),t=!0;else if(e.object)await this._lightSetting.loadFromObject(e.object),t=!0;else if(e.ls){const n=y.createDynamicLightSettingSource(null,e.ls);await this._lightSetting.loadFromURL(n.url),t=!0}if(!t)throw new Error("No dynamic light setting source set");this._renderEverything()}exportGLB(){this._scriptLoader.fetch(q,{id:"gltf-exporter"}).then(()=>{let e=new THREE.GLTFExporter,t=[];this._scene.children.forEach(e=>{"Object3D"!==e.type&&"Mesh"!==e.type||t.push(e)}),e.parse(t,e=>{let t=document.createElement("a");const n=new Blob([e],{type:"model/gltf-binary"});t.href=URL.createObjectURL(n),t.download="scene.glb",t.style.display="none",document.body.appendChild(t),t.click()},{binary:!0,embedImages:!0,forceIndices:!0})})}showGUI(){let e=w();e&&(this._lightSetting&&this._lightSetting.showGUI(),this._pixotron&&this._pixotronUtil.showGUI(),this._environment&&this._environment.showGUI(),this._addGUIListener(e))}_addGUIListener(e){let t=e.__folders;Object.keys(t).forEach(e=>{let n=t[e];n.__folders&&Object.keys(n.__folders).forEach(e=>{let n=t[e];this._addGUIListener(n)}),n.__controllers&&n.__controllers.forEach(e=>{e.onFinishChange(()=>{this._requestRender()})})})}zoomIn(e){this._cameraControl.zoomIn(e),this._renderEverything()}zoomOut(e){this._cameraControl.zoomOut(e),this._renderEverything()}showStats(){t.import("./stats-helper-f3d5141e.legacy.js").then(({default:e})=>this._statsHelper=new e)}async showDimensions(){await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._renderEverything()}async _initDimensions(){this._dimensionHelper||await t.import("./dimensioning-helper-71f8c8cf.legacy.js").then(({default:e})=>{this._dimensionHelper=new e(this._creator_),this._pluginSystem.addPlugin(this._dimensionHelper)})}hideDimensions(){this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}loadSceneSettings(e){let t=new Promise(t=>{(new ee).load(this._scene,this._renderer.domElement,this._environment,e).then(e=>{e&&this._setEnvironment(e),t()})});this._lightSetting=new W(this._scene,this._lightSetting);let n=this._lightSetting.loadFromObject(e);return new Promise((e,i)=>{Promise.all([t,n]).then(()=>{this._renderEverything(),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof X,e()},i)})}setBackgroundColor(e){this._setEnvironment(new J(this._scene,this._environment,new THREE.Color(e)))}setBackgroundImage(e){this._setEnvironment(new J(this._scene,this._environment,null,this._renderer.domElement,e))}setBakedShadow(e,t){this._setEnvironment(new J(this._scene,this._environment,new THREE.Color(e),this._renderer.domElement,t))}_setEnvironment(e){this._environment=e,this._environment instanceof Q&&(this._pixotron&&this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._renderEverything(),500))),this._renderEverything()}handleEvent(e){switch(e.type){case"resize":this._onWindowResize();break;case"keydown":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyDown(e);break;case"keyup":if(e.target&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))break;this._onKeyUp(e);break;case"visibilitychange":this._tabVisible()}}_updateCameraToBounds(e,t=!0){e||(e=this._configuratorViewModel.getBoundingBox()),e&&(this._cameraControl.updateToBounds(e,!1,t),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition())}requestDockingsPreview(e,t,n,i){i||(i=!1),e&&this.cancelPreviousDockings(),this.cancelSelection(),i&&this.enableDragIn(n),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._kernelAccess.webGlPreviewDockings(this._configuratorContext,i),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._kernelAccess.previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){const t=s.start("dock_component_"+e.childId);this._kernelAccess.dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null,s.end(t)}_onSelectedRuntimeComponentsChange(e){this._kernelAccess.multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,n=null;e&&(t=e.roomleId===this._configuratorContext.rootComponentId,n=e.roomleId),this._kernelAccess.selectionChange(n,t),e&&(this._kernelAccess.selectedComponent(e.roomleId),this._initData.debug||this.zoomToComponent(e))}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(Array.isArray(e)&&0!==e.length&&t&&-1===e.indexOf(t)){switch(this._configuratorContext.selectionMode){case"standard":this.resetCamera(),this._kernelAccess.requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case"multiselect":this.resetCamera(),this._kernelAccess.requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds)}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){if(e.roomleId===this._configuratorContext.rootComponentId){let t=new THREE.Vector3(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,t,null)}this._addonHelper&&e&&t.addOnSpots&&this._addonHelper.addAddOnSpots(e,t.addOnSpots),void 0===e.geometryChanged||e.geometryChanged?this._renderEverything():this._renderWithoutShadowsAndAO()}planObjectUpdated(e,t){if(e.bounds){if(this._configuratorContext.planObjectId===e.id){const n=S(e.boxForMeasurement);this._updateBounds(n,t)}this._highlight(),this._requestRender()}}componentDeleted(e){this._addonHelper&&this._addonHelper.deleteAddonPointsForComponent(e.roomleId),-1===this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.roomleId)&&"multiselect"!==this._sceneEventHandler.getSelectionMode()||this.cancelSelection()}previewConstructionDone(e,t){t||(this._cancelDockings(!0,null,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());const n=this._configuratorViewModel.getBoundingBoxWithPreviews();this._updateCameraToBounds(n),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(n),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(n.getSize(new THREE.Vector3)),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._configuratorViewModel)}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new THREE.Vector3(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):this._initData.debug||this.resetCamera(),this._pixotronUtil&&this._pixotronUtil.unLockAdapter(),this._environment&&this._environment.reload()}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks.onComponentPositionsUpdated)return;const e=[];this._configuratorViewModel.getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const n=(new THREE.Box3).setFromObject(t.boundingBoxMesh);let i=this._kernelAccess.kernelInstance.getComponent(t.roomleId);const o=i.parameters||i.possibleChildren?["edit"]:[];e.push({id:t.roomleId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"component",actions:o})}),this._configuratorViewModel.getPreviews().forEach(t=>{const n=(new THREE.Box3).setFromObject(t);e.push({id:t.roomleId,position:this.getScreenXY(n.getCenter(new THREE.Vector3)),type:"preview",actions:["add"]})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}getScene(){return this._scene}_updateBounds(e,t=!1){let n=e.getSize(new THREE.Vector3);if(this._configuratorViewModel.hasPreviews()||this._sceneEventHandler.hasSelection()||this._updateCameraToBounds(e,!1),this._sceneEventHandler.update(n,null,null),this._uiIntersectionHelper.updateToBounds(n,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._environment.needsBounds()&&this._environment.updateBounds(n,t),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(e),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._pixotron&&this._pixotron.getShadowPass().setShadowRecieverBBox(e),this._pixotronUtil){const t=new THREE.Sphere;e.getBoundingSphere(t),this._pixotronUtil.updateBounds(t)}this._camera.updateProjectionMatrix(),this._pluginSystem.updateBounds(e)}updateScene(){const e=this._configuratorViewModel.getBoundingBox();this._updateBounds(e),this._renderEverything()}async moveCamera(e){return this._cameraControl.moveCamera(e)}}return n([i],e.prototype,"_domHelper",void 0),n([i],e.prototype,"_scriptLoader",void 0),n([i],e.prototype,"_configuratorInputManager",void 0),n([i],e.prototype,"_configuratorUiCallbacks",void 0),n([i],e.prototype,"_configuratorMeshGenerator",void 0),n([i],e.prototype,"_memoryManager",void 0),n([i],e.prototype,"_lifeCycleManager",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_kernelAccess",void 0),n([i],e.prototype,"_componentDimensioningHelper",void 0),n([i],e.prototype,"_configuratorViewModel",void 0),n([i],e.prototype,"_environmentLoader",void 0),n([i],e.prototype,"_pluginSystem",void 0),n([i],e.prototype,"_initData",void 0),e})(),Re=(()=>{class e{constructor(e){this._activeComponents=[],this._creator_=e}setCamera(e){this._camera=e}add(e){const n=this._kernelAccess.kernelInstance.getComponent(e.roomleId);if(!n)return!1;const i=n.dimensionings;if(!i||0===i.length||this._camera.position.z<0)return!1;const o=S(n.boxForMeasurement),s={x:this._camera.position.x,y:this._camera.position.z};return t.import("./component-dimensioning-7702446a.legacy.js").then(t=>{Ee.loadFont("static/rubik_regular-75bd7bb699e9e39d.json").then(n=>{i.forEach(i=>{e.add(new t.default(P(i),o,n,s))})})}),this._activeComponents.push(e),!0}remove(e,n=!0){return new Promise(i=>{t.import("./component-dimensioning-7702446a.legacy.js").then(t=>{let o=[];e.children.forEach(e=>{e instanceof t.default&&o.push(e)}),o.forEach(t=>{e.remove(t),v(t)}),n&&x(this._activeComponents,e),i()})})}hasComponentDimensions(){return this._activeComponents.length>0}async reset(){for(const e of this._activeComponents)await this.remove(e);this._activeComponents=[]}clear(){}}return n([i],e.prototype,"_kernelAccess",void 0),e})();e("S",class{constructor(e){this._creator_=e}setScene(e){}setUiScene(e){}updateBounds(e){}clearScene(e,t){}moveCameraEnd(e){}moveCameraStart(e){}needsUiScene(){return!1}});let Me=(()=>{class e{constructor(e){this._plugins=[],this._creator_=e}async init(e,n,i){this._scene=e,this._uiScene=n,this._cameraPosition=i;const{bananaForScale:o}=this._initData;o&&await t.import("./banana-for-scale-8e37587e.legacy.js").then(({default:e})=>this._plugins.push(new e(this._creator_))),this._plugins.forEach(e=>e.setScene(this._scene)),this._plugins.forEach(e=>e.setUiScene(this._uiScene)),this._plugins.forEach(e=>e.updateBounds(this._bounds)),this._plugins.forEach(e=>e.moveCameraEnd(this._cameraPosition))}addPlugin(e){this._plugins.push(e),e.setScene(this._scene),e.setUiScene(this._uiScene),e.updateBounds(this._bounds),e.moveCameraEnd(this._cameraPosition)}updateBounds(e){this._bounds=e,this._plugins.forEach(t=>t.updateBounds(e))}clearScene(e,t){this._plugins.forEach(n=>n.clearScene(e,t))}getActivePlugins(){return this._plugins}getPlugin(e){for(let t of this._plugins)if(t instanceof e)return t;return null}moveCameraEnd(e){this._cameraPosition=e,this._plugins.forEach(t=>t.moveCameraEnd(e))}moveCameraStart(e){this._cameraPosition=e,this._plugins.forEach(t=>t.moveCameraStart(e))}needsUiScene(){return this._plugins.map(e=>e.needsUiScene()).reduce((e,t)=>e||t,!1)}}return n([i],e.prototype,"_initData",void 0),e})();class De{constructor(){this._nonTransparentComponent=null,this._raycaster=new THREE.Raycaster,this._raycaster.near=.1,this._raycaster.layers.enable(3)}init(e,t){this._scene=e,this._camera=t,this.checkComponentVisibility=U(this.checkComponentVisibility,100).bind(this),this.checkPreviewVisibility=U(this.checkPreviewVisibility,100).bind(this)}changeMaterialsOnSelect(e,t,n=!1){t!==this._nonTransparentComponent&&(this._nonTransparentComponent=t,this._changeMaterialsOnSelect(e,t,n))}_changeMaterialsOnSelect(e,t,n=!1){e.children.length>0&&e.children.forEach(i=>{const o=t&&e.id===t.id||n,s=!(i instanceof THREE.Mesh);this._changeMaterialsOnSelect(i,t,(!o||!s)&&o)}),t?e instanceof THREE.Mesh&&e.material instanceof THREE.MeshStandardMaterial&&(e.userData.oldMaterial=e.material,e.material=e.material.clone(),n||(e.material.opacity=.1,e.material.transparent=!0,e.material.needsUpdate=!0)):e.userData.oldMaterial&&e instanceof THREE.Mesh&&e.material instanceof THREE.MeshStandardMaterial&&(e.material=e.userData.oldMaterial,e.material.needsUpdate=!0,e.userData.oldMaterial=void 0)}isComponentVisible(e){const t=[];e.traverse(e=>t.push(e.uuid));const n=(new THREE.Box3).setFromObject(e).getCenter(new THREE.Vector3),i=(new THREE.Vector3).subVectors(n,this._camera.position).normalize();this._raycaster.set(this._camera.position,i),this._raycaster.far=this._camera.position.distanceTo(n);const o=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(e=>{e.object.material.visible&&(t.includes(e.object.uuid)||e.object.userData.ignoreComponentRaycast||o.push(e))}),0===o.length}checkComponentVisibility(e,t){if(!e.hasSelection())return;const n=t.getComponentsForIds(e.getSelectedRuntimeComponentIds());if(n.length>1)return;const i=n[0];this.isComponentVisible(i)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,i)}checkPreviewVisibility(e){if(!e.hasPreviews())return;const t=e.getPreviews();0!==t.length&&(t.map(e=>this.isComponentVisible(e)).reduce((e,t)=>e&&t)?this.changeMaterialsOnSelect(this._scene,null):this.changeMaterialsOnSelect(this._scene,{id:-1}))}}var Oe=Object.freeze({__proto__:null,default:De});const Te=[new I("kernel-access",Ce),new I("logger",k),new I("rapi-access",H),new I("script-loader",te),new I("unit-formatter",ge),new I("camera-control-3d",N),new I("camera-control",ne),new I("configurator-input-manager",class extends K{},1),new I("data-syncer",R),new I("selection-handler",class extends z{constructor(){super(...arguments),this._selectionMode="standard",this._selectedComponents=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedComponents.size&&this._selectedComponents.forEach((e,t)=>{e.deselect(),this._selectedComponents.delete(t),this.dispatchEvent(1,new ve({component:e}))})}_checkStandard(e){if(this._selectedComponents.has(e.roomleId))return this._selectedComponents.delete(e.roomleId),void this.dispatchEvent(1,new ve({component:e}));this._selectedComponents.size>0&&this._selectedComponents.forEach((e,t)=>{this._selectedComponents.delete(t),this.dispatchEvent(1,new ve({component:e,resetCamera:!1}))}),this._selectedComponents.set(e.roomleId,e),this.dispatchEvent(0,new ve({component:e}))}_checkMulti(e){if(this._selectedComponents.has(e.roomleId))return this._selectedComponents.delete(e.roomleId),void this.dispatchEvent(1,new ve({component:e,resetCamera:0===this._selectedComponents.size}));this._selectedComponents.set(e.roomleId,e),this.dispatchEvent(0,new ve({component:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedComponents.size>0}getSelectedRuntimeComponentIds(){let e=[];return this._selectedComponents.forEach(t=>e.push(t.roomleId)),e}isSelected(e){return this._selectedComponents.has(e.roomleId)}},1),new I("configurator-mesh-generator",le),new I("configurator-ui-callbacks",class extends u{constructor(e){super(e),this.onKernelIsReady=null,this.onComponentPositionsUpdated=null,this.onUpdateParameters=e=>{},this.onUpdatePossibleChildren=(e,t)=>{},this.onUpdatePrice=(e,t)=>{},this.onSelectionChange=(e,t,n,i)=>{},this.onSelectionCancel=()=>{},this.onPartListUpdate=(e,t)=>{},this.onBoundsUpdate=e=>{},this.onLoadConfiguration=()=>{},this.onConfigurationReady=(e,t,n)=>{},this.onOpenTag=e=>{},this.onOpenAddOns=()=>{},this.onClickOutside=()=>{},this.onNoDockingsAvailable=()=>{},this.onUiIntersectionChange=e=>{},this.onZoomChange=(e,t)=>{},this.onDimensionsVisibilityChange=e=>{},this.onErrorDueToOffline=e=>{},this.onError=e=>{},this.onDockingsPreviewRemoved=()=>{},this.onConfigurationHasChildren=e=>{},this.onTrackTiming=(e,t,n,i)=>{},this.onUserInitiatedDockDone=(e,t,n,i,o)=>{},this.onAddonPlusHover=()=>{},this.onAddonPlusHoverOff=()=>{},this.onAddonPlusShown=()=>{},this.onAddonPlusHidden=()=>{},this.onContentProblem=e=>{},this.onSyncStarted=()=>{},this.onSyncDone=()=>{},this.onOpenFloorMaterials=()=>{},this.onOpenPartList=()=>{},this.onComponentLoadError=(e,t)=>{},this.onConfigurationLoadError=()=>{},this.onChangeTypeChangeTag=e=>{},this.onRemoveTypeChangeTag=e=>{},this.onConfigurationLabelChange=(e,t,n)=>{},this.onMemoryCorruption=()=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onConfigurationSaved=e=>{},this.onCameraPositionChanges=()=>{}}},1),new I("scene-helper",He,1),new I("component-dimensioning-helper",Re,1),new I("plugin-system",Me,1),new I("component-raycast-helper",De,0)],Le=(e,t)=>e.sort||t.sort?e.sort?t.sort?e.sort-t.sort:-1:1:0,Ae=(e,t)=>e&&!t?1:!e&&t?-1:e&&t?e.localeCompare(t):0;let xe=(()=>{class e{constructor(e){this._onInitDoneCollection=[],this._isKernelReady=!1,this._isWebGlReady=!1,this._isPreloadReady=!0,this._isLoadError=!1,this._isReloading=!1,this._needsSync=!1,this._creator_=e,this._configuratorKernelAccessCallback.addListener(this);const t=this._errorHandler;t.subscribe(0,e=>this._configuratorUiCallbacks.onErrorDueToOffline(e)),t.subscribe(1,e=>this._configuratorUiCallbacks.onError(e)),t.subscribe(2,(e,t)=>this._configuratorUiCallbacks.onContentProblem({rapiPath:e,ids:t,message:"Could not load the ids"}))}_isInitDone(){return this._isKernelReady&&this._isWebGlReady&&this._isPreloadReady}_checkInitDone(){this._isInitDone()&&(this._onInitDoneCollection.forEach(e=>e()),this._onInitDoneCollection=[])}_onInitDone(e){this._isInitDone()?e():this._onInitDoneCollection.push(e)}getScene(){return this._sceneHelper.getScene()}updateScene(){this._sceneHelper.updateScene()}_loadWebGlLib(e,t){this._threeLoader.fetch().then(()=>Promise.all(ie.map(e=>this._scriptLoader.fetch(e,{id:e}))).then(this._loadingWebGlSuccess(e,t).bind(this),this.loadError.bind(this)),this.loadError.bind(this))}_loadingWebGlSuccess(e,t){return()=>{t&&this._sceneHelper.changeOffset(t);const{initialFloorMaterial:e,dls:n,ls:i,stats:o}=this._initData;let s=y.createDynamicLightSettingSource(n,i);this._enableHD(s),o&&this.showStats(),this._needsSync&&(this._needsSync=!1,this._kernelAccess.requestSync(h,this._configuratorContext.planObjectId));const r=[this._scriptLoader.fetch(oe,{id:"tween-js"})];e&&r.push(this._rapiAccess.getMaterial(e).then(e=>this._sceneHelper.changeFloorMaterial(e))),Promise.all(r).then(this._webGlIsReady.bind(this),this.loadError.bind(this))}}_webGlIsReady(){this._isWebGlReady=!0,this._checkInitDone()}_initPromiseCallback(e,t){this._isInitDone()?e():this._isLoadError?t("_initPromiseCallback failed"):(this._onInitDone(()=>e()),this._rejectOnLoadError=t)}_notifyOnConfigurationReady(e){return async t=>{const n=await this._kernelAccess.addUiDataAndPriceToPartList(t.partList,t.hash);t.partList=n,e(t),this._configuratorUiCallbacks.onConfigurationReady(n,t.hash,t.rootComponentLabel)}}_notifyOnConfigurationLoadingError(e){return t=>{this._configuratorUiCallbacks.onConfigurationLoadError(),e(t)}}_loadItemOrConfigById(e,t){this._configuratorContext.lastLoadedRapiId=e,this._onLoadConfiguration(),this._preloadPackage(e),this._clearScene();const{offlineSync:n}=this._initData;if(n){const t=M(e);t&&this._dataSyncer.start(t)}return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(t=>{t&&t.configuration?this._loadConfiguration(t.configuration).then(e=>{const i=this._notifyOnConfigurationReady(n);t.label?this._notifyUiAboutNewItem(t,e.rootComponentLabel):this._notifyUiAboutNewConfiguration(t),i(e)},this._notifyOnConfigurationLoadingError(i).bind(this)):i(new Error("Could not load item or config with id "+e))},i)})}_shouldBroadcastToUi(e){return!(0===e&&this._configuratorContext.selectedRuntimeComponentId||1===e&&!this._configuratorContext.selectedRuntimeComponentId||2===e&&!this._configuratorContext.selectedRuntimeComponentIds.length)}_isCorrectResponse(e,t){if(0===e)return t===this._configuratorContext.planObjectId;if(1===e)return t===this._configuratorContext.selectedRuntimeComponentId;const n=t.length;if(n!==this._configuratorContext.selectedRuntimeComponentIds.length)return!1;for(let e=0;e<n;e++)if(t[e]!==this._configuratorContext.selectedRuntimeComponentIds[e])return!1;return!0}_onLoadConfiguration(){this._clearScene(),this._configuratorUiCallbacks.onLoadConfiguration()}_clearScene(){this._sceneHelper&&this._sceneHelper.clearScene()}_notifyUiAboutNewItem(e,t){this._rapiAccess.getCatalog(e.catalog).then(n=>this._configuratorUiCallbacks.onConfigurationLabelChange(n.name,e.label,t))}_notifyUiAboutNewConfiguration(e){Promise.all([this._rapiAccess.getCatalog(e.catalog),this._rapiAccess.getComponent(e.rootComponentId)]).then(([e,t])=>this._configuratorUiCallbacks.onConfigurationLabelChange(e.name,null,t.label))}_getMaterialGroups(e){const t=(e,t)=>{let n=Le(e,t);return 0!==n?n:(n=Ae(e.label,t.label),0!==n?n:Ae(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 new Promise((t,n)=>{const i=()=>{const{x:i,y:o}=this._domHelper.getClientDimensions();if(i<=0&&o<=0){let e="Size of canvas is 0/0! When using embedding set correct size or remove id to load in idle mode!";return console.error(e),n(e)}this.resumeKernelCallbacks(),s.start("ui_load_configuration");const r=[];if(this._initData.applyCurrentGlobalParameters){const e=this._configuratorContext.planObjectId,t=this._configuratorContext.rootComponentParametersAsGlobal;r.push(this._kernelAccess.getGlobalParameters(e,t))}Promise.all(r).then(([i])=>{const o=[a.waitFor(4),a.waitFor(2)];Promise.all(o).then(([e,[n,o,s,r]])=>{const a=[];i&&this._initData.applyCurrentGlobalParameters&&i.forEach(e=>a.push(this.setParameter(e,e.value,!0)));const l=this._rapiAccess.peekComponent(r);Promise.all(a).then(()=>{const n=[];a.length&&(n.push(this._kernelAccess.getPartList()),n.push(this._kernelAccess.getConfigurationHash(this._configuratorContext))),Promise.all(n).then(async n=>{const i=n&&n[0]?n[0]:o,r=n&&n[1]?n[1]:s,a=await this._kernelAccess.addUiDataAndPriceToPartList(i,r);let h=e.errors;const c=h?_(h):[];t({partList:a,hash:r,rootComponentLabel:l?l.label:"",errors:c})})})},n),this._kernelAccess.loadConfiguration(e)},n)};this._onInitDone(()=>i())})}_preLoadItemOrConfig(e,t){return new Promise((n,i)=>{(t?this._rapiAccess.getConfiguration(e):this._rapiAccess.getItem(e)).then(n,i)})}_preloadPackage(e){this._isPreloadReady=!1;let t=null;t=D(e)?this._rapiAccess.getPreloadForItem.bind(this._rapiAccess):this._rapiAccess.getPreloadForConfiguration.bind(this._rapiAccess),s.start("rapi_preloads");const n=()=>{s.end("rapi_preloads");const t=s.getMeasure("rapi_preloads");if(Array.isArray(t)&&1===t.length){const n=t[0];this._configuratorUiCallbacks.onTrackTiming("Timing","RapiPreloads",Math.round(n.duration),{id:e})}};t(e).then(()=>{this._isPreloadReady=!0,this._checkInitDone(),n()},e=>{this._isPreloadReady=!0,this._checkInitDone(),console.error(e),n()})}_reloadConfiguration(e,t,n,i){return this._performLoadConfiguration(e).then(e=>{this._isReloading=!1,n(e)},e=>{this._isReloading=!1,i(e)})}_performLoadConfiguration(e){return this._onLoadConfiguration(),new Promise((t,n)=>{this._initData.preloadHint?this._preloadPackage(this._initData.preloadHint):console.warn("When loading a configuration string you have to supply a preloadHint to use fast loading!"),setTimeout(()=>{this._loadConfiguration(e).then(this._notifyOnConfigurationReady(t).bind(this),this._notifyOnConfigurationLoadingError(n).bind(this))},0)})}_changeHDGeometry(e){return new Promise((t,n)=>e===r.useHDGeometry?t():this._isReloading?n("Change of HD Geometry in progress"):(this._isReloading=!0,a.waitFor(3).then(([e,i])=>{this._reloadConfiguration(e,i,t,n)},n),r.useHDGeometry=e,void this._kernelAccess.changeUseOfHDGeometry(this._configuratorContext,r.useHDGeometry)))}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}init(e,t){this.setOverrides(t);const{preloadHint:n,offset:i,startTag:o}=this._initData;return this._domHelper.setDomElement(e),n?this._preloadPackage(n):console.warn("No preload hint! Therefore no preload during init!!"),o&&this.getTagById(o,{include:["items"]}).then(e=>this._configuratorUiCallbacks.onOpenTag(e),e=>console.error(e)),this._loadWebGlLib(e,i),new Promise(this._initPromiseCallback.bind(this))}cancelSelection(){this._sceneHelper.cancelSelection()}enableHDGeometry(){return this._changeHDGeometry(!0)}disableHDGeometry(){return this._changeHDGeometry(!1)}changeOffset(e){this._sceneHelper.changeOffset(e)}previewDockings(e,t,n){this._sceneHelper.requestDockingsPreview(!0,e,t,n)}cancelDockings(){this._sceneHelper.cancelDockings()}requestDeleteComponent(){this._sceneHelper.requestDeleteSelectedComponent()}renderImage(e){return this._sceneHelper.renderImage(e)}preparePerspectiveImage(e={}){return this._sceneHelper.preparePerspectiveImage(e)}preparePartImage(e,t){let n={};return"number"==typeof t?n.size=t:(t||(t={}),"number"!=typeof t.size&&(t.size=256),n=t),this._sceneHelper.preparePartImage(e,n)}saveCurrentConfiguration(){return new Promise((e,t)=>{this._kernelAccess.getConfigurationData(this._configuratorContext.planObjectId).then(n=>{this._rapiAccess.saveConfiguration(n).then(n=>{this._configuratorUiCallbacks.onConfigurationSaved(n.configurationHash),this._rapiAccess.getComponent(n.rootComponentId).then(i=>{let o=!0,s=!0,r=n.perspectiveImage,a=n.topImage;n.perspectiveImage||(o=!1,this._sceneHelper.preparePerspectiveImage().then(l=>{this._rapiAccess.savePerspectiveImage(n,l).then(t=>{o=!0,r=t.perspectiveImage,s&&(t.label=i.label,t.topImage=a,e(t))},t)})),n.topImage||(s=!1,this._sceneHelper.prepareTopImage().then(l=>{this._rapiAccess.saveTopImage(n,l).then(t=>{s=!0,a=t.topImage,o&&(t.label=i.label,t.perspectiveImage=r,e(t))},t)})),o&&s&&(n.label=i.label,e(n))},e=>{throw new Error(e)})},t)}).catch(t)})}generateImagesOfCurrentConfiguration(){return new Promise((e,t)=>this.saveCurrentConfiguration().then(t=>e({topImage:t.topImage,perspectiveImage:t.perspectiveImage,isLocally:t.isLocally}),t))}prepareTopImage(e){let t={};return"boolean"==typeof e?t.showDimensions=e:(e||(e={}),"boolean"!=typeof e.showDimensions&&(e.showDimensions=!1),t=e),this._sceneHelper.prepareTopImage(t)}resetCameraPosition(){this._sceneHelper.resetCameraPositionToStart()}showBenchmarks(e){s.showBenchmarks(e)}debugSceneGraph(e){this._sceneHelper.debugSceneGraph(e)}async loadConfiguration(e,t){this.setOverrides(t),this._configuratorContext.lastLoadedRapiId=null,this._sceneHelper&&this._sceneHelper.clearScene();const n=await this._performLoadConfiguration(e);return this._rapiAccess.trackView("configuration string"),n}async loadConfigurationById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!0);return this._rapiAccess.trackView(e),n}syncPlanObjectToView(e,t){this.resumeKernelCallbacks(),this._kernelAccess.requestSync(e,t),this._kernelAccess.requestPlanObjectConstruction(t);const n=this._kernelAccess.getSerializedConfiguration(t),i=this._kernelAccess.getCurrentConfigurationHash(t);this._kernelAccess.planObjectConfigurationUpdated(t,n,i),this._sceneHelper.resetCameraPositionToStart(!1)}async loadConfigurableItemById(e,t){this.setOverrides(t);const n=await this._loadItemOrConfigById(e,!1);return this._rapiAccess.trackView(e),n}preLoadConfigurationById(e){return this._preLoadItemOrConfig(e,!0)}preLoadConfigurableItemById(e){return this._preLoadItemOrConfig(e,!1)}_getTag(e){return this._rapiAccess.getTag(e)}_dispatchSetParameter(e,t,n,i,o){const r=this._configuratorContext.selectedRuntimeComponentId?"local":"global",a=s.start("kernel_change_param_"+r+"_"+e);switch(this._configuratorContext.selectionMode){case"standard":if(this._configuratorContext.selectedRuntimeComponentId||this._configuratorContext.rootComponentParametersAsGlobal){let s=this._configuratorContext.selectedRuntimeComponentId?this._configuratorContext.selectedRuntimeComponentId:this._configuratorContext.rootComponentId;this._kernelAccess.changeComponentParameter(s,e,t,n,i,o)}else this._kernelAccess.changePlanObjectParameter(this._configuratorContext.planObjectId,e,t,n,i,o);break;case"multiselect":this._kernelAccess.changeCommonComponentParameter(this._configuratorContext.selectedRuntimeComponentIds,e,t,n,i,o)}s.end(a)}setParameter(e,t,n=!1){return new Promise((i,o)=>{const{key:s,type:r}=e;if(ce(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._dispatchSetParameter(s,r,t,i,o)})}setParameterOfPlanObject(e,t){return new Promise((n,i)=>{const{planObjectId:o,rootComponentId:s,rootComponentParametersAsGlobal:r}=this._configuratorContext,{type:a,key:l}=e;r?this._kernelAccess.changeComponentParameter(s,l,a,t,n,i):this._kernelAccess.changePlanObjectParameter(o,l,a,t,n,i)})}getParametersOfPlanObject(){const{planObjectId:e,rootComponentParametersAsGlobal:t}=this._configuratorContext;return this._kernelAccess.getGlobalParameters(e,t)}setParameterOfRootComponent(e,t){return new Promise((n,i)=>{const{rootComponentId:o}=this._configuratorContext,{type:s,key:r}=e;this._kernelAccess.changeComponentParameter(o,r,s,t,n,i)})}getParametersOfRootComponent(){const{planObjectId:e}=this._configuratorContext;return this._kernelAccess.getGlobalParameters(e,!0)}enableMultiselect(){this._sceneHelper.setSelectionMode("multiselect"),this._configuratorContext.selectionMode="multiselect"}disableMultiselect(){this._sceneHelper.setSelectionMode("standard"),this._configuratorContext.selectionMode="standard"}getCurrentConfiguration(){return a.waitFor(1,()=>this._kernelAccess.uiRequestConfiguration(this._configuratorContext.planObjectId))}loadComponentIntoKernel(e){return a.waitFor(0,()=>{let t=null;try{if(t=JSON.parse(e).id,!t)throw new Error("Component string has no ID")}catch(e){return this._configuratorUiCallbacks.onContentProblem({rapiPath:"components",ids:[t],message:"Component string is not a valid JSON or has no ID"}),void a.failOperation(0,e)}this._kernelIo.setMeta({componentId:t}),this._kernelAccess.loadComponentIntoKernel(e,t)})}getShortUrlOfCurrentConfiguration(){return new Promise((e,t)=>{this.saveCurrentConfiguration().then(n=>navigator.onLine?this._rapiAccess.getShortUrl(n.id,3).then(t=>{const n=t.shortId,i=d.APP.SHORTENER_URL+n;e(i)},t):t("Can not generate short url when offline"),t)})}formatValueToUnitString(e,t){return this._unitFormatter.formatValueToUnitString(e,t)}getTagById(e,t){return new Promise((n,i)=>{this._getTag(e).then(e=>{let o=Promise.resolve([]),s=Promise.resolve([]);t&&t.include&&t.include.forEach(t=>{"materials"===t&&(o=this._rapiAccess.getMaterialsOf(e)),"items"===t&&(s=this._rapiAccess.getItems(e.items))}),Promise.all([o,s]).then(([t,i])=>(i.sort(Le),t.sort(Le),n({...e,items:i,materials:t})),i)},i)})}requestAsset(e){return this._dataSyncer.requestAsset(e)}changeFloorMaterial(e){return this._sceneHelper.changeFloorMaterial(e)}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._sceneHelper.changeFloorMaterial(t)}openFloorMaterials(){this._configuratorUiCallbacks.onOpenFloorMaterials()}openPartList(){this._configuratorUiCallbacks.onOpenPartList()}getAdditionalContentsOf(e){return this._rapiAccess.getAdditionalContentsOfItems(e)}changeTypeChangeTag(e){navigator.onLine&&this._initData.offlineSync&&this._dataSyncer.syncTypeChangeTag(e),this._configuratorUiCallbacks.onChangeTypeChangeTag(e)}removeTypeChangeTag(e){this._configuratorUiCallbacks.onRemoveTypeChangeTag(e)}showGUI(){const e=document.createElement("style");e.innerText=".dg.ac {right:auto!important}",document.head.appendChild(e),this._scriptLoader.fetch(se,{id:"dat-gui-js"}).then(()=>this._sceneHelper.showGUI(),e=>console.error(e))}showStats(){this._sceneHelper.showStats()}showDimensions(){this._sceneHelper.showDimensions()}hideDimensions(){this._sceneHelper.hideDimensions()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}syncFloorTag(e){return this._dataSyncer.syncFloorTag(e)}syncTypeChangeTag(e){return this._dataSyncer.syncTypeChangeTag(e)}loadDynamicLightSetting(e){return this._sceneHelper.loadDynamicLightSetting(e)}setBackgroundColor(e){this._sceneHelper.setBackgroundColor(e)}setBackgroundImage(e){this._sceneHelper.setBackgroundImage(e)}setBakedShadow(e,t){this._sceneHelper.setBakedShadow(e,t)}loadSceneSetting(e){return this._sceneHelper.loadSceneSettings(e)}enableMeshSelection(e){this._initData.meshSelection=e}updateSize(){this._sceneHelper.updateSize()}setCameraOffset(e){this._sceneHelper.setCameraOffset(e)}getCameraOffset(){return this._sceneHelper.getCameraOffset()}getMain(){}cleanup(){this._configuratorContext.selectedRuntimeComponentIds=[],this._sceneHelper.sceneCleared(),this._kernelAccess.cleanUpCallbacks()}resumeTest(e){e&&this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}zoomIn(e){this._sceneHelper.zoomIn(e)}zoomOut(e){this._sceneHelper.zoomOut(e)}get callbacks(){return this._configuratorUiCallbacks}get globalCallbacks(){return this._globalCallback}getRuntimeComponentIdOfRootComponent(){const e=this._configuratorContext.planObjectId;return e?this._kernelAccess.getRuntimeComponentIdOfRootComponent(e):(console.warn("planObjectId not set"),0)}getCurrentConfigurationHash(){return this._kernelAccess.getConfigurationHash(this._configuratorContext)}getCurrentSelection(){let e=this._configuratorContext.selectedRuntimeComponentIds;return e&&e.length||(e=[this._configuratorContext.rootComponentId]),e.map(e=>this._kernelAccess.getRuntimeComponentId(e))}_enableHD(e){return new Promise((t,n)=>{this._scriptLoader.fetch(re,{id:"pi-js"}).then(()=>{this._sceneHelper.enableHD(e),t()},n)})}isReady(){const e=s.getMeasure("kernel_is_ready");if(Array.isArray(e)&&1===e.length){const t=e[0],n=s.getMeta("kernel_is_ready");this._configuratorUiCallbacks.onTrackTiming("Timing","KernelIsReady",Math.round(t.duration),Object.assign(n,{startTime:t.startTime}))}this._isKernelReady=!0,this._checkInitDone(),"function"==typeof this._configuratorUiCallbacks.onKernelIsReady&&this._configuratorUiCallbacks.onKernelIsReady()}updatePossibleChildren(e,t,n){const i=[],o=[];let s;const r=new Map,a=new Map;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n.possible)continue;let l=n.itemId;n.itemId?(o.push(n.itemId),a.set(n.itemId,n)):(i.push(n.componentId),r.set(n.componentId,n),l=n.componentId),n.isDefault&&!s&&(s=l)}Promise.all([this._rapiAccess.getComponents(i),this._rapiAccess.getItems(o)]).then(e=>{const t=[],n=e[0],i=e[1];let o;for(let e=0,i=n.length;e<i;e++){const i=n[e];i.isItem=!1,i.isComponent=!0;const a=r.get(i.id);a&&(i.group=a.group),i.id===s&&(i.isDefault=!0,o=i),t.push(i)}for(let e=0,n=i.length;e<n;e++){const n=i[e];n.isItem=!0,n.isComponent=!1;const r=a.get(n.id);r&&(n.group=r.group),n.id===s&&(n.isDefault=!0,o=n),t.push(n)}return t.sort(Le),{possibleChildren:t,defaultChild:o||null}}).then(({possibleChildren:e,defaultChild:t})=>{const n=[],i=new Map,o=[];for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.tags;if(s.tags&&Array.isArray(s.tags)&&s.tags.length)for(let e=0,t=s.tags.length;e<t;e++){const t=r[e];-1===n.indexOf(t)&&n.push(t);let o=i.get(t);if(!o){const e=[];i.set(t,e),o=i.get(t)}o.push(s)}else o.push(s)}return{tagIds:n,associations:i,defaultChild:t,noTagChilds:o}}).then(({tagIds:t,associations:i,defaultChild:o,noTagChilds:s})=>{this._rapiAccess.getTags(t).then(t=>{if(this._isCorrectResponse(n,e)&&this._shouldBroadcastToUi(n)){for(let e=0,n=t.length;e<n;e++){const n=t[e];n.possibleChildren=i.get(n.id)}t.sort(Le),s.length&&t.unshift({id:"",externalIdentifier:"",global:!1,created:(new Date).toISOString(),updated:(new Date).toISOString(),language:this._globalInitData.locale,catalog:null,tags:[],parents:[],materials:[],items:[],possibleChildren:s}),this._configuratorUiCallbacks.onUpdatePossibleChildren(t,o)}},e=>{console.error("Couldnt load tags of possible children"),console.error(e)})},e=>console.error(e))}updateParameters(e,t,n,i){const o={};t||(t=[],console.warn("Kernel returned no parameter groups! Check why!")),t.forEach(e=>{o[e.key]=e}),e.sort(Le),e.forEach(e=>{e.group?e.grouping=o[e.group]:e.grouping=null,this._unitFormatter.formatParameter(e),pe(e)&&Object.defineProperty(e,"groups",{get:()=>new Promise((t,o)=>{this._getMaterialGroups(e).then(e=>{this._isCorrectResponse(i,n)&&this._shouldBroadcastToUi(i)?t(e):o("Response does not match to ids")},o)})})}),this._shouldBroadcastToUi(i)&&this._configuratorUiCallbacks.onUpdateParameters(e)}loadError(e){this._isLoadError=!0,this._rejectOnLoadError&&this._rejectOnLoadError(e)}resumeKernelCallbacks(){this._kernelAccess.muteKernelCallbacks=!1,this._kernelAccess.resume()}pauseKernelCallbacks(){this._kernelAccess.muteKernelCallbacks=!0,this._kernelAccess.pause()}setActiveGroupInView(e){this._kernelAccess.setActiveGroupInView(e)}getParameterGroups(){return this._kernelAccess.getParameterGroups()}async getConfiguratorSettings(e){return this._rapiAccess.getConfiguratorSettings(e)}async moveCamera(e){return this._sceneHelper.moveCamera(e)}}return n([i],e.prototype,"_rapiAccess",void 0),n([i],e.prototype,"_dataSyncer",void 0),n([i],e.prototype,"_errorHandler",void 0),n([i],e.prototype,"_unitFormatter",void 0),n([i],e.prototype,"_domHelper",void 0),n([i],e.prototype,"_configuratorUiCallbacks",void 0),n([i],e.prototype,"_configuratorKernelAccessCallback",void 0),n([i],e.prototype,"_lifeCycleManager",void 0),n([i],e.prototype,"_kernelAccess",void 0),n([i],e.prototype,"_threeLoader",void 0),n([i],e.prototype,"_scriptLoader",void 0),n([i],e.prototype,"_configuratorContext",void 0),n([i],e.prototype,"_sceneHelper",void 0),n([i],e.prototype,"_initData",void 0),n([i],e.prototype,"_globalInitData",void 0),n([i],e.prototype,"_globalCallback",void 0),n([i],e.prototype,"_kernelIo",void 0),e})();class Ue extends ae{setupDependencies(){O.setup(Te),this.lookup("kernel-access",this._context),this.lookup("rapi-access",this._context),this.lookup("script-loader",this._context),this.lookup("logger",this._context)}cleanUpGlobals(){delete window.RoomleConfigurator}cleanUpDependencies(){const e=this.lookup("script-loader"),t=this.lookup("rapi-access"),n=(this.lookup("dom-helper"),this.lookup("scene-helper"));e&&e.cleanUp(),t&&t.cleanUp(),n&&n.cleanUp()}setupGlobals(e){const{kernelInstance:t,kernelContainer:n,planObjectId:i}=e||{};r.init({kernelInstance:t,kernelContainer:n,planObjectId:i})}getApi(){return this._configurator}bootFinished(){this._configurator=new xe(this._context),this._configurator.getMain=()=>this,window.RoomleConfigurator||(window.RoomleConfigurator=this._configurator)}getContextName(){return"configurator"}}e("C",Ue),e("c",Object.freeze({__proto__:null,Configurator:Ue}))}}}));
2
- //# sourceMappingURL=configurator-f6d8647d.legacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configurator-mesh-generator-210e5ffe.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"default-light-setting-92bb70ce.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dimensioning-helper-71f8c8cf.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- System.register(["./rapi-access-1db44eda.legacy.js","./pixotron-769d1fe5.legacy.js","./default-light-setting-92bb70ce.legacy.js"],(function(t){var e,n,r,i,a,s,o;return{setters:[function(t){e=t.T,n=t.V,r=t.t,i=t.h},function(t){a=t.E,s=t.L},function(t){o=t.D}],execute:function(){t("G","static/GLTFExporter-86edae059df3a219.js");const c=r(30);class h extends a{constructor(t,e,n,r){super(),this._offset=new THREE.Vector3(0,0,0),this._mode=void 0===r?1:r,this._scene=t,this._camera=e,this._raycaster=new THREE.Raycaster,this._raycaster.layers.enableAll(),this._inputManager=n,this._addInputListeners(n),this._planeBottom=new THREE.Plane(new THREE.Vector3(0,1,0)),this._planeFront=new THREE.Plane(new THREE.Vector3(0,0,1)),this._planeSide=new THREE.Plane(new THREE.Vector3(1,0,0))}setLayers(t){this._raycaster.layers=t}_addInputListeners(t){t.addEventListener(3,t=>{this._findCandidate(t.positionRelative)},this),t.addEventListener(5,t=>{this._findSelection(t.positionRelative)},this),t.addEventListener(6,t=>{this._findHover(t.positionRelative,t.type)},this),t.addEventListener(0,t=>{this._onDragStart(t.positionRelative)},this),t.addEventListener(1,t=>{this._onDrag(t.positionRelative)},this),t.addEventListener(2,t=>{this._onDragEnd(t.positionRelative)},this),t.addEventListener(9,t=>{this._onRotate(t.positionRelative,t.rotation)},this),t.addEventListener(10,()=>{this._currentRotate=null},this)}_findCandidate(t){this._intersection(t)&&this._inputManager.onElementHit()}_findSelection(t){let e=this._intersection(t);e?e&&e.object.dispatchEvent({type:"select"}):this.dispatchEvent(3)}_findHover(t,e){const n=this._intersection(t);!n&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:e}}),this._currentHover=null):n&&(this._currentHover&&this._currentHover.id!==n.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:e}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:n,type:e}}):(this._currentHover=n.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:n,type:e}})))}_intersection(t){const e=this._intersect(t);if(e.length<=0)return null;let n=e[0];return e.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&e.forEach(t=>{t.object.id===this._currentHover.id&&t.object.userData.priority===this._currentHover.userData.priority&&n.object.userData.priority<=t.object.userData.priority&&(n=t)}),n}_intersect(t){this._raycaster.setFromCamera(t,this._camera);const e=[];return this._raycaster.intersectObjects(this._scene.children,!0).forEach(t=>{const n=this._findObjectWithHandler(t.object);n&&(t.object=n,e.push(t))}),e.length>=0?e.sort((t,e)=>t.object.userData.priority!==e.object.userData.priority?e.object.userData.priority-t.object.userData.priority:t.distance-e.distance):[]}_findObjectWithHandler(t){return t.userData.hasListener?t:t.parent?this._findObjectWithHandler(t.parent):null}_onDragStart(t){let e=this._intersection(t);if(!e&&!this._currentDrag)return;if(e&&e.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&e&&(this._currentDrag=e.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let n=this._currentDrag.parent;n&&n.computeBoundingBox&&(n.computeBoundingBox(),this._calculateOffset(n)),this._positionPlanes(n)}_onDrag(t){if(!this._currentDrag)return;this._raycaster.setFromCamera(t,this._camera);let e,n=new THREE.Vector3(0,0,-5);this._raycaster.ray.intersectPlane(this._planeBottom,n);let r=this._getDistanceToCamera(n),i=this._camera.userData.yaw;if(0===this._mode)e=n.clone(),e.y=this._currentDrag.parent.position.y;else{let t=new THREE.Vector3(0,0,0),a=new THREE.Vector3(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,t),this._raycaster.ray.intersectPlane(this._planeSide,a);let s=this._getDistanceToCamera(a),o=this._getDistanceToCamera(t);i>=-c&&i<=c?e=r<o?n.clone():t.clone():r<o&&r<s?e=n.clone():o<r&&o<s?e=t.clone():s<r&&s<o&&(e=a.clone()),e.sub(this._offset)}this._currentDrag.dispatchEvent({type:"drag",attachment:{position:e}})}_getDistanceToCamera(t){let n=t.clone().sub(this._camera.position).length();return e(t)&&(n=Number.POSITIVE_INFINITY),n}_onDragEnd(t){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:t}}),this._currentDrag=null)}_onRotate(t,e){if(!this._currentRotate){let e=this._intersection(t);if(!e)return;this._currentRotate=e.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:e}})}_positionPlanes(t){0===this._mode?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):t&&t.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-t.boundingBox.getCenter(new THREE.Vector3).y-this._rootComponentPosition.y,this._planeSide.constant=2*-t.boundingBox.getSize(new THREE.Vector3).x+t.boundingBox.getCenter(new THREE.Vector3).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+t.boundingBox.getCenter(new THREE.Vector3).z))}_calculateOffset(t){t&&t.boundingBox&&(this._offset.copy(t.boundingBox.getCenter(new THREE.Vector3)),this._offset.applyQuaternion(t.getWorldQuaternion(new THREE.Quaternion)))}update(t,e,n){if(t&&(this._bounds=t),e&&(this._rootComponentPosition=e),n){this._backgroundScene=n;let t=this._backgroundScene.children[0];t instanceof THREE.Mesh&&t.geometry.computeBoundingBox()}}clear(){this._currentDrag&&n(this._currentDrag),this._currentHover&&n(this._currentHover)}enableDragIn(t){this._currentDrag=t}setRootComponentId(t){this._rootComponentId=t}setCamera(t){this._camera=t}setScene(t){this._scene=t}setMode(t){this._mode=t}}t("S",class extends a{constructor(t,e,n,r){super(),this._debug=!1,this._dragIn=!1,this._inputManager=r,this._raycastHelper=new h(e,n,this._inputManager),this._creator_=t}isDragIn(){return this._dragIn}setDragIn(t,e){this._dragIn=t,t?this._inputManager.enableDragIn(e):this._raycastHelper.clear(),this._interaction()}});class l extends s{constructor(t,e){super(t,e),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 t=i();if(t&&this._ambientLight){let e=t.addFolder("Ambient Light");e.add(this._ambientLight,"visible"),e.add(this._ambientLight,"intensity").min(0).max(5).step(.1),e.addColor(this._params.ambientLight,"color").onChange(t=>this._ambientLight.color=new THREE.Color(t))}}}let d=null;const u=()=>(d||(d=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),d.outputEncoding=THREE.sRGBEncoding,d.gammaFactor=2.2),d),_=(t("g",(t,e=0)=>{if(!t){const t=new THREE.Vector3;return{center:t,bounds:t,diagonal:0}}const n=t.getSize(new THREE.Vector3);return n.addScalar(e),{center:t.getCenter(new THREE.Vector3),bounds:n,diagonal:Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)+Math.pow(n.z,2))}}),t("p",(t,e,n,r={})=>new Promise(i=>{const{size:a=1024}=r,s=u();s.setSize(a,a);const c=t.fog?t.fog.clone():null,h=t.background?t.background.clone():null;t.background=null,t.fog=null;let l=new o(t);e.layers.disable(2),e.layers.disable(5),_(e,n,-20,-30),s.render(t,e);const d=s.domElement.toDataURL();e.layers.enable(2),t.background=h,t.fog=c,l.removeFromScene(),i({image:d,width:a,height:a,blob:null})})),t("r",(t,e,n,r,i,a)=>new Promise(r=>{a||(a=1024);const i=u();i.setSize(a,a);const s=t.fog?t.fog.clone():null,o=t.background?t.background.clone():null;t.background=null,t.fog=null,e.layers.disable(2),e.layers.disable(5),n?_(e,n,-20,-30):(e.aspect=1,e.updateProjectionMatrix()),i.render(t,e);const c=i.domElement.toDataURL();e.layers.enable(2),t.background=o,t.fog=s,r({image:c,width:a,height:a,blob:null})})),(t,e,n,i)=>{t.far=1e3,t.fov=15,t.aspect=1,t.position.copy(e.center),t.rotation.set(0,0,0),t.rotateY(r(i)),t.rotateX(r(n)),t.translateZ(3.8*e.diagonal),t.updateProjectionMatrix()});t("a",(t,e,n,i={})=>{const{showDimensions:a=!1}=i;return new Promise(i=>{const s=u();s.autoClear=!1;let c=new THREE.OrthographicCamera(-n.bounds.x/2,n.bounds.x/2,n.bounds.z/2,-n.bounds.z/2,.5);c.position.copy(n.center),c.rotateX(r(-90)),c.translateZ(n.bounds.y+1),c.far=c.position.y+.5,c.layers.mask=65535;let h=200*n.bounds.x,d=200*n.bounds.z;if(h>4096||d>4096){let t=0;h>4096?t=h/4096:d>4096&&(t=d/4096),h/=t,d/=t}s.setSize(h,d);let _=t.fog?t.fog.clone():null,g=t.background?t.background.clone():null;t.background=null,t.fog=null;let p=a?new l(t):new o(t);c.layers.disable(2),c.layers.disable(5),a?c.layers.enable(7):c.layers.disable(7),s.render(t,c),e&&(s.clearDepth(),s.render(e,c));let b=s.domElement.toDataURL();c.layers.enable(2),c.layers.enable(5),t.background=g,t.fog=_,p.removeFromScene(),i({image:b,width:h,height:d,blob:null})})})}}}));
2
- //# sourceMappingURL=image-renderer-c831cb02.legacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"material-viewer-9d5181b8.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mesh-generator-ddb18de3.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- System.register(["./query-params-helper-8c00a872.legacy.js","./rapi-access-1db44eda.legacy.js","./main-thread-to-worker-45106055.legacy.js"],(function(t){var e,i,s,a,n,o,h,r,_,l,d,c,u,g,m,p,w,E,y,P,S,v,b;return{setters:[function(t){e=t.g},function(t){i=t.r,s=t.B,a=t.I,n=t._,o=t.i,h=t.t,r=t.s,_=t.u,l=t.v,d=t.w,c=t.x,u=t.h,g=t.G,m=t.y,p=t.z,w=t.F,E=t.H,y=t.J,P=t.K},function(t){S=t.d,v=t.g,b=t.h}],execute:function(){t("f","static/dat.gui.min-b5cbb61e5c62f0bf.js"),t("T","static/Tween-d024b02fe34f25ab.js"),t("M",class{constructor(t){this._context=t||i.getContext(this.getContextName()),s.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){i.setup(a);const t=e();this.lookup("global-init-data").setOverrides(t),this.lookup("init-data",this._context).setOverrides(t)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const t in window.THREE)if(window.THREE.hasOwnProperty(t))try{delete window.THREE[t]}catch(t){console.error(t)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(t){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(t),this.setupDependencies(),this.bootFinished()}lookup(t,e){return window.__RML__DI__.lookup(t,e)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(t){t&&this.lookup("dom-helper",this._context).setDomElement(t),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),i.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}});class x{constructor(){this._listeners={}}_addEventListener(t,e,i){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push({callback:e,scope:i})}addEventListener(t,e,i){this._addEventListener(t,e,i)}dispatchEvent(t,e){if(!this._listeners[t])return;const i=this._listeners[t];let s=i.length;for(let t=0;t<s;t++){const s=i[t];e?s.callback.apply(s.scope,[e]):s.callback.call(s.scope)}}removeEventListener(t,e){const i=this._listeners[t];if(i)for(let t=0,s=i.length;t<s;t++)if(i[t].callback===e)return void i.splice(t,1)}}t("E",x);const T=t("h",10);let f=t("d",(()=>{class t extends x{constructor(t,e,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=h(T),this._yaw=h(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=t,this._inputManager=e,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new THREE.Vector3,this._targetPosition=new THREE.Vector3,i?this._cameraPosition.copy(i):this._cameraPosition=new THREE.Vector3(0,.5,3),this._initData.debug){const t=this.getDebugCameraPosition();t&&this._setCurrentCameraParameters(t)}let s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=S(this._dispatchCameraIdle.bind(this),16)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.addEventListener(t.key,t.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.removeEventListener(t.key,t.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(t){let e=this._cameraPosition;if(!e||r(e,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,this._dispatchCameraIdle(),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,this._lerpEnabled&&!this._tweenEnd){let i=this.getCamera().position.clone();const s=Math.min(10*t,1);i.lerp(e,s),this.getCamera().position.copy(i)}else this.getCamera().position.copy(e);return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this._getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_areEqual(t,e){return t.yaw.toFixed(5)===e.yaw.toFixed(5)&&t.pitch.toFixed(5)===e.pitch.toFixed(5)&&t.distance.toFixed(5)===e.distance.toFixed(5)&&t.targetX===e.targetX&&t.targetY===e.targetY&&t.targetZ===e.targetZ}_tweenCameraParameter(t,e,i){return new Promise(i=>{if(e.yaw-t.yaw<=-Math.PI?t.yaw-=2*Math.PI:e.yaw-t.yaw>=Math.PI&&(t.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=e,new TWEEN.Tween(t).to(e,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._update(new THREE.Vector3(t.targetX,t.targetY,t.targetZ))}).onComplete(()=>{this.dispatchEvent(2,3),this._tweenEnd=null,i()}).start(),this.dispatchEvent(0,3)}})}_getCurrentCameraParameters(){const t=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z}}_setCurrentCameraParameters(t){this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._targetPosition.copy(new THREE.Vector3(t.targetX,t.targetY,t.targetZ))}_rotateHorizontal(t){this._yaw-=t,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(t){this._pitch+=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(t){if(t||!this._stateSaved){let t=this._yaw,e=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:t,pitch:e,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let t=this._getCamera();this._stateSaved.fov=t.fov,this._stateSaved.near=t.near,this._stateSaved.far=t.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let t=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z},this._stateSaved,!0)}this._stateSaved=null}setToState(t,e){this._tweenCameraParameter(t,e,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(t){const{x:e,y:i}=this._domHelper.getClientDimensions();return new THREE.Vector3(t.x/e*2-1,-t.y/i*2+1,.5)}addLightContainer(t){t.name="lights";const e=this._getCamera(),i=e.children.find(t=>"lights"===t.name);i&&e.remove(i),e.add(t)}checkNearFarDistance(t){if(!t)return;const e=this._cameraPosition.distanceTo(t),i=this._getCamera();i instanceof THREE.PerspectiveCamera&&e>i.far&&(i.far=e+1)}}return n([o],t.prototype,"_domHelper",void 0),n([o],t.prototype,"_initData",void 0),t})());class M{constructor(t,e){this.minZoom=!1,this.maxZoom=!1,this.minZoom=t,this.maxZoom=e}}t("C",class extends f{constructor(t,e,i,s){super(t,e,i),this._bounds=new THREE.Vector3,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=h(0),this.maxPolarAngle=h(85),this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,s?this._camera=s:this._initCamera(),this._targetPosition||(this._targetPosition=new THREE.Vector3(0,0,0));const{cameraRestriction:a,zoomDistance:n,minVerticalCameraAngle:o,maxVerticalCameraAngle:r,minHorizontalCameraAngle:_,maxHorizontalCameraAngle:l}=this._initData;if(n&&(this._zoomDistance=n/100),void 0!==o&&(this.minPolarAngle=h(o<0?o:-1*o)),void 0!==r&&(this.maxPolarAngle=h(r)),void 0!==_&&(this.minAzimuthAngle=h(_<0?_:-1*_)),void 0!==l&&(this.maxAzimuthAngle=h(l)),void 0!==a){let t=Math.abs(h(a));this.minAzimuthAngle=-t,this.maxAzimuthAngle=t,this.maxPolarAngle=Math.min(t,h(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}_initCamera(){this._camera=new THREE.PerspectiveCamera,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(5),this._camera.layers.enable(4)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t))return!1;let e=this._targetPosition;return!!e&&(this.getCamera().lookAt(e),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:t=>{1!==this._state||this._locked||(this._userInteraction=!0,this._move(new THREE.Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:11,fun:t=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new THREE.Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2,t.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:t})=>{this._maxZoomedIn||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:t})=>{this._maxZoomedOut||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomOut())}})}_panTargetPosition(t){const e=t.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),a=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-e.x/i.clientHeight*a,s.y=s.y+e.y/i.clientHeight*a,this._targetPosition.copy(s.unproject(this._camera))}_pan(t,e){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0,e)),this._panTargetPosition(t),_(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}_move(t,e){this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0,e));const i=t.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(t):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),_(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}setBounds(t){this._boundingBox=t}zoomToFitBounds(t){this.setBounds(t);const e=t.getSize(new THREE.Vector3);if(this._initData.debug||e.x+e.y+e.z===0)return;const i=this._getCurrentCameraParameters(),s=t.getCenter(new THREE.Vector3);this._targetPosition=new THREE.Vector3(s.x,s.y,s.z);const a=this._setDistanceAndRangesBasedOnBounds(e);this._distance=a,this._checkZoomDistance(t,a),this._tweenCameraParameter(i,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},!1)}updateToBounds(t,e,i=!0,s){if(this.setBounds(t),this._initData.debug)return;const a=this._getCurrentCameraParameters(),n=t.getSize(new THREE.Vector3);if(i){const i=t.getCenter(new THREE.Vector3);this._targetPosition=s?s.clone():new THREE.Vector3(i.x,i.y,i.z);const o=this._setDistanceAndRangesBasedOnBounds(n);this._distance=o,this._checkZoomDistance(t,o),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},e):this._update()}}_checkZoomDistance(t,e){const i=t.getBoundingSphere(new THREE.Sphere);e-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=e-i.radius)}_setDistanceAndRangesBasedOnBounds(t){const e=this._domHelper.getClientDimensions(),i=e.x,s=e.y,a=this._camera.offset?i-i*this._camera.offset.left-i*(1-this._camera.offset.right):i,n=this._camera.offset?s-s*this._camera.offset.bottom-s*(1-this._camera.offset.top):s;this._bounds.copy(t);const{cameraSpacing:o}=this._initData;t.addScalar(o/100),this.minDistance=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);const h=Math.max(t.x,t.y),{x:r,y:_}=this._getMargin(a,n),d=l(t.x+r,t.y+_,t.z,this._camera.fov,a,n);return this._distance<d&&(this._distance=d),this.maxDistance=d+h,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,d}_getMargin(t,e){let i=this._bounds.x/2,s=this._bounds.y/2;return t>1080&&(i+=this._bounds.x<.3?.2:0,i+=this._bounds.x*(t/1080-1)),e>1080&&(i+=this._bounds.y<.3?.2:0,s+=this._bounds.y*(e/1080-1)),{x:i,y:s}}reset(t,e,i,s,a=!0){if(t){e?this._targetPosition.copy(e):this._targetPosition=new THREE.Vector3(0,t.y/2,0);const n=this._getCurrentCameraParameters();i||(i=-30),s||(s=T),this._pitch=h(s),this._yaw=h(i),this._setDistanceAndRangesBasedOnBounds(t);let o=this._targetPosition.clone();this._areEqual(n,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:o.x,targetY:o.y,targetZ:o.z})?this._moveCameraForthAndBack():a?this._tweenCameraParameter(n,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:o.x,targetY:o.y,targetZ:o.z},!0):this._update(this._targetPosition)}else console.warn("you cant reset without bounds!")}updateAndReset(t,e,i,s,a,n=!0){const o=new THREE.Vector3(-t.x/2,0,-t.z/2),r=new THREE.Vector3(t.x/2,t.y,t.z/2);if(this._boundingBox=new THREE.Box3(o,r),a&&t.addScalar(a),e?this._targetPosition.copy(e):this._targetPosition=new THREE.Vector3(0,t.y/2,0),-1===this._distance){const e=this._setDistanceAndRangesBasedOnBounds(t);this._distance=Math.max(2,e)}const _=this._getCurrentCameraParameters();i||(i=-30),s||(s=T),this._pitch=h(s),this._yaw=h(i),this._setDistanceAndRangesBasedOnBounds(t);let l=this._targetPosition.clone();n?this._tweenCameraParameter(_,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:l.x,targetY:l.y,targetZ:l.z},!0):this._update(this._targetPosition)}_moveCameraForthAndBack(){if(window.TWEEN){let t={value:.6*this._camera.far},e={value:this._distance};new TWEEN.Tween(t).to(e,300).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this._distance=t.value,this._update()}).start()}}_update(t){this._initData.debug?this._pitch=Math.max(h(-89),Math.min(h(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const e=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX"),i=(new THREE.Quaternion).setFromEuler(e),s=new THREE.Vector3(0,0,-1);s.applyQuaternion(i),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),t&&this._targetPosition.copy(t);const a=this._targetPosition.clone().sub(s.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(a);else{const t=this._getCameraSphere(a);null!=this._boundingBox&&this._boundingBox.intersectsSphere(t)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(t)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(a),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(t,e){let i=t+""+e;0!==this._currentZoomHash.length&&this._currentZoomHash===i||(this.dispatchEvent(5,new M(t,e)),this._currentZoomHash=i),this._maxZoomedIn=e,this._maxZoomedOut=t}zoomTo(t,e,i,s,a,n){return this._tweenCameraParameter(this._getCurrentCameraParameters(),{yaw:s,pitch:a,distance:2.725*l(t.x,t.y,t.z,this._camera.fov,e,i),targetX:n.x,targetY:n.y,targetZ:n.z,blockOtherTweens:!0},!0)}_getCameraSphere(t){const e=Math.max(this._bounds.x,this._bounds.y),i=Math.max(e/10,this._zoomDistance);return new THREE.Sphere(t,i)}zoomIn(t){this._lerpEnabled=!0,this._scale*=t?Math.pow(.95,t):this._zoomSpeed,this._update(),this.dispatchEvent(3)}zoomOut(t){this._lerpEnabled=!0,this._scale/=t?Math.pow(.95,t):this._zoomSpeed,this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new THREE.Vector3(0,0,0))}async moveCamera(t){return this._tweenCameraParameter(this._getCurrentCameraParameters(),t,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}});let R={},C={};t("S",(()=>{class t{constructor(t){this._creator_=t}fetch(t,e){return this._singlePromiseFactory.create(5,t,(i,a)=>{!function(t,e,i,a){if(-1===t.indexOf("http")&&(t=v()+t),R[t])return i();if(e.id&&C[e.id])return a(new Error('There is already a script with ID "'+e.id+'"'));const n=s.start("load_"+e.id.replace(/-/g,"_")),o=document.createElement("script");o.async=!1,o.src=t,o.id=e.id,o.onload=()=>{R[t]=!0,C[e.id]=!0,s.end(n),Object.defineProperty(i,"name",{value:"resolve-"+e.id}),i()},o.onerror=t=>{a(t)},document.body.appendChild(o)}(t,e,i,a)})}loadScripts(t){const e=[];return t.forEach(t=>{let i=this.fetch(t.name,{id:t.id});e.push(i)}),Promise.all(e)}cleanUp(){for(let t in C)if(C.hasOwnProperty(t)){const e=document.getElementById(t);e&&e.parentElement.removeChild(e)}R={},C={}}}return n([o],t.prototype,"_singlePromiseFactory",void 0),t})());const A={MOUSE_MOVE:"mousemove",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_LEAVE:"mouseleave",MOUSE_ENTER:"mouseenter",MOUSE_WHEEL:"wheel",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend",CONTEXT_MENU:"contextmenu"};class k{constructor(t,e,i,s,a){this.position=t,this.positionRelative=e,this.type=i,this.rotation=s,this.event=a}}const D=t("i",5*window.devicePixelRatio),H=3*window.devicePixelRatio;t("I",(()=>{class t extends x{constructor(t){super(),this._debug=!1,this._elementHit=!1,this._delta=-1,this._state=0,this._pinchDistance=-1,this._rotationAngle=-1,this._lastMouseWheelEvent=null,this._lastTouchEvent=null,this._events=Object.keys(A).map(t=>A[t]),this._creator_=t,this._downPosition={x:0,y:0},this._downPositionRelative={x:0,y:0},this._boundingClientRect=this._domHelper.element.getBoundingClientRect()}enableDragIn(t){this._setState(1),this._dragEnabled=!0,t&&(this._dragMV=this._dragM.bind(this),this._dragEV=this._dragE.bind(this),this._dragTarget=t.currentTarget||t.target,this._delta=-1,this._dragMVName="drag",this._dragEVName="dragend",window.TouchEvent&&t instanceof TouchEvent?(this._dragMVName="touchmove",this._dragEVName="touchend"):t.dataTransfer&&t.dataTransfer.setData&&t.dataTransfer.setData("text/plain"," "),this._firefoxDragPosition={x:0,y:0},document.ondragover=t=>{t=t||window.event,this._firefoxDragPosition.x=t.pageX,this._firefoxDragPosition.y=t.pageY},this._dragTarget.addEventListener(this._dragMVName,this._dragMV,!1),this._dragTarget.addEventListener(this._dragEVName,this._dragEV,!1))}_dragM(t){let e=t,i=null,s=null;window.TouchEvent&&t instanceof TouchEvent?(i=this._getTouchPosition(e),s=this._getTouchPositionRelative(e)):(i=this._getMousePosition(e),s=this._getMousePositionRelative(e)),i.x>0&&i.y>0&&this._move(i,s)}_dragE(t){let e=t;document.ondragover=null,this._firefoxDragPosition=null,this._dragTarget.removeEventListener(this._dragMVName,this._dragMV),this._dragTarget.removeEventListener(this._dragEVName,this._dragEV),window.TouchEvent&&t instanceof TouchEvent?this._onUp(this._getTouchPosition(e),this._getTouchPositionRelative(e),2):this._onUp(this._getMousePosition(e),this._getMousePositionRelative(e),1)}addEvents(t){this._events.forEach(e=>t.addEventListener(e,this,!1))}removeEvents(t){this._events.forEach(e=>t.removeEventListener(e,this,!1))}_move2(t){if(this._lastTouchEvent&&t.timeStamp-this._lastTouchEvent.timeStamp<16)return;const e=t.touches[0],i=t.touches[1],s=e.pageX-i.pageX,a=e.pageY-i.pageY,n=Math.abs(s)+Math.abs(a);this._pinchDistance>-1&&(n>this._pinchDistance+H?(this._setState(3),this.dispatchEvent(7,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t)))):n<this._pinchDistance-H?(this._setState(3),this.dispatchEvent(8,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t)))):n<=this._pinchDistance+H&&n>=this._pinchDistance-H&&(this._setState(5),this.dispatchEvent(11,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t))))),this._pinchDistance=n,this._lastTouchEvent=t}_setState(t){this._state=t}_move(t,e,i){void 0===i&&(i=0),void 0===this._dragEnabled&&(this._dragEnabled=!1),1===this._state&&this._canDrag(i)&&(this._delta=this._getDelta(t),this._delta>D&&(this._setState(2),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(0,new k(t,e)))),2===this._state&&this.dispatchEvent(1,new k(t,e)),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(6,new k(t,e,i))}_longClick(){this._setState(2),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(0,new k(this._downPosition,this._downPositionRelative)),this.dispatchEvent(1,new k(this._downPosition,this._downPositionRelative))}_onUp(t,e,i){this.dispatchEvent(4,new k(t,e,i)),this._getDelta(t)<=D&&this.dispatchEvent(5,new k(t,e)),2===this._state&&this.dispatchEvent(2,new k(t,e)),4===this._state&&(this.dispatchEvent(10,new k(t,e)),this._rotationAngle=-1),3===this._state&&(this._pinchDistance=-1),this._lastTouchEvent=null,this._setState(0),this._dragTarget=null,this._elementHit=!1,this._longClickTimer&&clearTimeout(this._longClickTimer)}_getTouchPosition(t){if(t.touches.length){let{clientX:e,clientY:i}=t.touches[0];if(t.touches.length>1){const s=t.touches[1],a=s.clientX,n=s.clientY;e=(e+a)/2,i=(i+n)/2}return{x:e,y:i}}const e=t.changedTouches[0];return{x:e.clientX,y:e.clientY}}_getTouchPositionRelative(t){const e=this._boundingClientRect,{clientWidth:i,clientHeight:s}=this._domHelper.element;if(t.touches.length){const{clientX:a,clientY:n}=t.touches[0];return{x:(a-e.left)/i*2-1,y:-(n-e.top)/s*2+1}}const a=t.changedTouches[0];return{x:(a.clientX-e.left)/i*2-1,y:-(a.clientY-e.top)/s*2+1}}_getMousePosition(t){if(0!==t.clientX&&0!==t.clientY)return{x:t.clientX,y:t.clientY};{let{x:e,y:i}=this._getFireFoxMousePosition(t);return{x:e,y:i}}}_getFireFoxMousePosition(t){let{x:e,y:i}=this._domHelper.getClientDimensions();return{x:e-(e+t.offsetX),y:i-(i+t.offsetY)}}_getMousePositionRelative(t){const e=this._boundingClientRect;return 0!==t.clientX&&0!==t.clientY?{x:(t.clientX-e.left)/this._domHelper.element.clientWidth*2-1,y:-(t.clientY-e.top)/this._domHelper.element.clientHeight*2+1}:this._firefoxDragPosition&&0!==this._firefoxDragPosition.x&&0!==this._firefoxDragPosition.y?{x:(this._firefoxDragPosition.x-e.left)/this._domHelper.element.clientWidth*2-1,y:-(this._firefoxDragPosition.y-e.top)/this._domHelper.element.clientHeight*2+1}:(console.trace("this should not happen"),{x:0,y:0})}_getDelta(t){return Math.abs(this._downPosition.y-t.y)+Math.abs(this._downPosition.x-t.x)}setDragEnabled(t){this._dragEnabled=t}handleEvent(t){switch(this._debug&&t.type,t.type){case A.MOUSE_MOVE:this._onMouseMove(t);break;case A.MOUSE_DOWN:this._onMouseDown(t);break;case A.MOUSE_UP:this._onMouseUp(t);break;case A.MOUSE_LEAVE:this._onMouseLeave(t);break;case A.MOUSE_ENTER:this._onMouseEnter(t);break;case A.MOUSE_WHEEL:this._onMouseWheel(t);break;case A.TOUCH_MOVE:this._onTouchMove(t);break;case A.TOUCH_START:this._onTouchStart(t);break;case A.TOUCH_END:this._onTouchEnd(t);break;case A.CONTEXT_MENU:this._onContextMenu(t)}}_onMouseDown(t){t.preventDefault();let{x:e,y:i}=this._getMousePosition(t);this._downPosition={x:e,y:i},this._downPositionRelative=this._getMousePositionRelative(t),this.dispatchEvent(3,new k({x:e,y:i},this._downPositionRelative,1)),this._setState(1)}_onMouseUp(t){t.preventDefault(),this._onUp(this._getMousePosition(t),this._getMousePositionRelative(t),1)}_onMouseMove(t){t.preventDefault(),this._move(this._getMousePosition(t),this._getMousePositionRelative(t),1)}_onMouseLeave(t){this._delta=-1,this._onMouseUp(t)}_onMouseEnter(t){t.preventDefault()}_onMouseWheel(t){if(this._lastMouseWheelEvent&&t.timeStamp-this._lastMouseWheelEvent.timeStamp<40)return t.preventDefault(),void t.stopPropagation();t.deltaY<0?this.dispatchEvent(7,new k(this._getMousePosition(t),this._getMousePositionRelative(t),1,0,t)):this.dispatchEvent(8,new k(this._getMousePosition(t),this._getMousePositionRelative(t),1,0,t)),this._lastMouseWheelEvent=t}_onTouchMove(t){if(t.preventDefault(),!this._dragTarget)if(1===t.touches.length)this._move(this._getTouchPosition(t),this._getTouchPositionRelative(t),2);else if(2===t.touches.length)if(this._elementHit||4===this._state){const e=t.touches[0],i=t.touches[1];let s={x:e.pageX,y:e.pageY},a={x:i.pageX,y:i.pageY};const n=d(c(s,a));this._rotationAngle<0&&(this._rotationAngle=n);const o=n-this._rotationAngle;this._rotationAngle=n,this.dispatchEvent(9,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t),2,h(o))),this._setState(4)}else this._move2(t)}_onTouchStart(t){if(t.preventDefault(),1===t.touches.length){let{x:e,y:i}=this._getTouchPosition(t);this._downPosition={x:e,y:i},this._downPositionRelative=this._getTouchPositionRelative(t),this.dispatchEvent(3,new k({x:e,y:i},this._downPositionRelative,2)),this._setState(1),this._longClickTimer=window.setTimeout(this._longClick.bind(this),350)}else 2===t.touches.length&&(1!==this._state&&2!==this._state||this._onUp(this._getTouchPosition(t),this._getTouchPositionRelative(t),2),this._setState(3))}_onTouchEnd(t){t.preventDefault(),t.touches.length>1&&5===this._state||3===this._state||this._onUp(this._getTouchPosition(t),this._getTouchPositionRelative(t),2)}_onContextMenu(t){t.preventDefault()}_canDrag(t){return this._dragEnabled}onElementHit(){this._elementHit=!0}updateSize(){this._boundingClientRect=this._domHelper.element.getBoundingClientRect()}}return n([o],t.prototype,"_domHelper",void 0),t})());var L=t("P","static/PhotoStudioRoom-5b94763849f82256.glb");class O{constructor(t,e){this._scene=t,e&&e.removeFromScene()}needsBounds(){return!1}updateBounds(t){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new THREE.Object3D),this._cameraContainer}}t("L",O),t("D",(()=>{class t extends O{constructor(t,e){super(t,e),this._lights=[]}needsBounds(){return!0}updateBounds(t){if(this._cameraLight){const e=this._cameraLight,i=new THREE.Vector3;t.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,e.shadow.camera.top=s/2,e.shadow.camera.bottom=-s/2,e.shadow.camera.left=-s/2,e.shadow.camera.right=s/2,e.shadow.camera.updateProjectionMatrix()}}loadFromJSON(t){return new Promise(e=>{this._lights=this._dynamicLightSettingLoader.parse(t),this.addToScene(),e()})}loadFromObject(t){return new Promise(e=>{t.lights||e(),this._lights=this._dynamicLightSettingLoader.load(t),this._lights.forEach((t,e)=>{t.userData.movesWithCamera&&(this._cameraLight=t,this._lights.splice(e,1))}),this.addToScene(),e()})}loadFromURL(t){return new Promise((e,i)=>{fetch(new Request(t,{method:"GET"})).then(b).then(t=>this.loadFromObject(t).then(e,i))})}addToScene(){this._lights.forEach(t=>{this._scene.add(t)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(t,e){if(!this._cameraLight)return;let i=new THREE.Vector3;t.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=e.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(t=>{this._scene.remove(t)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let t=u();this._cameraLight&&this._addToGUI(t,this._cameraLight),this._lights.forEach(e=>{this._addToGUI(t,e)})}_addToGUI(t,e){t&&(e instanceof THREE.SpotLight&&this._addSpotLightToGUI(t,e),e instanceof THREE.AmbientLight&&this._addAmbientLightToGUI(t,e),e instanceof THREE.DirectionalLight&&this._addDirectionalLightToGUI(t,e),e instanceof THREE.RectAreaLight&&this._addRectAreaLightToGUI(t,e))}_addRectAreaLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),intensity:e.intensity*(e.width*e.height)};i.add(e,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(t=>{e.intensity=t/(e.width*e.height)}),i.add(e,"castShadow"),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}_addSpotLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),angle:180*e.angle/Math.PI};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.add(e,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(s,"angle").min(10).max(180).step(1).onChange(t=>{e.angle=t*Math.PI/180}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}_addAmbientLightToGUI(t,e){let i={name:e.name,color:"#"+e.color.getHexString()},s=t.addFolder(e.name);s.add(e,"visible"),s.add(e,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(t=>{e.color=new THREE.Color(t)})}_addDirectionalLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString()};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(e,"castShadow"),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}}return n([o],t.prototype,"_dynamicLightSettingLoader",void 0),t})());class B{constructor(t,e){this._scene=t,e&&(e.removeFromScene(),e.cleanUp())}updateCamera(t){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(t,e){this._bounds=t}cleanUp(){this._scene=null}}let Q=t("G",(()=>{class t extends B{constructor(t,e){super(t,e),this._gltfLoaderPromise=this._scriptLoader.fetch(g,{id:"gltf-loader-js"}).then(()=>{this._gltfLoader=new THREE.GLTFLoader})}needsBounds(){return!0}needsCamera(){return!0}updateBounds(t){if(super.updateBounds(t),this._backgroundMesh){let e=Math.max(t.x,t.z)/6;e=Math.max(e,1),this._backgroundMesh.scale.copy(new THREE.Vector3(e,e,e))}}updateCamera(t){if(this._backgroundMesh){let e=t.getWorldDirection(new THREE.Vector3);e.y=0,e.lengthSq()<.01&&(e=new THREE.Vector3(0,1,0),e.applyQuaternion(t.quaternion),e.y=0),e.multiplyScalar(-1),e.normalize();let i=Math.asin(e.x);e.z<0&&(i=Math.PI-i),this._backgroundMesh.rotation.set(0,i,0)}}addToScene(){this._scene&&this._backgroundMesh&&this._scene.add(this._backgroundMesh)}removeFromScene(){this._scene&&this._backgroundMesh&&this._scene.remove(this._backgroundMesh)}loadBackground(t,e){this._backgroundMaterial=e,this._backgroundMaterial||(this._backgroundMaterial=new THREE.MeshBasicMaterial),this._gltfLoaderPromise.then(()=>{this._gltfLoader.load(t,this._onBackgroundLoaded.bind(this),t=>{},t=>{console.error(t)})})}_onBackgroundLoaded(t){this._scene&&(this._backgroundMaterial.vertexColors=!0,t&&t.scene&&t.scene.children&&t.scene.children.length>0&&(t.scene.children[0].material=this._backgroundMaterial,t.scene.children[0].layers.set(2),t.scene.position.copy(new THREE.Vector3(0,0,0)),this._backgroundMesh=t.scene,this._backgroundMesh.layers.set(2),this._backgroundMesh.receiveShadow=!0,m(this._backgroundMesh,!0,!1),this.removeFromScene(),this.addToScene()))}showGUI(){console.warn("gui not implemented for gltf environment")}}return n([o],t.prototype,"_scriptLoader",void 0),t})());const I={enable:!0,shadowMapResolution:512,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.5,darkness:.2,size:1.6,lightSolidAngle:40,yPosition:0};class z extends B{constructor(t,e){super(t,e),this._pixotronGuard=new p,this._params=Object.assign(I,{lightDirection:new THREE.Vector3(0,1,.5),onComplete:this._addGroundShadows.bind(this),onProgress:this._progressCallback.bind(this)})}_progressCallback(t){}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}setPixotron(t,e,i,s){t&&(this._pixotron=t,this._renderer=e,this._camera=i,this._shadowBaker||(this._shadowBaker=new window.PIXOTRON.PlaneShadowBakePass(Object.assign(this._params,s))),this._shadowBaker.enable?this._shadowBaker.startBake(this._renderer,this._scene,this._camera):this._shadowBaker.enable=!0,this._wasAAEnabled=this._pixotron.enableAA,this._pixotronGuard.resolve())}async _addGroundShadows(){await this._pixotronGuard.wait(),this._pixotron.needsUpdate=!0,this._shadowPlane=this._shadowBaker.getShadowPlane(),this._shadowPlane.name="Shadow plane",this._shadowPlane.receiveShadow=!1,0!==this._params.yPosition&&(this._shadowPlane.position.y=this._params.yPosition),this._shadowPlane.visible=!0,this.addToScene(),this._loadedCallback&&this._loadedCallback()}setLoadedCallback(t){this._loadedCallback=t}update(){const t=this._getNumberOfChildren();this._bake(),this._sceneChildren=t}updateBounds(t,e){const i=this._getNumberOfChildren();return!(w(this._bounds,t,1e-4)&&this._scene&&i===this._sceneChildren&&!e||(super.updateBounds(t),this._bake(),this._sceneChildren=i,0))}_bake(){this._pixotronGuard.wait().then(()=>{this._shadowPlane&&(this._shadowPlane.visible=!1),this._shadowBaker.startBake(this._renderer,this._scene,this._camera)})}_getNumberOfChildren(){let t=0;return this._scene.traverse(e=>{"Shadow plane"!==e.name&&t++}),t}addToScene(){this._scene&&this._shadowPlane&&(this._shadowPlane.material.needsUpdate=!0,E(this._shadowPlane),this._scene.add(this._shadowPlane))}removeFromScene(){this._shadowPlane&&(this._scene.remove(this._shadowPlane),this._pixotron&&(this._pixotron.enableAA=this._wasAAEnabled))}showGUI(){}}t("B",z);class U{constructor(t){this._innerSize=1,this._outerSize=100,this._plane=new THREE.Object3D,this._plane.rotation.x=-Math.PI/2;const e=new THREE.MeshStandardMaterial;this._innerPlaneMesh=new THREE.Mesh,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=e,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new THREE.Mesh,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=e,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=t,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(t){this._innerSize=t,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(t,e){const i=new THREE.Shape;i.moveTo(-t/2,-t/2),i.lineTo(-t/2,t/2),i.lineTo(t/2,t/2),i.lineTo(t/2,-t/2),i.lineTo(-t/2,-t/2);const s=new THREE.Shape;s.moveTo(-e/2,-e/2),s.lineTo(-e/2,e/2),s.lineTo(e/2,e/2),s.lineTo(e/2,-e/2),s.lineTo(-e/2,-e/2);const a=new THREE.Path;a.moveTo(-t/2,-t/2),a.lineTo(-t/2,t/2),a.lineTo(t/2,t/2),a.lineTo(t/2,-t/2),a.lineTo(-t/2,-t/2),s.holes.push(a);const n=new THREE.ShapeBufferGeometry(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=n;const o=new THREE.ShapeBufferGeometry(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const h=n.attributes.uv.clone();n.setAttribute("uv2",h);const r=n.attributes.uv2.array;for(let t=0;t<r.length;++t)r[t]+=.5}}let V=t("F",(()=>{class t extends z{constructor(t,e,i){super(t,e),this._longestSide=2,this._bakedShadowPlane=new U(100),this._fog=i||!1,this._textureLoader=new THREE.TextureLoader,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(t){return super.updateBounds(t),this._longestSide=Math.max(t.x,t.z),this._update(),!0}updateCamera(t){this._cameraDistance=t.position.distanceTo(new THREE.Vector3(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let t=this._longestSide/2;this._scene.fog=new THREE.Fog(16185078,this._cameraDistance+t+3,this._cameraDistance+t+3+1),this._scene.background=new THREE.Color(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let t=this._width/1e3,e=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=THREE.RepeatWrapping,this._floorTexture.wrapT=THREE.RepeatWrapping,this._floorTexture.repeat.set(100/t,100/e));let i=new THREE.MeshStandardMaterial({map:this._floorTexture,side:THREE.DoubleSide});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&(this._shadowPlane&&(this._bakedShadowPlane.updateSize(this._shadowPlane.scale.x),this._bakedShadowPlane.getRootNode().position.copy(this._shadowPlane.position),this._bakedShadowPlane.getInnerPlane().material.aoMap=this._shadowPlane.material.aoMap),this._scene.add(this._bakedShadowPlane.getRootNode()))}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(t,e,i,s){return this._width=e,this._height=i,this._repeatable=s,this._floorPromise=new Promise((e,i)=>{this._textureLoader.load(t,t=>{this._floorTexture=t,e()},null,i)}),new Promise((t,e)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),t()},e)})}changeFloorMaterial(t,e){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=y(t,this._environmentLoader),this._rapiAccess.getTexturesOf(t).then(t=>{if(t.length>0){let a=[];t.forEach(t=>{a.push(P(this._dataSyncer.requestAsset(t.image,!0),t,this._floorMaterial,e,1,1))}),Promise.all(a).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((t,e)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),t()},e)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let t=u();if(!t)return;let e=t.addFolder("Floor");e.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),e.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),e.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}return n([o],t.prototype,"_rapiAccess",void 0),n([o],t.prototype,"_dataSyncer",void 0),n([o],t.prototype,"_environmentLoader",void 0),t})());class N extends z{constructor(t,e,i,s,a){if(super(t,e),this._color=i,this._oldBackground=t.background,s&&a){this._canvas=s,this._style=document.createElement("style");let t='background-image: url("'+a+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+t+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){super.addToScene(),this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"),this._pixotron&&(this._pixotron.enableAA=!1))}removeFromScene(){super.removeFromScene(),this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}}t("a",N),t("c",(()=>{class t{parse(t,e,i,s){let a=JSON.parse(s);return a.environment?this.load(t,e,i,a):null}load(t,e,i,s){let a,n=s.environment;if(!n)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(n.type){case"color":a=new Promise(e=>e(new N(t,i,new THREE.Color(n.details.color))));break;case"image":a=new Promise(s=>s(new N(t,i,null,e,n.details.imageUrl)));break;case"gltf":a=new Promise(e=>{let s=new Q(t,i);s.loadBackground(v()+L),e(s)});break;case"floor":a=new Promise(e=>{this._rapiAccess.getMaterial(n.details.material).then(s=>{let a=void 0===n.details.fog||n.details.fog,o=new V(t,i,a);o.changeFloorMaterial(s).then(()=>{e(o)})})});break;case"baked_shadow":a=new Promise(s=>{n.details&&n.details.color?s(new N(t,i,new THREE.Color(n.details.color))):n.details&&n.details.imageUrl?s(new N(t,i,null,e,n.details.imageUrl)):s(new z(t,i))});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(t=>t(i))}return a}}return n([o],t.prototype,"_rapiAccess",void 0),t})());class F{constructor(){this._settings=new window.PIXOTRON.QualitySettings(5),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!0,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class G{constructor(){this._settings=new window.PIXOTRON.QualitySettings(4),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!0,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class X{constructor(){this._settings=new window.PIXOTRON.QualitySettings(3),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class W{constructor(){this._settings=new window.PIXOTRON.QualitySettings(2),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class j{constructor(){this._settings=new window.PIXOTRON.QualitySettings(1),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class Y{constructor(){this._settings=new window.PIXOTRON.QualitySettings(0),this._settings.enableAA=!1,this._settings.useAreaLight=!1,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}t("b",class{constructor(t){this._sceneBoundingSphere=new THREE.Sphere,this._pixotron=t,this._initializeQualitySettings(),this._initializeQualityAdapters()}getPixotronInstance(t){const e={saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,bias:.02,accumulative:!1},shadowparams:{shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:100,side:THREE.FrontSide}};return t=t||e,new window.PIXOTRON.Pixotron(t)}showGUI(){let t=u();if(!t)return;let e=t.addFolder("Renderer");e.add(this._pixotron.getSAOPass(),"enabled"),this._pixotron.getSAOPass().smoothTransition&&e.add(this._pixotron.getSAOPass(),"smoothTransition"),e.add(this._pixotron.getSAOPass(),"occlusionWorldRadius").min(0).max(1).step(1e-4).onChange(t=>{this._adjustSaoRadius(t)}),e.add(this._pixotron.getSAOPass(),"intensity").min(.1).max(2).step(.05),e.add(this._pixotron.getSAOPass(),"bias").min(0).max(1).step(1e-4).onChange(t=>{this._adjustSaoBias(t)}),this._pixotron.getSAOPass().numSamples&&e.add(this._pixotron.getSAOPass(),"numSamples").min(10).max(3e3).step(10),void 0!==this._pixotron.getShadowPass().enabled&&e.add(this._pixotron.getShadowPass(),"enabled"),e.add(this._pixotron.getShadowPass(),"smoothTransition"),e.add(this._pixotron.getShadowPass(),"enableAccumulation"),e.add(this._pixotron.getShadowPass(),"shadowRadius").min(0).max(5).step(.1),e.add(this._pixotron.getShadowPass(),"shadowBiasMultiplier").min(0).max(3).step(.01),e.add(this._pixotron.getShadowPass(),"numSamples").min(10).max(3e3).step(10)}updateBounds(t){this._sceneBoundingSphere.copy(t);const e=.25*this._getMaxSaoRadius();this._adjustSaoRadius(e);const i=2*this._getMinSaoBias();this._adjustSaoBias(i)}_getSaoRadius(){return this._sceneBoundingSphere.radius}_adjustSaoRadius(t){const e=this._pixotron.getSAOPass(),i=this._getMinSaoRadius(),s=this._getMaxSaoRadius();e.occlusionWorldRadius=Math.min(Math.max(t,i),s)}_adjustSaoBias(t){const e=this._pixotron.getSAOPass(),i=this._getMinSaoBias(),s=this._getMaxSaoBias();e.bias=Math.min(Math.max(t,i),s)}_getMinSaoRadius(){return.001*this._getSaoRadius()}_getMaxSaoRadius(){return.6*this._getSaoRadius()}_getMinSaoBias(){return.001*this._getSaoRadius()}_getMaxSaoBias(){return.01*this._getSaoRadius()}updatePixelRatio(t){const e=new THREE.Vector2;t.getDrawingBufferSize(e),this._pixotron.setSize(Math.floor(e.width),Math.floor(e.height))}getHighPixelRatioQualitySetting(){return this._highPixelRatioQualitySetting.getSettings()}getLowestQualitySetting(){return this._lowQualitySetting.getSettings()}_initializeQualitySettings(){this._highestQualitySetting=new G,this._highPixelRatioQualitySetting=new F,this._highQualitySetting=new X,this._midQualitySetting=new W,this._lowQualitySetting=new j,this._lowestQualitySetting=new Y}_initializeQualityAdapters(){this._autoQualityAdapter=new window.PIXOTRON.AutoQualityAdapter(this._pixotron),this._autoQualityAdapter.addQuality(this._highestQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._highQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._midQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._lowQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._lowestQualitySetting.getSettings()),this._autoQualityAdapter.setDesiredFps(30),this._manualQualityAdapter=new window.PIXOTRON.ManualQualityAdapter(this._pixotron)}onAutoQualityChange(t){this._autoQualityAdapter.onQualityChange(t)}onManualQualityChange(t){this._manualQualityAdapter.onQualityChange(t)}getAutoAdapter(){return this._autoQualityAdapter}lockAdapter(){this._autoQualityAdapter.getCurrentQualitySetting().lock()}unLockAdapter(){this._autoQualityAdapter.getCurrentQualitySetting().unLock()}enablePixotronAutoQuality(){this._currentQualityAdapter||(this._currentQualityAdapter=this._autoQualityAdapter,this._pixotron.setQualityAdapter(this._autoQualityAdapter))}movingCameraStarts(){this._currentQualityAdapter&&(this._currentQualityAdapter=this._autoQualityAdapter,this._currentQualitySetting&&(this._manualQualityAdapter.setQualitySetting(this._currentQualitySetting),this._pixotron.setQualityAdapter(this._manualQualityAdapter)),this._pixotron.setQualityAdapter(this._autoQualityAdapter))}movingCameraStops(){this._currentQualityAdapter&&(this._currentQualitySetting=this._currentQualityAdapter.getCurrentQualitySetting(),this._currentQualityAdapter=this._manualQualityAdapter,this._pixotron.setQualityAdapter(this._manualQualityAdapter),this._manualQualityAdapter.setQualitySetting(this._highestQualitySetting.getSettings()))}}),t("g","static/pi.min-6875d25247d9711b.js"),t("e",["static/CopyShader-cde53240fcc3e06e.js","static/EffectComposer-1e936e5d03ff43cc.js","static/RenderPass-bc5df3810a01b2c6.js","static/ShaderPass-31f36160e0ea282d.js","static/LuminosityHighPassShader-dd5826656142421d.js","static/OutlinePass-f4bcd337cdd89b8d.js","static/RectAreaLightUniformsLib-4b74882185efd473.js","static/GammaCorrectionShader-b3b56f244f0d1e0e.js"])}}}));
2
- //# sourceMappingURL=pixotron-769d1fe5.legacy.js.map
@@ -1,2 +0,0 @@
1
- System.register(["./query-params-helper-8c00a872.legacy.js","./rapi-access-1db44eda.legacy.js","./main-thread-to-worker-45106055.legacy.js","./image-renderer-c831cb02.legacy.js","./pixotron-769d1fe5.legacy.js","./mesh-generator-ddb18de3.legacy.js","./default-light-setting-92bb70ce.legacy.js","./scene-manager-2bb96268.legacy.js"],(function(e,t){var n,a,i,s,r,o,l,c,h,d,_,p,g,m,u,C,E,b,f,w,M,S,P,v,y,I,k,R,H,L,j,O,T,x,V,D,B,A,G,K,F,U,z,q,W,X,N,Q,Y,J,Z,$,ee,te,ne,ae,ie,se,re,oe,le;return{setters:[function(){},function(e){n=e.h,a=e._,i=e.i,s=e.W,r=e.X,o=e.H,l=e.Y,c=e.e,h=e.Z,d=e.N,_=e.$,p=e.O,g=e.a0,m=e.a1,u=e.a2,C=e.d,E=e.z,b=e.a3,f=e.j,w=e.B,M=e.a4,S=e.q,P=e.G,v=e.a5,y=e.c,I=e.a6,k=e.r,R=e.C,H=e.E,L=e.M,j=e.V,O=e.U,T=e.m,x=e.L,V=e.n},function(e){D=e.s,B=e.j,A=e.k,G=e.l},function(e){K=e.S,F=e.G,U=e.a,z=e.p,q=e.g},function(e){W=e.L,X=e.B,N=e.a,Q=e.C,Y=e.h,J=e.T,Z=e.e,$=e.g,ee=e.I,te=e.E,ne=e.S,ae=e.M},function(e){ie=e.M},function(e){se=e.D},function(e){re=e.S,oe=e.C,le=e.a}],execute:function(){class ce extends W{constructor(e,t){super(e,t),this._center=new THREE.Vector3(0,0,0),this._params={ambientLight:{color:"#ffffff"},hemiLight:{color:"#ffffff"},mainDirLight:{direction:{x:.03,y:1,z:.03},color:"#ffffff"}},this._ambientLight=new THREE.AmbientLight(new THREE.Color(this._params.ambientLight.color),.3),this._ambientLight.layers.set(1),this._mainDirLight=new THREE.DirectionalLight(new THREE.Color(this._params.mainDirLight.color),.5),this._mainDirLight.castShadow=!0,this._mainDirLight.shadow.camera.near=.5,this._mainDirLight.shadow.camera.far=100,this._mainDirLight.shadow.mapSize=new THREE.Vector2(1024,1024),this._mainDirLight.visible=!0,this.addToScene()}updateSunPosition(e,t){}addToScene(){this._scene.add(this._mainDirLight),this._scene.add(this._ambientLight),this._scene.add(this._mainDirLight.target)}removeFromScene(){this._scene.remove(this._mainDirLight),this._scene.remove(this._ambientLight),this._scene.remove(this._mainDirLight.target)}reload(){this.removeFromScene(),this.addToScene()}needsBounds(){return!0}updateBounds(e){this._center.copy(e.getCenter(new THREE.Vector3));const t=new THREE.Sphere;e.getBoundingSphere(t);const n=t.radius,a=new THREE.Vector3(this._params.mainDirLight.direction.x,this._params.mainDirLight.direction.y,this._params.mainDirLight.direction.z);a.normalize(),a.multiplyScalar(n),this._mainDirLight.position.copy(this._center),this._mainDirLight.position.add(a),this._mainDirLight.target.position.copy(this._center),this._mainDirLight.target.updateMatrixWorld(!0),this._mainDirLight.shadow.camera.top=n,this._mainDirLight.shadow.camera.bottom=-n,this._mainDirLight.shadow.camera.left=-n,this._mainDirLight.shadow.camera.right=n,this._mainDirLight.shadow.camera.near=.01,this._mainDirLight.shadow.camera.far=2*n,this._mainDirLight.shadow.camera.updateProjectionMatrix()}showGUI(){let e=n();if(e){if(this._ambientLight){let t=e.addFolder("Ambient Light");t.add(this._ambientLight,"visible"),t.add(this._ambientLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.ambientLight,"color").onChange(e=>this._ambientLight.color=new THREE.Color(e))}if(this._hemiLight){let t=e.addFolder("Hemi Light");t.add(this._hemiLight,"visible"),t.add(this._hemiLight,"intensity").min(0).max(5).step(.1),t.addColor(this._params.hemiLight,"color").onChange(e=>this._hemiLight.color=new THREE.Color(e))}if(this._mainDirLight){let t=e.addFolder("Main Directional Light");t.add(this._mainDirLight,"visible"),t.add(this._mainDirLight,"intensity").min(0).max(10).step(.1),t.add(this._mainDirLight,"castShadow"),t.addColor(this._params.mainDirLight,"color").onChange(e=>this._mainDirLight.color=new THREE.Color(e)),t.add(this._mainDirLight.position,"x").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"y").min(-10).max(50).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center)),t.add(this._mainDirLight.position,"z").min(-10).max(10).step(.1).onChange(()=>this._mainDirLight.lookAt(this._center))}}}}class he{constructor(e){const{planElementViewModel:t,resetCamera:n,state:a,oldState:i}=e;this.planElementViewModel=t,this.resetCamera=void 0===n||n,this.state=void 0===a?0:a,this.oldState=void 0===i?0:i}}let de=(()=>{class e extends K{constructor(e,t,n,a){super(e,t,n,a),this._state=0,this._inputManager.addEventListener(4,()=>this._position=null,this),this._raycastHelper.setMode(0);const i=new THREE.Layers;i.enable(3),i.enable(6),this._raycastHelper.setLayers(i),this._raycastHelper.addEventListener(3,()=>{this._plannerSelectionHandler.cancelSelection()},this),this._plannerSelectionHandler.addEventListener(0,({planElementViewModel:e})=>{this.dispatchEvent(0,new he({planElementViewModel:e}))},this),this._plannerSelectionHandler.addEventListener(1,({planElementViewModel:e})=>{this.setState(0),this.dispatchEvent(1,new he({planElementViewModel:e}))},this),this._inputManager.addEventListener(6,e=>this._move(e),this)}getSelectionMode(){return this._plannerSelectionHandler.getSelectionMode()}async addPlanObjectHandlers(e,t){t||(t=await e.getObjectAsync());const n={hasListener:!0,priority:1,roomleId:e.getId()};this._addPlanObjectHandlers(e,t,n)}addWallHandlers(e){this._addPlanElementHandlers(e,e.getBoundingBox(),{hasListener:!0,priority:1,roomleId:e.getId()})}_addPlanObjectHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)),t.addEventListener("rotate",t=>this._rotate(e,t.attachment.rotation)))}_addPlanElementHandlers(e,t,n){t.userData.hasListener||(t.userData=n,t.addEventListener("select",()=>this._clickElement(e)),t.addEventListener("drag_start",()=>this._dragStart(e)),t.addEventListener("drag",t=>this._drag(e,t.attachment.position)),t.addEventListener("drag_end",t=>this._dragEnd(e,t.attachment.position)),t.addEventListener("hover_on",()=>this._hoverOn(e)),t.addEventListener("hover_off",()=>this._hoverOff(e)))}_clickElement(e){this._debug&&e.getId(),this._plannerSelectionHandler.check(e),this._setCursor()}_hoverOn(e){this._hoveredObject=e,this._setCursor()}_hoverOff(e){this._hoveredObject=null,this._setCursor()}_setCursor(){2===this._state&&this._hasSelection()?D("ew-resize"):1===this._state?D("grabbing"):this._hoveredObject&&this._plannerSelectionHandler.isSelected(this._hoveredObject.getId())?D("move"):this._hoveredObject?D("pointer"):D("default")}setCamera(e){this._raycastHelper.setCamera(e)}setScene(e){this._raycastHelper.setScene(e)}getSelectedIds(){return this._plannerSelectionHandler.getSelectedIds()}setSelectionMode(e){this._plannerSelectionHandler.setSelectionMode(e)}setPlanViewModel(e){this._planViewModel=e}cancelSelection(){this._plannerSelectionHandler.cancelSelection()}_dragStart(e){this._plannerSelectionHandler.isSelected(e.getId())&&0===this._state&&(this._draggedObject=e,this.setState(1),this.dispatchEvent(4,new he({planElementViewModel:e})),this._setCursor())}_drag(e,t){if(!this._draggedObject||1!==this._state)return;const n=this._plannerKernelAccess.planInteractionHandler;if(this._plannerSelectionHandler.getSelectedIds().length>1){const e=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList;let a=t.sub(this._draggedObject.getPosition());this._plannerSelectionHandler.getSelectedIds().forEach(t=>e.push_back(this._planViewModel.getPlanObjectForId(t).getPlanObject())),n.moveObjectsBy(e,s(a))}else n.moveElementTo(e.getPlanElement(),s(t));this.dispatchEvent(5,new he({planElementViewModel:e}))}_dragEnd(e,t){this._draggedObject&&(this._draggedObject=null,this.setState(0),this.dispatchEvent(6,new he({planElementViewModel:e})),this._dragIn&&(this.cancelSelection(),this.setDragIn(!1)),this._setCursor())}_rotate(e,t){if(this._plannerSelectionHandler.isSelected(e.getId())){const n=this._plannerKernelAccess.planInteractionHandler,a=e.getPlanObject();n.setObjectRotation(e.getPlanElement(),a.rotation-t)}}setState(e){const t=this._state;this._state=e,this._setCursor(),this.dispatchEvent(2,new he({state:this._state,oldState:t})),this._position=null,2===this._state&&this._plannerKernelAccess.planInteractionHandler.deactivateAllSnappingActivity()}resetState(){this.setState(0)}_move(e){if(2===this._state&&this._hasSelection()){this._setCursor();let t=Math.PI/180;const{x:n,y:a}=e.positionRelative;this._position?t=1.4*e.positionRelative.x*Math.PI-1.4*this._position.x*Math.PI:this._position=new THREE.Vector3(e.positionRelative.x,e.positionRelative.y,0);const i=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,r=new THREE.Box3;this.getSelectedIds().forEach(e=>{var t;const n=null===(t=this._planViewModel)||void 0===t?void 0:t.getPlanObjectForId(e);n&&n.getObject()&&(i.push_back(n.getPlanObject()),r.expandByObject(n.getContainer()))});const o=r.getCenter(new THREE.Vector3);this._plannerKernelAccess.planInteractionHandler.rotateObjectsBy(i,t,s(o)),this._position.copy(new THREE.Vector3(n,a,0))}}_hasSelection(){return this._plannerSelectionHandler.getSelectedIds().length>0}selectPlanElement(e){this._plannerSelectionHandler.check(e)}_interaction(e){this.dispatchEvent(0,new he({}))}addComponentDragInHandler(e){if(!this._dragIn)return;const t=e.getBoundingBox();this._addPlanElementHandlers(e,t,{hasListener:!0,priority:1,roomleId:e.getId()}),this._raycastHelper.enableDragIn(t),this._dragStart(e)}}return a([i],e.prototype,"_plannerSelectionHandler",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),e})();class _e{constructor(){this._promiseExecutors=[]}create(){return new Promise((e,t)=>{this._promiseExecutors.push({resolve:e,reject:t})})}resolve(e){return new Promise(t=>{this._promiseExecutors.forEach(t=>t.resolve(e)),this._promiseExecutors=[],t(e)})}reject(e){return new Promise((t,n)=>{this._promiseExecutors.forEach(t=>t.reject(e)),this._promiseExecutors=[],n(e)})}}class pe extends class{constructor(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getKernelObject(){return this._coreReference}}{constructor(e){super(e),this._objectWaiter=new _e;const t=r(e.getCenter());this._container=new THREE.Object3D,this._container.position.copy(t),this._boundingBox=this._generateBoundingBox(this.getSize(),e.customColor),o(this._boundingBox),this._container.add(this._boundingBox),2!==this.getPlanElement().getType().value&&(this._object=new THREE.Object3D,this._container.add(this._object))}getSize(){return this._object?(new THREE.Box3).setFromObject(this._object).getSize(new THREE.Vector3):new THREE.Vector3}update(){this._container.position.copy(r(this.getPlanElement().getCenter()))}getPosition(){return this._container.position}getRotation(){return this._container.rotation.y}getBounds(){let e=new THREE.Box3;return e.setFromObject(this._container),e}getBoundingBox(){return this._boundingBox}getPlanElement(){return this._coreReference}setObject(e){this._object=e,this._objectWaiter.resolve(e)}getObject(){return this._object}async getObjectAsync(){return this._object?Promise.resolve(this._object):this._objectWaiter.create()}addMesh(e){this._object.add(e),this.hidePreviewBox()}getMesh(e){if(!this._object||0===this._object.children.length)return null;const t=l(e,this.getPlanElement().getType());return this._object.children.find(e=>e.userData.material===t)}getContainer(){return this._container}getId(){return this.getPlanElement().getId()}clear(){c(this._container),this._selectionMesh&&c(this._selectionMesh)}hidePreviewBox(){this._container&&this._boundingBox&&(this._boundingBox.material=h())}_generateBoundingBox(e,t){e.addScalar(.01);let n=new THREE.BoxGeometry(e.x,e.y,e.z),a=new THREE.Color(d);t>0&&(a=_(t));let i=new THREE.MeshStandardMaterial({color:a,opacity:p,transparent:!0}),s=new THREE.Mesh(n,i);return s.name="bounding box",s.position.y=e.y/2,s.castShadow=!1,s.receiveShadow=!1,s.layers.set(5),s}select(){if(!this._selectionMesh){let e=new THREE.MeshStandardMaterial({color:this._primaryColor,opacity:p,transparent:!0});const t=r(this.getPlanElement().getCenter());this._selectionMesh=new THREE.Mesh(g(t,this.getSize()),e)}this._container.add(this._selectionMesh)}deselect(){this._selectionMesh&&this._container.remove(this._selectionMesh)}setPrimaryColor(e){this._primaryColor=e}}class ge extends pe{constructor(e){super(e),this._container.rotation.y=e.rotation}getPlanObject(){return this.getPlanElement()}getSize(){return m(this.getPlanObject().size)}update(){super.update(),this._container.rotation.y=this.getPlanObject().rotation}}let me=(()=>{class e extends ge{constructor(e){super(e),this._container.name="Static "+this._container.name}setRapiItem(e){return this._addStaticItem(e)}_addStaticItem(e){this._rapiItem=e;let t=this.getPlanObject();this._glbUrl=B(e);let n=e.scaleable?m(t.size):void 0,a=new THREE.Vector3(1,1,1);return t.flipX&&(a.x*=-1),t.flipY&&(a.z*=-1),new Promise(i=>{this._staticItemLoader.loadGLB(this._glbUrl,void 0,void 0,n,a,t.customColor,e.colorable).then(t=>{t.name=e.label,this.setObject(t),u(t,this._glbUrl),o(t),this._container.add(this.getObject()),this.hidePreviewBox(),i()})})}getRapiItem(){return this._rapiItem}needsRapiItem(){return!this._glbUrl}getGLBUrl(){return this._glbUrl}}return a([i],e.prototype,"_staticItemLoader",void 0),e})();class ue extends ge{constructor(e){super(e),this._container.name="Configurable "+this._container.name}addRootComponent(e){this.setObject(e),this._container.add(this.getObject())}getConfigurationRuntimeId(){return this.getPlanObject().getConfigurationRuntimeId()}}let Ce=(()=>{class e extends re{constructor(e,t,n,a){super(e,t,C.HSP,a),this._staticItemGuard=new E,this._configurableItemGuard=new E,this._roomlePlannerCallback=n,this._plannerMeshGenerator.maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._plannerMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._plannerSceneEventHandler=new de(e,this._scene,this._cameraControl.getCamera(),this._getInputManager()),this._plannerSceneEventHandler.addEventListener(2,({state:e,oldState:t})=>{2===t&&e!==t&&this._roomlePlannerUiCallback.onRotationCancel(),2===e||1===e?this._cameraControl.lock():this._cameraControl.unlock()},this),this._plannerSceneEventHandler.addEventListener(0,({planElementViewModel:e})=>{e instanceof me&&this._initData.debug&&e.getGLBUrl(),this._highlight(e),this._onSelectionChange(e)},this),this._plannerSceneEventHandler.addEventListener(1,()=>{this._highlight(null),this._roomlePlannerUiCallback.onSelectionCancel()},this),this._plannerSceneEventHandler.addEventListener(4,()=>{this._cameraControl.lock(),this._environment instanceof X&&this._environment.removeFromScene(),this._requestRender(),this._dragStartBounds=this.getBounds()},this),this._plannerSceneEventHandler.addEventListener(5,({planElementViewModel:e})=>{this._cameraControl.checkNearFarDistance(e.getPosition()),this._requestRender()},this),this._plannerSceneEventHandler.addEventListener(6,({planElementViewModel:e})=>{this._cameraControl.unlock(),this._environment instanceof X&&this._environment.addToScene();const t=this._getDragPosition(e.getPosition());t&&this._plannerKernelAccess.planInteractionHandler.moveElementTo(e.getPlanElement(),s(t)),this._requestRender(!0),this.updateEnvironment(this.getBounds(),!0),this._zoomToBounds()},this),this._plannerKernelAccess.addPlannerListener(this),this._plannerMeshGenerator.setMaterialLoadedListener(()=>{this._planViewModel.tryToMergeComponents(),this._configurableItemGuard.resolve(),this._requestRender()}),window.onbeforeunload=this.clearScene.bind(this)}_getDragPosition(e){if(!this._plannerSceneEventHandler.isDragIn())return null;const t=this._dragStartBounds?this._dragStartBounds:this.getBounds(),n=t.getCenter(new THREE.Vector3),a=e.distanceTo(n),i=t.getSize(new THREE.Vector3),s=Math.max(i.x,i.z)+3;if(a>s){const t=(new THREE.Vector3).subVectors(e,n).normalize();return n.clone().add(t.multiplyScalar(s))}return null}_onSelectionChange(e){let t;e instanceof me&&(t="static"),e instanceof ue&&(t="configuration");const n={};if(e instanceof me&&(n.item=e.getRapiItem()),e instanceof ue){const t=e.getConfigurationRuntimeId();n.configurationRuntimeId=t}const a=(async()=>{const n={};if(e instanceof me&&(n.item=e.getRapiItem()),e instanceof ue){const a=e.getConfigurationRuntimeId(),i=e.getPlanObject().getCatalogItemId(),s=this._plannerKernelAccess.kernelInstance.getHashOfConfiguration(a);let r;if(i&&S(i)){const e=await this._rapiAccess.getItem(i);n.item=e,r=e.rootComponentId?e.rootComponentId:null}else try{const e=await this._rapiAccess.getConfiguration(s);n.configuration=e,r=e.rootComponentId?e.rootComponentId:null}catch(e){console.warn("Could not get RAPI configuration for kernel hash "+s+", saving configuration...");const t=await this._plannerKernelAccess.getConfigurationData(a),i=await this._rapiAccess.saveConfiguration(t);n.configuration=i,r=i.rootComponentId?i.rootComponentId:null}if(r){const e=await this._rapiAccess.getComponent(r);n.component=e}n.configurationRuntimeId=a,t="configuration"}return A(n)})();this._roomlePlannerUiCallback.onSelectionChange(A(this._plannerSceneEventHandler.getSelectionMode()),A(t),A(n),a)}_setupScene(e,t){super._setupScene(e,t),this._initData.moc?(this._lightSetting=new se(this._scene),this._setEnvironment(new N(this._scene,this._environment,new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)))):(this._lightSetting=new ce(this._scene),this._addSky(),this._setEnvironment(new X(this._scene,this._environment)))}onBeforeRender(){this._cameraControl instanceof Q&&this._plannerMeshGenerator.wallMeshes.forEach(e=>b(this._cameraControl.getCamera(),e.material))}_getInputManager(){return this._plannerInputManager}createCameraControl(e){this.setMode(e)}resetCamera(){this._cameraControl.hasSavedState()?this.resetCameraToState():this.resetCameraPositionToStart()}resetCameraToState(){this._cameraControl.resetToState()}resetCameraPositionToStart(){this._requestRender()}_getYRotationOfObject(e){let t=e.getWorldDirection(new THREE.Vector3).clone();t.y=0,t.lengthSq()<.01&&(t=new THREE.Vector3(0,1,0),t.applyQuaternion(e.quaternion),t.y=0),t.normalize();let n=Math.asin(t.x);return t.z<0&&(n=Math.PI-n),n<0&&(n+=2*Math.PI),n}loadStaticPlanObjects(){let e=new Map;this._planViewModel.getStaticPlanObjectViewModels().forEach(t=>{let n=t.getPlanObject();e.has(n.getCatalogItemId())?e.get(n.getCatalogItemId()).push(t):e.set(n.getCatalogItemId(),[t])}),this._rapiAccess.getItems(Array.from(e.keys())).then(t=>{let n=[];t.forEach(t=>{this._plannerKernelAccess.catalogItemLoaded(t),e.get(t.id).forEach(e=>{n.push(new Promise((n,a)=>{e.setRapiItem(t).then(()=>{this._requestRender(),n()},a)}))})}),Promise.all(n).then(()=>this._staticItemsLoaded())})}_staticItemsLoaded(){this._requestRender(!0),this._staticItemGuard.resolve(),this._roomlePlannerUiCallback.onItemsLoaded()}preload(e){this._planId=e;let t=this._localStorageHelper.getItem(this._planId,"rml_plans");t&&this._loadGLTF(t).then(e=>{this._preloadScene=e,this._preloadScene&&this._scene.add(this._preloadScene),this._requestRender()})}planXMLLoaded(e){this.endPlanConstruction(e);const t=e.getBounds(),n=f(t);this._updateBounds(n),this.loadStaticPlanObjects()}planCompletelyLoaded(e){}handlerSwitchedPlans(e){if(this._planViewModel=e,this._planViewModel.setPlannerSceneEventHandler(this._plannerSceneEventHandler),this._planViewModel.setGeometriesMergedListener(()=>{this._requestRender()}),this._plannerSceneEventHandler.setPlanViewModel(this._planViewModel),this.clearScene(),!this._initData.moc){this._addSky();let e=new THREE.PlaneGeometry(1e3,1e3);e.rotateX(-Math.PI/2);let t=new THREE.MeshStandardMaterial({color:"#f0f0f0",roughness:1,metalness:0}),n=new THREE.Mesh(e,t);n.name="Ground",n.position.y=-.01,n.receiveShadow=!0,this._scene.add(n)}this.resetCamera(),this._setCeiling(),this._staticItemGuard.reset(),this._configurableItemGuard.reset(),Promise.all([this._staticItemGuard.wait(),this._configurableItemGuard.wait()]).then(this._itemsLoaded.bind(this))}_itemsLoaded(){const e=this._planViewModel.getCorePlan();if(this._pixotron){const t=f(e.getBounds());this._pixotron.getShadowPass().setShadowRecieverBBox(t)}this._roomlePlannerUiCallback.onCompletelyLoaded(),this._requestRender(),w.end("loadingTime")}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){this._renderLoopFunction=()=>{this._scene.add(this._planViewModel.getConstructionGroup()),this._scene.add(this._planViewModel.getCeilingGroup()),this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(this._planViewModel.getBoundingBox()),this._scene.remove(this._preloadScene)}}addPlanObjectToScene(e){const t=e.getContainer();o(t),this._scene.add(t),this._zoomToBounds(),this._plannerSceneEventHandler.isDragIn()&&(this._plannerSceneEventHandler.selectPlanElement(e),this._plannerSceneEventHandler.addComponentDragInHandler(e),this._requestRender())}removePlanObjectFromScene(e){this._scene.remove(e.getContainer()),this.updateEnvironment(this.getBounds()),this._requestRender(!0)}planElementChanged(e,t){this.updateEnvironment(this.getBounds(),!0),this._requestRender(!0),this._onPlanChanged()}exportGLB(e,t){this._scriptLoader.fetch(F,{id:"gltf-exporter"}).then(()=>{let n=new THREE.GLTFExporter;e||(e=[],this._scene.children.forEach(t=>{this._isPartOfScene(t)&&e.push(t)})),n.parse(e,e=>{let n=t||"test";this._localStorageHelper.addItem(n,JSON.stringify(e),"rml_plans")},{binary:!1,embedImages:!0,forceIndices:!0})})}importGLB(e){this._loadGLB(e).then(e=>this._scene.add(e))}clearScene(){this._plannerMeshGenerator.clear(),this._planViewModel.sceneCleared(),super.clearScene()}_addSky(){this._sky=new THREE.Sky,this._sky.name="Sky",this._sky.scale.setScalar(45e4),this._scene.add(this._sky),this._sky.material.uniforms.turbidity.value=10,this._sky.material.uniforms.rayleigh.value=2,this._sky.material.uniforms.luminance.value=1,this._sky.material.uniforms.mieCoefficient.value=.005,this._sky.material.uniforms.mieDirectionalG.value=.8;let e=new THREE.Mesh(new THREE.SphereBufferGeometry(2e4,16,8),new THREE.MeshBasicMaterial({color:16777215}));e.name="Sunsphere",e.position.y=-7e5,e.visible=!1,this._scene.add(e);let t=-.2*Math.PI,n=2*Math.PI*-.25;e.position.x=4e5*Math.cos(n),e.position.y=4e5*Math.sin(n)*Math.sin(t),e.position.z=4e5*Math.sin(n)*Math.cos(t),e.visible=!0,this._sky.material.uniforms.sunPosition.value.copy(e.position),this._lightSetting instanceof ce&&this._lightSetting.updateSunPosition(.3,.25)}switchTo2D(){this._cameraControl instanceof oe||(this._requestRender(),this._changeCameraControl(new oe(this._creator_,this._getInputManager())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("2D"))}switchTo3D(){this._cameraControl instanceof Q||(this._changeCameraControl(new Q(this._creator_,this._getInputManager(),new THREE.Vector3(0,10,0),this.getPerspectiveOffsetCamera())),this._updateCamera(),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("3D"))}_setCeiling(){this._planViewModel&&(this._cameraControl instanceof le?this._planViewModel.getCeilingGroup().visible=!0:this._planViewModel.getCeilingGroup().visible=!1)}cameraControlChanged(){super.cameraControlChanged(),this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setCamera(this._cameraControl.getCamera())}sceneChanged(){this._plannerSceneEventHandler&&this._plannerSceneEventHandler.setScene(this._scene)}closeHSC(){this._requestRender(),this._cameraControl instanceof Q&&this._cameraControl.resetToState()}switchToFirstPerson(){if(this._cameraControl instanceof le)return;this._plannerMeshGenerator.wallMeshes.forEach(e=>M(e.material,!1,!1)),this._requestRender();let e=new THREE.Vector3(0,0,0);this._planViewModel&&(e=this._planViewModel.getBoundingBox().getCenter(new THREE.Vector3)),this._cameraControl&&this._cameraControl.cleanUp(),this._changeCameraControl(new le(this._creator_,this._getInputManager(),e,this.getPerspectiveOffsetCamera())),this._addCameraControlListener(),this._setCeiling(),this._roomlePlannerUiCallback.onCameraChanged("FP")}_onKeyDown(e){super._onKeyDown(e),this._initData.debug&&this._checkNumKey(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("multiselect"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof Q&&(this._cameraControl.enablePanning(),e.preventDefault())}_checkNumKey(e){e.key&&"1"===e.key&&(this.switchTo2D(),e.preventDefault()),e.key&&"2"===e.key&&(this.switchTo3D(),e.preventDefault()),e.key&&"3"===e.key&&(this.switchToFirstPerson(),e.preventDefault())}_onKeyUp(e){super._onKeyDown(e),!e.key||"Meta"!==e.key&&"Control"!==e.key||(this._plannerSceneEventHandler.setSelectionMode("standard"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this._cameraControl instanceof Q&&(this._cameraControl.disablePanning(),e.preventDefault())}setMode(e){switch(e){case"2D":this.switchTo2D();break;case"3D":this.switchTo3D();break;case"FP":this.switchToFirstPerson()}}_highlight(e){let t=new Set;e&&e.getObject()&&e.getObject().children&&e.getObject().children.forEach(e=>t.add(e)),this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const n=this._planViewModel.getPlanObjectForId(e);n&&n.getObject()&&n.getObject().children&&n.getObject().children.forEach(e=>t.add(e))}),this._pixotron&&this._pixotron.highlightObjects(Array.from(t))}destroy(){super.destroy(),this._plannerMeshGenerator.removeMaterialLoadedListener(),this._planViewModel.removeGeometriesMergedListener()}getPixotronParams(){return{saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,samplesPerFrame:4,bias:.02,numSamples:100,accumulative:!1,falloff:2},shadowparams:{shadowMapResolution:1024,shadowRadius:3,shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.6,nearPlane:.01,farPlane:50,fov:110,side:THREE.FrontSide,numSamples:100},outlineparams:{highlightColor:new THREE.Color(this._initData.colors.SELECTION),edgeStrength:1,transparency:.9,edgeThickness:2}}}getBakedShadowParams(){return{enable:!0,shadowMapResolution:1024,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.8,darkness:.3,size:1.2,lightDirection:new THREE.Vector3(0,1,0),lightSolidAngle:40,yPosition:.006}}planObjectConfigurationLoaded(e,t,n){if(e&&e.extRef&&t&&t.extRef){let e=t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId();e>0&&this._planViewModel.constructComponents(e)}}addMesh(e,t,n,a,i,s){}_updateBounds(e){e&&(this._updateCamera(e),super._updateBounds(e))}_updateCamera(e){if(e||(e=this.getBounds()),e){if(this._cameraControl instanceof Q){const t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z),a=this._initData.moc?.5*n*-1:5,i=this._initData.moc?Y:70;this._cameraControl.updateAndReset(t,e.getCenter(new THREE.Vector3),-15,i,a,!1)}this._cameraControl instanceof oe&&this._cameraControl.updateToBounds(e.getSize(new THREE.Vector3),e.getCenter(new THREE.Vector3))}}_zoomToBounds(){const e=this.getBounds();this._cameraControl instanceof Q&&this._cameraControl.zoomToFitBounds(e)}getBounds(){return this._planViewModel?this._planViewModel.getBoundingBox():null}cancelSelection(){this._plannerSceneEventHandler.cancelSelection(),this._highlight(null),this._requestRender(!0)}deleteSelection(){const e=this._plannerSceneEventHandler.getSelectedIds();this.cancelSelection(),e.forEach(e=>{const t=this._planViewModel.getPlanObjectForId(e);t&&t.getObject()&&this._plannerKernelAccess.planInteractionHandler.removeElement(t.getKernelObject())})}rotateSelection(e){const t=new this._plannerKernelAccess.kernelContainer.PlanObjectPtrList,n=new THREE.Box3;this._plannerSceneEventHandler.getSelectedIds().forEach(e=>{const a=this._planViewModel.getPlanObjectForId(e);a&&a.getObject()&&(t.push_back(a.getPlanObject()),n.expandByObject(a.getContainer()))});const a=n.getCenter(new THREE.Vector3),i=this._plannerKernelAccess.planInteractionHandler.groupObjects(t);this._plannerKernelAccess.planInteractionHandler.rotateGroupBy(i,e,s(a))}planBoundsChanged(){this.updateEnvironment(this.getBounds()),this._requestRender(!0)}planElementRemoved(e){this._onPlanChanged()}_onPlanChanged(){this._roomlePlannerUiCallback.onPlanChanged()}prepareTopImage(e={}){return new Promise(t=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n=this._calculateBoundingBoxOfAllMeshes(.1);this._lightSetting.removeFromScene();let a=await U(this._scene,null,n,e);this._lightSetting.addToScene(),this._requestRender(),t(a)})})}preparePerspectiveImage(e={}){return new Promise((t,n)=>{this._planViewModel.materialQueue.finished(!0).then(async()=>{let n;n=this._cameraControl instanceof Q?this._cameraControl.getCamera().clone():this.getPerspectiveOffsetCamera();let a=this._calculateBoundingBoxOfAllMeshes();this._lightSetting.removeFromScene();const i=await z(this._scene,n,a,e);this._lightSetting.addToScene(),this._requestRender(),t(i)},n)})}_calculateBoundingBoxOfAllMeshes(e=0){const t=this.getBounds();return q(t,e)}enableRotation(){this._plannerSceneEventHandler.setState(2)}disableRotation(){this._plannerSceneEventHandler.resetState()}dragIn(e){this._plannerSceneEventHandler.setDragIn(!0,e)}getPlannerSceneEventHandler(){return this._plannerSceneEventHandler}}return a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_plannerMeshGenerator",void 0),a([i],e.prototype,"_plannerInputManager",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_localStorageHelper",void 0),e})();const Ee={left:0,top:1,right:1,bottom:0};let be=(()=>{class e{constructor(e){this._hscInstance=null,this._glbInstance=null,this._creator_=e,this._kernelAccessCallback.addListener(this),this._backstack.init([C.HSP],this)}deleteSelection(){this._sceneManager.deleteSelection()}rotateSelection(e){this._sceneManager.rotateSelection(e)}cancelSelection(){this._sceneManager.cancelSelection()}init(e,t,n){return w.start("loadingTime"),this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):(this._preloadPlanId=t,this.setOverrides(n),new Promise(this._initPromiseCallback.bind(this)))}loadPlanXml(e,t){return this.setOverrides(t),new Promise(t=>{this._plan=this._planInteractionHandler.loadPlanXML(e),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(C.HSP),this._initData.moc&&this._rapiAccess.trackView("planXML"),t()})}loadPlan(e,t){return this.setOverrides(t),new Promise((t,n)=>{this._rapiAccess.getPlan(e).then(n=>{this._plan=this._planInteractionHandler.loadPlanXML(n.planObjects),this._sceneManager.planXMLLoaded(this._plan),this._roomlePlannerUiCallback.onTotalFloorAreaChanged(this._planInteractionHandler.getPlan().getTotalFloorArea()),this._backstack.bringIntoForeground(C.HSP),this._initData.moc&&this._rapiAccess.trackView(e),t()},n)})}setOverrides(e){e&&(this._initData.setOverrides(e),this._globalInitData.setOverrides(e))}switch2D(){this._sceneManager.switchTo2D()}switch3D(){this._sceneManager.switchTo3D()}switchToFirstPerson(){this._sceneManager.switchToFirstPerson()}exportGLB(){this._sceneManager.exportGLB()}importGLB(e){this._sceneManager.importGLB(e)}_initPromiseCallback(e,t){this._threeLoader.fetch().then(()=>{let t=this._scriptLoader.fetch(P,{id:"gltf-loader"}),n=this._scriptLoader.fetch(v,{id:"draco-loader"}),a=this._scriptLoader.fetch(J,{id:"tween-js"}),i=this._scriptLoader.fetch("static/Sky-6621935ea8a523af.js",{id:"sky-js"});Promise.all([t,n,a,i]).then(()=>{this._kernelReadyCallback=e;const{mode:t,stats:n}=this._initData;this._sceneManager||(this._sceneManager=new Ce(this._creator_,Ee,this,t)),this._preloadPlanId&&this._sceneManager.preload(this._preloadPlanId),n?this.showStats():this.enableHD(),this._planInteractionHandler&&this._kernelReadyCallback()})})}enableHD(){return new Promise((e,t)=>{const n=()=>{this._sceneManager.enableHD(),e()};this._threeLoader.fetch().then(()=>Promise.all(Z.map(e=>this._scriptLoader.fetch(e,{id:e})))).then(()=>{this._scriptLoader.fetch($,{id:"pi-js"}).then(n,t)},t)})}isReady(){this._planInteractionHandler=this._plannerKernelAccess.planInteractionHandler,this._kernelReadyCallback&&this._kernelReadyCallback()}showBenchmarks(){w.showBenchmarks()}async switchToConfigurator(){const e=await this._singlePromiseFactory.create(3,"startHSC",e=>{if(this._hscInstance)return e(this._hscInstance);t.import("./configurator-f6d8647d.legacy.js").then((function(e){return e.c})).then(({Configurator:t})=>{const n=new t(this._creator_);n.boot({kernelInstance:this._planInteractionHandler.getConfiguratorKernel(),kernelContainer:this._plannerKernelAccess.kernelContainer}),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._hscInstance=n,e(this._hscInstance)})})});return this._backstack.bringIntoForeground(C.HSC),this.cancelSelection(),e}async switchToViewer(){const e=await this._singlePromiseFactory.create(4,"startGLB",e=>{if(this._glbInstance)return e(this._glbInstance);t.import("./glb-viewer-c541bffb.legacy.js").then(t=>{const n=new t.GlbViewer(this._creator_);n.boot(),n.getApi().setOverrides(this._initData),n.getApi().init(this._domHelper.element).then(()=>{this._glbInstance=n,e(this._glbInstance)})})});return this._backstack.bringIntoForeground(C.GLB),this.cancelSelection(),e}switchToPlanner(e){e&&this.loadPlan(e),this._backstack.bringIntoForeground(C.HSP)}updateSize(){this._sceneManager.updateCamera()}getMain(){}update(){this.updateSize(),this._glbInstance&&this._glbInstance.getApi().updateSize(),this._hscInstance&&this._hscInstance.getApi().updateSize()}get callbacks(){return this._roomlePlannerUiCallback}set callbacks(e){this._roomlePlannerUiCallback=e}showStats(){this._sceneManager.showStats()}onBackStackChanged(e){this._roomlePlannerUiCallback.onBackStackChanged(e)}onCloseHSC(){this._sceneManager.closeHSC(),this._hscInstance&&this._hscInstance.getApi().pauseKernelCallbacks()}back(){if(this._backstack.current()===C.GLB&&this._glbInstance&&this._glbInstance.getApi().clearScene(),this._backstack.current()===C.HSC&&this._hscInstance){const e=this._hscInstance.getApi();e.cancelSelection(),e.cancelDockings(),e.hideDimensions(),e.disableMultiselect(),this._sceneManager.updateScene()}this._backstack.back()}backTo(e){this._backstack.backTo(e)}getConfigurator(){return this._hscInstance}getCurrentSkin(){return this._rapiAccess.getCurrentSkin()}getRuntimeComponentIdOfRootComponent(e){return e?this._plannerKernelAccess.planInteractionHandler?this._plannerKernelAccess.planInteractionHandler.getConfiguratorKernel().getRootPlanComponentIdFromObjectId(e):(console.warn("Can not retrieve runtime id without planInteractionHandler"),0):(console.warn("Can not retrieve runtime id without planObjectId"),0)}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}syncCatalog(e){return this._dataSyncer.syncCatalog(e)}loadError(e){}getPlanInteractionHandler(){return Promise.resolve(this._planInteractionHandler)}getPlanModelViewHelper(){return Promise.resolve(this._plannerKernelAccess.planModelViewHelper)}async insertObject(e,t,n){if(!this._planInteractionHandler)throw new Error("no plan interaction handler");const a=await(S(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),i=await this._plannerKernelAccess.addPlanObjectFromItem(a,t,n);return this._sceneManager.updateScene(),i}async insertItemList(e){const t=e.map(e=>S(e)?this._rapiAccess.getItem(e):this._rapiAccess.getConfiguration(e)),n=await Promise.all(t);await this._plannerKernelAccess.insertItems(n)}async insertItems(e){await this._plannerKernelAccess.insertItems(e)}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getCameraOffset(){return this._sceneManager.getCameraOffset()}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}async getObjects(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);let t=[];for(let n=0;n<e.objects.size();n++)t.push(y(e.objects.get(n)));return t}async getPlanOverview(){const e=(await this.getPlanModelViewHelper()).getPlanOverview(this._plan);return y(e)}prepareTopImage(e={}){return this._sceneManager.prepareTopImage(e)}preparePerspectiveImage(e={}){return this._sceneManager.preparePerspectiveImage(e)}enableRotation(){this._sceneManager.enableRotation()}disableRotation(){this._sceneManager.disableRotation()}async dragInObject(e,t){this._sceneManager.dragIn(t);const n=await this._rapiAccess.getItem(e);this.insertItems([n])}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_scriptLoader",void 0),a([i],e.prototype,"_kernelAccessCallback",void 0),a([i],e.prototype,"_plannerKernelAccess",void 0),a([i],e.prototype,"_rapiAccess",void 0),a([i],e.prototype,"_singlePromiseFactory",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),a([i],e.prototype,"_backstack",void 0),a([i],e.prototype,"_threeLoader",void 0),a([i],e.prototype,"_dataSyncer",void 0),a([i],e.prototype,"_initData",void 0),a([i],e.prototype,"_globalInitData",void 0),e})();class fe extends pe{constructor(e){super(e),this._container.name="Wall Plan Element"}addMesh(e){super.addMesh(e);const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,t.y,t.z),this._boundingBox.position.y=t.y/2}}class we extends pe{constructor(e){super(e),this._container.name="Floor Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}class Me extends pe{constructor(e){super(e),this._container.name="Ceiling Plan Element"}addMesh(e){super.addMesh(e),e.castShadow=!1;const t=(new THREE.Box3).setFromObject(this.getObject()).getSize(new THREE.Vector3);this._boundingBox.geometry=new THREE.BoxGeometry(t.x,.01,t.z)}}let Se=(()=>{class e extends I{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionGroup=new THREE.Group,this._ceilingGroup=new THREE.Group,this._getKernelAccess().addPlannerListener(this)}planBoundsChanged(){}_getKernelAccess(){return k.lookup("planner-kernel-access",this._creator_)}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null,super.clearReference()}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof ue?this._configurablePlanObjectViewModels.push(e):e instanceof me?(this._staticPlanObjectViewModels.push(e),"door"!==e.getPlanObject().getObjectType()&&"window"!==e.getPlanObject().getObjectType()&&this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e)):e instanceof fe?(this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),this._constructionGroup.add(e.getContainer())):(e instanceof we||e instanceof Me)&&this._constructionGroup.add(e.getContainer())}_addRootComponent(e){const t=this._getPlanObjectViewModelForRuntimeId(e.parentObjectId);t&&t instanceof ue&&(t.addRootComponent(e),this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(t),t.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getConfigurationRuntimeId()&&(t=n)}),t}getPlanObjectForId(e){let t=null;return this._configurablePlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),this._staticPlanObjectViewModels.forEach(n=>{e===n.getId()&&(t=n)}),t}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getBoundingBox(){const e=this.getCorePlan();return e?f(e.getBounds()):(new THREE.Box3).setFromObject(this._constructionGroup)}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}sceneCleared(){this._configurablePlanObjectViewModels.forEach(e=>{e.clear()}),this._staticPlanObjectViewModels.forEach(e=>{e.clear()}),super.sceneCleared()}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getComponent(e){return this._components.get(e)}_generateMesh(e=0,t=null,n,a,i,s,r,o,l){return this._plannerMeshGenerator.generateMesh(t,n,a,i,s,r,o,l)}_setMaterial(e,t,n){this._plannerMeshGenerator.setMaterial(e,t)}Editor3dComponentCreated(e,t,n,a,i){super.Editor3dComponentCreated(e,t,n,a,i),this._getKernelAccess()instanceof Pe&&this.dockComponent(e,a,t,n)}addPlanObjectToScene(e){}handlerSwitchedPlans(e){this._constructionGroup=new THREE.Group,this._ceilingGroup=new THREE.Group}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,n,a,i,s,r){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,n){}addMesh(e,t,n,a,i,s){const r=e.extRef.jsObject;let o=r.getMesh(t);o?o.geometry=this._plannerMeshGenerator.generateGeometry(null,n,a,i,s):(o=this._generateMesh(0,null,t,n,a,i,s,e.getType()),r.addMesh(o))}removePlanObjectFromScene(e){}planElementRemoved(e){if(e.getType()===this._getKernelAccess().kernelContainer.PlanElementType.OBJECT){let t=e;if(t.hasConfiguration()){const e=t.extRef.jsObject,n=this._configurablePlanObjectViewModels.indexOf(e);n>-1&&this._configurablePlanObjectViewModels.splice(n,1)}else{const e=t.extRef.jsObject,n=this._staticPlanObjectViewModels.indexOf(e);n>-1&&this._staticPlanObjectViewModels.splice(n,1)}}}getMeshGenerator(){return this._plannerMeshGenerator}}return a([i],e.prototype,"_plannerMeshGenerator",void 0),e})(),Pe=(()=>{class e extends R{constructor(e){super(e,0),this._plannerKernelCallbackListener=new Set,w.addMeta("kernel_is_ready",{isWasm:this._useWASM}),this._scriptLoader.fetch(this._kernelPath,{id:"kernel"}).then(this._loadSuccess.bind(this),this._loadError.bind(this))}get kernelContainer(){return this._kernelContainer}_loadSuccess(){window.RoomleCore(this._kernelContainer)}_loadError(){console.error("kernel load error")}_createPlanInteractionHandler(){const e=this._kernelContainer;this._planInteractionHandler=new e.PlanInteractionHandler,this._planInteractionHandler.init(this._planInteractionHandler,1,100,!0,!0,e.DrawingType.CLICK_PER_CLICK),this._roomlePlannerUiCallback.onPlanInteractionHandlerCreated(this._planInteractionHandler)}addPlannerListener(e){this._plannerKernelCallbackListener.add(e)}removePlannerListener(e){this._plannerKernelCallbackListener.delete(e)}isReady(){super.isReady(),this.registerCallbacks(),this._roomlePlannerUiCallback.onPlannerKernelIsReady(this._kernelContainer),this._createPlanInteractionHandler();const e=this._planInteractionHandler.getConfiguratorKernel();this._kernelInstance=e,this._roomlePlannerUiCallback.onConfiguratorKernelIsReady(this._kernelContainer,e),H.isProduction||(window.__RML__DEBUG__.ConfiguratorKernel=this._kernelInstance,window.__RML__DEBUG__.PlannerKernelContainer=this._kernelContainer),this._kernelAccessCallback.isReady()}get callbacks(){return this._roomlePlannerUiCallback}get planInteractionHandler(){return this._planInteractionHandler}get planModelViewHelper(){return this._kernelContainer.PlanModelViewHelper}catalogItemLoaded(e){const t=this._rapiItemToKernelItem(e);this._kernelContainer.catalogItemLoaded(t)}async insertItems(e){let t=new this._kernelContainer.CatalogItemPtrList;e.forEach(e=>{let n=e.count||1;for(let a=0;a<n;a++)e.count||(e.count=0),t.push_back(this._rapiItemToKernelItem(e))}),this._planInteractionHandler.addPlanObjects(t);const n=this._planInteractionHandler.getPlan().extRef.jsObject;await Promise.all(n.getStaticPlanObjectViewModels().map(async e=>{if(e.needsRapiItem()){const t=await this._rapiAccess.getItem(e.getPlanObject().getCatalogItemId());e.setRapiItem(t)}}))}_rapiItemToKernelItem(e){let t=new this._kernelContainer.CatalogItem(e.id),n=t.size;return n.x=e.width||0,n.y=e.depth||0,n.z=e.height||0,t.size=n,t.flipable=e.flipable,e.layer&&(t.layer=e.layer),t.orderable=e.orderable,t.scaleable=e.scaleable,t.type=e.type||"other",t.detailType=e.detailType||t.type||"other",t.configuration=e.configuration||"",t}onLoadComponentError(e,t){}configurationLoaded(e,t,n,a,i){}componentDefinitionLoaded(e,t){}componentDefinitionLoadingError(e,t){}configurationLoadingError(){}componentConfigurationUpdated(e){}componentParameters(){}requestComponentDimensions(){}planObjectCreated(e,t){}planObjectUpdated(e){}planObjectConfigurationUpdated(e,t,n){}planObjectDeleted(){}requestPlanObjectDimensions(){}cleanUpCallbacks(){super.cleanUpCallbacks(),this._kernelContainer.unregisterPlannerCallback(this)}registerCallbacks(){super.registerCallbacks(),this._kernelContainer.registerPlannerCallback(this)}requestExternalMesh(e,t){return new Promise((n,a)=>{this._rapiAccess.getMesh(e,L,t).then(i=>{fetch(new Request(this._dataSyncer.requestAsset(i.url,!0))).then(e=>e.arrayBuffer()).then(a=>this._handleCortoMesh(a,e,t,n)).catch(e=>{console.error(e),a(e)})},e=>{console.error(e),a(e)})})}Editor3dRootComponentCreated(e,t,n,a){this._configuratorKernelCallbackListener.forEach(i=>i.Editor3dComponentCreated(e,t,n,a,!0))}Editor3dPlanObjectConstructionDone(e){}Editor3dBeginGroup(){}Editor3dEndGroup(){}Editor3dSetMaterial(){}Editor3dLoadMaterial(){}Editor3dAddDockPreview(e,t){}Editor3dSetPreviewPointAssociations(e,t){}Editor3dSetPreviewLineAssociations(e,t){}Editor3dPreviewConstructionDone(e,t){}Editor3dTranslateBy(){}Editor3dRotateBy(){}Editor3dRotateAround(){}Editor3dAddCube(){}Editor3dAddCubeUVMod(){}Editor3dAddSphere(){}Editor3dAddSphereUVMod(){}Editor3dAddRectangle(){}Editor3dAddRectangleUVMod(){}Editor3dAddMesh(){}Editor3dAddMeshUVMod(){}Editor3dAddMeshUVCoord(){}Editor3dAddCylinder(){}Editor3dAddCylinderUVMod(){}Editor3dAddPrism(){}Editor3dAddPrismUVMod(){}Editor3dAddFittingPoint(){}Editor3dAddFittingLine(){}Editor3dSelectObject(){}Editor3dCopy(){}Editor3dUpdatePlanObjectPosition(){}Editor3dUpdatePlanObjectRotation(){}Editor3dUpdatePlanObjectTransform(){}Editor3dUpdatePlanComponentPosition(){}Editor3dUpdatePlanComponentRotation(){}Editor3dUpdatePlanComponentTransform(){}planElementRemoved(e){this._plannerKernelCallbackListener.forEach(t=>t.planElementRemoved(e)),this._plannerKernelCallbackListener.forEach(t=>t.removePlanObjectFromScene(e.extRef.jsObject)),this._decoupleReferences(e)}handlerSwitchedPlans(e,t){if(this._decoupleReferences(e),t){let e=new Se(this._creator_);e.setReference(t),this._coupleReferences(e,t),this._plannerKernelCallbackListener.forEach(t=>t.handlerSwitchedPlans(e))}}planBoundsChanged(){this._plannerKernelCallbackListener.forEach(e=>e.planBoundsChanged())}planCleared(){}planCompletelyLoaded(e){this._plannerKernelCallbackListener.forEach(t=>t.planCompletelyLoaded(e))}planElement3dMeshChanged(e,t){if(t.extRef){const e=t.extRef.jsObject;for(let t=e.getObject().children.length-1;t>=0;t--)e.getObject().remove(e.getObject().children[t])}this.planModelViewHelper.requestMesh3d(t)}planElementAdded(e,t){if(e&&e.extRef)if(t.getType()===this._kernelContainer.PlanElementType.OBJECT){let n,a=t;a.hasConfiguration()?(n=new ue(a),this._coupleReferences(n,a),e.extRef.jsObject.addPlanElementViewModel(n)):(n=new me(a),this._coupleReferences(n,a),e.extRef.jsObject.addPlanElementViewModel(n)),this._plannerKernelCallbackListener.forEach(e=>e.addPlanObjectToScene(n))}else{let n,a=t;if(t.getType()===this._kernelContainer.PlanElementType.WALL?n=new fe(a):t.getType()===this._kernelContainer.PlanElementType.FLOOR?n=new we(a):t.getType()===this._kernelContainer.PlanElementType.CEILING&&(n=new Me(a)),!n)return;n.setPrimaryColor(this._initData.colors.PRIMARY),this._coupleReferences(n,a),e.extRef.jsObject.addPlanElementViewModel(n),this.planModelViewHelper.requestMesh3d(t)}}planElementChanged(e,t){if(t.extRef){let n=t.extRef.jsObject;n.update(),this._plannerKernelCallbackListener.forEach(t=>t.planElementChanged(e,n))}}planHistoryStateChanged(){}planObjectConfigurationCreated(e,t){}planObjectConfigurationLoaded(e,t,n){e&&e.extRef&&t&&t.extRef&&t.extRef.jsObject.getPlanObject().getConfigurationRuntimeId()>0&&this._plannerKernelCallbackListener.forEach(a=>a.planObjectConfigurationLoaded(e,t,n))}requestCatalogItem(e){}startedDrawing(){}stoppedDrawing(){}updateMesh2d(){}beginConstruction(){}addMesh(e,t,n,a,i,s){this._plannerKernelCallbackListener.forEach(r=>r.addMesh(e,t,n,a,i,s))}endConstruction(){}beginPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.beginPlanConstruction(e))}addPlanMesh(e,t,n,a,i,s,r){this._plannerKernelCallbackListener.forEach(o=>o.addPlanMesh(e,t,n,a,i,s,r))}endPlanConstruction(e){this._plannerKernelCallbackListener.forEach(t=>t.endPlanConstruction(e))}addPlanObjectFromItem(e,t,n){if(!t&&!n)return this.insertItems([e]);n=n||0===n?n:0,t=t||{x:0,y:0,z:0};const a=this._rapiItemToKernelItem(e);return this._planInteractionHandler.addPlanObjectFromItem(a,t,n)}_coupleReferences(e,t){let n=new this._kernelContainer.EMSReference;n.jsObject=e,t.extRef=n}_decoupleReferences(e){e&&e.extRef&&(e.extRef.jsObject.clearReference(),e.extRef.jsObject=null,e.extRef.delete(),e.extRef=null)}}return a([i],e.prototype,"_kernelAccessCallback",void 0),a([i],e.prototype,"_roomlePlannerUiCallback",void 0),a([i],e.prototype,"_initData",void 0),e})(),ve=(()=>{class e{constructor(e){this._initialStack=[],this._creator_=e,this._lifeCycleManager.addEventListener(this)}_setInitialStack(e){this._initialStack=[...e]}_setCallbacks(e){this._callbacks=e}_resetCanvasStack(){this._canvasStack=[...this._initialStack]}init(e,t){this._setInitialStack(e),this._resetCanvasStack(),this._setCallbacks(t)}bringIntoForeground(e){const t=this._domHelper.element.querySelectorAll("canvas");let n=!1;t.forEach(t=>{if(t.classList.contains(e)){if(!t.classList.contains("foreground")){const t=this.current();t&&e!==t&&(this._canvasStack.push(e),n=!0),t||(n=!0)}t.classList.remove("background"),t.classList.add("foreground")}else t.classList.remove("foreground"),t.classList.add("background")}),n&&this._callbacks.onBackStackChanged(this._canvasStack)}current(){return this._canvasStack[this._canvasStack.length-1]}back(){if(1===this._canvasStack.length)return;let e=this._canvasStack.pop();this.bringIntoForeground(this.current()),e===C.HSC&&this._callbacks.onCloseHSC(),this._callbacks.onBackStackChanged(this._canvasStack)}backTo(e){if(1!==this._canvasStack.length&&this.current()!==e)for(;this._canvasStack.length>0;){let t=this.current();if(t===e){this.bringIntoForeground(t);break}t===C.HSC&&this._callbacks.onCloseHSC(),this._canvasStack.pop(),this._callbacks.onBackStackChanged(this._canvasStack)}}pause(){this._resetCanvasStack()}resume(){}destroy(){}}return a([i],e.prototype,"_domHelper",void 0),a([i],e.prototype,"_lifeCycleManager",void 0),e})();class ye{constructor(e){const{planElementViewModel:t}=e;this.planElementViewModel=t}}const Ie=[new T("script-loader",ne),new T("planner-input-manager",class extends ee{_canDrag(e){return!0}},1),new T("planner-kernel-access",Pe),new T("logger",x),new T("planner-mesh-generator",class extends ie{constructor(e){super(e),this._wallMeshes=[],this._defaultMaterial=new THREE.MeshStandardMaterial({color:"#ffffff",roughness:1,metalness:0,opacity:1,envMap:null}),this._environmentLoader.setEnvMap(this._defaultMaterial)}generateGeometry(e=null,t,n,a,i,s=!1){let r;return r=s?this._generateGeometry(e,t,n,a,i).clone():this._generateGeometry(e,t,n,a,i),r}generateMesh(e=null,t,n,a,i,s,r,o=!1){const l=this.generateGeometry(e,n,a,i,s,o),c=new THREE.Mesh(l,this._previewMaterial);return c.layers.set(3),!t&&r&&7!==r.value?(console.warn("material is undefined"),c):(this.setMaterial(c,t,r).then(()=>{const e=r&&3===r.value;c.castShadow=!e}),this._checkWallMaterial(c,r),c)}async setMaterial(e,t,n){if(e.userData.material=l(t,n),e.userData.materialId=t,G(t))t?(await this._assignMaterial(e,t),this._materialLoaded&&this._materialLoaded()):(console.warn("Used default material because material is empty"),this.changeMaterialOfMesh(e,this._defaultMaterial));else{if(!t)return void this.changeMaterialOfMesh(e,this._defaultMaterial);2===(t=t).getSourceType().value?(await this._assignMaterial(e,t.materialId),this._materialLoaded&&this._materialLoaded()):1===t.getSourceType().value?await this._assignItem(e,t.catalogItemId):3===t.getSourceType().value?await this._assignRGB(e,t.rgbValue):0===t.getSourceType().value?this.changeMaterialOfMesh(e,this._defaultMaterial):(this.changeMaterialOfMesh(e,this._defaultMaterial),1!==n.value&&7!==n.value&&3!==n.value&&console.warn("Used default material because material is not supported",t))}}set maxAnisotropy(e){this._maxAnisotropy=e}_checkWallMaterial(e,t){t&&1===t.value&&(e.renderOrder=5,this._wallMeshes.push(e))}clear(){super.clear(),this.clearWallMeshes()}clearWallMeshes(){this._wallMeshes.forEach(e=>{j(e)}),this._wallMeshes=[]}get wallMeshes(){return this._wallMeshes}}),new T("rapi-access",V),new T("roomle-planner-ui-callback",class extends O{constructor(e){super(e),this.onItemsLoaded=()=>{},this.onBackStackChanged=e=>{},this.onCameraChanged=e=>{},this.onTotalFloorAreaChanged=e=>{},this.onPlanInteractionHandlerCreated=e=>{},this.onPlannerKernelIsReady=e=>{},this.onConfiguratorKernelIsReady=(e,t)=>{},this.onSelectionChange=(e,t,n,a)=>{},this.onSelectionCancel=()=>{},this.onPlanChanged=()=>{},this.onCompletelyLoaded=()=>{},this.onRotationCancel=()=>{}}}),new T("backstack",ve),new T("planner-selection-handler",class extends te{constructor(){super(...arguments),this._selectionMode="standard",this._selectedPlanElementViewModels=new Map}check(e){"standard"===this._selectionMode&&this._checkStandard(e),"multiselect"===this._selectionMode&&this._checkMulti(e)}cancelSelection(){0!==this._selectedPlanElementViewModels.size&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new ye({planElementViewModel:e}))})}_checkStandard(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new ye({planElementViewModel:e}));this._selectedPlanElementViewModels.size>0&&this._selectedPlanElementViewModels.forEach((e,t)=>{this._selectedPlanElementViewModels.delete(t),this.dispatchEvent(1,new ye({planElementViewModel:e}))}),this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new ye({planElementViewModel:e}))}_checkMulti(e){if(this._selectedPlanElementViewModels.has(e.getId()))return this._selectedPlanElementViewModels.delete(e.getId()),void this.dispatchEvent(1,new ye({planElementViewModel:e}));this._selectedPlanElementViewModels.set(e.getId(),e),this.dispatchEvent(0,new ye({planElementViewModel:e}))}setSelectionMode(e){this._selectionMode=e}getSelectionMode(){return this._selectionMode}hasSelection(){return this._selectedPlanElementViewModels.size>0}getSelectedIds(){let e=[];return this._selectedPlanElementViewModels.forEach(t=>e.push(t.getId())),e}isSelected(e){return!!this._selectedPlanElementViewModels.get(e)}})];e("Planner",class extends ae{setupGlobals(){}setupDependencies(){k.setup(Ie),this.lookup("logger",this._context),this.lookup("planner-kernel-access",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._planner=new be(this._context),this._planner.getMain=()=>this,window.RoomlePlanner||(window.RoomlePlanner=this._planner)}getApi(){return this._planner}getContextName(){return"planner"}})}}}));
2
- //# sourceMappingURL=planner-5818e32b.legacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scene-manager-2bb96268.legacy.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}