ai-agent-session-center 2.10.4 → 2.10.8
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/dist/client/assets/{AgendaView-BjUofdUE.js → AgendaView-cE3y0BVY.js} +1 -1
- package/dist/client/assets/{CyberdromeScene-CVC6Dakt.js → CyberdromeScene-BVJvSptO.js} +2 -2
- package/dist/client/assets/{HistoryView-BHbCPzur.js → HistoryView-BbzJAx3N.js} +1 -1
- package/dist/client/assets/{ProjectBrowserView-Cx-NqZVI.js → ProjectBrowserView-oRc-gGwv.js} +1 -1
- package/dist/client/assets/{QueueView-woz0B4Bh.js → QueueView-B9HBPeYQ.js} +1 -1
- package/dist/client/assets/index-BtUJHbpO.js +210 -0
- package/dist/client/assets/index-CHSTdWtQ.css +1 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/server/apiRouter.ts +76 -9
- package/server/sshManager.ts +26 -17
- package/server/ttsManager.ts +177 -0
- package/dist/client/assets/index-Cd3bd-J3.js +0 -206
- package/dist/client/assets/index-DInNwfLK.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as f,h as l,k as e,o as A}from"./index-Cd3bd-J3.js";const P="_container_3h9eq_6",F="_filterBar_3h9eq_15",$="_toggleLabel_3h9eq_42",U="_taskList_3h9eq_61",Y="_groupHeader_3h9eq_69",G="_groupChevron_3h9eq_78",V="_collapsed_3h9eq_86",W="_groupLabel_3h9eq_90",K="_groupCount_3h9eq_99",z="_taskCard_3h9eq_107",J="_completed_3h9eq_124",Q="_taskTitle_3h9eq_128",X="_overdue_3h9eq_133",Z="_dueToday_3h9eq_138",ee="_checkbox_3h9eq_145",te="_taskContent_3h9eq_160",se="_taskHeader_3h9eq_165",ae="_taskTitleInput_3h9eq_189",ne="_priorityBadge_3h9eq_204",oe="_priorityUrgent_3h9eq_231",le="_priorityHigh_3h9eq_237",ie="_priorityMedium_3h9eq_243",re="_priorityLow_3h9eq_249",ce="_taskMeta_3h9eq_257",de="_dueDate_3h9eq_265",ue="_dueDateOverdue_3h9eq_271",pe="_dueDateToday_3h9eq_275",he="_tag_3h9eq_279",ge="_tagInput_3h9eq_294",me="_addTagBtn_3h9eq_307",_e="_description_3h9eq_327",fe="_descriptionToggle_3h9eq_337",ve="_deleteBtn_3h9eq_354",xe="_addForm_3h9eq_375",ye="_titleInput_3h9eq_418",Ce="_tagsInput_3h9eq_423",je="_addBtn_3h9eq_428",Te="_emptyState_3h9eq_454",ke="_loading_3h9eq_475",De="_stats_3h9eq_488",be="_statsSep_3h9eq_498",we="_confirmOverlay_3h9eq_504",qe="_confirmBtn_3h9eq_513",Se="_cancelBtn_3h9eq_528",s={container:P,filterBar:F,toggleLabel:$,taskList:U,groupHeader:Y,groupChevron:G,collapsed:V,groupLabel:W,groupCount:K,taskCard:z,completed:J,taskTitle:Q,overdue:X,dueToday:Z,checkbox:ee,taskContent:te,taskHeader:se,taskTitleInput:ae,priorityBadge:ne,priorityUrgent:oe,priorityHigh:le,priorityMedium:ie,priorityLow:re,taskMeta:ce,dueDate:de,dueDateOverdue:ue,dueDateToday:pe,tag:he,tagInput:ge,addTagBtn:me,description:_e,descriptionToggle:fe,deleteBtn:ve,addForm:xe,titleInput:ye,tagsInput:Ce,addBtn:je,emptyState:Te,loading:ke,stats:De,statsSep:be,confirmOverlay:we,confirmBtn:qe,cancelBtn:Se},Ne=[{value:"all",label:"All priorities"},{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],Be=[{value:"priority",label:"Priority"},{value:"dueDate",label:"Due date"},{value:"createdAt",label:"Created"}];function Ie(){const t=f(i=>i.filter),o=f(i=>i.setFilter),n=l.useCallback(i=>o({search:i}),[o]),c=l.useCallback(i=>o({priority:i.target.value}),[o]),d=l.useCallback(i=>o({sortBy:i.target.value}),[o]),p=l.useCallback(()=>o({showCompleted:!t.showCompleted}),[o,t.showCompleted]);return e.jsxs("div",{className:s.filterBar,children:[e.jsx(A,{value:t.search,onChange:n,placeholder:"Search tasks...",debounceMs:200}),e.jsx("select",{value:t.priority,onChange:c,children:Ne.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))}),e.jsx("select",{value:t.sortBy,onChange:d,children:Be.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))}),e.jsxs("label",{className:s.toggleLabel,children:[e.jsx("input",{type:"checkbox",checked:t.showCompleted,onChange:p}),"Show completed"]})]})}const Le={urgent:s.priorityUrgent,high:s.priorityHigh,medium:s.priorityMedium,low:s.priorityLow},Oe=["low","medium","high","urgent"];function Re(t){if(!t)return null;const o=new Date;o.setHours(0,0,0,0);const n=new Date(t+"T00:00:00");return n<o?"overdue":n.getTime()===o.getTime()?"today":"future"}function Ee(t){return new Date(t+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"})}function N({task:t}){const o=f(a=>a.toggleTask),n=f(a=>a.updateTask),c=f(a=>a.deleteTask),[d,p]=l.useState(!1),[i,m]=l.useState(t.title),[_,x]=l.useState(!1),[u,C]=l.useState(""),[j,r]=l.useState(!1),[v,g]=l.useState(!1),T=l.useRef(null),b=l.useRef(null);l.useEffect(()=>{d&&(T.current?.focus(),T.current?.select())},[d]),l.useEffect(()=>{_&&b.current?.focus()},[_]),l.useEffect(()=>{d||m(t.title)},[t.title,d]);const k=l.useCallback(()=>{p(!1);const a=i.trim();a&&a!==t.title?n(t.id,{title:a}):m(t.title)},[i,t.id,t.title,n]),w=l.useCallback(()=>{o(t.id)},[o,t.id]),h=l.useCallback(()=>{c(t.id),g(!1)},[c,t.id]),y=l.useCallback(()=>{C(t.tags.join(", ")),x(!0)},[t.tags]),R=l.useCallback(a=>{n(t.id,{priority:a.target.value})},[t.id,n]),S=l.useCallback(()=>{x(!1);const a=u.split(",").map(M=>M.trim()).filter(Boolean),E=t.tags.join(","),H=a.join(",");E!==H&&n(t.id,{tags:a})},[u,t.id,t.tags,n]),D=Re(t.dueDate),q=[s.taskCard];return t.completed&&q.push(s.completed),!t.completed&&D==="overdue"&&q.push(s.overdue),!t.completed&&D==="today"&&q.push(s.dueToday),e.jsxs("div",{className:q.join(" "),children:[e.jsx("input",{type:"checkbox",className:s.checkbox,checked:t.completed,onChange:w,"aria-label":`Mark "${t.title}" as ${t.completed?"incomplete":"complete"}`}),e.jsxs("div",{className:s.taskContent,children:[e.jsxs("div",{className:s.taskHeader,children:[d?e.jsx("input",{ref:T,className:s.taskTitleInput,value:i,onChange:a=>m(a.target.value),onBlur:k,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),k()),a.key==="Escape"&&(m(t.title),p(!1))},onClick:a=>a.stopPropagation()}):e.jsx("span",{className:s.taskTitle,onClick:()=>{m(t.title),p(!0)},title:"Click to edit",children:t.title}),e.jsx("select",{className:`${s.priorityBadge} ${Le[t.priority]}`,value:t.priority,onChange:R,onClick:a=>a.stopPropagation(),title:"Change priority",children:Oe.map(a=>e.jsx("option",{value:a,children:a.toUpperCase()},a))})]}),e.jsxs("div",{className:s.taskMeta,children:[t.dueDate&&e.jsxs("span",{className:`${s.dueDate} ${D==="overdue"?s.dueDateOverdue:""} ${D==="today"?s.dueDateToday:""}`,children:[D==="overdue"&&"Overdue: ",D==="today"&&"Today: ",Ee(t.dueDate)]}),_?e.jsx("input",{ref:b,className:s.tagInput,value:u,onChange:a=>C(a.target.value),onBlur:S,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),S()),a.key==="Escape"&&x(!1)},onClick:a=>a.stopPropagation(),placeholder:"tag1, tag2, ..."}):e.jsxs(e.Fragment,{children:[t.tags.map(a=>e.jsx("span",{className:s.tag,onClick:y,title:"Click to edit tags",style:{cursor:"pointer"},children:a},a)),e.jsx("button",{className:s.addTagBtn,onClick:y,title:"Add / edit tags",children:"+"})]})]}),t.description&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:s.descriptionToggle,onClick:()=>r(a=>!a),children:j?"- Hide details":"+ Show details"}),j&&e.jsx("div",{className:s.description,children:t.description})]})]}),v?e.jsxs("div",{className:s.confirmOverlay,children:[e.jsx("span",{children:"Delete?"}),e.jsx("button",{className:s.confirmBtn,onClick:h,children:"Yes"}),e.jsx("button",{className:s.cancelBtn,onClick:()=>g(!1),children:"No"})]}):e.jsx("button",{className:s.deleteBtn,onClick:()=>g(!0),"aria-label":`Delete "${t.title}"`,title:"Delete task",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})}function He(){const t=f(u=>u.createTask),[o,n]=l.useState(""),[c,d]=l.useState("medium"),[p,i]=l.useState(""),[m,_]=l.useState(""),x=l.useCallback(u=>{u.preventDefault();const C=o.trim();if(!C)return;const j=m.split(",").map(r=>r.trim()).filter(Boolean);t({title:C,priority:c,tags:j,dueDate:p||void 0}),n(""),d("medium"),i(""),_("")},[o,c,p,m,t]);return e.jsxs("form",{className:s.addForm,onSubmit:x,children:[e.jsx("input",{type:"text",className:s.titleInput,placeholder:"New task title...",value:o,onChange:u=>n(u.target.value),required:!0}),e.jsxs("select",{value:c,onChange:u=>d(u.target.value),children:[e.jsx("option",{value:"urgent",children:"Urgent"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]}),e.jsx("input",{type:"date",value:p,onChange:u=>i(u.target.value),title:"Due date (optional)"}),e.jsx("input",{type:"text",className:s.tagsInput,placeholder:"Tags (comma-sep)",value:m,onChange:u=>_(u.target.value)}),e.jsx("button",{type:"submit",className:s.addBtn,disabled:!o.trim(),children:"ADD"})]})}const B=["urgent","high","medium","low"],I={urgent:0,high:1,medium:2,low:3},Me={urgent:"Urgent",high:"High",medium:"Medium",low:"Low"};function Ae(t,o,n,c){if(n!=="all"&&t.priority!==n||c!=="all"&&!t.tags.includes(c))return!1;if(o){const d=o.toLowerCase(),p=t.title.toLowerCase().includes(d),i=(t.description??"").toLowerCase().includes(d);if(!p&&!i)return!1}return!0}function L(t,o){return[...t].sort((n,c)=>{if(o==="priority"){const d=I[n.priority],p=I[c.priority];return d!==p?d-p:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()}return o==="dueDate"?!n.dueDate&&!c.dueDate?0:n.dueDate?c.dueDate?n.dueDate.localeCompare(c.dueDate):-1:1:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()})}function O({label:t,count:o,collapsed:n,onToggle:c}){return e.jsxs("div",{className:s.groupHeader,onClick:c,children:[e.jsx("svg",{className:`${s.groupChevron} ${n?s.collapsed:""}`,width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),e.jsx("span",{className:s.groupLabel,children:t}),e.jsx("span",{className:s.groupCount,children:o})]})}function Fe(){const t=f(r=>r.tasks),o=f(r=>r.loading),n=f(r=>r.filter),c=f(r=>r.fetchTasks),[d,p]=l.useState(new Set);l.useEffect(()=>{c()},[c]);const i=l.useCallback(r=>{p(v=>{const g=new Set(v);return g.has(r)?g.delete(r):g.add(r),g})},[]),{groups:m,completedTasks:_,totalIncomplete:x,totalCompleted:u}=l.useMemo(()=>{const v=[...t.values()].filter(h=>Ae(h,n.search,n.priority,n.tag)),g=v.filter(h=>!h.completed),T=v.filter(h=>h.completed),b=L(g,n.sortBy),k=new Map;for(const h of B)k.set(h,[]);for(const h of b){const y=k.get(h.priority);y&&y.push(h)}const w=[];for(const h of B){const y=k.get(h)??[];y.length>0&&w.push({id:h,label:Me[h],tasks:y})}return{groups:w,completedTasks:L(T,n.sortBy),totalIncomplete:g.length,totalCompleted:T.length}},[t,n]);if(o)return e.jsx("div",{className:s.container,children:e.jsx("div",{className:s.loading,children:"Loading tasks..."})});const C=m.length===0&&_.length===0,j=t.size===0;return e.jsxs("div",{className:s.container,"data-testid":"agenda-view",children:[e.jsx(Ie,{}),e.jsxs("div",{className:s.stats,children:[e.jsxs("span",{children:[x," task",x!==1?"s":""]}),e.jsx("span",{className:s.statsSep,children:"|"}),e.jsxs("span",{children:[u," completed"]})]}),e.jsx("div",{className:s.taskList,children:j?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks yet"}),e.jsx("span",{children:"Add your first task below"})]}):C?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks match the current filter"}),e.jsx("span",{children:"Try adjusting your search or filter criteria"})]}):e.jsxs(e.Fragment,{children:[m.map(r=>{const v=d.has(r.id);return e.jsxs("div",{children:[e.jsx(O,{label:r.label,count:r.tasks.length,collapsed:v,onToggle:()=>i(r.id)}),!v&&r.tasks.map(g=>e.jsx(N,{task:g},g.id))]},r.id)}),n.showCompleted&&_.length>0&&e.jsxs("div",{children:[e.jsx(O,{label:"Completed",count:_.length,collapsed:d.has("__completed__"),onToggle:()=>i("__completed__")}),!d.has("__completed__")&&_.map(r=>e.jsx(N,{task:r},r.id))]})]})}),e.jsx(He,{})]})}export{Fe as default};
|
|
1
|
+
import{y as f,h as l,k as e,o as A}from"./index-BtUJHbpO.js";const P="_container_3h9eq_6",F="_filterBar_3h9eq_15",$="_toggleLabel_3h9eq_42",U="_taskList_3h9eq_61",Y="_groupHeader_3h9eq_69",G="_groupChevron_3h9eq_78",V="_collapsed_3h9eq_86",W="_groupLabel_3h9eq_90",K="_groupCount_3h9eq_99",z="_taskCard_3h9eq_107",J="_completed_3h9eq_124",Q="_taskTitle_3h9eq_128",X="_overdue_3h9eq_133",Z="_dueToday_3h9eq_138",ee="_checkbox_3h9eq_145",te="_taskContent_3h9eq_160",se="_taskHeader_3h9eq_165",ae="_taskTitleInput_3h9eq_189",ne="_priorityBadge_3h9eq_204",oe="_priorityUrgent_3h9eq_231",le="_priorityHigh_3h9eq_237",ie="_priorityMedium_3h9eq_243",re="_priorityLow_3h9eq_249",ce="_taskMeta_3h9eq_257",de="_dueDate_3h9eq_265",ue="_dueDateOverdue_3h9eq_271",pe="_dueDateToday_3h9eq_275",he="_tag_3h9eq_279",ge="_tagInput_3h9eq_294",me="_addTagBtn_3h9eq_307",_e="_description_3h9eq_327",fe="_descriptionToggle_3h9eq_337",ve="_deleteBtn_3h9eq_354",xe="_addForm_3h9eq_375",ye="_titleInput_3h9eq_418",Ce="_tagsInput_3h9eq_423",je="_addBtn_3h9eq_428",Te="_emptyState_3h9eq_454",ke="_loading_3h9eq_475",De="_stats_3h9eq_488",be="_statsSep_3h9eq_498",we="_confirmOverlay_3h9eq_504",qe="_confirmBtn_3h9eq_513",Se="_cancelBtn_3h9eq_528",s={container:P,filterBar:F,toggleLabel:$,taskList:U,groupHeader:Y,groupChevron:G,collapsed:V,groupLabel:W,groupCount:K,taskCard:z,completed:J,taskTitle:Q,overdue:X,dueToday:Z,checkbox:ee,taskContent:te,taskHeader:se,taskTitleInput:ae,priorityBadge:ne,priorityUrgent:oe,priorityHigh:le,priorityMedium:ie,priorityLow:re,taskMeta:ce,dueDate:de,dueDateOverdue:ue,dueDateToday:pe,tag:he,tagInput:ge,addTagBtn:me,description:_e,descriptionToggle:fe,deleteBtn:ve,addForm:xe,titleInput:ye,tagsInput:Ce,addBtn:je,emptyState:Te,loading:ke,stats:De,statsSep:be,confirmOverlay:we,confirmBtn:qe,cancelBtn:Se},Ne=[{value:"all",label:"All priorities"},{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],Be=[{value:"priority",label:"Priority"},{value:"dueDate",label:"Due date"},{value:"createdAt",label:"Created"}];function Ie(){const t=f(i=>i.filter),o=f(i=>i.setFilter),n=l.useCallback(i=>o({search:i}),[o]),c=l.useCallback(i=>o({priority:i.target.value}),[o]),d=l.useCallback(i=>o({sortBy:i.target.value}),[o]),p=l.useCallback(()=>o({showCompleted:!t.showCompleted}),[o,t.showCompleted]);return e.jsxs("div",{className:s.filterBar,children:[e.jsx(A,{value:t.search,onChange:n,placeholder:"Search tasks...",debounceMs:200}),e.jsx("select",{value:t.priority,onChange:c,children:Ne.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))}),e.jsx("select",{value:t.sortBy,onChange:d,children:Be.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))}),e.jsxs("label",{className:s.toggleLabel,children:[e.jsx("input",{type:"checkbox",checked:t.showCompleted,onChange:p}),"Show completed"]})]})}const Le={urgent:s.priorityUrgent,high:s.priorityHigh,medium:s.priorityMedium,low:s.priorityLow},Oe=["low","medium","high","urgent"];function Re(t){if(!t)return null;const o=new Date;o.setHours(0,0,0,0);const n=new Date(t+"T00:00:00");return n<o?"overdue":n.getTime()===o.getTime()?"today":"future"}function Ee(t){return new Date(t+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"})}function N({task:t}){const o=f(a=>a.toggleTask),n=f(a=>a.updateTask),c=f(a=>a.deleteTask),[d,p]=l.useState(!1),[i,m]=l.useState(t.title),[_,x]=l.useState(!1),[u,C]=l.useState(""),[j,r]=l.useState(!1),[v,g]=l.useState(!1),T=l.useRef(null),b=l.useRef(null);l.useEffect(()=>{d&&(T.current?.focus(),T.current?.select())},[d]),l.useEffect(()=>{_&&b.current?.focus()},[_]),l.useEffect(()=>{d||m(t.title)},[t.title,d]);const k=l.useCallback(()=>{p(!1);const a=i.trim();a&&a!==t.title?n(t.id,{title:a}):m(t.title)},[i,t.id,t.title,n]),w=l.useCallback(()=>{o(t.id)},[o,t.id]),h=l.useCallback(()=>{c(t.id),g(!1)},[c,t.id]),y=l.useCallback(()=>{C(t.tags.join(", ")),x(!0)},[t.tags]),R=l.useCallback(a=>{n(t.id,{priority:a.target.value})},[t.id,n]),S=l.useCallback(()=>{x(!1);const a=u.split(",").map(M=>M.trim()).filter(Boolean),E=t.tags.join(","),H=a.join(",");E!==H&&n(t.id,{tags:a})},[u,t.id,t.tags,n]),D=Re(t.dueDate),q=[s.taskCard];return t.completed&&q.push(s.completed),!t.completed&&D==="overdue"&&q.push(s.overdue),!t.completed&&D==="today"&&q.push(s.dueToday),e.jsxs("div",{className:q.join(" "),children:[e.jsx("input",{type:"checkbox",className:s.checkbox,checked:t.completed,onChange:w,"aria-label":`Mark "${t.title}" as ${t.completed?"incomplete":"complete"}`}),e.jsxs("div",{className:s.taskContent,children:[e.jsxs("div",{className:s.taskHeader,children:[d?e.jsx("input",{ref:T,className:s.taskTitleInput,value:i,onChange:a=>m(a.target.value),onBlur:k,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),k()),a.key==="Escape"&&(m(t.title),p(!1))},onClick:a=>a.stopPropagation()}):e.jsx("span",{className:s.taskTitle,onClick:()=>{m(t.title),p(!0)},title:"Click to edit",children:t.title}),e.jsx("select",{className:`${s.priorityBadge} ${Le[t.priority]}`,value:t.priority,onChange:R,onClick:a=>a.stopPropagation(),title:"Change priority",children:Oe.map(a=>e.jsx("option",{value:a,children:a.toUpperCase()},a))})]}),e.jsxs("div",{className:s.taskMeta,children:[t.dueDate&&e.jsxs("span",{className:`${s.dueDate} ${D==="overdue"?s.dueDateOverdue:""} ${D==="today"?s.dueDateToday:""}`,children:[D==="overdue"&&"Overdue: ",D==="today"&&"Today: ",Ee(t.dueDate)]}),_?e.jsx("input",{ref:b,className:s.tagInput,value:u,onChange:a=>C(a.target.value),onBlur:S,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),S()),a.key==="Escape"&&x(!1)},onClick:a=>a.stopPropagation(),placeholder:"tag1, tag2, ..."}):e.jsxs(e.Fragment,{children:[t.tags.map(a=>e.jsx("span",{className:s.tag,onClick:y,title:"Click to edit tags",style:{cursor:"pointer"},children:a},a)),e.jsx("button",{className:s.addTagBtn,onClick:y,title:"Add / edit tags",children:"+"})]})]}),t.description&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:s.descriptionToggle,onClick:()=>r(a=>!a),children:j?"- Hide details":"+ Show details"}),j&&e.jsx("div",{className:s.description,children:t.description})]})]}),v?e.jsxs("div",{className:s.confirmOverlay,children:[e.jsx("span",{children:"Delete?"}),e.jsx("button",{className:s.confirmBtn,onClick:h,children:"Yes"}),e.jsx("button",{className:s.cancelBtn,onClick:()=>g(!1),children:"No"})]}):e.jsx("button",{className:s.deleteBtn,onClick:()=>g(!0),"aria-label":`Delete "${t.title}"`,title:"Delete task",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})}function He(){const t=f(u=>u.createTask),[o,n]=l.useState(""),[c,d]=l.useState("medium"),[p,i]=l.useState(""),[m,_]=l.useState(""),x=l.useCallback(u=>{u.preventDefault();const C=o.trim();if(!C)return;const j=m.split(",").map(r=>r.trim()).filter(Boolean);t({title:C,priority:c,tags:j,dueDate:p||void 0}),n(""),d("medium"),i(""),_("")},[o,c,p,m,t]);return e.jsxs("form",{className:s.addForm,onSubmit:x,children:[e.jsx("input",{type:"text",className:s.titleInput,placeholder:"New task title...",value:o,onChange:u=>n(u.target.value),required:!0}),e.jsxs("select",{value:c,onChange:u=>d(u.target.value),children:[e.jsx("option",{value:"urgent",children:"Urgent"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]}),e.jsx("input",{type:"date",value:p,onChange:u=>i(u.target.value),title:"Due date (optional)"}),e.jsx("input",{type:"text",className:s.tagsInput,placeholder:"Tags (comma-sep)",value:m,onChange:u=>_(u.target.value)}),e.jsx("button",{type:"submit",className:s.addBtn,disabled:!o.trim(),children:"ADD"})]})}const B=["urgent","high","medium","low"],I={urgent:0,high:1,medium:2,low:3},Me={urgent:"Urgent",high:"High",medium:"Medium",low:"Low"};function Ae(t,o,n,c){if(n!=="all"&&t.priority!==n||c!=="all"&&!t.tags.includes(c))return!1;if(o){const d=o.toLowerCase(),p=t.title.toLowerCase().includes(d),i=(t.description??"").toLowerCase().includes(d);if(!p&&!i)return!1}return!0}function L(t,o){return[...t].sort((n,c)=>{if(o==="priority"){const d=I[n.priority],p=I[c.priority];return d!==p?d-p:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()}return o==="dueDate"?!n.dueDate&&!c.dueDate?0:n.dueDate?c.dueDate?n.dueDate.localeCompare(c.dueDate):-1:1:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()})}function O({label:t,count:o,collapsed:n,onToggle:c}){return e.jsxs("div",{className:s.groupHeader,onClick:c,children:[e.jsx("svg",{className:`${s.groupChevron} ${n?s.collapsed:""}`,width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),e.jsx("span",{className:s.groupLabel,children:t}),e.jsx("span",{className:s.groupCount,children:o})]})}function Fe(){const t=f(r=>r.tasks),o=f(r=>r.loading),n=f(r=>r.filter),c=f(r=>r.fetchTasks),[d,p]=l.useState(new Set);l.useEffect(()=>{c()},[c]);const i=l.useCallback(r=>{p(v=>{const g=new Set(v);return g.has(r)?g.delete(r):g.add(r),g})},[]),{groups:m,completedTasks:_,totalIncomplete:x,totalCompleted:u}=l.useMemo(()=>{const v=[...t.values()].filter(h=>Ae(h,n.search,n.priority,n.tag)),g=v.filter(h=>!h.completed),T=v.filter(h=>h.completed),b=L(g,n.sortBy),k=new Map;for(const h of B)k.set(h,[]);for(const h of b){const y=k.get(h.priority);y&&y.push(h)}const w=[];for(const h of B){const y=k.get(h)??[];y.length>0&&w.push({id:h,label:Me[h],tasks:y})}return{groups:w,completedTasks:L(T,n.sortBy),totalIncomplete:g.length,totalCompleted:T.length}},[t,n]);if(o)return e.jsx("div",{className:s.container,children:e.jsx("div",{className:s.loading,children:"Loading tasks..."})});const C=m.length===0&&_.length===0,j=t.size===0;return e.jsxs("div",{className:s.container,"data-testid":"agenda-view",children:[e.jsx(Ie,{}),e.jsxs("div",{className:s.stats,children:[e.jsxs("span",{children:[x," task",x!==1?"s":""]}),e.jsx("span",{className:s.statsSep,children:"|"}),e.jsxs("span",{children:[u," completed"]})]}),e.jsx("div",{className:s.taskList,children:j?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks yet"}),e.jsx("span",{children:"Add your first task below"})]}):C?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks match the current filter"}),e.jsx("span",{children:"Try adjusting your search or filter criteria"})]}):e.jsxs(e.Fragment,{children:[m.map(r=>{const v=d.has(r.id);return e.jsxs("div",{children:[e.jsx(O,{label:r.label,count:r.tasks.length,collapsed:v,onToggle:()=>i(r.id)}),!v&&r.tasks.map(g=>e.jsx(N,{task:g},g.id))]},r.id)}),n.showCompleted&&_.length>0&&e.jsxs("div",{children:[e.jsx(O,{label:"Completed",count:_.length,collapsed:d.has("__completed__"),onToggle:()=>i("__completed__")}),!d.has("__completed__")&&_.map(r=>e.jsx(N,{task:r},r.id))]})]})}),e.jsx(He,{})]})}export{Fe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{U as _r,B as Mm,N as xr,C as Yl,V as wn,D as Ot,F as Ff,M as ki,E as ft,R as Tm,G as Yt,H as Vt,I as Uu,J as Rl,W as Du,K as Hr,L as tn,O as fo,Q as ci,T as Sr,X as dr,Y as mo,Z as xo,_ as F_,$ as Ta,a0 as Iu,a1 as ym,a2 as br,a3 as va,a4 as Xt,a5 as Am,a6 as kt,a7 as si,a8 as Cm,a9 as vl,aa as Dr,ab as ma,ac as ba,ad as go,ae as Bi,af as ps,ag as O_,ah as Rm,ai as vo,aj as Vn,ak as wl,al as pa,am as hs,an as wm,ao as Pm,ap as co,aq as Lm,ar as Um,as as Dm,at as Im,au as Nm,av as Fm,aw as Om,ax as km,ay as Bm,az as Gm,aA as zm,aB as Hm,aC as Vm,aD as Wm,aE as jm,aF as Xm,aG as Ym,aH as _l,aI as os,aJ as qm,aK as Fi,aL as Km,aM as Zm,aN as ql,aO as Qm,aP as Kl,aQ as Jm,aR as $m,aS as eg,aT as Of,aU as Ut,aV as kf,aW as Bf,aX as ui,aY as _a,aZ as po,a_ as ho,a$ as li,b0 as ga,b1 as oi,b2 as Gf,b3 as tg,b4 as zf,b5 as Hf,b6 as Vf,b7 as ms,b8 as Wf,b9 as jf,ba as Xf,bb as bo,bc as ng,bd as rg,be as ig,bf as ag,bg as Yf,bh as og,bi as sg,bj as lg,bk as Sl,bl as xl,bm as bl,bn as El,bo as Nu,bp as Fu,bq as Ou,br as ku,bs as Bu,bt as Gu,bu as zu,bv as Hu,bw as Vu,bx as Wu,by as ju,bz as Xu,bA as Yu,bB as qu,bC as Ku,bD as Zu,bE as Qu,bF as Ju,bG as $u,bH as ef,bI as tf,bJ as nf,bK as rf,bL as af,bM as of,bN as sf,bO as lf,bP as cf,bQ as uf,bR as ff,bS as df,bT as pf,bU as Pl,bV as Ll,bW as Ul,bX as Dl,bY as Il,bZ as Nl,b_ as Fl,b$ as cg,c0 as hf,c1 as ug,c2 as cs,c3 as fg,c4 as mf,c5 as gf,c6 as Ol,c7 as kl,c8 as Bl,c9 as qf,ca as Kf,cb as _s,cc as dg,cd as pg,ce as hg,cf as Zf,cg as ph,ch as Qf,ci as Jf,cj as $f,ck as ed,cl as Ss,cm as td,cn as nd,co as rd,cp as hh,cq as id,cr as _o,cs as Ea,ct as ad,cu as mg,cv as gg,cw as k_,cx as vf,cy as Kn,cz as Gl,cA as vg,cB as _g,cC as B_,cD as Sg,cE as xg,cF as bg,cG as od,cH as Eg,cI as Mg,cJ as G_,cK as z_,cL as H_,cM as V_,cN as W_,cO as j_,cP as X_,cQ as Y_,cR as q_,cS as K_,cT as Z_,cU as Q_,cV as J_,cW as $_,cX as eS,cY as tS,cZ as nS,c_ as rS,c$ as iS,d0 as Tg,d1 as aS,d2 as oS,d3 as sS,d4 as lS,d5 as sd,d6 as cS,d7 as uS,d8 as fS,d9 as dS,da as pS,db as hS,dc as mS,dd as gS,de as vS,df as _S,dg as yg,dh as SS,di as xS,dj as bS,dk as ES,dl as MS,dm as TS,dn as yS,dp as AS,dq as CS,dr as RS,ds as wS,dt as PS,du as LS,dv as US,dw as DS,dx as IS,dy as NS,dz as FS,dA as OS,dB as kS,dC as BS,dD as GS,dE as zS,dF as HS,dG as VS,dH as WS,dI as jS,dJ as XS,dK as YS,dL as qS,dM as ua,dN as KS,dO as ZS,dP as QS,dQ as JS,dR as $S,dS as ex,dT as _f,dU as tx,dV as nx,dW as rx,dX as ix,dY as ax,dZ as ox,d_ as sx,d$ as lx,e0 as cx,e1 as ux,e2 as fx,e3 as dx,e4 as px,e5 as hx,e6 as mx,e7 as gx,e8 as Ag,e9 as Cg,ea as vx,eb as _x,ec as Sx,ed as xx,ee as bx,ef as Ex,eg as Mx,eh as Tx,ei as yx,ej as Ax,ek as Cx,el as Rx,em as wx,en as Px,eo as Lx,ep as Ux,eq as Dx,er as Ix,es as Nx,et as Fx,eu as Ox,ev as kx,ew as Rg,ex as Bx,ey as Gx,ez as zx,eA as Hx,eB as wg,eC as Vx,eD as Wx,eE as jx,eF as Xx,eG as Yx,eH as qx,eI as Kx,eJ as Zx,eK as Qx,eL as Jx,eM as $x,eN as fa,eO as eb,eP as tb,eQ as Sf,eR as nb,eS as rb,eT as ib,eU as ab,eV as ob,eW as sb,eX as fr,eY as lb,eZ as cb,e_ as ub,e$ as fb,f0 as db,f1 as pb,f2 as hb,f3 as mb,f4 as gb,f5 as vb,f6 as _b,f7 as Sb,f8 as xb,f9 as bb,fa as Eb,fb as Mb,fc as Tb,fd as yb,fe as Pg,ff as Ab,fg as Cb,fh as Rb,fi as wb,fj as Pb,fk as Lb,fl as Ub,fm as zl,fn as Db,fo as Ib,fp as Lg,fq as Nb,fr as Fb,fs as Ob,ft as Ug,fu as Dg,fv as kb,fw as Bb,fx as Gb,fy as zb,fz as Hb,fA as Ig,fB as Vb,fC as Wb,fD as jb,fE as Xb,fF as Yb,fG as qb,fH as Kb,fI as Zb,fJ as Qb,fK as Ng,fL as Jb,fM as xf,fN as $b,fO as eE,fP as tE,fQ as nE,fR as rE,fS as iE,fT as aE,fU as oE,fV as sE,fW as lE,fX as cE,fY as uE,fZ as fE,f_ as dE,f$ as da,g0 as pE,g1 as hE,g2 as mE,g3 as gE,g4 as vE,g5 as _E,g6 as SE,g7 as xE,g8 as bE,g9 as EE,ga as ME,gb as TE,gc as yE,gd as AE,ge as CE,gf as RE,gg as wE,gh as PE,gi as LE,gj as UE,gk as DE,gl as IE,gm as NE,gn as FE,go as OE,gp as kE,gq as BE,gr as GE,gs as zE,gt as HE,gu as VE,gv as WE,gw as Fg,gx as jE,gy as Og,gz as XE,h as oe,k as Q,gA as ld,gB as YE,gC as qE,gD as fi,gE as oa,gF as kg,gG as KE,gH as ol,gI as mh,gJ as ZE,gK as QE,gL as JE,gM as $E,gN as Zl,gO as sl,gP as Ml,gQ as kn,gR as es,gS as gh,gT as bf,gU as du,gV as e1,gW as t1,gX as n1,gY as r1,gZ as Hl,w as vh,g_ as i1,g$ as a1,h0 as o1,h1 as s1,h2 as l1,h3 as c1,h4 as u1,h5 as f1,h6 as d1}from"./index-
|
|
1
|
+
import{U as _r,B as Mm,N as xr,C as Yl,V as wn,D as Ot,F as Ff,M as ki,E as ft,R as Tm,G as Yt,H as Vt,I as Uu,J as Rl,W as Du,K as Hr,L as tn,O as fo,Q as ci,T as Sr,X as dr,Y as mo,Z as xo,_ as F_,$ as Ta,a0 as Iu,a1 as ym,a2 as br,a3 as va,a4 as Xt,a5 as Am,a6 as kt,a7 as si,a8 as Cm,a9 as vl,aa as Dr,ab as ma,ac as ba,ad as go,ae as Bi,af as ps,ag as O_,ah as Rm,ai as vo,aj as Vn,ak as wl,al as pa,am as hs,an as wm,ao as Pm,ap as co,aq as Lm,ar as Um,as as Dm,at as Im,au as Nm,av as Fm,aw as Om,ax as km,ay as Bm,az as Gm,aA as zm,aB as Hm,aC as Vm,aD as Wm,aE as jm,aF as Xm,aG as Ym,aH as _l,aI as os,aJ as qm,aK as Fi,aL as Km,aM as Zm,aN as ql,aO as Qm,aP as Kl,aQ as Jm,aR as $m,aS as eg,aT as Of,aU as Ut,aV as kf,aW as Bf,aX as ui,aY as _a,aZ as po,a_ as ho,a$ as li,b0 as ga,b1 as oi,b2 as Gf,b3 as tg,b4 as zf,b5 as Hf,b6 as Vf,b7 as ms,b8 as Wf,b9 as jf,ba as Xf,bb as bo,bc as ng,bd as rg,be as ig,bf as ag,bg as Yf,bh as og,bi as sg,bj as lg,bk as Sl,bl as xl,bm as bl,bn as El,bo as Nu,bp as Fu,bq as Ou,br as ku,bs as Bu,bt as Gu,bu as zu,bv as Hu,bw as Vu,bx as Wu,by as ju,bz as Xu,bA as Yu,bB as qu,bC as Ku,bD as Zu,bE as Qu,bF as Ju,bG as $u,bH as ef,bI as tf,bJ as nf,bK as rf,bL as af,bM as of,bN as sf,bO as lf,bP as cf,bQ as uf,bR as ff,bS as df,bT as pf,bU as Pl,bV as Ll,bW as Ul,bX as Dl,bY as Il,bZ as Nl,b_ as Fl,b$ as cg,c0 as hf,c1 as ug,c2 as cs,c3 as fg,c4 as mf,c5 as gf,c6 as Ol,c7 as kl,c8 as Bl,c9 as qf,ca as Kf,cb as _s,cc as dg,cd as pg,ce as hg,cf as Zf,cg as ph,ch as Qf,ci as Jf,cj as $f,ck as ed,cl as Ss,cm as td,cn as nd,co as rd,cp as hh,cq as id,cr as _o,cs as Ea,ct as ad,cu as mg,cv as gg,cw as k_,cx as vf,cy as Kn,cz as Gl,cA as vg,cB as _g,cC as B_,cD as Sg,cE as xg,cF as bg,cG as od,cH as Eg,cI as Mg,cJ as G_,cK as z_,cL as H_,cM as V_,cN as W_,cO as j_,cP as X_,cQ as Y_,cR as q_,cS as K_,cT as Z_,cU as Q_,cV as J_,cW as $_,cX as eS,cY as tS,cZ as nS,c_ as rS,c$ as iS,d0 as Tg,d1 as aS,d2 as oS,d3 as sS,d4 as lS,d5 as sd,d6 as cS,d7 as uS,d8 as fS,d9 as dS,da as pS,db as hS,dc as mS,dd as gS,de as vS,df as _S,dg as yg,dh as SS,di as xS,dj as bS,dk as ES,dl as MS,dm as TS,dn as yS,dp as AS,dq as CS,dr as RS,ds as wS,dt as PS,du as LS,dv as US,dw as DS,dx as IS,dy as NS,dz as FS,dA as OS,dB as kS,dC as BS,dD as GS,dE as zS,dF as HS,dG as VS,dH as WS,dI as jS,dJ as XS,dK as YS,dL as qS,dM as ua,dN as KS,dO as ZS,dP as QS,dQ as JS,dR as $S,dS as ex,dT as _f,dU as tx,dV as nx,dW as rx,dX as ix,dY as ax,dZ as ox,d_ as sx,d$ as lx,e0 as cx,e1 as ux,e2 as fx,e3 as dx,e4 as px,e5 as hx,e6 as mx,e7 as gx,e8 as Ag,e9 as Cg,ea as vx,eb as _x,ec as Sx,ed as xx,ee as bx,ef as Ex,eg as Mx,eh as Tx,ei as yx,ej as Ax,ek as Cx,el as Rx,em as wx,en as Px,eo as Lx,ep as Ux,eq as Dx,er as Ix,es as Nx,et as Fx,eu as Ox,ev as kx,ew as Rg,ex as Bx,ey as Gx,ez as zx,eA as Hx,eB as wg,eC as Vx,eD as Wx,eE as jx,eF as Xx,eG as Yx,eH as qx,eI as Kx,eJ as Zx,eK as Qx,eL as Jx,eM as $x,eN as fa,eO as eb,eP as tb,eQ as Sf,eR as nb,eS as rb,eT as ib,eU as ab,eV as ob,eW as sb,eX as fr,eY as lb,eZ as cb,e_ as ub,e$ as fb,f0 as db,f1 as pb,f2 as hb,f3 as mb,f4 as gb,f5 as vb,f6 as _b,f7 as Sb,f8 as xb,f9 as bb,fa as Eb,fb as Mb,fc as Tb,fd as yb,fe as Pg,ff as Ab,fg as Cb,fh as Rb,fi as wb,fj as Pb,fk as Lb,fl as Ub,fm as zl,fn as Db,fo as Ib,fp as Lg,fq as Nb,fr as Fb,fs as Ob,ft as Ug,fu as Dg,fv as kb,fw as Bb,fx as Gb,fy as zb,fz as Hb,fA as Ig,fB as Vb,fC as Wb,fD as jb,fE as Xb,fF as Yb,fG as qb,fH as Kb,fI as Zb,fJ as Qb,fK as Ng,fL as Jb,fM as xf,fN as $b,fO as eE,fP as tE,fQ as nE,fR as rE,fS as iE,fT as aE,fU as oE,fV as sE,fW as lE,fX as cE,fY as uE,fZ as fE,f_ as dE,f$ as da,g0 as pE,g1 as hE,g2 as mE,g3 as gE,g4 as vE,g5 as _E,g6 as SE,g7 as xE,g8 as bE,g9 as EE,ga as ME,gb as TE,gc as yE,gd as AE,ge as CE,gf as RE,gg as wE,gh as PE,gi as LE,gj as UE,gk as DE,gl as IE,gm as NE,gn as FE,go as OE,gp as kE,gq as BE,gr as GE,gs as zE,gt as HE,gu as VE,gv as WE,gw as Fg,gx as jE,gy as Og,gz as XE,h as oe,k as Q,gA as ld,gB as YE,gC as qE,gD as fi,gE as oa,gF as kg,gG as KE,gH as ol,gI as mh,gJ as ZE,gK as QE,gL as JE,gM as $E,gN as Zl,gO as sl,gP as Ml,gQ as kn,gR as es,gS as gh,gT as bf,gU as du,gV as e1,gW as t1,gX as n1,gY as r1,gZ as Hl,w as vh,g_ as i1,g$ as a1,h0 as o1,h1 as s1,h2 as l1,h3 as c1,h4 as u1,h5 as f1,h6 as d1}from"./index-BtUJHbpO.js";function Bg(){let n=null,r=!1,s=null,l=null;function a(i,f){s(i,f),l=n.requestAnimationFrame(a)}return{start:function(){r!==!0&&s!==null&&(l=n.requestAnimationFrame(a),r=!0)},stop:function(){n.cancelAnimationFrame(l),r=!1},setAnimationLoop:function(i){s=i},setContext:function(i){n=i}}}function p1(n){const r=new WeakMap;function s(u,d){const p=u.array,h=u.usage,v=p.byteLength,S=n.createBuffer();n.bindBuffer(d,S),n.bufferData(d,p,h),u.onUploadCallback();let b;if(p instanceof Float32Array)b=n.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)b=n.HALF_FLOAT;else if(p instanceof Uint16Array)u.isFloat16BufferAttribute?b=n.HALF_FLOAT:b=n.UNSIGNED_SHORT;else if(p instanceof Int16Array)b=n.SHORT;else if(p instanceof Uint32Array)b=n.UNSIGNED_INT;else if(p instanceof Int32Array)b=n.INT;else if(p instanceof Int8Array)b=n.BYTE;else if(p instanceof Uint8Array)b=n.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)b=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:S,type:b,bytesPerElement:p.BYTES_PER_ELEMENT,version:u.version,size:v}}function l(u,d,p){const h=d.array,v=d.updateRanges;if(n.bindBuffer(p,u),v.length===0)n.bufferSubData(p,0,h);else{v.sort((b,A)=>b.start-A.start);let S=0;for(let b=1;b<v.length;b++){const A=v[S],P=v[b];P.start<=A.start+A.count+1?A.count=Math.max(A.count,P.start+P.count-A.start):(++S,v[S]=P)}v.length=S+1;for(let b=0,A=v.length;b<A;b++){const P=v[b];n.bufferSubData(p,P.start*h.BYTES_PER_ELEMENT,h,P.start,P.count)}d.clearUpdateRanges()}d.onUploadCallback()}function a(u){return u.isInterleavedBufferAttribute&&(u=u.data),r.get(u)}function i(u){u.isInterleavedBufferAttribute&&(u=u.data);const d=r.get(u);d&&(n.deleteBuffer(d.buffer),r.delete(u))}function f(u,d){if(u.isInterleavedBufferAttribute&&(u=u.data),u.isGLBufferAttribute){const h=r.get(u);(!h||h.version<u.version)&&r.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}const p=r.get(u);if(p===void 0)r.set(u,s(u,d));else if(p.version<u.version){if(p.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");l(p.buffer,u,d),p.version=u.version}}return{get:a,remove:i,update:f}}var h1=`#ifdef USE_ALPHAHASH
|
|
2
2
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
3
3
|
#endif`,m1=`#ifdef USE_ALPHAHASH
|
|
4
4
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -4183,4 +4183,4 @@ if (edgeAlpha == 0.0) {
|
|
|
4183
4183
|
`;function _3(n){const r=If(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new kt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new wn(0,0,0,0)},uTroikaClipRect:{value:new wn(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new kt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ot},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Ut},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:h3,vertexTransform:m3,fragmentDefs:g3,fragmentColorTransform:v3,customRewriter({vertexShader:s,fragmentShader:l}){let a=/\buniform\s+vec3\s+diffuse\b/;return a.test(l)&&(l=l.replace(a,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),a.test(s)||(s=s.replace(dv,`uniform vec3 diffuse;
|
|
4184
4184
|
$&
|
|
4185
4185
|
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
|
|
4186
|
-
`))),{vertexShader:s,fragmentShader:l}}});return r.transparent=!0,r.forceSinglePass=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}const pd=new ad({color:16777215,side:Sr,transparent:!0}),hm=8421504,mm=new ki,ml=new ft,wu=new ft,rs=[],S3=new ft,Pu="+x+y";function gm(n){return Array.isArray(n)?n[0]:n}let _v=()=>{const n=new br(new bo(1,1),pd);return _v=()=>n,n},Sv=()=>{const n=new br(new bo(1,1,32,1),pd);return Sv=()=>n,n};const x3={type:"syncstart"},b3={type:"synccomplete"},xv=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],E3=xv.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let bv=class extends br{constructor(){const r=new p3;super(r,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=hm,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Pu,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(r){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(r):(this._isSyncing=!0,this.dispatchEvent(x3),hv({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},s=>{this._isSyncing=!1,this._textRenderInfo=s,this.geometry.updateGlyphs(s.glyphBounds,s.glyphAtlasIndices,s.blockBounds,s.chunkedBounds,s.glyphColors);const l=this._queuedSyncs;l&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{l.forEach(a=>a&&a())})),this.dispatchEvent(b3),r&&r()})))}onBeforeRender(r,s,l,a,i,f){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(r){return _3(r)}get material(){let r=this._derivedMaterial;const s=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=pd.clone());if((!r||!r.isDerivedFrom(s))&&(r=this._derivedMaterial=this.createDerivedMaterial(s),s.addEventListener("dispose",function l(){s.removeEventListener("dispose",l),r.dispose()})),this.hasOutline()){let l=r._outlineMtl;return l||(l=r._outlineMtl=Object.create(r,{id:{value:r.id+.1}}),l.isTextOutlineMaterial=!0,l.depthWrite=!1,l.map=null,r.addEventListener("dispose",function a(){r.removeEventListener("dispose",a),l.dispose()})),[l,r]}else return r}set material(r){r&&r.isTroikaTextMaterial?(this._derivedMaterial=r,this._baseMaterial=r.baseMaterial):this._baseMaterial=r}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(r){this.geometry.detail=r}get curveRadius(){return this.geometry.curveRadius}set curveRadius(r){this.geometry.curveRadius=r}get customDepthMaterial(){return gm(this.material).getDepthMaterial()}set customDepthMaterial(r){}get customDistanceMaterial(){return gm(this.material).getDistanceMaterial()}set customDistanceMaterial(r){}_prepareForRender(r){const s=r.isTextOutlineMaterial,l=r.uniforms,a=this.textRenderInfo;if(a){const{sdfTexture:u,blockBounds:d}=a;l.uTroikaSDFTexture.value=u,l.uTroikaSDFTextureSize.value.set(u.image.width,u.image.height),l.uTroikaSDFGlyphSize.value=a.sdfGlyphSize,l.uTroikaSDFExponent.value=a.sdfExponent,l.uTroikaTotalBounds.value.fromArray(d),l.uTroikaUseGlyphColors.value=!s&&!!a.glyphColors;let p=0,h=0,v=0,S,b,A,P=0,x=0;if(s){let{outlineWidth:M,outlineOffsetX:R,outlineOffsetY:C,outlineBlur:w,outlineOpacity:L}=this;p=this._parsePercent(M)||0,h=Math.max(0,this._parsePercent(w)||0),S=L,P=this._parsePercent(R)||0,x=this._parsePercent(C)||0}else v=Math.max(0,this._parsePercent(this.strokeWidth)||0),v&&(A=this.strokeColor,l.uTroikaStrokeColor.value.set(A??hm),b=this.strokeOpacity,b==null&&(b=1)),S=this.fillOpacity;l.uTroikaEdgeOffset.value=p,l.uTroikaPositionOffset.value.set(P,x),l.uTroikaBlurRadius.value=h,l.uTroikaStrokeWidth.value=v,l.uTroikaStrokeOpacity.value=b,l.uTroikaFillOpacity.value=S??1,l.uTroikaCurveRadius.value=this.curveRadius||0;let _=this.clipRect;if(_&&Array.isArray(_)&&_.length===4)l.uTroikaClipRect.value.fromArray(_);else{const M=(this.fontSize||.1)*100;l.uTroikaClipRect.value.set(d[0]-M,d[1]-M,d[2]+M,d[3]+M)}this.geometry.applyClipRect(l.uTroikaClipRect.value)}l.uTroikaSDFDebug.value=!!this.debugSDF,r.polygonOffset=!!this.depthOffset,r.polygonOffsetFactor=r.polygonOffsetUnits=this.depthOffset||0;const i=s?this.outlineColor||0:this.color;if(i==null)delete r.color;else{const u=r.hasOwnProperty("color")?r.color:r.color=new Ot;(i!==u._input||typeof i=="object")&&u.set(u._input=i)}let f=this.orientation||Pu;if(f!==r._orientation){let u=l.uTroikaOrient.value;f=f.replace(/[^-+xyz]/g,"");let d=f!==Pu&&f.match(/^([-+])([xyz])([-+])([xyz])$/);if(d){let[,p,h,v,S]=d;ml.set(0,0,0)[h]=p==="-"?1:-1,wu.set(0,0,0)[S]=v==="-"?-1:1,mm.lookAt(S3,ml.cross(wu),wu),u.setFromMatrix4(mm)}else u.identity();r._orientation=f}}_parsePercent(r){if(typeof r=="string"){let s=r.match(/^(-?[\d.]+)%$/),l=s?parseFloat(s[1]):NaN;r=(isNaN(l)?0:l/100)*this.fontSize}return r}localPositionToTextCoords(r,s=new kt){s.copy(r);const l=this.curveRadius;return l&&(s.x=Math.atan2(r.x,Math.abs(l)-Math.abs(r.z))*Math.abs(l)),s}worldPositionToTextCoords(r,s=new kt){return ml.copy(r),this.localPositionToTextCoords(this.worldToLocal(ml),s)}raycast(r,s){const{textRenderInfo:l,curveRadius:a}=this;if(l){const i=l.blockBounds,f=a?Sv():_v(),u=f.geometry,{position:d,uv:p}=u.attributes;for(let h=0;h<p.count;h++){let v=i[0]+p.getX(h)*(i[2]-i[0]);const S=i[1]+p.getY(h)*(i[3]-i[1]);let b=0;a&&(b=a-Math.cos(v/a)*a,v=Math.sin(v/a)*a),d.setXYZ(h,v,S,b)}u.boundingSphere=this.geometry.boundingSphere,u.boundingBox=this.geometry.boundingBox,f.matrixWorld=this.matrixWorld,f.material.side=this.material.side,rs.length=0,f.raycast(r,rs);for(let h=0;h<rs.length;h++)rs[h].object=this,s.push(rs[h])}}copy(r){const s=this.geometry;return super.copy(r),this.geometry=s,E3.forEach(l=>{this[l]=r[l]}),this}clone(){return new this.constructor().copy(this)}};xv.forEach(n=>{const r="_private_"+n;Object.defineProperty(bv.prototype,n,{get(){return this[r]},set(s){s!==this[r]&&(this[r]=s,this._needsSync=!0)}})});new sd;new Ot;const xa=oe.forwardRef(({sdfGlyphSize:n=64,anchorX:r="center",anchorY:s="middle",font:l,fontSize:a=1,children:i,characters:f,onSync:u,...d},p)=>{const h=Lr(({invalidate:A})=>A),[v]=oe.useState(()=>new bv),[S,b]=oe.useMemo(()=>{const A=[];let P="";return oe.Children.forEach(i,x=>{typeof x=="string"||typeof x=="number"?P+=x:A.push(x)}),[A,P]},[i]);return _C(()=>new Promise(A=>o3({font:l,characters:f},A)),["troika-text",l,f]),oe.useLayoutEffect(()=>{v.sync(()=>{h(),u&&u(v)})}),oe.useEffect(()=>()=>v.dispose(),[v]),oe.createElement("primitive",ld({object:v,ref:p,font:l,text:b,anchorX:r,anchorY:s,fontSize:a,sdfGlyphSize:n},d),S)}),M3=oe.forwardRef(({makeDefault:n,camera:r,regress:s,domElement:l,enableDamping:a=!0,keyEvents:i=!1,onChange:f,onStart:u,onEnd:d,...p},h)=>{const v=Lr(L=>L.invalidate),S=Lr(L=>L.camera),b=Lr(L=>L.gl),A=Lr(L=>L.events),P=Lr(L=>L.setEvents),x=Lr(L=>L.set),_=Lr(L=>L.get),M=Lr(L=>L.performance),R=r||S,C=l||A.connected||b.domElement,w=oe.useMemo(()=>new CR(R),[R]);return Qn(()=>{w.enabled&&w.update()},-1),oe.useEffect(()=>(i&&w.connect(i===!0?C:i),w.connect(C),()=>{w.dispose()}),[i,C,s,w,v]),oe.useEffect(()=>{const L=T=>{v(),s&&M.regress(),f&&f(T)},F=T=>{u&&u(T)},G=T=>{d&&d(T)};return w.addEventListener("change",L),w.addEventListener("start",F),w.addEventListener("end",G),()=>{w.removeEventListener("start",F),w.removeEventListener("end",G),w.removeEventListener("change",L)}},[f,u,d,w,v,P]),oe.useEffect(()=>{if(n){const L=_().controls;return x({controls:w}),()=>x({controls:L})}},[n,w]),oe.createElement("primitive",ld({ref:h,object:w,enableDamping:a},p))}),Ev="cyberdrome-robot-positions";function T3(n){const r={};n.forEach((s,l)=>{r[l]=s});try{sessionStorage.setItem(Ev,JSON.stringify(r))}catch{}}function y3(){const n=new Map;try{const r=sessionStorage.getItem(Ev);if(!r)return n;const s=JSON.parse(r);for(const[l,a]of Object.entries(s))n.set(l,a)}catch{}return n}const is=new Map,vs={set(n,r,s,l){const a=is.get(n);a?(a.x=r,a.y=s,a.z=l):is.set(n,{x:r,y:s,z:l})},get(n){return is.get(n)},delete(n){is.delete(n)},has(n){return is.has(n)}},hd=new Map;function A3(n,r){hd.set(n,r)}function C3(){return hd}function R3(n){hd.delete(n)}const Mv={background:"#0e0c1a",fogDensity:.008,floor:"#1a1830",roomFloor:"#2e2850",borderGlow:"#00f0ff",grid1:"#00f0ff",grid2:"#ff00aa",wall:"#282845",wallOpacity:.55,stripPrimary:"#00f0ff",stripSecondary:"#ff00aa",desk:"#1c1c30",monitorFrame:"#111120",chair:"#222238",particle1:"#00f0ff",particle2:"#ff00aa",trace3:"#a855f7",stars:"#bbaaee",ambientColor:"#3a3060",ambientIntensity:5,dirColor:"#d8caf0",dirIntensity:3.5,fillColor:"#a0b8e0",fillIntensity:1.5,pointLight1:"#00f0ff",pointLight2:"#ff00aa",pointLight3:"#8866ff",hemisphereUp:"#4a3a6e",hemisphereDown:"#1a1428",hemisphereIntensity:2,sconceColor:"#f0e8d0",roomLight1:"#f0e8d0",roomLight2:"#d8d0e8",coffeeFloor:"#2a2018",coffeeAccent:"#d4882a",coffeeFurniture:"#5a3a20"},w3={background:"#0d0221",fogDensity:.01,floor:"#150530",roomFloor:"#2a0a50",borderGlow:"#ff00ff",grid1:"#ff00ff",grid2:"#00ffff",wall:"#1e0840",wallOpacity:.6,stripPrimary:"#ff00ff",stripSecondary:"#00ffff",desk:"#1a0838",monitorFrame:"#0f0520",chair:"#200a40",particle1:"#ff00ff",particle2:"#00ffff",trace3:"#ff6b00",stars:"#dd88ff",ambientColor:"#2a1050",ambientIntensity:4,dirColor:"#e0b0ff",dirIntensity:3,fillColor:"#80c0ff",fillIntensity:1.5,pointLight1:"#ff00ff",pointLight2:"#00ffff",pointLight3:"#ff6b00",hemisphereUp:"#3a1060",hemisphereDown:"#100520",hemisphereIntensity:2,sconceColor:"#e0c0ff",roomLight1:"#e0c0ff",roomLight2:"#c0e0ff",coffeeFloor:"#200818",coffeeAccent:"#ff8820",coffeeFurniture:"#4a2010"},P3={background:"#f5ede0",fogDensity:.005,floor:"#e8ddd0",roomFloor:"#ddd0c0",borderGlow:"#d97706",grid1:"#d97706",grid2:"#b87333",wall:"#c8b8a0",wallOpacity:.7,stripPrimary:"#d97706",stripSecondary:"#b87333",desk:"#8b7355",monitorFrame:"#6b5540",chair:"#9a8468",particle1:"#d9a040",particle2:"#b87333",trace3:"#c2860c",stars:"#d4c4a8",ambientColor:"#f0e0c0",ambientIntensity:8,dirColor:"#fff5e0",dirIntensity:5,fillColor:"#ffe8c0",fillIntensity:3,pointLight1:"#d97706",pointLight2:"#b87333",pointLight3:"#e8a020",hemisphereUp:"#fff8f0",hemisphereDown:"#d0c0a0",hemisphereIntensity:4,sconceColor:"#ffe0a0",roomLight1:"#fff0d0",roomLight2:"#f0e0c0",coffeeFloor:"#c8b898",coffeeAccent:"#b87333",coffeeFurniture:"#8a6a40"},L3={background:"#282a36",fogDensity:.008,floor:"#1e1f2e",roomFloor:"#343648",borderGlow:"#bd93f9",grid1:"#bd93f9",grid2:"#50fa7b",wall:"#383a4e",wallOpacity:.6,stripPrimary:"#bd93f9",stripSecondary:"#50fa7b",desk:"#2a2c3e",monitorFrame:"#1a1c2e",chair:"#303248",particle1:"#bd93f9",particle2:"#50fa7b",trace3:"#ff79c6",stars:"#c8b8e8",ambientColor:"#44475a",ambientIntensity:5,dirColor:"#f8f8f2",dirIntensity:3,fillColor:"#c8c0e0",fillIntensity:1.5,pointLight1:"#bd93f9",pointLight2:"#50fa7b",pointLight3:"#ff79c6",hemisphereUp:"#44475a",hemisphereDown:"#1a1c2e",hemisphereIntensity:2,sconceColor:"#f8f8f2",roomLight1:"#f8f8f2",roomLight2:"#ddd8f0",coffeeFloor:"#2a2030",coffeeAccent:"#ffb86c",coffeeFurniture:"#4a3028"},U3={background:"#002b36",fogDensity:.008,floor:"#073642",roomFloor:"#0a4050",borderGlow:"#2aa198",grid1:"#2aa198",grid2:"#cb4b16",wall:"#0c4a58",wallOpacity:.6,stripPrimary:"#2aa198",stripSecondary:"#cb4b16",desk:"#073038",monitorFrame:"#042028",chair:"#0a3840",particle1:"#2aa198",particle2:"#cb4b16",trace3:"#b58900",stars:"#839496",ambientColor:"#1a4050",ambientIntensity:5,dirColor:"#eee8d5",dirIntensity:3,fillColor:"#93a1a1",fillIntensity:1.5,pointLight1:"#2aa198",pointLight2:"#cb4b16",pointLight3:"#b58900",hemisphereUp:"#2a5a68",hemisphereDown:"#002028",hemisphereIntensity:2,sconceColor:"#eee8d5",roomLight1:"#eee8d5",roomLight2:"#93a1a1",coffeeFloor:"#0a2828",coffeeAccent:"#cb4b16",coffeeFurniture:"#3a2818"},D3={background:"#2e3440",fogDensity:.008,floor:"#252b38",roomFloor:"#3b4252",borderGlow:"#88c0d0",grid1:"#88c0d0",grid2:"#d08770",wall:"#3b4252",wallOpacity:.6,stripPrimary:"#88c0d0",stripSecondary:"#d08770",desk:"#2e3440",monitorFrame:"#1e2430",chair:"#343c4c",particle1:"#88c0d0",particle2:"#d08770",trace3:"#b48ead",stars:"#81a1c1",ambientColor:"#3b4252",ambientIntensity:5,dirColor:"#eceff4",dirIntensity:3,fillColor:"#d8dee9",fillIntensity:1.5,pointLight1:"#88c0d0",pointLight2:"#d08770",pointLight3:"#b48ead",hemisphereUp:"#4c566a",hemisphereDown:"#2e3440",hemisphereIntensity:2,sconceColor:"#eceff4",roomLight1:"#eceff4",roomLight2:"#d8dee9",coffeeFloor:"#2a2228",coffeeAccent:"#d08770",coffeeFurniture:"#4a3030"},I3={background:"#272822",fogDensity:.008,floor:"#1e1f1a",roomFloor:"#3e3d32",borderGlow:"#66d9ef",grid1:"#66d9ef",grid2:"#f92672",wall:"#3e3d32",wallOpacity:.6,stripPrimary:"#66d9ef",stripSecondary:"#f92672",desk:"#2a2a20",monitorFrame:"#1a1a14",chair:"#32322a",particle1:"#66d9ef",particle2:"#f92672",trace3:"#a6e22e",stars:"#a0a090",ambientColor:"#3e3d32",ambientIntensity:5,dirColor:"#f8f8f2",dirIntensity:3,fillColor:"#c8c8b8",fillIntensity:1.5,pointLight1:"#66d9ef",pointLight2:"#f92672",pointLight3:"#a6e22e",hemisphereUp:"#4e4d40",hemisphereDown:"#1e1f1a",hemisphereIntensity:2,sconceColor:"#f8f8f2",roomLight1:"#f8f8f2",roomLight2:"#d8d8c8",coffeeFloor:"#2a2018",coffeeAccent:"#f92672",coffeeFurniture:"#4a2a18"},N3={background:"#e8eaef",fogDensity:.004,floor:"#d8dae0",roomFloor:"#c8cad5",borderGlow:"#3b82f6",grid1:"#3b82f6",grid2:"#0ea5e9",wall:"#b8bac8",wallOpacity:.7,stripPrimary:"#3b82f6",stripSecondary:"#0ea5e9",desk:"#888898",monitorFrame:"#686878",chair:"#989aa8",particle1:"#3b82f6",particle2:"#0ea5e9",trace3:"#7c3aed",stars:"#b0b8d0",ambientColor:"#e0e4f0",ambientIntensity:10,dirColor:"#ffffff",dirIntensity:5,fillColor:"#e0e8ff",fillIntensity:3,pointLight1:"#3b82f6",pointLight2:"#0ea5e9",pointLight3:"#7c3aed",hemisphereUp:"#f0f4ff",hemisphereDown:"#c0c4d0",hemisphereIntensity:5,sconceColor:"#fff8f0",roomLight1:"#ffffff",roomLight2:"#e0e4f0",coffeeFloor:"#c0b0a0",coffeeAccent:"#b87333",coffeeFurniture:"#8a7050"},F3={background:"#f0e8d8",fogDensity:.005,floor:"#e0d8c8",roomFloor:"#d5cab8",borderGlow:"#ca8a04",grid1:"#ca8a04",grid2:"#a16207",wall:"#c0b49a",wallOpacity:.7,stripPrimary:"#ca8a04",stripSecondary:"#a16207",desk:"#8a7a60",monitorFrame:"#6a5a44",chair:"#9a8a70",particle1:"#ca9a20",particle2:"#a16207",trace3:"#b89040",stars:"#d0c4a8",ambientColor:"#f0e0c0",ambientIntensity:8,dirColor:"#fff8e8",dirIntensity:5,fillColor:"#ffe8c8",fillIntensity:3,pointLight1:"#ca8a04",pointLight2:"#a16207",pointLight3:"#d4a020",hemisphereUp:"#fff8e8",hemisphereDown:"#c8b898",hemisphereIntensity:4,sconceColor:"#ffe8b0",roomLight1:"#fff0d8",roomLight2:"#f0e0c8",coffeeFloor:"#c8b898",coffeeAccent:"#a16207",coffeeFurniture:"#8a6a38"},O3={"command-center":Mv,cyberpunk:w3,warm:P3,dracula:L3,solarized:U3,nord:D3,monokai:I3,light:N3,blonde:F3};function k3(n){return O3[n]??Mv}function Tv({center:n,size:r,glowColor:s}){const[l,,a]=n,i=.06,f=oe.useMemo(()=>new fr({color:s,emissive:s,emissiveIntensity:1.5,roughness:.2,transparent:!0,opacity:.35}),[s]);return Q.jsxs("group",{position:[l,.015,a],children:[Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,-r/2],material:f,children:Q.jsx("planeGeometry",{args:[r,i]})}),Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,r/2],material:f,children:Q.jsx("planeGeometry",{args:[r,i]})}),Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[-r/2,0,0],material:f,children:Q.jsx("planeGeometry",{args:[i,r]})}),Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[r/2,0,0],material:f,children:Q.jsx("planeGeometry",{args:[i,r]})})]})}function yv({x:n,z:r,rotation:s,seatX:l,seatZ:a,faceRot:i,screenColor:f,deskMat:u,monFrameMat:d,chairMat:p}){return Q.jsxs("group",{children:[Q.jsxs("group",{position:[n,0,r],rotation:[0,s,0],children:[Q.jsx("mesh",{position:[0,.7,0],material:u,castShadow:!0,receiveShadow:!0,children:Q.jsx("boxGeometry",{args:[1.5,.05,.65]})}),Q.jsx("mesh",{position:[-.72,.35,0],material:u,castShadow:!0,children:Q.jsx("boxGeometry",{args:[.04,.66,.58]})}),Q.jsx("mesh",{position:[.72,.35,0],material:u,castShadow:!0,children:Q.jsx("boxGeometry",{args:[.04,.66,.58]})}),Q.jsx("mesh",{position:[0,.92,-.2],material:d,children:Q.jsx("boxGeometry",{args:[.48,.32,.025]})}),Q.jsxs("mesh",{position:[0,.92,-.185],children:[Q.jsx("boxGeometry",{args:[.44,.28,.005]}),Q.jsx("meshStandardMaterial",{color:f,emissive:f,emissiveIntensity:.6,roughness:.3})]}),Q.jsx("mesh",{position:[0,.72,.12],material:u,children:Q.jsx("boxGeometry",{args:[.32,.012,.1]})})]}),Q.jsxs("group",{position:[l,0,a],rotation:[0,i,0],children:[Q.jsx("mesh",{position:[0,.4,0],material:p,children:Q.jsx("boxGeometry",{args:[.36,.03,.36]})}),Q.jsx("mesh",{position:[0,.57,-.155],material:p,children:Q.jsx("boxGeometry",{args:[.34,.28,.03]})}),Q.jsx("mesh",{position:[0,.19,0],material:p,children:Q.jsx("cylinderGeometry",{args:[.025,.025,.36,6]})}),Q.jsx("mesh",{position:[0,.013,0],material:p,children:Q.jsx("cylinderGeometry",{args:[.16,.16,.025,6]})})]})]})}function B3({room:n,deskOffset:r,theme:s}){const[l,,a]=n.center,i=KE*2,f=oe.useMemo(()=>new fr({color:s.wall,roughness:.2,metalness:.7,transparent:!0,opacity:s.wallOpacity,side:Sr}),[s.wall,s.wallOpacity]),u=oe.useMemo(()=>new fr({color:s.stripPrimary,emissive:s.stripPrimary,emissiveIntensity:2,roughness:.2}),[s.stripPrimary]),d=oe.useMemo(()=>new fr({color:s.stripSecondary,emissive:s.stripSecondary,emissiveIntensity:2,roughness:.2}),[s.stripSecondary]),p=oe.useMemo(()=>new fr({color:s.desk,roughness:.5,metalness:.6}),[s.desk]),h=oe.useMemo(()=>new fr({color:s.monitorFrame,roughness:.3,metalness:.8}),[s.monitorFrame]),v=oe.useMemo(()=>new fr({color:s.chair,roughness:.55,metalness:.5}),[s.chair]);oe.useEffect(()=>()=>{f.dispose(),u.dispose(),d.dispose(),p.dispose(),h.dispose(),v.dispose()},[f,u,d,p,h,v]);const S=n.stripColor===0?u:d,b=oe.useMemo(()=>qE([n]),[n]),A=n.bounds,P=(A.minX+A.maxX)/2,x=(A.minZ+A.maxZ)/2,_=mh/2,M=(i-mh)/2;function R({x:w,z:L,len:F}){return Q.jsxs("group",{children:[Q.jsx("mesh",{position:[w,oa/2,L],material:f,castShadow:!0,receiveShadow:!0,children:Q.jsx("boxGeometry",{args:[F,oa,ol]})}),Q.jsx("mesh",{position:[w,oa,L],material:S,children:Q.jsx("boxGeometry",{args:[F,.04,ol+.06]})})]})}function C({x:w,z:L,len:F}){return Q.jsxs("group",{children:[Q.jsx("mesh",{position:[w,oa/2,L],material:f,castShadow:!0,receiveShadow:!0,children:Q.jsx("boxGeometry",{args:[ol,oa,F]})}),Q.jsx("mesh",{position:[w,oa,L],material:S,children:Q.jsx("boxGeometry",{args:[ol+.06,.04,F]})})]})}return Q.jsxs("group",{children:[Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[l,.003,a],receiveShadow:!0,children:[Q.jsx("planeGeometry",{args:[i,i]}),Q.jsx("meshStandardMaterial",{color:s.roomFloor,roughness:.5,metalness:.2})]}),Q.jsx(Tv,{center:n.center,size:i,glowColor:s.borderGlow}),Q.jsx(R,{x:(A.minX+P-_)/2,z:A.minZ,len:M}),Q.jsx(R,{x:(P+_+A.maxX)/2,z:A.minZ,len:M}),Q.jsx(R,{x:(A.minX+P-_)/2,z:A.maxZ,len:M}),Q.jsx(R,{x:(P+_+A.maxX)/2,z:A.maxZ,len:M}),Q.jsx(C,{x:A.minX,z:x,len:i}),Q.jsx(C,{x:A.maxX,z:x,len:i}),b.map((w,L)=>Q.jsx(yv,{x:w.x,z:w.z,rotation:w.rotation,seatX:w.x+.65*Math.sin(w.rotation),seatZ:w.z+.65*Math.cos(w.rotation),faceRot:w.rotation+Math.PI,screenColor:fi[((r+L)*3+1)%fi.length],deskMat:p,monFrameMat:h,chairMat:v},L)),Q.jsx("pointLight",{color:s.roomLight1,intensity:8,distance:8,decay:1.5,position:[l,oa-.2,a],castShadow:!1})]})}function G3({rooms:n,theme:r}){const s=oe.useMemo(()=>new fr({color:r.desk,roughness:.5,metalness:.6}),[r.desk]),l=oe.useMemo(()=>new fr({color:r.monitorFrame,roughness:.3,metalness:.8}),[r.monitorFrame]),a=oe.useMemo(()=>new fr({color:r.chair,roughness:.55,metalness:.5}),[r.chair]),i=oe.useMemo(()=>kg(n,0).map(u=>({x:u.seatPos.x-.65*Math.sin(u.faceRot-Math.PI),z:u.seatPos.z-.65*Math.cos(u.faceRot-Math.PI),rotation:u.faceRot-Math.PI,seatX:u.seatPos.x,seatZ:u.seatPos.z,faceRot:u.faceRot})),[n]);return Q.jsx("group",{children:i.map((f,u)=>Q.jsx(yv,{x:f.x,z:f.z,rotation:f.rotation,seatX:f.seatX,seatZ:f.seatZ,faceRot:f.faceRot,screenColor:fi[(u*3+5)%fi.length],deskMat:s,monFrameMat:l,chairMat:a},u))})}function z3({x:n,z:r,mat:s}){return Q.jsxs("group",{children:[Q.jsx("mesh",{position:[n,.45,r],material:s,castShadow:!0,children:Q.jsx("cylinderGeometry",{args:[.4,.4,.04,10]})}),Q.jsx("mesh",{position:[n,.22,r],material:s,children:Q.jsx("cylinderGeometry",{args:[.05,.05,.44,6]})})]})}function H3({area:n,theme:r}){const[s,,l]=n.center,a=10,i=3,f=oe.useMemo(()=>new fr({color:r.coffeeFloor,roughness:.6,metalness:.2}),[r.coffeeFloor]),u=oe.useMemo(()=>new fr({color:r.coffeeFurniture,roughness:.5,metalness:.4}),[r.coffeeFurniture]),d=[];for(let p=0;p<2;p++)for(let h=0;h<2;h++)d.push([s+(h-.5)*i,l+(p-.5)*i]);return Q.jsxs("group",{children:[Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[s,.004,l],receiveShadow:!0,material:f,children:Q.jsx("planeGeometry",{args:[a,a]})}),Q.jsx(Tv,{center:n.center,size:a,glowColor:r.coffeeAccent}),d.map(([p,h],v)=>Q.jsx(z3,{x:p,z:h,mat:u},v)),Q.jsx("mesh",{position:[s,.5,l-a/2+.4],material:u,castShadow:!0,children:Q.jsx("boxGeometry",{args:[5,.9,.3]})}),Q.jsxs("mesh",{position:[s,.96,l-a/2+.4],children:[Q.jsx("boxGeometry",{args:[5.1,.03,.35]}),Q.jsx("meshStandardMaterial",{color:r.coffeeAccent,emissive:r.coffeeAccent,emissiveIntensity:.4,roughness:.3})]}),Q.jsx("pointLight",{color:r.coffeeAccent,intensity:6,distance:12,decay:1.5,position:[s,2.5,l],castShadow:!1})]})}function vm(n,r,s,l,a,i){if(n){for(let f=0;f<l;f++)r[f*3+1]+=s[f]*a,r[f*3+1]>10&&(r[f*3+1]=0,r[f*3]=(Math.random()-.5)*i,r[f*3+2]=(Math.random()-.5)*i);n.geometry.attributes.position.needsUpdate=!0}}function V3({floorSize:n,theme:r}){const s=oe.useRef(null),l=oe.useRef(null),{cyanPositions:a,cyanSpeeds:i,magentaPositions:f,magentaSpeeds:u}=oe.useMemo(()=>{const h=new Float32Array(180),v=new Float32Array(60),S=new Float32Array(120),b=new Float32Array(40);for(let A=0;A<60;A++)h[A*3]=(Math.random()-.5)*n,h[A*3+1]=Math.random()*10,h[A*3+2]=(Math.random()-.5)*n,v[A]=.2+Math.random()*.6;for(let A=0;A<40;A++)S[A*3]=(Math.random()-.5)*n,S[A*3+1]=Math.random()*10,S[A*3+2]=(Math.random()-.5)*n,b[A]=.2+Math.random()*.6;return{cyanPositions:h,cyanSpeeds:v,magentaPositions:S,magentaSpeeds:b}},[n]);return Qn((d,p)=>{const h=Math.min(p,.1);vm(s.current,a,i,60,h,n),vm(l.current,f,u,40,h,n)}),Q.jsxs("group",{children:[Q.jsxs("points",{ref:s,children:[Q.jsx("bufferGeometry",{children:Q.jsx("bufferAttribute",{attach:"attributes-position",args:[a,3]})}),Q.jsx("pointsMaterial",{color:r.particle1,size:.04,transparent:!0,opacity:.4,sizeAttenuation:!0})]}),Q.jsxs("points",{ref:l,children:[Q.jsx("bufferGeometry",{children:Q.jsx("bufferAttribute",{attach:"attributes-position",args:[f,3]})}),Q.jsx("pointsMaterial",{color:r.particle2,size:.04,transparent:!0,opacity:.4,sizeAttenuation:!0})]})]})}function W3({theme:n}){const r=oe.useMemo(()=>{const l=new Float32Array(600);for(let a=0;a<200;a++)l[a*3]=(Math.random()-.5)*50,l[a*3+1]=Math.random()*25+6,l[a*3+2]=(Math.random()-.5)*50;return l},[]);return Q.jsxs("points",{children:[Q.jsx("bufferGeometry",{children:Q.jsx("bufferAttribute",{attach:"attributes-position",args:[r,3]})}),Q.jsx("pointsMaterial",{color:n.stars,size:.05,transparent:!0,opacity:.4,sizeAttenuation:!0})]})}function j3({theme:n}){return Q.jsxs("group",{children:[Q.jsx("ambientLight",{color:n.ambientColor,intensity:n.ambientIntensity}),Q.jsx("directionalLight",{color:n.dirColor,intensity:n.dirIntensity,position:[8,20,6],castShadow:!0,"shadow-camera-left":-18,"shadow-camera-right":18,"shadow-camera-top":18,"shadow-camera-bottom":-18,"shadow-camera-near":1,"shadow-camera-far":50,"shadow-mapSize-width":2048,"shadow-mapSize-height":2048,"shadow-bias":-4e-4,"shadow-normalBias":.02}),Q.jsx("directionalLight",{color:n.fillColor,intensity:n.fillIntensity,position:[-6,15,-8]}),Q.jsx("pointLight",{color:n.pointLight1,intensity:6,distance:50,decay:1.5,position:[-10,8,-10]}),Q.jsx("pointLight",{color:n.pointLight2,intensity:5,distance:50,decay:1.5,position:[10,7,10]}),Q.jsx("hemisphereLight",{args:[n.hemisphereUp,n.hemisphereDown,n.hemisphereIntensity]})]})}function X3({rooms:n,casualAreas:r,theme:s}){const l=oe.useMemo(()=>YE(n),[n]);return Q.jsxs("group",{children:[Q.jsx(j3,{theme:s}),Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],receiveShadow:!0,children:[Q.jsx("planeGeometry",{args:[l,l]}),Q.jsx("meshStandardMaterial",{color:s.floor,roughness:.7,metalness:.3})]}),Q.jsx("gridHelper",{args:[l,Math.round(l/5),s.grid2,s.grid2],position:[0,.005,0]}),n.map((a,i)=>Q.jsx(B3,{room:a,deskOffset:i*2,theme:s},a.roomId)),Q.jsx(G3,{rooms:n,theme:s}),r?.map(a=>Q.jsx(H3,{area:a,theme:s},a.type)),Q.jsx(V3,{floorSize:l,theme:s}),Q.jsx(W3,{theme:s})]})}const Y3=Zl("#ffdd00"),q3=Zl("#aa66ff"),K3=Zl("#333344");function Z3(n){if(!n)return"default";const r=n.toLowerCase();return r==="read"||r==="grep"||r==="glob"||r==="notebookedit"?"read":r==="write"||r==="edit"?"write":r==="bash"?"bash":r==="webfetch"||r==="websearch"?"web":r==="task"?"task":"default"}function Q3({neonColor:n,state:r,scale:s=1,rotation:l=0,modelType:a="robot",seatedRef:i,cliBadge:f,currentTool:u=null,statusStartTime:d}){const p=oe.useMemo(()=>ZE(a),[a]),h=oe.useRef(null),v=oe.useRef(null),S=oe.useRef(null),b=oe.useRef(null),A=oe.useRef(null),P=oe.useRef(null),x=oe.useRef(null),_=oe.useRef(null),M=oe.useRef(null),R=oe.useRef(null),C=oe.useRef(null),w=oe.useMemo(()=>Math.random()*Math.PI*2,[]),L=oe.useRef(null),F=oe.useMemo(()=>Z3(u),[u]),{neonMat:G,edgeMat:T,isCustom:y}=oe.useMemo(()=>{const Y=fi.indexOf(n);return Y>=0?{neonMat:JE[Y],edgeMat:QE[Y],isCustom:!1}:{neonMat:Zl(n),edgeMat:$E(n),isCustom:!0}},[n]),V=oe.useMemo(()=>sl.clone(),[]),O=oe.useMemo(()=>T.clone(),[T]);oe.useEffect(()=>()=>{y&&(G.dispose(),T.dispose()),V.dispose(),O.dispose()},[G,T,y,V,O]);const k=oe.useRef(0);oe.useEffect(()=>{k.current=0},[r]),Qn((Y,ue)=>{const W=Ml.getState(),ie=W.animationSpeed/100,de=W.animationIntensity/100,Ge=performance.now()/1e3*ie,Qe=Math.min(ue,.1);if(!h.current)return;k.current+=Qe;const Ie=d?(Date.now()-d)/1e3:k.current;if(v.current){let Ue=.8+(Math.sin(Ge*6+w)+1)*.5*.4*de;if(r==="working"&&F==="web"){Ue=1+Math.sin(Ge*8+w)*.3*de;const j=v.current.material;j.emissiveIntensity=3+Math.sin(Ge*10)*1.5}v.current.scale.setScalar(Ue)}switch(S.current&&S.current.scale.setScalar(.9+Math.sin(Ge*3+w)*.12*de),r){case"idle":ee(Ge,Qe,w,de);break;case"thinking":Z(Ge,Qe,w,de);break;case"working":ne(Ge,Qe,w,de);break;case"waiting":ve(Ge,Qe,w,de);break;case"alert":fe(Ge,Qe,w,de,Ie);break;case"input":re(Ge,Qe,w,de);break;case"offline":B();break;case"connecting":$();break}});function H(){if(b.current){const Y=b.current.material;Y.emissive&&(Y.emissive.set("#000000"),Y.emissiveIntensity=0)}if(A.current){const Y=A.current.material;Y.color.set(n),Y.opacity=.5}S.current&&(S.current.material.emissiveIntensity=1),P.current&&r!=="alert"&&r!=="input"&&(P.current.material.emissiveIntensity=1.5)}function ee(Y,ue,W,ie){H();const de=h.current;de.position.y=Math.sin(Y*1.5+W)*.02*ie,x.current&&(x.current.rotation.x=Math.sin(Y*.8+W)*.08*ie),_.current&&(_.current.rotation.x=-Math.sin(Y*.8+W)*.08*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0),b.current&&(b.current.rotation.z=Math.sin(Y*.5+W)*.01*ie),A.current&&(A.current.rotation.z=Math.sin(Y*.5+W)*.01*ie)}function Z(Y,ue,W,ie){H();const de=h.current;i?.current?(de.position.y=Math.sin(Y*.8+W)*.005*ie,C.current&&(C.current.rotation.z=.12+Math.sin(Y*.5+W)*.04*ie,C.current.rotation.x=-.08),_.current&&(_.current.rotation.x=-1.1+Math.sin(Y*1.8+W)*.06*ie),x.current&&(x.current.rotation.x=-.3+Math.sin(Y*.5+W)*.02*ie),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2),b.current&&(b.current.rotation.z=Math.sin(Y*.4+W)*.008*ie),A.current&&(A.current.rotation.z=Math.sin(Y*.4+W)*.008*ie)):(de.position.y=Math.sin(Y*1.2+W)*.015*ie,C.current&&(C.current.rotation.z=Math.sin(Y*.6+W)*.08*ie,C.current.rotation.x=0),_.current&&(_.current.rotation.x=-.6+Math.sin(Y*1.5+W)*.05*ie),x.current&&(x.current.rotation.x=Math.sin(Y*.7+W)*.06*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0))}function ne(Y,ue,W,ie){switch(F){case"read":{C.current&&(C.current.rotation.y=Math.sin(Y*2.5+W)*.35*ie),C.current&&(C.current.rotation.z=0);const de=Math.sin(Y*6+W)*.03*ie;x.current&&(x.current.rotation.x=-.4+de),_.current&&(_.current.rotation.x=-.4-de);break}case"write":{const de=Math.sin(Y*14+W)*.07*ie;x.current&&(x.current.rotation.x=-.6+de),_.current&&(_.current.rotation.x=-.6-de),C.current&&(C.current.rotation.y=0,C.current.rotation.z=Math.sin(Y*.8+W)*.02*ie);break}case"bash":{_.current&&(_.current.rotation.x=-.9+Math.sin(Y*2+W)*.04*ie),x.current&&(x.current.rotation.x=-.3+Math.sin(Y*4+W)*.03*ie),C.current&&(C.current.rotation.y=0,C.current.rotation.z=0);break}case"task":{x.current&&(x.current.rotation.x=-.8+Math.sin(Y*1.5+W)*.05*ie),_.current&&(_.current.rotation.x=-.8-Math.sin(Y*1.5+W)*.05*ie),C.current&&(C.current.rotation.y=Math.sin(Y*.7+W)*.1*ie,C.current.rotation.z=0);break}default:{const de=Math.sin(Y*10+W)*.05*ie;x.current&&(x.current.rotation.x=-.5+de),_.current&&(_.current.rotation.x=-.5-de),C.current&&(C.current.rotation.y=0,C.current.rotation.z=0);break}}if(i?.current?(M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2)):(M.current&&(M.current.rotation.x=Math.sin(Y*8+W)*.3*ie),R.current&&(R.current.rotation.x=-Math.sin(Y*8+W)*.3*ie)),b.current&&(b.current.rotation.z=Math.sin(Y*.7+W)*.012*ie),A.current&&(A.current.rotation.z=Math.sin(Y*.7+W)*.012*ie),A.current){const de=A.current.material,Ge=1+Math.sin(Y*12+W)*.4+Math.sin(Y*23+W*2)*.3;de.opacity=Math.min(1,.6+Ge*.2)}if(S.current){const de=S.current.material;de.emissiveIntensity=2+Math.sin(Y*8+W)*1.2+Math.sin(Y*19)*.6}if(P.current){const de=P.current.material;de.emissiveIntensity=2+Math.sin(Y*10+W)*.8+Math.sin(Y*17)*.4}if(v.current){const de=v.current.material;de.emissiveIntensity=2.5+Math.sin(Y*15+W)*1.5;const Ge=1+Math.sin(Y*20+W)*.15*ie;v.current.scale.setScalar(Ge)}if(b.current){const de=b.current.material;de.emissive&&(de.emissive.set(n),de.emissiveIntensity=.15+Math.sin(Y*14+W)*.1)}}function ve(Y,ue,W,ie){H();const de=h.current;de.position.y=Math.abs(Math.sin(Y*2+W))*.06*ie,C.current&&(C.current.rotation.y=Math.sin(Y*.8+W)*.3*ie),x.current&&(x.current.rotation.x=Math.sin(Y*1.2+W)*.12*ie),_.current&&(_.current.rotation.x=-Math.sin(Y*1.2+W)*.12*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0)}function fe(Y,ue,W,ie,de){const Ge=h.current;if(P.current){const Qe=de>30?2.5:1.5,Ce=de>30?1.5:1,Ie=de>15?12:8,Ue=Qe+Math.sin(Y*Ie)*Ce;P.current.material.emissiveIntensity=Ue}if(i?.current)Ge.position.y=Math.abs(Math.sin(Y*6+W))*.03*ie,x.current&&(x.current.rotation.x=-1.2+Math.sin(Y*8+W)*.2*ie),_.current&&(_.current.rotation.x=-1.2-Math.sin(Y*8+W)*.2*ie),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2),C.current&&(C.current.rotation.z=Math.sin(Y*10+W)*.05*ie);else{Ge.position.y=Math.abs(Math.sin(Y*6+W))*.08*ie;const Qe=de>30?Math.sin(Y*16+W)*.03*ie:Math.sin(Y*12+W)*.02*ie;Ge.position.x=Qe,x.current&&(x.current.rotation.x=-1.2+Math.sin(Y*8+W)*.2*ie),_.current&&(_.current.rotation.x=-1.2-Math.sin(Y*8+W)*.2*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0),C.current&&(C.current.rotation.z=0)}}function re(Y,ue,W,ie){const de=h.current;if(P.current){const Ge=1.5+Math.sin(Y*4)*.8;P.current.material.emissiveIntensity=Ge}i?.current?(de.position.y=Math.sin(Y*1.5+W)*.01*ie,_.current&&(_.current.rotation.x=-1.5+Math.sin(Y*2+W)*.1*ie),x.current&&(x.current.rotation.x=-.3+Math.sin(Y*.5+W)*.03*ie),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2)):(de.position.y=Math.sin(Y*2+W)*.03*ie,de.rotation.y=l+Math.sin(Y*.8+W)*.06*ie,_.current&&(_.current.rotation.x=-1.5+Math.sin(Y*2+W)*.1*ie),x.current&&(x.current.rotation.x=Math.sin(Y*.7+W)*.05*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0))}function B(Y,ue){const W=h.current;if(P.current){const ie=P.current.material;ie.emissiveIntensity=Math.max(0,ie.emissiveIntensity-.02)}if(S.current){const ie=S.current.material;ie.emissiveIntensity=Math.max(0,ie.emissiveIntensity-.02)}i?.current?(W.position.y=0,C.current&&(C.current.rotation.x=.3,C.current.rotation.z=.1),x.current&&(x.current.rotation.x=.3),_.current&&(_.current.rotation.x=.3),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2),b.current&&(b.current.rotation.x=.15),A.current&&(A.current.rotation.x=.15)):(W.position.y=-.05,x.current&&(x.current.rotation.x=.1),_.current&&(_.current.rotation.x=.1),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0))}function $(Y,ue){L.current===null&&(L.current=performance.now()/1e3);const W=performance.now()/1e3-L.current,ie=Math.min(W/1.5,1),de=h.current,Ge=ie*s;de.scale.setScalar(Ge),de.position.y=(1-ie)*.5}oe.useEffect(()=>{r!=="connecting"&&(L.current=null)},[r]);const le=oe.useMemo(()=>r==="alert"?Y3:r==="input"?q3:r==="offline"?K3:G,[r,G]),he=p.head.geometry??kn.head,se=p.head.position??[0,1.32,0],q=p.torso.geometry??kn.torso,K=p.torso.position??[0,.87,0],pe=p.armL.geometry??kn.arm,Le=p.armL.position??[-.21,1.07,0],te=p.armR.geometry??kn.arm,we=p.armR.position??[.21,1.07,0],Ae=p.legL.geometry??kn.leg,_e=p.legL.position??[-.09,.54,0],Xe=p.legR.geometry??kn.leg,He=p.legR.position??[.09,.54,0],Oe=p.armL.visible!==!1,ke=p.armR.visible!==!1,N=p.legL.visible!==!1,Be=p.legR.visible!==!1,Ne=oe.useMemo(()=>new ua(he),[he]),Me=oe.useMemo(()=>new ua(q),[q]),Fe=oe.useMemo(()=>Oe?new ua(pe):null,[pe,Oe]),U=oe.useMemo(()=>ke?new ua(te):null,[te,ke]),E=oe.useMemo(()=>N?new ua(Ae):null,[Ae,N]),z=oe.useMemo(()=>Be?new ua(Xe):null,[Xe,Be]);return oe.useEffect(()=>()=>{Ne.dispose(),Me.dispose(),Fe?.dispose(),U?.dispose(),E?.dispose(),z?.dispose()},[Ne,Me,Fe,U,E,z]),Q.jsxs("group",{ref:h,position:[0,p.baseY,0],rotation:[0,l,0],scale:r==="connecting"?0:s,children:[Q.jsx("mesh",{ref:C,geometry:he,material:sl,position:se,castShadow:!0}),Q.jsx("lineSegments",{geometry:Ne,material:T,position:se}),Q.jsx("mesh",{ref:P,geometry:kn.visor,material:le,position:[se[0],se[1],(se[2]??0)+.13]}),Q.jsx("mesh",{geometry:kn.antenna,material:es,position:[.05,(se[1]??1.32)+.2,0]}),Q.jsx("mesh",{ref:v,geometry:kn.aTip,material:G,position:[.05,(se[1]??1.32)+.28,0]}),Q.jsx("mesh",{ref:b,geometry:q,material:V,position:K,castShadow:!0}),Q.jsx("lineSegments",{ref:A,geometry:Me,material:O,position:K}),Q.jsx("mesh",{ref:S,geometry:kn.core,material:G,position:[K[0]??0,(K[1]??.87)+.04,(K[2]??0)+.105]}),f&&Q.jsx(dd,{position:[K[0]??0,(K[1]??.87)-.06,(K[2]??0)+.12],follow:!0,lockX:!1,lockY:!1,lockZ:!1,children:Q.jsxs(xa,{fontSize:.14,color:f.color,anchorX:"center",anchorY:"middle",fontWeight:700,outlineWidth:.01,outlineColor:"#000000",children:[f.letter,Q.jsx("meshStandardMaterial",{color:f.color,emissive:f.color,emissiveIntensity:.8,toneMapped:!1})]})}),Oe&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:Le}),ke&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:we}),Oe&&Q.jsxs("group",{ref:x,position:Le,children:[Q.jsx("mesh",{geometry:pe,material:es,position:[0,-.18,0],castShadow:!0}),Fe&&Q.jsx("lineSegments",{geometry:Fe,material:T,position:[0,-.18,0]})]}),ke&&Q.jsxs("group",{ref:_,position:we,children:[Q.jsx("mesh",{geometry:te,material:es,position:[0,-.18,0],castShadow:!0}),U&&Q.jsx("lineSegments",{geometry:U,material:T,position:[0,-.18,0]})]}),N&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:_e,scale:.9}),Be&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:He,scale:.9}),N&&Q.jsxs("group",{ref:M,position:_e,children:[Q.jsx("mesh",{geometry:Ae,material:es,position:[0,-.19,0],castShadow:!0}),E&&Q.jsx("lineSegments",{geometry:E,material:T,position:[0,-.19,0]}),Q.jsx("mesh",{geometry:kn.foot,material:sl,position:[0,-.36,.012],castShadow:!0})]}),Be&&Q.jsxs("group",{ref:R,position:He,children:[Q.jsx("mesh",{geometry:Xe,material:es,position:[0,-.19,0],castShadow:!0}),z&&Q.jsx("lineSegments",{geometry:z,material:T,position:[0,-.19,0]}),Q.jsx("mesh",{geometry:kn.foot,material:sl,position:[0,-.36,.012],castShadow:!0})]})]})}const J3={idle:"#00ff88",prompting:"#00e5ff",working:"#ff9100",waiting:"#00e5ff",approval:"#ffdd00",input:"#aa66ff",ended:"#ff4444",connecting:"#888888"},$3=13,ew=.065,tw=1.8,nw=.14,rw=1.84,iw=.17,aw=.025,ow=-.82,sw=1.6,lw=.16,cw=.07,uw=.18,fw=2.1,dw=1.5;function pw({session:n,robotState:r,fontSize:s}){const l=s/$3,a=J3[n.status]??"#888888",i=r==="alert",f=r==="input",u=oe.useMemo(()=>{const T=n.title||n.projectName||"Unnamed";return T.length>28?T.slice(0,28)+"...":T},[n.title,n.projectName]),d=i?"APPROVAL NEEDED":f?"INPUT NEEDED":null,p=i?"#ffdd00":"#aa66ff",h=oe.useRef(1);Qn(()=>{d&&(h.current=.8+.2*Math.sin(performance.now()/500))});const v=n.label?` [${n.label.toUpperCase()}]`:"",S=ew*l,b=tw*l,A=nw*l,P=rw*l,x=iw*l,_=aw*l,M=ow*l,R=sw*l,C=lw*l,w=cw*l,L=uw*l,F=fw+(l-1)*.3,G=dw*l;return Q.jsxs(dd,{position:[0,F,0],follow:!0,lockX:!1,lockY:!1,lockZ:!1,children:[d&&Q.jsxs(Q.Fragment,{children:[Q.jsxs("mesh",{position:[0,L,-.01],children:[Q.jsx("planeGeometry",{args:[R,C]}),Q.jsx("meshBasicMaterial",{color:p,transparent:!0,opacity:h.current*.85})]}),Q.jsx(xa,{position:[0,L,0],fontSize:w,color:"#000000",anchorX:"center",anchorY:"middle",fontWeight:700,letterSpacing:.08,clipRect:[-R/2,-C/2,R/2,C/2],children:d})]}),Q.jsxs("mesh",{position:[0,0,-.01],children:[Q.jsx("planeGeometry",{args:[b,A]}),Q.jsx("meshBasicMaterial",{color:"#0a0616",transparent:!0,opacity:.8})]}),Q.jsxs("mesh",{position:[0,0,-.015],children:[Q.jsx("planeGeometry",{args:[P,x]}),Q.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.15})]}),Q.jsxs("mesh",{position:[M,0,0],children:[Q.jsx("circleGeometry",{args:[_,16]}),Q.jsx("meshBasicMaterial",{color:a})]}),Q.jsxs(xa,{position:[.02,0,0],fontSize:S,color:"#dddddd",anchorX:"center",anchorY:"middle",maxWidth:G,clipRect:[-b/2,-A/2,b/2,A/2],children:[u,v]})]})}const hw=oe.memo(pw,(n,r)=>n.session.sessionId===r.session.sessionId&&n.session.status===r.session.status&&n.session.title===r.session.title&&n.session.projectName===r.session.projectName&&n.session.label===r.session.label&&n.robotState===r.robotState&&n.isSelected===r.isSelected&&n.isHovered===r.isHovered&&n.fontSize===r.fontSize);function mw({dialogueRef:n}){const r=oe.useRef(0),s=oe.useRef(0),l=oe.useRef(!1),a=oe.useRef(0),i=oe.useRef(""),f=oe.useRef("#00e5ff"),u=oe.useRef(null),d=oe.useRef(null);Qn((v,S)=>{const b=n.current,A=performance.now()/1e3;b&&b.timestamp!==s.current&&(s.current=b.timestamp,i.current=b.text,f.current=b.borderColor,l.current=!1,b.persistent?a.current=0:a.current=A+5),a.current>0&&A>=a.current&&!l.current&&(l.current=!0);const P=l.current?0:s.current>0?1:0,x=4;r.current+=(P-r.current)*Math.min(1,x*S),r.current<.01&&(r.current=0),u.current&&(u.current.opacity=r.current*.92,u.current.visible=r.current>0),d.current&&(d.current.opacity=r.current*.6,d.current.visible=r.current>0,d.current.color.set(f.current))});const p=2.2,h=.22;return Q.jsxs(dd,{position:[0,2.8,0],follow:!0,lockX:!1,lockY:!1,lockZ:!1,children:[Q.jsxs("mesh",{position:[0,0,-.01],children:[Q.jsx("planeGeometry",{args:[p,h]}),Q.jsx("meshBasicMaterial",{ref:u,color:"#0a0616",transparent:!0,opacity:0,visible:!1,depthTest:!1})]}),Q.jsxs("mesh",{position:[0,0,-.005],children:[Q.jsx("planeGeometry",{args:[p+.04,h+.04]}),Q.jsx("meshBasicMaterial",{ref:d,color:"#00e5ff",transparent:!0,opacity:0,visible:!1,depthTest:!1})]}),Q.jsxs(xa,{fontSize:.09,color:"#ffffff",anchorX:"center",anchorY:"middle",maxWidth:2,outlineWidth:.005,outlineColor:"#000000",fillOpacity:0,outlineOpacity:0,children:[" ",Q.jsx(gw,{opacityRef:r,textRef:i})]})]})}function gw({opacityRef:n,textRef:r}){const s=oe.useRef(null);return oe.useEffect(()=>()=>{if(!s.current)return;s.current.parent?.dispose?.()},[]),Qn(()=>{if(!s.current)return;const l=s.current.parent;if(!l)return;const a=n.current,i=r.current;l.fillOpacity!==void 0&&(l.fillOpacity=a),l.outlineOpacity!==void 0&&(l.outlineOpacity=a*.5),l.text!==void 0&&l.text!==i&&(l.text=i,l.sync?.())}),Q.jsx("group",{ref:s})}function vw(n,r){return(n==="idle"||n==="waiting")&&(r==="working"||r==="thinking")?{color:"#ffdd00",count:20,pattern:"up",speed:2.5,gravity:-1.5,lifetime:1.5,size:.04}:(n==="working"||n==="thinking")&&r==="waiting"?{color:"#00ff88",count:20,pattern:"confetti",speed:1.2,gravity:2,lifetime:1.5,size:.05}:r==="alert"?{color:"#ffdd00",count:25,pattern:"ring",speed:2,gravity:0,lifetime:1.2,size:.06}:r==="input"?{color:"#aa66ff",count:20,pattern:"ring",speed:1.5,gravity:0,lifetime:1.2,size:.05}:r==="offline"?{color:"#666688",count:20,pattern:"down",speed:.8,gravity:.5,lifetime:2,size:.06}:null}const _w=25;function Sw(n){const{count:r,pattern:s,speed:l,gravity:a,lifetime:i,color:f,size:u}=n,d=new Float32Array(r*3),p=new Float32Array(r*3);for(let h=0;h<r;h++){const v=h*3;switch(d[v]=(Math.random()-.5)*.2,d[v+1]=.8+Math.random()*.3,d[v+2]=(Math.random()-.5)*.2,s){case"up":{p[v]=(Math.random()-.5)*l*.5,p[v+1]=l*(.6+Math.random()*.4),p[v+2]=(Math.random()-.5)*l*.5;break}case"down":{p[v]=(Math.random()-.5)*l*.4,p[v+1]=-l*(.3+Math.random()*.3),p[v+2]=(Math.random()-.5)*l*.4;break}case"ring":{const S=h/r*Math.PI*2+Math.random()*.3;p[v]=Math.cos(S)*l,p[v+1]=(Math.random()-.5)*l*.3,p[v+2]=Math.sin(S)*l,d[v+1]=.15;break}case"confetti":{p[v]=(Math.random()-.5)*l,p[v+1]=l*(.2+Math.random()*.3),p[v+2]=(Math.random()-.5)*l;break}}}return{positions:d,velocities:p,count:r,startTime:performance.now()/1e3,lifetime:i,gravity:a,color:new Ot(f),size:u}}function xw({state:n}){const r=oe.useRef(null),s=oe.useRef(null),l=oe.useRef(n),a=oe.useMemo(()=>{const f=new Ta,u=new Float32Array(_w*3);return f.setAttribute("position",new _a(u,3)),f.setDrawRange(0,0),f},[]),i=oe.useMemo(()=>new Pg({size:.05,transparent:!0,opacity:0,depthWrite:!1,blending:Ol,vertexColors:!1}),[]);return oe.useEffect(()=>()=>{i.dispose()},[i]),oe.useEffect(()=>{if(l.current!==n){const f=vw(l.current,n);f&&(s.current=Sw(f)),l.current=n}},[n]),Qn(()=>{const f=s.current;if(!f){a.setDrawRange(0,0),i.opacity=0;return}const p=(performance.now()/1e3-f.startTime)/f.lifetime;if(p>=1){s.current=null,a.setDrawRange(0,0),i.opacity=0;return}const h=a.getAttribute("position"),v=1/60;for(let S=0;S<f.count;S++){const b=S*3;f.positions[b]+=f.velocities[b]*v,f.positions[b+1]+=f.velocities[b+1]*v,f.positions[b+2]+=f.velocities[b+2]*v,f.velocities[b+1]-=f.gravity*v,f.velocities[b]*=.99,f.velocities[b+1]*=.99,f.velocities[b+2]*=.99,h.array[b]=f.positions[b],h.array[b+1]=f.positions[b+1],h.array[b+2]=f.positions[b+2]}h.needsUpdate=!0,a.setDrawRange(0,f.count),i.opacity=1-p*p,i.size=f.size*(1-p*.5),i.color.copy(f.color)}),Q.jsx("points",{ref:r,geometry:a,material:i})}const bw={idle:"idle",prompting:"thinking",working:"working",waiting:"waiting",approval:"alert",input:"input",ended:"offline",connecting:"connecting"};function Ew(n){return bw[n]??"idle"}const Mw={idle:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:1,casualTarget:"coffee"},thinking:{seekDesk:!0,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:1,casualTarget:null},working:{seekDesk:!0,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:1.2,casualTarget:null},waiting:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:.6,casualTarget:"coffee"},alert:{seekDesk:!1,wander:!1,urgentFlash:!0,visorColorOverride:"#ffdd00",speedMultiplier:0,casualTarget:null},input:{seekDesk:!1,wander:!1,urgentFlash:!0,visorColorOverride:"#aa66ff",speedMultiplier:0,casualTarget:null},offline:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:"#333344",speedMultiplier:0,casualTarget:null},connecting:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:0,casualTarget:null}};function Tw(n){return Mw[n]}const yw={claude:{letter:"C",color:"#00f0ff"},gemini:{letter:"G",color:"#4285f4"},codex:{letter:"X",color:"#10a37f"},openclaw:{letter:"O",color:"#ff6b2b"}};function Aw(n){const r=n1(n);return r?yw[r]:{letter:"?",color:"#aa66ff"}}const Pr=0,lo=1,uo=2,Lu=3;function Cw({session:n,workstations:r,wallRects:s,rooms:l,doors:a,sceneBound:i,onSelect:f,roomIndex:u,globalCharacterModel:d,fontSize:p}){const h=Ew(n.status),v=Tw(h),S=n.accentColor||fi[(n.colorIndex??0)%fi.length],b=oe.useRef(!1),A=!1,P=n.characterModel||d||"robot",x=y3().get(n.sessionId),_=x?x.posX:(Math.random()-.5)*4,M=x?x.posZ:(Math.random()-.5)*4,R=x?x.rotY:Math.random()*Math.PI*2,C=x?x.mode===lo?Pr:x.mode:Pr,w=x?x.deskIdx:-1,L=oe.useRef({mode:C,target:new ft(_,0,M),deskIdx:w,speed:1.2+Math.random()*.6,walkHz:6+Math.random()*2,phase:Math.random()*Math.PI*2,decisionTimer:2+Math.random()*4,posX:_,posY:0,posZ:M,rotY:R,waypoints:[],waypointIdx:0}),F=oe.useRef(0),G=oe.useRef(Math.floor(Math.random()*3)),T=oe.useRef(h),y=oe.useRef(u),V=oe.useRef(!1);function O(){return u!=null?gh(u):t1(i)}oe.useEffect(()=>{if(u!==y.current&&u!=null){const te=L.current;te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null,te.deskIdx=-1),te.posY=0;const we=gh(u);as(te,we,u,l,a),te.mode=Pr}y.current=u},[u,r,l,a]),oe.useEffect(()=>{const te=L.current,we=!V.current;if(we&&(V.current=!0,te.mode===uo&&te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=n.sessionId)),!we&&T.current===h)return;const Ae=["thinking","working"],_e=["idle","waiting"],Xe=!we&&Ae.includes(T.current),He=Ae.includes(h),Oe=!we&&_e.includes(T.current);if(Xe&&He){T.current=h;return}if(Xe&&!He&&(te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null,te.deskIdx=-1),te.posY=0,te.mode=Pr),Oe&&!_e.includes(h)&&(te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null,te.deskIdx=-1),te.posY=0,te.mode=Pr),He&&te.mode!==uo){const ke=u??bf(te.posX,te.posZ,l);let N;if(ke>=0?N=r.filter(Be=>Be.zone===ke&&!Be.occupantId):u==null?N=r.filter(Be=>Be.zone===-1&&!Be.occupantId):N=r.filter(Be=>!Be.occupantId),N.length>0){const Be=N[Math.floor(Math.random()*N.length)];Be.occupantId=n.sessionId,te.deskIdx=Be.idx,te.mode=lo,as(te,Be.seatPos,Be.zone,l,a)}else{const Be=ke>=0?r.filter(Ne=>Ne.zone===ke&&Ne.occupantId):r.filter(Ne=>Ne.zone===-1&&Ne.occupantId);if(Be.length>0){let Ne=Be[0],Me=1/0;for(const E of Be){const z=E.seatPos.x-te.posX,Y=E.seatPos.z-te.posZ,ue=z*z+Y*Y;ue<Me&&(Me=ue,Ne=E)}const Fe=.5,U=new ft(Ne.seatPos.x-Math.sin(Ne.faceRot)*Fe,0,Ne.seatPos.z-Math.cos(Ne.faceRot)*Fe);as(te,U,Ne.zone,l,a),te.mode=lo}else{te.mode=Pr;const Ne=O();te.waypoints=[Ne.clone()],te.waypointIdx=0,te.target.copy(Ne)}}}if((h==="alert"||h==="input")&&te.mode!==uo&&(te.mode=Lu),h==="idle"||h==="waiting"){const ke=r.filter(N=>N.zone===-2&&!N.occupantId);if(ke.length>0){const N=ke[Math.floor(Math.random()*ke.length)];N.occupantId=n.sessionId,te.deskIdx=N.idx,te.mode=lo,as(te,N.seatPos,N.zone,l,a)}else{te.mode=Pr,te.decisionTimer=2+Math.random()*4;const N=O();te.waypoints=[N.clone()],te.waypointIdx=0,te.target.copy(N)}}(h==="offline"||h==="connecting")&&(te.mode=Lu),T.current=h},[h,n.sessionId,r,u,l]),oe.useEffect(()=>()=>{const te=L.current;te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null)},[r]),Qn((te,we)=>{if(F.current++,(F.current+G.current)%3!==0)return;const Ae=Math.min(we*3,.15),_e=L.current;if(_e.mode===Lu||_e.mode===uo)return;const Xe=_e.target.x-_e.posX,He=_e.target.z-_e.posZ;if(Math.sqrt(Xe*Xe+He*He)<.5){if(_e.waypointIdx<_e.waypoints.length-1){_e.waypointIdx++,_e.target.copy(_e.waypoints[_e.waypointIdx]);return}if(_e.mode===lo){Rw(_e,r);return}const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U);return}let N=Math.atan2(Xe,He)-_e.rotY;N>Math.PI&&(N-=Math.PI*2),N<-Math.PI&&(N+=Math.PI*2),_e.rotY+=N*Math.min(1,10*Ae);const Be=_e.speed*v.speedMultiplier*Ae,Ne=_e.posX+Math.sin(_e.rotY)*Be,Me=_e.posZ+Math.cos(_e.rotY)*Be;if(!du(Ne,Me,s))_e.posX=Ne,_e.posZ=Me;else if(du(Ne,_e.posZ,s)){if(du(_e.posX,Me,s)){if(_e.mode===Pr){const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U)}}else if(_e.posZ=Me,_e.mode===Pr){const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U)}}else if(_e.posX=Ne,_e.mode===Pr){const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U)}_e.posX=Sf.clamp(_e.posX,-i,i),_e.posZ=Sf.clamp(_e.posZ,-i,i);const Fe=performance.now()/1e3*_e.walkHz+_e.phase;if(_e.posY=Math.abs(Math.sin(Fe*2))*.03,_e.mode===Pr&&v.seekDesk&&(_e.decisionTimer-=Ae,_e.decisionTimer<=0)){_e.decisionTimer=3+Math.random()*5;const U=u??bf(_e.posX,_e.posZ,l),E=U>=0?U:u==null?-1:-999;if(E!==-999){const z=r.filter(Y=>Y.zone===E&&!Y.occupantId);if(z.length>0){const Y=z[Math.floor(Math.random()*z.length)];Y.occupantId=n.sessionId,_e.deskIdx=Y.idx,_e.mode=lo,as(_e,Y.seatPos,Y.zone,l,a)}}}});const k=oe.useRef(null);Qn(()=>{const te=L.current;k.current&&k.current.position.set(te.posX,te.posY,te.posZ)});const H=oe.useCallback(te=>{te.stopPropagation(),f(n.sessionId)},[n.sessionId,f]),ee=oe.useCallback(()=>{b.current=!0},[]),Z=oe.useCallback(()=>{b.current=!1},[]),ne=.85+L.current.phase%.2,ve=oe.useRef(!1);Qn(()=>{ve.current=L.current.mode===uo});const fe=oe.useRef(0);Qn(()=>{if(fe.current++,(fe.current+G.current)%3!==0)return;const te=L.current;vs.set(n.sessionId,te.posX,te.posY+1,te.posZ),A3(n.sessionId,{x:te.posX,y:te.posY,z:te.posZ,rotY:te.rotY,mode:te.mode,deskIdx:te.deskIdx})}),oe.useEffect(()=>()=>{vs.delete(n.sessionId),R3(n.sessionId)},[n.sessionId]);const re=oe.useMemo(()=>Aw(n),[n.model,n.events]),B=n.accentColor?S:re.color,$=oe.useRef(Date.now()),le=oe.useRef(n.status);oe.useEffect(()=>{le.current!==n.status&&($.current=Date.now(),le.current=n.status)},[n.status]);const he=n.pendingTool||(n.toolLog&&n.toolLog.length>0?n.toolLog[n.toolLog.length-1].tool:null),se=oe.useRef(null),q=oe.useRef(n.status),K=oe.useRef(null),pe=oe.useRef(n.currentPrompt),Le=oe.useRef(0);return oe.useEffect(()=>{const te=q.current!==n.status,we=Date.now();if(we-Le.current<500&&!te)return;Le.current=we;const Ae=n.toolLog,_e=Ae&&Ae.length>0?Ae[Ae.length-1]:null,Xe=_e?`${_e.tool}-${_e.timestamp}`:null,He=Xe!==K.current,Oe=n.currentPrompt!==pe.current;if(te){const ke=q.current;if(n.status==="prompting"&&n.currentPrompt){const N=n.currentPrompt.length>60?n.currentPrompt.slice(0,60)+"...":n.currentPrompt;se.current={text:N,borderColor:"#00e5ff",persistent:!1,timestamp:Date.now()}}else n.status==="approval"?se.current={text:"AWAITING APPROVAL",borderColor:"#ffdd00",persistent:!0,timestamp:Date.now()}:n.status==="input"?se.current={text:"NEEDS INPUT",borderColor:"#aa66ff",persistent:!0,timestamp:Date.now()}:n.status==="waiting"?se.current={text:"Task complete!",borderColor:"#00ff88",persistent:!1,timestamp:Date.now()}:n.status==="ended"?se.current={text:"OFFLINE",borderColor:"#ff4444",persistent:!1,timestamp:Date.now()}:n.status==="idle"&&ke!=="idle"&&ke!=="connecting"&&(se.current={text:"ONLINE",borderColor:"#00ff88",persistent:!1,timestamp:Date.now()})}else if(He&&_e){const ke=_e.tool,N=_e.input||"";if(ke==="Read"||ke==="Grep"||ke==="Glob"){const Be=_m(N);se.current={text:`Reading ${Be}...`,borderColor:"rgba(0,229,255,0.6)",persistent:!1,timestamp:Date.now()}}else if(ke==="Bash"){const Be=N.length>40?N.slice(0,40)+"...":N;se.current={text:`$ ${Be}`,borderColor:"#ff9100",persistent:!1,timestamp:Date.now()}}else if(ke==="Edit"||ke==="Write"){const Be=_m(N);se.current={text:`Editing ${Be}...`,borderColor:"#00aaff",persistent:!1,timestamp:Date.now()}}else ke==="Task"?se.current={text:"Spawning agent...",borderColor:"#aa66ff",persistent:!1,timestamp:Date.now()}:(ke==="WebFetch"||ke==="WebSearch")&&(se.current={text:"Fetching...",borderColor:"#00e5ff",persistent:!1,timestamp:Date.now()})}else if(Oe&&n.status==="prompting"&&n.currentPrompt){const ke=n.currentPrompt.length>60?n.currentPrompt.slice(0,60)+"...":n.currentPrompt;se.current={text:ke,borderColor:"#00e5ff",persistent:!1,timestamp:Date.now()}}q.current=n.status,K.current=Xe,pe.current=n.currentPrompt},[n.status,n.toolLog,n.currentPrompt]),Q.jsxs("group",{ref:k,onClick:H,onPointerEnter:ee,onPointerLeave:Z,children:[Q.jsx(Q3,{neonColor:B,state:h,rotation:L.current.rotY,scale:ne,modelType:P,seatedRef:ve,cliBadge:re,currentTool:he,statusStartTime:$.current}),Q.jsx(xw,{state:h}),Q.jsx(hw,{session:n,robotState:h,isSelected:A,isHovered:b.current,fontSize:p}),Q.jsx(mw,{dialogueRef:se})]})}function as(n,r,s,l,a){const i=bf(n.posX,n.posZ,l),f=e1(n.posX,n.posZ,r,i,s,a);n.waypoints=f,n.waypointIdx=0,n.target.copy(f[0])}function Rw(n,r){const s=r[n.deskIdx];s&&(n.mode=uo,n.posX=s.seatPos.x,n.posY=-.12,n.posZ=s.seatPos.z,n.rotY=s.faceRot)}function _m(n){const r=n.match(/(?:\/[\w.-]+)+/);if(r){const s=r[0].split("/");return s[s.length-1]||r[0]}return n.length>20?n.slice(0,20)+"...":n||"file"}const ww=oe.memo(Cw,(n,r)=>n.session.sessionId===r.session.sessionId&&n.session.status===r.session.status&&n.session.accentColor===r.session.accentColor&&n.session.colorIndex===r.session.colorIndex&&n.session.model===r.session.model&&n.session.currentPrompt===r.session.currentPrompt&&n.session.pendingTool===r.session.pendingTool&&n.session.label===r.session.label&&n.session.characterModel===r.session.characterModel&&n.session.title===r.session.title&&n.session.projectName===r.session.projectName&&(n.session.toolLog?.length??0)===(r.session.toolLog?.length??0)&&(n.session.events?.length??0)===(r.session.events?.length??0)&&n.sceneBound===r.sceneBound&&n.onSelect===r.onSelect&&n.workstations===r.workstations&&n.wallRects===r.wallRects&&n.rooms===r.rooms&&n.doors===r.doors&&n.roomIndex===r.roomIndex&&n.globalCharacterModel===r.globalCharacterModel&&n.fontSize===r.fontSize),Sm=["#00f0ff","#ff00aa"],xm=["#007f88","#881155"];function Pw({rooms:n,casualAreas:r,storeRooms:s,sessions:l}){const a=s;return Q.jsxs(Q.Fragment,{children:[n.map(i=>{const[f,,u]=r1(i.index),d=a.find(S=>S.id===i.roomId),p=l?d?.sessionIds.filter(S=>{const b=l.get(S);return b&&b.status!=="ended"}).length??0:d?.sessionIds.length??0,h=Sm[i.stripColor]??Sm[0],v=xm[i.stripColor]??xm[0];return Q.jsxs("group",{children:[Q.jsx(xa,{position:[f,2.8,u],rotation:[-Math.PI/2,0,0],fontSize:.7,color:h,anchorX:"center",anchorY:"middle",letterSpacing:.15,outlineWidth:.02,outlineColor:"#000000",children:i.name.toUpperCase()}),Q.jsx(xa,{position:[f,2.8,u+1],rotation:[-Math.PI/2,0,0],fontSize:.35,color:v,anchorX:"center",anchorY:"middle",letterSpacing:.1,children:`${p} ${p===1?"UNIT":"UNITS"}`})]},i.roomId)}),r?.map(i=>{const[f,,u]=i.center;return Q.jsx(xa,{position:[f,2.8,u],rotation:[-Math.PI/2,0,0],fontSize:.8,color:"#ff9944",anchorX:"center",anchorY:"middle",letterSpacing:.15,outlineWidth:.02,outlineColor:"#000000",children:"COFFEE LOUNGE"},i.type)})]})}function Lw({parentId:n,childId:r,color:s}){const l=oe.useRef(0),a=oe.useMemo(()=>{const i=new Ta,f=new Float32Array(6);i.setAttribute("position",new _a(f,3));const u=new wg({color:s,dashSize:.3,gapSize:.2,transparent:!0,opacity:.3}),d=new Rg(i,u);return d.computeLineDistances(),d},[s]);return oe.useEffect(()=>()=>{a.geometry.dispose(),a.material.dispose()},[a]),Qn((i,f)=>{const u=vs.get(n),d=vs.get(r);if(!u||!d)return;const p=a.geometry.getAttribute("position"),h=p.array;h[0]=u.x,h[1]=u.y,h[2]=u.z,h[3]=d.x,h[4]=d.y,h[5]=d.z,p.needsUpdate=!0,l.current-=f*2;const v=a.material;v.dashOffset=l.current,a.computeLineDistances()}),Q.jsx("primitive",{object:a})}function Uw({connections:n}){return n.length===0?null:Q.jsx(Q.Fragment,{children:n.map(r=>Q.jsx(Lw,{parentId:r.parentId,childId:r.childId,color:r.color},`${r.parentId}-${r.childId}`))})}const bm=.04,Em=.1;function Dw({controlsRef:n}){const r=Lr(u=>u.camera),s=oe.useRef(new ft),l=oe.useRef(new ft),a=oe.useRef(!1),i=oe.useRef(0),f=oe.useRef(0);return Qn(()=>{if(!a.current&&(f.current++,f.current%6!==0))return;const{pendingTarget:u}=Hl.getState();if(u&&u.requestId!==i.current&&(i.current=u.requestId,s.current.set(...u.position),l.current.set(...u.lookAt),a.current=!0,f.current=0),!a.current||!n.current)return;const d=n.current;r.position.lerp(s.current,bm),d.target.lerp(l.current,bm),d.update();const p=r.position.distanceTo(s.current),h=d.target.distanceTo(l.current);p<Em&&h<Em&&(r.position.copy(s.current),d.target.copy(l.current),d.update(),a.current=!1,queueMicrotask(()=>Hl.getState().completeAnimation()))}),null}function Iw({background:n,fogDensity:r}){const{scene:s,gl:l}=Lr();return oe.useEffect(()=>{const a=new Ot(n);s.fog instanceof _f?(s.fog.color.copy(a),s.fog.density=r):s.fog=new _f(n,r),l.setClearColor(a)},[n,r,s,l]),null}const Nw=6,Fw=8,Ow=10;function kw({rooms:n,workstations:r,wallRects:s,sceneBound:l,casualAreas:a,doors:i,sessionArray:f,sessionsMap:u,connections:d,sceneBackground:p,sceneFogDensity:h,storeRooms:v,sceneTheme:S,globalCharacterModel:b,roomAssignments:A,fontSize:P}){const x=oe.useCallback(_=>{setTimeout(()=>{window.dispatchEvent(new CustomEvent("robot-select",{detail:{sessionId:_}}))},0)},[]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(Iw,{background:p,fogDensity:h}),Q.jsx(X3,{rooms:n,casualAreas:a,theme:S}),Q.jsx(Pw,{rooms:n,casualAreas:a,storeRooms:v,sessions:u}),f.map(_=>Q.jsx(ww,{session:_,workstations:r,wallRects:s,rooms:n,doors:i,sceneBound:l,onSelect:x,roomIndex:A.get(_.sessionId),globalCharacterModel:b,fontSize:P},_.sessionId)),Q.jsx(Uw,{connections:d})]})}const gl={width:34,height:34,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid rgba(0,240,255,0.2)",borderRadius:3,background:"rgba(10,6,22,0.7)",color:"rgba(0,240,255,0.6)",cursor:"pointer",fontSize:16,fontFamily:"'JetBrains Mono', monospace",fontWeight:700,lineHeight:1,padding:0,transition:"all 0.15s ease",backdropFilter:"blur(8px)"};function Bw({controlsRef:n}){const r=Hl(u=>u.flyTo),s=oe.useCallback(u=>{const d=n.current;if(!d)return;const p=d.object,h=d.target,v=p.position.x-h.x,S=p.position.y-h.y,b=p.position.z-h.z;r([h.x+v*u,h.y+S*u,h.z+b*u],[h.x,h.y,h.z])},[r,n]),l=oe.useCallback(()=>{r([18,16,18],[0,1,0])},[r]),a=oe.useCallback(()=>{const u=n.current;if(!u)return;const d=u.target;r([d.x+.01,d.y+30,d.z+.01],[d.x,d.y,d.z])},[r,n]),i=oe.useCallback(u=>{u.currentTarget.style.background="rgba(0,240,255,0.15)",u.currentTarget.style.borderColor="rgba(0,240,255,0.5)",u.currentTarget.style.color="#00f0ff"},[]),f=oe.useCallback(u=>{u.currentTarget.style.background="rgba(10,6,22,0.7)",u.currentTarget.style.borderColor="rgba(0,240,255,0.2)",u.currentTarget.style.color="rgba(0,240,255,0.6)"},[]);return Q.jsxs("div",{style:{position:"absolute",bottom:20,left:20,display:"flex",flexDirection:"column",gap:4,pointerEvents:"all",zIndex:11},children:[Q.jsx("button",{style:gl,onClick:()=>s(.65),onMouseEnter:i,onMouseLeave:f,title:"Zoom in",children:Q.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Q.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),Q.jsx("button",{style:gl,onClick:()=>s(1.5),onMouseEnter:i,onMouseLeave:f,title:"Zoom out",children:Q.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Q.jsx("path",{d:"M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),Q.jsx("div",{style:{height:4}}),Q.jsx("button",{style:gl,onClick:a,onMouseEnter:i,onMouseLeave:f,title:"Top-down view",children:Q.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[Q.jsx("circle",{cx:"8",cy:"6",r:"3",stroke:"currentColor",strokeWidth:"1.2"}),Q.jsx("path",{d:"M8 9v4M5 15h6",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}),Q.jsx("button",{style:gl,onClick:l,onMouseEnter:i,onMouseLeave:f,title:"Reset view",children:Q.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Q.jsx("path",{d:"M3 9l5-6 5 6M4 8.5V14h3v-3h2v3h3V8.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function Ww(){const n=vh(M=>M.sessions),r=vh(M=>M.selectSession),s=Hl(M=>M.flyTo),l=i1(M=>M.rooms),a=Ml(M=>M.themeName),i=Ml(M=>M.characterModel),f=Ml(M=>M.fontSize),u=oe.useMemo(()=>k3(a),[a]),d=oe.useRef(null);oe.useEffect(()=>{const M=R=>{const{sessionId:C}=R.detail;r(C);const w=vs.get(C);w&&s([w.x+Nw,w.y+Fw,w.z+Ow],[w.x,w.y+1,w.z])};return window.addEventListener("robot-select",M),()=>window.removeEventListener("robot-select",M)},[r,s]),oe.useEffect(()=>{const M=setInterval(()=>{const R=C3(),C=new Map;R.forEach((w,L)=>{C.set(L,{posX:w.x,posZ:w.z,rotY:w.rotY,mode:w.mode,deskIdx:w.deskIdx})}),T3(C)},2e3);return()=>clearInterval(M)},[]);const p=oe.useMemo(()=>a1(l),[l]),h=oe.useMemo(()=>o1(p),[p]),v=oe.useMemo(()=>{const M=s1(p),R=kg(p,M.length),C=l1(h,M.length+R.length);return[...M,...R,...C]},[p,h]),S=oe.useMemo(()=>[],[]),b=oe.useMemo(()=>c1(p),[p]),A=oe.useMemo(()=>u1(p),[p]),P=oe.useMemo(()=>[...n.values()].filter(M=>M.status!=="ended"&&M.source==="ssh"),[n]),x=oe.useMemo(()=>{const M=new Map;for(const R of n.values()){const C=l.find(w=>w.sessionIds.includes(R.sessionId));M.set(R.sessionId,C?.roomIndex)}return M},[n,l]),_=oe.useMemo(()=>{const M=[];for(const R of n.values()){if(!R.teamId||R.teamRole!=="member")continue;const C=R.teamId.replace(/^team-/,"");if(!C||C===R.sessionId)continue;const w=n.get(C);if(!w||w.status==="ended"||R.status==="ended")continue;const L=w.accentColor||fi[(w.colorIndex??0)%fi.length];M.push({parentId:C,childId:R.sessionId,color:L})}return M},[n]);return Q.jsxs("div",{style:{position:"absolute",inset:0},children:[Q.jsxs(SR,{shadows:!0,camera:{position:[18,16,18],fov:50,near:.1,far:150},gl:{antialias:!0,toneMapping:Ss,toneMappingExposure:1.2},style:{position:"absolute",inset:0,background:u.background},onCreated:({gl:M})=>{M.shadowMap.enabled=!0,M.shadowMap.type=ho},children:[Q.jsx("fogExp2",{attach:"fog",args:[u.background,u.fogDensity]}),Q.jsx(M3,{ref:d,enableDamping:!0,dampingFactor:.06,maxPolarAngle:Math.PI/2.1,minDistance:6,maxDistance:80,target:[0,1,0]}),Q.jsx(Dw,{controlsRef:d}),Q.jsx(oe.Suspense,{fallback:null,children:Q.jsx(kw,{rooms:p,workstations:v,wallRects:S,sceneBound:A,casualAreas:h,doors:b,sessionArray:P,sessionsMap:n,connections:_,sceneBackground:u.background,sceneFogDensity:u.fogDensity,storeRooms:l,sceneTheme:u,globalCharacterModel:i,roomAssignments:x,fontSize:f})})]}),Q.jsx(Bw,{controlsRef:d}),Q.jsx(f1,{sessionCount:P.length}),Q.jsx(d1,{})]})}export{Ww as default};
|
|
4186
|
+
`))),{vertexShader:s,fragmentShader:l}}});return r.transparent=!0,r.forceSinglePass=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}const pd=new ad({color:16777215,side:Sr,transparent:!0}),hm=8421504,mm=new ki,ml=new ft,wu=new ft,rs=[],S3=new ft,Pu="+x+y";function gm(n){return Array.isArray(n)?n[0]:n}let _v=()=>{const n=new br(new bo(1,1),pd);return _v=()=>n,n},Sv=()=>{const n=new br(new bo(1,1,32,1),pd);return Sv=()=>n,n};const x3={type:"syncstart"},b3={type:"synccomplete"},xv=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],E3=xv.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let bv=class extends br{constructor(){const r=new p3;super(r,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=hm,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Pu,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(r){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(r):(this._isSyncing=!0,this.dispatchEvent(x3),hv({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},s=>{this._isSyncing=!1,this._textRenderInfo=s,this.geometry.updateGlyphs(s.glyphBounds,s.glyphAtlasIndices,s.blockBounds,s.chunkedBounds,s.glyphColors);const l=this._queuedSyncs;l&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{l.forEach(a=>a&&a())})),this.dispatchEvent(b3),r&&r()})))}onBeforeRender(r,s,l,a,i,f){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(r){return _3(r)}get material(){let r=this._derivedMaterial;const s=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=pd.clone());if((!r||!r.isDerivedFrom(s))&&(r=this._derivedMaterial=this.createDerivedMaterial(s),s.addEventListener("dispose",function l(){s.removeEventListener("dispose",l),r.dispose()})),this.hasOutline()){let l=r._outlineMtl;return l||(l=r._outlineMtl=Object.create(r,{id:{value:r.id+.1}}),l.isTextOutlineMaterial=!0,l.depthWrite=!1,l.map=null,r.addEventListener("dispose",function a(){r.removeEventListener("dispose",a),l.dispose()})),[l,r]}else return r}set material(r){r&&r.isTroikaTextMaterial?(this._derivedMaterial=r,this._baseMaterial=r.baseMaterial):this._baseMaterial=r}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(r){this.geometry.detail=r}get curveRadius(){return this.geometry.curveRadius}set curveRadius(r){this.geometry.curveRadius=r}get customDepthMaterial(){return gm(this.material).getDepthMaterial()}set customDepthMaterial(r){}get customDistanceMaterial(){return gm(this.material).getDistanceMaterial()}set customDistanceMaterial(r){}_prepareForRender(r){const s=r.isTextOutlineMaterial,l=r.uniforms,a=this.textRenderInfo;if(a){const{sdfTexture:u,blockBounds:d}=a;l.uTroikaSDFTexture.value=u,l.uTroikaSDFTextureSize.value.set(u.image.width,u.image.height),l.uTroikaSDFGlyphSize.value=a.sdfGlyphSize,l.uTroikaSDFExponent.value=a.sdfExponent,l.uTroikaTotalBounds.value.fromArray(d),l.uTroikaUseGlyphColors.value=!s&&!!a.glyphColors;let p=0,h=0,v=0,S,b,A,P=0,x=0;if(s){let{outlineWidth:M,outlineOffsetX:R,outlineOffsetY:C,outlineBlur:w,outlineOpacity:L}=this;p=this._parsePercent(M)||0,h=Math.max(0,this._parsePercent(w)||0),S=L,P=this._parsePercent(R)||0,x=this._parsePercent(C)||0}else v=Math.max(0,this._parsePercent(this.strokeWidth)||0),v&&(A=this.strokeColor,l.uTroikaStrokeColor.value.set(A??hm),b=this.strokeOpacity,b==null&&(b=1)),S=this.fillOpacity;l.uTroikaEdgeOffset.value=p,l.uTroikaPositionOffset.value.set(P,x),l.uTroikaBlurRadius.value=h,l.uTroikaStrokeWidth.value=v,l.uTroikaStrokeOpacity.value=b,l.uTroikaFillOpacity.value=S??1,l.uTroikaCurveRadius.value=this.curveRadius||0;let _=this.clipRect;if(_&&Array.isArray(_)&&_.length===4)l.uTroikaClipRect.value.fromArray(_);else{const M=(this.fontSize||.1)*100;l.uTroikaClipRect.value.set(d[0]-M,d[1]-M,d[2]+M,d[3]+M)}this.geometry.applyClipRect(l.uTroikaClipRect.value)}l.uTroikaSDFDebug.value=!!this.debugSDF,r.polygonOffset=!!this.depthOffset,r.polygonOffsetFactor=r.polygonOffsetUnits=this.depthOffset||0;const i=s?this.outlineColor||0:this.color;if(i==null)delete r.color;else{const u=r.hasOwnProperty("color")?r.color:r.color=new Ot;(i!==u._input||typeof i=="object")&&u.set(u._input=i)}let f=this.orientation||Pu;if(f!==r._orientation){let u=l.uTroikaOrient.value;f=f.replace(/[^-+xyz]/g,"");let d=f!==Pu&&f.match(/^([-+])([xyz])([-+])([xyz])$/);if(d){let[,p,h,v,S]=d;ml.set(0,0,0)[h]=p==="-"?1:-1,wu.set(0,0,0)[S]=v==="-"?-1:1,mm.lookAt(S3,ml.cross(wu),wu),u.setFromMatrix4(mm)}else u.identity();r._orientation=f}}_parsePercent(r){if(typeof r=="string"){let s=r.match(/^(-?[\d.]+)%$/),l=s?parseFloat(s[1]):NaN;r=(isNaN(l)?0:l/100)*this.fontSize}return r}localPositionToTextCoords(r,s=new kt){s.copy(r);const l=this.curveRadius;return l&&(s.x=Math.atan2(r.x,Math.abs(l)-Math.abs(r.z))*Math.abs(l)),s}worldPositionToTextCoords(r,s=new kt){return ml.copy(r),this.localPositionToTextCoords(this.worldToLocal(ml),s)}raycast(r,s){const{textRenderInfo:l,curveRadius:a}=this;if(l){const i=l.blockBounds,f=a?Sv():_v(),u=f.geometry,{position:d,uv:p}=u.attributes;for(let h=0;h<p.count;h++){let v=i[0]+p.getX(h)*(i[2]-i[0]);const S=i[1]+p.getY(h)*(i[3]-i[1]);let b=0;a&&(b=a-Math.cos(v/a)*a,v=Math.sin(v/a)*a),d.setXYZ(h,v,S,b)}u.boundingSphere=this.geometry.boundingSphere,u.boundingBox=this.geometry.boundingBox,f.matrixWorld=this.matrixWorld,f.material.side=this.material.side,rs.length=0,f.raycast(r,rs);for(let h=0;h<rs.length;h++)rs[h].object=this,s.push(rs[h])}}copy(r){const s=this.geometry;return super.copy(r),this.geometry=s,E3.forEach(l=>{this[l]=r[l]}),this}clone(){return new this.constructor().copy(this)}};xv.forEach(n=>{const r="_private_"+n;Object.defineProperty(bv.prototype,n,{get(){return this[r]},set(s){s!==this[r]&&(this[r]=s,this._needsSync=!0)}})});new sd;new Ot;const xa=oe.forwardRef(({sdfGlyphSize:n=64,anchorX:r="center",anchorY:s="middle",font:l,fontSize:a=1,children:i,characters:f,onSync:u,...d},p)=>{const h=Lr(({invalidate:A})=>A),[v]=oe.useState(()=>new bv),[S,b]=oe.useMemo(()=>{const A=[];let P="";return oe.Children.forEach(i,x=>{typeof x=="string"||typeof x=="number"?P+=x:A.push(x)}),[A,P]},[i]);return _C(()=>new Promise(A=>o3({font:l,characters:f},A)),["troika-text",l,f]),oe.useLayoutEffect(()=>{v.sync(()=>{h(),u&&u(v)})}),oe.useEffect(()=>()=>v.dispose(),[v]),oe.createElement("primitive",ld({object:v,ref:p,font:l,text:b,anchorX:r,anchorY:s,fontSize:a,sdfGlyphSize:n},d),S)}),M3=oe.forwardRef(({makeDefault:n,camera:r,regress:s,domElement:l,enableDamping:a=!0,keyEvents:i=!1,onChange:f,onStart:u,onEnd:d,...p},h)=>{const v=Lr(L=>L.invalidate),S=Lr(L=>L.camera),b=Lr(L=>L.gl),A=Lr(L=>L.events),P=Lr(L=>L.setEvents),x=Lr(L=>L.set),_=Lr(L=>L.get),M=Lr(L=>L.performance),R=r||S,C=l||A.connected||b.domElement,w=oe.useMemo(()=>new CR(R),[R]);return Qn(()=>{w.enabled&&w.update()},-1),oe.useEffect(()=>(i&&w.connect(i===!0?C:i),w.connect(C),()=>{w.dispose()}),[i,C,s,w,v]),oe.useEffect(()=>{const L=T=>{v(),s&&M.regress(),f&&f(T)},F=T=>{u&&u(T)},G=T=>{d&&d(T)};return w.addEventListener("change",L),w.addEventListener("start",F),w.addEventListener("end",G),()=>{w.removeEventListener("start",F),w.removeEventListener("end",G),w.removeEventListener("change",L)}},[f,u,d,w,v,P]),oe.useEffect(()=>{if(n){const L=_().controls;return x({controls:w}),()=>x({controls:L})}},[n,w]),oe.createElement("primitive",ld({ref:h,object:w,enableDamping:a},p))}),Ev="cyberdrome-robot-positions";function T3(n){const r={};n.forEach((s,l)=>{r[l]=s});try{sessionStorage.setItem(Ev,JSON.stringify(r))}catch{}}function y3(){const n=new Map;try{const r=sessionStorage.getItem(Ev);if(!r)return n;const s=JSON.parse(r);for(const[l,a]of Object.entries(s))n.set(l,a)}catch{}return n}const is=new Map,vs={set(n,r,s,l){const a=is.get(n);a?(a.x=r,a.y=s,a.z=l):is.set(n,{x:r,y:s,z:l})},get(n){return is.get(n)},delete(n){is.delete(n)},has(n){return is.has(n)}},hd=new Map;function A3(n,r){hd.set(n,r)}function C3(){return hd}function R3(n){hd.delete(n)}const Mv={background:"#0e0c1a",fogDensity:.008,floor:"#1a1830",roomFloor:"#2e2850",borderGlow:"#00f0ff",grid1:"#00f0ff",grid2:"#ff00aa",wall:"#282845",wallOpacity:.55,stripPrimary:"#00f0ff",stripSecondary:"#ff00aa",desk:"#1c1c30",monitorFrame:"#111120",chair:"#222238",particle1:"#00f0ff",particle2:"#ff00aa",trace3:"#a855f7",stars:"#bbaaee",ambientColor:"#3a3060",ambientIntensity:5,dirColor:"#d8caf0",dirIntensity:3.5,fillColor:"#a0b8e0",fillIntensity:1.5,pointLight1:"#00f0ff",pointLight2:"#ff00aa",pointLight3:"#8866ff",hemisphereUp:"#4a3a6e",hemisphereDown:"#1a1428",hemisphereIntensity:2,sconceColor:"#f0e8d0",roomLight1:"#f0e8d0",roomLight2:"#d8d0e8",coffeeFloor:"#2a2018",coffeeAccent:"#d4882a",coffeeFurniture:"#5a3a20"},w3={background:"#0d0221",fogDensity:.01,floor:"#150530",roomFloor:"#2a0a50",borderGlow:"#ff00ff",grid1:"#ff00ff",grid2:"#00ffff",wall:"#1e0840",wallOpacity:.6,stripPrimary:"#ff00ff",stripSecondary:"#00ffff",desk:"#1a0838",monitorFrame:"#0f0520",chair:"#200a40",particle1:"#ff00ff",particle2:"#00ffff",trace3:"#ff6b00",stars:"#dd88ff",ambientColor:"#2a1050",ambientIntensity:4,dirColor:"#e0b0ff",dirIntensity:3,fillColor:"#80c0ff",fillIntensity:1.5,pointLight1:"#ff00ff",pointLight2:"#00ffff",pointLight3:"#ff6b00",hemisphereUp:"#3a1060",hemisphereDown:"#100520",hemisphereIntensity:2,sconceColor:"#e0c0ff",roomLight1:"#e0c0ff",roomLight2:"#c0e0ff",coffeeFloor:"#200818",coffeeAccent:"#ff8820",coffeeFurniture:"#4a2010"},P3={background:"#f5ede0",fogDensity:.005,floor:"#e8ddd0",roomFloor:"#ddd0c0",borderGlow:"#d97706",grid1:"#d97706",grid2:"#b87333",wall:"#c8b8a0",wallOpacity:.7,stripPrimary:"#d97706",stripSecondary:"#b87333",desk:"#8b7355",monitorFrame:"#6b5540",chair:"#9a8468",particle1:"#d9a040",particle2:"#b87333",trace3:"#c2860c",stars:"#d4c4a8",ambientColor:"#f0e0c0",ambientIntensity:8,dirColor:"#fff5e0",dirIntensity:5,fillColor:"#ffe8c0",fillIntensity:3,pointLight1:"#d97706",pointLight2:"#b87333",pointLight3:"#e8a020",hemisphereUp:"#fff8f0",hemisphereDown:"#d0c0a0",hemisphereIntensity:4,sconceColor:"#ffe0a0",roomLight1:"#fff0d0",roomLight2:"#f0e0c0",coffeeFloor:"#c8b898",coffeeAccent:"#b87333",coffeeFurniture:"#8a6a40"},L3={background:"#282a36",fogDensity:.008,floor:"#1e1f2e",roomFloor:"#343648",borderGlow:"#bd93f9",grid1:"#bd93f9",grid2:"#50fa7b",wall:"#383a4e",wallOpacity:.6,stripPrimary:"#bd93f9",stripSecondary:"#50fa7b",desk:"#2a2c3e",monitorFrame:"#1a1c2e",chair:"#303248",particle1:"#bd93f9",particle2:"#50fa7b",trace3:"#ff79c6",stars:"#c8b8e8",ambientColor:"#44475a",ambientIntensity:5,dirColor:"#f8f8f2",dirIntensity:3,fillColor:"#c8c0e0",fillIntensity:1.5,pointLight1:"#bd93f9",pointLight2:"#50fa7b",pointLight3:"#ff79c6",hemisphereUp:"#44475a",hemisphereDown:"#1a1c2e",hemisphereIntensity:2,sconceColor:"#f8f8f2",roomLight1:"#f8f8f2",roomLight2:"#ddd8f0",coffeeFloor:"#2a2030",coffeeAccent:"#ffb86c",coffeeFurniture:"#4a3028"},U3={background:"#002b36",fogDensity:.008,floor:"#073642",roomFloor:"#0a4050",borderGlow:"#2aa198",grid1:"#2aa198",grid2:"#cb4b16",wall:"#0c4a58",wallOpacity:.6,stripPrimary:"#2aa198",stripSecondary:"#cb4b16",desk:"#073038",monitorFrame:"#042028",chair:"#0a3840",particle1:"#2aa198",particle2:"#cb4b16",trace3:"#b58900",stars:"#839496",ambientColor:"#1a4050",ambientIntensity:5,dirColor:"#eee8d5",dirIntensity:3,fillColor:"#93a1a1",fillIntensity:1.5,pointLight1:"#2aa198",pointLight2:"#cb4b16",pointLight3:"#b58900",hemisphereUp:"#2a5a68",hemisphereDown:"#002028",hemisphereIntensity:2,sconceColor:"#eee8d5",roomLight1:"#eee8d5",roomLight2:"#93a1a1",coffeeFloor:"#0a2828",coffeeAccent:"#cb4b16",coffeeFurniture:"#3a2818"},D3={background:"#2e3440",fogDensity:.008,floor:"#252b38",roomFloor:"#3b4252",borderGlow:"#88c0d0",grid1:"#88c0d0",grid2:"#d08770",wall:"#3b4252",wallOpacity:.6,stripPrimary:"#88c0d0",stripSecondary:"#d08770",desk:"#2e3440",monitorFrame:"#1e2430",chair:"#343c4c",particle1:"#88c0d0",particle2:"#d08770",trace3:"#b48ead",stars:"#81a1c1",ambientColor:"#3b4252",ambientIntensity:5,dirColor:"#eceff4",dirIntensity:3,fillColor:"#d8dee9",fillIntensity:1.5,pointLight1:"#88c0d0",pointLight2:"#d08770",pointLight3:"#b48ead",hemisphereUp:"#4c566a",hemisphereDown:"#2e3440",hemisphereIntensity:2,sconceColor:"#eceff4",roomLight1:"#eceff4",roomLight2:"#d8dee9",coffeeFloor:"#2a2228",coffeeAccent:"#d08770",coffeeFurniture:"#4a3030"},I3={background:"#272822",fogDensity:.008,floor:"#1e1f1a",roomFloor:"#3e3d32",borderGlow:"#66d9ef",grid1:"#66d9ef",grid2:"#f92672",wall:"#3e3d32",wallOpacity:.6,stripPrimary:"#66d9ef",stripSecondary:"#f92672",desk:"#2a2a20",monitorFrame:"#1a1a14",chair:"#32322a",particle1:"#66d9ef",particle2:"#f92672",trace3:"#a6e22e",stars:"#a0a090",ambientColor:"#3e3d32",ambientIntensity:5,dirColor:"#f8f8f2",dirIntensity:3,fillColor:"#c8c8b8",fillIntensity:1.5,pointLight1:"#66d9ef",pointLight2:"#f92672",pointLight3:"#a6e22e",hemisphereUp:"#4e4d40",hemisphereDown:"#1e1f1a",hemisphereIntensity:2,sconceColor:"#f8f8f2",roomLight1:"#f8f8f2",roomLight2:"#d8d8c8",coffeeFloor:"#2a2018",coffeeAccent:"#f92672",coffeeFurniture:"#4a2a18"},N3={background:"#e8eaef",fogDensity:.004,floor:"#d8dae0",roomFloor:"#c8cad5",borderGlow:"#3b82f6",grid1:"#3b82f6",grid2:"#0ea5e9",wall:"#b8bac8",wallOpacity:.7,stripPrimary:"#3b82f6",stripSecondary:"#0ea5e9",desk:"#888898",monitorFrame:"#686878",chair:"#989aa8",particle1:"#3b82f6",particle2:"#0ea5e9",trace3:"#7c3aed",stars:"#b0b8d0",ambientColor:"#e0e4f0",ambientIntensity:10,dirColor:"#ffffff",dirIntensity:5,fillColor:"#e0e8ff",fillIntensity:3,pointLight1:"#3b82f6",pointLight2:"#0ea5e9",pointLight3:"#7c3aed",hemisphereUp:"#f0f4ff",hemisphereDown:"#c0c4d0",hemisphereIntensity:5,sconceColor:"#fff8f0",roomLight1:"#ffffff",roomLight2:"#e0e4f0",coffeeFloor:"#c0b0a0",coffeeAccent:"#b87333",coffeeFurniture:"#8a7050"},F3={background:"#f0e8d8",fogDensity:.005,floor:"#e0d8c8",roomFloor:"#d5cab8",borderGlow:"#ca8a04",grid1:"#ca8a04",grid2:"#a16207",wall:"#c0b49a",wallOpacity:.7,stripPrimary:"#ca8a04",stripSecondary:"#a16207",desk:"#8a7a60",monitorFrame:"#6a5a44",chair:"#9a8a70",particle1:"#ca9a20",particle2:"#a16207",trace3:"#b89040",stars:"#d0c4a8",ambientColor:"#f0e0c0",ambientIntensity:8,dirColor:"#fff8e8",dirIntensity:5,fillColor:"#ffe8c8",fillIntensity:3,pointLight1:"#ca8a04",pointLight2:"#a16207",pointLight3:"#d4a020",hemisphereUp:"#fff8e8",hemisphereDown:"#c8b898",hemisphereIntensity:4,sconceColor:"#ffe8b0",roomLight1:"#fff0d8",roomLight2:"#f0e0c8",coffeeFloor:"#c8b898",coffeeAccent:"#a16207",coffeeFurniture:"#8a6a38"},O3={"command-center":Mv,cyberpunk:w3,warm:P3,dracula:L3,solarized:U3,nord:D3,monokai:I3,light:N3,blonde:F3};function k3(n){return O3[n]??Mv}function Tv({center:n,size:r,glowColor:s}){const[l,,a]=n,i=.06,f=oe.useMemo(()=>new fr({color:s,emissive:s,emissiveIntensity:1.5,roughness:.2,transparent:!0,opacity:.35}),[s]);return Q.jsxs("group",{position:[l,.015,a],children:[Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,-r/2],material:f,children:Q.jsx("planeGeometry",{args:[r,i]})}),Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,r/2],material:f,children:Q.jsx("planeGeometry",{args:[r,i]})}),Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[-r/2,0,0],material:f,children:Q.jsx("planeGeometry",{args:[i,r]})}),Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[r/2,0,0],material:f,children:Q.jsx("planeGeometry",{args:[i,r]})})]})}function yv({x:n,z:r,rotation:s,seatX:l,seatZ:a,faceRot:i,screenColor:f,deskMat:u,monFrameMat:d,chairMat:p}){return Q.jsxs("group",{children:[Q.jsxs("group",{position:[n,0,r],rotation:[0,s,0],children:[Q.jsx("mesh",{position:[0,.7,0],material:u,castShadow:!0,receiveShadow:!0,children:Q.jsx("boxGeometry",{args:[1.5,.05,.65]})}),Q.jsx("mesh",{position:[-.72,.35,0],material:u,castShadow:!0,children:Q.jsx("boxGeometry",{args:[.04,.66,.58]})}),Q.jsx("mesh",{position:[.72,.35,0],material:u,castShadow:!0,children:Q.jsx("boxGeometry",{args:[.04,.66,.58]})}),Q.jsx("mesh",{position:[0,.92,-.2],material:d,children:Q.jsx("boxGeometry",{args:[.48,.32,.025]})}),Q.jsxs("mesh",{position:[0,.92,-.185],children:[Q.jsx("boxGeometry",{args:[.44,.28,.005]}),Q.jsx("meshStandardMaterial",{color:f,emissive:f,emissiveIntensity:.6,roughness:.3})]}),Q.jsx("mesh",{position:[0,.72,.12],material:u,children:Q.jsx("boxGeometry",{args:[.32,.012,.1]})})]}),Q.jsxs("group",{position:[l,0,a],rotation:[0,i,0],children:[Q.jsx("mesh",{position:[0,.4,0],material:p,children:Q.jsx("boxGeometry",{args:[.36,.03,.36]})}),Q.jsx("mesh",{position:[0,.57,-.155],material:p,children:Q.jsx("boxGeometry",{args:[.34,.28,.03]})}),Q.jsx("mesh",{position:[0,.19,0],material:p,children:Q.jsx("cylinderGeometry",{args:[.025,.025,.36,6]})}),Q.jsx("mesh",{position:[0,.013,0],material:p,children:Q.jsx("cylinderGeometry",{args:[.16,.16,.025,6]})})]})]})}function B3({room:n,deskOffset:r,theme:s}){const[l,,a]=n.center,i=KE*2,f=oe.useMemo(()=>new fr({color:s.wall,roughness:.2,metalness:.7,transparent:!0,opacity:s.wallOpacity,side:Sr}),[s.wall,s.wallOpacity]),u=oe.useMemo(()=>new fr({color:s.stripPrimary,emissive:s.stripPrimary,emissiveIntensity:2,roughness:.2}),[s.stripPrimary]),d=oe.useMemo(()=>new fr({color:s.stripSecondary,emissive:s.stripSecondary,emissiveIntensity:2,roughness:.2}),[s.stripSecondary]),p=oe.useMemo(()=>new fr({color:s.desk,roughness:.5,metalness:.6}),[s.desk]),h=oe.useMemo(()=>new fr({color:s.monitorFrame,roughness:.3,metalness:.8}),[s.monitorFrame]),v=oe.useMemo(()=>new fr({color:s.chair,roughness:.55,metalness:.5}),[s.chair]);oe.useEffect(()=>()=>{f.dispose(),u.dispose(),d.dispose(),p.dispose(),h.dispose(),v.dispose()},[f,u,d,p,h,v]);const S=n.stripColor===0?u:d,b=oe.useMemo(()=>qE([n]),[n]),A=n.bounds,P=(A.minX+A.maxX)/2,x=(A.minZ+A.maxZ)/2,_=mh/2,M=(i-mh)/2;function R({x:w,z:L,len:F}){return Q.jsxs("group",{children:[Q.jsx("mesh",{position:[w,oa/2,L],material:f,castShadow:!0,receiveShadow:!0,children:Q.jsx("boxGeometry",{args:[F,oa,ol]})}),Q.jsx("mesh",{position:[w,oa,L],material:S,children:Q.jsx("boxGeometry",{args:[F,.04,ol+.06]})})]})}function C({x:w,z:L,len:F}){return Q.jsxs("group",{children:[Q.jsx("mesh",{position:[w,oa/2,L],material:f,castShadow:!0,receiveShadow:!0,children:Q.jsx("boxGeometry",{args:[ol,oa,F]})}),Q.jsx("mesh",{position:[w,oa,L],material:S,children:Q.jsx("boxGeometry",{args:[ol+.06,.04,F]})})]})}return Q.jsxs("group",{children:[Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[l,.003,a],receiveShadow:!0,children:[Q.jsx("planeGeometry",{args:[i,i]}),Q.jsx("meshStandardMaterial",{color:s.roomFloor,roughness:.5,metalness:.2})]}),Q.jsx(Tv,{center:n.center,size:i,glowColor:s.borderGlow}),Q.jsx(R,{x:(A.minX+P-_)/2,z:A.minZ,len:M}),Q.jsx(R,{x:(P+_+A.maxX)/2,z:A.minZ,len:M}),Q.jsx(R,{x:(A.minX+P-_)/2,z:A.maxZ,len:M}),Q.jsx(R,{x:(P+_+A.maxX)/2,z:A.maxZ,len:M}),Q.jsx(C,{x:A.minX,z:x,len:i}),Q.jsx(C,{x:A.maxX,z:x,len:i}),b.map((w,L)=>Q.jsx(yv,{x:w.x,z:w.z,rotation:w.rotation,seatX:w.x+.65*Math.sin(w.rotation),seatZ:w.z+.65*Math.cos(w.rotation),faceRot:w.rotation+Math.PI,screenColor:fi[((r+L)*3+1)%fi.length],deskMat:p,monFrameMat:h,chairMat:v},L)),Q.jsx("pointLight",{color:s.roomLight1,intensity:8,distance:8,decay:1.5,position:[l,oa-.2,a],castShadow:!1})]})}function G3({rooms:n,theme:r}){const s=oe.useMemo(()=>new fr({color:r.desk,roughness:.5,metalness:.6}),[r.desk]),l=oe.useMemo(()=>new fr({color:r.monitorFrame,roughness:.3,metalness:.8}),[r.monitorFrame]),a=oe.useMemo(()=>new fr({color:r.chair,roughness:.55,metalness:.5}),[r.chair]),i=oe.useMemo(()=>kg(n,0).map(u=>({x:u.seatPos.x-.65*Math.sin(u.faceRot-Math.PI),z:u.seatPos.z-.65*Math.cos(u.faceRot-Math.PI),rotation:u.faceRot-Math.PI,seatX:u.seatPos.x,seatZ:u.seatPos.z,faceRot:u.faceRot})),[n]);return Q.jsx("group",{children:i.map((f,u)=>Q.jsx(yv,{x:f.x,z:f.z,rotation:f.rotation,seatX:f.seatX,seatZ:f.seatZ,faceRot:f.faceRot,screenColor:fi[(u*3+5)%fi.length],deskMat:s,monFrameMat:l,chairMat:a},u))})}function z3({x:n,z:r,mat:s}){return Q.jsxs("group",{children:[Q.jsx("mesh",{position:[n,.45,r],material:s,castShadow:!0,children:Q.jsx("cylinderGeometry",{args:[.4,.4,.04,10]})}),Q.jsx("mesh",{position:[n,.22,r],material:s,children:Q.jsx("cylinderGeometry",{args:[.05,.05,.44,6]})})]})}function H3({area:n,theme:r}){const[s,,l]=n.center,a=10,i=3,f=oe.useMemo(()=>new fr({color:r.coffeeFloor,roughness:.6,metalness:.2}),[r.coffeeFloor]),u=oe.useMemo(()=>new fr({color:r.coffeeFurniture,roughness:.5,metalness:.4}),[r.coffeeFurniture]),d=[];for(let p=0;p<2;p++)for(let h=0;h<2;h++)d.push([s+(h-.5)*i,l+(p-.5)*i]);return Q.jsxs("group",{children:[Q.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[s,.004,l],receiveShadow:!0,material:f,children:Q.jsx("planeGeometry",{args:[a,a]})}),Q.jsx(Tv,{center:n.center,size:a,glowColor:r.coffeeAccent}),d.map(([p,h],v)=>Q.jsx(z3,{x:p,z:h,mat:u},v)),Q.jsx("mesh",{position:[s,.5,l-a/2+.4],material:u,castShadow:!0,children:Q.jsx("boxGeometry",{args:[5,.9,.3]})}),Q.jsxs("mesh",{position:[s,.96,l-a/2+.4],children:[Q.jsx("boxGeometry",{args:[5.1,.03,.35]}),Q.jsx("meshStandardMaterial",{color:r.coffeeAccent,emissive:r.coffeeAccent,emissiveIntensity:.4,roughness:.3})]}),Q.jsx("pointLight",{color:r.coffeeAccent,intensity:6,distance:12,decay:1.5,position:[s,2.5,l],castShadow:!1})]})}function vm(n,r,s,l,a,i){if(n){for(let f=0;f<l;f++)r[f*3+1]+=s[f]*a,r[f*3+1]>10&&(r[f*3+1]=0,r[f*3]=(Math.random()-.5)*i,r[f*3+2]=(Math.random()-.5)*i);n.geometry.attributes.position.needsUpdate=!0}}function V3({floorSize:n,theme:r}){const s=oe.useRef(null),l=oe.useRef(null),{cyanPositions:a,cyanSpeeds:i,magentaPositions:f,magentaSpeeds:u}=oe.useMemo(()=>{const h=new Float32Array(180),v=new Float32Array(60),S=new Float32Array(120),b=new Float32Array(40);for(let A=0;A<60;A++)h[A*3]=(Math.random()-.5)*n,h[A*3+1]=Math.random()*10,h[A*3+2]=(Math.random()-.5)*n,v[A]=.2+Math.random()*.6;for(let A=0;A<40;A++)S[A*3]=(Math.random()-.5)*n,S[A*3+1]=Math.random()*10,S[A*3+2]=(Math.random()-.5)*n,b[A]=.2+Math.random()*.6;return{cyanPositions:h,cyanSpeeds:v,magentaPositions:S,magentaSpeeds:b}},[n]);return Qn((d,p)=>{const h=Math.min(p,.1);vm(s.current,a,i,60,h,n),vm(l.current,f,u,40,h,n)}),Q.jsxs("group",{children:[Q.jsxs("points",{ref:s,children:[Q.jsx("bufferGeometry",{children:Q.jsx("bufferAttribute",{attach:"attributes-position",args:[a,3]})}),Q.jsx("pointsMaterial",{color:r.particle1,size:.04,transparent:!0,opacity:.4,sizeAttenuation:!0})]}),Q.jsxs("points",{ref:l,children:[Q.jsx("bufferGeometry",{children:Q.jsx("bufferAttribute",{attach:"attributes-position",args:[f,3]})}),Q.jsx("pointsMaterial",{color:r.particle2,size:.04,transparent:!0,opacity:.4,sizeAttenuation:!0})]})]})}function W3({theme:n}){const r=oe.useMemo(()=>{const l=new Float32Array(600);for(let a=0;a<200;a++)l[a*3]=(Math.random()-.5)*50,l[a*3+1]=Math.random()*25+6,l[a*3+2]=(Math.random()-.5)*50;return l},[]);return Q.jsxs("points",{children:[Q.jsx("bufferGeometry",{children:Q.jsx("bufferAttribute",{attach:"attributes-position",args:[r,3]})}),Q.jsx("pointsMaterial",{color:n.stars,size:.05,transparent:!0,opacity:.4,sizeAttenuation:!0})]})}function j3({theme:n}){return Q.jsxs("group",{children:[Q.jsx("ambientLight",{color:n.ambientColor,intensity:n.ambientIntensity}),Q.jsx("directionalLight",{color:n.dirColor,intensity:n.dirIntensity,position:[8,20,6],castShadow:!0,"shadow-camera-left":-18,"shadow-camera-right":18,"shadow-camera-top":18,"shadow-camera-bottom":-18,"shadow-camera-near":1,"shadow-camera-far":50,"shadow-mapSize-width":2048,"shadow-mapSize-height":2048,"shadow-bias":-4e-4,"shadow-normalBias":.02}),Q.jsx("directionalLight",{color:n.fillColor,intensity:n.fillIntensity,position:[-6,15,-8]}),Q.jsx("pointLight",{color:n.pointLight1,intensity:6,distance:50,decay:1.5,position:[-10,8,-10]}),Q.jsx("pointLight",{color:n.pointLight2,intensity:5,distance:50,decay:1.5,position:[10,7,10]}),Q.jsx("hemisphereLight",{args:[n.hemisphereUp,n.hemisphereDown,n.hemisphereIntensity]})]})}function X3({rooms:n,casualAreas:r,theme:s}){const l=oe.useMemo(()=>YE(n),[n]);return Q.jsxs("group",{children:[Q.jsx(j3,{theme:s}),Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],receiveShadow:!0,children:[Q.jsx("planeGeometry",{args:[l,l]}),Q.jsx("meshStandardMaterial",{color:s.floor,roughness:.7,metalness:.3})]}),Q.jsx("gridHelper",{args:[l,Math.round(l/5),s.grid2,s.grid2],position:[0,.005,0]}),n.map((a,i)=>Q.jsx(B3,{room:a,deskOffset:i*2,theme:s},a.roomId)),Q.jsx(G3,{rooms:n,theme:s}),r?.map(a=>Q.jsx(H3,{area:a,theme:s},a.type)),Q.jsx(V3,{floorSize:l,theme:s}),Q.jsx(W3,{theme:s})]})}const Y3=Zl("#ffdd00"),q3=Zl("#aa66ff"),K3=Zl("#333344");function Z3(n){if(!n)return"default";const r=n.toLowerCase();return r==="read"||r==="grep"||r==="glob"||r==="notebookedit"?"read":r==="write"||r==="edit"?"write":r==="bash"?"bash":r==="webfetch"||r==="websearch"?"web":r==="task"?"task":"default"}function Q3({neonColor:n,state:r,scale:s=1,rotation:l=0,modelType:a="robot",seatedRef:i,cliBadge:f,currentTool:u=null,statusStartTime:d}){const p=oe.useMemo(()=>ZE(a),[a]),h=oe.useRef(null),v=oe.useRef(null),S=oe.useRef(null),b=oe.useRef(null),A=oe.useRef(null),P=oe.useRef(null),x=oe.useRef(null),_=oe.useRef(null),M=oe.useRef(null),R=oe.useRef(null),C=oe.useRef(null),w=oe.useMemo(()=>Math.random()*Math.PI*2,[]),L=oe.useRef(null),F=oe.useMemo(()=>Z3(u),[u]),{neonMat:G,edgeMat:T,isCustom:y}=oe.useMemo(()=>{const Y=fi.indexOf(n);return Y>=0?{neonMat:JE[Y],edgeMat:QE[Y],isCustom:!1}:{neonMat:Zl(n),edgeMat:$E(n),isCustom:!0}},[n]),V=oe.useMemo(()=>sl.clone(),[]),O=oe.useMemo(()=>T.clone(),[T]);oe.useEffect(()=>()=>{y&&(G.dispose(),T.dispose()),V.dispose(),O.dispose()},[G,T,y,V,O]);const k=oe.useRef(0);oe.useEffect(()=>{k.current=0},[r]),Qn((Y,ue)=>{const W=Ml.getState(),ie=W.animationSpeed/100,de=W.animationIntensity/100,Ge=performance.now()/1e3*ie,Qe=Math.min(ue,.1);if(!h.current)return;k.current+=Qe;const Ie=d?(Date.now()-d)/1e3:k.current;if(v.current){let Ue=.8+(Math.sin(Ge*6+w)+1)*.5*.4*de;if(r==="working"&&F==="web"){Ue=1+Math.sin(Ge*8+w)*.3*de;const j=v.current.material;j.emissiveIntensity=3+Math.sin(Ge*10)*1.5}v.current.scale.setScalar(Ue)}switch(S.current&&S.current.scale.setScalar(.9+Math.sin(Ge*3+w)*.12*de),r){case"idle":ee(Ge,Qe,w,de);break;case"thinking":Z(Ge,Qe,w,de);break;case"working":ne(Ge,Qe,w,de);break;case"waiting":ve(Ge,Qe,w,de);break;case"alert":fe(Ge,Qe,w,de,Ie);break;case"input":re(Ge,Qe,w,de);break;case"offline":B();break;case"connecting":$();break}});function H(){if(b.current){const Y=b.current.material;Y.emissive&&(Y.emissive.set("#000000"),Y.emissiveIntensity=0)}if(A.current){const Y=A.current.material;Y.color.set(n),Y.opacity=.5}S.current&&(S.current.material.emissiveIntensity=1),P.current&&r!=="alert"&&r!=="input"&&(P.current.material.emissiveIntensity=1.5)}function ee(Y,ue,W,ie){H();const de=h.current;de.position.y=Math.sin(Y*1.5+W)*.02*ie,x.current&&(x.current.rotation.x=Math.sin(Y*.8+W)*.08*ie),_.current&&(_.current.rotation.x=-Math.sin(Y*.8+W)*.08*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0),b.current&&(b.current.rotation.z=Math.sin(Y*.5+W)*.01*ie),A.current&&(A.current.rotation.z=Math.sin(Y*.5+W)*.01*ie)}function Z(Y,ue,W,ie){H();const de=h.current;i?.current?(de.position.y=Math.sin(Y*.8+W)*.005*ie,C.current&&(C.current.rotation.z=.12+Math.sin(Y*.5+W)*.04*ie,C.current.rotation.x=-.08),_.current&&(_.current.rotation.x=-1.1+Math.sin(Y*1.8+W)*.06*ie),x.current&&(x.current.rotation.x=-.3+Math.sin(Y*.5+W)*.02*ie),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2),b.current&&(b.current.rotation.z=Math.sin(Y*.4+W)*.008*ie),A.current&&(A.current.rotation.z=Math.sin(Y*.4+W)*.008*ie)):(de.position.y=Math.sin(Y*1.2+W)*.015*ie,C.current&&(C.current.rotation.z=Math.sin(Y*.6+W)*.08*ie,C.current.rotation.x=0),_.current&&(_.current.rotation.x=-.6+Math.sin(Y*1.5+W)*.05*ie),x.current&&(x.current.rotation.x=Math.sin(Y*.7+W)*.06*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0))}function ne(Y,ue,W,ie){switch(F){case"read":{C.current&&(C.current.rotation.y=Math.sin(Y*2.5+W)*.35*ie),C.current&&(C.current.rotation.z=0);const de=Math.sin(Y*6+W)*.03*ie;x.current&&(x.current.rotation.x=-.4+de),_.current&&(_.current.rotation.x=-.4-de);break}case"write":{const de=Math.sin(Y*14+W)*.07*ie;x.current&&(x.current.rotation.x=-.6+de),_.current&&(_.current.rotation.x=-.6-de),C.current&&(C.current.rotation.y=0,C.current.rotation.z=Math.sin(Y*.8+W)*.02*ie);break}case"bash":{_.current&&(_.current.rotation.x=-.9+Math.sin(Y*2+W)*.04*ie),x.current&&(x.current.rotation.x=-.3+Math.sin(Y*4+W)*.03*ie),C.current&&(C.current.rotation.y=0,C.current.rotation.z=0);break}case"task":{x.current&&(x.current.rotation.x=-.8+Math.sin(Y*1.5+W)*.05*ie),_.current&&(_.current.rotation.x=-.8-Math.sin(Y*1.5+W)*.05*ie),C.current&&(C.current.rotation.y=Math.sin(Y*.7+W)*.1*ie,C.current.rotation.z=0);break}default:{const de=Math.sin(Y*10+W)*.05*ie;x.current&&(x.current.rotation.x=-.5+de),_.current&&(_.current.rotation.x=-.5-de),C.current&&(C.current.rotation.y=0,C.current.rotation.z=0);break}}if(i?.current?(M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2)):(M.current&&(M.current.rotation.x=Math.sin(Y*8+W)*.3*ie),R.current&&(R.current.rotation.x=-Math.sin(Y*8+W)*.3*ie)),b.current&&(b.current.rotation.z=Math.sin(Y*.7+W)*.012*ie),A.current&&(A.current.rotation.z=Math.sin(Y*.7+W)*.012*ie),A.current){const de=A.current.material,Ge=1+Math.sin(Y*12+W)*.4+Math.sin(Y*23+W*2)*.3;de.opacity=Math.min(1,.6+Ge*.2)}if(S.current){const de=S.current.material;de.emissiveIntensity=2+Math.sin(Y*8+W)*1.2+Math.sin(Y*19)*.6}if(P.current){const de=P.current.material;de.emissiveIntensity=2+Math.sin(Y*10+W)*.8+Math.sin(Y*17)*.4}if(v.current){const de=v.current.material;de.emissiveIntensity=2.5+Math.sin(Y*15+W)*1.5;const Ge=1+Math.sin(Y*20+W)*.15*ie;v.current.scale.setScalar(Ge)}if(b.current){const de=b.current.material;de.emissive&&(de.emissive.set(n),de.emissiveIntensity=.15+Math.sin(Y*14+W)*.1)}}function ve(Y,ue,W,ie){H();const de=h.current;de.position.y=Math.abs(Math.sin(Y*2+W))*.06*ie,C.current&&(C.current.rotation.y=Math.sin(Y*.8+W)*.3*ie),x.current&&(x.current.rotation.x=Math.sin(Y*1.2+W)*.12*ie),_.current&&(_.current.rotation.x=-Math.sin(Y*1.2+W)*.12*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0)}function fe(Y,ue,W,ie,de){const Ge=h.current;if(P.current){const Qe=de>30?2.5:1.5,Ce=de>30?1.5:1,Ie=de>15?12:8,Ue=Qe+Math.sin(Y*Ie)*Ce;P.current.material.emissiveIntensity=Ue}if(i?.current)Ge.position.y=Math.abs(Math.sin(Y*6+W))*.03*ie,x.current&&(x.current.rotation.x=-1.2+Math.sin(Y*8+W)*.2*ie),_.current&&(_.current.rotation.x=-1.2-Math.sin(Y*8+W)*.2*ie),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2),C.current&&(C.current.rotation.z=Math.sin(Y*10+W)*.05*ie);else{Ge.position.y=Math.abs(Math.sin(Y*6+W))*.08*ie;const Qe=de>30?Math.sin(Y*16+W)*.03*ie:Math.sin(Y*12+W)*.02*ie;Ge.position.x=Qe,x.current&&(x.current.rotation.x=-1.2+Math.sin(Y*8+W)*.2*ie),_.current&&(_.current.rotation.x=-1.2-Math.sin(Y*8+W)*.2*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0),C.current&&(C.current.rotation.z=0)}}function re(Y,ue,W,ie){const de=h.current;if(P.current){const Ge=1.5+Math.sin(Y*4)*.8;P.current.material.emissiveIntensity=Ge}i?.current?(de.position.y=Math.sin(Y*1.5+W)*.01*ie,_.current&&(_.current.rotation.x=-1.5+Math.sin(Y*2+W)*.1*ie),x.current&&(x.current.rotation.x=-.3+Math.sin(Y*.5+W)*.03*ie),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2)):(de.position.y=Math.sin(Y*2+W)*.03*ie,de.rotation.y=l+Math.sin(Y*.8+W)*.06*ie,_.current&&(_.current.rotation.x=-1.5+Math.sin(Y*2+W)*.1*ie),x.current&&(x.current.rotation.x=Math.sin(Y*.7+W)*.05*ie),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0))}function B(Y,ue){const W=h.current;if(P.current){const ie=P.current.material;ie.emissiveIntensity=Math.max(0,ie.emissiveIntensity-.02)}if(S.current){const ie=S.current.material;ie.emissiveIntensity=Math.max(0,ie.emissiveIntensity-.02)}i?.current?(W.position.y=0,C.current&&(C.current.rotation.x=.3,C.current.rotation.z=.1),x.current&&(x.current.rotation.x=.3),_.current&&(_.current.rotation.x=.3),M.current&&(M.current.rotation.x=1.2),R.current&&(R.current.rotation.x=1.2),b.current&&(b.current.rotation.x=.15),A.current&&(A.current.rotation.x=.15)):(W.position.y=-.05,x.current&&(x.current.rotation.x=.1),_.current&&(_.current.rotation.x=.1),M.current&&(M.current.rotation.x=0),R.current&&(R.current.rotation.x=0))}function $(Y,ue){L.current===null&&(L.current=performance.now()/1e3);const W=performance.now()/1e3-L.current,ie=Math.min(W/1.5,1),de=h.current,Ge=ie*s;de.scale.setScalar(Ge),de.position.y=(1-ie)*.5}oe.useEffect(()=>{r!=="connecting"&&(L.current=null)},[r]);const le=oe.useMemo(()=>r==="alert"?Y3:r==="input"?q3:r==="offline"?K3:G,[r,G]),he=p.head.geometry??kn.head,se=p.head.position??[0,1.32,0],q=p.torso.geometry??kn.torso,K=p.torso.position??[0,.87,0],pe=p.armL.geometry??kn.arm,Le=p.armL.position??[-.21,1.07,0],te=p.armR.geometry??kn.arm,we=p.armR.position??[.21,1.07,0],Ae=p.legL.geometry??kn.leg,_e=p.legL.position??[-.09,.54,0],Xe=p.legR.geometry??kn.leg,He=p.legR.position??[.09,.54,0],Oe=p.armL.visible!==!1,ke=p.armR.visible!==!1,N=p.legL.visible!==!1,Be=p.legR.visible!==!1,Ne=oe.useMemo(()=>new ua(he),[he]),Me=oe.useMemo(()=>new ua(q),[q]),Fe=oe.useMemo(()=>Oe?new ua(pe):null,[pe,Oe]),U=oe.useMemo(()=>ke?new ua(te):null,[te,ke]),E=oe.useMemo(()=>N?new ua(Ae):null,[Ae,N]),z=oe.useMemo(()=>Be?new ua(Xe):null,[Xe,Be]);return oe.useEffect(()=>()=>{Ne.dispose(),Me.dispose(),Fe?.dispose(),U?.dispose(),E?.dispose(),z?.dispose()},[Ne,Me,Fe,U,E,z]),Q.jsxs("group",{ref:h,position:[0,p.baseY,0],rotation:[0,l,0],scale:r==="connecting"?0:s,children:[Q.jsx("mesh",{ref:C,geometry:he,material:sl,position:se,castShadow:!0}),Q.jsx("lineSegments",{geometry:Ne,material:T,position:se}),Q.jsx("mesh",{ref:P,geometry:kn.visor,material:le,position:[se[0],se[1],(se[2]??0)+.13]}),Q.jsx("mesh",{geometry:kn.antenna,material:es,position:[.05,(se[1]??1.32)+.2,0]}),Q.jsx("mesh",{ref:v,geometry:kn.aTip,material:G,position:[.05,(se[1]??1.32)+.28,0]}),Q.jsx("mesh",{ref:b,geometry:q,material:V,position:K,castShadow:!0}),Q.jsx("lineSegments",{ref:A,geometry:Me,material:O,position:K}),Q.jsx("mesh",{ref:S,geometry:kn.core,material:G,position:[K[0]??0,(K[1]??.87)+.04,(K[2]??0)+.105]}),f&&Q.jsx(dd,{position:[K[0]??0,(K[1]??.87)-.06,(K[2]??0)+.12],follow:!0,lockX:!1,lockY:!1,lockZ:!1,children:Q.jsxs(xa,{fontSize:.14,color:f.color,anchorX:"center",anchorY:"middle",fontWeight:700,outlineWidth:.01,outlineColor:"#000000",children:[f.letter,Q.jsx("meshStandardMaterial",{color:f.color,emissive:f.color,emissiveIntensity:.8,toneMapped:!1})]})}),Oe&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:Le}),ke&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:we}),Oe&&Q.jsxs("group",{ref:x,position:Le,children:[Q.jsx("mesh",{geometry:pe,material:es,position:[0,-.18,0],castShadow:!0}),Fe&&Q.jsx("lineSegments",{geometry:Fe,material:T,position:[0,-.18,0]})]}),ke&&Q.jsxs("group",{ref:_,position:we,children:[Q.jsx("mesh",{geometry:te,material:es,position:[0,-.18,0],castShadow:!0}),U&&Q.jsx("lineSegments",{geometry:U,material:T,position:[0,-.18,0]})]}),N&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:_e,scale:.9}),Be&&Q.jsx("mesh",{geometry:kn.joint,material:G,position:He,scale:.9}),N&&Q.jsxs("group",{ref:M,position:_e,children:[Q.jsx("mesh",{geometry:Ae,material:es,position:[0,-.19,0],castShadow:!0}),E&&Q.jsx("lineSegments",{geometry:E,material:T,position:[0,-.19,0]}),Q.jsx("mesh",{geometry:kn.foot,material:sl,position:[0,-.36,.012],castShadow:!0})]}),Be&&Q.jsxs("group",{ref:R,position:He,children:[Q.jsx("mesh",{geometry:Xe,material:es,position:[0,-.19,0],castShadow:!0}),z&&Q.jsx("lineSegments",{geometry:z,material:T,position:[0,-.19,0]}),Q.jsx("mesh",{geometry:kn.foot,material:sl,position:[0,-.36,.012],castShadow:!0})]})]})}const J3={idle:"#00ff88",prompting:"#00e5ff",working:"#ff9100",waiting:"#00e5ff",approval:"#ffdd00",input:"#aa66ff",ended:"#ff4444",connecting:"#888888"},$3=13,ew=.065,tw=1.8,nw=.14,rw=1.84,iw=.17,aw=.025,ow=-.82,sw=1.6,lw=.16,cw=.07,uw=.18,fw=2.1,dw=1.5;function pw({session:n,robotState:r,fontSize:s}){const l=s/$3,a=J3[n.status]??"#888888",i=r==="alert",f=r==="input",u=oe.useMemo(()=>{const T=n.title||n.projectName||"Unnamed";return T.length>28?T.slice(0,28)+"...":T},[n.title,n.projectName]),d=i?"APPROVAL NEEDED":f?"INPUT NEEDED":null,p=i?"#ffdd00":"#aa66ff",h=oe.useRef(1);Qn(()=>{d&&(h.current=.8+.2*Math.sin(performance.now()/500))});const v=n.label?` [${n.label.toUpperCase()}]`:"",S=ew*l,b=tw*l,A=nw*l,P=rw*l,x=iw*l,_=aw*l,M=ow*l,R=sw*l,C=lw*l,w=cw*l,L=uw*l,F=fw+(l-1)*.3,G=dw*l;return Q.jsxs(dd,{position:[0,F,0],follow:!0,lockX:!1,lockY:!1,lockZ:!1,children:[d&&Q.jsxs(Q.Fragment,{children:[Q.jsxs("mesh",{position:[0,L,-.01],children:[Q.jsx("planeGeometry",{args:[R,C]}),Q.jsx("meshBasicMaterial",{color:p,transparent:!0,opacity:h.current*.85})]}),Q.jsx(xa,{position:[0,L,0],fontSize:w,color:"#000000",anchorX:"center",anchorY:"middle",fontWeight:700,letterSpacing:.08,clipRect:[-R/2,-C/2,R/2,C/2],children:d})]}),Q.jsxs("mesh",{position:[0,0,-.01],children:[Q.jsx("planeGeometry",{args:[b,A]}),Q.jsx("meshBasicMaterial",{color:"#0a0616",transparent:!0,opacity:.8})]}),Q.jsxs("mesh",{position:[0,0,-.015],children:[Q.jsx("planeGeometry",{args:[P,x]}),Q.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.15})]}),Q.jsxs("mesh",{position:[M,0,0],children:[Q.jsx("circleGeometry",{args:[_,16]}),Q.jsx("meshBasicMaterial",{color:a})]}),Q.jsxs(xa,{position:[.02,0,0],fontSize:S,color:"#dddddd",anchorX:"center",anchorY:"middle",maxWidth:G,clipRect:[-b/2,-A/2,b/2,A/2],children:[u,v]})]})}const hw=oe.memo(pw,(n,r)=>n.session.sessionId===r.session.sessionId&&n.session.status===r.session.status&&n.session.title===r.session.title&&n.session.projectName===r.session.projectName&&n.session.label===r.session.label&&n.robotState===r.robotState&&n.isSelected===r.isSelected&&n.isHovered===r.isHovered&&n.fontSize===r.fontSize);function mw({dialogueRef:n}){const r=oe.useRef(0),s=oe.useRef(0),l=oe.useRef(!1),a=oe.useRef(0),i=oe.useRef(""),f=oe.useRef("#00e5ff"),u=oe.useRef(null),d=oe.useRef(null);Qn((v,S)=>{const b=n.current,A=performance.now()/1e3;b&&b.timestamp!==s.current&&(s.current=b.timestamp,i.current=b.text,f.current=b.borderColor,l.current=!1,b.persistent?a.current=0:a.current=A+5),a.current>0&&A>=a.current&&!l.current&&(l.current=!0);const P=l.current?0:s.current>0?1:0,x=4;r.current+=(P-r.current)*Math.min(1,x*S),r.current<.01&&(r.current=0),u.current&&(u.current.opacity=r.current*.92,u.current.visible=r.current>0),d.current&&(d.current.opacity=r.current*.6,d.current.visible=r.current>0,d.current.color.set(f.current))});const p=2.2,h=.22;return Q.jsxs(dd,{position:[0,2.8,0],follow:!0,lockX:!1,lockY:!1,lockZ:!1,children:[Q.jsxs("mesh",{position:[0,0,-.01],children:[Q.jsx("planeGeometry",{args:[p,h]}),Q.jsx("meshBasicMaterial",{ref:u,color:"#0a0616",transparent:!0,opacity:0,visible:!1,depthTest:!1})]}),Q.jsxs("mesh",{position:[0,0,-.005],children:[Q.jsx("planeGeometry",{args:[p+.04,h+.04]}),Q.jsx("meshBasicMaterial",{ref:d,color:"#00e5ff",transparent:!0,opacity:0,visible:!1,depthTest:!1})]}),Q.jsxs(xa,{fontSize:.09,color:"#ffffff",anchorX:"center",anchorY:"middle",maxWidth:2,outlineWidth:.005,outlineColor:"#000000",fillOpacity:0,outlineOpacity:0,children:[" ",Q.jsx(gw,{opacityRef:r,textRef:i})]})]})}function gw({opacityRef:n,textRef:r}){const s=oe.useRef(null);return oe.useEffect(()=>()=>{if(!s.current)return;s.current.parent?.dispose?.()},[]),Qn(()=>{if(!s.current)return;const l=s.current.parent;if(!l)return;const a=n.current,i=r.current;l.fillOpacity!==void 0&&(l.fillOpacity=a),l.outlineOpacity!==void 0&&(l.outlineOpacity=a*.5),l.text!==void 0&&l.text!==i&&(l.text=i,l.sync?.())}),Q.jsx("group",{ref:s})}function vw(n,r){return(n==="idle"||n==="waiting")&&(r==="working"||r==="thinking")?{color:"#ffdd00",count:20,pattern:"up",speed:2.5,gravity:-1.5,lifetime:1.5,size:.04}:(n==="working"||n==="thinking")&&r==="waiting"?{color:"#00ff88",count:20,pattern:"confetti",speed:1.2,gravity:2,lifetime:1.5,size:.05}:r==="alert"?{color:"#ffdd00",count:25,pattern:"ring",speed:2,gravity:0,lifetime:1.2,size:.06}:r==="input"?{color:"#aa66ff",count:20,pattern:"ring",speed:1.5,gravity:0,lifetime:1.2,size:.05}:r==="offline"?{color:"#666688",count:20,pattern:"down",speed:.8,gravity:.5,lifetime:2,size:.06}:null}const _w=25;function Sw(n){const{count:r,pattern:s,speed:l,gravity:a,lifetime:i,color:f,size:u}=n,d=new Float32Array(r*3),p=new Float32Array(r*3);for(let h=0;h<r;h++){const v=h*3;switch(d[v]=(Math.random()-.5)*.2,d[v+1]=.8+Math.random()*.3,d[v+2]=(Math.random()-.5)*.2,s){case"up":{p[v]=(Math.random()-.5)*l*.5,p[v+1]=l*(.6+Math.random()*.4),p[v+2]=(Math.random()-.5)*l*.5;break}case"down":{p[v]=(Math.random()-.5)*l*.4,p[v+1]=-l*(.3+Math.random()*.3),p[v+2]=(Math.random()-.5)*l*.4;break}case"ring":{const S=h/r*Math.PI*2+Math.random()*.3;p[v]=Math.cos(S)*l,p[v+1]=(Math.random()-.5)*l*.3,p[v+2]=Math.sin(S)*l,d[v+1]=.15;break}case"confetti":{p[v]=(Math.random()-.5)*l,p[v+1]=l*(.2+Math.random()*.3),p[v+2]=(Math.random()-.5)*l;break}}}return{positions:d,velocities:p,count:r,startTime:performance.now()/1e3,lifetime:i,gravity:a,color:new Ot(f),size:u}}function xw({state:n}){const r=oe.useRef(null),s=oe.useRef(null),l=oe.useRef(n),a=oe.useMemo(()=>{const f=new Ta,u=new Float32Array(_w*3);return f.setAttribute("position",new _a(u,3)),f.setDrawRange(0,0),f},[]),i=oe.useMemo(()=>new Pg({size:.05,transparent:!0,opacity:0,depthWrite:!1,blending:Ol,vertexColors:!1}),[]);return oe.useEffect(()=>()=>{i.dispose()},[i]),oe.useEffect(()=>{if(l.current!==n){const f=vw(l.current,n);f&&(s.current=Sw(f)),l.current=n}},[n]),Qn(()=>{const f=s.current;if(!f){a.setDrawRange(0,0),i.opacity=0;return}const p=(performance.now()/1e3-f.startTime)/f.lifetime;if(p>=1){s.current=null,a.setDrawRange(0,0),i.opacity=0;return}const h=a.getAttribute("position"),v=1/60;for(let S=0;S<f.count;S++){const b=S*3;f.positions[b]+=f.velocities[b]*v,f.positions[b+1]+=f.velocities[b+1]*v,f.positions[b+2]+=f.velocities[b+2]*v,f.velocities[b+1]-=f.gravity*v,f.velocities[b]*=.99,f.velocities[b+1]*=.99,f.velocities[b+2]*=.99,h.array[b]=f.positions[b],h.array[b+1]=f.positions[b+1],h.array[b+2]=f.positions[b+2]}h.needsUpdate=!0,a.setDrawRange(0,f.count),i.opacity=1-p*p,i.size=f.size*(1-p*.5),i.color.copy(f.color)}),Q.jsx("points",{ref:r,geometry:a,material:i})}const bw={idle:"idle",prompting:"thinking",working:"working",waiting:"waiting",approval:"alert",input:"input",ended:"offline",connecting:"connecting"};function Ew(n){return bw[n]??"idle"}const Mw={idle:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:1,casualTarget:"coffee"},thinking:{seekDesk:!0,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:1,casualTarget:null},working:{seekDesk:!0,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:1.2,casualTarget:null},waiting:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:.6,casualTarget:"coffee"},alert:{seekDesk:!1,wander:!1,urgentFlash:!0,visorColorOverride:"#ffdd00",speedMultiplier:0,casualTarget:null},input:{seekDesk:!1,wander:!1,urgentFlash:!0,visorColorOverride:"#aa66ff",speedMultiplier:0,casualTarget:null},offline:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:"#333344",speedMultiplier:0,casualTarget:null},connecting:{seekDesk:!1,wander:!1,urgentFlash:!1,visorColorOverride:null,speedMultiplier:0,casualTarget:null}};function Tw(n){return Mw[n]}const yw={claude:{letter:"C",color:"#00f0ff"},gemini:{letter:"G",color:"#4285f4"},codex:{letter:"X",color:"#10a37f"},openclaw:{letter:"O",color:"#ff6b2b"}};function Aw(n){const r=n1(n);return r?yw[r]:{letter:"?",color:"#aa66ff"}}const Pr=0,lo=1,uo=2,Lu=3;function Cw({session:n,workstations:r,wallRects:s,rooms:l,doors:a,sceneBound:i,onSelect:f,roomIndex:u,globalCharacterModel:d,fontSize:p}){const h=Ew(n.status),v=Tw(h),S=n.accentColor||fi[(n.colorIndex??0)%fi.length],b=oe.useRef(!1),A=!1,P=n.characterModel||d||"robot",x=y3().get(n.sessionId),_=x?x.posX:(Math.random()-.5)*4,M=x?x.posZ:(Math.random()-.5)*4,R=x?x.rotY:Math.random()*Math.PI*2,C=x?x.mode===lo?Pr:x.mode:Pr,w=x?x.deskIdx:-1,L=oe.useRef({mode:C,target:new ft(_,0,M),deskIdx:w,speed:1.2+Math.random()*.6,walkHz:6+Math.random()*2,phase:Math.random()*Math.PI*2,decisionTimer:2+Math.random()*4,posX:_,posY:0,posZ:M,rotY:R,waypoints:[],waypointIdx:0}),F=oe.useRef(0),G=oe.useRef(Math.floor(Math.random()*3)),T=oe.useRef(h),y=oe.useRef(u),V=oe.useRef(!1);function O(){return u!=null?gh(u):t1(i)}oe.useEffect(()=>{if(u!==y.current&&u!=null){const te=L.current;te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null,te.deskIdx=-1),te.posY=0;const we=gh(u);as(te,we,u,l,a),te.mode=Pr}y.current=u},[u,r,l,a]),oe.useEffect(()=>{const te=L.current,we=!V.current;if(we&&(V.current=!0,te.mode===uo&&te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=n.sessionId)),!we&&T.current===h)return;const Ae=["thinking","working"],_e=["idle","waiting"],Xe=!we&&Ae.includes(T.current),He=Ae.includes(h),Oe=!we&&_e.includes(T.current);if(Xe&&He){T.current=h;return}if(Xe&&!He&&(te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null,te.deskIdx=-1),te.posY=0,te.mode=Pr),Oe&&!_e.includes(h)&&(te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null,te.deskIdx=-1),te.posY=0,te.mode=Pr),He&&te.mode!==uo){const ke=u??bf(te.posX,te.posZ,l);let N;if(ke>=0?N=r.filter(Be=>Be.zone===ke&&!Be.occupantId):u==null?N=r.filter(Be=>Be.zone===-1&&!Be.occupantId):N=r.filter(Be=>!Be.occupantId),N.length>0){const Be=N[Math.floor(Math.random()*N.length)];Be.occupantId=n.sessionId,te.deskIdx=Be.idx,te.mode=lo,as(te,Be.seatPos,Be.zone,l,a)}else{const Be=ke>=0?r.filter(Ne=>Ne.zone===ke&&Ne.occupantId):r.filter(Ne=>Ne.zone===-1&&Ne.occupantId);if(Be.length>0){let Ne=Be[0],Me=1/0;for(const E of Be){const z=E.seatPos.x-te.posX,Y=E.seatPos.z-te.posZ,ue=z*z+Y*Y;ue<Me&&(Me=ue,Ne=E)}const Fe=.5,U=new ft(Ne.seatPos.x-Math.sin(Ne.faceRot)*Fe,0,Ne.seatPos.z-Math.cos(Ne.faceRot)*Fe);as(te,U,Ne.zone,l,a),te.mode=lo}else{te.mode=Pr;const Ne=O();te.waypoints=[Ne.clone()],te.waypointIdx=0,te.target.copy(Ne)}}}if((h==="alert"||h==="input")&&te.mode!==uo&&(te.mode=Lu),h==="idle"||h==="waiting"){const ke=r.filter(N=>N.zone===-2&&!N.occupantId);if(ke.length>0){const N=ke[Math.floor(Math.random()*ke.length)];N.occupantId=n.sessionId,te.deskIdx=N.idx,te.mode=lo,as(te,N.seatPos,N.zone,l,a)}else{te.mode=Pr,te.decisionTimer=2+Math.random()*4;const N=O();te.waypoints=[N.clone()],te.waypointIdx=0,te.target.copy(N)}}(h==="offline"||h==="connecting")&&(te.mode=Lu),T.current=h},[h,n.sessionId,r,u,l]),oe.useEffect(()=>()=>{const te=L.current;te.deskIdx>=0&&r[te.deskIdx]&&(r[te.deskIdx].occupantId=null)},[r]),Qn((te,we)=>{if(F.current++,(F.current+G.current)%3!==0)return;const Ae=Math.min(we*3,.15),_e=L.current;if(_e.mode===Lu||_e.mode===uo)return;const Xe=_e.target.x-_e.posX,He=_e.target.z-_e.posZ;if(Math.sqrt(Xe*Xe+He*He)<.5){if(_e.waypointIdx<_e.waypoints.length-1){_e.waypointIdx++,_e.target.copy(_e.waypoints[_e.waypointIdx]);return}if(_e.mode===lo){Rw(_e,r);return}const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U);return}let N=Math.atan2(Xe,He)-_e.rotY;N>Math.PI&&(N-=Math.PI*2),N<-Math.PI&&(N+=Math.PI*2),_e.rotY+=N*Math.min(1,10*Ae);const Be=_e.speed*v.speedMultiplier*Ae,Ne=_e.posX+Math.sin(_e.rotY)*Be,Me=_e.posZ+Math.cos(_e.rotY)*Be;if(!du(Ne,Me,s))_e.posX=Ne,_e.posZ=Me;else if(du(Ne,_e.posZ,s)){if(du(_e.posX,Me,s)){if(_e.mode===Pr){const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U)}}else if(_e.posZ=Me,_e.mode===Pr){const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U)}}else if(_e.posX=Ne,_e.mode===Pr){const U=O();_e.waypoints=[U.clone()],_e.waypointIdx=0,_e.target.copy(U)}_e.posX=Sf.clamp(_e.posX,-i,i),_e.posZ=Sf.clamp(_e.posZ,-i,i);const Fe=performance.now()/1e3*_e.walkHz+_e.phase;if(_e.posY=Math.abs(Math.sin(Fe*2))*.03,_e.mode===Pr&&v.seekDesk&&(_e.decisionTimer-=Ae,_e.decisionTimer<=0)){_e.decisionTimer=3+Math.random()*5;const U=u??bf(_e.posX,_e.posZ,l),E=U>=0?U:u==null?-1:-999;if(E!==-999){const z=r.filter(Y=>Y.zone===E&&!Y.occupantId);if(z.length>0){const Y=z[Math.floor(Math.random()*z.length)];Y.occupantId=n.sessionId,_e.deskIdx=Y.idx,_e.mode=lo,as(_e,Y.seatPos,Y.zone,l,a)}}}});const k=oe.useRef(null);Qn(()=>{const te=L.current;k.current&&k.current.position.set(te.posX,te.posY,te.posZ)});const H=oe.useCallback(te=>{te.stopPropagation(),f(n.sessionId)},[n.sessionId,f]),ee=oe.useCallback(()=>{b.current=!0},[]),Z=oe.useCallback(()=>{b.current=!1},[]),ne=.85+L.current.phase%.2,ve=oe.useRef(!1);Qn(()=>{ve.current=L.current.mode===uo});const fe=oe.useRef(0);Qn(()=>{if(fe.current++,(fe.current+G.current)%3!==0)return;const te=L.current;vs.set(n.sessionId,te.posX,te.posY+1,te.posZ),A3(n.sessionId,{x:te.posX,y:te.posY,z:te.posZ,rotY:te.rotY,mode:te.mode,deskIdx:te.deskIdx})}),oe.useEffect(()=>()=>{vs.delete(n.sessionId),R3(n.sessionId)},[n.sessionId]);const re=oe.useMemo(()=>Aw(n),[n.model,n.events]),B=n.accentColor?S:re.color,$=oe.useRef(Date.now()),le=oe.useRef(n.status);oe.useEffect(()=>{le.current!==n.status&&($.current=Date.now(),le.current=n.status)},[n.status]);const he=n.pendingTool||(n.toolLog&&n.toolLog.length>0?n.toolLog[n.toolLog.length-1].tool:null),se=oe.useRef(null),q=oe.useRef(n.status),K=oe.useRef(null),pe=oe.useRef(n.currentPrompt),Le=oe.useRef(0);return oe.useEffect(()=>{const te=q.current!==n.status,we=Date.now();if(we-Le.current<500&&!te)return;Le.current=we;const Ae=n.toolLog,_e=Ae&&Ae.length>0?Ae[Ae.length-1]:null,Xe=_e?`${_e.tool}-${_e.timestamp}`:null,He=Xe!==K.current,Oe=n.currentPrompt!==pe.current;if(te){const ke=q.current;if(n.status==="prompting"&&n.currentPrompt){const N=n.currentPrompt.length>60?n.currentPrompt.slice(0,60)+"...":n.currentPrompt;se.current={text:N,borderColor:"#00e5ff",persistent:!1,timestamp:Date.now()}}else n.status==="approval"?se.current={text:"AWAITING APPROVAL",borderColor:"#ffdd00",persistent:!0,timestamp:Date.now()}:n.status==="input"?se.current={text:"NEEDS INPUT",borderColor:"#aa66ff",persistent:!0,timestamp:Date.now()}:n.status==="waiting"?se.current={text:"Task complete!",borderColor:"#00ff88",persistent:!1,timestamp:Date.now()}:n.status==="ended"?se.current={text:"OFFLINE",borderColor:"#ff4444",persistent:!1,timestamp:Date.now()}:n.status==="idle"&&ke!=="idle"&&ke!=="connecting"&&(se.current={text:"ONLINE",borderColor:"#00ff88",persistent:!1,timestamp:Date.now()})}else if(He&&_e){const ke=_e.tool,N=_e.input||"";if(ke==="Read"||ke==="Grep"||ke==="Glob"){const Be=_m(N);se.current={text:`Reading ${Be}...`,borderColor:"rgba(0,229,255,0.6)",persistent:!1,timestamp:Date.now()}}else if(ke==="Bash"){const Be=N.length>40?N.slice(0,40)+"...":N;se.current={text:`$ ${Be}`,borderColor:"#ff9100",persistent:!1,timestamp:Date.now()}}else if(ke==="Edit"||ke==="Write"){const Be=_m(N);se.current={text:`Editing ${Be}...`,borderColor:"#00aaff",persistent:!1,timestamp:Date.now()}}else ke==="Task"?se.current={text:"Spawning agent...",borderColor:"#aa66ff",persistent:!1,timestamp:Date.now()}:(ke==="WebFetch"||ke==="WebSearch")&&(se.current={text:"Fetching...",borderColor:"#00e5ff",persistent:!1,timestamp:Date.now()})}else if(Oe&&n.status==="prompting"&&n.currentPrompt){const ke=n.currentPrompt.length>60?n.currentPrompt.slice(0,60)+"...":n.currentPrompt;se.current={text:ke,borderColor:"#00e5ff",persistent:!1,timestamp:Date.now()}}q.current=n.status,K.current=Xe,pe.current=n.currentPrompt},[n.status,n.toolLog,n.currentPrompt]),Q.jsxs("group",{ref:k,onClick:H,onPointerEnter:ee,onPointerLeave:Z,children:[Q.jsx(Q3,{neonColor:B,state:h,rotation:L.current.rotY,scale:ne,modelType:P,seatedRef:ve,cliBadge:re,currentTool:he,statusStartTime:$.current}),Q.jsx(xw,{state:h}),Q.jsx(hw,{session:n,robotState:h,isSelected:A,isHovered:b.current,fontSize:p}),Q.jsx(mw,{dialogueRef:se})]})}function as(n,r,s,l,a){const i=bf(n.posX,n.posZ,l),f=e1(n.posX,n.posZ,r,i,s,a);n.waypoints=f,n.waypointIdx=0,n.target.copy(f[0])}function Rw(n,r){const s=r[n.deskIdx];s&&(n.mode=uo,n.posX=s.seatPos.x,n.posY=-.12,n.posZ=s.seatPos.z,n.rotY=s.faceRot)}function _m(n){const r=n.match(/(?:\/[\w.-]+)+/);if(r){const s=r[0].split("/");return s[s.length-1]||r[0]}return n.length>20?n.slice(0,20)+"...":n||"file"}const ww=oe.memo(Cw,(n,r)=>n.session.sessionId===r.session.sessionId&&n.session.status===r.session.status&&n.session.accentColor===r.session.accentColor&&n.session.colorIndex===r.session.colorIndex&&n.session.model===r.session.model&&n.session.currentPrompt===r.session.currentPrompt&&n.session.pendingTool===r.session.pendingTool&&n.session.label===r.session.label&&n.session.characterModel===r.session.characterModel&&n.session.title===r.session.title&&n.session.projectName===r.session.projectName&&(n.session.toolLog?.length??0)===(r.session.toolLog?.length??0)&&(n.session.events?.length??0)===(r.session.events?.length??0)&&n.sceneBound===r.sceneBound&&n.onSelect===r.onSelect&&n.workstations===r.workstations&&n.wallRects===r.wallRects&&n.rooms===r.rooms&&n.doors===r.doors&&n.roomIndex===r.roomIndex&&n.globalCharacterModel===r.globalCharacterModel&&n.fontSize===r.fontSize),Sm=["#00f0ff","#ff00aa"],xm=["#007f88","#881155"];function Pw({rooms:n,casualAreas:r,storeRooms:s,sessions:l}){const a=s;return Q.jsxs(Q.Fragment,{children:[n.map(i=>{const[f,,u]=r1(i.index),d=a.find(S=>S.id===i.roomId),p=l?d?.sessionIds.filter(S=>{const b=l.get(S);return b&&b.status!=="ended"}).length??0:d?.sessionIds.length??0,h=Sm[i.stripColor]??Sm[0],v=xm[i.stripColor]??xm[0];return Q.jsxs("group",{children:[Q.jsx(xa,{position:[f,2.8,u],rotation:[-Math.PI/2,0,0],fontSize:.7,color:h,anchorX:"center",anchorY:"middle",letterSpacing:.15,outlineWidth:.02,outlineColor:"#000000",children:i.name.toUpperCase()}),Q.jsx(xa,{position:[f,2.8,u+1],rotation:[-Math.PI/2,0,0],fontSize:.35,color:v,anchorX:"center",anchorY:"middle",letterSpacing:.1,children:`${p} ${p===1?"UNIT":"UNITS"}`})]},i.roomId)}),r?.map(i=>{const[f,,u]=i.center;return Q.jsx(xa,{position:[f,2.8,u],rotation:[-Math.PI/2,0,0],fontSize:.8,color:"#ff9944",anchorX:"center",anchorY:"middle",letterSpacing:.15,outlineWidth:.02,outlineColor:"#000000",children:"COFFEE LOUNGE"},i.type)})]})}function Lw({parentId:n,childId:r,color:s}){const l=oe.useRef(0),a=oe.useMemo(()=>{const i=new Ta,f=new Float32Array(6);i.setAttribute("position",new _a(f,3));const u=new wg({color:s,dashSize:.3,gapSize:.2,transparent:!0,opacity:.3}),d=new Rg(i,u);return d.computeLineDistances(),d},[s]);return oe.useEffect(()=>()=>{a.geometry.dispose(),a.material.dispose()},[a]),Qn((i,f)=>{const u=vs.get(n),d=vs.get(r);if(!u||!d)return;const p=a.geometry.getAttribute("position"),h=p.array;h[0]=u.x,h[1]=u.y,h[2]=u.z,h[3]=d.x,h[4]=d.y,h[5]=d.z,p.needsUpdate=!0,l.current-=f*2;const v=a.material;v.dashOffset=l.current,a.computeLineDistances()}),Q.jsx("primitive",{object:a})}function Uw({connections:n}){return n.length===0?null:Q.jsx(Q.Fragment,{children:n.map(r=>Q.jsx(Lw,{parentId:r.parentId,childId:r.childId,color:r.color},`${r.parentId}-${r.childId}`))})}const bm=.04,Em=.1;function Dw({controlsRef:n}){const r=Lr(u=>u.camera),s=oe.useRef(new ft),l=oe.useRef(new ft),a=oe.useRef(!1),i=oe.useRef(0),f=oe.useRef(0);return Qn(()=>{if(!a.current&&(f.current++,f.current%6!==0))return;const{pendingTarget:u}=Hl.getState();if(u&&u.requestId!==i.current&&(i.current=u.requestId,s.current.set(...u.position),l.current.set(...u.lookAt),a.current=!0,f.current=0),!a.current||!n.current)return;const d=n.current;r.position.lerp(s.current,bm),d.target.lerp(l.current,bm),d.update();const p=r.position.distanceTo(s.current),h=d.target.distanceTo(l.current);p<Em&&h<Em&&(r.position.copy(s.current),d.target.copy(l.current),d.update(),a.current=!1,queueMicrotask(()=>Hl.getState().completeAnimation()))}),null}function Iw({background:n,fogDensity:r}){const{scene:s,gl:l}=Lr();return oe.useEffect(()=>{const a=new Ot(n);s.fog instanceof _f?(s.fog.color.copy(a),s.fog.density=r):s.fog=new _f(n,r),l.setClearColor(a)},[n,r,s,l]),null}const Nw=6,Fw=8,Ow=10;function kw({rooms:n,workstations:r,wallRects:s,sceneBound:l,casualAreas:a,doors:i,sessionArray:f,sessionsMap:u,connections:d,sceneBackground:p,sceneFogDensity:h,storeRooms:v,sceneTheme:S,globalCharacterModel:b,roomAssignments:A,fontSize:P}){const x=oe.useCallback(_=>{setTimeout(()=>{window.dispatchEvent(new CustomEvent("robot-select",{detail:{sessionId:_}}))},0)},[]);return Q.jsxs(Q.Fragment,{children:[Q.jsx(Iw,{background:p,fogDensity:h}),Q.jsx(X3,{rooms:n,casualAreas:a,theme:S}),Q.jsx(Pw,{rooms:n,casualAreas:a,storeRooms:v,sessions:u}),f.map(_=>Q.jsx(ww,{session:_,workstations:r,wallRects:s,rooms:n,doors:i,sceneBound:l,onSelect:x,roomIndex:A.get(_.sessionId),globalCharacterModel:b,fontSize:P},_.sessionId)),Q.jsx(Uw,{connections:d})]})}const gl={width:34,height:34,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid rgba(0,240,255,0.2)",borderRadius:3,background:"rgba(10,6,22,0.7)",color:"rgba(0,240,255,0.6)",cursor:"pointer",fontSize:16,fontFamily:"'JetBrains Mono', monospace",fontWeight:700,lineHeight:1,padding:0,transition:"all 0.15s ease",backdropFilter:"blur(8px)"};function Bw({controlsRef:n}){const r=Hl(u=>u.flyTo),s=oe.useCallback(u=>{const d=n.current;if(!d)return;const p=d.object,h=d.target,v=p.position.x-h.x,S=p.position.y-h.y,b=p.position.z-h.z;r([h.x+v*u,h.y+S*u,h.z+b*u],[h.x,h.y,h.z])},[r,n]),l=oe.useCallback(()=>{r([18,16,18],[0,1,0])},[r]),a=oe.useCallback(()=>{const u=n.current;if(!u)return;const d=u.target;r([d.x+.01,d.y+30,d.z+.01],[d.x,d.y,d.z])},[r,n]),i=oe.useCallback(u=>{u.currentTarget.style.background="rgba(0,240,255,0.15)",u.currentTarget.style.borderColor="rgba(0,240,255,0.5)",u.currentTarget.style.color="#00f0ff"},[]),f=oe.useCallback(u=>{u.currentTarget.style.background="rgba(10,6,22,0.7)",u.currentTarget.style.borderColor="rgba(0,240,255,0.2)",u.currentTarget.style.color="rgba(0,240,255,0.6)"},[]);return Q.jsxs("div",{style:{position:"absolute",bottom:20,left:20,display:"flex",flexDirection:"column",gap:4,pointerEvents:"all",zIndex:11},children:[Q.jsx("button",{style:gl,onClick:()=>s(.65),onMouseEnter:i,onMouseLeave:f,title:"Zoom in",children:Q.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Q.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),Q.jsx("button",{style:gl,onClick:()=>s(1.5),onMouseEnter:i,onMouseLeave:f,title:"Zoom out",children:Q.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Q.jsx("path",{d:"M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),Q.jsx("div",{style:{height:4}}),Q.jsx("button",{style:gl,onClick:a,onMouseEnter:i,onMouseLeave:f,title:"Top-down view",children:Q.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[Q.jsx("circle",{cx:"8",cy:"6",r:"3",stroke:"currentColor",strokeWidth:"1.2"}),Q.jsx("path",{d:"M8 9v4M5 15h6",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}),Q.jsx("button",{style:gl,onClick:l,onMouseEnter:i,onMouseLeave:f,title:"Reset view",children:Q.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Q.jsx("path",{d:"M3 9l5-6 5 6M4 8.5V14h3v-3h2v3h3V8.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function Ww(){const n=vh(M=>M.sessions),r=vh(M=>M.selectSession),s=Hl(M=>M.flyTo),l=i1(M=>M.rooms),a=Ml(M=>M.themeName),i=Ml(M=>M.characterModel),f=Ml(M=>M.fontSize),u=oe.useMemo(()=>k3(a),[a]),d=oe.useRef(null);oe.useEffect(()=>{const M=R=>{const{sessionId:C}=R.detail;r(C);const w=vs.get(C);w&&s([w.x+Nw,w.y+Fw,w.z+Ow],[w.x,w.y+1,w.z])};return window.addEventListener("robot-select",M),()=>window.removeEventListener("robot-select",M)},[r,s]),oe.useEffect(()=>{const M=setInterval(()=>{const R=C3(),C=new Map;R.forEach((w,L)=>{C.set(L,{posX:w.x,posZ:w.z,rotY:w.rotY,mode:w.mode,deskIdx:w.deskIdx})}),T3(C)},2e3);return()=>clearInterval(M)},[]);const p=oe.useMemo(()=>a1(l),[l]),h=oe.useMemo(()=>o1(p),[p]),v=oe.useMemo(()=>{const M=s1(p),R=kg(p,M.length),C=l1(h,M.length+R.length);return[...M,...R,...C]},[p,h]),S=oe.useMemo(()=>[],[]),b=oe.useMemo(()=>c1(p),[p]),A=oe.useMemo(()=>u1(p),[p]),P=oe.useMemo(()=>[...n.values()].filter(M=>M.status!=="ended"&&M.source==="ssh"),[n]),x=oe.useMemo(()=>{const M=new Map;for(const R of l)for(const C of R.sessionIds)M.set(C,R.roomIndex);return M},[l]),_=oe.useMemo(()=>{const M=[];for(const R of n.values()){if(!R.teamId||R.teamRole!=="member")continue;const C=R.teamId.replace(/^team-/,"");if(!C||C===R.sessionId)continue;const w=n.get(C);if(!w||w.status==="ended"||R.status==="ended")continue;const L=w.accentColor||fi[(w.colorIndex??0)%fi.length];M.push({parentId:C,childId:R.sessionId,color:L})}return M},[n]);return Q.jsxs("div",{style:{position:"absolute",inset:0},children:[Q.jsxs(SR,{shadows:!0,camera:{position:[18,16,18],fov:50,near:.1,far:150},gl:{antialias:!0,toneMapping:Ss,toneMappingExposure:1.2},style:{position:"absolute",inset:0,background:u.background},onCreated:({gl:M})=>{M.shadowMap.enabled=!0,M.shadowMap.type=ho},children:[Q.jsx("fogExp2",{attach:"fog",args:[u.background,u.fogDensity]}),Q.jsx(M3,{ref:d,enableDamping:!0,dampingFactor:.06,maxPolarAngle:Math.PI/2.1,minDistance:6,maxDistance:80,target:[0,1,0]}),Q.jsx(Dw,{controlsRef:d}),Q.jsx(oe.Suspense,{fallback:null,children:Q.jsx(kw,{rooms:p,workstations:v,wallRects:S,sceneBound:A,casualAreas:h,doors:b,sessionArray:P,sessionsMap:n,connections:_,sceneBackground:u.background,sceneFogDensity:u.fogDensity,storeRooms:l,sceneTheme:u,globalCharacterModel:i,roomAssignments:x,fontSize:f})})]}),Q.jsx(Bw,{controlsRef:d}),Q.jsx(f1,{sessionCount:P.length}),Q.jsx(d1,{})]})}export{Ww as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as ae,p as G,r as g,s as F,a as R,n as U,i as Q,b as W,t as ie,c as D,f as ne,d as re,e as z,g as X,h as v,j as Y,u as ee,k as s,l as C,m as M,o as oe,q as k}from"./index-Cd3bd-J3.js";var le=class extends ae{constructor(e,t){super(),this.options=t,this.#s=e,this.#i=null,this.#a=G(),this.bindMethods(),this.setOptions(t)}#s;#e=void 0;#m=void 0;#t=void 0;#r;#d;#a;#i;#f;#u;#h;#o;#l;#n;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),K(this.#e,this.options)?this.#c():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return L(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return L(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#x(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,a=this.#e;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof g(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),t._defaulted&&!F(this.options,t)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&V(this.#e,a,this.options,t)&&this.#c(),this.updateResult(),r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||R(this.options.staleTime,this.#e)!==R(t.staleTime,this.#e))&&this.#v();const n=this.#_();r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||n!==this.#n)&&this.#y(n)}getOptimisticResult(e){const t=this.#s.getQueryCache().build(this.#s,e),a=this.createResult(t,e);return de(this,a)&&(this.#t=a,this.#d=this.options,this.#r=this.#e.state),a}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(a,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#s.defaultQueryOptions(e),a=this.#s.getQueryCache().build(this.#s,t);return a.fetch().then(()=>this.createResult(a,t))}fetch(e){return this.#c({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#c(e){this.#j();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(U)),t}#v(){this.#g();const e=R(this.options.staleTime,this.#e);if(Q||this.#t.isStale||!W(e))return;const a=ie(this.#t.dataUpdatedAt,e)+1;this.#o=D.setTimeout(()=>{this.#t.isStale||this.updateResult()},a)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#x(),this.#n=e,!(Q||g(this.options.enabled,this.#e)===!1||!W(this.#n)||this.#n===0)&&(this.#l=D.setInterval(()=>{(this.options.refetchIntervalInBackground||ne.isFocused())&&this.#c()},this.#n))}#b(){this.#v(),this.#y(this.#_())}#g(){this.#o&&(D.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#l&&(D.clearInterval(this.#l),this.#l=void 0)}createResult(e,t){const a=this.#e,r=this.options,n=this.#t,h=this.#r,o=this.#d,f=e!==a?e.state:this.#m,{state:d}=e;let u={...d},x=!1,p;if(t._optimisticResults){const b=this.hasListeners(),w=!b&&K(e,t),E=b&&V(e,a,t,r);(w||E)&&(u={...u,...re(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:c,errorUpdatedAt:_,status:l}=u;p=u.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&l==="pending"){let b;n?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(b=n.data,y=!0):b=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,b!==void 0&&(l="success",p=z(n?.data,b,t),x=!0)}if(t.select&&p!==void 0&&!y)if(n&&p===h?.data&&t.select===this.#f)p=this.#u;else try{this.#f=t.select,p=t.select(p),p=z(n?.data,p,t),this.#u=p,this.#i=null}catch(b){this.#i=b}this.#i&&(c=this.#i,p=this.#u,_=Date.now(),l="error");const j=u.fetchStatus==="fetching",T=l==="pending",I=l==="error",$=T&&j,H=p!==void 0,S={status:l,fetchStatus:u.fetchStatus,isPending:T,isSuccess:l==="success",isError:I,isInitialLoading:$,isLoading:$,data:p,dataUpdatedAt:u.dataUpdatedAt,error:c,errorUpdatedAt:_,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>f.dataUpdateCount||u.errorUpdateCount>f.errorUpdateCount,isFetching:j,isRefetching:j&&!T,isLoadingError:I&&!H,isPaused:u.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:I&&H,isStale:A(e,t),refetch:this.refetch,promise:this.#a,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const b=S.data!==void 0,w=S.status==="error"&&!b,E=B=>{w?B.reject(S.error):b&&B.resolve(S.data)},q=()=>{const B=this.#a=S.promise=G();E(B)},N=this.#a;switch(N.status){case"pending":e.queryHash===a.queryHash&&E(N);break;case"fulfilled":(w||S.data!==N.value)&&q();break;case"rejected":(!w||S.error!==N.reason)&&q();break}}return S}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#d=this.options,this.#r.data!==void 0&&(this.#h=this.#e),F(t,e))return;this.#t=t;const a=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,n=typeof r=="function"?r():r;if(n==="all"||!n&&!this.#p.size)return!0;const h=new Set(n??this.#p);return this.options.throwOnError&&h.add("error"),Object.keys(this.#t).some(o=>{const m=o;return this.#t[m]!==e[m]&&h.has(m)})};this.#S({listeners:a()})}#j(){const e=this.#s.getQueryCache().build(this.#s,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#m=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){X.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#s.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function ce(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function K(e,t){return ce(e,t)||e.state.data!==void 0&&L(e,t,t.refetchOnMount)}function L(e,t,a){if(g(t.enabled,e)!==!1&&R(t.staleTime,e)!=="static"){const r=typeof a=="function"?a(e):a;return r==="always"||r!==!1&&A(e,t)}return!1}function V(e,t,a,r){return(e!==t||g(r.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&A(e,a)}function A(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(R(t.staleTime,e))}function de(e,t){return!F(e.getCurrentResult(),t)}var te=v.createContext(!1),ue=()=>v.useContext(te);te.Provider;function he(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pe=v.createContext(he()),me=()=>v.useContext(pe),fe=(e,t,a)=>{const r=a?.state.error&&typeof e.throwOnError=="function"?Y(e.throwOnError,[a.state.error,a]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ve=e=>{v.useEffect(()=>{e.clearReset()},[e])},_e=({result:e,errorResetBoundary:t,throwOnError:a,query:r,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(n&&e.data===void 0||Y(a,[e.error,r])),ye=e=>{if(e.suspense){const a=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>a(r(...n)):a(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},be=(e,t)=>e.isLoading&&e.isFetching&&!t,ge=(e,t)=>e?.suspense&&t.isPending,Z=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function xe(e,t,a){const r=ue(),n=me(),h=ee(),o=h.defaultQueryOptions(e);h.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const m=h.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",ye(o),fe(o,n,m),ve(n);const f=!h.getQueryCache().get(o.queryHash),[d]=v.useState(()=>new t(h,o)),u=d.getOptimisticResult(o),x=!r&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(p=>{const c=x?d.subscribe(X.batchCalls(p)):U;return d.updateResult(),c},[d,x]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),v.useEffect(()=>{d.setOptions(o)},[o,d]),ge(o,u))throw Z(o,d,n);if(_e({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:m,suspense:o.suspense}))throw u.error;return h.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Q&&be(u,r)&&(f?Z(o,d,n):m?.promise)?.catch(U).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?u:d.trackResult(u)}function P(e,t){return xe(e,le)}function je({tabs:e,activeTab:t,onTabChange:a,containerClassName:r,panelClassName:n,tabListClassName:h,tabClassName:o,activeTabClassName:m}){return s.jsxs("div",{className:r,children:[s.jsx("div",{role:"tablist",className:h,style:h?void 0:{display:"flex",gap:"2px",borderBottom:"1px solid var(--border-subtle, rgba(255,255,255,0.06))",marginBottom:"12px"},children:e.map(f=>{const d=t===f.id,u=[o,d&&m].filter(Boolean).join(" ");return s.jsx("button",{role:"tab","aria-selected":d,onClick:()=>a(f.id),className:u||void 0,style:u?void 0:{padding:"8px 16px",background:d?"var(--bg-accent, rgba(0,229,255,0.1))":"transparent",border:"none",borderBottom:d?"2px solid var(--accent-cyan, #00e5ff)":"2px solid transparent",color:d?"var(--accent-cyan, #00e5ff)":"var(--text-secondary, #8888aa)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"var(--font-mono, monospace)",transition:"color 0.15s, background 0.15s"},children:f.label},f.id)})}),s.jsx("div",{role:"tabpanel",className:n,children:e.find(f=>f.id===t)?.content})]})}const Se="_container_1uen7_5",Te="_filters_1uen7_15",we="_filterGroup_1uen7_22",Ce="_filterLabel_1uen7_28",Re="_filterInput_1uen7_36",Ee="_sortToggle_1uen7_54",Ne="_results_1uen7_72",Be="_emptyState_1uen7_80",De="_row_1uen7_89",Oe="_rowTitle_1uen7_107",Ie="_rowProject_1uen7_115",Me="_rowDate_1uen7_123",ke="_rowDuration_1uen7_129",Pe="_rowStatus_1uen7_135",Fe="_rowMeta_1uen7_165",Ue="_resumeBtn_1uen7_171",Qe="_deleteBtn_1uen7_189",Le="_pagination_1uen7_207",Ae="_pageBtn_1uen7_215",$e="_pageBtnActive_1uen7_236",He="_pageEllipsis_1uen7_242",qe="_detailOverlay_1uen7_249",Ge="_detailCard_1uen7_259",We="_detailTabs_1uen7_273",ze="_detailTabPanel_1uen7_281",Ke="_detailHeader_1uen7_289",Ve="_detailTitle_1uen7_296",Ze="_detailMeta_1uen7_302",Je="_detailCloseBtn_1uen7_309",Xe="_detailBody_1uen7_322",Ye="_convoEntry_1uen7_327",et="_convoEntryHeader_1uen7_335",tt="_copyBtn_1uen7_342",st="_convoPrompt_1uen7_364",at="_convoResponse_1uen7_369",it="_convoTime_1uen7_374",nt="_convoText_1uen7_380",rt="_activityEntry_1uen7_387",ot="_activityTime_1uen7_395",lt="_activityBadge_1uen7_401",ct="_activityBadgeTool_1uen7_410",dt="_activityBadgeEvent_1uen7_415",ut="_activityDetail_1uen7_420",i={container:Se,filters:Te,filterGroup:we,filterLabel:Ce,filterInput:Re,sortToggle:Ee,results:Ne,emptyState:Be,row:De,rowTitle:Oe,rowProject:Ie,rowDate:Me,rowDuration:ke,rowStatus:Pe,rowMeta:Fe,resumeBtn:Ue,deleteBtn:Qe,pagination:Le,pageBtn:Ae,pageBtnActive:$e,pageEllipsis:He,detailOverlay:qe,detailCard:Ge,detailTabs:We,detailTabPanel:ze,detailHeader:Ke,detailTitle:Ve,detailMeta:Ze,detailCloseBtn:Je,detailBody:Xe,convoEntry:Ye,convoEntryHeader:et,copyBtn:tt,convoPrompt:st,convoResponse:at,convoTime:it,convoText:nt,activityEntry:rt,activityTime:ot,activityBadge:lt,activityBadgeTool:ct,activityBadgeEvent:dt,activityDetail:ut},se=50;function O(e){if(e<1e3)return"<1s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const a=Math.floor(t/60);return a<60?`${a}m ${t%60}s`:`${Math.floor(a/60)}h ${a%60}m`}function ht(e){return e?new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"--"}function J(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function pt(e){const t=new URLSearchParams;e.query&&t.set("query",e.query),e.project&&t.set("project",e.project),e.status==="archived"?t.set("archived","true"):e.status&&t.set("status",e.status),e.dateFrom&&t.set("dateFrom",String(new Date(e.dateFrom).getTime())),e.dateTo&&t.set("dateTo",String(new Date(e.dateTo+"T23:59:59").getTime()));const a={date:"started_at",duration:"last_activity_at",prompts:"started_at",tools:"started_at"};return t.set("sortBy",a[e.sortBy]||"started_at"),t.set("sortDir",e.sortDir),t.set("page",String(e.page)),t.set("pageSize",String(se)),t.toString()}function xt(){const e=ee(),[t,a]=v.useState({query:"",project:"",status:"",dateFrom:"",dateTo:"",sortBy:"date",sortDir:"desc",page:1}),[r,n]=v.useState(null),{data:h}=P({queryKey:["db-projects"],queryFn:async()=>{const l=await C("/api/db/projects");if(!l.ok)throw new Error("Failed to load projects");return l.json()},staleTime:6e4}),{data:o,isLoading:m}=P({queryKey:["db-sessions",t],queryFn:async()=>{const l=await C(`/api/db/sessions?${pt(t)}`);if(!l.ok)throw new Error("Failed to load sessions");return l.json()}}),{data:f}=P({queryKey:["db-session-detail",r],queryFn:async()=>{if(!r)return null;const l=await C(`/api/db/sessions/${encodeURIComponent(r)}`);if(!l.ok)throw new Error("Failed to load session detail");return l.json()},enabled:!!r}),d=v.useCallback((l,y)=>{a(j=>({...j,[l]:y,page:l==="page"?y:1}))},[]),u=v.useCallback(async(l,y)=>{l.stopPropagation(),window.confirm("Delete this session from history? This cannot be undone.")&&(await C(`/api/db/sessions/${encodeURIComponent(y)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["db-sessions"]}))},[e]),x=v.useCallback(async(l,y)=>{l.stopPropagation();try{const T=await(await C(`/api/sessions/${encodeURIComponent(y)}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();T.ok?M("Resuming Claude session in terminal","success"):M(T.error||"Resume failed","error")}catch(j){M(j.message,"error")}},[]),p=o?.sessions??[],c=o?.total??0,_=Math.ceil(c/se);return s.jsxs("div",{className:i.container,"data-testid":"history-view",children:[s.jsxs("div",{className:i.filters,children:[s.jsx(oe,{value:t.query,onChange:l=>d("query",l),placeholder:"Search prompts..."}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Project"}),s.jsx(k,{value:t.project,onChange:l=>d("project",l),options:[{value:"",label:"All"},...h?.map(l=>({value:l.project_path,label:l.project_name}))??[]]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Status"}),s.jsx(k,{value:t.status,onChange:l=>d("status",l),options:[{value:"",label:"All"},{value:"idle",label:"Idle"},{value:"working",label:"Working"},{value:"waiting",label:"Waiting"},{value:"ended",label:"Ended"},{value:"archived",label:"Archived"}]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"From"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateFrom,onChange:l=>d("dateFrom",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"To"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateTo,onChange:l=>d("dateTo",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Sort"}),s.jsx(k,{value:t.sortBy,onChange:l=>d("sortBy",l),options:[{value:"date",label:"Date"},{value:"duration",label:"Activity"},{value:"prompts",label:"Prompts"},{value:"tools",label:"Tools"}]}),s.jsx("button",{className:i.sortToggle,onClick:()=>d("sortDir",t.sortDir==="desc"?"asc":"desc"),children:t.sortDir.toUpperCase()})]})]}),s.jsxs("div",{className:i.results,children:[m&&s.jsx("div",{className:i.emptyState,children:"Loading..."}),!m&&p.length===0&&s.jsx("div",{className:i.emptyState,children:"No sessions found"}),p.map(l=>s.jsx(ft,{session:l,onClick:()=>n(l.id),onResume:y=>x(y,l.id),onDelete:y=>u(y,l.id)},l.id))]}),_>1&&s.jsx(vt,{currentPage:t.page,totalPages:_,onPageChange:l=>d("page",l)}),r&&f&&s.jsx(yt,{detail:f,onClose:()=>n(null)})]})}function mt(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polyline",{points:"1 4 1 10 7 10"}),s.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})}function ft({session:e,onClick:t,onResume:a,onDelete:r}){const n=e.ended_at&&e.started_at?O(e.ended_at-e.started_at):e.started_at?O(Date.now()-e.started_at):"--";return s.jsxs("div",{className:i.row,onClick:t,children:[s.jsx("span",{className:i.rowTitle,children:e.title||e.project_name||e.id}),s.jsx("span",{className:i.rowProject,children:e.project_name}),s.jsx("span",{className:i.rowDate,children:ht(e.started_at)}),s.jsx("span",{className:i.rowDuration,children:n}),s.jsx("span",{className:i.rowStatus,"data-status":e.status,children:e.status.toUpperCase()}),s.jsxs("span",{className:i.rowMeta,children:[e.total_prompts," prompts"]}),s.jsxs("span",{className:i.rowMeta,children:[e.total_tool_calls," tools"]}),s.jsx("button",{className:i.resumeBtn,onClick:a,title:"Resume session","aria-label":"Resume session",children:s.jsx(mt,{})}),s.jsx("button",{className:i.deleteBtn,onClick:r,title:"Delete session","aria-label":"Delete session",children:"x"})]})}function vt({currentPage:e,totalPages:t,onPageChange:a}){const r=[];for(let o=1;o<=t;o++)(o===1||o===t||o>=e-2&&o<=e+2)&&r.push(o);const n=[];let h=0;for(const o of r)typeof o=="number"&&(h&&o-h>1&&n.push("ellipsis"),n.push(o),h=o);return s.jsxs("div",{className:i.pagination,children:[s.jsx("button",{className:i.pageBtn,disabled:e<=1,onClick:()=>a(e-1),children:"Prev"}),n.map((o,m)=>o==="ellipsis"?s.jsx("span",{className:i.pageEllipsis,children:"..."},`e-${m}`):s.jsx("button",{className:`${i.pageBtn} ${o===e?i.pageBtnActive:""}`,onClick:()=>a(o),children:o},o)),s.jsx("button",{className:i.pageBtn,disabled:e>=t,onClick:()=>a(e+1),children:"Next"})]})}function _t({text:e}){const[t,a]=v.useState(!1),r=n=>{n.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})};return s.jsx("button",{className:i.copyBtn,onClick:r,"aria-label":"Copy to clipboard",title:"Copy to clipboard",children:t?"✓":"⎘"})}function yt({detail:e,onClose:t}){const[a,r]=v.useState("conversation"),{session:n,prompts:h,responses:o,tool_calls:m,events:f}=e,d=[...h.map(c=>({type:"prompt",timestamp:c.timestamp,text:c.text})),...o.map(c=>({type:"response",timestamp:c.timestamp,text:c.text_excerpt}))].sort((c,_)=>c.timestamp-_.timestamp),u=[...m.map(c=>({kind:"tool",label:c.tool_name,detail:c.tool_input_summary,timestamp:c.timestamp})),...f.map(c=>({kind:"event",label:c.event_type,detail:c.detail,timestamp:c.timestamp}))].sort((c,_)=>_.timestamp-c.timestamp),x=n.ended_at&&n.started_at?O(n.ended_at-n.started_at):n.started_at?O(Date.now()-n.started_at):"--",p=[{id:"conversation",label:`Conversation (${d.length})`,content:s.jsxs("div",{className:i.detailBody,children:[d.length===0&&s.jsx("div",{className:i.emptyState,children:"No conversation recorded"}),d.map((c,_)=>s.jsxs("div",{className:`${i.convoEntry} ${c.type==="prompt"?i.convoPrompt:i.convoResponse}`,children:[s.jsxs("div",{className:i.convoEntryHeader,children:[s.jsx("div",{className:i.convoTime,children:J(c.timestamp)}),s.jsx(_t,{text:c.text})]}),s.jsx("div",{className:i.convoText,children:c.text})]},_))]})},{id:"activity",label:`Activity (${u.length})`,content:s.jsxs("div",{className:i.detailBody,children:[u.length===0&&s.jsx("div",{className:i.emptyState,children:"No activity recorded"}),u.map((c,_)=>s.jsxs("div",{className:i.activityEntry,children:[s.jsx("span",{className:i.activityTime,children:J(c.timestamp)}),s.jsx("span",{className:`${i.activityBadge} ${c.kind==="tool"?i.activityBadgeTool:i.activityBadgeEvent}`,children:c.label}),s.jsx("span",{className:i.activityDetail,children:c.detail})]},_))]})}];return s.jsx("div",{className:i.detailOverlay,onClick:t,children:s.jsxs("div",{className:i.detailCard,onClick:c=>c.stopPropagation(),children:[s.jsxs("div",{className:i.detailHeader,children:[s.jsxs("div",{children:[s.jsx("h2",{className:i.detailTitle,children:n.project_name||n.id}),s.jsxs("div",{className:i.detailMeta,children:[s.jsxs("span",{children:["Status: ",n.status.toUpperCase()]}),s.jsxs("span",{children:["Model: ",n.model||"--"]}),s.jsxs("span",{children:["Duration: ",x]}),s.jsxs("span",{children:[n.total_prompts," prompts / ",n.total_tool_calls," tools"]})]})]}),s.jsx("button",{className:i.detailCloseBtn,onClick:t,"aria-label":"Close",children:"x"})]}),s.jsx(je,{tabs:p,activeTab:a,onTabChange:r,containerClassName:i.detailTabs,panelClassName:i.detailTabPanel})]})})}export{xt as default};
|
|
1
|
+
import{S as ae,p as G,r as g,s as F,a as R,n as U,i as Q,b as W,t as ie,c as D,f as ne,d as re,e as z,g as X,h as v,j as Y,u as ee,k as s,l as C,m as M,o as oe,q as k}from"./index-BtUJHbpO.js";var le=class extends ae{constructor(e,t){super(),this.options=t,this.#s=e,this.#i=null,this.#a=G(),this.bindMethods(),this.setOptions(t)}#s;#e=void 0;#m=void 0;#t=void 0;#r;#d;#a;#i;#f;#u;#h;#o;#l;#n;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),K(this.#e,this.options)?this.#c():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return L(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return L(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#x(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,a=this.#e;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof g(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),t._defaulted&&!F(this.options,t)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&V(this.#e,a,this.options,t)&&this.#c(),this.updateResult(),r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||R(this.options.staleTime,this.#e)!==R(t.staleTime,this.#e))&&this.#v();const n=this.#_();r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||n!==this.#n)&&this.#y(n)}getOptimisticResult(e){const t=this.#s.getQueryCache().build(this.#s,e),a=this.createResult(t,e);return de(this,a)&&(this.#t=a,this.#d=this.options,this.#r=this.#e.state),a}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(a,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#s.defaultQueryOptions(e),a=this.#s.getQueryCache().build(this.#s,t);return a.fetch().then(()=>this.createResult(a,t))}fetch(e){return this.#c({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#c(e){this.#j();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(U)),t}#v(){this.#g();const e=R(this.options.staleTime,this.#e);if(Q||this.#t.isStale||!W(e))return;const a=ie(this.#t.dataUpdatedAt,e)+1;this.#o=D.setTimeout(()=>{this.#t.isStale||this.updateResult()},a)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#x(),this.#n=e,!(Q||g(this.options.enabled,this.#e)===!1||!W(this.#n)||this.#n===0)&&(this.#l=D.setInterval(()=>{(this.options.refetchIntervalInBackground||ne.isFocused())&&this.#c()},this.#n))}#b(){this.#v(),this.#y(this.#_())}#g(){this.#o&&(D.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#l&&(D.clearInterval(this.#l),this.#l=void 0)}createResult(e,t){const a=this.#e,r=this.options,n=this.#t,h=this.#r,o=this.#d,f=e!==a?e.state:this.#m,{state:d}=e;let u={...d},x=!1,p;if(t._optimisticResults){const b=this.hasListeners(),w=!b&&K(e,t),E=b&&V(e,a,t,r);(w||E)&&(u={...u,...re(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:c,errorUpdatedAt:_,status:l}=u;p=u.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&l==="pending"){let b;n?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(b=n.data,y=!0):b=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,b!==void 0&&(l="success",p=z(n?.data,b,t),x=!0)}if(t.select&&p!==void 0&&!y)if(n&&p===h?.data&&t.select===this.#f)p=this.#u;else try{this.#f=t.select,p=t.select(p),p=z(n?.data,p,t),this.#u=p,this.#i=null}catch(b){this.#i=b}this.#i&&(c=this.#i,p=this.#u,_=Date.now(),l="error");const j=u.fetchStatus==="fetching",T=l==="pending",I=l==="error",$=T&&j,H=p!==void 0,S={status:l,fetchStatus:u.fetchStatus,isPending:T,isSuccess:l==="success",isError:I,isInitialLoading:$,isLoading:$,data:p,dataUpdatedAt:u.dataUpdatedAt,error:c,errorUpdatedAt:_,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>f.dataUpdateCount||u.errorUpdateCount>f.errorUpdateCount,isFetching:j,isRefetching:j&&!T,isLoadingError:I&&!H,isPaused:u.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:I&&H,isStale:A(e,t),refetch:this.refetch,promise:this.#a,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const b=S.data!==void 0,w=S.status==="error"&&!b,E=B=>{w?B.reject(S.error):b&&B.resolve(S.data)},q=()=>{const B=this.#a=S.promise=G();E(B)},N=this.#a;switch(N.status){case"pending":e.queryHash===a.queryHash&&E(N);break;case"fulfilled":(w||S.data!==N.value)&&q();break;case"rejected":(!w||S.error!==N.reason)&&q();break}}return S}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#d=this.options,this.#r.data!==void 0&&(this.#h=this.#e),F(t,e))return;this.#t=t;const a=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,n=typeof r=="function"?r():r;if(n==="all"||!n&&!this.#p.size)return!0;const h=new Set(n??this.#p);return this.options.throwOnError&&h.add("error"),Object.keys(this.#t).some(o=>{const m=o;return this.#t[m]!==e[m]&&h.has(m)})};this.#S({listeners:a()})}#j(){const e=this.#s.getQueryCache().build(this.#s,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#m=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){X.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#s.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function ce(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function K(e,t){return ce(e,t)||e.state.data!==void 0&&L(e,t,t.refetchOnMount)}function L(e,t,a){if(g(t.enabled,e)!==!1&&R(t.staleTime,e)!=="static"){const r=typeof a=="function"?a(e):a;return r==="always"||r!==!1&&A(e,t)}return!1}function V(e,t,a,r){return(e!==t||g(r.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&A(e,a)}function A(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(R(t.staleTime,e))}function de(e,t){return!F(e.getCurrentResult(),t)}var te=v.createContext(!1),ue=()=>v.useContext(te);te.Provider;function he(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pe=v.createContext(he()),me=()=>v.useContext(pe),fe=(e,t,a)=>{const r=a?.state.error&&typeof e.throwOnError=="function"?Y(e.throwOnError,[a.state.error,a]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ve=e=>{v.useEffect(()=>{e.clearReset()},[e])},_e=({result:e,errorResetBoundary:t,throwOnError:a,query:r,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(n&&e.data===void 0||Y(a,[e.error,r])),ye=e=>{if(e.suspense){const a=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>a(r(...n)):a(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},be=(e,t)=>e.isLoading&&e.isFetching&&!t,ge=(e,t)=>e?.suspense&&t.isPending,Z=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function xe(e,t,a){const r=ue(),n=me(),h=ee(),o=h.defaultQueryOptions(e);h.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const m=h.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",ye(o),fe(o,n,m),ve(n);const f=!h.getQueryCache().get(o.queryHash),[d]=v.useState(()=>new t(h,o)),u=d.getOptimisticResult(o),x=!r&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(p=>{const c=x?d.subscribe(X.batchCalls(p)):U;return d.updateResult(),c},[d,x]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),v.useEffect(()=>{d.setOptions(o)},[o,d]),ge(o,u))throw Z(o,d,n);if(_e({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:m,suspense:o.suspense}))throw u.error;return h.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Q&&be(u,r)&&(f?Z(o,d,n):m?.promise)?.catch(U).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?u:d.trackResult(u)}function P(e,t){return xe(e,le)}function je({tabs:e,activeTab:t,onTabChange:a,containerClassName:r,panelClassName:n,tabListClassName:h,tabClassName:o,activeTabClassName:m}){return s.jsxs("div",{className:r,children:[s.jsx("div",{role:"tablist",className:h,style:h?void 0:{display:"flex",gap:"2px",borderBottom:"1px solid var(--border-subtle, rgba(255,255,255,0.06))",marginBottom:"12px"},children:e.map(f=>{const d=t===f.id,u=[o,d&&m].filter(Boolean).join(" ");return s.jsx("button",{role:"tab","aria-selected":d,onClick:()=>a(f.id),className:u||void 0,style:u?void 0:{padding:"8px 16px",background:d?"var(--bg-accent, rgba(0,229,255,0.1))":"transparent",border:"none",borderBottom:d?"2px solid var(--accent-cyan, #00e5ff)":"2px solid transparent",color:d?"var(--accent-cyan, #00e5ff)":"var(--text-secondary, #8888aa)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"var(--font-mono, monospace)",transition:"color 0.15s, background 0.15s"},children:f.label},f.id)})}),s.jsx("div",{role:"tabpanel",className:n,children:e.find(f=>f.id===t)?.content})]})}const Se="_container_1uen7_5",Te="_filters_1uen7_15",we="_filterGroup_1uen7_22",Ce="_filterLabel_1uen7_28",Re="_filterInput_1uen7_36",Ee="_sortToggle_1uen7_54",Ne="_results_1uen7_72",Be="_emptyState_1uen7_80",De="_row_1uen7_89",Oe="_rowTitle_1uen7_107",Ie="_rowProject_1uen7_115",Me="_rowDate_1uen7_123",ke="_rowDuration_1uen7_129",Pe="_rowStatus_1uen7_135",Fe="_rowMeta_1uen7_165",Ue="_resumeBtn_1uen7_171",Qe="_deleteBtn_1uen7_189",Le="_pagination_1uen7_207",Ae="_pageBtn_1uen7_215",$e="_pageBtnActive_1uen7_236",He="_pageEllipsis_1uen7_242",qe="_detailOverlay_1uen7_249",Ge="_detailCard_1uen7_259",We="_detailTabs_1uen7_273",ze="_detailTabPanel_1uen7_281",Ke="_detailHeader_1uen7_289",Ve="_detailTitle_1uen7_296",Ze="_detailMeta_1uen7_302",Je="_detailCloseBtn_1uen7_309",Xe="_detailBody_1uen7_322",Ye="_convoEntry_1uen7_327",et="_convoEntryHeader_1uen7_335",tt="_copyBtn_1uen7_342",st="_convoPrompt_1uen7_364",at="_convoResponse_1uen7_369",it="_convoTime_1uen7_374",nt="_convoText_1uen7_380",rt="_activityEntry_1uen7_387",ot="_activityTime_1uen7_395",lt="_activityBadge_1uen7_401",ct="_activityBadgeTool_1uen7_410",dt="_activityBadgeEvent_1uen7_415",ut="_activityDetail_1uen7_420",i={container:Se,filters:Te,filterGroup:we,filterLabel:Ce,filterInput:Re,sortToggle:Ee,results:Ne,emptyState:Be,row:De,rowTitle:Oe,rowProject:Ie,rowDate:Me,rowDuration:ke,rowStatus:Pe,rowMeta:Fe,resumeBtn:Ue,deleteBtn:Qe,pagination:Le,pageBtn:Ae,pageBtnActive:$e,pageEllipsis:He,detailOverlay:qe,detailCard:Ge,detailTabs:We,detailTabPanel:ze,detailHeader:Ke,detailTitle:Ve,detailMeta:Ze,detailCloseBtn:Je,detailBody:Xe,convoEntry:Ye,convoEntryHeader:et,copyBtn:tt,convoPrompt:st,convoResponse:at,convoTime:it,convoText:nt,activityEntry:rt,activityTime:ot,activityBadge:lt,activityBadgeTool:ct,activityBadgeEvent:dt,activityDetail:ut},se=50;function O(e){if(e<1e3)return"<1s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const a=Math.floor(t/60);return a<60?`${a}m ${t%60}s`:`${Math.floor(a/60)}h ${a%60}m`}function ht(e){return e?new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"--"}function J(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function pt(e){const t=new URLSearchParams;e.query&&t.set("query",e.query),e.project&&t.set("project",e.project),e.status==="archived"?t.set("archived","true"):e.status&&t.set("status",e.status),e.dateFrom&&t.set("dateFrom",String(new Date(e.dateFrom).getTime())),e.dateTo&&t.set("dateTo",String(new Date(e.dateTo+"T23:59:59").getTime()));const a={date:"started_at",duration:"last_activity_at",prompts:"started_at",tools:"started_at"};return t.set("sortBy",a[e.sortBy]||"started_at"),t.set("sortDir",e.sortDir),t.set("page",String(e.page)),t.set("pageSize",String(se)),t.toString()}function xt(){const e=ee(),[t,a]=v.useState({query:"",project:"",status:"",dateFrom:"",dateTo:"",sortBy:"date",sortDir:"desc",page:1}),[r,n]=v.useState(null),{data:h}=P({queryKey:["db-projects"],queryFn:async()=>{const l=await C("/api/db/projects");if(!l.ok)throw new Error("Failed to load projects");return l.json()},staleTime:6e4}),{data:o,isLoading:m}=P({queryKey:["db-sessions",t],queryFn:async()=>{const l=await C(`/api/db/sessions?${pt(t)}`);if(!l.ok)throw new Error("Failed to load sessions");return l.json()}}),{data:f}=P({queryKey:["db-session-detail",r],queryFn:async()=>{if(!r)return null;const l=await C(`/api/db/sessions/${encodeURIComponent(r)}`);if(!l.ok)throw new Error("Failed to load session detail");return l.json()},enabled:!!r}),d=v.useCallback((l,y)=>{a(j=>({...j,[l]:y,page:l==="page"?y:1}))},[]),u=v.useCallback(async(l,y)=>{l.stopPropagation(),window.confirm("Delete this session from history? This cannot be undone.")&&(await C(`/api/db/sessions/${encodeURIComponent(y)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["db-sessions"]}))},[e]),x=v.useCallback(async(l,y)=>{l.stopPropagation();try{const T=await(await C(`/api/sessions/${encodeURIComponent(y)}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();T.ok?M("Resuming Claude session in terminal","success"):M(T.error||"Resume failed","error")}catch(j){M(j.message,"error")}},[]),p=o?.sessions??[],c=o?.total??0,_=Math.ceil(c/se);return s.jsxs("div",{className:i.container,"data-testid":"history-view",children:[s.jsxs("div",{className:i.filters,children:[s.jsx(oe,{value:t.query,onChange:l=>d("query",l),placeholder:"Search prompts..."}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Project"}),s.jsx(k,{value:t.project,onChange:l=>d("project",l),options:[{value:"",label:"All"},...h?.map(l=>({value:l.project_path,label:l.project_name}))??[]]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Status"}),s.jsx(k,{value:t.status,onChange:l=>d("status",l),options:[{value:"",label:"All"},{value:"idle",label:"Idle"},{value:"working",label:"Working"},{value:"waiting",label:"Waiting"},{value:"ended",label:"Ended"},{value:"archived",label:"Archived"}]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"From"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateFrom,onChange:l=>d("dateFrom",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"To"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateTo,onChange:l=>d("dateTo",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Sort"}),s.jsx(k,{value:t.sortBy,onChange:l=>d("sortBy",l),options:[{value:"date",label:"Date"},{value:"duration",label:"Activity"},{value:"prompts",label:"Prompts"},{value:"tools",label:"Tools"}]}),s.jsx("button",{className:i.sortToggle,onClick:()=>d("sortDir",t.sortDir==="desc"?"asc":"desc"),children:t.sortDir.toUpperCase()})]})]}),s.jsxs("div",{className:i.results,children:[m&&s.jsx("div",{className:i.emptyState,children:"Loading..."}),!m&&p.length===0&&s.jsx("div",{className:i.emptyState,children:"No sessions found"}),p.map(l=>s.jsx(ft,{session:l,onClick:()=>n(l.id),onResume:y=>x(y,l.id),onDelete:y=>u(y,l.id)},l.id))]}),_>1&&s.jsx(vt,{currentPage:t.page,totalPages:_,onPageChange:l=>d("page",l)}),r&&f&&s.jsx(yt,{detail:f,onClose:()=>n(null)})]})}function mt(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polyline",{points:"1 4 1 10 7 10"}),s.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})}function ft({session:e,onClick:t,onResume:a,onDelete:r}){const n=e.ended_at&&e.started_at?O(e.ended_at-e.started_at):e.started_at?O(Date.now()-e.started_at):"--";return s.jsxs("div",{className:i.row,onClick:t,children:[s.jsx("span",{className:i.rowTitle,children:e.title||e.project_name||e.id}),s.jsx("span",{className:i.rowProject,children:e.project_name}),s.jsx("span",{className:i.rowDate,children:ht(e.started_at)}),s.jsx("span",{className:i.rowDuration,children:n}),s.jsx("span",{className:i.rowStatus,"data-status":e.status,children:e.status.toUpperCase()}),s.jsxs("span",{className:i.rowMeta,children:[e.total_prompts," prompts"]}),s.jsxs("span",{className:i.rowMeta,children:[e.total_tool_calls," tools"]}),s.jsx("button",{className:i.resumeBtn,onClick:a,title:"Resume session","aria-label":"Resume session",children:s.jsx(mt,{})}),s.jsx("button",{className:i.deleteBtn,onClick:r,title:"Delete session","aria-label":"Delete session",children:"x"})]})}function vt({currentPage:e,totalPages:t,onPageChange:a}){const r=[];for(let o=1;o<=t;o++)(o===1||o===t||o>=e-2&&o<=e+2)&&r.push(o);const n=[];let h=0;for(const o of r)typeof o=="number"&&(h&&o-h>1&&n.push("ellipsis"),n.push(o),h=o);return s.jsxs("div",{className:i.pagination,children:[s.jsx("button",{className:i.pageBtn,disabled:e<=1,onClick:()=>a(e-1),children:"Prev"}),n.map((o,m)=>o==="ellipsis"?s.jsx("span",{className:i.pageEllipsis,children:"..."},`e-${m}`):s.jsx("button",{className:`${i.pageBtn} ${o===e?i.pageBtnActive:""}`,onClick:()=>a(o),children:o},o)),s.jsx("button",{className:i.pageBtn,disabled:e>=t,onClick:()=>a(e+1),children:"Next"})]})}function _t({text:e}){const[t,a]=v.useState(!1),r=n=>{n.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})};return s.jsx("button",{className:i.copyBtn,onClick:r,"aria-label":"Copy to clipboard",title:"Copy to clipboard",children:t?"✓":"⎘"})}function yt({detail:e,onClose:t}){const[a,r]=v.useState("conversation"),{session:n,prompts:h,responses:o,tool_calls:m,events:f}=e,d=[...h.map(c=>({type:"prompt",timestamp:c.timestamp,text:c.text})),...o.map(c=>({type:"response",timestamp:c.timestamp,text:c.text_excerpt}))].sort((c,_)=>c.timestamp-_.timestamp),u=[...m.map(c=>({kind:"tool",label:c.tool_name,detail:c.tool_input_summary,timestamp:c.timestamp})),...f.map(c=>({kind:"event",label:c.event_type,detail:c.detail,timestamp:c.timestamp}))].sort((c,_)=>_.timestamp-c.timestamp),x=n.ended_at&&n.started_at?O(n.ended_at-n.started_at):n.started_at?O(Date.now()-n.started_at):"--",p=[{id:"conversation",label:`Conversation (${d.length})`,content:s.jsxs("div",{className:i.detailBody,children:[d.length===0&&s.jsx("div",{className:i.emptyState,children:"No conversation recorded"}),d.map((c,_)=>s.jsxs("div",{className:`${i.convoEntry} ${c.type==="prompt"?i.convoPrompt:i.convoResponse}`,children:[s.jsxs("div",{className:i.convoEntryHeader,children:[s.jsx("div",{className:i.convoTime,children:J(c.timestamp)}),s.jsx(_t,{text:c.text})]}),s.jsx("div",{className:i.convoText,children:c.text})]},_))]})},{id:"activity",label:`Activity (${u.length})`,content:s.jsxs("div",{className:i.detailBody,children:[u.length===0&&s.jsx("div",{className:i.emptyState,children:"No activity recorded"}),u.map((c,_)=>s.jsxs("div",{className:i.activityEntry,children:[s.jsx("span",{className:i.activityTime,children:J(c.timestamp)}),s.jsx("span",{className:`${i.activityBadge} ${c.kind==="tool"?i.activityBadgeTool:i.activityBadgeEvent}`,children:c.label}),s.jsx("span",{className:i.activityDetail,children:c.detail})]},_))]})}];return s.jsx("div",{className:i.detailOverlay,onClick:t,children:s.jsxs("div",{className:i.detailCard,onClick:c=>c.stopPropagation(),children:[s.jsxs("div",{className:i.detailHeader,children:[s.jsxs("div",{children:[s.jsx("h2",{className:i.detailTitle,children:n.project_name||n.id}),s.jsxs("div",{className:i.detailMeta,children:[s.jsxs("span",{children:["Status: ",n.status.toUpperCase()]}),s.jsxs("span",{children:["Model: ",n.model||"--"]}),s.jsxs("span",{children:["Duration: ",x]}),s.jsxs("span",{children:[n.total_prompts," prompts / ",n.total_tool_calls," tools"]})]})]}),s.jsx("button",{className:i.detailCloseBtn,onClick:t,"aria-label":"Close",children:"x"})]}),s.jsx(je,{tabs:p,activeTab:a,onTabChange:r,containerClassName:i.detailTabs,panelClassName:i.detailTabPanel})]})})}export{xt as default};
|
package/dist/client/assets/{ProjectBrowserView-Cx-NqZVI.js → ProjectBrowserView-oRc-gGwv.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o,k as s,A as e,P as l}from"./index-
|
|
1
|
+
import{z as o,k as s,A as e,P as l}from"./index-BtUJHbpO.js";function c(){const[t]=o(),a=t.get("path");if(!a)return s.jsx("div",{className:e.standalone,children:s.jsxs("div",{className:e.standaloneEmpty,children:["No project path specified. Use ",s.jsx("code",{children:"?path=/your/project"})," to open a project."]})});const i=a.split("/").filter(Boolean).pop()||a,n=t.get("file")||void 0;return s.jsxs("div",{className:e.standalone,children:[s.jsxs("div",{className:e.standaloneHeader,children:[s.jsx("span",{className:e.standaloneTitle,children:i}),s.jsx("span",{className:e.standalonePath,children:a})]}),s.jsx("div",{className:e.standaloneContent,children:s.jsx(l,{projectPath:a,initialPath:n,initialIsFile:!!n,persistId:`browser-${a}`})})]})}export{c as default};
|