@roomle/web-sdk 2.107.0 → 2.108.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{PointLightHelper-BkdQaOKc.js → PointLightHelper-B8VP_55Z.js} +2 -2
- package/lib/{PointLightHelper-BkdQaOKc.js.map → PointLightHelper-B8VP_55Z.js.map} +1 -1
- package/lib/{PointLightHelper-qhWtXw8x.mjs → PointLightHelper-DtoZq5ME.mjs} +2 -2
- package/lib/{PointLightHelper-qhWtXw8x.mjs.map → PointLightHelper-DtoZq5ME.mjs.map} +1 -1
- package/lib/RoomleCore.js +6 -6
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{banana-for-scale-XjIfe69B.js → banana-for-scale-BVlDK4jg.js} +2 -2
- package/lib/{banana-for-scale-XjIfe69B.js.map → banana-for-scale-BVlDK4jg.js.map} +1 -1
- package/lib/{banana-for-scale-CDGM3hdN.mjs → banana-for-scale-CKSlc9Tc.mjs} +2 -2
- package/lib/{banana-for-scale-CDGM3hdN.mjs.map → banana-for-scale-CKSlc9Tc.mjs.map} +1 -1
- package/lib/camera-behaviour-CzgZxW1D.js +50 -0
- package/lib/camera-behaviour-CzgZxW1D.js.map +1 -0
- package/lib/{camera-behaviour-BLMduSEn.mjs → camera-behaviour-DWkBHxkk.mjs} +79 -75
- package/lib/camera-behaviour-DWkBHxkk.mjs.map +1 -0
- package/lib/{component-dimensioning-Do75G-kI.js → component-dimensioning-CUoDDxfk.js} +2 -2
- package/lib/{component-dimensioning-Do75G-kI.js.map → component-dimensioning-CUoDDxfk.js.map} +1 -1
- package/lib/{component-dimensioning-DvCO0pEp.mjs → component-dimensioning-CgVIP7Nu.mjs} +2 -2
- package/lib/{component-dimensioning-DvCO0pEp.mjs.map → component-dimensioning-CgVIP7Nu.mjs.map} +1 -1
- package/lib/{component-raycast-helper-Dl-pzfg_.js → component-raycast-helper-DvNtWlR5.js} +2 -2
- package/lib/{component-raycast-helper-Dl-pzfg_.js.map → component-raycast-helper-DvNtWlR5.js.map} +1 -1
- package/lib/{component-raycast-helper-CuZdUtrH.mjs → component-raycast-helper-zAwc-AuF.mjs} +2 -2
- package/lib/{component-raycast-helper-CuZdUtrH.mjs.map → component-raycast-helper-zAwc-AuF.mjs.map} +1 -1
- package/lib/{configurator-CT_ghGbX.mjs → configurator-DDhzCgxy.mjs} +6 -6
- package/lib/{configurator-CT_ghGbX.mjs.map → configurator-DDhzCgxy.mjs.map} +1 -1
- package/lib/{configurator-B01iJTNa.js → configurator-DJnpG8CG.js} +2 -2
- package/lib/{configurator-B01iJTNa.js.map → configurator-DJnpG8CG.js.map} +1 -1
- package/lib/configurator-scene-manager-Bxdyg2zz.js +2 -0
- package/lib/configurator-scene-manager-Bxdyg2zz.js.map +1 -0
- package/lib/{configurator-scene-manager-DbsYS4rm.mjs → configurator-scene-manager-DnZvFw0N.mjs} +150 -162
- package/lib/configurator-scene-manager-DnZvFw0N.mjs.map +1 -0
- package/lib/configurator.js +1 -1
- package/lib/configurator.nomodule.js +1 -1
- package/lib/{continuous-drawing-helper-DdnnCOqZ.js → continuous-drawing-helper-C6qDGAxa.js} +2 -2
- package/lib/{continuous-drawing-helper-DdnnCOqZ.js.map → continuous-drawing-helper-C6qDGAxa.js.map} +1 -1
- package/lib/{continuous-drawing-helper-DrpQFppG.mjs → continuous-drawing-helper-DbTM7uCv.mjs} +2 -2
- package/lib/{continuous-drawing-helper-DrpQFppG.mjs.map → continuous-drawing-helper-DbTM7uCv.mjs.map} +1 -1
- package/lib/{default-light-setting-D0Ie_AEw.mjs → default-light-setting-BdD0jDeP.mjs} +3 -3
- package/lib/{default-light-setting-D0Ie_AEw.mjs.map → default-light-setting-BdD0jDeP.mjs.map} +1 -1
- package/lib/{default-light-setting-DQxt3v5x.js → default-light-setting-CYiFuxeI.js} +2 -2
- package/lib/{default-light-setting-DQxt3v5x.js.map → default-light-setting-CYiFuxeI.js.map} +1 -1
- package/lib/definitions/common-core/src/light/light-source.d.ts +2 -0
- package/lib/definitions/common-core/src/utils/threejs-utils.d.ts +2 -1
- package/lib/definitions/common-core/src/webgl/roomle-component-factory.d.ts +1 -0
- package/lib/definitions/common-core/src/webgl/scene-manager.d.ts +1 -1
- package/lib/definitions/planner-core/src/lights/ceiling-light.d.ts +1 -1
- package/lib/definitions/planner-core/src/lights/light-group.d.ts +1 -2
- package/lib/definitions/planner-core/src/roomle-planner.d.ts +12 -6
- package/lib/definitions/planner-core/src/services/planner-kernel-access.d.ts +1 -1
- package/lib/definitions/planner-core/src/view-model/plan-view-model.d.ts +1 -4
- package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +5 -1
- package/lib/{glb-viewer-BEWU9zxC.mjs → glb-viewer-BoZgMSrk.mjs} +6 -6
- package/lib/{glb-viewer-BEWU9zxC.mjs.map → glb-viewer-BoZgMSrk.mjs.map} +1 -1
- package/lib/{glb-viewer-camera-behaviour-Cl2bS83k.js → glb-viewer-camera-behaviour-AEWNZ6mR.js} +2 -2
- package/lib/{glb-viewer-camera-behaviour-Cl2bS83k.js.map → glb-viewer-camera-behaviour-AEWNZ6mR.js.map} +1 -1
- package/lib/{glb-viewer-camera-behaviour-DQ2sVbku.mjs → glb-viewer-camera-behaviour-CRnnMrL2.mjs} +2 -2
- package/lib/{glb-viewer-camera-behaviour-DQ2sVbku.mjs.map → glb-viewer-camera-behaviour-CRnnMrL2.mjs.map} +1 -1
- package/lib/{glb-viewer-6_OVDzVH.js → glb-viewer-vvpjnYPw.js} +2 -2
- package/lib/{glb-viewer-6_OVDzVH.js.map → glb-viewer-vvpjnYPw.js.map} +1 -1
- package/lib/glb-viewer.js +1 -1
- package/lib/glb-viewer.nomodule.js +1 -1
- package/lib/{imos-ix-poc-export-helper-r0pv9sOT.js → imos-ix-poc-export-helper-7AWayvID.js} +2 -2
- package/lib/{imos-ix-poc-export-helper-r0pv9sOT.js.map → imos-ix-poc-export-helper-7AWayvID.js.map} +1 -1
- package/lib/{imos-ix-poc-export-helper-BrpY0OHi.mjs → imos-ix-poc-export-helper-gQb0lbdn.mjs} +2 -2
- package/lib/{imos-ix-poc-export-helper-BrpY0OHi.mjs.map → imos-ix-poc-export-helper-gQb0lbdn.mjs.map} +1 -1
- package/lib/{main-05wLxbDZ.js → main-DVWEbQdM.js} +340 -149
- package/lib/{main-05wLxbDZ.js.map → main-DVWEbQdM.js.map} +1 -1
- package/lib/{main-CMu7hOEO.mjs → main-RpgY_kch.mjs} +2202 -1999
- package/lib/{main-CMu7hOEO.mjs.map → main-RpgY_kch.mjs.map} +1 -1
- package/lib/{material-viewer-B0MevA_r.mjs → material-viewer-DQjAOrWL.mjs} +4 -4
- package/lib/{material-viewer-B0MevA_r.mjs.map → material-viewer-DQjAOrWL.mjs.map} +1 -1
- package/lib/{material-viewer-CLqZXFrn.js → material-viewer-_9Sb1UCw.js} +2 -2
- package/lib/{material-viewer-CLqZXFrn.js.map → material-viewer-_9Sb1UCw.js.map} +1 -1
- package/lib/material-viewer.js +1 -1
- package/lib/material-viewer.nomodule.js +1 -1
- package/lib/planner-BcHlq0n3.js +155 -0
- package/lib/planner-BcHlq0n3.js.map +1 -0
- package/lib/{planner-B3Bt-cWy.mjs → planner-BilNNFJ0.mjs} +143 -125
- package/lib/planner-BilNNFJ0.mjs.map +1 -0
- package/lib/planner.js +1 -1
- package/lib/planner.nomodule.js +1 -1
- package/lib/roomle-sdk.js +7 -7
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/{script-loader-CZjzwkk2.js → script-loader-BZOMZ1AI.js} +2 -2
- package/lib/{script-loader-CZjzwkk2.js.map → script-loader-BZOMZ1AI.js.map} +1 -1
- package/lib/{script-loader-BzwDLtbS.mjs → script-loader-CHolkWhE.mjs} +2 -2
- package/lib/{script-loader-BzwDLtbS.mjs.map → script-loader-CHolkWhE.mjs.map} +1 -1
- package/lib/static/roomle-core-hsc/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/RoomleCore.js +6 -6
- package/lib/static/roomle-core-hsc/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/RoomleServiceCore.js +6 -6
- package/lib/static/roomle-core-hsc/RoomleServiceCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/RoomleToolsCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/configuratorCoreInterface.d.ts +2 -0
- package/lib/static/roomle-core-hsc/embind/configuratorCoreInterface.d.ts +2 -0
- package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.d.ts +2 -2
- package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.js +1 -1
- package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.js.map +1 -1
- package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.d.ts +17 -2
- package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js.map +1 -1
- package/lib/static/roomle-core-hsc/package.json +1 -1
- package/lib/static/roomle-core-hsc/plannerCoreCallback.d.ts +2 -2
- package/lib/static/roomle-core-hsc/plannerCoreCallback.js +1 -1
- package/lib/static/roomle-core-hsc/plannerCoreCallback.js.map +1 -1
- package/lib/static/roomle-core-hsc/plannerCoreInterface.d.ts +17 -2
- package/lib/static/roomle-core-hsc/plannerCoreInterface.js.map +1 -1
- package/lib/static/roomle-core-hsc/src/embind/configuratorCoreInterface.d.ts +2 -0
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.d.ts +2 -2
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.js +1 -1
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.js.map +1 -1
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +17 -2
- package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js.map +1 -1
- package/lib/static/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.js +6 -6
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleServiceCore.js +6 -6
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleServiceCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
- package/lib/{stats-helper-BaTpWjzi.mjs → stats-helper-BFpxduid.mjs} +2 -2
- package/lib/{stats-helper-BaTpWjzi.mjs.map → stats-helper-BFpxduid.mjs.map} +1 -1
- package/lib/{stats-helper-DylhlHS_.js → stats-helper-D4z7zVEi.js} +2 -2
- package/lib/{stats-helper-DylhlHS_.js.map → stats-helper-D4z7zVEi.js.map} +1 -1
- package/lib/{tools-core-BF9kMznR.js → tools-core-BJbLUz5-.js} +2 -2
- package/lib/{tools-core-BF9kMznR.js.map → tools-core-BJbLUz5-.js.map} +1 -1
- package/lib/{tools-core-BbL-KMAf.mjs → tools-core-COGP-hBi.mjs} +3 -3
- package/lib/{tools-core-BbL-KMAf.mjs.map → tools-core-COGP-hBi.mjs.map} +1 -1
- package/package.json +1 -1
- package/lib/camera-behaviour-BLMduSEn.mjs.map +0 -1
- package/lib/camera-behaviour-DgLVg_pP.js +0 -50
- package/lib/camera-behaviour-DgLVg_pP.js.map +0 -1
- package/lib/configurator-scene-manager-CRSHxOfd.js +0 -2
- package/lib/configurator-scene-manager-CRSHxOfd.js.map +0 -1
- package/lib/configurator-scene-manager-DbsYS4rm.mjs.map +0 -1
- package/lib/planner-B3Bt-cWy.mjs.map +0 -1
- package/lib/planner-D7lLZxgW.js +0 -155
- package/lib/planner-D7lLZxgW.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register(["./camera-behaviour-CzgZxW1D.js","./main-DVWEbQdM.js","./main-thread-to-worker-C8MPjAY0.js","./Object3D-BBDnGQZV.js","./default-light-setting-CYiFuxeI.js"],function(D,be){"use strict";var $,ve,Xe,$e,Qe,Je,et,tt,ye,ae,A,N,it,T,Q,nt,st,Oe,Pe,ot,J,he,le,rt,Me,at,ht,lt,y,ce,ct,dt,Ie,_t,De,xe,ut,mt,ee,P,gt,f,F,pt,ft,de,te,Ee,Se,He,Re,je,Le,Ct,Ae,wt,V,bt,_e,u,vt,ie,O,W,ne,yt,Ot,Pt,Te,Mt,Ve,Be,ke,Ge,M,Fe,It,Dt,xt,Et,St,Ht,Rt,jt,ue,Lt,At,Tt,Vt,Bt,ze,kt,Ue,Gt,Ft,zt,w,H,g,Ut,me,Nt,Wt,K,z,Kt,Ne,ge,qt;return{setters:[a=>{$=a.O,ve=a.R,Xe=a.c,$e=a.S,Qe=a.P,Je=a.g,et=a.B,tt=a.D,ye=a.C,ae=a.F,A=a.b},a=>{N=a.by,it=a.bz,T=a.v,Q=a.$,nt=a.bA,st=a.t,Oe=a.Z,Pe=a.a0,ot=a.bB,J=a.w,he=a.bC,le=a.bD,rt=a.bE,Me=a.R,at=a.bF,ht=a.bG,lt=a.bH,y=a.H,ce=a.q,ct=a.o,dt=a.bI,Ie=a.br,_t=a.O,De=a.bJ,xe=a.bK,ut=a.bL,mt=a.bM,ee=a.b6,P=a.W,gt=a.a_,f=a.j,F=a.aK,pt=a.a8,ft=a.bN,de=a.aO,te=a.aH,Ee=a.aN,Se=a.aI,He=a.aA,Re=a.aP,je=a.as,Le=a.at,Ct=a.bO,Ae=a.aB,wt=a.bP,V=a.B,bt=a.bQ,_e=a.aq,u=a.V,vt=a.F,ie=a.bR,O=a.au,W=a.az,ne=a.ao,yt=a.bS,Ot=a.bT,Pt=a.Q,Te=a.bU,Mt=a.ay,Ve=a.bw,Be=a.bV,ke=a.av,Ge=a.ax,M=a.ar,Fe=a.aR,It=a.a1,Dt=a.bW,xt=a.bX,Et=a.bY,St=a.bZ,Ht=a.a2,Rt=a.a3,jt=a.b3,ue=a.be,Lt=a.bf,At=a.a9,Tt=a.b_,Vt=a.b$,Bt=a.c0,ze=a.bb,kt=a.c1,Ue=a.c2,Gt=a.b1,Ft=a.bv,zt=a.c3},a=>{w=a.C},a=>{H=a.g,g=a.V,Ut=a.d,me=a.W,Nt=a.v,Wt=a.S,K=a.b,z=a.M,Kt=a.O,Ne=a.R,ge=a.D},a=>{qt=a.D}],execute:function(){const a=(h,e)=>{const t=N.filterAnimationParameters(e);if(t.length!==0)for(const i of h){i.animationValueMap??=new N;for(const n of t)i.animationValueMap.updateParameterValue(n)}},Yt=(h,e,t,i,n,s)=>{h.animationValueMap??=new N;const o=N.getAnimationName(e),r=h.animationValueMap.setValueAndGetOldValue(o,t,i),l=h.animationValueMap.getPriorAnimations(o,i),d=h.animationValueMap.getSequentAnimations(o,i);h.animateMeshes&&h.animateMeshes(o,{from:r,to:t,priorAnimations:l,subsequentAnimations:d},n,s)};class q 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 q(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 q(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 Oe().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=Pe();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 di=16755200,_i=.9,ui=25,mi=11,gi=.6;class se extends ot{static fromStaticObject(e,t=!1){const i=e.getObject().userData;return new se(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 se(n,t);return s.shadow.camera.near=.1,s.shadow.camera.far=20,s.shadow.intensity=1,s}constructor(e,t){super(di,_i,ui),e.intensity?this.intensity=e.intensity:this.power=mi,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-B8VP_55Z.js").then(({PointLightHelper:i})=>{this._helper=new i(this,0),this._helper.visible=!1,this.add(this._helper)}),this.castShadow=!0,this.shadow.intensity=gi,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=Pe();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 pi=h=>{switch(h.type.value){case he.SPOT:return le.fromKernelAttributes(h);case he.POINT:return se.fromKernelAttributes(h);case he.AREA:return q.fromKernelAttributes(h)}return null};class fi{constructor(e,t){this._lightSourceId=e,this._light=t,this._light.castShadow=!1}get lightSourceId(){return this._lightSourceId}get isLightOn(){return this._light.visible===!0}addToScene(e){e.add(this._light)}removeFromScene(){this._light.removeFromParent(),this._light.dispose()}setLightOnOff(e){this._light.visible=e,this._light.matrixWorldNeedsUpdate=!0}updateLightSource(e){this._light instanceof le?this._light.updateAttributes(e):this._light instanceof se?this._light.updateAttributes(e):this._light instanceof q&&this._light.updateAttributes(e)}}class Ci{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 N,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 wi=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&&wi(e,t,n),n};class Y{constructor(e){this._mergeThreshold=3,this._componentsToMerge=new bi,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 Me.lookup("planner-kernel-access",this._creator_)}_applyMeshTransform(e,t,i,n,s,o,r){if(n){const l=t.userData.transform=at(n);i&&(t.userData.transform=l),t.applyMatrix4(l)}this._applyMeshUVTransform(t,i,s,r),$.setObjectAnimations(t,o,this.getComponent(e))}_applyMeshUVTransform(e,t,i,n){if(i?.length===6&&!ht(i)){const s=lt(i);t&&(t.uvTransform=s);const o=n??e.geometry;if(o&&o.attributes.uv){const r=o.clone();r.attributes.uv.applyMatrix4(s),e.geometry=r}}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);a(i,t)}changeAnimationValue(e,t,i,n,s,o){const r=this.getComponentFromElementId(e);r&&(s?r.traverse(l=>{l.id&&Yt(l,t,i,n,o,this._invalidateRenderCallback)}):Yt(r,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,r,l,d,c,p){const _=this._generateMesh(e,t,i,o,r,l,d,void 0,void 0,c);this._applyMeshTransform(e,_,null,n,s,p),this._subPartObject.add(_)}_addMeshToComponent(e,t,i,n,s,o,r,l,d,c,p,_,I){if(this._subPartGuard&&this._subPartGuard.info===e){this._addMeshToSubPart(e,null,n,null,null,r,l,d,c,_,I);return}const C=this.getComponent(e);if(!C)return;const b=this._componentFactory.isPreview(C),m=this._generateMesh(e,i,b?null:n,r,l,d,c,void 0,void 0,_);m.userData.meshId=t,m.userData.geometryId=i,m.userData.materialId=n,this._applyMeshTransform(e,m,m.userData,s,o,I),b&&m.layers.set(y.PREVIEW),C&&C.addMesh(m),C.meshes.length>this._mergeThreshold&&this._componentsToMerge.set(e,C.meshes.length)}_changeMeshOfComponent(e,t,i,n,s,o,r,l){const d=this.getComponent(e);if(!d)return;const c=d.getMeshById(t);if(c){c.userData.geometryId!==i&&console.warn("Geometry of mesh has changed!"),c.userData.materialId=n,c.userData.materialAttributes=r;const p=c.material.clone();this._configuratorMeshGenerator.setMaterial(c,n,void 0,r).then(()=>{this._requestRenderSceneUpdateCallback&&this._requestRenderSceneUpdateCallback()}),p.opacity!==c.material.opacity&&this._requestRenderCallback&&this._requestRenderCallback(),s&&(c.position.set(0,0,0),c.scale.set(1,1,1),c.rotation.set(0,0,0));const _=this._configuratorMeshGenerator.getGeometry(i);this._applyMeshTransform(e,c,c.userData,s,o,l,_)}}_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=pi(i);if(!o)return;const r=new fi(t,o);n.addLightSource(r)}_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 r=o.userData.materialId;if(!r){console.warn("mesh has no material id set");return}if(!i.has(r)){const c=new ce(new ct,o.material);c.userData.materialId=r,c.receiveShadow=!0,c.castShadow=!0,c.layers.set(y.OBJECT),this._setMaterial(c,r),n.push(c),i.set(r,c)}const l=i.get(r),d=l.geometry;o.userData.transform&&o.geometry.applyMatrix4(o.userData.transform),l.geometry=dt([d,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),r=this._components.get(e);r&&(r.roomlePosition=n,r.roomleRotation=s,o&&o.add(r),r.parentObjectId=i,r.isRootComponent=t,this._addComponent(r))}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(y.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];De.finishOperation(xe.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 r;o===0?r=n:r=n.clonePreviewLine(o),r.name="Preview Line",r.parentDockId=e[o].parentDockId,r.parentId=e[o].parentId,r.childDockId=e[o].childDockId,r.childId=e[o].childId,r.docklineRotation=ut(e[o].rotation),r.roomlePosition=e[o].position,r.roomleLineFrom=e[o].lineFrom,r.roomleLineTo=e[o].lineTo,r.lineSegments=[];for(const l of e[o].lineSegments)r.lineSegments.push({from:l.from/1e3,to:l.to/1e3});r.roomlePositionFrom=e[o].positionFrom,r.roomlePositionTo=e[o].positionTo,s.add(r),r.preparePreview(),this._previews.set(r.stringId,r)}}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 r=e[s].position;o.roomlePosition=r,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 Ci(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===mt&&(this._configuratorContext.dockingRootComponentId=i);const o=t===0;o?this._getKernelAccess().kernelInstance.requestPlanComponentConstructionRecursive(i):this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(t);const r=this._getKernelAccess().kernelInstance.getComponent(i),l=this._components.get(i);l&&(l.computeBoundingBox(r.boxForMeasurement),l.hash=r.hash),this._listener&&this._listener.configurationLoaded(l,o&&l.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 ee(e.boxForMeasurement)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return new P().setFromObject(e)}return null}getBoundingBoxOfGeometry(){if(this._configuratorContext.planObjectId){const e=this._getKernelAccess().kernelInstance.getPlanObject(this._configuratorContext.planObjectId);if(e&&e.boxOfGeometry)return ee(e.boxOfGeometry)}else if(this._configuratorContext.rootComponentId){const e=this._components.get(this._configuratorContext.rootComponentId);return new P().setFromObject(e)}return null}getBoundingBoxWithPreviews(){const e=this._components.get(this._configuratorContext.rootComponentId);return e?new P().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,r,l,d,c){return this._configuratorMeshGenerator.generateMesh(e,t,i,n,s,o,r,!1,c)}_setMaterial(e,t,i){this._configuratorMeshGenerator.setMaterial(e,t)}constructComponents(e){this._getKernelAccess().kernelInstance.requestPlanObjectConstruction(e)}requestSubPartConstruction(e){return this._subPartGuard=new gt(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}}D("a",Y),pe([f],Y.prototype,"_configuratorMeshGenerator"),pe([f],Y.prototype,"_configuratorContext"),pe([f],Y.prototype,"_cacheHolder"),pe([f],Y.prototype,"_initData");class bi 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 R{constructor(e=0,t=0,i=0,n=1){R.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 l=e.elements,d=l[0],c=l[4],p=l[8],_=l[1],I=l[5],C=l[9],b=l[2],m=l[6],X=l[10];if(Math.abs(c-_)<.01&&Math.abs(p-b)<.01&&Math.abs(C-m)<.01){if(Math.abs(c+_)<.1&&Math.abs(p+b)<.1&&Math.abs(C+m)<.1&&Math.abs(d+I+X-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const G=(d+1)/2,S=(I+1)/2,we=(X+1)/2,hi=(c+_)/4,li=(p+b)/4,ci=(C+m)/4;return G>S&&G>we?G<.01?(i=0,n=.707106781,s=.707106781):(i=Math.sqrt(G),n=hi/i,s=li/i):S>we?S<.01?(i=.707106781,n=0,s=.707106781):(n=Math.sqrt(S),i=hi/n,s=ci/n):we<.01?(i=.707106781,n=.707106781,s=0):(s=Math.sqrt(we),i=li/s,n=ci/s),this.set(i,n,s,t),this}let k=Math.sqrt((m-C)*(m-C)+(p-b)*(p-b)+(_-c)*(_-c));return Math.abs(k)<.001&&(k=1),this.x=(m-C)/k,this.y=(p-b)/k,this.z=(_-c)/k,this.w=Math.acos((d+I+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=H(this.x,e.x,t.x),this.y=H(this.y,e.y,t.y),this.z=H(this.z,e.z,t.z),this.w=H(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=H(this.x,e,t),this.y=H(this.y,e,t),this.z=H(this.z,e,t),this.w=H(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(H(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}}D("V",R);const We=new g,vi=new g,yi=new Ut;class Z{constructor(e=new g(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(vi.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||yi.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 U=new Wt,fe=new g;class Oi{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 r=this.planes;return r[0].copy(e),r[1].copy(t),r[2].copy(i),r[3].copy(n),r[4].copy(s),r[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=me){const i=this.planes,n=e.elements,s=n[0],o=n[1],r=n[2],l=n[3],d=n[4],c=n[5],p=n[6],_=n[7],I=n[8],C=n[9],b=n[10],m=n[11],X=n[12],k=n[13],G=n[14],S=n[15];if(i[0].setComponents(l-s,_-d,m-I,S-X).normalize(),i[1].setComponents(l+s,_+d,m+I,S+X).normalize(),i[2].setComponents(l+o,_+c,m+C,S+k).normalize(),i[3].setComponents(l-o,_-c,m-C,S-k).normalize(),i[4].setComponents(l-r,_-p,m-b,S-G).normalize(),t===me)i[5].setComponents(l+r,_+p,m+b,S+G).normalize();else if(t===Nt)i[5].setComponents(r,p,b,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(),U.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),U.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(U)}intersectsSprite(e){return U.center.set(0,0,0),U.radius=.7071067811865476,U.applyMatrix4(e.matrixWorld),this.intersectsSphere(U)}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,Zt=new g,Xt=new g;class Pi{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.map=null,this.mapPass=null,this.matrix=new z,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Oi,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new R(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Zt.setFromMatrixPosition(e.matrixWorld),t.position.copy(Zt),Xt.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Xt),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 Kt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new z,this.projectionMatrix=new z,this.projectionMatrixInverse=new z,this.coordinateSystem=me}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 g,$t=new K,Qt=new K;class Ii 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(ge*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ne*2*Math.atan(Math.tan(ge*.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,$t,Qt),t.subVectors(Qt,$t)}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(ge*.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 l=o.fullWidth,d=o.fullHeight;s+=o.offsetX*n/l,t-=o.offsetY*i/d,n*=o.width/l,i*=o.height/d}const r=this.filmOffset;r!==0&&(s+=e*r/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 Jt=new z,oe=new g,qe=new g;class Di extends Pi{constructor(){super(new Ii(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new K(4,2),this._viewportCount=6,this._viewports=[new R(2,1,1,1),new R(0,1,1,1),new R(3,1,1,1),new R(1,1,1,1),new R(3,0,1,1),new R(1,0,1,1)],this._cubeDirections=[new g(1,0,0),new g(-1,0,0),new g(0,0,1),new g(0,0,-1),new g(0,1,0),new g(0,-1,0)],this._cubeUps=[new g(0,1,0),new g(0,1,0),new g(0,1,0),new g(0,1,0),new g(0,0,1),new g(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()),oe.setFromMatrixPosition(e.matrixWorld),i.position.copy(oe),qe.copy(i.position),qe.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(qe),i.updateMatrixWorld(),n.makeTranslation(-oe.x,-oe.y,-oe.z),Jt.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Jt)}}const ei=1;class xi extends F{constructor(){super(),this.children=[],this._availableShadowMaps=[];for(let e=0;e<ei;e++){const t=new pt(90,1,.5,500),i=new Di(t);i.mapSize.width=512,i.mapSize.height=512,this._availableShadowMaps.push(i)}}get lightsOn(){return this.children.every(e=>e.power>0)}add(...e){for(const t of e){const i=this.children.length;if(this._availableShadowMaps.length>0){const n=this._availableShadowMaps[i%ei];t.shadow=n,t.castShadow=!1,n.camera.position.copy(t.position)}}return super.add(...e),this}toggleAllLights(e){for(const t of this.children)t.power=e?ft:0}}var Ei=Object.defineProperty,ti=(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&&Ei(e,t,n),n};const ii="Construction",Si="Ceiling",Hi="Floor",Ri=1,ji=D("G","Ceiling Lights"),Li="Measurement Line",Ai="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=ii,this._ceilingGroup=new F,this._ceilingGroup.name=Si,this._floorGroup=new F,this._floorGroup.name=Hi,this._ceilingLightsGroup=new xi,this._ceilingLightsGroup.name=ji,this._measurementLineGroup=new F,this._measurementLineGroup.name=Li,this._wallAtticsGroup=new F,this._wallAtticsGroup.name=Ai,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 te?this._handleConfiguratorPlanObjectViewModel(e):e instanceof Ee?this._handleConstructionPlanObjectViewModel(e):e instanceof Se?this._handleStaticPlanObjectViewModel(e):e instanceof He?this._handleMeasurementLinePlanElementViewModel(e):e instanceof Re?this._handleWallAtticPlanElementViewModel(e):e instanceof je?this._handleWallPlanElementViewModel(e):e instanceof Le?this._handleFloorPlanElementViewModel(e):e instanceof Ct?this._handleCeilingPlanElementViewModel(e):e instanceof Ae&&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===w.CAMERA_2D),this._configurableConstructionPlanObjectViewModels.push(e)}_handleConstructionPlanObjectViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addConstructionPlanObjectHandlers(e),e.setTopView(this._cameraType===w.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===w.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===w.CAMERA_2D),this._wallAtticsPlanObjectViewModels.push(e),this._wallAtticsGroup.add(e.getContainer())}_handleWallPlanElementViewModel(e){this._initData.edit&&this._plannerSceneEventHandler.addWallHandlers(e),e.setTopView(this._cameraType===w.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===w.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<Ri;n++){const s=new wt(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:r,intensity:l,active:d}=t;i.userData={...i.userData,targetPos:n,lightPos:s,color:o,decay:r,intensity:l};const c=le.fromStaticObject(e,this._initData.debug);d===!1&&(c.visible=!1),i.add(c)}handleRectLampLight(e,t){const i=e.getObject(),{dimensions:n,lightPos:s,color:o,rotation:r,active:l}=t;i.userData={...i.userData,dimensions:n,lightPos:s,color:o,rotation:r};const d=q.fromStaticObject(e,this._initData.debug);l===!1&&(d.visible=!1),i.add(d)}toggleCeilingLights(e){this._ceilingLightsGroup.toggleAllLights(e)}commonHandlerForEditableAndTopView(e){this._initData.edit&&this._plannerSceneEventHandler.addPlanObjectHandlers(e),e.setTopView(this._cameraType===w.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 te&&(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}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 ee(e.getBounds())}catch(i){console.error(i)}const t=new P;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,r,l,d,c){return this._plannerMeshGenerator.generateMesh(e,t,i,n,s,o,r,l,d,c)}_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 bt&&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,r){}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 te&&this._linkPlanObjectViewModelAndComponent(s)}planObjectConfigurationChanged(e,t){}addMesh(e,t,i,n,s,o){const r=e.extRef.jsObject;let l=r.getMesh(t);l?l.geometry=this._plannerMeshGenerator.generateGeometry(null,i,n,s,o):(l=this._generateMesh(0,null,t,i,n,s,o,e.getType()),r.addMesh(l))}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 te?(this._detachPlanObjectViewModelFromComponent(i),this._removeObject(this._configurablePlanObjectViewModels,i)):i instanceof Ee?this._removeObject(this._constructionPlanObjectViewModels,i):i instanceof Se?this._removeObject(this._staticPlanObjectViewModels,i):i instanceof Le?this._removeObject(this._floorPlanObjectViewModels,i):i instanceof je?this._removeObject(this._wallPlanObjectViewModels,i):i instanceof Ae?this._removeObject(this._nodePlanObjectViewModels,i):i instanceof He?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 P;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===w.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===w.CAMERA_2D)),this._measurementLinePlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===w.CAMERA_2D)),this._wallAtticsPlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===w.CAMERA_2D)),this._nodePlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===w.CAMERA_2D)),this._configurablePlanObjectViewModels.forEach(i=>i.setTopView(this._cameraType===w.CAMERA_2D)),this._constructionPlanObjectViewModels.forEach(i=>t.push(i.setTopView(this._cameraType===w.CAMERA_2D))),this._configurableConstructionPlanObjectViewModels.forEach(i=>t.push(i.setTopView(this._cameraType===w.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){}}D("P",Ye),ti([f],Ye.prototype,"_plannerMeshGenerator"),ti([f],Ye.prototype,"_roomlePlannerUiCallback");var v=D("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))(v||{}));const re=D("b",{RAYCASTER_FLOOR:.8,FLOOR:.9,WALL:.95,DEFAULT:1,CONSTRUCTION:1,COMPONENT:2,PREVIEW:3,PREVIEW_LINE:4});var Ti=D("I",(h=>(h[h.PLANNER=0]="PLANNER",h[h.CONFIGURATOR=1]="CONFIGURATOR",h))(Ti||{})),ni=D("R",(h=>(h[h.CLICK_OUTSIDE=0]="CLICK_OUTSIDE",h))(ni||{}));const si=Ve(30);class Vi extends _e{constructor(e,t,i,n){super(),this._offset=new u(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 vt,this._raycaster.layers.disableAll(),this._inputManager=i,this._addInputListeners(i),this._planeBottom=new ie(new u(0,1,0)),this._planeFront=new ie(new u(0,0,1)),this._planeSide=new ie(new u(1,0,0))}setLayers(e){this._raycaster.layers=e}getLayers(){return this._raycaster.layers}_addInputListeners(e){e.addEventListener(O.DOWN,t=>{this._findCandidate(t.positionRelative)},this),e.addEventListener(O.CLICK,t=>{this._findSelection(t.positionRelative)},this),e.addEventListener(O.DOUBLE_CLICK,t=>{this._findSelection(t.positionRelative,!0,t.type)},this),e.addEventListener(O.LONG_TOUCH,t=>{this._findSelection(t.positionRelative,!0,t.type)},this),e.addEventListener(O.MOVE,t=>{Date.now()-this._lastMoveCheck>32&&(this._findHover(t.positionRelative,t.type),this._lastMoveCheck=Date.now())},this),e.addEventListener(O.DRAG_START,t=>{this._onDragStart(t.positionRelative)},this),e.addEventListener(O.DRAG,t=>{this._onDrag(t.positionRelative)},this),e.addEventListener(O.DRAG_END,t=>{this._onDragEnd(t.positionRelative)},this),e.addEventListener(O.ROTATE,t=>{this._onRotate(t.positionRelative,t.rotation)},this),e.addEventListener(O.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=W.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 ne(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:yt(new P().setFromObject(n.object),new P().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 ne(e.x,e.y),this._camera);let t=new u(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:r})=>o==="Group"&&r===ii),s=this._currentDrag.userData.snapToWall;if(n&&(this._onWallSnapping||s)){const o=this._raycaster.intersectObjects(n.children,!0);if(o.length){const r=o[0].point.clone();this._currentDrag.dispatchEvent({type:"drag",attachment:{position:r}});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 u(0,0,0),s=new u(0,0,0);this._raycaster.ray.intersectPlane(this._planeFront,n),this._raycaster.ray.intersectPlane(this._planeSide,s);let o=this._getDistanceToCamera(s),r=this._getDistanceToCamera(n),l;return i>=-si&&i<=si?t<r?l=e.clone():l=n.clone():t<r&&t<o?l=e.clone():r<t&&r<o?l=n.clone():o<t&&o<r&&(l=s.clone()),l}_getDistanceToCamera(e){let i=e.clone().sub(this._camera.position).length();return Ot(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 u).y-this._rootComponentPosition.y,this._planeSide.constant=-e.boundingBox.getSize(new u).x*2+e.boundingBox.getCenter(new u).x,this._camera.userData.yaw>0&&(this._planeSide.constant*=-1),this._bounds&&(this._planeFront.constant=this._bounds.z/2+e.boundingBox.getCenter(new u).z))}_calculateOffset(e){e&&e.boundingBox&&(this._offset.copy(e.boundingBox.getCenter(new u)),this._offset.applyQuaternion(e.getWorldQuaternion(new Pt)))}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 ce&&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 ie,i=new u;return i.copy(this._camera.position).normalize(),t.setFromNormalAndCoplanarPoint(i,this._object.position),this._raycaster.setFromCamera(new ne(e.positionRelative.x,e.positionRelative.y),this._camera),Mt(this._raycaster.ray.intersectPlane(t,new u))}enableOnWallSnapping(){this._onWallSnapping=!0}disableOnWallSnapping(){this._onWallSnapping=!1}}class oi extends _e{constructor(e,t,i,n){super(),this._debug=!1,this._dragIn=!1,this._inputManager=n,this._raycastHelper=new Vi(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()}}D("S",oi);var Bi=Object.defineProperty,ri=(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},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:r,reason:l}=e;this.component=t,this.preview=i,this.resetCamera=n===void 0?!0:n,this.consecutive=s===void 0?!0:s,this.type=o||W.UNKNOWN,this.forceRender=r!==void 0?r:!1,this.reason=l}}class Ze extends oi{constructor(e,t,i,n){super(e,t,i,n),this._cameraMoving=!1,this._raycastHelper.addEventListener(ni.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:r})=>{this._selectionHandler.hasSelection()||this._inputManager.setDragEnabled(!1),this.dispatchEvent(9,new j({component:s,resetCamera:o,reason:r}))},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(y.COMPONENT),e.enable(y.PREVIEW),e.enable(y.GIZMO),e.enable(y.DIMENSIONS),this._raycastHelper.setLayers(e),this._raycastHelper.enableEvents()}_addInputListeners(e){e.addEventListener(O.ZOOM_IN,t=>this._interaction(),this),e.addEventListener(O.ZOOM_OUT,t=>this._interaction(),this)}addComponentHandlers(e){this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:re.DEFAULT,roomleId:e.runtimeId}),e.meshes.forEach(t=>{this._addComponentHandlers(e,t,{hasListener:!0,priority:re.COMPONENT,roomleId:e.runtimeId})})}addComponentDragInHandler(e){this._dragIn&&(this._addComponentHandlers(e,e.boundingBoxMesh,{hasListener:!0,priority:re.DEFAULT,roomleId:e.runtimeId}),this._raycastHelper.enableDragIn(e.boundingBoxMesh))}_addComponentHandlers(e,t,i){t.userData.hasListener||(Object.assign(t.userData,i),t.addEventListener(v.CLICK,()=>this.clickComponent(e)),t.addEventListener(v.HOVER_ON,n=>this._hoverOn(e,n.attachment.type)),t.addEventListener(v.HOVER_OFF,n=>this._hoverOff(e,n.attachment.type)),t.addEventListener(v.DRAG_START,()=>this._dragStart(e)),t.addEventListener(v.DRAG,n=>this._drag(e,n.attachment.position)),t.addEventListener(v.DRAG_END,()=>this._dragEnd(e)))}addPreviewHandlers(e){const t=e.boundingBoxMesh;t.userData.hasListener||(t.userData=Ge(t.userData,{hasListener:!0,priority:re.PREVIEW,roomleId:e.runtimeId}),t.addEventListener(v.CLICK,()=>this._clickPreview(e)),t.addEventListener(v.HOVER_ON,()=>this._hoverOnPreview(e)),t.addEventListener(v.HOVER_OFF,()=>this._hoverOffPreview(e)))}addPreviewLineHandlers(e){const t=e.boundingLineMesh;t.userData.hasListener||(t.userData=Ge(t.userData,{hasListener:!0,priority:re.PREVIEW_LINE,roomleId:e.runtimeId}),t.addEventListener(v.CLICK,()=>this._clickPreviewLine(e)),t.addEventListener(v.HOVER_ON,i=>this._hoverOnPreviewLine(e,i.attachment.intersection)),t.addEventListener(v.HOVER_MOVE,i=>this._hoverMovePreviewLine(e,i.attachment.intersection)),t.addEventListener(v.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){const 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 ce){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){const 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){const 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(M.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,W.UNKNOWN),this._cameraMoving=e}setCamera(e){this._raycastHelper.setCamera(e)}setObject(e){this._raycastHelper.setObject(e)}}ri([f],Ze.prototype,"_selectionHandler"),ri([f],Ze.prototype,"_configuratorUiCallbacks");var ai=(h=>(h[h.CHANGE=0]="CHANGE",h))(ai||{});class ki extends _e{constructor(e){super(),this._uiIntersectionMask=0,this.floorEnvironment=!1,this._camera=e}updateToBounds(e,t,i){let n=new u(-e.x/2,0,-e.z/2),s=new u(e.x/2,e.y,e.z/2);this._boundingBox=new P(n,s),this._clientWidth=t,this._clientHeight=i;let o=this._boundingBox.getSize(new u);this._boxVertices=[],this._boxVertices.push(this._boundingBox.min),this._boxVertices.push(this._boundingBox.min.clone().add(new u(o.x,0,0))),this._boxVertices.push(this._boundingBox.max),this._boxVertices.push(this._boundingBox.max.clone().sub(new u(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)}}D("c",Ce);var Gi=Object.defineProperty,L=(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&&Gi(e,t,n),n};class E extends $e{constructor(e,t,i){super(e,t,It.HSC,i),this._dimensionUpdateDebounced=null,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,async({component:n,type:s})=>await 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()===M.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 r=this._getViewModel().getBoundingBox();this._environment&&this._environment.needsBounds()&&this._environment.updateBounds(r.getSize(new u))}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),Dt.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-DvNtWlR5.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=Me.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&&St().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)}updateAddons(){this._configuratorContext.selectionMode===M.STANDARD&&(this._configuratorContext.selectedRuntimeComponentId?this._getKernelAccess().selectedComponent(this._configuratorContext.selectedRuntimeComponentId):this._configuratorContext.planObjectId&&this._getKernelAccess().updatePlanObjectDependencies(this._configuratorContext.planObjectId))}async _onHoverOn(e,t){t!==W.TOUCH&&this._highlightComponent(e),this._isComponentDimensionsVisible||await this._showCustomComponentDimensions(e)&&this._updateComponentDimensionLabels()}_onHoverOff(e,t){t!==W.TOUCH&&this._highlightComponent(),this._componentDimensioningHelper&&!this._isComponentDimensionsVisible&&this._componentDimensioningHelper.hasComponentDimensions()&&(this._removeCustomComponentDimensions(e),this._configuratorUiCallbacks.onDimensionLabelsUpdated(null)),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 ki(this.cameraBehaviour3d.cameraControl.getCamera()),this._uiIntersectionHelper.canvasOffset=e,this._uiIntersectionHelper.addEventListener(ai.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(Ht.createDynamicLightSettingSource(null,Rt.CAMERA)):this._lightSetting=new qt(this._scene,this._lightSetting)),this._requestRender(),t||this._setEnvironment(new et(this._scene,this._environment,jt(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 r=this.cameraBehaviour3d.cameraControl.getObjectRotation();if(i){await this._initDimensions(),await this._dimensionHelper.isInitialized();const d=-30+Ft(r);ue.placeCameraForPerspectiveImage(n,s,-20,d),this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(n.position),s=this._calculateBoundingBoxOfAllMeshes(0,i)}this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&await this._componentDimensioningHelper.reset();const l=await this._imageRenderer.preparePerspectiveImage(this._scene,this._uiScene,n,s,e,r);return o?(this._dimensionHelper.enableDimensions(),this._dimensionHelper.moveCameraEnd(this.cameraBehaviour3d.cameraControl.getCamera().position)):i&&this._dimensionHelper.disableDimensions(),this._lightSetting?.addToScene(),this._renderEverything(),l}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 r=ue.getCameraTargetForBBox(new P().setFromObject(s)),l=Lt(this._scene);l.add(s);const d=await this._imageRenderer.preparePerspectiveImage(l,null,o,r,t);At(l),i(d)},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 u),i=Tt(e),n=new Oe(0,i,0),s=e.getWorldPosition(new u).clone().add(e.boundingBox.getCenter(new u).applyEuler(n)),o=new ne;this._renderer.getSize(o);const r={yaw:n.y,pitch:Ve(15),distance:Vt(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};Bt(this.cameraBehaviour.cameraControl.getCurrentCameraParameters(),r)||(this._configuratorUiCallbacks.onZoomToComponent(),await this.configuratorCameraBehaviour?.zoomToComponentOnConsecutiveClick(r))}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()===M.STANDARD||this._cancelSelection(e,t)}notifyPlannerOnComponentSelectionCancel(e,t){}_cancelSelection(e,t){this._sceneEventHandler.cancelSelection(t),this._configuratorContext.selectionMode=M.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()===M.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()===M.STANDARD&&(this._cancelSelection(t,i),this._highlightComponent()),this._sceneEventHandler.getSelectionMode()===M.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 ae))&&(this._environment=new ae(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(await this._showCustomComponentDimensions(this._currentComponent)){this._isComponentDimensionsVisible=!0,this._updateComponentDimensionLabels();return}await this._initDimensions(),this._dimensionHelper.enableDimensions(),this._dimensionHelper.onDimensionsVisibilityChanged(t=>{t&&this._renderEverything(),this._configuratorUiCallbacks.onDimensionsVisibilityChange(t)}),this._configuratorUiCallbacks.onDimensionsVisibilityChange(!0),this._renderEverything()}async _initDimensions(e=!1){this._dimensionHelper||await be.import("./main-DVWEbQdM.js").then(n=>n.cQ).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=ee(t.boxForMeasurement);i.copy(n.getCenter(new u)),i.y=n.getSize(new u).y+1}this._dimensionHelper.moveCameraEnd(i)}hideDimensions(){if(this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()){this._removeCustomComponentDimensions(this._currentComponent),this._isComponentDimensionsVisible=!1,this._configuratorUiCallbacks.onDimensionLabelsUpdated(null);return}this._dimensionHelper&&this._dimensionHelper.disableDimensions(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._componentDimensioningHelper.reset(),this._renderEverything()}_updateComponentDimensionLabels(){if(!this._componentDimensioningHelper||!this._currentComponent){this._configuratorUiCallbacks.onDimensionLabelsUpdated(null);return}this._componentDimensioningHelper.ensureDimensionObjectsReady(this._currentComponent.runtimeId),this._componentDimensioningHelper.updateDimensionVisibility(this._currentComponent.runtimeId);const e=[],t=this._currentComponent,i=this._componentDimensioningHelper.getDimensionData(t.runtimeId),n=this._componentDimensioningHelper.getDimensionObjects(t.runtimeId);if(i&&i.length>0&&n){const s=[],o=[];i.forEach((d,c)=>{if(!n[c]||!n[c].visible)return;let p=this._componentDimensioningHelper.getDimensionLineCenter(t.runtimeId,c);p||n[c].getWorldPosition(p=new u),o.push({id:d.id,worldPos:p,index:c})});let r=new Set;this._componentRaycastHelper&&o.length>0&&(r=this._componentRaycastHelper.checkMultipleLabelOcclusion(o.map(({id:d,worldPos:c})=>({id:d,worldPos:c})),t)),o.forEach(({id:d,worldPos:c,index:p})=>{if(r.has(d))return;const _=i[p],I=this.getScreenXY(c),C=_.level===0?100:50-_.level,b=_.value||(_.dimensioning.to||0)-(_.dimensioning.from||0),m=this._unitFormatter.formatMMValueToUnitString(b);s.push({id:_.id,value:b,formattedValue:m,position:{x:I.x,y:I.y},angle:0,level:_.level,maxLevel:_.maxLevel,axisKey:_.axis?.key||null,isVisible:!0,direction:_.axis?{x:_.axis.labelDirection.x,y:_.axis.labelDirection.y,z:_.axis.labelDirection.z}:null,priority:C,interactionKey:_.interactionKey||null})});const l=this._resolveCollisions(s);e.push(...l)}if(e.length>0){const s={labels:e,componentId:t.runtimeId};this._configuratorUiCallbacks.onDimensionLabelsUpdated(s)}else this._configuratorUiCallbacks.onDimensionLabelsUpdated(null)}_resolveCollisions(e){const t=[...e].sort((r,l)=>l.priority-r.priority),i=[],n=68.4,s=34,o=20;for(const r of t){let l=!1;for(const d of i)if(kt(r,d,n,s,o)){l=!0;break}if(!l||r.level===0&&r.priority>90){const{...d}=r;i.push(d)}}return i}async loadSceneSettings(e){await super.loadSceneSettings(e),this._uiIntersectionHelper.floorEnvironment=this._environment instanceof ae}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 M.STANDARD:this._getKernelAccess().requestDeleteComponent(this._configuratorContext.selectedRuntimeComponentId);break;case M.MULTISELECT:this._getKernelAccess().requestDeleteComponents(this._configuratorContext.selectedRuntimeComponentIds);break}this._configuratorContext.selectedRuntimeComponentIds=[]}}componentUpdated(e,t){if(this._currentComponent=e,e.runtimeId===this._configuratorContext.rootComponentId){const s=new u(e.position.x/1e3,e.position.z/1e3,e.position.y/-1e3);this._sceneEventHandler.update(null,s,null)}(e.geometryChanged!==void 0?e.geometryChanged:!0)?this._renderEverything():this._renderWithoutShadowsAndAO(),this._componentDimensioningHelper?.invalidateDimensioningsCache(e.runtimeId),this._isComponentDimensionsVisible&&(this._dimensionUpdateDebounced&&clearTimeout(this._dimensionUpdateDebounced),this._configuratorUiCallbacks.onDimensionLabelsUpdated(null),this._dimensionUpdateDebounced=setTimeout(async()=>{this._dimensionUpdateDebounced=null,this._componentDimensioningHelper.regenerateDimensions(this._currentComponent,()=>this._renderEverything()).then(()=>{this._updateComponentDimensionLabels()})},100))}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()===M.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 u))),this._componentRaycastHelper&&this._componentRaycastHelper.checkPreviewVisibility(this._getViewModel())}configurationLoaded(e,t){e&&t&&this._sceneEventHandler.isDragIn()?(e.position.copy(new u(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 P().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 u)),type:"component",actions:o})}),this._getViewModel().getPreviews().forEach(t=>{const i=new P().setFromObject(t),n=["add"];e.push({id:t.runtimeId,position:this.getScreenXY(i.getCenter(new u)),type:"preview",actions:n})}),this._configuratorUiCallbacks.onComponentPositionsUpdated(e),this._isComponentDimensionsVisible&&this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._updateComponentDimensionLabels()}_updateBounds(e,t,i=!1){if(super._updateBounds(e,t,i),!e)return;const n=e.getSize(new u),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(Gt(),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(y.OBJECT),o.layers.enable(y.LIGHTING),o.layers.enable(y.BACKGROUND),o.layers.enable(y.UI),o.layers.enable(y.PREVIEW),o.position.copy(new u(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(A.ORBIT_START,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._sceneEventHandler.setCameraMoving(!0),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(A.ORBIT_MOVE,()=>{this._componentRaycastHelper&&this._componentRaycastHelper.checkComponentAndPreviewVisibility(this._sceneEventHandler,this._getViewModel()),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._currentComponent&&(this._componentDimensioningHelper.needsDimensionRegeneration(this.cameraBehaviour.cameraControl.getCamera())?this._componentDimensioningHelper.regenerateDimensions(this._currentComponent,()=>this._renderEverything()).then(()=>{this._updateComponentDimensionLabels()}):(this._componentDimensioningHelper.updateDimensionVisibility(this._currentComponent.runtimeId),this._updateComponentDimensionLabels())),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(A.ORBIT_END,()=>{this._sceneEventHandler.setCameraMoving(!1),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(A.ZOOM_CHANGE,({minZoom:e,maxZoom:t})=>{this._configuratorUiCallbacks.onZoomChange(e,t)},this),this.cameraBehaviour.cameraControl.addEventListener(A.ZOOM_IN,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._configuratorUiCallbacks.onDimensionLabelsUpdated(null),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(A.ZOOM_OUT,()=>{this._configuratorUiCallbacks.onCameraPositionChanges(),this._configuratorUiCallbacks.onDimensionLabelsUpdated(null),this._requestRender()},this),this.cameraBehaviour.cameraControl.addEventListener(A.MOVING,()=>{this._pluginSystem.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position),this._dimensionHelper?.moveCameraStart(this.cameraBehaviour.cameraControl.getCamera().position)},this),this.cameraBehaviour.cameraControl.addEventListener(A.IDLE,()=>{this._pluginSystem.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position),this._dimensionHelper?.moveCameraEnd(this.cameraBehaviour.cameraControl.getCamera().position),this._updateComponentPosition(),this._componentDimensioningHelper&&this._componentDimensioningHelper.hasComponentDimensions()&&this._currentComponent&&(this._componentDimensioningHelper.needsDimensionRegeneration(this.cameraBehaviour.cameraControl.getCamera())?this._componentDimensioningHelper.regenerateDimensions(this._currentComponent,()=>this._renderEverything()).then(()=>{this._updateComponentDimensionLabels()}):(this._componentDimensioningHelper.updateDimensionVisibility(this._currentComponent.runtimeId),this._updateComponentDimensionLabels()))},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=zt+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 De.waitFor(xe.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))}async _showCustomComponentDimensions(e){const t=e||this._currentComponent;if(!t||!this._componentDimensioningHelper)return!1;const i=await this._componentDimensioningHelper.add(t,()=>{this._renderEverything()});return i&&(this._renderEverything(),this._updateComponentDimensionLabels()),i}async _removeCustomComponentDimensions(e){const t=e||this._currentComponent;!t||!this._componentDimensioningHelper||(await this._componentDimensioningHelper.remove(t),this._renderEverything())}clearHighlighting(){this._roomleRenderer?.highlightObjects([])}}D("C",E),L([f],E.prototype,"_configuratorInputManager"),L([f],E.prototype,"_configuratorMeshGenerator"),L([f],E.prototype,"_memoryManager"),L([f],E.prototype,"_unitFormatter"),L([f],E.prototype,"_configuratorContext"),L([f],E.prototype,"_componentDimensioningHelper"),L([f],E.prototype,"_configuratorHistory"),L([f],E.prototype,"_configuratorUiCallbacks"),L([f],E.prototype,"_plannerKernelAccess"),L([f],E.prototype,"_globalInitData")}}});
|
|
2
|
+
//# sourceMappingURL=configurator-scene-manager-Bxdyg2zz.js.map
|