1"use strict";(globalThis.webpackChunk_swo_frontend=globalThis.webpackChunk_swo_frontend||[]).push([[5534],{45534:(e,t,n)=>{n.r(t),n.d(t,{ModelCanvas:()=>M});var o=n(21126),r=n(47552),i=n(18127);const a=e=>{const t=!1,n=!e.moreIntenseLights&&e.pointerOver?.25:.15,r=!e.moreIntenseLights&&e.pointerOver?.2:.15,a=e.moreIntenseLights||e.pointerOver?1:.6,s=!e.moreIntenseLights&&e.pointerOver?.3:.2;return(0,i.FD)(o.Fragment,{children:[(0,i.Y)("spotLight",{position:[0,500,0],intensity:n,castShadow:t}),(0,i.Y)("spotLight",{position:[0,-500,0],intensity:n,castShadow:t}),(0,i.Y)("spotLight",{position:[500,0,0],intensity:r,castShadow:t}),(0,i.Y)("spotLight",{position:[-500,0,0],intensity:r,castShadow:t}),(0,i.Y)("hemisphereLight",{intensity:a}),(0,i.Y)("ambientLight",{intensity:s})]})};var s=n(23837),l=n(56225);function u(e){return(0,i.Y)(s.E,{children:(0,i.Y)(l.rP,{size:"2x",color:"white"===e.backgroundTheme?"green":"white"})})}var c=n(21790),d=n(89693),p=n(24050),m=n(2802),h=n(96910);function g(e){const{scene:t,gl:n}=(0,c.C)(),r=e.environment.isCubeMap?d.ScU:m.Y,i=(0,c.G)(r,e.environment.file,t=>t.setPath(e.path)),a={isCubeMap:e.environment.isCubeMap,texture:i},s=(0,h.Q)(()=>new Promise(e=>{const t=new p.PMREMGenerator(n),o=(r={...a,gen:t}).isCubeMap?(r.gen.compileEquirectangularShader(),r.gen.fromCubemap(r.texture).texture):r.gen.fromEquirectangular(r.texture).texture;var r;t.dispose(),a.texture.dispose(),e(o)}),[e.keyProp]);function l(){const n=t.background,o=t.environment;return e.background&&(t.background=s),t.environment=s,()=>{t.background=n,t.environment=o}}return o.useLayoutEffect(()=>{l()},[]),o.useLayoutEffect(()=>{l()},[e.keyProp]),null}const f=e=>{return(0,i.Y)(g,{path:(t=e.environmentUrl,t.split("/").filter((e,t,n)=>t<n.length-1).join("/")+"/"),environment:{file:(e=>e.split("/").slice(-1)[0])(e.environmentUrl),isCubeMap:!1},keyProp:e.keyProp});var t};var v=n(58561),b=n(12748);const k=o.forwardRef((e,t)=>{const n=(0,o.useRef)(null),r=(0,v.p)(e.modelUrl),a=(0,b.zo)(e.selectedOption?[e.selectedOption.textureUrl]:[]),[s,l]=(0,o.useMemo)(()=>Object.entries(r.nodes).filter(([e,t])=>"Mesh"===t.type)[0],[r]);return function(e,t){(0,c.D)((n,o)=>{const r=e.current;if(r){const e=n.clock.getElapsedTime();t?r.position.setY(.5*Math.sin(e)):r.position.setY(Math.max(0,r.position.y-.5/30))}})}(n,e.isVisible&&!e.hasInteraction),(0,o.useLayoutEffect)(()=>{a&&a[0]&&(l.material.map=a[0])},[a]),(0,o.useEffect)(()=>{e.onModelLoaded()},[]),(0,i.FD)("group",{ref:n,...e,dispose:null,onClick:e.onClick,onPointerOver:e.hasInteraction?void 0:e.onPointerOver,onPointerOut:e.hasInteraction?void 0:e.onPointerOut,children:[(0,i.Y)("mesh",{material:l.material,geometry:l.geometry,ref:t}),a&&a[0]&&(0,i.Y)("meshStandardMaterial",{attach:"material",map:a[0],transparent:!0})]})});var S=n(79795),P=(n(82897),n(56245));function w(e,t=100){switch(e){case"front":return new d.Pq0(0,0,t);case"3d":return new d.Pq0(t,t,t);case"side":return new d.Pq0(t,0,0);default:return e}}const y=e=>{var t;const n=(0,o.useRef)(null),r=(0,o.useRef)(null),[s,l]=(0,o.useState)(Math.random().toString()),[c,p]=(0,o.useState)(void 0),[m,h]=(0,o.useState)(function(e){switch(e){case"disabled":return 0;case"limited":return Math.PI/7;case"full":return Math.PI/4;default:return e}}(e.polarRotation)),g=(0,o.useRef)(null),[v,b]=(0,o.useState)(!1),y=(0,o.useCallback)(()=>b(!0),[]),M=(0,o.useCallback)(()=>b(!1),[]),Y=(0,o.useCallback)(()=>{e.setModelState("idle")},[]);(0,o.useEffect)(()=>{"idle"===e.modelState&&p(function(){var t,o,r,i;const a=null===(t=n.current)||void 0===t||null===(o=t.geometry.boundingSphere)||void 0===o?void 0:o.radius,s="number"===typeof a?3*a:100,l=null===(r=n.current)||void 0===r||null===(i=r.geometry.boundingSphere)||void 0===i?void 0:i.center,u="undefined"!==typeof l?l:new d.Pq0(0,0,0);return{position:w(e.initialCameraPosition,s),lookAt:u}}())},[e.modelState]),(0,o.useEffect)(()=>{c&&r&&r.current&&(r.current.lookAt(c.lookAt),r.current.position.set(c.position.x,c.position.y,c.position.z))},[c]);const C="interacted-with"===e.modelState,L=null===(t=n.current)||void 0===t?void 0:t.geometry,O=!1;return(0,i.FD)(o.Fragment,{children:[(0,i.Y)(a,{moreIntenseLights:"interacted-with"===e.modelState,pointerOver:v}),(0,i.FD)(o.Suspense,{fallback:(0,i.Y)(u,{backgroundTheme:e.backgroundTheme}),children:[(0,i.Y)(f,{environmentUrl:e.environmentUrl,keyProp:s}),(0,i.Y)(k,{hasInteraction:"interacted-with"===e.modelState,onModelLoaded:Y,onClick:e.onUserModelInteraction,onPointerOver:y,onPointerOut:M,modelUrl:e.modelUrl,ref:n,isVisible:e.isVisible,selectedOption:e.selectedOption})]}),O,O,("idle"===e.modelState||"interacted-with"===e.modelState)&&c&&(0,i.Y)(S.u,{makeDefault:!0,position:c.position,far:250,near:.1,fov:24,ref:r,type:"PerspectiveCamera"}),O,c&&L&&L.boundingSphere&&(0,i.Y)(P.N,{enabled:C,ref:g,minPolarAngle:Math.PI/2-m,maxPolarAngle:Math.PI/2+m,enableZoom:!0,enablePan:!1,enableRotate:!0,enableDamping:!0,dampingFactor:.05,target:c.lookAt,minDistance:2.5*L.boundingSphere.radius,maxDistance:4.5*L.boundingSphere.radius,zoomSpeed:.3,panSpeed:.5})]})},M=e=>{const t=(0,o.useCallback)(()=>{e.setModelState(e=>"idle"===e?"interacted-with":e)},[]);return(0,i.Y)(r.Hl,{className:"canvas-el",dpr:[1,2],shadows:!0,draggable:"true",onDragStart:e=>{e.preventDefault(),t()},children:(0,i.Y)(y,{...e,onUserModelInteraction:t})})}}}]); 2//# sourceMappingURL=5534.e9db339a.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.