"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[340],{340:(e,t,n)=>{n.r(t),n.d(t,{default:()=>j});var s=n(23892),i=n(85848),a=n(35477),r=n(30205),l=n(48462),c=n(89112),o=n(31565),d=n(17794),u=n(78065),x=n(38862),h=n(3040);function f(e){let{modelUrl:t,onBoundsCalculated:n}=e,{asset:r}=(0,u.fn)(t),c=(0,i.useRef)(null);return((0,i.useEffect)(()=>{r&&c.current&&requestAnimationFrame(()=>{let e=c.current;if(!e)return;let t=new x.I,s=e.findComponents("render");if(s.length>0){let e=!1;if(s.forEach(n=>{n.meshInstances&&n.meshInstances.forEach(n=>{e?t.add(n.aabb):(t.copy(n.aabb),e=!0)})}),e){let e=t.halfExtents,s=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);n({center:[t.center.x,t.center.y,t.center.z],radius:s})}}})},[r,n]),r)?(0,s.jsx)(a.w,{ref:c,children:(0,s.jsx)(l.dw,{type:"asset",asset:r})}):null}function j(e){let{modelUrl:t}=e,[n,l]=(0,i.useState)(null);(0,i.useEffect)(()=>{l(null)},[t]);let u=(0,i.useCallback)(e=>{if(e){let t=e.findComponent("camera");t&&t.requestSceneColorMap(!0)}},[]),x=n?n.radius/Math.tan(22.5*Math.PI/180)*1.1:2,j=n?.3*n.radius:.1,p=n?50*n.radius:100,y=n?[n.center[0],n.center[1],n.center[2]]:[0,0,0];return(0,s.jsxs)("div",{className:"w-full h-full relative",style:{background:"linear-gradient(to bottom, #a8b5c8 0%, #8a9ab0 100%)"},children:[!n&&(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:(0,s.jsx)(h.A,{className:"h-8 w-8 animate-spin text-white/70"})}),(0,s.jsxs)(r.l,{children:[(0,s.jsxs)(a.w,{ref:u,position:[y[0],y[1],y[2]+x],children:[(0,s.jsx)(c.i,{clearColor:"rgba(0, 0, 0, 0)",fov:45}),(0,s.jsx)(d.N,{inertiaFactor:.1,distance:x,distanceMin:j,distanceMax:p,pitchAngleMin:-90,pitchAngleMax:90})]}),(0,s.jsx)(a.w,{rotation:[45,30,0],children:(0,s.jsx)(o.v,{type:"directional",intensity:2})}),(0,s.jsx)(a.w,{rotation:[-30,-120,0],children:(0,s.jsx)(o.v,{type:"directional",intensity:.8})}),(0,s.jsx)(a.w,{position:[10,10,10],children:(0,s.jsx)(o.v,{type:"omni",intensity:.5,range:100})}),(0,s.jsx)(a.w,{position:[-10,10,-10],children:(0,s.jsx)(o.v,{type:"omni",intensity:.5,range:100})}),(0,s.jsx)(a.w,{position:[10,-10,-10],children:(0,s.jsx)(o.v,{type:"omni",intensity:.5,range:100})}),(0,s.jsx)(a.w,{position:[-10,-10,10],children:(0,s.jsx)(o.v,{type:"omni",intensity:.5,range:100})}),(0,s.jsx)(f,{modelUrl:t,onBoundsCalculated:l})]},t)]})}}}]);