@roomle/web-sdk 2.106.0 → 2.107.0-alpha.2

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 (105) hide show
  1. package/lib/{PointLightHelper-BkhgsNMr.js → PointLightHelper-BEyPVHpD.js} +2 -2
  2. package/lib/{PointLightHelper-BkhgsNMr.js.map → PointLightHelper-BEyPVHpD.js.map} +1 -1
  3. package/lib/{PointLightHelper-Dv5w-V26.mjs → PointLightHelper-C08I9fxN.mjs} +2 -2
  4. package/lib/{PointLightHelper-Dv5w-V26.mjs.map → PointLightHelper-C08I9fxN.mjs.map} +1 -1
  5. package/lib/{banana-for-scale-C6WLZBrI.js → banana-for-scale-CRuiKfKr.js} +2 -2
  6. package/lib/{banana-for-scale-C6WLZBrI.js.map → banana-for-scale-CRuiKfKr.js.map} +1 -1
  7. package/lib/{banana-for-scale-Dkvl0dmA.mjs → banana-for-scale-D1KrBggd.mjs} +2 -2
  8. package/lib/{banana-for-scale-Dkvl0dmA.mjs.map → banana-for-scale-D1KrBggd.mjs.map} +1 -1
  9. package/lib/{camera-behaviour-CeI8xI7Q.mjs → camera-behaviour-CsLcX8jk.mjs} +3 -3
  10. package/lib/{camera-behaviour-CeI8xI7Q.mjs.map → camera-behaviour-CsLcX8jk.mjs.map} +1 -1
  11. package/lib/{camera-behaviour-BC7oG4ni.js → camera-behaviour-vflerxg2.js} +3 -3
  12. package/lib/{camera-behaviour-BC7oG4ni.js.map → camera-behaviour-vflerxg2.js.map} +1 -1
  13. package/lib/{component-dimensioning-Cd4amJUD.mjs → component-dimensioning-DKZR-14N.mjs} +2 -2
  14. package/lib/{component-dimensioning-Cd4amJUD.mjs.map → component-dimensioning-DKZR-14N.mjs.map} +1 -1
  15. package/lib/{component-dimensioning-D5TgCYxL.js → component-dimensioning-fBdrqhdr.js} +2 -2
  16. package/lib/{component-dimensioning-D5TgCYxL.js.map → component-dimensioning-fBdrqhdr.js.map} +1 -1
  17. package/lib/{component-raycast-helper-CKvxxNPn.js → component-raycast-helper-Bkq0_1Vg.js} +2 -2
  18. package/lib/{component-raycast-helper-CKvxxNPn.js.map → component-raycast-helper-Bkq0_1Vg.js.map} +1 -1
  19. package/lib/{component-raycast-helper-CoI-qGLm.mjs → component-raycast-helper-Bn1_2Pjk.mjs} +2 -2
  20. package/lib/{component-raycast-helper-CoI-qGLm.mjs.map → component-raycast-helper-Bn1_2Pjk.mjs.map} +1 -1
  21. package/lib/{configurator-DAPa7kO6.mjs → configurator-BLPGn_Jf.mjs} +6 -6
  22. package/lib/{configurator-DAPa7kO6.mjs.map → configurator-BLPGn_Jf.mjs.map} +1 -1
  23. package/lib/{configurator-Tu4gkYAu.js → configurator-DNFinDo-.js} +2 -2
  24. package/lib/{configurator-Tu4gkYAu.js.map → configurator-DNFinDo-.js.map} +1 -1
  25. package/lib/configurator-scene-manager-BGg58f7L.js +2 -0
  26. package/lib/configurator-scene-manager-BGg58f7L.js.map +1 -0
  27. package/lib/{configurator-scene-manager-Dg1niEPb.mjs → configurator-scene-manager-BKQisjHk.mjs} +84 -72
  28. package/lib/configurator-scene-manager-BKQisjHk.mjs.map +1 -0
  29. package/lib/configurator.js +1 -1
  30. package/lib/configurator.nomodule.js +1 -1
  31. package/lib/{continuous-drawing-helper-IfYzzo2J.js → continuous-drawing-helper-BMR1PLYx.js} +2 -2
  32. package/lib/{continuous-drawing-helper-IfYzzo2J.js.map → continuous-drawing-helper-BMR1PLYx.js.map} +1 -1
  33. package/lib/{continuous-drawing-helper-BRhXsKu9.mjs → continuous-drawing-helper-mMQUjv13.mjs} +2 -2
  34. package/lib/{continuous-drawing-helper-BRhXsKu9.mjs.map → continuous-drawing-helper-mMQUjv13.mjs.map} +1 -1
  35. package/lib/{default-light-setting-Cu-QozJN.js → default-light-setting-CEI-Ibbc.js} +2 -2
  36. package/lib/{default-light-setting-Cu-QozJN.js.map → default-light-setting-CEI-Ibbc.js.map} +1 -1
  37. package/lib/{default-light-setting-CMk6tZWX.mjs → default-light-setting-DzvlT557.mjs} +3 -3
  38. package/lib/{default-light-setting-CMk6tZWX.mjs.map → default-light-setting-DzvlT557.mjs.map} +1 -1
  39. package/lib/definitions/common-core/src/rapi-access.d.ts +1 -0
  40. package/lib/definitions/common-core/src/services/global-callback.d.ts +2 -0
  41. package/lib/definitions/common-core/src/utils/common-utils.d.ts +1 -0
  42. package/lib/definitions/common-core/src/view-model/configurator-view-model.d.ts +4 -0
  43. package/lib/definitions/configurator-core/src/services/configurator-ui-callback.d.ts +5 -0
  44. package/lib/definitions/configurator-core/src/webgl/configurator-scene-manager.d.ts +3 -0
  45. package/lib/definitions/homag-intelligence/src/hi-tag-catalog-callbacks.d.ts +20 -0
  46. package/lib/definitions/homag-intelligence/src/homag-intelligence.d.ts +15 -1
  47. package/lib/definitions/homag-intelligence/src/loader.d.ts +1 -1
  48. package/lib/definitions/planner-core/src/roomle-planner.d.ts +2 -0
  49. package/lib/definitions/planner-core/src/services/planner-kernel-access.d.ts +2 -2
  50. package/lib/definitions/typings/external-objects.d.ts +9 -0
  51. package/lib/{glb-viewer-CoRcp1it.mjs → glb-viewer-CRfJISyp.mjs} +6 -6
  52. package/lib/{glb-viewer-CoRcp1it.mjs.map → glb-viewer-CRfJISyp.mjs.map} +1 -1
  53. package/lib/{glb-viewer-CW4kiAoW.js → glb-viewer-D-5Zh8iu.js} +2 -2
  54. package/lib/{glb-viewer-CW4kiAoW.js.map → glb-viewer-D-5Zh8iu.js.map} +1 -1
  55. package/lib/{glb-viewer-camera-behaviour-C3UBK_qg.js → glb-viewer-camera-behaviour-B-1iUjYD.js} +2 -2
  56. package/lib/{glb-viewer-camera-behaviour-C3UBK_qg.js.map → glb-viewer-camera-behaviour-B-1iUjYD.js.map} +1 -1
  57. package/lib/{glb-viewer-camera-behaviour-CvoP6Xzb.mjs → glb-viewer-camera-behaviour-D2qHMKWu.mjs} +2 -2
  58. package/lib/{glb-viewer-camera-behaviour-CvoP6Xzb.mjs.map → glb-viewer-camera-behaviour-D2qHMKWu.mjs.map} +1 -1
  59. package/lib/glb-viewer.js +1 -1
  60. package/lib/glb-viewer.nomodule.js +1 -1
  61. package/lib/{imos-ix-poc-export-helper-xpua69yM.js → imos-ix-poc-export-helper-BgbWS04l.js} +2 -2
  62. package/lib/{imos-ix-poc-export-helper-xpua69yM.js.map → imos-ix-poc-export-helper-BgbWS04l.js.map} +1 -1
  63. package/lib/{imos-ix-poc-export-helper-MGULYQ2d.mjs → imos-ix-poc-export-helper-BrKzvPu6.mjs} +2 -2
  64. package/lib/{imos-ix-poc-export-helper-MGULYQ2d.mjs.map → imos-ix-poc-export-helper-BrKzvPu6.mjs.map} +1 -1
  65. package/lib/{main-CmH0kRDP.js → main-04TgUoiW.js} +42 -42
  66. package/lib/{main-CmH0kRDP.js.map → main-04TgUoiW.js.map} +1 -1
  67. package/lib/{main-BeohK5k5.mjs → main-B9KqFf2R.mjs} +877 -879
  68. package/lib/{main-BeohK5k5.mjs.map → main-B9KqFf2R.mjs.map} +1 -1
  69. package/lib/{material-viewer-By7xDt5f.js → material-viewer-6OT6wsTS.js} +2 -2
  70. package/lib/{material-viewer-By7xDt5f.js.map → material-viewer-6OT6wsTS.js.map} +1 -1
  71. package/lib/{material-viewer-BrYReao0.mjs → material-viewer-DO2eXyfN.mjs} +4 -4
  72. package/lib/{material-viewer-BrYReao0.mjs.map → material-viewer-DO2eXyfN.mjs.map} +1 -1
  73. package/lib/material-viewer.js +1 -1
  74. package/lib/material-viewer.nomodule.js +1 -1
  75. package/lib/planner-D6W4tb_-.js +155 -0
  76. package/lib/planner-D6W4tb_-.js.map +1 -0
  77. package/lib/{planner-C6apY6Bo.mjs → planner-Lp1_Sa3j.mjs} +2040 -977
  78. package/lib/planner-Lp1_Sa3j.mjs.map +1 -0
  79. package/lib/planner.js +1 -1
  80. package/lib/planner.nomodule.js +1 -1
  81. package/lib/roomle-sdk.js +7 -7
  82. package/lib/roomle-sdk.nomodule.js +1 -1
  83. package/lib/{script-loader-gdCes60A.js → script-loader-CT_OImo2.js} +2 -2
  84. package/lib/{script-loader-gdCes60A.js.map → script-loader-CT_OImo2.js.map} +1 -1
  85. package/lib/{script-loader-WY98fiYV.mjs → script-loader-CeVVxl8B.mjs} +2 -2
  86. package/lib/{script-loader-WY98fiYV.mjs.map → script-loader-CeVVxl8B.mjs.map} +1 -1
  87. package/lib/{stats-helper-PgjCdGmN.mjs → stats-helper-AWQXcT4g.mjs} +2 -2
  88. package/lib/{stats-helper-PgjCdGmN.mjs.map → stats-helper-AWQXcT4g.mjs.map} +1 -1
  89. package/lib/{stats-helper-C3P5UOTA.js → stats-helper-EKipvzLy.js} +2 -2
  90. package/lib/{stats-helper-C3P5UOTA.js.map → stats-helper-EKipvzLy.js.map} +1 -1
  91. package/lib/{tools-core-B_Dn7CWq.mjs → tools-core-BDANWqVZ.mjs} +3 -3
  92. package/lib/{tools-core-B_Dn7CWq.mjs.map → tools-core-BDANWqVZ.mjs.map} +1 -1
  93. package/lib/{tools-core-Cv27Qh8I.js → tools-core-CRDdyFZ-.js} +2 -2
  94. package/lib/{tools-core-Cv27Qh8I.js.map → tools-core-CRDdyFZ-.js.map} +1 -1
  95. package/package.json +1 -1
  96. package/lib/configurator-scene-manager-Dg1niEPb.mjs.map +0 -1
  97. package/lib/configurator-scene-manager-DjEghHP7.js +0 -2
  98. package/lib/configurator-scene-manager-DjEghHP7.js.map +0 -1
  99. package/lib/homag-intelligence-B2hIU9jH.mjs +0 -893
  100. package/lib/homag-intelligence-B2hIU9jH.mjs.map +0 -1
  101. package/lib/homag-intelligence-LpViFXPC.js +0 -2
  102. package/lib/homag-intelligence-LpViFXPC.js.map +0 -1
  103. package/lib/planner-C6apY6Bo.mjs.map +0 -1
  104. package/lib/planner-wPfcVW9Q.js +0 -155
  105. package/lib/planner-wPfcVW9Q.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ System.register(["./camera-behaviour-vflerxg2.js","./main-04TgUoiW.js","./main-thread-to-worker-C8MPjAY0.js","./Object3D-BBDnGQZV.js","./default-light-setting-CEI-Ibbc.js"],function(P,be){"use strict";var $,ve,Xe,$e,Qe,Je,et,tt,ye,he,H,W,it,T,Q,nt,st,Me,Oe,ot,J,ce,ee,rt,Pe,at,ht,ct,v,le,lt,dt,Ie,_t,xe,Ee,ut,gt,te,O,mt,p,F,pt,de,ie,De,Se,je,Re,He,Ae,ft,Le,Ct,V,wt,_e,d,bt,ne,y,K,se,vt,yt,Mt,Te,Ot,Ve,Be,ke,Ge,I,Fe,Pt,It,xt,Et,Dt,St,jt,Rt,ue,Ht,At,Lt,Tt,Vt,ze,Ue,Bt,kt,Gt,f,D,u,Ft,ge,zt,Ut,q,z,Nt,Ne,me,Wt;return{setters:[r=>{$=r.O,ve=r.R,Xe=r.c,$e=r.S,Qe=r.P,Je=r.g,et=r.B,tt=r.D,ye=r.C,he=r.F,H=r.b},r=>{W=r.by,it=r.bz,T=r.v,Q=r.$,nt=r.bA,st=r.t,Me=r.Z,Oe=r.a0,ot=r.bB,J=r.w,ce=r.bC,ee=r.bD,rt=r.bE,Pe=r.R,at=r.bF,ht=r.bG,ct=r.bH,v=r.H,le=r.q,lt=r.o,dt=r.bI,Ie=r.br,_t=r.O,xe=r.bJ,Ee=r.bK,ut=r.bL,gt=r.bM,te=r.b6,O=r.W,mt=r.a_,p=r.j,F=r.aK,pt=r.a8,de=r.aO,ie=r.aH,De=r.aN,Se=r.aI,je=r.aA,Re=r.aP,He=r.as,Ae=r.at,ft=r.bN,Le=r.aB,Ct=r.bO,V=r.B,wt=r.bP,_e=r.aq,d=r.V,bt=r.F,ne=r.bQ,y=r.au,K=r.az,se=r.ao,vt=r.bR,yt=r.bS,Mt=r.Q,Te=r.bT,Ot=r.ay,Ve=r.bw,Be=r.bU,ke=r.av,Ge=r.ax,I=r.ar,Fe=r.aR,Pt=r.a1,It=r.bV,xt=r.bW,Et=r.bX,Dt=r.bY,St=r.a2,jt=r.a3,Rt=r.b3,ue=r.be,Ht=r.bf,At=r.a9,Lt=r.bZ,Tt=r.b_,Vt=r.b$,ze=r.bb,Ue=r.c0,Bt=r.b1,kt=r.bv,Gt=r.c1},r=>{f=r.C},r=>{D=r.g,u=r.V,Ft=r.d,ge=r.W,zt=r.v,Ut=r.S,q=r.b,z=r.M,Nt=r.O,Ne=r.R,me=r.D},r=>{Wt=r.D}],execute:function(){const r=(h,e)=>{const t=W.filterAnimationParameters(e);if(t.length!==0)for(const i of h){i.animationValueMap??=new W;for(const n of t)i.animationValueMap.updateParameterValue(n)}},Kt=(h,e,t,i,n,s)=>{h.animationValueMap??=new W;const o=W.getAnimationName(e),a=h.animationValueMap.setValueAndGetOldValue(o,t,i),c=h.animationValueMap.getPriorAnimations(o,i),_=h.animationValueMap.getSequentAnimations(o,i);h.animateMeshes&&h.animateMeshes(o,{from:a,to:t,priorAnimations:c,subsequentAnimations:_},n,s)};class U extends it{static fromStaticObject(e,t=!1){let i={};const n=e.getObject().userData;return n&&(i={...n},n.dimensions&&(i.width=n.dimensions.width,i.height=n.dimensions.height)),new U(i,t)}static fromKernelAttributes(e,t=!1){const i=T(e.position);let n;e.direction&&(n=T(e.direction).multiplyScalar(1e3).add(i));const s={lightPos:i,targetPos:n,color:e.color??"#ffffff",intensity:e.intensity};return e.width&&(s.width=e.width/1e3),e.height&&(s.height=e.height/1e3),new U(s,t)}constructor(e,t){super(16711680,15,4,2),e.intensity&&(this.intensity=e.intensity),e.color&&(typeof e.color=="number"?this.color.setHex(e.color):this.color=new Q(e.color)),e.width&&(this.width=e.width),e.height&&(this.height=e.height),this._initLightSource(e.lightPos,e.targetPos,e.rotation,t)}_initLightSource(e,t,i,n=!1){n&&(this._helper=new nt(this),this._helper.visible=!0,this.add(this._helper)),e&&this.position.set(e.x,e.y,e.z),i?this.rotation.set(i.x,i.y,i.z):t?this.lookAt(t):this.rotation.x=1.57,n&&this._addDebugUI()}updateAttributes(e){const t=T(e.position);if(this.position.copy(t),e.direction){const i=T(e.direction).multiplyScalar(1e3).add(t),n=new st().lookAt(t,i,this.up),s=new Me().setFromRotationMatrix(n);this.rotation.set(s.x,s.y,s.z)}this.matrixWorldNeedsUpdate=!0,e.intensity&&(this.intensity=e.intensity),e.color&&(this.color=new Q(e.color)),e.width&&(this.width=e.width/1e3),e.height&&(this.height=e.height/1e3)}_addDebugUI(){const e=Oe();if(!e)return;const t={color:this.color.getHex(),intensity:this.intensity,width:this.width,height:this.height,positionX:this.position.x,positionY:this.position.y,positionZ:this.position.z,rotationX:this.rotation.x,rotationY:this.rotation.y,rotationZ:this.rotation.z},i=e.addFolder("Rect Area Lamp "+this.id);i.addColor(t,"color").onChange(n=>{this.color.setHex(n)}),i.add(t,"intensity",0,100,.01).onChange(n=>{this.intensity=n}),i.add(t,"width",0,20,.01).onChange(n=>{this.width=n}),i.add(t,"height",0,20,.01).onChange(n=>{this.height=n}),i.add(t,"positionX",-10,10,.001).onChange(n=>{this.position.x=n}),i.add(t,"positionY",-10,10,.001).onChange(n=>{this.position.y=n}),i.add(t,"positionZ",-10,10,.001).onChange(n=>{this.position.z=n}),i.add(t,"rotationX",-Math.PI,Math.PI,.001).onChange(n=>{this.rotation.x=n}),i.add(t,"rotationY",-Math.PI,Math.PI,.001).onChange(n=>{this.rotation.y=n}),i.add(t,"rotationZ",-Math.PI,Math.PI,.001).onChange(n=>{this.rotation.z=n})}}const ci=16755200,li=.9,di=25,_i=11,ui=.6;class oe extends ot{static fromStaticObject(e,t=!1){const i=e.getObject().userData;return new oe(i,t)}static fromKernelAttributes(e,t=!1){const n={lightPos:T(e.position),color:e.color??"#ffffff",intensity:e.intensity,distance:e.distance,decay:e.decay},s=new oe(n,t);return s.shadow.camera.near=.1,s.shadow.camera.far=20,s.shadow.intensity=1,s}constructor(e,t){super(ci,li,di),e.intensity?this.intensity=e.intensity:this.power=_i,e.color&&(typeof e.color=="number"?this.color.setHex(e.color):this.color=new Q(e.color)),e.distance&&(this.distance=e.distance),e.decay&&(this.decay=e.decay),this._initLightSource(e.lightPos,t)}_initLightSource(e,t=!1){t&&be.import("./PointLightHelper-BEyPVHpD.js").then(({PointLightHelper:i})=>{this._helper=new i(this,0),this._helper.visible=!1,this.add(this._helper)}),this.castShadow=!0,this.shadow.intensity=ui,e&&this.position.set(e.x,e.y,e.z),this.update(),t&&this._addDebugUI()}update(e=J.HIGHEST){this._helper?.update(),e===J.HIGH||e===J.HIGHEST?(this.visible=!0,this.castShadow=!0,this.shadow.mapSize.x=512,this.shadow.mapSize.y=512):e===J.MEDIUM?(this.visible=!0,this.castShadow=!1,this.shadow.mapSize.x=0,this.shadow.mapSize.y=0):(this.visible=!1,this.castShadow=!1,this.shadow.mapSize.x=0,this.shadow.mapSize.y=0)}updateAttributes(e){const t=T(e.position);this.position.copy(t),this.matrixWorldNeedsUpdate=!0,e.intensity&&(this.intensity=e.intensity),e.color&&(this.color=new Q(e.color)),e.distance&&(this.distance=e.distance),e.decay&&(this.decay=e.decay)}_addDebugUI(){const e=Oe();if(!e)return;const t={color:this.color.getHex(),intensity:this.intensity,distance:this.distance,decay:this.decay,power:this.power,positionX:this.position.x,positionY:this.position.y,positionZ:this.position.z,shadows:!0},i=e.addFolder("Lamp "+this.id);i.addColor(t,"color").onChange(n=>{this.color.setHex(n)}),i.add(t,"intensity",0,100,.01).onChange(n=>{this.intensity=n,this.update()}),i.add(t,"distance",0,100,.01).onChange(n=>{this.distance=n,this.update()}),i.add(t,"decay",0,2,.01).onChange(n=>{this.decay=n,this.update()}),i.add(t,"power",0,100,.01).onChange(n=>{this.power=n,this.update()}),i.add(t,"positionX",-10,10,.01).onChange(n=>{this.position.x=n,this.update()}),i.add(t,"positionY",-10,10,.01).onChange(n=>{this.position.y=n,this.update()}),i.add(t,"positionZ",-10,10,.01).onChange(n=>{this.position.z=n,this.update()}),i.add(t,"shadows").onChange(n=>{this.castShadow=n,this.update()})}}const gi=h=>{switch(h.type.value){case ce.SPOT:return ee.fromKernelAttributes(h);case ce.POINT:return oe.fromKernelAttributes(h);case ce.AREA:return U.fromKernelAttributes(h)}return null};class mi{constructor(e,t){this._lightSourceId=e,this._light=t}get lightSourceId(){return this._lightSourceId}addToScene(e){e.add(this._light)}removeFromScene(){this._light.removeFromParent(),this._light.dispose()}updateLightSource(e){this._light instanceof ee?this._light.updateAttributes(e):this._light instanceof oe?this._light.updateAttributes(e):this._light instanceof U&&this._light.updateAttributes(e)}}class pi{constructor(e,t,i,n,s){this._currentAnimation=null,this._id=e,this._previewComponent=t,this._displacedComponent=i,this._displacementTransformation=rt(n.displacedChildTransform),this._addObjectAnimationTransformations(),this._addObjectAnimationValue(),this._invalidateRenderCallback=s}_addObjectAnimationTransformations(){const e=new Map;e.set(this._id+":open",{matrix:this._displacementTransformation,visible:!0,initial:!1}),$.addObjectAnimations(this._displacedComponent,e,this._previewComponent)}_addObjectAnimationValue(){this._previewComponent.animationValueMap??=new W,this._previewComponent.animationValueMap.setValue(this._id,"close",0)}startInsert(){this.endInsert(),this._changeAnimation("open",!0)}endInsert(){this._currentAnimation?.stop(),this._changeAnimation("closed",!1),this._displacedComponent.userData?.transform&&delete this._displacedComponent.userData.transform}cleanUp(){this.endInsert(),$.removeObjectAnimations(this._displacedComponent,this._id+":open")}_changeAnimation(e,t){if(!this._previewComponent.animationValueMap)return;const i=this._previewComponent.animationValueMap.setValueAndGetOldValue(this._id,e,0);i!==e&&(this._currentAnimation=$.animateObject(this._displacedComponent,this._id,{from:i,to:e,priorAnimations:[],subsequentAnimations:[]},t,this._invalidateRenderCallback))}}var fi=Object.defineProperty,pe=(h,e,t,i)=>{for(var n=void 0,s=h.length-1,o;s>=0;s--)(o=h[s])&&(n=o(e,t,n)||n);return n&&fi(e,t,n),n};class Y{constructor(e){this._mergeThreshold=3,this._componentsToMerge=new Ci,this._mergeInProgress=!1,this._externalConfigurations=new Map,this._components=new Map,this._previews=new Map,this._componentNumberOfPossibleChildren=new Map,this._creator_=e,this._getKernelAccess().addConfiguratorListener(this),this._componentFactory=ve()}get materialQueue(){return this.getMeshGenerator().materialQueue}_getKernelAccess(){return Pe.lookup("planner-kernel-access",this._creator_)}_applyMeshTransform(e,t,i,n,s,o,a){if(n){const c=t.userData.transform=at(n);i&&(t.userData.transform=c),t.applyMatrix4(c)}this._applyMeshUVTransform(t,i,s,a),$.setObjectAnimations(t,o,this.getComponent(e))}_applyMeshUVTransform(e,t,i,n){if(i?.length===6&&!ht(i)){const s=ct(i);t&&(t.uvTransform=s);const o=n??e.geometry;if(o&&o.attributes.uv){const a=o.clone();a.attributes.uv.applyMatrix4(s),e.geometry=a}}else t&&(t.uvTransform=void 0),n&&(e.geometry=n)}updateAnimationParameters(e,t){const i=(Array.isArray(e)?e:[e]).map(n=>this.getComponentFromElementId(n)).filter(n=>!!n);r(i,t)}changeAnimationValue(e,t,i,n,s,o){const a=this.getComponentFromElementId(e);a&&(s?a.traverse(c=>{c.id&&Kt(c,t,i,n,o,this._invalidateRenderCallback)}):Kt(a,t,i,n,o,this._invalidateRenderCallback))}saveExternalConfiguration(e){this._externalConfigurations.set(e.id,e)}getExternalConfigurationById(e){return this._externalConfigurations.get(e)}getComponentFromElementId(e){let t=this.getComponent(e);if(!t){const i=this._getKernelAccess().kernelInstance.getRootPlanComponentIdFromObjectId(e);t=this.getComponent(i)}return t||console.warn("component not found!",e),t}_addMeshToSubPart(e,t,i,n,s,o,a,c,_,l,w){const g=this._generateMesh(e,t,i,o,a,c,_,void 0,void 0,l);this._applyMeshTransform(e,g,null,n,s,w),this._subPartObject.add(g)}_addMeshToComponent(e,t,i,n,s,o,a,c,_,l,w,g,L){if(this._subPartGuard&&this._subPartGuard.info===e){this._addMeshToSubPart(e,null,n,null,null,a,c,_,l,g,L);return}const C=this.getComponent(e);if(!C)return;const M=this._componentFactory.isPreview(C),m=this._generateMesh(e,i,M?null:n,a,c,_,l,void 0,void 0,g);m.userData.meshId=t,m.userData.geometryId=i,m.userData.materialId=n,this._applyMeshTransform(e,m,m.userData,s,o,L),M&&m.layers.set(v.PREVIEW),C&&C.addMesh(m),C.meshes.length>this._mergeThreshold&&this._componentsToMerge.set(e,C.meshes.length)}_changeMeshOfComponent(e,t,i,n,s,o,a,c){const _=this.getComponent(e);if(!_)return;const l=_.getMeshById(t);if(l){l.userData.geometryId!==i&&console.warn("Geometry of mesh has changed!"),l.userData.materialId=n,l.userData.materialAttributes=a;const w=l.material.clone();this._configuratorMeshGenerator.setMaterial(l,n,void 0,a).then(()=>{this._requestRenderSceneUpdateCallback&&this._requestRenderSceneUpdateCallback()}),w.opacity!==l.material.opacity&&this._requestRenderCallback&&this._requestRenderCallback(),s&&(l.position.set(0,0,0),l.scale.set(1,1,1),l.rotation.set(0,0,0));const g=this._configuratorMeshGenerator.getGeometry(i);this._applyMeshTransform(e,l,l.userData,s,o,c,g)}}_removeMeshFromComponent(e,t){const i=this.getComponent(e);i&&i.removeMeshById(t)}_removeLightSourceFromComponent(e,t){const i=this.getComponent(e);i&&i.removeLightSourceById(t)}_addLightSourceToComponent(e,t,i){const n=this.getComponent(e);if(!n||this._componentFactory.isPreview(n))return;const o=gi(i);if(!o)return;const a=new mi(t,o);n.addLightSource(a)}_changeLightSourceOfComponent(e,t,i){const n=this.getComponent(e);if(!n)return;const s=n.getLightSourceById(t);if(!s){this._addLightSourceToComponent(e,t,i);return}s.updateLightSource(i)}getComponent(e){let t=this._components.get(e);return!t&&(t=this._previews.get(e.toString()),!t)?null:t}getNumberOfPossibleChildrenForComponent(e){if(this._componentNumberOfPossibleChildren.has(e))return this._componentNumberOfPossibleChildren.get(e);const t=this._getKernelAccess().kernelInstance.getPlanComponentPossibleChildren(e).length;return this._componentNumberOfPossibleChildren.set(e,t),t}tryToMergeComponents(){this._initData.moc||this._mergeInProgress||(this._mergeInProgress=!0,console.log("start merging geometries",this._componentsToMerge.size),this._requestMergeComponents())}_requestMergeComponents(){window.requestIdleCallback(this._mergeNextComponent.bind(this))}_mergeNextComponent(){if(this._componentsToMerge.size>0){const e=this._componentsToMerge.largestValue();this._componentsToMerge.delete(e),this._mergeComponent(e),this._requestMergeComponents()}else this._mergeInProgress=!1,this._geometriesMerged&&this._geometriesMerged(),console.log("finished merging geometries"),this._components.forEach(e=>{e.loadingMesh&&console.warn("component still has loading mesh: ",e.hash)})}_mergeComponent(e){const t=this._components.get(e);if(!(!t||t.meshes.length<=this._mergeThreshold))if(this._cacheHolder.componentCache.has(t.hash)){const i=this._cacheHolder.componentCache.get(t.hash).meshes;t.replaceMeshes(i)}else{const i=new Map,n=[],s=[];t.meshes.forEach(o=>{const a=o.userData.materialId;if(!a){console.warn("mesh has no material id set");return}if(!i.has(a)){const l=new le(new lt,o.material);l.userData.materialId=a,l.receiveShadow=!0,l.castShadow=!0,l.layers.set(v.OBJECT),this._setMaterial(l,a),n.push(l),i.set(a,l)}const c=i.get(a),_=c.geometry;o.userData.transform&&o.geometry.applyMatrix4(o.userData.transform),c.geometry=dt([_,o.geometry]),s.push(o)}),n.forEach(o=>t.addMesh(o)),s.forEach(o=>t.removeMesh(o)),this._cacheHolder.componentCache.set(t.hash,t)}}_addComponent(e){this._listener&&e.isRootComponent&&this._listener.display(e)}removeDockingComponent(){this._getKernelAccess().requestDeleteComponent(this._configuratorContext.dockingRootComponentId),this._configuratorContext.dockingRootComponentId=null}dockComponent(e,t,i,n,s){const o=this._components.get(i),a=this._components.get(e);a&&(a.roomlePosition=n,a.roomleRotation=s,o&&o.add(a),a.parentObjectId=i,a.isRootComponent=t,this._addComponent(a))}dockComponentWithPosition(e,t){const i=this._components.get(e.parentId);let n;t?n=t.getKernelPosition(i):n=e.getKernelPosition(i),Ie.start("dock_component_with_position_"+e.childId),this._getKernelAccess().dockComponentWithPosition(e.parentId,e.parentDockId,e.childId,e.childDockId,n),this._configuratorContext.dockingRootComponentId=null}removePreviews(){this._previews.size>0&&(this._previews.forEach(e=>{e.dockInsertAnimation?.cleanUp(),e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear())}_updatePlanObject(e,t){const i=this._components.get(e.rootPlanComponentId);let n=!0;i&&(n=i.geometryChanged),this._listener&&this._listener.planObjectUpdated(e,n,t)}Editor3dAddDockPreview(e,t){const i=this._componentFactory.createPreview(t,e,this._creator_);this._previews.set(t.toString(),i)}Editor3dAddMesh(e,t,i,n,s,o){this._addMeshToComponent(e,t,i,s.materialId,s.transform,s.uvTransform,o.vertices,o.indices,o.uvCoords,o.normals,n,s.materialAttributes,s.animations)}Editor3ChangedMesh(e,t,i,n){this._changeMeshOfComponent(e,t,i,n.materialId,n.transform,n.uvTransform,n.materialAttributes,n.animations)}Editor3dRemoveMesh(e,t){this._removeMeshFromComponent(e,t)}Editor3dRemoveLightSource(e,t){this._removeLightSourceFromComponent(e,t)}Editor3dAddLightSource(e,t,i){this._initData.featureFlags.interiorLights&&this._addLightSourceToComponent(e,t,i)}Editor3dChangedLightSource(e,t,i){this._initData.featureFlags.interiorLights&&this._changeLightSourceOfComponent(e,t,i)}Editor3dBeginConstruction(e,t){if(!t){const i=this._components.get(e);i&&i.removeAllMeshes()}this._subPartGuard&&e===this._subPartGuard.info&&(this._subPartObject=new _t)}Editor3dComponentCreated(e,t,i,n,s){n&&(this._configuratorContext.rootComponentId=e);let o=null;this._components.has(e)?(o=this._components.get(e),o.removeAllMeshes()):(o=this._componentFactory.create(e,t,i,s,n),o.layers.set(v.OBJECT)),this._components.set(e,o),this._addComponent(o)}Editor3dComponentDocked(e,t,i,n,s){this.dockComponent(e,t,i,n,s)}Editor3dEndConstruction(e){if(this._subPartGuard&&this._subPartGuard.info===e){this._subPartGuard.resolve(this._subPartObject);return}const t=this._getKernelAccess().kernelInstance.getComponent(e),i=this._components.get(e);i&&(i.computeBoundingBox(t.boxForMeasurement),i.boundingBoxMesh&&this._listener&&this._listener.addComponentHandlers(i));const n=this._previews.get(e.toString());n&&n.computeBoundingBox(t.boxForMeasurement,!0)}Editor3dGeometryReady(e){const t=this._components.get(e);t&&t.loadingFinished()}Editor3dGeometryNotReady(e){const t=this._components.get(e);t&&t.loading()}Editor3dPlanObjectConstructionDone(e){const t=this._getKernelAccess().kernelInstance.getPlanObject(e),i=this._getKernelAccess().kernelInstance.getFullPartList(),n=this._getKernelAccess().kernelInstance.getHashOfConfiguration(e),s=this._getKernelAccess().kernelInstance.getComponentId(t.rootPlanComponentId),o=[t,i,n,s];xe.finishOperation(Ee.KERNEL_PLAN_OBJECT_CONSTRUCTION_DONE,o),this._updatePlanObject(t,!1),this._listener&&this._listener.planObjectConstructionDone(t)}Editor3dPreviewConstructionDone(e,t){let i=!1;this._previews.forEach(n=>{n.parent!==null&&(this._listener&&(this._componentFactory.isPreviewLine(n)?this._listener.addPreviewLineHandlers(n):this._listener.addPreviewHandlers(n)),i=!0)}),this._listener&&this._listener.previewConstructionDone(this._components.get(e),i)}Editor3dSetPreviewLineAssociations(e,t){const i=this._previews.get(t.toString());if(i.clear(),!i)return;const n=this._componentFactory.createPreviewLine(i,this._creator_),s=this._components.get(this._configuratorContext.rootComponentId);for(let o=0;o<e.length;o++){let a;o===0?a=n:a=n.clonePreviewLine(o),a.name="Preview Line",a.parentDockId=e[o].parentDockId,a.parentId=e[o].parentId,a.childDockId=e[o].childDockId,a.childId=e[o].childId,a.docklineRotation=ut(e[o].rotation),a.roomlePosition=e[o].position,a.roomleLineFrom=e[o].lineFrom,a.roomleLineTo=e[o].lineTo,a.lineSegments=[];for(const c of e[o].lineSegments)a.lineSegments.push({from:c.from/1e3,to:c.to/1e3});a.roomlePositionFrom=e[o].positionFrom,a.roomlePositionTo=e[o].positionTo,s.add(a),a.preparePreview(),this._previews.set(a.stringId,a)}}Editor3dSetPreviewPointAssociations(e,t){const i=this._previews.get(t.toString());if(!i)return;const n=this._components.get(this._configuratorContext.rootComponentId);for(let s=0;s<e.length;s++){let o;s===0?o=i:(o=i.clonePreview(s),this._previews.set(o.stringId,o)),o.name="Preview Point",o.parentDockId=e[s].parentDockId,o.parentId=e[s].parentId,o.childDockId=e[s].childDockId,o.childId=e[s].childId,o.preparePreview(),o.receivedPointAssociation=!0,o.userData.ignoreComponentRaycast=!0,this._addDockPreviewAnimation(o,t.toString()+"_"+s,e[s]),n.add(o);const a=e[s].position;o.roomlePosition=a,o.roomleRotation=e[s].rotation,o.startPulsating()}}_addDockPreviewAnimation(e,t,i){if(!this._initData.featureFlags?.advancedDocking)return;const n=this._components.get(i.displacedChildId);n&&(e.dockInsertAnimation=new pi(t,e,n,i,this._invalidateRenderCallback))}componentDeleted(e){const t=this._components.get(e);t&&(this._listener&&this._listener.componentDeleted(t),t.removeFromParent(),t.removeAllMeshes(),this._components.delete(e))}componentMetaUpdated(e){const t=this._getRuntimeComponent(e.id);t&&(t.hash=e.hash,t.roomlePosition=e.position,t.roomleRotation=e.rotation,e.boxForMeasurement&&t.computeBoundingBox(e.boxForMeasurement),this._listener&&this._listener.componentUpdated(t,e))}componentConfigurationUpdated(e,t){const i=this._getRuntimeComponent(e);i&&(i.geometryChanged=t)}_getRuntimeComponent(e){let t=this._components.get(e);return!t&&(t=this._previews.get(e.toString()),!t)?null:t}configurationLoaded(e,t,i,n,s){e===gt&&(this._configuratorContext.dockingRootComponentId=i);const o=t===0;o?this._getKernelAccess().kernelInstance.requestPlanComponentConstructionRecursive(i):this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(t);const a=this._getKernelAccess().kernelInstance.getComponent(i),c=this._components.get(i);c&&(c.computeBoundingBox(a.boxForMeasurement),c.hash=a.hash),this._listener&&this._listener.configurationLoaded(c,o&&c.boundingBoxMesh!==void 0)}finishParameterChange(e,t){this.materialQueue.registerCallback(e)}planObjectConfigurationUpdated(e,t,i,n){const s=this._getKernelAccess().kernelInstance.getPlanObject(e);this._updatePlanObject(s,n)}planObjectCreated(e,t){this._configuratorContext.planObjectId=t,this._listener&&this._listener.clearScene()}planObjectUpdated(e,t){this._updatePlanObject(e,t)}sceneCleared(){this._components.forEach(function(e){e.removeFromParent(),e.removeAllMeshes()}),this._components.clear(),this._componentNumberOfPossibleChildren.clear(),this._previews.forEach(e=>{e.removeFromParent(),e.removeAllMeshes()}),this._previews.clear()}setListener(e){this._listener=e}getBoundingBox(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxForMeasurement)return te(e.boxForMeasurement)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return new O().setFromObject(e)}return null}getBoundingBoxOfGeometry(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxOfGeometry)return te(e.boxOfGeometry)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return new O().setFromObject(e)}return null}getBoundingBoxWithPreviews(){const e=this._components.get(this._configuratorContext.rootComponentId);return e?new O().setFromObject(e):null}hasPreviews(){return this._previews.size>0}clearRootComponent(){this._components.get(this._configuratorContext.rootComponentId)?.hoverOff()}debugSceneGraph(e){if(e){this._components.has(e)?console.log(this._components.get(e)):this._previews.has(e.toString())&&console.log(this._previews.get(e.toString()));return}console.log(this._configuratorContext)}getComponentsForIds(e){const t=[];return e.forEach(i=>{const n=this._components.get(i);n&&t.push(n)}),t}getComponents(){return Array.from(this._components.values())}getPreviews(){return Array.from(this._previews.values())}hasPreviewLines(){for(const e of this._previews.values())if(this._componentFactory.isPreviewLine(e))return!0;return!1}isPreviewLine(e){return this._componentFactory.isPreviewLine(e)}isPreview(e){return this._componentFactory.isPreview(e)}setGeometriesMergedListener(e){this._geometriesMerged=e}removeGeometriesMergedListener(){this._geometriesMerged=void 0}setMergeThreshold(e){this._mergeThreshold=e}_generateMesh(e=0,t=null,i,n,s,o,a,c,_,l){return this._configuratorMeshGenerator.generateMesh(e,t,i,n,s,o,a,!1,l)}_setMaterial(e,t,i){this._configuratorMeshGenerator.setMaterial(e,t)}constructComponents(e){this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(e)}requestSubPartConstruction(e){return this._subPartGuard=new mt(e),this._getKernelAccess().requestPlanComponentConstruction(e,!1),this._subPartGuard.wait()}getMeshGenerator(){return this._configuratorMeshGenerator}setRequestRenderCallback(e){this._requestRenderCallback=e}setRequestRenderSceneUpdateCallback(e){this._requestRenderSceneUpdateCallback=e}setInvalidateRenderCallback(e){this._invalidateRenderCallback=e}}P("a",Y),pe([p],Y.prototype,"_configuratorMeshGenerator"),pe([p],Y.prototype,"_configuratorContext"),pe([p],Y.prototype,"_cacheHolder"),pe([p],Y.prototype,"_initData");class Ci extends Map{largestValue(){let e=this.entries().next().value[0],t=0;return this.forEach((i,n)=>{i>t&&(e=n,t=i)}),e}}class S{constructor(e=0,t=0,i=0,n=1){S.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,n=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*n+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*n+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*n+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*n+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,s;const c=e.elements,_=c[0],l=c[4],w=c[8],g=c[1],L=c[5],C=c[9],M=c[2],m=c[6],X=c[10];if(Math.abs(l-g)<.01&&Math.abs(w-M)<.01&&Math.abs(C-m)<.01){if(Math.abs(l+g)<.1&&Math.abs(w+M)<.1&&Math.abs(C+m)<.1&&Math.abs(_+L+X-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const G=(_+1)/2,E=(L+1)/2,we=(X+1)/2,ri=(l+g)/4,ai=(w+M)/4,hi=(C+m)/4;return G>E&&G>we?G<.01?(i=0,n=.707106781,s=.707106781):(i=Math.sqrt(G),n=ri/i,s=ai/i):E>we?E<.01?(i=.707106781,n=0,s=.707106781):(n=Math.sqrt(E),i=ri/n,s=hi/n):we<.01?(i=.707106781,n=.707106781,s=0):(s=Math.sqrt(we),i=ai/s,n=hi/s),this.set(i,n,s,t),this}let k=Math.sqrt((m-C)*(m-C)+(w-M)*(w-M)+(g-l)*(g-l));return Math.abs(k)<.001&&(k=1),this.x=(m-C)/k,this.y=(w-M)/k,this.z=(g-l)/k,this.w=Math.acos((_+L+X-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=D(this.x,e.x,t.x),this.y=D(this.y,e.y,t.y),this.z=D(this.z,e.z,t.z),this.w=D(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=D(this.x,e,t),this.y=D(this.y,e,t),this.z=D(this.z,e,t),this.w=D(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(D(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}P("V",S);const We=new u,wi=new u,bi=new Ft;class Z{constructor(e=new u(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const n=We.subVectors(i,t).cross(wi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(We),n=this.normal.dot(i);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/n;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||bi.getNormalMatrix(e),n=this.coplanarPoint(We).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const N=new Ut,fe=new u;class vi{constructor(e=new Z,t=new Z,i=new Z,n=new Z,s=new Z,o=new Z){this.planes=[e,t,i,n,s,o]}set(e,t,i,n,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(n),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=ge){const i=this.planes,n=e.elements,s=n[0],o=n[1],a=n[2],c=n[3],_=n[4],l=n[5],w=n[6],g=n[7],L=n[8],C=n[9],M=n[10],m=n[11],X=n[12],k=n[13],G=n[14],E=n[15];if(i[0].setComponents(c-s,g-_,m-L,E-X).normalize(),i[1].setComponents(c+s,g+_,m+L,E+X).normalize(),i[2].setComponents(c+o,g+l,m+C,E+k).normalize(),i[3].setComponents(c-o,g-l,m-C,E-k).normalize(),i[4].setComponents(c-a,g-w,m-M,E-G).normalize(),t===ge)i[5].setComponents(c+a,g+w,m+M,E+G).normalize();else if(t===zt)i[5].setComponents(a,w,M,G).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),N.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),N.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(N)}intersectsSprite(e){return N.center.set(0,0,0),N.radius=.7071067811865476,N.applyMatrix4(e.matrixWorld),this.intersectsSphere(N)}intersectsSphere(e){const t=this.planes,i=e.center,n=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const n=t[i];if(fe.x=n.normal.x>0?e.max.x:e.min.x,fe.y=n.normal.y>0?e.max.y:e.min.y,fe.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(fe)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Ke=new z,qt=new u,Yt=new u;class yi{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new q(512,512),this.map=null,this.mapPass=null,this.matrix=new z,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new vi,this._frameExtents=new q(1,1),this._viewportCount=1,this._viewports=[new S(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;qt.setFromMatrixPosition(e.matrixWorld),t.position.copy(qt),Yt.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Yt),t.updateMatrixWorld(),Ke.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ke),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ke)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Mi extends Nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new z,this.projectionMatrix=new z,this.projectionMatrixInverse=new z,this.coordinateSystem=ge}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const B=new u,Zt=new q,Xt=new q;class Oi extends Mi{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ne*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(me*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ne*2*Math.atan(Math.tan(me*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){B.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(B.x,B.y).multiplyScalar(-e/B.z),B.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(B.x,B.y).multiplyScalar(-e/B.z)}getViewSize(e,t){return this.getViewBounds(e,Zt,Xt),t.subVectors(Xt,Zt)}setViewOffset(e,t,i,n,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(me*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,s=-.5*n;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,_=o.fullHeight;s+=o.offsetX*n/c,t-=o.offsetY*i/_,n*=o.width/c,i*=o.height/_}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const $t=new z,re=new u,qe=new u;class Pi extends yi{constructor(){super(new Oi(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new q(4,2),this._viewportCount=6,this._viewports=[new S(2,1,1,1),new S(0,1,1,1),new S(3,1,1,1),new S(1,1,1,1),new S(3,0,1,1),new S(1,0,1,1)],this._cubeDirections=[new u(1,0,0),new u(-1,0,0),new u(0,0,1),new u(0,0,-1),new u(0,1,0),new u(0,-1,0)],this._cubeUps=[new u(0,1,0),new u(0,1,0),new u(0,1,0),new u(0,1,0),new u(0,0,1),new u(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,n=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),re.setFromMatrixPosition(e.matrixWorld),i.position.copy(re),qe.copy(i.position),qe.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(qe),i.updateMatrixWorld(),n.makeTranslation(-re.x,-re.y,-re.z),$t.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix($t)}}const Qt=1;class Ii extends F{constructor(){super(),this.children=[],this._availableShadowMaps=[],this._lightsOn=!0;for(let e=0;e<Qt;e++){const t=new pt(90,1,.5,500),i=new Pi(t);i.mapSize.width=512,i.mapSize.height=512,this._availableShadowMaps.push(i)}}get lightsOn(){return this._lightsOn}add(...e){for(const t of e){const i=this.children.length;if(this._availableShadowMaps.length>0){const n=this._availableShadowMaps[i%Qt];t.shadow=n,t.castShadow=!1,n.camera.position.copy(t.position)}}return super.add(...e),this}toggleAllLights(e){this._lightsOn=e;for(const t of this.children)t.visible=e}}var xi=Object.defineProperty,Jt=(h,e,t,i)=>{for(var n=void 0,s=h.length-1,o;s>=0;s--)(o=h[s])&&(n=o(e,t,n)||n);return n&&xi(e,t,n),n};const ei="Construction",Ei="Ceiling",Di="Floor",Si=1,ji=P("G","Ceiling Lights"),Ri="Measurement Line",Hi="Wall Attics";class Ye extends Y{constructor(e){super(e),this._configurablePlanObjectViewModels=[],this._configurableConstructionPlanObjectViewModels=[],this._staticPlanObjectViewModels=[],this._constructionPlanObjectViewModels=[],this._wallPlanObjectViewModels=[],this._measurementLinePlanObjectViewModels=[],this._wallAtticsPlanObjectViewModels=[],this._floorPlanObjectViewModels=[],this._nodePlanObjectViewModels=[],this._constructionGroup=new F,this._constructionGroup.name=ei,this._ceilingGroup=new F,this._ceilingGroup.name=Ei,this._floorGroup=new F,this._floorGroup.name=Di,this._ceilingLightsGroup=new Ii,this._ceilingLightsGroup.name=ji,this._measurementLineGroup=new F,this._measurementLineGroup.name=Ri,this._wallAtticsGroup=new F,this._wallAtticsGroup.name=Hi,this._getKernelAccess().addPlannerListener(this)}get latestWallPlanObjectViewModel(){return this._latestWallPlanObjectViewModel}get latestNodePlanObjectViewModel(){return this._latestNodePlanObjectViewModel}startedDrawing(){}stoppedDrawing(){}planBoundsChanged(){}setReference(e){this._coreReference=e.clone()}clearReference(){this._coreReference.delete(),this._coreReference=null}getCorePlan(){return this._coreReference}addPlanElementViewModel(e){e instanceof de?this._handleConfiguratorConstructionPlanObjectViewModel(e):e instanceof ie?this._handleConfiguratorPlanObjectViewModel(e):e instanceof De?this._handleConstructionPlanObjectViewModel(e):e instanceof Se?this._handleStaticPlanObjectViewModel(e):e instanceof je?this._handleMeasurementLinePlanElementViewModel(e):e instanceof Re?this._handleWallAtticPlanElementViewModel(e):e instanceof He?this._handleWallPlanElementViewModel(e):e instanceof Ae?this._handleFloorPlanElementViewModel(e):e instanceof ft?this._handleCeilingPlanElementViewModel(e):e instanceof Le&&this._handleNodePlanElementViewModel(e)}_handleConfiguratorPlanObjectViewModel(e){this._configurablePlanObjectViewModels.push(e),this._linkPlanObjectViewModelAndComponent(e)}_linkPlanObjectViewModelAndComponent(e){const t=e.getConfigurationRuntimeId();if(t>0){for(const i of this._components.values())if(i.parentObjectId===t||i.runtimeId===t){this._addComponent(i);break}}}_detachPlanObjectViewModelFromComponent(e){const t=e.getConfigurationRuntimeId();if(t>0){for(const i of this._components.values())if(i.parentObjectId===t||i.runtimeId===t){i.isChildPlanObject=!1;break}}}_handleConfiguratorConstructionPlanObjectViewModel(e){e.setTopView(this._cameraType===f.CAMERA_2D),this._configurableConstructionPlanObjectViewModels.push(e)}_handleConstructionPlanObjectViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(e),e.setTopView(this._cameraType===f.CAMERA_2D),this._constructionPlanObjectViewModels.push(e)}_handleStaticPlanObjectViewModel(e){this._staticPlanObjectViewModels.push(e),this.commonHandlerForEditableAndTopView(e)}_handleMeasurementLinePlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addMeasurementLineHandlers(e),e.setTopView(this._cameraType===f.CAMERA_2D),e.getPoint1Draggable().scale.setScalar(this._nodeZoom),e.getPoint2Draggable().scale.setScalar(this._nodeZoom),this._measurementLinePlanObjectViewModels.push(e),this._measurementLineGroup.add(e.getContainer())}_handleWallAtticPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallAtticHandlers(e),e.setTopView(this._cameraType===f.CAMERA_2D),this._wallAtticsPlanObjectViewModels.push(e),this._wallAtticsGroup.add(e.getContainer())}_handleWallPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView(this._cameraType===f.CAMERA_2D),this._wallPlanObjectViewModels.push(e),this._latestWallPlanObjectViewModel=e,this._constructionGroup.add(e.getContainer())}_handleFloorPlanElementViewModel(e){const t=e.getContainer();t.name="Floor",this._initData.edit&&this._plannerSceneEventHandler.addFloorHandlers(e),this._floorPlanObjectViewModels.push(e),this._floorGroup.add(t)}_handleCeilingPlanElementViewModel(e){this._ceilingGroup.add(e.getContainer())}_handleNodePlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addNodeHandlers(e),e.setTopView(this._cameraType===f.CAMERA_2D),e.setZoom(this._nodeZoom),this._nodePlanObjectViewModels.push(e),this._latestNodePlanObjectViewModel=e,this._constructionGroup.add(e.getContainer())}_getCeilingLightsDistribution(){const e=this._getKernelAccess().planInteractionHandler.getPlan();if(!e)return[];const t=this._getKernelAccess().planModelViewHelper.calculateLightSourceDistribution(e,{lightSourceAreaInSquareMeters:90,minimumRoomSizeInSquareMeters:7,maximumNumberOfLightSources:8}),i=[];for(let n=0;n<t.size();n++){const s=t.get(n);for(let o=0;o<s.positionsInPlan.size();o++)i.push(T(s.positionsInPlan.get(o)))}return i}handleInitialLights(e,t){if(!(this._ceilingLightsGroup.children.length>0))for(let n=0;n<Si;n++){const s=new Ct(this._initData.debug,t);s.position.set(0,0,0),s.intensity=0,this._ceilingLightsGroup.add(s)}}handleCeilingLights(){if(!this._ceilingLightsGroup.lightsOn)return;const e=this._ceilingLightsGroup.children,t=this._getCeilingLightsDistribution();let i=0;for(let s=0;s<e.length;s++)e[s].power=0,s<t.length&&(e[s].position.copy(t[s]),e[s].position.y-=.1,e[s].power=1,i++);const n=e.filter(s=>s.power>0);for(const s of n)s.recalculatePower(i)}handleLampLight(e,t){const i=e.getObject(),{targetPos:n,lightPos:s,color:o,decay:a,intensity:c,active:_}=t;i.userData={...i.userData,targetPos:n,lightPos:s,color:o,decay:a,intensity:c};const l=ee.fromStaticObject(e,this._initData.debug);_===!1&&(l.visible=!1),i.add(l)}handleRectLampLight(e,t){const i=e.getObject(),{dimensions:n,lightPos:s,color:o,rotation:a,active:c}=t;i.userData={...i.userData,dimensions:n,lightPos:s,color:o,rotation:a};const _=U.fromStaticObject(e,this._initData.debug);c===!1&&(_.visible=!1),i.add(_)}toggleCeilingLights(e,t){if(t)if(this._ceilingLightsGroup.toggleAllLights(e),e)this.handleCeilingLights();else for(const i of this._ceilingLightsGroup.children)i.power=0}commonHandlerForEditableAndTopView(e){this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e),e.setTopView(this._cameraType===f.CAMERA_2D)}dockComponent(e,t,i,n,s){this._plannerSceneEventHandler?.cancelSelection("dock_component"),super.dockComponent(e,t,i,n,s)}_addComponent(e){const t=e.isRootComponent?e.parentObjectId:e.runtimeId,i=this._getPlanObjectViewModelForRuntimeId(t);i&&i instanceof ie&&(e.isRootComponent?i.addRootComponent(e):i.addChildEntityComponent(e),this._initData.edit&&(i instanceof de?this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(i):this._plannerSceneEventHandler.addPlanObjectHandlers(i)),i.hidePreviewBox())}_getPlanObjectViewModelForRuntimeId(e){let t=null;return[...this._configurableConstructionPlanObjectViewModels,...this._configurablePlanObjectViewModels].forEach(i=>{e===i.getConfigurationRuntimeId()&&(t=i)}),t}getConfigurablePlanObjectForId(e){for(const t of[...this._configurableConstructionPlanObjectViewModels,...this._configurablePlanObjectViewModels])if(e===t.getId())return t;return null}getStaticPlanObjectForId(e){for(const t of this._staticPlanObjectViewModels)if(e===t.getId())return t;return null}getConstructionObjectForId(e){for(const t of this._constructionPlanObjectViewModels)if(e===t.getId())return t;return null}getStaticPlanObjectViewModelForId(e){const t=this.getStaticPlanObjectForId(e);return t||this.getConstructionObjectForId(e)}getPlanObjectForId(e){const t=this.getConfigurablePlanObjectForId(e);if(t)return t;const i=this.getStaticPlanObjectForId(e);if(i)return i;for(const n of this._nodePlanObjectViewModels)if(e===n.getId())return n;for(const n of this._wallPlanObjectViewModels)if(e===n.getId())return n;for(const n of this._measurementLinePlanObjectViewModels)if(e===n.getId())return n;for(const n of this._floorPlanObjectViewModels)if(e===n.getId())return n;for(const n of this._constructionPlanObjectViewModels)if(e===n.getId())return n;return null}getPlanObjectViewModelsFromRapiId(){return[...this._configurablePlanObjectViewModels,...this._configurableConstructionPlanObjectViewModels,...this._staticPlanObjectViewModels]}getPlanObjectCount(){return this._configurablePlanObjectViewModels.length+this._configurableConstructionPlanObjectViewModels.length+this._staticPlanObjectViewModels.length}getConstructionGroup(){return this._constructionGroup}getCeilingGroup(){return this._ceilingGroup}getFloorGroup(){return this._floorGroup}getMeasurementLineGroup(){return this._measurementLineGroup}getCeilingLightsGroup(){return this._ceilingLightsGroup}getLampLightsArray(){return[...this._configurablePlanObjectViewModels,...this._staticPlanObjectViewModels].map(i=>i.getObject()).flatMap(i=>i.children).filter(i=>i instanceof ee||i instanceof U)}getWallAtticsGroup(){return this._wallAtticsGroup}getBoundingBox(){if(this._configuratorContext.baseContext===V.CONFIGURATOR){const i=this.getPlanObjectForId(this._configuratorContext.planElementId);if(i)return i.getBounds()}if(this._configuratorContext.baseContext===V.GLB_VIEWER){const i=this._plannerSceneEventHandler.getSelectedIds();if(i&&i.length===1){const n=this.getPlanObjectForId(i[0]);if(n)return n.getBounds()}}const e=this.getCorePlan();if(e)try{return te(e.getBounds())}catch(i){console.error(i)}const t=new O;t.expandByObject(this._constructionGroup);for(const i of this._staticPlanObjectViewModels)t.expandByObject(i.getContainer());for(const i of this._configurablePlanObjectViewModels)t.expandByObject(i.getContainer());for(const i of this._configurableConstructionPlanObjectViewModels)t.expandByObject(i.getContainer());return t}getBoundingBoxOfGeometry(){return this.getBoundingBox()}setPlannerSceneEventHandler(e){this._plannerSceneEventHandler=e}getStaticPlanObjectViewModels(){return this._staticPlanObjectViewModels}getConfigurablePlanObjectViewModels(){return this._configurablePlanObjectViewModels}getConfigurableConstructionPlanObjectViewModels(){return this._configurableConstructionPlanObjectViewModels}getConstructionPlanObjectViewModels(){return this._constructionPlanObjectViewModels}getWallPlanObjectViewModels(){return this._wallPlanObjectViewModels}getNodePlanObjectViewModels(){return this._nodePlanObjectViewModels}getFloorPlanObjectViewModels(){return this._floorPlanObjectViewModels}getMeasurementLineObjectViewModels(){return this._measurementLinePlanObjectViewModels}getWallAtticsObjectViewModels(){return this._wallAtticsPlanObjectViewModels}_generateMesh(e=0,t=null,i,n,s,o,a,c,_,l){return this._plannerMeshGenerator.generateMesh(e,t,i,n,s,o,a,c,_,l)}_setMaterial(e,t,i,n){this._plannerMeshGenerator.setMaterial(e,t,i,n)}Editor3dComponentCreated(e,t,i,n,s){super.Editor3dComponentCreated(e,t,i,n,s),this._getKernelAccess()instanceof wt&&this.dockComponent(e,n,s,t,i)}addPlanObjectToScene(e){}handlerSwitchedPlans(e,t){this._constructionGroup.clear(),this._ceilingGroup.clear(),this._floorGroup.clear(),this._measurementLineGroup.clear(),this._wallAtticsGroup.clear()}planCompletelyLoaded(e){}beginPlanConstruction(e){}addPlanMesh(e,t,i,n,s,o,a){}endPlanConstruction(e){}planElementChanged(e,t){}planObjectConfigurationLoaded(e,t,i){const n=this.getConfigurablePlanObjectForId(t.getId());if(!n){console.warn("planObjectConfigurationLoaded but no view model found");return}i?n.finishConstruction():n.failConstruction();const s=t.extRef.jsObject;s instanceof ie&&this._linkPlanObjectViewModelAndComponent(s)}planObjectConfigurationChanged(e,t){}addMesh(e,t,i,n,s,o){const a=e.extRef.jsObject;let c=a.getMesh(t);c?c.geometry=this._plannerMeshGenerator.generateGeometry(null,i,n,s,o):(c=this._generateMesh(0,null,t,i,n,s,o,e.getType()),a.addMesh(c))}removePlanObjectFromScene(e){const t=e.getPlanElement().getType();this._isConstructionType(t)?this._constructionGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.FLOOR?this._floorGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.CEILING?this._ceilingGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.MEASURE?this._measurementLineGroup.remove(e.getContainer()):t===this._getKernelAccess().kernelContainer.PlanElementType.ATTIC&&this._wallAtticsGroup.remove(e.getContainer()),e.clear()}_isConstructionType(e){return e===this._getKernelAccess().kernelContainer.PlanElementType.WALL||e===this._getKernelAccess().kernelContainer.PlanElementType.NODE}planElementRemoved(e){const i=e.extRef?.jsObject;i instanceof de?this._removeObject(this._configurableConstructionPlanObjectViewModels,i):i instanceof ie?(this._detachPlanObjectViewModelFromComponent(i),this._removeObject(this._configurablePlanObjectViewModels,i)):i instanceof De?this._removeObject(this._constructionPlanObjectViewModels,i):i instanceof Se?this._removeObject(this._staticPlanObjectViewModels,i):i instanceof Ae?this._removeObject(this._floorPlanObjectViewModels,i):i instanceof He?this._removeObject(this._wallPlanObjectViewModels,i):i instanceof Le?this._removeObject(this._nodePlanObjectViewModels,i):i instanceof je?this._removeObject(this._measurementLinePlanObjectViewModels,i):i instanceof Re&&this._removeObject(this._wallAtticsPlanObjectViewModels,i)}_removeObject(e,t){const i=e.indexOf(t);i>-1&&e.splice(i,1)}getMeshGenerator(){return this._plannerMeshGenerator}componentConfigurationUpdated(e,t){super.componentConfigurationUpdated(e,t)}getBoundingBoxFromRuntimeIds(e){const t=new O;return this._staticPlanObjectViewModels.forEach(i=>{e.includes(i.getPlanElement().getId())&&t.expandByObject(i.getContainer())}),this._configurablePlanObjectViewModels.forEach(i=>{e.includes(i.getPlanElement().getId())&&t.expandByObject(i.getContainer())}),this._configurableConstructionPlanObjectViewModels.forEach(i=>{e.includes(i.getPlanElement().getId())&&t.expandByObject(i.getContainer())}),this._constructionPlanObjectViewModels.forEach(i=>{e.includes(i.getPlanElement().getId())&&t.expandByObject(i.getContainer())}),t}hideAllExceptRuntimeIds(e){this._ceilingGroup.visible=!1,this._floorGroup.visible=!1,this._measurementLineGroup.visible=!1,this._wallAtticsGroup.visible=!1,this._constructionGroup.visible=!1,this._staticPlanObjectViewModels.forEach(t=>{e.includes(t.getPlanElement().getId())||(t.getContainer().visible=!1)}),this._configurablePlanObjectViewModels.forEach(t=>{e.includes(t.getPlanElement().getId())||(t.getContainer().visible=!1)}),this._configurableConstructionPlanObjectViewModels.forEach(t=>{e.includes(t.getPlanElement().getId())||(t.getContainer().visible=!1)}),this._constructionPlanObjectViewModels.forEach(t=>{e.includes(t.getPlanElement().getId())||(t.getContainer().visible=!1)})}hideAllExcept(e){this._ceilingGroup.visible=!1,this._floorGroup.visible=!1,this._measurementLineGroup.visible=!1,this._wallAtticsGroup.visible=!1,this._constructionGroup.visible=!1,this._staticPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurablePlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._configurableConstructionPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)}),this._constructionPlanObjectViewModels.forEach(t=>{t.getId()!==e&&(t.getContainer().visible=!1)})}showAll(){this._ceilingGroup.visible=this._cameraType===f.CAMERA_FP,this._floorGroup.visible=!0,this._measurementLineGroup.visible=!0,this._wallAtticsGroup.visible=!0,this._constructionGroup.visible=!0,this._staticPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurablePlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._configurableConstructionPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0),this._constructionPlanObjectViewModels.forEach(e=>e.getContainer().visible=!0)}planHistoryStateChanged(){}setNodeVisibility(e){this._nodePlanObjectViewModels.forEach(t=>t.setTopView(e))}async setCameraType(e){this._cameraType=e;const t=[];this._wallPlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===f.CAMERA_2D)),this._measurementLinePlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===f.CAMERA_2D)),this._wallAtticsPlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===f.CAMERA_2D)),this._nodePlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===f.CAMERA_2D)),this._configurablePlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===f.CAMERA_2D)),this._constructionPlanObjectViewModels.forEach(i=>t.push(i.setTopView(this._cameraType===f.CAMERA_2D))),this._configurableConstructionPlanObjectViewModels.forEach(i=>t.push(i.setTopView(this._cameraType===f.CAMERA_2D))),await Promise.all(t)}get cameraType(){return this._cameraType}setNodeZoom(e){e=Math.min(4,e),this._nodeZoom=e;for(const t of this._nodePlanObjectViewModels)t.setZoom(e);for(const t of this._measurementLinePlanObjectViewModels)t.getPoint1Draggable().scale.setScalar(e),t.getPoint2Draggable().scale.setScalar(e)}planCleared(){[this._configurablePlanObjectViewModels,this._configurableConstructionPlanObjectViewModels,this._staticPlanObjectViewModels,this._wallPlanObjectViewModels,this._measurementLinePlanObjectViewModels,this._nodePlanObjectViewModels,this._floorPlanObjectViewModels,this._constructionPlanObjectViewModels,this._wallAtticsPlanObjectViewModels].forEach(t=>{t.forEach(i=>i.remove()),t.length=0})}requestCatalogItem(e){}turnLightsOnOrOff(e){const t=this.getCeilingLightsGroup(),i=this.getLampLightsArray();t.toggleAllLights(e);for(const n of i)n.visible=e}}P("P",Ye),Jt([p],Ye.prototype,"_plannerMeshGenerator"),Jt([p],Ye.prototype,"_roomlePlannerUiCallback");var b=P("O",(h=>(h.CLICK="select",h.DOUBLE_CLICK="double_click",h.HOVER_ON="hover_on",h.HOVER_OFF="hover_off",h.HOVER_MOVE="hover_move",h.DRAG_START="drag_start",h.DRAG="drag",h.DRAG_END="drag_end",h.ROTATE="rotate",h))(b||{}));const ae=P("b",{RAYCASTER_FLOOR:.8,FLOOR:.9,WALL:.95,DEFAULT:1,CONSTRUCTION:1,COMPONENT:2,PREVIEW:3,PREVIEW_LINE:4});var Ai=P("I",(h=>(h[h.PLANNER=0]="PLANNER",h[h.CONFIGURATOR=1]="CONFIGURATOR",h))(Ai||{})),ti=P("R",(h=>(h[h.CLICK_OUTSIDE=0]="CLICK_OUTSIDE",h))(ti||{}));const ii=Ve(30);class Li extends _e{constructor(e,t,i,n){super(),this._offset=new d(0,0,0),this._lastMoveCheck=0,this._onWallSnapping=!1,this._mode=n===void 0?1:n,this._object=e,this._camera=t,this._raycaster=new bt,this._raycaster.layers.disableAll(),this._inputManager=i,this._addInputListeners(i),this._planeBottom=new ne(new d(0,1,0)),this._planeFront=new ne(new d(0,0,1)),this._planeSide=new ne(new d(1,0,0))}setLayers(e){this._raycaster.layers=e}getLayers(){return this._raycaster.layers}_addInputListeners(e){e.addEventListener(y.DOWN,t=>{this._findCandidate(t.positionRelative)},this),e.addEventListener(y.CLICK,t=>{this._findSelection(t.positionRelative)},this),e.addEventListener(y.DOUBLE_CLICK,t=>{this._findSelection(t.positionRelative,!0,t.type)},this),e.addEventListener(y.LONG_TOUCH,t=>{this._findSelection(t.positionRelative,!0,t.type)},this),e.addEventListener(y.MOVE,t=>{Date.now()-this._lastMoveCheck>32&&(this._findHover(t.positionRelative,t.type),this._lastMoveCheck=Date.now())},this),e.addEventListener(y.DRAG_START,t=>{this._onDragStart(t.positionRelative)},this),e.addEventListener(y.DRAG,t=>{this._onDrag(t.positionRelative)},this),e.addEventListener(y.DRAG_END,t=>{this._onDragEnd(t.positionRelative)},this),e.addEventListener(y.ROTATE,t=>{this._onRotate(t.positionRelative,t.rotation)},this),e.addEventListener(y.ROTATE_END,()=>{this._currentRotate=null},this)}_findCandidate(e){let t=this._intersection(e);t&&!t.object.userData.ignoreElementHit&&this._mode===0&&this._inputManager.onElementHit()}_findSelection(e,t=!1,i=K.UNKNOWN){let n=this._intersection(e);if(!n)this.dispatchEvent(0);else if(n){const s=t?"double_click":"select";n.object.dispatchEvent({type:s,attachment:{intersection:n,type:i}})}}_findHover(e,t){const i=this._intersection(e);!i&&this._currentHover?(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null):i&&(this._currentHover&&this._currentHover.id!==i.object.id&&(this._currentHover.dispatchEvent({type:"hover_off",attachment:{type:t}}),this._currentHover=null),this._currentHover?this._currentHover.dispatchEvent({type:"hover_move",attachment:{intersection:i,type:t}}):(this._currentHover=i.object,this._currentHover.dispatchEvent({type:"hover_on",attachment:{intersection:i,type:t}})))}_intersection(e){if(e.x===0&&e.y===0)return null;const t=this._intersect(e);if(window.__RML__DEBUG__?.raycaster){const n=[];for(const s of t)n.push({name:s.object.userData.planElementName,distance:s.distance,priority:s.object.userData.priority});n.length&&console.table(n)}if(t.length<=0)return null;let i=t[0];return t.length>1&&this._currentHover&&this._currentDrag&&this._currentDrag.id!==this._currentHover.id&&t.forEach(n=>{n.object.id===this._currentHover.id&&n.object.userData.priority===this._currentHover.userData.priority&&i.object.userData.priority<=n.object.userData.priority&&(i=n)}),i}_intersect(e){this._raycaster.setFromCamera(new se(e.x,e.y),this._camera);const t=[];return this._raycaster.intersectObjects(this._object.children,!0).forEach(n=>{const s=this._findObjectWithHandler(n.object);s&&(n.object=s,t.push(n))}),t.length>=0?t.sort((n,s)=>n.object.userData.priority!==s.object.userData.priority?s.object.userData.priority-n.object.userData.priority:vt(new O().setFromObject(n.object),new O().setFromObject(s.object))<0?-1:n.distance-s.distance):[]}_findObjectWithHandler(e){return e.userData.hasListener?e:e.parent?this._findObjectWithHandler(e.parent):null}_onDragStart(e){let t=this._intersection(e);if(!t&&!this._currentDrag||t&&t.object.userData.roomleId===this._rootComponentId)return;!this._currentDrag&&t&&(this._currentDrag=t.object,this._currentDrag.dispatchEvent({type:"drag_start"}));let i=this._currentDrag.parent;i&&i.computeBoundingBox&&(i.computeBoundingBox(),this._calculateOffset(i)),this._positionPlanes(i)}_onDrag(e){if(!this._currentDrag)return;this._raycaster.setFromCamera(new se(e.x,e.y),this._camera);let t=new d(0,0,-5);this._raycaster.ray.intersectPlane(this._planeBottom,t);let i;if(this._mode===0){const n=this._object.children.find(({type:o,name:a})=>o==="Group"&&a===ei),s=this._currentDrag.userData.snapToWall;if(n&&(this._onWallSnapping||s)){const o=this._raycaster.intersectObjects(n.children,!0);if(o.length){const a=o[0].point.clone();this._currentDrag.dispatchEvent({type:"drag",attachment:{position:a}});return}}i=t.clone()}else i=this._getIntersectionPosition(t),i.sub(this._offset);this._currentDrag.dispatchEvent({type:"drag",attachment:{position:i}})}_getIntersectionPosition(e){let t=this._getDistanceToCamera(e),i=this._camera.userData.yaw,n=new d(0,0,0),s=new d(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,n),this._raycaster.ray.intersectPlane(this._planeSide,s);let o=this._getDistanceToCamera(s),a=this._getDistanceToCamera(n),c;return i>=-ii&&i<=ii?t<a?c=e.clone():c=n.clone():t<a&&t<o?c=e.clone():a<t&&a<o?c=n.clone():o<t&&o<a&&(c=s.clone()),c}_getDistanceToCamera(e){let i=e.clone().sub(this._camera.position).length();return yt(e)&&(i=Number.POSITIVE_INFINITY),i}_onDragEnd(e){this._currentDrag&&(this._currentDrag.dispatchEvent({type:"drag_end",attachment:{position:e}}),this._currentDrag=null)}_onRotate(e,t){if(!this._currentRotate){let i=this._intersection(e);if(!i)return;this._currentRotate=i.object}this._currentRotate.dispatchEvent({type:"rotate",attachment:{rotation:t}})}_positionPlanes(e){this._mode===0?(this._planeBottom.constant=0,this._camera.userData&&this._camera.userData.pitch&&this._camera.userData.pitch<0&&(this._planeBottom.constant=-3)):e&&e.boundingBox&&this._rootComponentPosition&&(this._planeBottom.constant=-e.boundingBox.getCenter(new d).y-this._rootComponentPosition.y,this._planeSide.constant=-e.boundingBox.getSize(new d).x*2+e.boundingBox.getCenter(new d).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new d).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new d)),this._offset.applyQuaternion(e.getWorldQuaternion(new Mt)))}update(e,t,i){if(e&&(this._bounds=e),t&&(this._rootComponentPosition=t),i){this._backgroundScene=i;let n=this._backgroundScene.children[0];n instanceof le&&n.geometry.computeBoundingBox()}}clear(){this._currentDrag&&Te(this._currentDrag),this._currentHover&&Te(this._currentHover)}enableDragIn(e){this._currentDrag=e}setRootComponentId(e){this._rootComponentId=e}setCamera(e){this._camera=e}setObject(e){this._object=e}setMode(e){this._mode=e}intersectMouseOnScene(e){const t=new ne,i=new d;return i.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(i,this._object.position),this._raycaster.setFromCamera(new se(e.positionRelative.x,e.positionRelative.y),this._camera),Ot(this._raycaster.ray.intersectPlane(t,new d))}enableOnWallSnapping(){this._onWallSnapping=!0}disableOnWallSnapping(){this._onWallSnapping=!1}}class ni extends _e{constructor(e,t,i,n){super(),this._debug=!1,this._dragIn=!1,this._inputManager=n,this._raycastHelper=new Li(t,i,this._inputManager),this._creator_=e}isDragIn(){return this._dragIn}setDragIn(e,t){this._dragIn=e,e?this._inputManager.enableDragIn(t):this._raycastHelper.clear(),this._interaction()}}P("S",ni);var Ti=Object.defineProperty,si=(h,e,t,i)=>{for(var n=void 0,s=h.length-1,o;s>=0;s--)(o=h[s])&&(n=o(e,t,n)||n);return n&&Ti(e,t,n),n},x=(h=>(h[h.INTERACTION=0]="INTERACTION",h[h.HOVER_ON=1]="HOVER_ON",h[h.HOVER_OFF=2]="HOVER_OFF",h[h.CLICK_OUTSIDE=3]="CLICK_OUTSIDE",h[h.DRAG_START=4]="DRAG_START",h[h.DRAG_MOVE=5]="DRAG_MOVE",h[h.DRAG_END=6]="DRAG_END",h[h.CLICK_PREVIEW=7]="CLICK_PREVIEW",h[h.SELECT_COMPONENT=8]="SELECT_COMPONENT",h[h.DESELECT_COMPONENT=9]="DESELECT_COMPONENT",h))(x||{});class j{constructor(e){const{component:t,preview:i,resetCamera:n,consecutive:s,type:o,forceRender:a,reason:c}=e;this.component=t,this.preview=i,this.resetCamera=n===void 0?!0:n,this.consecutive=s===void 0?!0:s,this.type=o||K.UNKNOWN,this.forceRender=a!==void 0?a:!1,this.reason=c}}class Ze extends ni{constructor(e,t,i,n){super(e,t,i,n),this._cameraMoving=!1,this._raycastHelper.addEventListener(ti.CLICK_OUTSIDE,()=>{this._clickOutside()},this),this._selectionHandler.addEventListener(Be.SELECT_COMPONENT,({component:s,consecutive:o})=>{this.dispatchEvent(8,new j({component:s,consecutive:o})),this._inputManager.setDragEnabled(!0)},this),this._selectionHandler.addEventListener(Be.DESELECT_COMPONENT,({component:s,resetCamera:o,reason:a})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new j({component:s,resetCamera:o,reason:a}))},this),this._addInputListeners(this._inputManager)}disable(){const e=new ke;e.disableAll(),this._raycastHelper.setLayers(e),this._raycastHelper.disableEvents()}enable(){const e=new ke;e.disableAll(),e.enable(v.COMPONENT),e.enable(v.PREVIEW),e.enable(v.GIZMO),e.enable(v.DIMENSIONS),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}_addInputListeners(e){e.addEventListener(y.ZOOM_IN,t=>this._interaction(),this),e.addEventListener(y.ZOOM_OUT,t=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:ae.DEFAULT,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:ae.COMPONENT,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:ae.DEFAULT,roomleId:e.runtimeId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,i){t.userData.hasListener||(Object.assign(t.userData,i),t.addEventListener(b.CLICK,()=>this.clickComponent(e)),t.addEventListener(b.HOVER_ON,n=>this._hoverOn(e,n.attachment.type)),t.addEventListener(b.HOVER_OFF,n=>this._hoverOff(e,n.attachment.type)),t.addEventListener(b.DRAG_START,()=>this._dragStart(e)),t.addEventListener(b.DRAG,n=>this._drag(e,n.attachment.position)),t.addEventListener(b.DRAG_END,()=>this._dragEnd(e)))}addPreviewHandlers(e){let t=e.boundingBoxMesh;t.userData.hasListener||(t.userData=Ge(t.userData,{hasListener:!0,priority:ae.PREVIEW,roomleId:e.runtimeId}),t.addEventListener(b.CLICK,()=>this._clickPreview(e)),t.addEventListener(b.HOVER_ON,()=>this._hoverOnPreview(e)),t.addEventListener(b.HOVER_OFF,()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){let t=e.boundingLineMesh;t.userData.hasListener||(t.userData=Ge(t.userData,{hasListener:!0,priority:ae.PREVIEW_LINE,roomleId:e.runtimeId}),t.addEventListener(b.CLICK,()=>this._clickPreviewLine(e)),t.addEventListener(b.HOVER_ON,i=>this._hoverOnPreviewLine(e,i.attachment.intersection)),t.addEventListener(b.HOVER_MOVE,i=>this._hoverMovePreviewLine(e,i.attachment.intersection)),t.addEventListener(b.HOVER_OFF,()=>this._hoverOffPreviewLine(e)))}_clickPreview(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new j({preview:e}))}_clickPreviewLine(e){this._dragStartPosition&&(e.position.copy(this._dragStartPosition),this._dragStartPosition=null),this.dispatchEvent(7,new j({preview:e}))}clickComponent(e,t=!0){this._debug&&console.log("select: "+e.runtimeId),this._selectionHandler.check(e),t&&this._configuratorUiCallbacks.onClickComponent(e)}_clickOutside(){this._selectionHandler.cancelSelection("click_outside"),this.dispatchEvent(3),this._interaction()}_hoverOn(e,t){this._cameraMoving||(this._debug&&console.log("hover_on: "+e.runtimeId),e.hoverOn(),this._interaction(),this.dispatchEvent(1,new j({component:e,type:t})),this._hoveredComponent=e)}_hoverOff(e,t){this._cameraMoving||(this._debug&&console.log("hover_off: "+e.runtimeId),e.hoverOff(),this._interaction(),this.dispatchEvent(2,new j({component:e,type:t})),this._hoveredComponent=null)}_hoverOnPreview(e){e.hoverOn(),this._interaction(!0),this._hoveredPreview=e,this._hoveredPreview?.dockInsertAnimation?.startInsert()}_hoverOffPreview(e){this._hoveredPreview?.dockInsertAnimation?.endInsert(),e.hoverOff(),this._interaction(!0),this._hoveredPreview=null}_hoverOnPreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._draggedComponent||e.hoverOn(),this._interaction(),this._hoveredPreview=e}_hoverMovePreviewLine(e,t){this._updatePositionForPreviewLine(e,t),this._hoveredPreview=e,this._interaction(!0)}_updatePositionForPreviewLine(e,t){let i=t.object.parent.parent.worldToLocal(t.point);this._previewLineIntersection=i,e&&(this._draggedComponent?this._draggedComponent.visible=!0:e.updatePreviewPosition(i))}_hoverOffPreviewLine(e){this._draggedComponent||e.hoverOff(),this._interaction(),this._hoveredPreview=null,this._previewLineIntersection=null}_setDragComponentShadow(e){this._draggedComponent?.traverse(t=>{if(t instanceof le){const i=t;e&&i.castShadowOld!==void 0?(i.receiveShadow=i.receiveShadowOld,i.castShadow=i.castShadowOld):(i.receiveShadowOld=t.receiveShadow,i.castShadowOld=t.castShadow,i.receiveShadow=!1,i.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 j({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 i=this._hoveredPreview,n=i.getPositionForIntersectionPoint(this._previewLineIntersection),s=i.parent.localToWorld(n);this._draggedComponent.position.copy(this._draggedComponent.parent.worldToLocal(s)),this._draggedComponent.rotation.copy(i.docklineRotation),i.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 j({component:e})),this._interaction()}}_dragEnd(e){if(!(!e||!this._selectionHandler.isSelected(e)&&!this.isDragIn())){if(this._hoveredPreview&&this._previewLineIntersection){let t=this._hoveredPreview,i=t.getPositionForIntersectionPoint(this._previewLineIntersection),n=t.parent.localToWorld(i);e.position.copy(e.parent.worldToLocal(n)),e.rotation.copy(t.docklineRotation)}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 j({component:e,preview:this._hoveredPreview})),this._interaction()}}_interaction(e){this.dispatchEvent(0,new j({forceRender:e}))}hasSelection(){return this._selectionHandler.hasSelection()}update(e,t,i){this._raycastHelper.update(e,t,i)}isDragIn(){return this._dragIn}isDragging(){return this._draggedComponent!=null}setRootComponentId(e){this._raycastHelper.setRootComponentId(e)}cancelSelection(e){return this._selectionHandler.setSelectionMode(I.STANDARD),this._selectionHandler.cancelSelection(e)}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,K.UNKNOWN),this._cameraMoving=e}setCamera(e){this._raycastHelper.setCamera(e)}setObject(e){this._raycastHelper.setObject(e)}}si([p],Ze.prototype,"_selectionHandler"),si([p],Ze.prototype,"_configuratorUiCallbacks");var oi=(h=>(h[h.CHANGE=0]="CHANGE",h))(oi||{});class Vi extends _e{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,i){let n=new d(-e.x/2,0,-e.z/2),s=new d(e.x/2,e.y,e.z/2);this._boundingBox=new O(n,s),this._clientWidth=t,this._clientHeight=i;let o=this._boundingBox.getSize(new d);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new d(o.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new d(o.x,0,0)))}set canvasOffset(e){this._offset=e,this.calculateUIIntersection()}calculateUIIntersection(){let e=[];if(this._boundingBox==null||this._offset==null)return;let t=this._checkPaddings();t.bottom=this._clientHeight-t.bottom,t.right=this._clientWidth-t.right;let i=0;this.floorEnvironment?(e=["left","right","bottom"],i=11):(this._offset.left>0&&t.left<this._offset.left*this._clientWidth&&(e.push("left"),i|=8),this._offset.right<1&&t.right<(1-this._offset.right)*this._clientWidth&&(e.push("right"),i|=2),this._offset.bottom>0&&t.bottom<this._offset.bottom*this._clientHeight&&(e.push("bottom"),i|=1)),this._offset.top<1&&t.top<(1-this._offset.top)*this._clientHeight&&(e.push("top"),i|=4),i!==this._uiIntersectionMask&&(this.dispatchEvent(0,e),this._uiIntersectionMask=i)}_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 i=Fe(t,this._camera,this._clientWidth,this._clientHeight);i.x<e.left&&(e.left=i.x),i.x>e.right&&(e.right=i.x),i.y<e.top&&(e.top=i.y),i.y>e.bottom&&(e.bottom=i.y)}),e}}class Ce extends Xe{get cameraControl(){return this._cameraControl}resetCameraOnSceneClear(){this.cameraControl.clear()}async externalApiMoveCamera(e){await this.cameraControl.moveCamera(e),this._onCameraChanged()}externalApiZoomIn(e){this.cameraControl.zoomIn(e),this._onCameraChanged()}externalApiZoomOut(e){this.cameraControl.zoomOut(e),this._onCameraChanged()}externalApiResetCameraPosition(e){this.cameraControl.updateAndReset(e,!0),this._onCameraChanged()}disablePanningOnShiftRelease(){this.cameraControl.disablePanning()}enablePanningOnShiftClick(){this.cameraControl.enablePanning()}resetCameraToStartOnConfigurationLoaded(e){this.cameraControl.updateAndReset(e,!1)}updateBoundsOnPlanObjectUpdated(e){this.cameraControl.updateToBounds(e,!1,!1)}updateBoundsOnCancelDockings(e){this.cameraControl.updateToBounds(e,!1,!1)}async zoomToComponentOnConsecutiveClick(e){this.cameraControl.saveState(!1),await this.cameraControl.zoomTo(e),this._onCameraChanged()}resetCameraToStateOnCancelSelection(){this.cameraControl.hasSavedState()&&(this.cameraControl.resetToState(),this._onCameraChanged())}zoomToFitBoundsAfterUserInitiatedPreviews(e){this.cameraControl.zoomToFitBounds(e),this._onCameraChanged()}async resetCameraOnStartConfiguring(e,t,i=0,n=0){this.cameraControl.setCurrentCameraParameters(t),this.cameraControl.setObjectRotation(i,n),await this.cameraControl.updateAndReset(e,!0)}}P("c",Ce);var Bi=Object.defineProperty,A=(h,e,t,i)=>{for(var n=void 0,s=h.length-1,o;s>=0;s--)(o=h[s])&&(n=o(e,t,n)||n);return n&&Bi(e,t,n),n};class R extends $e{constructor(e,t,i){super(e,t,Pt.HSC,i),this._configuratorContext.baseContext=V.CONFIGURATOR,this._getViewModel().setListener(this),this._sceneEventHandler=new Ze(this._creator_,this._scene,this.cameraBehaviour3d.cameraControl.getCamera(),this._getInputManager()),this._sceneEventHandler.addEventListener(x.INTERACTION,({forceRender:n})=>{this._uiIntersectionHelper.calculateUIIntersection(),n&&this._renderEverything()},this),this._sceneEventHandler.addEventListener(x.HOVER_ON,({component:n,type:s})=>this._onHoverOn(n,s),this),this._sceneEventHandler.addEventListener(x.HOVER_OFF,({component:n,type:s})=>this._onHoverOff(n,s),this),this._sceneEventHandler.addEventListener(x.CLICK_OUTSIDE,()=>{this._configuratorUiCallbacks.onClickOutside(),this.cameraBehaviour.cameraControl.unlock(),this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this.cancelComponentSelection(!0,"click_outside"),this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this._sceneEventHandler.addEventListener(x.SELECT_COMPONENT,({component:n,consecutive:s})=>{this._getViewModel().hasPreviews()&&this._cancelDockings(!1,null,this._getViewModel().hasPreviews(),!0,!1),this._selectComponent(n,s),this._requestRender()},this),this._sceneEventHandler.addEventListener(x.DESELECT_COMPONENT,({component:n,resetCamera:s,reason:o})=>{this._deselectComponent(n,s,o),this._requestRender()},this),this._sceneEventHandler.addEventListener(x.DRAG_START,({component:n})=>{this._sceneEventHandler.getSelectionMode()===I.MULTISELECT&&this.cancelComponentSelection(!1,"dragIn"),this._requestDockingsPreviewWithDrag(n.runtimeId),this.cameraBehaviour.cameraControl.lock(),this._roomleRenderer?.enableUiInteractionMode(),this._requestRender()},this),this._sceneEventHandler.addEventListener(x.DRAG_MOVE,()=>{this._renderEverything()},this),this._sceneEventHandler.addEventListener(x.DRAG_END,({component:n,preview:s})=>{if(s){const o=s;this._getViewModel().isPreviewLine(o)?this._getViewModel().dockComponentWithPosition(o,n):this._getViewModel().isPreview(o)?this._dockComponent(o):this._getKernelAccess().cancelDocking(n.runtimeId),this._cancelDockings(!s,n,!0,!0)}else{this._getKernelAccess().cancelDocking(n.runtimeId);const o=this._sceneEventHandler.isDragIn()?n:null;this._cancelDockings(this._sceneEventHandler.isDragIn(),o,!1,!0);const a=this._getViewModel().getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(a.getSize(new d))}this.cameraBehaviour.cameraControl.unlock(),this._roomleRenderer?.disableUiInteractionMode(),this._renderEverything()},this),this._sceneEventHandler.addEventListener(x.CLICK_PREVIEW,({preview:n})=>{this._getViewModel().isPreview(n)&&(this._getViewModel().isPreviewLine(n)?this._getViewModel().dockComponentWithPosition(n):this._dockComponent(n),this._cancelDockings(!1,null,!this._getViewModel().hasPreviews(),!1,!1),this.requestDockingsPreview(!1),this._requestRender())},this),It.isProduction||(window.__RML__DEBUG__.SceneManager=this),this.enableConfiguratorEvents(),this._initOptionalModules(),this._offsetAnimationStart=xt(this._offsetAnimationStart.bind(this),250),this._offsetAnimationEnd=Et(this._offsetAnimationEnd.bind(this),32)}async _initOptionalModules(){const{transparentHighlighting:e}=this._initData;if(e){const{default:t}=await be.import("./component-raycast-helper-Bkq0_1Vg.js");this._componentRaycastHelper=new t,this._componentRaycastHelper.init(this._scene,this.cameraBehaviour3d.cameraControl.getCamera())}}_changeCameraBehaviour(e){super._changeCameraBehaviour(e),this._componentRaycastHelper?.setCamera(this.cameraBehaviour3d.cameraControl.getCamera())}disableEvents(){this.disableConfiguratorEvents()}enableEvents(){this._configuratorContext.baseContext===V.CONFIGURATOR&&this.enableConfiguratorEvents()}enableConfiguratorEvents(){this._sceneEventHandler.enable()}disableConfiguratorEvents(){this._sceneEventHandler.disable()}saveExternalConfiguration(e){this._viewModel.saveExternalConfiguration(e)}getExternalConfigurationById(e){return this._viewModel.getExternalConfigurationById(e)}_getViewModel(){return this._viewModel||(this._viewModel=Pe.lookup("configurator-view-model",this._creator_),this._viewModel.setRequestRenderCallback(()=>this._renderEverything()),this._viewModel.setRequestRenderSceneUpdateCallback(()=>this._roomleRenderer?.clearCache()),this._viewModel.setInvalidateRenderCallback(()=>this._roomleRenderer?.forceShadowUpdates(!0))),this._viewModel}_getKernelAccess(){return this._plannerKernelAccess}_showDockings(){if(this._roomleRenderer?.enableUiInteractionMode(),this._initData?.featureFlags?.pulsePreview){this._renderEverything();const e=setInterval(()=>this._renderEverything(),16);setTimeout(()=>clearInterval(e),(Qe+1)*Je)}}cancelDockings(){this._cancelDockings(!0,null,!0,!0,!1),this._renderEverything()}_cancelDockings(e,t,i,n,s=!0){this._roomleRenderer?.disableUiInteractionMode(),e&&(this._sceneEventHandler.setDragIn(!1),this._getViewModel().removeDockingComponent(),t&&this._scene.remove(t)),this._getViewModel().removePreviews(),i&&s&&Dt().then(()=>{this.configuratorCameraBehaviour?.updateBoundsOnCancelDockings(this.getBounds())}),n&&i&&this._configuratorUiCallbacks.onDockingsPreviewRemoved(),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null,!1,()=>{this._roomleRenderer?.forceShadowUpdates(!0),this._initData.transparentHighlighting&&this._roomleRenderer?.clearCache(),this._renderEverything()}),i&&this._roomleRenderer?.forceShadowUpdates(!0)}_onHoverOn(e,t){t!==K.TOUCH&&this._highlightComponent(e),this._isComponentDimensionsVisible||this._showCustomComponentDimensions(e)}_onHoverOff(e,t){t!==K.TOUCH&&this._highlightComponent(),this._componentDimensioningHelper&&!this._isComponentDimensionsVisible&&this._componentDimensioningHelper.hasComponentDimensions()&&this._removeCustomComponentDimensions(e),this._requestRender()}_highlightComponent(e=null,t=[]){if(!this._shouldHighlightComponent())return;const i=[],n=this._initData.meshSelection;e?n?i.push(...e.meshes):e.boundingBoxMesh&&i.push(e.boundingBoxMesh):(!t||!t.length)&&(t=this._sceneEventHandler.getSelectedRuntimeComponentIds()),this._getViewModel().getComponentsForIds(t).forEach(s=>{s&&(n?i.push(...s.meshes):s.boundingBoxMesh&&i.push(s.boundingBoxMesh))}),this._roomleRenderer?.highlightObjects(i)}shouldClearShadowsAndAO(){return super.shouldClearShadowsAndAO()||!this._sceneEventHandler?.isDragging()}resume(){super.resume(),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded()),this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()})}_materialLoaded(){this._renderEverything()}async waitForMaterialQueue(){await this._getViewModel().materialQueue.finished()}pause(){super.pause(),this._getViewModel().materialQueue.unregisterCallback(),this._configuratorMeshGenerator.removeMaterialLoadedListener()}_setupScene(e,t,i){super._setupScene(e,t),this._uiIntersectionHelper=new Vi(this.cameraBehaviour3d.cameraControl.getCamera()),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(oi.CHANGE,n=>{this._configuratorUiCallbacks.onUiIntersectionChange(n)},this),this._configuratorMeshGenerator.maxAnisotropy=this._maxAnisotropy,this._configuratorMeshGenerator.maxTextures=this._renderer.capabilities.maxTextures,this._configuratorMeshGenerator.setMaterialLoadedListener(()=>{this._renderWithoutShadowsAndAO()}),this._domHelper.element?.appendChild(this._renderer.domElement),!i&&this._initData.legacyLight&&!this._initData.ls&&!this._initData.dls&&(this._renderer.capabilities.maxTextures>8?this.loadDynamicLightSetting(St.createDynamicLightSettingSource(null,jt.CAMERA)):this._lightSetting=new Wt(this._scene,this._lightSetting)),this._requestRender(),t||this._setEnvironment(new et(this._scene,this._environment,Rt(this._initData.colors.DEFAULT_BACKGROUND))),this._getViewModel().materialQueue.registerCallback(()=>this._materialLoaded())}sceneCleared(e){this._internalClearScene(e)}display(e){this._scene.add(e),this.setRootComponentId(e.runtimeId),this._requestRender()}setRootComponentId(e){this._sceneEventHandler.setRootComponentId(e)}debugSceneGraph(e){this._getViewModel().debugSceneGraph(e),this._printObjectGraph(this._scene,"")}debugScene(){return this._scene}_printObjectGraph(e,t){const i=e.material?e.material.opacity:void 0;console.log(t+e.type+" id:"+e.id+" roomleId: "+e.runtimeId,i,e),e.children.length>0&&e.children.forEach(n=>{const s=t+" ";this._printObjectGraph(n,s)})}clearScene(){this.configuratorCameraBehaviour?.resetCameraOnSceneClear(),this._internalClearScene(!1),this._sceneEventHandler?.cancelSelection("reset_scene"),this._pluginSystem.clearScene(this._scene,this._uiScene)}planObjectConstructionDone(e){this._componentDimensioningHelper.reset(),this._componentDimensioningHelper.setCamera(this.cameraBehaviour3d.cameraControl.getCamera())}_internalClearScene(e){this._scene.children.forEach(t=>{(t.type==="Object3D"||t.type==="Mesh"||t.type==="Line")&&this._scene.remove(t)}),this._uiScene.children.forEach(t=>{this._uiScene.remove(t)}),this._getViewModel().sceneCleared(),this._componentDimensioningHelper?.invalidateDimensioningsCache(),(e||this._memoryManager.shouldHardReset())&&(this._configuratorMeshGenerator.clear(),this._renderer.renderLists.dispose(),this._memoryManager.executedHardReset()),this._renderEverything()}async _waitForAssets(){await super._waitForAssets(),await this._externalMeshesAndMaterialsReady()}async preparePerspectiveImage(e={},t){await this._externalMeshesAndMaterialsReady();const{showDimensions:i=!1}=e;this._cancelDockings(!0,null,!0,!0);const n=this.cameraBehaviour3d.cameraControl.getCamera().clone();n.resetOffset();let s=this._calculateBoundingBoxOfAllMeshes(0,i);this._lightSetting?.removeFromScene();const o=this._dimensionHelper?this._dimensionHelper.areDimensionsEnabled():!1;o&&this._dimensionHelper.disableDimensions();const a=this.cameraBehaviour3d.cameraControl.getObjectRotation();if(i){await this._initDimensions(),await this._dimensionHelper.isInitialized();const _=-30+kt(a);ue.placeCameraForPerspectiveImage(n,s,-20,_),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(n.position),s=this._calculateBoundingBoxOfAllMeshes(0,i)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const c=await this._imageRenderer.preparePerspectiveImage(this._scene,this._uiScene,n,s,e,a);return o?(this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)):i&&this._dimensionHelper.disableDimensions(),this._lightSetting?.addToScene(),this._renderEverything(),c}async renderImage(e){await this._externalMeshesAndMaterialsReady(),this._getViewModel().getPreviews()&&this._cancelDockings(!0,null,!0,!0);let t=this.cameraBehaviour3d.cameraControl.getCamera(),i=null;e.useCurrentPerspective||(t=this.cameraBehaviour3d.cameraControl.getCamera().clone(),t.resetOffset(),i=this._calculateBoundingBoxOfAllMeshes());const n=this._dimensionHelper?this._dimensionHelper.areDimensionsEnabled():!1;n&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const s=await this._imageRenderer.renderPerspectiveImage(this._scene,t,i);return n&&(this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)),this._renderEverything(),s}async preparePartImage(e,t){return new Promise((i,n)=>{this._getViewModel().requestSubPartConstruction(e).then(async s=>{t.size||(t.size=256);const o=this.cameraBehaviour3d.cameraControl.getCamera().clone();o.resetOffset();const a=ue.getCameraTargetForBBox(new O().setFromObject(s)),c=Ht(this._scene);c.add(s);const _=await this._imageRenderer.preparePerspectiveImage(c,null,o,a,t);At(c),i(_)},n)})}_calculateBoundingBoxOfAllMeshes(e=0,t){let i=null;return t&&this._dimensionHelper?i=this._dimensionHelper.getBoundingBox():i=this._getViewModel().getBoundingBox(),ue.getCameraTargetForBBox(i,e)}async _externalMeshesAndMaterialsReady(){await this._getKernelAccess().externalMeshQueue.finished(!0),await this._getViewModel().materialQueue.finished(!0)}async prepareTopImage(e={},t){await this._externalMeshesAndMaterialsReady();const{showDimensions:i=!1}=e;this._cancelDockings(!0,null,!0,!0),i&&(await this._initDimensions(!0),await this._dimensionHelper.isInitialized(),this._dimensionHelper.enableTopDimensions()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const n=this._calculateBoundingBoxOfAllMeshes(.1,i);this._lightSetting?.removeFromScene();const s=await this._imageRenderer.prepareTopImage(this._scene,this._uiScene,n,e);return i&&this._dimensionHelper.disableTopDimensions(),this._lightSetting?.addToScene(),this._renderEverything(),s}enableDragIn(e){this._sceneEventHandler.setDragIn(!0,e),this._requestRender()}async _zoomToComponentOnConsecutiveClick(e){const t=e.boundingBox.getSize(new d),i=Lt(e),n=new Me(0,i,0),s=e.getWorldPosition(new d).clone().add(e.boundingBox.getCenter(new d).applyEuler(n)),o=new se;this._renderer.getSize(o);const a={yaw:n.y,pitch:Ve(15),distance:Tt(t.x,t.y,t.z,this.cameraBehaviour3d.cameraControl.getCamera().fov,o.width,o.height)*tt,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0};Vt(this.cameraBehaviour.cameraControl.getCurrentCameraParameters(),a)||(this._configuratorUiCallbacks.onZoomToComponent(),await this.configuratorCameraBehaviour?.zoomToComponentOnConsecutiveClick(a))}resetCameraPositionToStart(){this._requestRender();const e=this._getViewModel().getBoundingBox();this.configuratorCameraBehaviour.externalApiResetCameraPosition(e)}resetPreviews(){this._getViewModel().removePreviews(),this._requestRender()}changeOffset(e){this.cameraBehaviour3d.cameraControl.getCamera().offset=e,this._uiIntersectionHelper&&(this._uiIntersectionHelper.canvasOffset=e)}setCameraOffset(e){this._offsetAnimationStart(),this.cameraBehaviour3d.cameraControl.getCamera().offset&&(this.cameraBehaviour3d.cameraControl.getCamera().offset=e,this._renderEverything()),this._offsetAnimationEnd()}_offsetAnimationStart(){this._onCameraMove()}_offsetAnimationEnd(){this._onCameraIdle()}getCameraOffset(){return this.cameraBehaviour3d?.cameraControl?.getCamera()?.offset?JSON.parse(JSON.stringify(this.cameraBehaviour3d.cameraControl.getCamera().offset)):{left:0,top:1,right:1,bottom:0}}_checkUndoRedo(e){if(ze(e)&&e.shiftKey&&e.key==="z"){this.redo();return}ze(e)&&e.key==="z"&&this.undo()}_onKeyDown(e){super._onKeyDown(e),this._checkUndoRedo(e),e.key&&(e.key==="Escape"||e.key==="Esc")&&(this._getViewModel().hasPreviews()||this.cancelComponentSelection(!1,"click_outside"),e.preventDefault()),e.key&&e.key.includes("Shift")&&this.cameraBehaviour3d.cameraControl instanceof ye&&(this.enablePanning(),e.preventDefault()),this._sceneEventHandler&&this._sceneEventHandler.hasSelection()&&e.key&&(e.key==="Backspace"||e.key==="Delete")&&(this.requestDeleteSelectedComponent(),e.preventDefault())}_onKeyUp(e,t=!1){super._onKeyUp(e,t),e.key&&e.key.includes("Shift")&&(t||this.disablePanning(),e.preventDefault())}enablePanning(){this.configuratorCameraBehaviour.enablePanningOnShiftClick()}disablePanning(){this.configuratorCameraBehaviour.disablePanningOnShiftRelease()}cancelPreviousDockings(){this._cancelDockings(!0,null,!1,!1),this._roomleRenderer?.forceShadowUpdates(!0),this._renderEverything()}cancelComponentSelection(e,t){!this._sceneEventHandler.hasSelection()&&this._sceneEventHandler.getSelectionMode()===I.STANDARD||this._cancelSelection(e,t)}notifyPlannerOnComponentSelectionCancel(e,t){}_cancelSelection(e,t){this._sceneEventHandler.cancelSelection(t),this._configuratorContext.selectionMode=I.STANDARD,this._configuratorContext.selectedRuntimeComponentIds=[],this._getViewModel().removePreviews(),e&&!this._initData.debug&&this.configuratorCameraBehaviour&&this.configuratorCameraBehaviour.resetCameraToStateOnCancelSelection();const i=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId)?.externalObject;this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId),this._configuratorUiCallbacks.onSelectionCancel(t),this.notifyPlannerOnComponentSelectionCancel(i,t)}_selectComponent(e,t){this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds(),t||(this._sceneEventHandler.getSelectionMode()===I.STANDARD?this._onSelectedRuntimeComponentChange(e):this._onSelectedRuntimeComponentsChange(this._sceneEventHandler.getSelectedRuntimeComponentIds())),this._highlightComponent(e),!this._initData.debug&&t&&this._zoomToComponentOnConsecutiveClick(e)}_deselectComponent(e,t,i){this._sceneEventHandler.getSelectionMode()===I.STANDARD&&(this._cancelSelection(t,i),this._highlightComponent()),this._sceneEventHandler.getSelectionMode()===I.MULTISELECT&&(this._sceneEventHandler.hasSelection()?this._configuratorContext.selectedRuntimeComponentIds=this._sceneEventHandler.getSelectedRuntimeComponentIds():(this._cancelSelection(t,i),this._highlightComponent())),this._componentRaycastHelper&&this._componentRaycastHelper.changeMaterialsOnSelect(this._scene,null)}getScreenXY(e){return Fe(e,this.cameraBehaviour.cameraControl.getCamera(),this._domHelper.element.clientWidth,this._domHelper.element.clientHeight)}setSelectionMode(e){this._sceneEventHandler.setSelectionMode(e)}changeFloorMaterial(e){return(!this._environment||!(this._environment instanceof he))&&(this._environment=new he(this._scene,this._environment,!0),this._uiIntersectionHelper.floorEnvironment=!0),new Promise((t,i)=>{this._environment.changeFloorMaterial(e,this._maxAnisotropy).then(()=>{this._requestRender(),t()},i)})}zoomIn(e){this.configuratorCameraBehaviour.externalApiZoomIn(e),this._renderEverything()}zoomOut(e){this.configuratorCameraBehaviour.externalApiZoomOut(e),this._renderEverything()}async showDimensions(){if(this._showCustomComponentDimensions(this._currentComponent)){this._isComponentDimensionsVisible=!0;return}await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(e=>{e&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(e)}),this._configuratorUiCallbacks.onDimensionsVisibilityChange(!0),this._renderEverything()}async _initDimensions(e=!1){this._dimensionHelper||await be.import("./main-04TgUoiW.js").then(n=>n.cM).then(({default:n})=>{this._dimensionHelper=new n(this._creator_)}),this._dimensionHelper.setUiScene(this._uiScene),this._dimensionHelper.setObject(this._getViewModel().getComponent(this._configuratorContext.rootComponentId),this.cameraBehaviour3d.cameraControl.getObjectRotation());const t=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);t&&t.boxForMeasurement&&this._dimensionHelper.updateSize(t.boxForMeasurement);const i=this.cameraBehaviour3d.cameraControl.getCamera().position;if(e){const n=te(t.boxForMeasurement);i.copy(n.getCenter(new d)),i.y=n.getSize(new d).y+1}this._dimensionHelper.moveCameraEnd(i)}hideDimensions(){if(this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()){this._removeCustomComponentDimensions(this._currentComponent),this._isComponentDimensionsVisible=!1;return}this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}async loadSceneSettings(e){await super.loadSceneSettings(e),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof he}onCameraChanged(){super.onCameraChanged(),this._configuratorUiCallbacks.onCameraPositionChanges(),this._updateComponentPosition()}requestDockingsPreview(e,t,i,n){n||(n=!1),e&&this.cancelPreviousDockings(),this.cancelComponentSelection(!1,"dock_preview"),n&&this.enableDragIn(i),t&&(this._configuratorContext.lastPossibleChild=t),this._configuratorContext.requestPreviewsIsUserInitiated=e,this.resetPreviews(),this._getKernelAccess().webGlPreviewDockings(this._configuratorContext,n),this._showDockings()}_requestDockingsPreviewWithDrag(e){this.cancelPreviousDockings(),this._configuratorContext.rootComponentId!==e&&(this.resetPreviews(),this._getKernelAccess().previewDockingsWithDrag(e,this._configuratorContext.planObjectId),this._showDockings())}_dockComponent(e){e.dockInsertAnimation?.endInsert(),this._getKernelAccess().kernelInstance.isExternalPlanObject(e.parentId)?this._dockExternalComponent(e):this._dockKernelComponent(e)}_dockKernelComponent(e){Ie.start("dock_component_"+e.childId),this._getKernelAccess().dockComponent(e.parentId,e.parentDockId,e.childId,e.childDockId),this._configuratorContext.dockingRootComponentId=null;const t=this._getKernelAccess().kernelInstance.getComponent(e.childId);this._configuratorUiCallbacks.onElementDocked(JSON.parse(JSON.stringify(t)),e.childId),this.saveConfigToIdb()}_dockExternalComponent(e){this._getKernelAccess().dockExternalObjectComponent(e.parentId,e.parentDockId,e.childId,e.childDockId)}_onSelectedRuntimeComponentsChange(e){this._getKernelAccess().multiSelectionChange(e,this._configuratorContext.rootComponentId)}_onSelectedRuntimeComponentChange(e){let t=!1,i=null;e&&(t=e.runtimeId===this._configuratorContext.rootComponentId,i=e.runtimeId),this._getKernelAccess().selectionChange(i,t),e&&this._getKernelAccess().selectedComponent(e.runtimeId)}requestDeleteSelectedComponent(){const e=this._configuratorContext.selectedRuntimeComponentIds,t=this._configuratorContext.rootComponentId;if(!(!this._getKernelAccess().isExternalObjectOrComponent(t)&&(!Array.isArray(e)||e.length===0||!t||e.indexOf(t)!==-1))){switch(this._configuratorContext.selectionMode){case I.STANDARD:this._getKernelAccess().requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case I.MULTISELECT:this._getKernelAccess().requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds);break}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){if(this._currentComponent=e,e.runtimeId===this._configuratorContext.rootComponentId){const n=new d(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,n,null)}(e.geometryChanged!==void 0?e.geometryChanged:!0)?this._renderEverything():this._renderWithoutShadowsAndAO(),this._componentDimensioningHelper?.invalidateDimensioningsCache(e.runtimeId)}planObjectUpdated(e,t,i){const n=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId);if(i||this._configuratorHistory.push(n),!!e.bounds){if(this._configuratorContext.planObjectId===e.id&&this.cameraBehaviour3d instanceof Ce){const s=this._getViewModel().getBoundingBox();this.cameraBehaviour3d.updateBoundsOnPlanObjectUpdated(s);const o=this._getViewModel().getBoundingBoxOfGeometry();this._updateBounds(s,o,t)}this._highlightComponent(),this._requestRender()}}componentDeleted(e){(this._sceneEventHandler.getSelectedRuntimeComponentIds().indexOf(e.runtimeId)!==-1||this._sceneEventHandler.getSelectionMode()===I.MULTISELECT)&&this.cancelComponentSelection(!1,"delete_component"),this._renderEverything()}previewConstructionDone(e,t){const i=this._getViewModel().getBoundingBoxWithPreviews();t||(this._cancelDockings(!0,null,!1,!1,!1),this._configuratorContext.requestPreviewsIsUserInitiated&&this._configuratorUiCallbacks.onNoDockingsAvailable());let n=!0;this._componentRaycastHelper&&(n=!this._componentRaycastHelper.areAllComponentsInFrustum(this._getViewModel().getPreviews())),this._configuratorContext.requestPreviewsIsUserInitiated&&n&&this.configuratorCameraBehaviour.zoomToFitBoundsAfterUserInitiatedPreviews(i),this._lightSetting&&this._lightSetting.needsBounds()&&(this._lightSetting.updateBounds(i),this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(i.getSize(new d))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new d(0,100,0)),this._scene.add(e),this._sceneEventHandler.addComponentDragInHandler(e),this._requestRender()):!t&&!this._initData.debug&&!this._initData.moc&&this.configuratorCameraBehaviour.resetCameraToStartOnConfigurationLoaded(this.getBounds()),this._environment&&this._environment.reload(),this._waitForAssets().then(()=>{this._readyForRender()})}addComponentHandlers(e){this._sceneEventHandler.addComponentHandlers(e)}addPreviewHandlers(e){this._sceneEventHandler.addPreviewHandlers(e)}addPreviewLineHandlers(e){this._sceneEventHandler.addPreviewLineHandlers(e)}_updateComponentPosition(){if(!this._configuratorUiCallbacks?.onComponentPositionsUpdated||this._configuratorContext.baseContext!==V.CONFIGURATOR)return;const e=[];this._getViewModel().getComponents().forEach(t=>{if(!t.boundingBoxMesh)return;const i=new O().setFromObject(t.boundingBoxMesh),n=this._getKernelAccess().kernelInstance.getComponent(t.runtimeId),o=n.parameters||n.possibleChildren?["edit"]:[];e.push({id:t.runtimeId,position:this.getScreenXY(i.getCenter(new d)),type:"component",actions:o})}),this._getViewModel().getPreviews().forEach(t=>{const i=new O().setFromObject(t),n=["add"];e.push({id:t.runtimeId,position:this.getScreenXY(i.getCenter(new d)),type:"preview",actions:n})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e)}_updateBounds(e,t,i=!1){if(super._updateBounds(e,t,i),!e)return;const n=e.getSize(new d),s=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);s&&s.boxForMeasurement&&this._dimensionHelper?.updateSize(s.boxForMeasurement),this._sceneEventHandler.update(n,null,null),this._uiIntersectionHelper.updateToBounds(n,this._domHelper.element.clientWidth,this._domHelper.element.clientHeight),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this.cameraBehaviour3d.cameraControl.getCamera().updateProjectionMatrix()}async moveCamera(e){return this.configuratorCameraBehaviour.externalApiMoveCamera(e)}getSelectedRuntimeComponentIds(){return this._sceneEventHandler.getSelectedRuntimeComponentIds()}selectComponent(e,t=!0){if(!e)return;const n=this._getViewModel().getComponents().find(s=>s.runtimeId===e);if(!n){console.warn('Can not select "'+e+'" because it was not found');return}this._sceneEventHandler.clickComponent(n,t)}highlightParts(e){this._highlightComponent(null,e),this._requestRender()}_shouldHighlightComponent(){return this._configuratorContext.baseContext!==V.CONFIGURATOR?!1:this._initData.highlighting===Ue.ALWAYS?!0:this._initData.highlighting===Ue.OFF?!1:this._getKernelAccess().kernelInstance.getComponent(this._configuratorContext.rootComponentId).externalComponent?!0:(this._plannerKernelAccess.kernelInstance.getChildrenOfPlanComponent(this._configuratorContext.rootComponentId,!0,!1)||[]).length>1}saveConfigToIdb(){let e,t;const{configuratorId:i}=this._globalInitData,{lastLoadedPlanId:n,lastLoadedRapiId:s}=this._configuratorContext;this._initData.moc?(e=n,t=this._getKernelAccess()?.planInteractionHandler.getPlan()?.getPlanXML(!1,2)):(e=s,t=this._getKernelAccess().kernelInstance.getSerializedConfiguration(this._configuratorContext.planObjectId));const o=this._idbManager.getKey(Bt(),i,e);this._idbManager.setValue(o,t,this._idbManager.configStore)}_getInputManager(){return this._configuratorInputManager}createCameraControl(e,t){this._componentFactory=ve();const i=this._domHelper.getClientDimensions(),n=i.x,s=i.y,o=this._componentFactory.createPerspectiveCamera(30,n/s,.1,20,t);o.layers.set(v.OBJECT),o.layers.enable(v.LIGHTING),o.layers.enable(v.BACKGROUND),o.layers.enable(v.UI),o.layers.enable(v.PREVIEW),o.position.copy(new d(0,.5,5)),this._changeCameraBehaviour(new Ce(new ye(this._creator_,this._getInputManager(),null,o),this._cameraBehaviourState))}getBounds(){return this._getViewModel().getBoundingBox()}getGeometryBounds(){return this._getViewModel().getBoundingBoxOfGeometry()}sceneChanged(){}get configuratorCameraBehaviour(){return this.cameraBehaviour instanceof Ce?this.cameraBehaviour:null}get cameraBehaviour3d(){return this.cameraBehaviour}_onCameraIdle(){return super._onCameraIdle()}_onCameraMove(){return super._onCameraMove()}getComponent(e){return this._plannerKernelAccess.kernelInstance.getComponent(e)}cameraBehaviourChanged(){super.cameraBehaviourChanged(),this._sceneEventHandler?.setCamera(this.cameraBehaviour.cameraControl.getCamera()),this._setCameraControlListeners()}_setCameraControlListeners(){this.cameraBehaviour3d&&(this.cameraBehaviour.cameraControl.addEventListener(H.ORBIT_START,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(H.ORBIT_MOVE,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._getViewModel()),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(H.ORBIT_END,()=>{this._sceneEventHandler.setCameraMoving(!1),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(H.ZOOM_CHANGE,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this.cameraBehaviour.cameraControl.addEventListener(H.ZOOM_IN,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(H.ZOOM_OUT,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(H.MOVING,()=>{this._pluginSystem.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position),this._dimensionHelper?.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position)},this),this.cameraBehaviour.cameraControl.addEventListener(H.IDLE,()=>{this._pluginSystem.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position),this._dimensionHelper?.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position),this._updateComponentPosition()},this))}_shouldRenderUi(){return super._shouldRenderUi()||this._dimensionHelper?.areDimensionsEnabled()}setEventHandlerObject(e){this._sceneEventHandler.setObject(e)}_readyForRender(){this._configuratorContext.baseContext===V.CONFIGURATOR&&(console.log("ready_for_render"),this._configuratorUiCallbacks.onReadyForRender(),this._globalCallback.onReadyForRender())}animateElement(e,t,i,n,s){const o=Gt+t;this._viewModel.changeAnimationValue(e,o,i,0,n,s)}undo(){return new Promise((e,t)=>{const i=this._configuratorHistory.undo();i&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(i))})}redo(){return new Promise((e,t)=>{const i=this._configuratorHistory.redo();i&&(this._callOnPartListUpdate().then(e,t),this._plannerKernelAccess.loadConfiguration(i))})}clearHistory(){this._configuratorHistory.clearHistory()}async _callOnPartListUpdate(){const{hash:e}=await xe.waitFor(Ee.CONFIGURATION_LOADED),t=await this._plannerKernelAccess.getPartList(),i=await this._plannerKernelAccess.getConfigurationHash(this._configuratorContext),n=await this._plannerKernelAccess.addUiDataAndPriceToPartList(t,i);this._configuratorUiCallbacks.onPartListUpdate(n,window.btoa(e))}_showCustomComponentDimensions(e){const t=e||this._currentComponent;if(!t||!this._componentDimensioningHelper)return!1;const i=this._componentDimensioningHelper.add(t,()=>{this._renderEverything()});return i&&this._renderEverything(),i}async _removeCustomComponentDimensions(e){const t=e||this._currentComponent;!t||!this._componentDimensioningHelper||(await this._componentDimensioningHelper.remove(t),this._renderEverything())}}P("C",R),A([p],R.prototype,"_configuratorInputManager"),A([p],R.prototype,"_configuratorMeshGenerator"),A([p],R.prototype,"_memoryManager"),A([p],R.prototype,"_configuratorContext"),A([p],R.prototype,"_componentDimensioningHelper"),A([p],R.prototype,"_configuratorHistory"),A([p],R.prototype,"_configuratorUiCallbacks"),A([p],R.prototype,"_plannerKernelAccess"),A([p],R.prototype,"_globalInitData")}}});
2
+ //# sourceMappingURL=configurator-scene-manager-BGg58f7L.js.map