PageSourceSearch

https://experiments.dvy.io/_next/static/chunks/app/3d-image-depth-map/page-4006275e040c36fd.js

js dvy.io collected 2026-09-25 22:00:01 UTC 21,804 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[508],{28250:function(){},34364:function(){},90916:function(){},58519:function(){},24448:function(){},81266:function(){},37044:function(e,t,a){Promise.resolve().then(a.bind(a,49799))},49799:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return ea}});var n,r,o=a(59533),s=a(78258),i=a(59478),l=a(57838),d=a(27580),c=a(98232),h=a(66892),u=a(31229),m=a(220),p=a(42322),g=a(41994),f=a(21875),v=a(35394);(n=r||(r={})).INITIAL="INITIAL",n.BASE_IMAGE_LOADED="BASE_IMAGE_LOADED",n.DEPTH_MAP_LOADED="DEPTH_MAP_LOADED",n.GENERATING_DEPTH_MAP="GENERATING_DEPTH_MAP",n.MODEL_READY="MODEL_READY",n.ERROR="ERROR";var x=a(93393),E=a(96633),_=a(91215),j=a(64431);let w=async e=>{let{env:t}=await Promise.resolve().then(a.bind(a,91215));t.allowLocalModels=!1,t.backends.onnx.wasm.proxy=!0;let n=await (0,_.EUT)("depth-estimation","Xenova/depth-anything-large-hf"),{depth:r}=await n(e),o=await r.toBlob();return URL.createObjectURL(o)},C=async e=>{let t=await fetch("/api/generate-depth-map",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:e})});if(!t.ok)throw Error("Server-side depth map generation failed");let{depthMap:a}=await t.json();return a},D=async e=>{let{imageUrl:t,mode:a="local"}=e;(0,j.L9)("generateDepthMap");try{return await ("server"===a?C(t):w(t))}catch(e){throw Error("Error generating depth map: ".concat(e.message))}},b={state:r.INITIAL,baseImage:void 0,cameraResetTrigger:0,cameraType:"perspective",depthMap:void 0,error:void 0,sliderValues:{centerFocus:0,depthColorThresholdBack:0,depthColorThresholdFront:1,depthContrast:.5,depthIntensity:.75,shadowIntensity:0,shadowThreshold:.15,shadowSmoothness:.2},wireframe:!1};async function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1024;return new Promise((n,r)=>{let o=new Image,s=()=>{let e=document.createElement("canvas"),s=o.width,i=o.height;s>i?s>t&&(i*=t/s,s=t):i>a&&(s*=a/i,i=a),e.width=s,e.height=i;let l=e.getContext("2d");if(!l){r(Error("Failed to get canvas context"));return}l.drawImage(o,0,0,s,i),n(e.toDataURL("image/jpeg"))},i=()=>{r(Error("Failed to load image"))};return o.addEventListener("load",s),o.addEventListener("error",i),o.src=URL.createObjectURL(e),()=>{o.removeEventListener("load",s),o.removeEventListener("error",i)}})}let I=(0,x.Ue)()((0,E.tJ)((e,t)=>({...b,uploadBaseImage:async a=>{try{let n=await y(a),{depthMap:o}=t();e({baseImage:n,state:o?r.MODEL_READY:r.BASE_IMAGE_LOADED})}catch(t){e({error:"Error uploading base image",state:r.ERROR})}},uploadDepthMap:async a=>{try{let n=await y(a),{baseImage:o}=t();e({depthMap:n,state:o?r.MODEL_READY:r.DEPTH_MAP_LOADED})}catch(t){e({error:"Error uploading depth map",state:r.ERROR})}},generateDepthMap:async()=>{let{baseImage:a}=t();if(!a){e({error:"No base image uploaded",state:r.ERROR});return}e(e=>({state:r.GENERATING_DEPTH_MAP,cameraResetTrigger:e.cameraResetTrigger+1}));try{let t=await D({imageUrl:a,mode:"server"});e({depthMap:t,state:r.MODEL_READY})}catch(t){e({error:"Error generating depth map: ".concat(t.message),state:r.ERROR})}},clearBaseImage:()=>e(e=>({baseImage:void 0,state:e.depthMap?r.DEPTH_MAP_LOADED:r.INITIAL})),clearDepthMap:()=>e(e=>({depthMap:void 0,state:e.baseImage?r.BASE_IMAGE_LOADED:r.INITIAL})),handleSliderChange:(t,a)=>{e(e=>({sliderValues:{...e.sliderValues,[t]:a}}))},toggleWireframe:()=>e(e=>({wireframe:!e.wireframe})),reset:()=>e(b),setCameraResetTrigger:()=>e(e=>({cameraResetTrigger:e.cameraResetTrigger+1})),initializeFromStorage:()=>{let{baseImage:a,depthMap:n}=t();a&&n?e({state:r.MODEL_READY}):a?e({state:r.BASE_IMAGE_LOADED}):n&&e({state:r.DEPTH_MAP_LOADED})},setCameraType:t=>e({cameraType:t})}),{name:"experiments-storage",partialize:e=>({baseImage:e.baseImage,depthMap:e.depthMap})})),T={distance:{max:.5,min:.1},far:10,maxZoom:3e3,minZoom:300,near:-1,position:[-.1,0,.5],zoom:700},A={distance:{max:3,min:1},near:.001,position:[-.4,0,2]};function N(){let{camera:e,gl:t}=(0,l.A)(),{controlsRef:a,isUserInteracting:n}=function(){let[e,t]=(0,u.useState)(!1),a=(0,u.useRef)(null),n=(0,u.useCallback)(()=>t(!0),[]),r=(0,u.useCallback)(()=>t(!1),[]);return(0,u.useEffect)(()=>{let e=a.current;if(e)return e.addEventListener("start",n),e.addEventListener("end",r),()=>{e.removeEventListener("start",n),e.removeEventListener("end",r)}},[n,r]),{isUserInteracting:e,controlsRef:a}}(),s=I(e=>e.cameraType),i=I(e=>e.cameraResetTrigger),{state:d}=I(),c=(0,u.useRef)(!1),h=(0,u.useCallback)(()=>{var t;"perspective"===s?(e.position.set(A.position[0],A.position[1],A.position[2]),e instanceof v.PerspectiveCamera&&(e.near=A.near,e.updateProjectionMatrix())):(e.position.set(T.position[0],T.position[1],T.position[2]),e instanceof v.Orthogra
1phicCamera&&(e.far=T.far,e.near=T.near,e.zoom=T.zoom,e.updateProjectionMatrix())),e.lookAt(0,0,0),null===(t=a.current)||void 0===t||t.reset()},[e,s,a]);return(0,u.useEffect)(()=>{(i>0||!c.current)&&(h(),c.current=!0)},[i,h]),(0,l.C)(()=>{var t;d!==r.MODEL_READY||n||(e.position.applyAxisAngle(new v.Vector3(0,0,-1),-.004),e.lookAt(0,0,0)),null===(t=a.current)||void 0===t||t.update()}),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(p.z,{args:[e,t.domElement],dampingFactor:.1,enableDamping:!0,maxAzimuthAngle:Math.PI/2.5,maxDistance:"perspective"===s?A.distance.max:T.distance.max,maxZoom:T.maxZoom,minAzimuthAngle:-Math.PI/2.5,minDistance:"perspective"===s?A.distance.min:T.distance.min,minPolarAngle:.1*Math.PI,minZoom:T.minZoom,ref:a}),"perspective"===s?(0,o.jsx)(g.c,{makeDefault:!0,near:A.near,position:A.position}):(0,o.jsx)(f.i,{far:T.far,makeDefault:!0,near:T.near,position:T.position,zoom:T.zoom})]})}var M=a(65433),k=a(48003),R=a(30928),P=()=>{let[e,t]=(0,u.useState)(void 0);return(0,u.useEffect)(()=>{let e=()=>{t(window.matchMedia("(max-width: 767px)").matches)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e},L=a(36176),z=a(41671),S=a(85771),F=a(95119),O=a(16415),B=a(26215),U=a.n(B),G=a(83373),Z=a(52284),H=a(55536);function V(e){let{children:t,className:a=""}=e;return(0,o.jsx)("p",{className:(0,Z.cn)("font-medium text-2xs text-neutral-500",a),children:t})}function Y(e){let{children:t,className:a,id:n,label:r,labelProps:s,note:i,noteProps:l,required:d=!1}=e;return(0,o.jsxs)("div",{className:(0,Z.cn)("gap-1 flex flex-col",a),children:[(0,o.jsx)(H.Q,{htmlFor:n,required:d,...s,children:r}),t,!!i&&(0,o.jsx)(V,{...l,children:i})]})}var X=a(35125),Q=a(68070),W=a(62181),q=a(10836);let J=e=>{if(!e){console.error("No file URL available for download");return}let t=document.createElement("a");t.href=e,t.download=function(e){let t=U()(e,"/");return t[t.length-1]||"download"}(e),document.body.append(t),t.click(),t.remove()};function $(e){let{baseImage:t,cameraType:a,clearBaseImage:n,clearDepthMap:s,depthMap:i,generateDepthMap:l,handleSliderChange:d,setCameraType:c,setIsSliderDragging:h,sliderValues:u,state:p,toggleWireframe:g,uploadBaseImage:f,uploadDepthMap:v,wireframe:x}=e,E=async()=>{t&&p!==r.GENERATING_DEPTH_MAP&&await l()};return(0,o.jsxs)("div",{className:"w-full",children:[(0,o.jsxs)("div",{className:"flex gap-2 mb-4 h-44",children:[(0,o.jsx)(X.S,{accept:{"image/*":[]},className:"grow shrink basis-1/2",currentFileUrl:t,id:"baseImage",label:"Base Image",onChange:e=>f(e[0]),trailingHeaderElement:(0,o.jsxs)(G.h_,{children:[(0,o.jsx)(G.$F,{asChild:!0,children:(0,o.jsx)(m.z,{className:"-mr-1.5 pointer-events-none dark:text-neutral-400 group-hover:pointer-events-auto hover:dark:bg-neutral-750",leadingIcon:(0,o.jsx)(L.Z,{className:"size-4",variant:"solid"}),onClick:e=>{e.stopPropagation()},size:"iconSm",type:"button",variant:"ghost"})}),(0,o.jsxs)(G.AW,{children:[(0,o.jsxs)(G.Xi,{disabled:!t,onClick:e=>{e.stopPropagation(),t&&J(t)},children:[(0,o.jsx)(z.Z,{className:"size-4",variant:"solid"}),"Download Image"]}),(0,o.jsx)(G.Xi,{disabled:!t,icon:(0,o.jsx)(S.Z,{className:"size-full",variant:"solid"}),onClick:e=>{e.stopPropagation(),n()},children:"Clear Image"})]})]})}),(0,o.jsx)(X.S,{accept:{"image/*":[]},className:"grow shrink basis-1/2",currentFileUrl:i,id:"depthMap",isDisabled:p===r.GENERATING_DEPTH_MAP,isLoading:p===r.GENERATING_DEPTH_MAP,label:"Depth Map",onChange:e=>v(e[0]),placeholderContent:p===r.BASE_IMAGE_LOADED&&(0,o.jsxs)("div",{className:"flex flex-col items-center gap-1 text-sm dark:text-neutral-400",children:[(0,o.jsx)(F.Z,{className:"size-8",variant:"stroke"}),(0,o.jsx)("span",{className:"text-xs font-semibold",children:"Choose file..."}),(0,o.jsx)("span",{className:"mb-1 text-xs dark:text-neutral-450",children:"or"}),(0,o.jsx)(m.z,{leadingIcon:(0,o.jsx)(O.Z,{className:"size-4",variant:"solid"}),onClick:e=>{e.stopPropagation(),E()},size:"sm",children:"Generate"})]}),trailingHeaderElement:(0,o.jsxs)(G.h_,{children:[(0,o.jsx)(G.$F,{asChild:!0,children:(0,o.jsx)(m.z,{className:"-mr-1.5 pointer-events-none dark:text-neutral-400 group-hover:pointer-events-auto hover:dark:bg-neutral-750",leadingIcon:(0,o.jsx)(L.Z,{className:"size-4",variant:"solid"}),onClick:e=>{e.stopPropagation()},size:"iconSm",type:"button",variant:"ghost"})}),(0,o.jsxs)(G.AW,{children:[!!t&&!i&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(G.Xi,{disabled:p===r.GENERATING_DEPTH_MAP,onClick:e=>{e.stopPropagation(),E()},children:[(0,o.jsx)(O.Z,{className:"size-4",variant:"solid"}),"Generate Depth Map"]}),(0,o.jsx)(G.VD,{})]}),(0,o.jsxs)(G.Xi,{disabled:!i,onClick:e=>{e.stopPropagation(),i&&J(i)},children:[(0,o.jsx)(z.Z,{className:"size-4",variant:"solid"}),"Download Image"]}),(0,o.jsx)(G.Xi,{disabled:!i,icon:(0,o.jsx)(S.Z,{className:"size-full",variant:"solid"}),onClick:e=>{e.stopPropagation(),s()},children:"Clear Image"})]})]})})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-4 px-2",children:[(0,o.jsx)(Y,{label:"Depth Intensity",children:(0,o.jsx)(W.Z,{formatTooltipValue:e=>"".concat(Math.round(100*e),"%"),max:1,min:0,onChange:e=>d("depthIntensity",e[0]),onChangeEnd:()=>null==h?void 0:h(!1),onChangeStart:()=>null==h?void 0:h(!0),step:.01,value:[u.depthIntensity]})}),(0,o.jsx)(Y,{label:"Depth Contrast",children:(0,o.jsx)(W.Z,{formatTooltipValue:e=>"".concat(Math.round(100*e),"%"),max:1,min:0,onChange:e=>d("depthContrast",e[0]),onChangeEnd:()=>null==h?void 0:h(!1),onChangeStart:()=>null==h?void 0:h(!0),step:.01,value:[u.depthContrast]})}),(0,o.jsx)(Y,{label:"Depth Color Threshold",children:(0,o.jsx)(W.Z,{formatTooltipValue:e=>"".concat(Math.round(100*e),"%"),max:1,min:0,minRangeBetweenThumbs:.1,onChange:e=>{d("depthColorThresholdBack",e[0]),d("depthColorThresholdFront",e[1])},onChangeEnd:()=>null==h?void 0:h(!1),onChangeStart:()=>null==h?void 0:h(!0),step:.01,value:[u.depthColorThresholdBack,u.depthColorThresholdFront]})}),(0,o.jsx)(Y,{label:"Center Focus",note:"Sometimes useful for portraits",children:(0,o.jsx)(W.Z,{formatTooltipValue:e=>"".concat(Math.round(100*e),"%"),max:1,min:0,onChange:e=>d("centerFocus",e[0]),onChangeEnd:()=>null==h?void 0:h(!1),onChangeStart:()=>null==h?void 0:h(!0),showStepMarkers:!0,step:.25,value:[u.centerFocus]})})]}),(0,o.jsx)("div",{className:"dark:bg-neutral-700 h-[1px] my-4"}),(0,o.jsxs)("div",{className:"flex flex-col gap-4 px-2",children:[(0,o.jsxs)("div",{className:"flex items-center justify-stretch",children:[(0,o.jsx)(H.Q,{className:"grow",htmlFor:"camera-type",children:"Camera Type"}),(0,o.jsxs)(Q.Ph,{defaultValue:"orthographic",onValueChange:e=>c(e),value:a,children:[(0,o.jsx)(Q.i4,{className:"w-[180px]",children:(0,o.jsx)(Q.ki,{placeholder:"Select camera type"})}),(0,o.jsxs)(Q.Bw,{children:[(0,o.jsx)(Q.Ql,{value:"orthographic",children:"Orthogra
1phic"}),(0,o.jsx)(Q.Ql,{value:"perspective",children:"Perspective"})]})]})]}),(0,o.jsxs)("div",{className:"flex items-center justify-stretch",children:[(0,o.jsx)(H.Q,{className:"grow",htmlFor:"wireframe-mode",children:"Wireframe Mode"}),(0,o.jsx)(q.r,{checked:x,id:"wireframe-mode",onCheckedChange:g})]})]})]})}function K(e){let t=P(),[a,n]=(0,u.useState)(!1),[r,s]=(0,u.useState)(!0);return void 0===t?null:t?(0,o.jsxs)(R.fC,{onOpenChange:s,open:r,children:[(0,o.jsx)(R.xz,{asChild:!0,children:!r&&(0,o.jsx)(m.z,{className:"fixed -translate-x-1/2 left-1/2 bottom-4",leadingIcon:(0,o.jsx)(M.Z,{variant:"stroke"}),children:"Open Controls"})}),(0,o.jsxs)(R.h_,{children:[(0,o.jsx)(R.aV,{className:"fixed inset-0 bg-black/25"}),(0,o.jsxs)(R.VY,{"aria-describedby":void 0,className:"fixed bottom-0 left-0 right-0 dark:bg-neutral-900/90 backdrop-blur-lg rounded-t-xl max-h-[60vh] h-full mx-4 flex flex-col overflow-hidden transition-opacity duration-200 ".concat(a?"opacity-50":"opacity-100"),children:[(0,o.jsxs)("div",{className:"sticky top-0 left-0 right-0 z-10 flex items-center justify-between h-12 dark:bg-neutral-900",children:[(0,o.jsx)(R.Dx,{className:"px-4 text-lg font-semibold",children:"Controls"}),(0,o.jsx)(R.x8,{asChild:!0,children:(0,o.jsx)(m.z,{"aria-label":"Close controls panel",className:"mr-2",leadingIcon:(0,o.jsx)(k.Z,{variant:"solid"}),size:"iconSm",variant:"ghost"})})]}),(0,o.jsx)("div",{className:"flex flex-col items-center flex-1 overflow-y-auto",children:(0,o.jsx)("div",{className:"w-full p-4 max-w-96",children:(0,o.jsx)($,{...e,setIsSliderDragging:n})})})]})]})]}):(0,o.jsx)("div",{className:"h-screen p-4",children:(0,o.jsx)("div",{className:"h-full p-2 pb-4 overflow-y-auto shadow-md rounded-xl dark:bg-neutral-800/90 w-80",children:(0,o.jsx)($,{...e})})})}function ee(e){let{animatedDepthIntensity:t,baseImage:a,depthMap:n,sliderValues:s,state:i,wireframe:d}=e,c=(0,u.useRef)(null),m=(0,u.useRef)(null),p=(0,u.useRef)(null),[g,f]=(0,l.F)(v.TextureLoader,[null!=a?a:"",null!=n?n:""]),x=(0,u.useMemo)(()=>g.image?g.image.width/g.image.height:1,[g]),E=(0,h.q)(-.25,{damping:10,stiffness:50}),_=(0,u.useMemo)(()=>new v.Vector3(0,0,1).normalize(),[]),j=(0,u.useMemo)(()=>new v.ShaderMaterial({uniforms:{u_baseTexture:{value:g},u_centerFocus:{value:s.centerFocus},u_depthColorThresholdBack:{value:s.depthColorThresholdBack},u_depthColorThresholdFront:{value:s.depthColorThresholdFront},u_depthTexture:{value:f},u_depthIntensity:{value:s.depthIntensity},u_depthContrast:{value:s.depthContrast},u_animatedDepthIntensity:{value:t},u_highlightPosition:{value:E},u_lightDirection:{value:_},u_shadowIntensity:{value:s.shadowIntensity},u_shadowSmoothness:{value:s.shadowSmoothness},u_shadowThreshold:{value:s.shadowThreshold}},vertexShader:"\n          uniform sampler2D u_depthTexture;\n          uniform float u_centerFocus;\n          uniform float u_depthIntensity;\n          uniform float u_depthContrast;\n          uniform float u_animatedDepthIntensity;\n          uniform float u_highlightPosition;\n          uniform vec3 u_lightDirection;\n          varying vec2 vUv;\n          varying vec3 vNormal;\n          varying float vLightIntensity;\n          varying float vDepth;\n          varying float vHighlight;\n\n          void main() {\n            vUv = uv;\n\n            // Sample depth map and apply contrast adjustment\n            vec4 depthColor = texture2D(u_depthTexture, vUv);\n            float depth = pow(depthColor.r, u_depthContrast);\n\n            // Calculate distance-based falloff for center focus effect\n            vec2 centeredUv = vUv - 0.5;\n            float distanceFromCenter = length(centeredUv);\n            float centerEffect = 1.0 - (distanceFromCenter * u_centerFocus);\n\n            // Apply vertex displacement along Z-axis based on depth value\n            vec3 newPosition = position;\n            float displacement = depth * u_depthIntensity * u_animatedDepthIntensity * centerEffect;\n            newPosition.z += displacement;\n\n            // Calculate surface normal using central difference method\n            // Sample neighboring pixels to compute tangent and bitangent vectors\n            float step = 0.01;\n            float left = texture2D(u_depthTexture, vUv - vec2(step, 0.0)).r;\n            float right = texture2D(u_depthTexture, vUv + vec2(step, 0.0)).r;\n            float top = texture2D(u_depthTexture, vUv + vec2(0.0, step)).r;\n            float bottom = texture2D(u_depthTexture, vUv - vec2(0.0, step)).r;\n\n            vec3 tangent = normalize(vec3(2.0 * step, 0.0, right - left));
1\n            vec3 bitangent = normalize(vec3(0.0, 2.0 * step, top - bottom));\n            vNormal = normalize(cross(tangent, bitangent));\n\n            // Calculate lighting based on normal and light direction\n            vLightIntensity = dot(vNormal, u_lightDirection);\n\n            // Create highlight band at specific depth using inverse distance with power curve\n            float highlightIntensity = 1.0 - abs(depth - u_highlightPosition);\n            highlightIntensity = pow(highlightIntensity, 10.0);\n            vHighlight = highlightIntensity;\n\n            gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n            vDepth = newPosition.z;\n          }\n        ",fragmentShader:"\n          uniform sampler2D u_baseTexture;\n          uniform sampler2D u_depthTexture;\n          uniform float u_depthColorThresholdBack;\n          uniform float u_depthColorThresholdFront;\n          uniform float u_shadowIntensity;\n          uniform float u_shadowSmoothness;\n          uniform float u_shadowThreshold;\n          varying vec2 vUv;\n          varying vec3 vNormal;\n          varying float vLightIntensity;\n          varying float vDepth;\n          varying float vHighlight;\n\n          // Convert RGB to grayscale using standard luminance weights\n          vec3 rgb2gray(vec3 color) {\n            float gray = dot(color.rgb, vec3(0.299, 0.587, 0.114));\n            return vec3(gray);\n          }\n\n          void main() {\n            vec4 baseColor = texture2D(u_baseTexture, vUv);\n            vec4 depthColor = texture2D(u_depthTexture, vUv);\n\n            float depth = depthColor.r;\n            float thresholdBack = u_depthColorThresholdBack;\n            float thresholdFront = u_depthColorThresholdFront;\n\n            // Desaturate pixels outside the depth threshold range\n            vec3 color = baseColor.rgb;\n            if (depth < thresholdBack || depth > thresholdFront) {\n              color = rgb2gray(color);\n            }\n\n            // Apply shadows with smooth transition based on surface normal\n            float shadowFactor = smoothstep(u_shadowThreshold - u_shadowSmoothness, u_shadowThreshold + u_shadowSmoothness, vLightIntensity);\n            color = mix(color * (1.0 - u_shadowIntensity), color, shadowFactor);\n\n            // Add highlight effect\n            color = mix(color, vec3(1.0), vHighlight * 0.3);\n            gl_FragColor = vec4(color, baseColor.a);\n          }\n        ",transparent:!0,wireframe:d}),[g,f,s,t,_,d,E]);return(0,l.C)(()=>{m.current&&p.current&&f.source.data&&(p.current.uniforms.u_centerFocus.value=s.centerFocus,p.current.uniforms.u_depthColorThresholdBack.value=s.depthColorThresholdBack,p.current.uniforms.u_depthColorThresholdFront.value=s.depthColorThresholdFront,p.current.uniforms.u_depthIntensity.value=s.depthIntensity,p.current.uniforms.u_depthContrast.value=s.depthContrast,p.current.uniforms.u_animatedDepthIntensity.value=t.get(),p.current.uniforms.u_shadowIntensity.value=s.shadowIntensity,p.current.uniforms.u_shadowSmoothness.value=s.shadowSmoothness,p.current.uniforms.u_shadowThreshold.value=s.shadowThreshold,p.current.uniforms.u_highlightPosition.value=E.get())}),(0,u.useEffect)(()=>{i===r.MODEL_READY?E.set(1.25):E.set(-.25)},[i,E]),(0,o.jsxs)("mesh",{position:[0,0,0],ref:c,children:[(0,o.jsx)("planeGeometry",{args:[x,1,511,511],ref:m}),(0,o.jsx)("primitive",{object:j,ref:p})]})}function et(e){let{captureRef:t}=e,a=function(){let{camera:e,gl:t,scene:a}=(0,l.A)();return(0,u.useCallback)(()=>(t.render(a,e),t.domElement.toDataURL("image/png")),[e,t,a])}();return(0,u.useEffect)(()=>(t.current=a,()=>{t.current=void 0}),[a,t]),null}function ea(){let{baseImage:e,cameraType:t,clearBaseImage:a,clearDepthMap:n,depthMap:l,error:p,generateDepthMap:g,handleSliderChange:f,initializeFromStorage:v,reset:x,setCameraType:E,sliderValues:_,state:j,toggleWireframe:w,uploadBaseImage:C,uploadDepthMap:D,wireframe:b}=I(),y=(0,c.c)(0),T=(0,h.q)(y,{stiffness:100,damping:30}),A=(0,u.useRef)(null),M=(0,u.useRef)(),k=(0,u.useCallback)(()=>{if(M.current){let e=M.current(),t=document.createElement("a");t.href=e,t.download="scene-capture.png",t.click()}},[]);return(0,u.useEffect)(()=>{v()},[v]),(0,u.useEffect)(()=>{j===r.MODEL_READY?y.set(1):y.set(0)},[j,y]),(0,o.jsxs)("div",{className:"relative flex w-full h-full",children:[(0,o.jsxs)(d.Xz,{ref:A,children:[(0,o.jsx)(N,{}),j===r.MODEL_READY&&(0,o.jsx)(ee,{animatedDepthIntensity:T,baseImage:e,depthMap:l,sliderValues:_,state:j,wireframe:b}),(0,o.jsx)(et,{captureRef:M})]}),(0,o.jsx)("div",{className:"absolute bottom-4 left-4",children:(0,o.jsx)(m.z,{leadingIcon:(0,o.jsx)(s.Z,{className:"relative -top-[0.5px]",variant:"solid"}),onClick:k,size:"icon",variant:"ghost"})}),j===r.INITIAL&&(0,o.jsxs)("div",{className:"absolute flex items-center justify-center gap-2 px-3 py-1.5 text-sm rounded-lg top-4 z-10 dark:bg-neutral-800/90 dark:text-neutral-300 font-medium max-w-[90%] overflow-hidden whitespace-nowrap md:left-4 left-1/2 md:transform-none -translate-x-1/2 md:-translate-x-0",children:[(0,o.jsx)(i.Z,{className:"shrink-0 size-5",variant:"solid"}),(0,o.jsx)("span",{className:"truncate",children:"Start by uploading a base image..."})]}),(0,o.jsx)(K,{baseImage:e,cameraType:t,clearBaseImage:a,clearDepthMap:n,depthMap:l,error:p,generateDepthMap:g,handleSliderChange:f,reset:x,setCameraType:E,sliderValues:_,state:j,toggleWireframe:w,uploadBaseImage:C,uploadDepthMap:D,wireframe:b})]})}}},function(e){e.O(0,[8,382,978,596,113,883,463,170,842,744],function(){return e(e.s=37044)}),_N_E=e.O()}]);

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.