import{j as x}from"./jsx-dev-runtime-Czb3f8pQ.js";import{r as u}from"./index-Br42UDbl.js";import{E as l}from"./engine-Bmw5iF75.js";import{b as g,P as b,o as w}from"./state-B_bTBsCz.js";import"./index-BlGQAcOD.js";function J(){const d=u.useRef(null);return u.useEffect(()=>{const t=JSON.parse(decodeURIComponent(new URLSearchParams(location.search).get("debug")||"{}")),i=new l;i.setSize(540,960);const c=d.current;c.width=540,c.height=960;const h=t.target??[0,.2,0],f=g({cam:{pos:w(h,t.dist??5,t.yaw??0,t.pitch??.1),target:h,fov:35},arm:{pos:[0,0,0],rot:t.rot??[0,.6,0]},pose:t.poseArr??[...b[t.pose??"rest"]],xray:t.xray??0,bone:t.bone??1,tendon:t.tendon??1,sheath:t.sheath??1,thick:t.thick??0,pain:t.pain??0,friction:t.friction??0,props:Object.fromEntries((t.props??[]).map(r=>[r,{vis:1,depth:.3}])),time:1});i.render({views:[{rect:[0,0,1,1],state:f}]},c.getContext("2d"),1,{w:540,h:960});const o=i.model,p=i.cams[0],n=(r,a)=>{const e=r.localToWorld(new o.anchors.pain.constructor(0,a,0)),s=o.project(e,p);return[Math.round(s.x*540),Math.round(s.y*960),+e.x.toFixed(2),+e.y.toFixed(2),+e.z.toFixed(2)]},m={thumbTip:n(o.thumbJoints[2],.27),idxTip:n(o.fingerJoints[0][2],.2),midTip:n(o.fingerJoints[1][2],.21),litTip:n(o.fingerJoints[3][2],.18),wrist:n(o.wrist,0),elbow:n(o.forearm,-2.6),pain:(()=>{const r=o.project(o.anchors.pain,p);return[Math.round(r.x*540),Math.round(r.y*960)]})()};for(const[r,a]of Object.entries(o.props))if(a.visible){const e=a.getWorldPosition(new o.anchors.pain.constructor),s=o.project(e,p);m["prop_"+r]=[Math.round(s.x*540),Math.round(s.y*960),+e.x.toFixed(2),+e.y.toFixed(2),+e.z.toFixed(2)]}console.log("INFO "+JSON.stringify(m)),window.__done=!0},[]),x.jsxDEV("canvas",{ref:d,style:{width:540,height:960}},void 0,!1,{fileName:"/workspaces/frontend/src/video/Debug.tsx",lineNumber:34,columnNumber:10},this)}export{J as default};