@crewspaceai/server 2026.418.0-canary.4 → 2026.418.0-canary.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewspaceai/server",
3
- "version": "2026.418.0-canary.4",
3
+ "version": "2026.418.0-canary.5",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/crewspaceai/crewspace",
6
6
  "bugs": {
@@ -28,17 +28,17 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@aws-sdk/client-s3": "^3.888.0",
31
- "@crewspaceai/adapter-claude-local": "2026.418.0-canary.4",
32
- "@crewspaceai/adapter-codex-local": "2026.418.0-canary.4",
33
- "@crewspaceai/adapter-cursor-local": "2026.418.0-canary.4",
34
- "@crewspaceai/adapter-gemini-local": "2026.418.0-canary.4",
35
- "@crewspaceai/adapter-openclaw-gateway": "2026.418.0-canary.4",
36
- "@crewspaceai/adapter-opencode-local": "2026.418.0-canary.4",
37
- "@crewspaceai/adapter-pi-local": "2026.418.0-canary.4",
38
- "@crewspaceai/adapter-utils": "2026.418.0-canary.4",
39
- "@crewspaceai/db": "2026.418.0-canary.4",
40
- "@crewspaceai/plugin-sdk": "2026.418.0-canary.4",
41
- "@crewspaceai/shared": "2026.418.0-canary.4",
31
+ "@crewspaceai/adapter-claude-local": "2026.418.0-canary.5",
32
+ "@crewspaceai/adapter-codex-local": "2026.418.0-canary.5",
33
+ "@crewspaceai/adapter-cursor-local": "2026.418.0-canary.5",
34
+ "@crewspaceai/adapter-gemini-local": "2026.418.0-canary.5",
35
+ "@crewspaceai/adapter-openclaw-gateway": "2026.418.0-canary.5",
36
+ "@crewspaceai/adapter-opencode-local": "2026.418.0-canary.5",
37
+ "@crewspaceai/adapter-pi-local": "2026.418.0-canary.5",
38
+ "@crewspaceai/adapter-utils": "2026.418.0-canary.5",
39
+ "@crewspaceai/db": "2026.418.0-canary.5",
40
+ "@crewspaceai/plugin-sdk": "2026.418.0-canary.5",
41
+ "@crewspaceai/shared": "2026.418.0-canary.5",
42
42
  "ajv": "^8.18.0",
43
43
  "ajv-formats": "^3.0.1",
44
44
  "better-auth": "1.4.18",
@@ -58,7 +58,7 @@
58
58
  "sharp": "^0.34.5",
59
59
  "ws": "^8.19.0",
60
60
  "zod": "^3.24.2",
61
- "hermes-crewspace-adapter": "2026.418.0-canary.4"
61
+ "hermes-crewspace-adapter": "2026.418.0-canary.5"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/express": "^5.0.0",
@@ -0,0 +1 @@
1
+ import{j as e,u as ge}from"./vendor-query-Cn7TC_2z.js";import{R as pt,r as y}from"./vendor-react-DGHjaq9o.js";import{c as dt,H as E,u as g,C as S,a as de,b as xt,d as mt,O as ht,e as ft}from"./vendor-r3f-DFKxAGNv.js";import{ab as w,C as V,ay as le,az as tt,aA as ze,aw as ke,f as C,ag as Re,K as gt,aB as ut,aC as jt,aD as bt,af as yt,ac as wt,D as Mt,am as W,A as St}from"./vendor-three-HM1ZjaBH.js";import{u as vt,a as It,q as ue,i as Pt,h as zt}from"./index-BRdHg4pr.js";import{U as Pe,X as kt,W as Rt,a as At}from"./vendor-ui-DE3UP9jO.js";import"./vendor-editor-C6NiDIhH.js";const R={"ceo-cabin":{x:-18,y:0,z:-12},"scrum-room":{x:-9,y:0,z:-12},"conf-dev":{x:-1,y:0,z:-12},"conf-design":{x:7,y:0,z:-12},"conf-security":{x:15,y:0,z:-12},"conf-qa":{x:23,y:0,z:-12},"conf-product":{x:32,y:0,z:-12},kitchen:{x:-18,y:0,z:0},"conf-ops":{x:-8,y:0,z:0},"collab-area":{x:4,y:0,z:0},"conf-data":{x:15,y:0,z:0},"sleeping-room":{x:27,y:0,z:0},workstations:{x:-6,y:0,z:12},"play-area":{x:16,y:0,z:12},"server-room":{x:28,y:0,z:12},"file-room":{x:38,y:0,z:12},"nike-store":{x:-4,y:0,z:30},"food-court":{x:14,y:0,z:30},"gaming-room":{x:27,y:0,z:30}},$e={"conf-ops":{width:7.5,depth:9},"ceo-cabin":{width:8,depth:7},"scrum-room":{width:7,depth:7},"conf-dev":{width:6,depth:7},"conf-design":{width:6,depth:7},"conf-security":{width:6,depth:7},"conf-qa":{width:7,depth:6},"conf-product":{width:9,depth:7},kitchen:{width:8,depth:7},workstations:{width:28,depth:8},"sleeping-room":{width:10,depth:10},"conf-data":{width:8,depth:7},"play-area":{width:10,depth:8},"server-room":{width:8,depth:8},"file-room":{width:7,depth:7},"collab-area":{width:10,depth:8},"nike-store":{width:14,depth:10},"food-court":{width:14,depth:10},"gaming-room":{width:10,depth:10}},Ae={"ceo-cabin":[{offset:[0,0,.5],rot:Math.PI}],"scrum-room":Array.from({length:6}).map((s,a)=>{const t=a/6*Math.PI*2;return{offset:[Math.cos(t)*1.8,0,Math.sin(t)*1.8],rot:-t+Math.PI}}),"conf-dev":[...[-1,0,1].map(s=>({offset:[s*.9,0,-.9],rot:0})),...[-1,0,1].map(s=>({offset:[s*.9,0,.9],rot:Math.PI}))],"conf-design":[...[-1,0,1].map(s=>({offset:[s*.9,0,-.9],rot:0})),...[-1,0,1].map(s=>({offset:[s*.9,0,.9],rot:Math.PI}))],"conf-security":[...[-1,0,1].map(s=>({offset:[s*.9,0,-.9],rot:0})),...[-1,0,1].map(s=>({offset:[s*.9,0,.9],rot:Math.PI}))],"conf-qa":[...[-1.2,0,1.2].map(s=>({offset:[s,0,-.8],rot:0})),...[-1.2,0,1.2].map(s=>({offset:[s,0,.8],rot:Math.PI})),{offset:[-2.2,0,0],rot:Math.PI/2},{offset:[2.2,0,0],rot:-Math.PI/2}],"conf-data":[...[-1.5,-.5,.5,1.5].map(s=>({offset:[s,0,-1],rot:0})),...[-1.5,-.5,.5,1.5].map(s=>({offset:[s,0,1],rot:Math.PI}))],"conf-ops":[...[-.8,.8].map(s=>({offset:[s,0,-.7],rot:0})),...[-.8,.8].map(s=>({offset:[s,0,.7],rot:Math.PI}))],"conf-product":[...[-2,-.7,.7,2].map(s=>({offset:[s,0,-1.2],rot:0})),...[-2,-.7,.7,2].map(s=>({offset:[s,0,1.2],rot:Math.PI})),{offset:[-3.2,0,0],rot:Math.PI/2},{offset:[3.2,0,0],rot:-Math.PI/2}],workstations:[...[-12.5,-10,-7.5,-5,-2.5,0,2.5,5,7.5,10,12.5].map(s=>({offset:[s,0,-.65],rot:Math.PI})),...[-12.5,-10,-7.5,-5,-2.5,0,2.5,5,7.5,10,12.5].map(s=>({offset:[s,0,.65],rot:0}))],"sleeping-room":[{offset:[-2.3,0,-2],rot:Math.PI},{offset:[2.3,0,-2],rot:Math.PI},{offset:[-2.3,0,2],rot:0},{offset:[2.3,0,2],rot:0}],kitchen:[{offset:[1,0,1],rot:0},{offset:[-1.5,0,1],rot:Math.PI/4},{offset:[-2,0,-2.5],rot:0},{offset:[0,0,1],rot:0}],"play-area":[{offset:[-2.4,0,-1],rot:Math.PI/2},{offset:[.4,0,-1],rot:-Math.PI/2},{offset:[3,0,.8],rot:0},{offset:[-3,0,2],rot:0},{offset:[-1.5,0,2.5],rot:0}],"server-room":[{offset:[0,0,0],rot:0},{offset:[-2,0,0],rot:0},{offset:[2,0,0],rot:0}],"file-room":[{offset:[0,0,0],rot:0},{offset:[-1.5,0,0],rot:0},{offset:[1.5,0,0],rot:0}],"collab-area":[{offset:[-2,0,-1.5],rot:Math.PI/4},{offset:[2,0,-1.5],rot:-Math.PI/4},{offset:[-2,0,1.5],rot:3*Math.PI/4},{offset:[2,0,1.5],rot:-3*Math.PI/4},{offset:[0,0,-2.5],rot:0},{offset:[0,0,2.5],rot:Math.PI},{offset:[-3.5,0,0],rot:Math.PI/2},{offset:[3.5,0,0],rot:-Math.PI/2}],"nike-store":[{offset:[-4,0,-2],rot:0},{offset:[-1,0,-2],rot:0},{offset:[2,0,-2],rot:0},{offset:[5,0,-2],rot:0},{offset:[-4,0,1],rot:Math.PI},{offset:[0,0,1],rot:Math.PI},{offset:[4,0,1],rot:Math.PI}],"food-court":[{offset:[-4,0,-2],rot:0},{offset:[-1.5,0,-2],rot:0},{offset:[1.5,0,-2],rot:0},{offset:[4,0,-2],rot:0},{offset:[-4,0,1.5],rot:Math.PI},{offset:[-1.5,0,1.5],rot:Math.PI},{offset:[1.5,0,1.5],rot:Math.PI},{offset:[4,0,1.5],rot:Math.PI}],"gaming-room":[{offset:[-4,0,-2.5],rot:0},{offset:[-1.5,0,-2.5],rot:0},{offset:[1.5,0,-2.5],rot:0},{offset:[4,0,-2.5],rot:0},{offset:[-2.5,0,2],rot:Math.PI},{offset:[0,0,2],rot:Math.PI},{offset:[2.5,0,2],rot:Math.PI}]},_e=new Set(["done","completed","closed","resolved","cancelled","canceled"]);function st(s){let a=0;for(let t=0;t<s.length;t+=1)a=a*31+s.charCodeAt(t)|0;return Math.abs(a)}function _t(s){switch(s){case"ceo":return"ceo";case"pm":return"pm";case"researcher":return"researcher";case"designer":return"designer";case"security":return"security";case"manager":return"manager";case"developer":return"developer";default:return"engineer"}}function Gt(s,a,t){if(t>0)return"working";const n=a.filter(o=>o.assigneeAgentId===s.id&&!_e.has(o.status.toLowerCase()));return n.length>0?s.role==="ceo"||s.role==="pm"||s.role==="manager"?"meeting":n.length>1?"collaborating":"working":s.lastHeartbeatAt&&Date.now()-new Date(s.lastHeartbeatAt).getTime()>1e3*60*60*12?"sleeping":"idle"}function Ct(s,a,t){if(a==="sleeping")return"sleeping-room";if(a==="shopping")return"nike-store";if(a==="playing")return"gaming-room";if(a==="eating")return"food-court";if(a==="standing-up")return"kitchen";if(a==="meeting")return s==="ceo"?"ceo-cabin":t%2===0?"scrum-room":"conf-product";if(a==="collaborating")return s==="researcher"?"conf-data":s==="security"?"conf-security":s==="designer"?"conf-design":"collab-area";if(a==="working")return s==="ceo"?"ceo-cabin":s==="pm"||s==="manager"?t%2===0?"scrum-room":"conf-product":s==="researcher"?"conf-data":s==="designer"?"conf-design":s==="security"?"conf-security":t%4===0?"server-room":"workstations";const n=["kitchen","play-area","collab-area","nike-store","food-court","gaming-room"];return n[t%n.length]}function Ot(s,a){const t=R[s],n=Ae[s],r=n[a%n.length];return[t.x+r.offset[0],r.offset[1],t.z+r.offset[2]]}function Tt(s,a,t){const n=Ae[s],r=a.get(s)??[];if(s==="workstations"){const o=t%n.length;if(!r.includes(o))return o}for(let o=0;o<n.length;o+=1)if(!r.includes(o))return o;return t%n.length}function Et(s,a){var r;const n=a.filter(o=>o.assigneeAgentId===s.id).sort((o,c)=>new Date(c.updatedAt).getTime()-new Date(o.updatedAt).getTime()).find(o=>!_e.has(o.status.toLowerCase()));return n?n.title:s.title?s.title:s.capabilities?((r=s.capabilities.split(",")[0])==null?void 0:r.trim())??"Monitoring":"Standing by"}function Lt(s,a){const t=s.filter(o=>a.get(o.id)==="idle");if(t.length===0)return a;const n=["sleeping","shopping","playing","eating","collaborating","standing-up","idle"],r=new Map(a);return t.forEach((o,c)=>{const i=st(o.id)%n.length;r.set(o.id,n[i])}),r}function Ft(s,a){const t=new Map,n=new Map(a.map(l=>[l.id,l])),r=new Map;for(const l of s.liveRuns)r.set(l.agentId,(r.get(l.agentId)??0)+1);const o=new Map;for(const l of s.agents){const i=r.get(l.id)??0,p=Gt(l,s.issues,i);o.set(l.id,p)}const c=Lt(s.agents,o);return[...s.agents].sort((l,i)=>l.name.localeCompare(i.name)).map(l=>{const i=st(l.id),p=_t(l.role),u=r.get(l.id)??0,m=c.get(l.id)??"idle",j=Ct(p,m,i),b=Tt(j,t,i);t.set(j,[...t.get(j)??[],b]);const ee=Ot(j,b),v=n.get(l.id),T=(v==null?void 0:v.position)??ee,re=s.issues.filter(N=>N.assigneeAgentId===l.id&&!_e.has(N.status.toLowerCase())).length;return{id:l.id,name:l.name,role:p,backendRole:l.role,title:l.title,status:m,backendStatus:l.status,currentRoom:j,targetRoom:j,position:T,targetPosition:ee,waypoints:[],task:Et(l,s.issues),stateTimer:0,isSitting:m!=="idle"&&m!=="walking"&&m!=="standing-up"&&m!=="shopping"&&m!=="playing"&&m!=="eating",seatIndex:b,standUpTimer:0,assignedWorkstation:j==="workstations"?b:-1,capabilities:l.capabilities,liveRunCount:u,openIssueCount:re,lastHeartbeatAt:l.lastHeartbeatAt,reportsTo:l.reportsTo,urlKey:l.urlKey}})}const I=dt(s=>({agents:[],officeAgents:[],issues:[],selectedAgentId:null,isNightMode:!1,liveMode:!1,selectAgent:a=>s({selectedAgentId:a}),toggleNightMode:()=>s(a=>({isNightMode:!a.isNightMode})),setBackendSnapshot:a=>s(t=>{const n=Ft(a,t.agents),r=t.selectedAgentId&&n.some(o=>o.id===t.selectedAgentId);return{agents:n,officeAgents:n,issues:a.issues,liveMode:!0,selectedAgentId:r?t.selectedAgentId:null}})}));function $t(s,a){if(Object.is(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;if(s instanceof Map&&a instanceof Map){if(s.size!==a.size)return!1;for(const[n,r]of s)if(!Object.is(r,a.get(n)))return!1;return!0}if(s instanceof Set&&a instanceof Set){if(s.size!==a.size)return!1;for(const n of s)if(!a.has(n))return!1;return!0}const t=Object.keys(s);if(t.length!==Object.keys(a).length)return!1;for(const n of t)if(!Object.prototype.hasOwnProperty.call(a,n)||!Object.is(s[n],a[n]))return!1;return!0}const{useRef:Dt}=pt;function ot(s){const a=Dt();return t=>{const n=s(t);return $t(a.current,n)?a.current:a.current=n}}const oe=2.5,q=.12,Q=1.5,F=2.2,je=new Map;function J(s,a=.7){const t=`${s}|${a}`;return je.has(t)||je.set(t,new w({color:s,roughness:a})),je.get(t)}const Y=({args:s,position:a,color:t})=>{const[n,r,o]=s,c=n/2,l=r/2,i=o/2,p=.08,u=J(t,.6);return e.jsxs("group",{position:a,children:[e.jsxs("mesh",{position:[c-p/2,0,i-p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,r,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[-c+p/2,0,i-p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,r,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[c-p/2,0,-i+p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,r,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[-c+p/2,0,-i+p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,r,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[0,l-p/2,i-p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[n-p,p,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[0,l-p/2,-i+p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[n-p,p,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[c-p/2,l-p/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,p,o-p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[-c+p/2,l-p/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,p,o-p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[0,-l+p/2,i-p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[n-p,p,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[0,-l+p/2,-i+p/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[n-p,p,p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[c-p/2,-l+p/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,p,o-p]}),e.jsx("primitive",{object:u,attach:"material"})]}),e.jsxs("mesh",{position:[-c+p/2,-l+p/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[p,p,o-p]}),e.jsx("primitive",{object:u,attach:"material"})]})]})};function De(s,a){const t=[...a].sort((c,l)=>c-l),n=[];let r=-s;for(const c of t){const l=c-Q/2-r;l>.1&&n.push({x:r+l/2,w:l}),r=c+Q/2}const o=s-r;return o>.1&&n.push({x:r+o/2,w:o}),n}const Ne=({dc:s,z:a,color:t})=>e.jsxs("group",{children:[e.jsxs("mesh",{position:[s,F+.06,a],children:[e.jsx("boxGeometry",{args:[Q+.2,.12,.15]}),e.jsx("primitive",{object:J(t),attach:"material"})]}),e.jsxs("mesh",{position:[s-Q/2-.05,F/2,a],children:[e.jsx("boxGeometry",{args:[.1,F,.15]}),e.jsx("primitive",{object:J(t),attach:"material"})]}),e.jsxs("mesh",{position:[s+Q/2+.05,F/2,a],children:[e.jsx("boxGeometry",{args:[.1,F,.15]}),e.jsx("primitive",{object:J(t),attach:"material"})]}),e.jsx(Y,{args:[Q,oe-F-.12,q],position:[s,F+(oe-F)/2+.06,a],color:t})]}),Nt=({position:s,width:a,depth:t,accentColor:n,label:r,wallHeight:o=oe,doorOffsets:c=[0],backDoorOffsets:l=[]})=>{const i=a/2,p=t/2,u=y.useMemo(()=>De(i,c),[i,c]),m=y.useMemo(()=>l.length>0?De(i,l):null,[i,l]);return e.jsxs("group",{position:s,children:[e.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.03,0],receiveShadow:!0,children:[e.jsx("planeGeometry",{args:[a,t]}),e.jsx("primitive",{object:J("#8a7a68",.92),attach:"material"})]}),m?e.jsxs(e.Fragment,{children:[m.map((j,b)=>e.jsx(Y,{args:[j.w,oe,q],position:[j.x,oe/2,-p],color:n},b)),[...l].map((j,b)=>e.jsx(Ne,{dc:j,z:-p,color:n},b))]}):e.jsx(Y,{args:[a,o,q],position:[0,o/2,-p],color:n}),e.jsx(Y,{args:[q,o,t],position:[-i,o/2,0],color:n}),e.jsx(Y,{args:[q,o,t],position:[i,o/2,0],color:n}),u.map((j,b)=>e.jsx(Y,{args:[j.w,o,q],position:[j.x,o/2,p],color:n},b)),c.map((j,b)=>e.jsx(Ne,{dc:j,z:p,color:n},b)),e.jsxs("mesh",{position:[0,.04,p],children:[e.jsx("boxGeometry",{args:[a,.03,.12]}),e.jsx("primitive",{object:J(n,.7),attach:"material"})]}),e.jsx(E,{position:[0,o+.7,0],center:!0,distanceFactor:20,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"11px",letterSpacing:"0.08em",padding:"2px 10px",borderRadius:"5px",color:"#5a4a3a",background:"#faf5ee",border:`2px solid ${n}`,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",fontWeight:600,fontFamily:"system-ui",whiteSpace:"nowrap"},children:r})})]})},We=y.memo(Nt);g.preload("/models/programmer_desktop_3d_pc.glb");g.preload("/models/chair.glb");g.preload("/models/monitor.glb");g.preload("/models/table.glb");g.preload("/models/table-round.glb");g.preload("/models/sofa.glb");g.preload("/models/whiteboard.glb");g.preload("/models/server-rack.glb");g.preload("/models/filing-cabinet.glb");g.preload("/models/office_chair (4).glb");g.preload("/models/simple_bunk_bed.glb");g.preload("/models/rhyzome_plant.glb");g.preload("/models/agent-figure.glb");g.preload("/models/movie_sonic_sonic_rumble.glb");const $=["#cc2222","#1144cc","#111111","#ee8800","#22aa55","#ffffff","#8800aa","#cc5500"],be=new Map,ye=new Map;function h(s,...a){const t=`${s}:${a}`;return be.has(t)||be.set(t,s==="box"?new le(...a):s==="cyl"?new tt(...a):new ze(...a)),be.get(t)}function f(s,a=.75,t,n=0){const r=`${s}|${a}|${t??""}`;if(!ye.has(r)){const o=new w({color:s,roughness:a});t&&(o.emissive=new V(t),o.emissiveIntensity=n),ye.set(r,o)}return ye.get(r)}const M=({pos:s,rot:a=0})=>{const{scene:t}=g("/models/chair.glb");return e.jsx(S,{object:t,position:s,rotation:[0,a,0]})},ie=({pos:s,rot:a=0})=>{const{scene:t}=g("/models/monitor.glb");return e.jsx(S,{object:t,position:s,rotation:[0,a,0]})},Wt=({pos:s})=>{const a=new le(.35,.02,.15),t=new w({color:"#1a1a1a",metalness:.3,roughness:.7});return e.jsx("mesh",{geometry:a,material:t,position:s})},Kt=({pos:s})=>{const a=new ze(.03,16,16),t=new w({color:"#2a2a2a",metalness:.2,roughness:.6});return e.jsx("mesh",{geometry:a,material:t,position:s})},Ke=({pos:s,rot:a=0})=>{const t=new le(.5,.35,.03),n=new le(.35,.25,.03),r=new w({color:"#0f0f0f",emissive:"#1a1a1a",metalness:.15,roughness:.85}),o=new w({color:"#2a2a2a",metalness:.4,roughness:.6});return e.jsxs("group",{position:s,rotation:[0,a,0],children:[e.jsx("mesh",{geometry:t,material:r,position:[0,.2,0],rotation:[.08,0,0]}),e.jsx("mesh",{geometry:n,material:r,position:[-.3,.15,-.08],rotation:[.1,.25,0]}),e.jsx("mesh",{geometry:n,material:r,position:[.3,.15,-.08],rotation:[.1,-.25,0]}),e.jsxs("mesh",{position:[0,.05,0],children:[e.jsx("cylinderGeometry",{args:[.08,.1,.1,8]}),e.jsx("meshStandardMaterial",{...o})]}),e.jsxs("mesh",{position:[-.3,.04,-.08],children:[e.jsx("cylinderGeometry",{args:[.06,.07,.08,8]}),e.jsx("meshStandardMaterial",{...o})]}),e.jsxs("mesh",{position:[.3,.04,-.08],children:[e.jsx("cylinderGeometry",{args:[.06,.07,.08,8]}),e.jsx("meshStandardMaterial",{...o})]}),e.jsx(Wt,{pos:[-.15,.01,.2]}),e.jsx(Kt,{pos:[.15,.015,.18]})]})},P=({pos:s,size:a=[2,.06,1]})=>{const{scene:t}=g("/models/table.glb");return e.jsx(S,{object:t,position:s,scale:[a[0]/2,1,a[2]]})},Ht=({pos:s})=>{const{scene:a}=g("/models/table-round.glb");return e.jsx(S,{object:a,position:s})},K=({pos:s,rot:a=0})=>{const{scene:t}=g("/models/sofa.glb");return e.jsx(S,{object:t,position:s,rotation:[0,a,0]})},H=({pos:s,rot:a=0})=>{const{scene:t}=g("/models/whiteboard.glb");return e.jsx(S,{object:t,position:s,rotation:[0,a,0]})},Bt=({pos:s})=>{const{scene:a}=g("/models/simple_bunk_bed.glb");return e.jsx(S,{object:a,position:s,scale:.18})},Z=({pos:s,rot:a=0,scale:t=1})=>{const{scene:n}=g("/models/rhyzome_plant.glb");return e.jsx(S,{object:n,position:s,rotation:[0,a,0],scale:t})},He=({pos:s})=>{const{scene:a}=g("/models/server-rack.glb");return e.jsx(S,{object:a,position:s})},we=({pos:s})=>{const{scene:a}=g("/models/filing-cabinet.glb");return e.jsx(S,{object:a,position:s})},Zt=({tablePos:s})=>{const a=y.useRef(null),n=I(r=>r.officeAgents).filter(r=>r.currentRoom==="play-area"&&r.seatIndex<=1&&r.status!=="walking"&&r.status!=="standing-up").length>=2;return de(()=>{if(!a.current||(a.current.visible=n,!n))return;const r=Date.now()*.003;a.current.position.set(s[0]+Math.sin(r)*.9,Math.abs(Math.sin(r*2))*.15+.72,s[2]+Math.sin(r*.7)*.15)}),e.jsx("mesh",{ref:a,geometry:h("sph",.02,6,5),material:f("#ff8800",.5)})},pe="#88ccee",te=({pos:s,w:a,h:t})=>e.jsx("mesh",{position:s,geometry:h("box",a,t,.01),material:f(pe,.4,pe,.1)}),se=({pos:s,rot:a=0})=>{const{scene:t}=g("/models/agent-figure.glb");return e.jsx(S,{object:t,position:s,rotation:[0,a,0],scale:.25})},Ut=({pos:s,rot:a=0})=>{const{scene:t}=g("/models/movie_sonic_sonic_rumble.glb");return e.jsx(S,{object:t,position:s,rotation:[0,a,0],scale:1.1})},Xt=({roomId:s,position:a})=>{const[t,n,r]=a;switch(s){case"ceo-cabin":return e.jsxs("group",{children:[e.jsx("mesh",{position:[t,.55,r-1],geometry:h("box",2.2,.07,.8),material:f("#8b5e3c",.6),castShadow:!0}),e.jsx(ie,{pos:[t-.35,.87,r-1.2]}),e.jsx(ie,{pos:[t+.35,.87,r-1.2]}),e.jsx(K,{pos:[t-2.5,n,r+1.5],rot:Math.PI/2}),e.jsx(we,{pos:[t+3,n,r-.5]}),e.jsx("mesh",{position:[t,1.4,r-3.2],geometry:h("box",2.4,1.3,.06),material:f("#1a1a25",.5)}),e.jsx(te,{pos:[t,1.4,r-3.16],w:2.2,h:1.1})]});case"scrum-room":return e.jsxs("group",{children:[e.jsx(Ht,{pos:[t,n,r]}),Array.from({length:6}).map((o,c)=>{const l=c/6*Math.PI*2;return e.jsx(M,{pos:[t+Math.cos(l)*1.8,n,r+Math.sin(l)*1.8],rot:-l+Math.PI},c)}),e.jsx(H,{pos:[t,n,r-3.2]})]});case"conf-dev":case"conf-design":case"conf-security":return e.jsxs("group",{children:[e.jsx(P,{pos:[t,n,r],size:[2.5,.06,1]}),[-1,0,1].map(o=>e.jsx(M,{pos:[t+o*.9,n,r-.9]},`t${o}`)),[-1,0,1].map(o=>e.jsx(M,{pos:[t+o*.9,n,r+.9],rot:Math.PI},`b${o}`)),e.jsx(te,{pos:[t,1.3,r-3.17],w:1.85,h:1.05})]});case"conf-qa":return e.jsxs("group",{children:[e.jsx(P,{pos:[t,n,r],size:[3,.06,1.2]}),[-1.2,0,1.2].map(o=>e.jsx(M,{pos:[t+o,n,r-.8]},`t${o}`)),[-1.2,0,1.2].map(o=>e.jsx(M,{pos:[t+o,n,r+.8],rot:Math.PI},`b${o}`)),e.jsx(M,{pos:[t-2.2,n,r],rot:Math.PI/2}),e.jsx(M,{pos:[t+2.2,n,r],rot:-Math.PI/2}),e.jsx(H,{pos:[t,n,r-2.7]})]});case"conf-data":return e.jsxs("group",{children:[e.jsx(P,{pos:[t,n,r],size:[3.5,.06,1.4]}),[-1.5,-.5,.5,1.5].map(o=>e.jsx(M,{pos:[t+o,n,r-1]},`t${o}`)),[-1.5,-.5,.5,1.5].map(o=>e.jsx(M,{pos:[t+o,n,r+1],rot:Math.PI},`b${o}`)),e.jsx(H,{pos:[t+3.5,n,r],rot:-Math.PI/2})]});case"conf-ops":return e.jsxs("group",{children:[e.jsx(P,{pos:[t,n,r],size:[2,.06,.9]}),[-.8,.8].map(o=>e.jsx(M,{pos:[t+o,n,r-.7]},`t${o}`)),[-.8,.8].map(o=>e.jsx(M,{pos:[t+o,n,r+.7],rot:Math.PI},`b${o}`))]});case"conf-product":return e.jsxs("group",{children:[e.jsx(P,{pos:[t,n,r],size:[4.5,.06,1.6]}),[-2,-.7,.7,2].map(o=>e.jsx(M,{pos:[t+o,n,r-1.2]},`t${o}`)),[-2,-.7,.7,2].map(o=>e.jsx(M,{pos:[t+o,n,r+1.2],rot:Math.PI},`b${o}`)),e.jsx(M,{pos:[t-3.2,n,r],rot:Math.PI/2}),e.jsx(M,{pos:[t+3.2,n,r],rot:-Math.PI/2}),e.jsx(te,{pos:[t,1.4,r-3.17],w:3.3,h:1.35}),e.jsx(H,{pos:[t-4,n,r],rot:Math.PI/2}),e.jsx(H,{pos:[t+4,n,r],rot:-Math.PI/2})]});case"workstations":return e.jsxs("group",{children:[[-12.5,-10,-7.5,-5,-2.5,0,2.5,5,7.5,10,12.5].map((o,c)=>e.jsxs("group",{children:[e.jsx(P,{pos:[t+o,n,r-2.1],size:[2.4,.06,1.1]}),e.jsx(Ke,{pos:[t+o,.73,r-2.1],rot:0})]},`ws1${c}`)),[-12.5,-10,-7.5,-5,-2.5,0,2.5,5,7.5,10,12.5].map((o,c)=>e.jsxs("group",{children:[e.jsx(P,{pos:[t+o,n,r+2.1],size:[2.4,.06,1.1]}),e.jsx(Ke,{pos:[t+o,.73,r+2.1],rot:0})]},`ws2${c}`)),e.jsx(H,{pos:[t+12.5,n,r-3.8]}),e.jsx(H,{pos:[t-12.5,n,r-3.8]})]});case"sleeping-room":return e.jsx("group",{children:[[-2.3,-2],[2.3,-2],[-2.3,2],[2.3,2]].map(([o,c],l)=>e.jsx(Bt,{pos:[t+o,n,r+c]},l))});case"server-room":return e.jsxs("group",{children:[[-3,-2,-1,0,1,2,3].map((o,c)=>e.jsx(He,{pos:[t+o,n,r-2]},`sb${c}`)),[-3,-2,-1,0,1,2,3].map((o,c)=>e.jsx(He,{pos:[t+o,n,r+2]},`sf${c}`))]});case"file-room":return e.jsxs("group",{children:[[-2.5,-1.5,-.5,.5,1.5,2.5].map((o,c)=>e.jsx(we,{pos:[t+o,n,r-2.5]},`fb${c}`)),[-2.5,-1.5,-.5,.5,1.5,2.5].map((o,c)=>e.jsx(we,{pos:[t+o,n,r+2.5]},`ff${c}`)),e.jsx(P,{pos:[t,n,r],size:[2.5,.06,.8]}),e.jsx(M,{pos:[t-.5,n,r+.6],rot:Math.PI}),e.jsx(M,{pos:[t+.5,n,r+.6],rot:Math.PI})]});case"kitchen":return e.jsxs("group",{children:[e.jsx("mesh",{position:[t-2,.5,r-2.5],geometry:h("box",3,.8,.5),material:f("#c8a878",.75),castShadow:!0}),e.jsx(K,{pos:[t+1,n,r+1]}),e.jsx(K,{pos:[t-1.5,n,r+1],rot:Math.PI/4}),e.jsx(P,{pos:[t,n,r+1],size:[.8,.04,.5]}),e.jsx(Z,{pos:[t+3.5,n,r-2.5],rot:.5,scale:.8}),e.jsx(Z,{pos:[t-3.5,n,r+2.5],rot:-.8,scale:.6})]});case"play-area":return e.jsxs("group",{children:[e.jsx(P,{pos:[t-1,n,r-1],size:[2.5,.05,1.4]}),e.jsx("mesh",{position:[t-1,.7,r-1],geometry:h("box",.03,.15,1.4),material:f("#ffffff",.5)}),e.jsx(Zt,{tablePos:[t-1,0,r-1]}),e.jsx(K,{pos:[t+2,n,r+2]})]});case"collab-area":return e.jsxs("group",{children:[e.jsx(Z,{pos:[t+4.5,n,r-3.5],rot:1.2,scale:.9}),e.jsx(Z,{pos:[t-4.5,n,r+3.5],rot:-.6,scale:.75}),e.jsx("mesh",{position:[t,.35,r],geometry:h("cyl",.8,.8,.04,16),material:f("#c8a878",.75),castShadow:!0}),[[-2.5,-2],[2.5,-2],[-2.5,2],[2.5,2]].map(([o,c],l)=>e.jsxs("group",{position:[t+o,0,r+c],rotation:[0,l*Math.PI/2,0],children:[e.jsx("mesh",{position:[0,.25,0],geometry:h("box",1.4,.15,.6),material:f(["#d4a574","#b8956a","#c49868","#dab882"][l],.85),castShadow:!0}),e.jsx("mesh",{position:[0,.45,-.25],geometry:h("box",1.4,.3,.1),material:f(["#c49868","#a88558","#b89060","#caa878"][l],.85),castShadow:!0})]},l)),e.jsx("mesh",{position:[t,1.3,r-3.5],geometry:h("box",2.5,1.5,.08),material:f("#f8f8f0",.4),castShadow:!0})]});case"nike-store":return e.jsxs("group",{children:[e.jsx("mesh",{position:[t,1.5,r-4.28],geometry:h("box",13,3,.06),material:f("#f8f5f0",.4),castShadow:!0}),[.55,1.1,1.65,2.2].map((o,c)=>e.jsx("mesh",{position:[t,o,r-4.08],geometry:h("box",12.5,.05,.42),material:f("#ddd8cc",.65),castShadow:!0},`bshelf${c}`)),[-5,-3,-1,1,3,5].map((o,c)=>[.65,1.2,1.75,2.3].map((l,i)=>e.jsxs("group",{position:[t+o,l,r-3.9],children:[e.jsx("mesh",{geometry:h("box",.36,.05,.14),position:[0,0,0],material:f("#111111",.7)}),e.jsx("mesh",{geometry:h("box",.28,.13,.12),position:[.02,.09,0],material:f($[(c+i*2)%$.length],.6)}),e.jsx("mesh",{geometry:h("box",.1,.08,.12),position:[.15,.05,0],material:f($[(c+i*2)%$.length],.55)}),e.jsx("mesh",{geometry:h("box",.08,.16,.1),position:[-.15,.1,0],material:f("#ffffff",.7)})]},`ws${c}_${i}`))),e.jsx("mesh",{position:[t-6.85,1.1,r-.5],geometry:h("box",.06,2,6),material:f("#eeebe4",.5),castShadow:!0}),[.45,.9,1.35,1.8].map((o,c)=>e.jsx("mesh",{position:[t-6.65,o,r-.5],geometry:h("box",.22,.04,5.6),material:f("#d4ccc0",.7),castShadow:!0},`lshelf${c}`)),[-2,-.8,.4,1.6,2.8].map((o,c)=>[.5,1,1.5].map((l,i)=>e.jsxs("group",{position:[t-6.6,l,r+o-.5],children:[e.jsx("mesh",{geometry:h("box",.18,.2,.3),material:f($[(c+i*3)%$.length],.65)}),e.jsx("mesh",{geometry:h("box",.16,.02,.28),position:[0,.11,0],material:f("#ffffff",.75)})]},`lbox${c}_${i}`))),e.jsx(P,{pos:[t,n,r-1],size:[4,.08,1.2]}),[-1.2,0,1.2].map((o,c)=>e.jsxs("group",{position:[t+o,.73,r-1],children:[e.jsx("mesh",{geometry:h("cyl",.15,.2,.06,12),position:[0,-.03,0],material:f("#ffffff",.4)}),e.jsx("mesh",{geometry:h("box",.42,.06,.16),position:[0,0,0],material:f("#111111",.7)}),e.jsx("mesh",{geometry:h("box",.32,.15,.14),position:[.02,.1,0],material:f($[c*2],.6)}),e.jsx("mesh",{geometry:h("box",.12,.09,.14),position:[.17,.06,0],material:f($[c*2],.55)}),e.jsx("mesh",{geometry:h("box",.1,.18,.12),position:[-.17,.12,0],material:f("#ffffff",.7)})]},`feat${c}`)),e.jsx(E,{position:[t,1.55,r-1],center:!0,distanceFactor:18,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"6px",background:"#cc2222",color:"#fff",padding:"1px 8px",borderRadius:"2px",fontFamily:"monospace",fontWeight:800,letterSpacing:"0.12em",whiteSpace:"nowrap"},children:"NEW ARRIVALS"})}),e.jsx("mesh",{position:[t-3.5,.44,r+1.5],geometry:h("box",3.5,.12,.55),material:f("#c8a070",.85),castShadow:!0}),[-1,0,1].map((o,c)=>e.jsx("mesh",{position:[t-3.5+o,.22,r+1.5],geometry:h("box",.12,.44,.5),material:f("#8a5a28",.9),castShadow:!0},`bs${c}`)),e.jsx(K,{pos:[t+2.5,n,r+3.5],rot:Math.PI}),e.jsx(P,{pos:[t-.5,n,r+3.5],size:[.8,.04,.5]}),e.jsx("mesh",{position:[t+5.6,.52,r+.5],geometry:h("box",1.8,.88,3.5),material:f("#1a1a25",.5),castShadow:!0}),e.jsx("mesh",{position:[t+5.6,.97,r+.5],geometry:h("box",1.85,.06,3.55),material:f("#2a2a38",.4),castShadow:!0}),e.jsx(ie,{pos:[t+5.6,1,r-.6]}),e.jsx("mesh",{position:[t+5.6,.62,r-.8],geometry:h("box",.9,.08,.35),material:f("#333344",.5),castShadow:!0}),e.jsx("mesh",{position:[t+5.6,1.04,r+.1],geometry:h("box",.18,.12,.28),material:f("#111111",.5),castShadow:!0}),e.jsx("mesh",{position:[t+5.6,1.04,r+.1],geometry:h("box",.14,.02,.22),material:f(pe,.3,pe,.15)}),e.jsx(E,{position:[t+5.6,1.6,r+.5],center:!0,distanceFactor:20,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"7px",background:"#cc2222",color:"#fff",padding:"1px 6px",borderRadius:"2px",fontFamily:"monospace",letterSpacing:"0.1em",fontWeight:700,whiteSpace:"nowrap"},children:"PAY HERE"})}),[r+1.8,r+.9,r+0].map((o,c)=>e.jsxs("group",{children:[e.jsxs("mesh",{position:[t+3.8,.5,o],children:[e.jsx("cylinderGeometry",{args:[.04,.06,1,8]}),e.jsx("meshStandardMaterial",{color:"#c8a020",metalness:.6,roughness:.3})]}),e.jsxs("mesh",{position:[t+3.8,.02,o],children:[e.jsx("cylinderGeometry",{args:[.18,.18,.04,12]}),e.jsx("meshStandardMaterial",{color:"#c8a020",metalness:.5})]})]},`q${c}`)),e.jsxs("mesh",{position:[t+3.8,.5,r+1.35],children:[e.jsx("boxGeometry",{args:[.03,.03,.9]}),e.jsx("meshStandardMaterial",{color:"#8a2020",roughness:.6})]}),e.jsxs("mesh",{position:[t+3.8,.5,r+.45],children:[e.jsx("boxGeometry",{args:[.03,.03,.9]}),e.jsx("meshStandardMaterial",{color:"#8a2020",roughness:.6})]}),e.jsx(se,{pos:[t-2,n,r-3],rot:.4}),e.jsx(se,{pos:[t-4,n,r-2.5],rot:Math.PI+.2}),e.jsx(se,{pos:[t+1.5,n,r-.5],rot:Math.PI+.3}),e.jsx(se,{pos:[t-.5,n,r+.2],rot:.1}),e.jsx(se,{pos:[t+5.6,n,r+1.8],rot:Math.PI})]});case"food-court":return e.jsxs("group",{children:[e.jsx(Ut,{pos:[t-4.5,n,r+3],rot:.6}),[-5,0,5].map((o,c)=>e.jsxs("group",{children:[e.jsx("mesh",{position:[t+o,.7,r-4.2],geometry:h("box",2.8,1.2,.7),material:f(["#e87d3e","#4a8ad4","#4aa84a"][c],.6),castShadow:!0}),e.jsx("mesh",{position:[t+o,1.4,r-4.2],geometry:h("box",2.8,.06,.7),material:f("#f0ece4",.7),castShadow:!0}),e.jsx(ie,{pos:[t+o,1.1,r-3.85]})]},`kiosk${c}`)),[-4,-1.5,1.5,4].map((o,c)=>e.jsxs("group",{children:[e.jsx(P,{pos:[t+o,n,r-1.5],size:[1.2,.05,.7]}),e.jsx(M,{pos:[t+o,n,r-2.1]}),e.jsx(M,{pos:[t+o,n,r-.9],rot:Math.PI})]},`table${c}`)),[-4,-1.5,1.5,4].map((o,c)=>e.jsxs("group",{children:[e.jsx(P,{pos:[t+o,n,r+1.8],size:[1.2,.05,.7]}),e.jsx(M,{pos:[t+o,n,r+1.2]}),e.jsx(M,{pos:[t+o,n,r+2.4],rot:Math.PI})]},`table2${c}`)),[-4,0,4].map((o,c)=>e.jsxs("group",{children:[e.jsx("mesh",{position:[t+o,1.3,r+1.8],geometry:h("cyl",.05,.05,2.6,6),material:f("#888888",.5)}),e.jsx("mesh",{position:[t+o,2.65,r+1.8],geometry:h("cyl",1.6,.2,.12,12),material:f(["#cc2222","#2255cc","#22aa44"][c],.7)})]},`umb${c}`))]});case"gaming-room":return e.jsxs("group",{children:[e.jsx(Z,{pos:[t-5.5,n,r+4],rot:.3,scale:.7}),e.jsx(Z,{pos:[t+5.5,n,r+4],rot:-.5,scale:.7}),[-4.5,-2,.5,3].map((o,c)=>e.jsxs("group",{children:[e.jsx("mesh",{position:[t+o,.8,r-4.2],geometry:h("box",.8,1.6,.5),material:f(["#cc2222","#2244cc","#22aa44","#cc8800"][c],.6),castShadow:!0}),e.jsx(te,{pos:[t+o,1.1,r-3.94],w:.6,h:.55}),e.jsx("mesh",{position:[t+o,.52,r-3.97],geometry:h("cyl",.04,.04,.12,8),material:f("#222222",.5)}),e.jsx("mesh",{position:[t+o,.6,r-3.97],geometry:h("sph",.06,8,8),material:f("#cc2222",.5)})]},`arcade${c}`)),e.jsx("mesh",{position:[t+4.5,1.5,r-4.8],geometry:h("box",2.8,1.8,.1),material:f("#1a1a25",.5),castShadow:!0}),e.jsx(te,{pos:[t+4.5,1.5,r-4.74],w:2.6,h:1.6}),[-4,-1.5,.5,2.5].map((o,c)=>e.jsx("mesh",{position:[t+o,.2,r-2.5],geometry:h("sph",.38,10,10),material:f(["#cc2222","#2244cc","#22aa44","#cc8800"][c],.9)},`bean${c}`)),e.jsx(K,{pos:[t-2.5,n,r+2.5],rot:Math.PI}),e.jsx(K,{pos:[t+1.5,n,r+2.5],rot:Math.PI}),e.jsx(P,{pos:[t-.5,n,r+1.5],size:[1.4,.04,.5]})]});default:return null}},Be=y.memo(Xt,(s,a)=>s.roomId===a.roomId&&s.position[0]===a.position[0]&&s.position[2]===a.position[2]);g.preload("/models/plant-small.glb");g.preload("/models/plant-tall.glb");g.preload("/models/plant-hanging.glb");const k=({pos:s,scale:a=1})=>{const{scene:t}=g("/models/plant-small.glb");return e.jsx(S,{object:t,position:s,scale:a})},A=({pos:s})=>{const{scene:a}=g("/models/plant-tall.glb");return e.jsx(S,{object:a,position:s})},Me=({pos:s})=>{const{scene:a}=g("/models/plant-hanging.glb");return e.jsx(S,{object:a,position:s})},qt=()=>{const s=R["ceo-cabin"],a=R["scrum-room"],t=R["conf-dev"],n=R["conf-design"],r=R["conf-security"],o=R.workstations,c=R["sleeping-room"],l=R.kitchen,i=R["play-area"];return e.jsxs("group",{children:[e.jsx(A,{pos:[s.x+3.5,0,s.z-3]}),e.jsx(k,{pos:[s.x-3.5,0,s.z-3]}),e.jsx(k,{pos:[a.x+3,0,a.z-3],scale:.8}),e.jsx(k,{pos:[a.x-3,0,a.z-3],scale:.8}),e.jsx(k,{pos:[t.x+2.5,0,t.z-3],scale:.8}),e.jsx(k,{pos:[n.x-2.5,0,n.z-3],scale:.8}),e.jsx(k,{pos:[r.x+2.5,0,r.z-3],scale:.8}),e.jsx(A,{pos:[o.x-10.5,0,o.z-3.5]}),e.jsx(A,{pos:[o.x+10.5,0,o.z-3.5]}),e.jsx(A,{pos:[o.x-10.5,0,o.z+3.5]}),e.jsx(A,{pos:[o.x+10.5,0,o.z+3.5]}),e.jsx(k,{pos:[c.x+3.5,0,c.z-3.5]}),e.jsx(k,{pos:[c.x-3.5,0,c.z-3.5]}),e.jsx(A,{pos:[l.x+3.5,0,l.z-3.5]}),e.jsx(k,{pos:[l.x+3.5,0,l.z+3.5]}),e.jsx(A,{pos:[i.x+4.5,0,i.z-3.5]}),e.jsx(k,{pos:[i.x-4.5,0,i.z+3.5]}),e.jsx(A,{pos:[-12,0,-16]}),e.jsx(A,{pos:[10,0,-16]}),e.jsx(A,{pos:[26,0,-16]}),e.jsx(k,{pos:[-22,0,-8]}),e.jsx(k,{pos:[26,0,-8]}),e.jsx(k,{pos:[-22,0,2]}),e.jsx(k,{pos:[26,0,2]}),e.jsx(A,{pos:[-22,0,10]}),e.jsx(A,{pos:[26,0,10]}),e.jsx(Me,{pos:[s.x,2.3,s.z-3.5]}),e.jsx(Me,{pos:[l.x,2.3,l.z-4]}),e.jsx(Me,{pos:[n.x,2.3,n.z-3.5]})]})},Yt=y.memo(qt),_=new w({color:"#b8a080",roughness:.7}),D=({args:s,position:a})=>{const[t,n,r]=s,o=t/2,c=n/2,l=r/2,i=.08;return e.jsxs("group",{position:a,children:[e.jsxs("mesh",{position:[o-i/2,0,l-i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,n,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[-o+i/2,0,l-i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,n,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[o-i/2,0,-l+i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,n,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[-o+i/2,0,-l+i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,n,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[0,c-i/2,l-i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[t-i,i,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[0,c-i/2,-l+i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[t-i,i,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[o-i/2,c-i/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,i,r-i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[-o+i/2,c-i/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,i,r-i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[0,-c+i/2,l-i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[t-i,i,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[0,-c+i/2,-l+i/2],castShadow:!0,children:[e.jsx("boxGeometry",{args:[t-i,i,i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[o-i/2,-c+i/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,i,r-i]}),e.jsx("primitive",{object:_,attach:"material"})]}),e.jsxs("mesh",{position:[-o+i/2,-c+i/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[i,i,r-i]}),e.jsx("primitive",{object:_,attach:"material"})]})]})},Vt=new w({color:"#d8ccb8",roughness:.95}),Qt=new w({color:"#a89070",roughness:.98}),Jt=new w({color:"#ece4d4",roughness:.85}),es=new w({color:"#c8c0b0",roughness:.88}),ts=new w({color:"#b0a8a0",roughness:.9}),Ze=new w({color:"#3e7022",roughness:.92}),ce=new w({color:"#c0b8a8",roughness:.88}),U=new w({color:"#6a5a3a",roughness:.85}),ss=new w({color:"#909088",roughness:.92}),Ue=new w({color:"#555555"}),Xe=new w({color:"#888888",metalness:.6}),os=new w({color:"#9a9590",roughness:.94}),qe=new w({color:"#e8e4d8",roughness:.85}),rs=new w({color:"#555555",metalness:.5}),ns=new w({color:"#888888",roughness:.6,metalness:.5}),as=new tt(.06,.09,3,8),is=new ze(.22,8,8),cs=new w({color:"#fffde8",emissive:"#fffde8",emissiveIntensity:.65,roughness:.25}),X=new gt,ls=[-22,-10,2,14,26,38],rt=ls.map(s=>[s,0,21.5]),Se=[...[-22,-10,2,14,26,38].map(s=>[s,0,-19]),...[-22,-10,2,14,26,38].map(s=>[s,0,45]),...[-14,-4,6,16,26,36].map(s=>[-25,0,s]),...[-14,-4,6,16,26,36].map(s=>[45,0,s]),...rt],ps=()=>{const s=y.useRef(null),a=y.useRef(null);return y.useEffect(()=>{const t=s.current,n=a.current;!t||!n||(Se.forEach((r,o)=>{X.position.set(r[0],1.5,r[2]),X.updateMatrix(),t.setMatrixAt(o,X.matrix),X.position.set(r[0],3.1,r[2]),X.updateMatrix(),n.setMatrixAt(o,X.matrix)}),t.instanceMatrix.needsUpdate=!0,n.instanceMatrix.needsUpdate=!0)},[]),e.jsxs(e.Fragment,{children:[e.jsx("instancedMesh",{ref:s,args:[as,ns,Se.length]}),e.jsx("instancedMesh",{ref:a,args:[is,cs,Se.length]}),rt.map((t,n)=>e.jsx("pointLight",{position:[t[0],3.1,t[2]],intensity:.8,distance:6,decay:2,color:"#ffe8c0"},n))]})},nt="/models/tree/mango_tree.glb";g.preload(nt);const O=({position:s,s:a=1})=>{const{scene:t}=g(nt),n=y.useMemo(()=>{const o=t.clone(!0);return o.traverse(c=>{if(!(c instanceof Re))return;const l=c.name.toLowerCase(),i=l.includes("tree")&&!l.includes("leave")&&!l.includes("leaf")||/trunk|bark|stem|wood|branch|tronc/.test(l),p=c.material,m=(Array.isArray(p)?p:[p]).map(j=>{if(!(j instanceof w))return j;const b=j.clone();return i?(b.color=new V("#1a1008"),b.emissive=new V("#000000"),b.emissiveIntensity=0,b.roughness=.98):(b.color=new V("#5f9f3a"),b.emissive=new V("#102408"),b.emissiveIntensity=.06,b.roughness=.92),b});c.material=Array.isArray(p)?m:m[0]}),o},[t]),r=y.useMemo(()=>{const o=new ke().setFromObject(n),c=new C,l=new C;o.getSize(c),o.getCenter(l);const p=4.2*a/Math.max(c.y,.001);return{scale:p,centerX:l.x,centerZ:l.z,groundOffset:-o.min.y*p}},[a,t]);return e.jsx("group",{position:s,children:e.jsx("group",{position:[-r.centerX*r.scale,r.groundOffset,-r.centerZ*r.scale],scale:r.scale,children:e.jsx(S,{object:n})})})},B=[{name:"Ferrari F40",path:"/models/cars/1987_ferrari_f40.glb",yawOffset:0,bayLength:3.5,labelY:1.05,parkingOffset:[.05,0]},{name:"Mazda RX-7 FC",path:"/models/cars/1987_mazda_rx-7_fc.glb",yawOffset:0,bayLength:3.4,labelY:1.05,parkingOffset:[0,0]},{name:"Veilside RX-7 FD",path:"/models/cars/1997_veilside_fortune_mazda_rx-7_fd_tokyo_drift.glb",yawOffset:0,bayLength:3.6,labelY:1.1,parkingOffset:[-.1,.05]},{name:"R Magic RX-7 FD3S",path:"/models/cars/2010_r_magic_fd_armor_mazda_rx-7_fd3s.glb",yawOffset:0,bayLength:3.55,labelY:1.1,parkingOffset:[.1,0]},{name:"LB Super Silhouette RX-7",path:"/models/cars/2023_lbsuper_silhouette_mazda_fd3s_rx-7.glb",yawOffset:0,bayLength:3.7,labelY:1.15,parkingOffset:[0,-.05]}];B.forEach(s=>g.preload(s.path));const ds=[{position:[36.75,0,25.75],rot:Math.PI/2,car:B[0]},{position:[36.75,0,29.25],rot:Math.PI/2,car:B[1]},{position:[36.75,0,32.75],rot:Math.PI/2,car:B[2]},{position:[42.25,0,25.75],rot:-Math.PI/2,car:B[3]},{position:[42.25,0,29.25],rot:-Math.PI/2,car:B[4]},{position:[42.25,0,36.25],rot:-Math.PI/2,car:B[0]}],xs=({position:s,rot:a=0,car:t})=>{const{scene:n}=g(t.path),{carScene:r,fitted:o}=y.useMemo(()=>{const c=n.clone(!0);c.traverse(b=>{if(b.visible=!0,b.frustumCulled=!1,!(b instanceof Re))return;(Array.isArray(b.material)?b.material:[b.material]).forEach(v=>{if(!(v instanceof w))return;v.visible=!0,v.depthWrite=!0,v.depthTest=!0;const T=v.color;T.r<.05&&T.g<.05&&T.b<.05&&!v.map&&T.set(.15,.15,.15),v.opacity<.1&&v.alphaMap==null&&(v.opacity=1,v.transparent=!1)})}),c.updateMatrixWorld(!0);const l=new ke().expandByObject(c),i=new C,p=new C;l.getSize(i),l.getCenter(p);const u=Math.max(i.x,i.z,.001),m=t.bayLength/u,j=-l.min.y*m;return{carScene:c,fitted:{scale:m,centerX:p.x,centerZ:p.z,groundOffset:j}}},[t.bayLength,n]);return e.jsxs("group",{position:s,rotation:[0,a+t.yawOffset,0],children:[e.jsx("group",{position:[-o.centerX*o.scale+t.parkingOffset[0],o.groundOffset,-o.centerZ*o.scale+t.parkingOffset[1]],scale:o.scale,children:e.jsx("primitive",{object:r})}),e.jsx(E,{position:[0,t.labelY,0],center:!0,distanceFactor:28,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"6px",color:"#ffffff",background:"rgba(0,0,0,0.55)",padding:"1px 5px",borderRadius:"2px",fontFamily:"monospace",letterSpacing:"0.06em",whiteSpace:"nowrap",fontWeight:700},children:t.name})})]})},Ye=new w({color:"#606060",roughness:.65,metalness:.5}),ve=({position:s})=>e.jsxs("group",{position:s,children:[e.jsxs("mesh",{position:[0,.52,0],children:[e.jsx("cylinderGeometry",{args:[.04,.04,1.04,8]}),e.jsx("primitive",{object:Ye,attach:"material"})]}),e.jsxs("mesh",{position:[0,1.08,0],children:[e.jsx("cylinderGeometry",{args:[.13,.11,.13,12]}),e.jsx("primitive",{object:Ye,attach:"material"})]})]}),ms=new w({color:"#8a6a3a",roughness:.85}),hs=new w({color:"#5a4a2a",roughness:.9}),G=({position:s,rot:a=0})=>e.jsxs("group",{position:s,rotation:[0,a,0],children:[e.jsxs("mesh",{position:[0,.42,0],children:[e.jsx("boxGeometry",{args:[1.8,.1,.45]}),e.jsx("primitive",{object:ms,attach:"material"})]}),[-.7,.7].map((t,n)=>e.jsxs("mesh",{position:[t,.2,0],children:[e.jsx("boxGeometry",{args:[.12,.4,.4]}),e.jsx("primitive",{object:hs,attach:"material"})]},n))]}),Ge="#cc2222",fs="#991111",gs=new w({color:Ge,roughness:.6,transparent:!0,opacity:.2}),us=new w({color:fs,roughness:.55,transparent:!0,opacity:.2}),Ve=new w({color:"#ffffff",roughness:.5,emissive:"#ffffff",emissiveIntensity:.05}),at="/models/logos/nike_logo.glb";g.preload(at);const js=({position:s})=>{const[a,t,n]=s,r=14,o=6,c=10,{scene:l}=g(at),i=y.useMemo(()=>{const p=new ke().setFromObject(l),u=new C,m=new C;return p.getSize(u),p.getCenter(m),{scale:7.2/Math.max(u.x,.001),centerX:m.x,centerY:m.y,centerZ:m.z}},[l]);return e.jsxs("group",{position:[a,t,n],children:[e.jsxs("mesh",{position:[0,o/2,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[r,o,c]}),e.jsx("primitive",{object:gs,attach:"material"})]}),e.jsxs("mesh",{position:[0,o+.18,0],castShadow:!0,children:[e.jsx("boxGeometry",{args:[r+.3,.36,c+.3]}),e.jsx("primitive",{object:us,attach:"material"})]}),e.jsxs("mesh",{position:[0,1.8,c/2+.02],children:[e.jsx("boxGeometry",{args:[r,.5,.06]}),e.jsx("primitive",{object:Ve,attach:"material"})]}),e.jsxs("mesh",{position:[0,1.1,c/2+.03],children:[e.jsx("boxGeometry",{args:[2.6,2.2,.06]}),e.jsx("primitive",{object:Ve,attach:"material"})]}),e.jsx("group",{position:[0,2.45,c/2+.18],scale:i.scale,children:e.jsx("group",{position:[-i.centerX,-i.centerY,-i.centerZ],children:e.jsx(S,{object:l})})}),e.jsx(E,{position:[0,o+1,0],center:!0,distanceFactor:20,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"13px",letterSpacing:"0.25em",fontWeight:900,padding:"3px 14px",borderRadius:"4px",color:"#fff",background:Ge,border:"2px solid #fff",fontFamily:"system-ui",whiteSpace:"nowrap",boxShadow:"0 2px 12px rgba(0,0,0,0.3)"},children:"NIKE"})})]})},bs=[{id:"nike-store",label:"Nike Store",color:Ge},{id:"food-court",label:"Food Court",color:"#e8a840"},{id:"gaming-room",label:"Gaming Room",color:"#9a40c8"}],ys=[{id:"ceo-cabin",label:"CEO Cabin",accentColor:"#e87d3e"},{id:"scrum-room",label:"Daily Scrum",accentColor:"#4aa84a"},{id:"conf-dev",label:"Dev Conference",accentColor:"#4a8ad4"},{id:"conf-design",label:"Design Conference",accentColor:"#9a5ec8"},{id:"conf-security",label:"Security Conf",accentColor:"#3aaa6a"},{id:"conf-qa",label:"QA Conference",accentColor:"#6aaa3a"},{id:"conf-data",label:"Data Science Lab",accentColor:"#4a6ad4"},{id:"conf-ops",label:"DevOps Room",accentColor:"#d4844a"},{id:"conf-product",label:"Product War Room",accentColor:"#d44a6a",doorOffsets:[-2],backDoorOffsets:[2]},{id:"workstations",label:"Workstations",accentColor:"#4a8ad4",doorOffsets:[-6,6],backDoorOffsets:[0]},{id:"sleeping-room",label:"Rest Area",accentColor:"#7a5acd",doorOffsets:[-2],backDoorOffsets:[2]},{id:"kitchen",label:"Kitchen & Lounge",accentColor:"#e87d3e",doorOffsets:[-1.5],backDoorOffsets:[1.5]},{id:"play-area",label:"Play Zone",accentColor:"#d45a8a",doorOffsets:[-2],backDoorOffsets:[2]},{id:"server-room",label:"Server Room",accentColor:"#2a6ad4"},{id:"file-room",label:"File Room",accentColor:"#8a7a5a"},{id:"collab-area",label:"Collaboration Hub",accentColor:"#e8a84a"}],ws=[[-20,-7,56,2],[-20,5,50,2],[-20,17,60,2],[-18,-7,2,12],[-9,-7,2,12],[-1,-7,2,12],[7,-7,2,12],[15,-7,2,12],[23,-7,2,12],[32,-7,2,12],[-8,5,2,12],[4,5,2,12],[15,5,2,12],[24,5,2,4],[38,5,2,12]],Ms=()=>e.jsxs("group",{children:[e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[10,-.02,0],receiveShadow:!0,material:Vt,children:e.jsx("planeGeometry",{args:[70,38]})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[10,-.005,0],receiveShadow:!0,material:Qt,children:e.jsx("planeGeometry",{args:[69,37]})}),e.jsx(D,{args:[70,3,.12],position:[10,3/2,0-38/2]}),e.jsx(D,{args:[.12,3,38],position:[10-70/2,3/2,0]}),e.jsx(D,{args:[.12,3,38],position:[10+70/2,3/2,0]}),e.jsx(D,{args:[27,3,.12],position:[10-21.5,3/2,0+38/2]}),e.jsx(D,{args:[27,3,.12],position:[10+21.5,3/2,0+38/2]}),ws.map(([i,p,u,m],j)=>e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[i+u/2-4,.005,p+m/2-4],receiveShadow:!0,material:Jt,children:e.jsx("planeGeometry",{args:[u,m]})},j)),ys.map(i=>{const p=R[i.id],u=$e[i.id],m=i.id==="collab-area";return e.jsxs("group",{children:[m?e.jsxs(e.Fragment,{children:[e.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[p.x,.02,p.z],receiveShadow:!0,children:[e.jsx("planeGeometry",{args:[u.width,u.depth]}),e.jsx("meshStandardMaterial",{color:"#e8dcc8",roughness:.85})]}),e.jsx(E,{position:[p.x,3.2,p.z],center:!0,distanceFactor:20,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"11px",letterSpacing:"0.08em",padding:"2px 10px",borderRadius:"5px",color:"#5a4a3a",background:"#faf5ee",border:`2px solid ${i.accentColor}`,fontWeight:600,fontFamily:"system-ui"},children:i.label})})]}):e.jsx(We,{position:[p.x,0,p.z],width:u.width,depth:u.depth,accentColor:i.accentColor,label:i.label,doorOffsets:i.doorOffsets,backDoorOffsets:i.backDoorOffsets}),e.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[p.x,.035,p.z],receiveShadow:!0,children:[e.jsx("planeGeometry",{args:[u.width*.65,u.depth*.55]}),e.jsx("meshStandardMaterial",{color:i.accentColor,transparent:!0,opacity:.1,roughness:.95})]}),e.jsx(Be,{roomId:i.id,position:[p.x,0,p.z]})]},i.id)}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[10,-.01,32],receiveShadow:!0,material:es,children:e.jsx("planeGeometry",{args:[70,26]})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[10,.005,22],receiveShadow:!0,material:ts,children:e.jsx("planeGeometry",{args:[70,3]})}),e.jsx(D,{args:[70,3,.12],position:[10,3/2,45]}),e.jsx(D,{args:[.12,3,26],position:[10-70/2,3/2,32]}),e.jsx(D,{args:[.12,3,26],position:[10+70/2,3/2,32]}),[-24,-8,8,24,40].map((i,p)=>e.jsx(G,{position:[i,0,23],rot:0},p)),[-24,-8,8,24,40].map((i,p)=>e.jsx(G,{position:[i,0,20],rot:Math.PI},`r${p}`)),e.jsx(js,{position:[R["nike-store"].x,0,R["nike-store"].z]}),bs.map(({id:i,label:p,color:u})=>{const m=R[i],j=$e[i];return e.jsxs("group",{children:[e.jsx(We,{position:[m.x,0,m.z],width:j.width,depth:j.depth,accentColor:u,label:p}),e.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[m.x,.035,m.z],receiveShadow:!0,children:[e.jsx("planeGeometry",{args:[j.width*.65,j.depth*.55]}),e.jsx("meshStandardMaterial",{color:u,transparent:!0,opacity:.1,roughness:.95})]}),e.jsx(Be,{roomId:i,position:[m.x,0,m.z]})]},i)}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[-19.5,.008,33.5],receiveShadow:!0,material:Ze,children:e.jsx("planeGeometry",{args:[11,23]})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[3,.008,41],receiveShadow:!0,material:Ze,children:e.jsx("planeGeometry",{args:[34,8]})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[-19.5,.015,33.5],material:ce,children:e.jsx("planeGeometry",{args:[1,23]})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[-19.5,.015,33.5],material:ce,children:e.jsx("planeGeometry",{args:[11,1]})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[3,.015,41],material:ce,children:e.jsx("planeGeometry",{args:[34,1]})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[-19.5,.015,41],material:ce,children:e.jsx("planeGeometry",{args:[1,8]})}),e.jsx("mesh",{position:[-25,.22,33.5],material:U,children:e.jsx("boxGeometry",{args:[.08,.44,23]})}),e.jsx("mesh",{position:[-19.5,.22,22],material:U,children:e.jsx("boxGeometry",{args:[11,.44,.08]})}),e.jsx("mesh",{position:[-14,.22,29.5],material:U,children:e.jsx("boxGeometry",{args:[.08,.44,15]})}),e.jsx("mesh",{position:[3,.22,45],material:U,children:e.jsx("boxGeometry",{args:[34,.44,.08]})}),e.jsx("mesh",{position:[3,.22,37],material:U,children:e.jsx("boxGeometry",{args:[34,.44,.08]})}),e.jsx("mesh",{position:[20,.22,41],material:U,children:e.jsx("boxGeometry",{args:[.08,.44,8]})}),e.jsx(G,{position:[-22.5,0,26],rot:Math.PI/2}),e.jsx(G,{position:[-16.5,0,26],rot:-Math.PI/2}),e.jsx(G,{position:[-22.5,0,33],rot:Math.PI/2}),e.jsx(G,{position:[-16.5,0,33],rot:-Math.PI/2}),e.jsx(O,{position:[-24,0,23.5],s:1.05}),e.jsx(O,{position:[-15,0,23.8],s:.88}),e.jsx(O,{position:[-23.5,0,29.5],s:1.1}),e.jsx(O,{position:[-21.5,0,31.5],s:.8}),e.jsx(O,{position:[-24,0,35.5],s:.95}),e.jsx(G,{position:[-8,0,39],rot:0}),e.jsx(G,{position:[-8,0,43],rot:Math.PI}),e.jsx(G,{position:[4,0,39],rot:0}),e.jsx(G,{position:[4,0,43],rot:Math.PI}),e.jsx(G,{position:[14,0,39],rot:0}),e.jsx(G,{position:[14,0,43],rot:Math.PI}),e.jsx(O,{position:[-10,0,38.2],s:1}),e.jsx(O,{position:[-5,0,43.5],s:.9}),e.jsx(O,{position:[1,0,38.5],s:1.05}),e.jsx(O,{position:[8,0,43.2],s:.85}),e.jsx(O,{position:[14,0,38],s:1.1}),e.jsx(O,{position:[18.5,0,43],s:.8}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[16.5,.012,41.5],material:ss,children:e.jsx("planeGeometry",{args:[6,5]})}),[13.5,19.5].map((i,p)=>e.jsx("mesh",{position:[i,.3,39.1],material:Ue,children:e.jsx("cylinderGeometry",{args:[.05,.05,.6,8]})},`sp${p}`)),[13.5,19.5].map((i,p)=>e.jsx("mesh",{position:[i,.3,43.9],material:Ue,children:e.jsx("cylinderGeometry",{args:[.05,.05,.6,8]})},`sp2${p}`)),e.jsx("mesh",{position:[16.5,.55,39.1],material:Xe,children:e.jsx("boxGeometry",{args:[6,.04,.04]})}),e.jsx("mesh",{position:[16.5,.55,43.9],material:Xe,children:e.jsx("boxGeometry",{args:[6,.04,.04]})}),e.jsx(ve,{position:[14.5,0,40.5]}),e.jsx(ve,{position:[17.5,0,42]}),e.jsx(ve,{position:[19,0,40]}),e.jsx(E,{position:[16.5,2,41.5],center:!0,distanceFactor:20,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"8px",background:"#222222",color:"#ddddcc",padding:"2px 8px",borderRadius:"3px",border:"1px solid #666",fontFamily:"monospace",whiteSpace:"nowrap",letterSpacing:"0.06em"},children:"🚬 Smoking Area Only"})}),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[39.5,.006,33.5],material:os,children:e.jsx("planeGeometry",{args:[11,23]})}),[24,27.5,31,34.5,38,41.5].map((i,p)=>e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[39.5,.012,i],material:qe,children:e.jsx("planeGeometry",{args:[11,.12]})},`pl${p}`)),e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[39.5,.011,33.5],material:qe,children:e.jsx("planeGeometry",{args:[.12,23]})}),e.jsx("mesh",{position:[39.5,1,23],material:rs,children:e.jsx("cylinderGeometry",{args:[.05,.05,2,8]})}),e.jsx(E,{position:[39.5,2.4,23],center:!0,distanceFactor:20,style:{pointerEvents:"none"},children:e.jsx("div",{style:{fontSize:"8px",background:"#1a44aa",color:"#fff",padding:"2px 7px",borderRadius:"3px",border:"1px solid #88aaff",fontFamily:"monospace",whiteSpace:"nowrap",letterSpacing:"0.05em",fontWeight:700},children:"🅿 Employee Parking"})}),ds.map((i,p)=>e.jsx(xs,{position:i.position,rot:i.rot,car:i.car},`parked-car-${p}`)),e.jsx(ps,{}),e.jsx(Yt,{})]});function Ss(s){const a=new Map,t=new Map,n=s.clone();return it(s,n,function(r,o){a.set(o,r),t.set(r,o)}),n.traverse(function(r){if(!r.isSkinnedMesh)return;const o=r,c=a.get(r),l=c.skeleton.bones;o.skeleton=c.skeleton.clone(),o.bindMatrix.copy(c.bindMatrix),o.skeleton.bones=l.map(function(i){return t.get(i)}),o.bind(o.skeleton,o.bindMatrix)}),n}function it(s,a,t){t(s,a);for(let n=0;n<s.children.length;n++)it(s.children[n],a.children[n],t)}g.preload("/models/agent-figure.glb");const ct={ceo:"#d97706",pm:"#f97316",engineer:"#4a8ad4",researcher:"#8b5cf6",developer:"#4a8ad4",designer:"#9a5ec8",security:"#3aaa6a",manager:"#e87d3e"},vs={ceo:{shirt:"#d97706"},pm:{shirt:"#f97316"},engineer:{shirt:"#4a8ad4"},researcher:{shirt:"#8b5cf6"},developer:{shirt:"#4a8ad4"},designer:{shirt:"#9a5ec8"},security:{shirt:"#3aaa6a"},manager:{shirt:"#e87d3e"}},Ie={};function Is(s){return Ie[s]||(Ie[s]=new wt({color:ct[s],transparent:!0,opacity:.7,side:Mt})),Ie[s]}const Ps={working:"💻",collaborating:"💬",sleeping:"😴",idle:"☕",meeting:"🗣️",walking:"🚶","standing-up":"🧍",shopping:"🛍️",playing:"🎮",eating:"🍽️"};function zs(s,a){if(a)return"Sitting";switch(s){case"walking":return"Walking";case"sleeping":return"Death";case"collaborating":return"Wave";case"meeting":return"ThumbsUp";case"standing-up":return"Standing";case"shopping":return"Idle";case"playing":return"Standing";case"eating":return"Idle";default:return"Idle"}}const ks=new bt(.14,.2,24);function Rs(s,a,t){return y.useMemo(()=>{if(s!==a)return 0;const n=Ae[s];return n!=null&&n.length?n[t%n.length].rot:0},[s,a,t])}function As(s,a,t=.18){s.traverse(n=>{if(!(n instanceof Re)&&!(n instanceof yt))return;const o=(Array.isArray(n.material)?n.material:[n.material]).map(c=>{const l=c.clone();return l.emissive=new V(a),l.emissiveIntensity=t,l});n.material=o.length===1?o[0]:o})}const _s=({agentId:s,isSelected:a})=>{const t=I(x=>x.selectAgent),{name:n,role:r,task:o,currentRoom:c,targetRoom:l,status:i,isSitting:p,seatIndex:u}=I(ot(x=>{const d=x.officeAgents.find(z=>z.id===s);return{name:(d==null?void 0:d.name)??"",role:(d==null?void 0:d.role)??"engineer",task:(d==null?void 0:d.task)??"",currentRoom:(d==null?void 0:d.currentRoom)??"workstations",targetRoom:(d==null?void 0:d.targetRoom)??"workstations",status:(d==null?void 0:d.status)??"idle",isSitting:(d==null?void 0:d.isSitting)??!1,seatIndex:(d==null?void 0:d.seatIndex)??0}})),m=vs[r],j=Rs(c,l,u),{scene:b,animations:ee}=g("/models/agent-figure.glb"),v=y.useMemo(()=>{const x=Ss(b);return As(x,ct[r],.18),x},[b,r]),T=y.useRef(null),re=y.useRef(""),{actions:N}=xt(ee,T),xe=y.useMemo(()=>{const x=I.getState().officeAgents.find(d=>d.id===s);return(x==null?void 0:x.targetPosition)??[0,0,0]},[s]);y.useEffect(()=>{const x=zs(i,p);if(x===re.current)return;re.current=x,Object.values(N).forEach(z=>z==null?void 0:z.fadeOut(.2));const d=N[x]??N.Idle;d&&(x==="Sitting"?(d.reset(),d.setLoop(ut,1),d.clampWhenFinished=!0,d.play(),d.time=d.getClip().duration):(d.reset().setEffectiveTimeScale(1).setEffectiveWeight(1).fadeIn(.2),d.setLoop(jt,1/0),d.play()))},[i,p,N]);const Te=y.useRef(xe[0]),Ee=y.useRef(xe[2]),ne=y.useRef(!1),Le=y.useRef(c);return de(()=>{const x=T.current;if(!x)return;const d=I.getState().officeAgents.find(lt=>lt.id===s);if(!d)return;const z=d.targetPosition[0],L=d.targetPosition[2];if(Le.current!==d.currentRoom&&(Le.current=d.currentRoom,ne.current=!1),(Te.current!==z||Ee.current!==L)&&(Te.current=z,Ee.current=L,ne.current=!1),ne.current)return;const Fe=(Math.abs(x.position.x-z)>.01||Math.abs(x.position.z-L)>.01)&&d.currentRoom!==d.targetRoom?"walking":d.status,ae=d.status==="sleeping"?1.4:(d.isSitting,0),me=d.status==="sleeping"?Math.PI/2:0,he=d.status==="sleeping"?j:Fe==="walking"?Math.atan2(z-x.position.x,L-x.position.z):j,fe=d.status==="sleeping"?Math.PI/2:0;d.status!=="sleeping"?(x.position.x=W.lerp(x.position.x,z,.04),x.position.z=W.lerp(x.position.z,L,.04),x.position.y=W.lerp(x.position.y,ae,.08),x.rotation.x=W.lerp(x.rotation.x,me,.07),x.rotation.y=W.lerp(x.rotation.y,he,.07),x.rotation.z=W.lerp(x.rotation.z,fe,.07)):(x.position.x=z,x.position.z=L,x.position.y=W.lerp(x.position.y,ae,.04),x.rotation.x=me,x.rotation.y=he,x.rotation.z=fe),Fe!=="walking"&&d.status!=="sleeping"&&Math.abs(x.position.x-z)<.005&&Math.abs(x.position.z-L)<.005&&Math.abs(x.position.y-ae)<.005&&(x.position.set(z,ae,L),x.rotation.set(me,he,fe),ne.current=!0)}),e.jsxs("group",{ref:T,position:xe,onClick:x=>{x.stopPropagation(),t(a?null:s)},children:[a&&e.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.02,0],geometry:ks,material:Is(r)}),e.jsx("primitive",{object:v,scale:.25}),e.jsx(E,{position:[0,.7,0],center:!0,distanceFactor:15,style:{pointerEvents:"none"},children:e.jsxs("div",{style:{whiteSpace:"nowrap",fontSize:"10px",padding:"2px 6px",borderRadius:"4px",color:m.shirt,background:a?"#fff":"#faf5ee",border:`1.5px solid ${a?m.shirt:m.shirt+"60"}`,fontWeight:600,fontFamily:"monospace",boxShadow:a?`0 0 8px ${m.shirt}40`:"0 1px 4px rgba(0,0,0,0.08)"},children:[Ps[i]||"🧍"," ",n]})}),a&&e.jsx(E,{position:[0,1.2,0],center:!0,distanceFactor:8,style:{pointerEvents:"none"},children:e.jsxs("div",{style:{whiteSpace:"nowrap",padding:"8px 12px",borderRadius:"10px",background:"rgba(255,255,255,0.95)",border:`2px solid ${m.shirt}`,boxShadow:`0 4px 20px rgba(0,0,0,0.12), 0 0 12px ${m.shirt}20`,fontSize:"11px",color:"#5a5a6a",lineHeight:1.6},children:[e.jsx("div",{style:{fontWeight:800,fontSize:"13px",color:"#2a2a3a",marginBottom:4},children:n}),e.jsxs("div",{children:["📍 ",c.replace(/-/g," ").replace(/\b\w/g,x=>x.toUpperCase())]}),e.jsxs("div",{children:["⚡ ",o]}),e.jsx("div",{style:{marginTop:4,padding:"1px 5px",borderRadius:3,fontSize:"9px",fontWeight:600,textTransform:"uppercase",display:"inline-block",background:i==="working"?"#dcfce7":i==="sleeping"?"#ede9fe":"#dbeafe",color:i==="working"?"#166534":i==="sleeping"?"#5b21b6":"#1e40af"},children:i})]})})]})},Gs=({agentId:s,isSelected:a=!1})=>e.jsx(_s,{agentId:s,isSelected:a}),Ce=[25,30,35],Oe=[2,0,0],Qe=new C(...Ce),Cs=new C(...Oe),Je=new C,et=new C,Os=({controlsRef:s})=>{const{camera:a}=ft(),t=I(c=>c.selectedAgentId),n=y.useRef(new C(...Oe)),r=y.useRef(new C(...Ce)),o=y.useRef(!1);return de(()=>{if(s.current){if(t){const c=I.getState().officeAgents.find(l=>l.id===t);c&&(Je.set(c.targetPosition[0],1,c.targetPosition[2]),et.set(c.targetPosition[0]+5,6,c.targetPosition[2]+5),n.current.lerp(Je,.05),r.current.lerp(et,.04),o.current=!0)}else o.current&&(n.current.lerp(Cs,.03),r.current.lerp(Qe,.03),r.current.distanceTo(Qe)<.5&&(o.current=!1));o.current&&(a.position.lerp(r.current,.06),s.current.target.lerp(n.current,.06),s.current.update())}}),null},Ts=()=>{const[s,a]=y.useState(!0),t=I(ot(l=>l.officeAgents.map(i=>i.id))),n=I(l=>l.selectedAgentId),r=I(l=>l.selectAgent),o=y.useRef(null),c=()=>a(!1);return e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(15, 23, 42, 0.95)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:50,backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{textAlign:"center",color:"#fff"},children:[e.jsx("div",{style:{fontSize:"24px",fontWeight:600,marginBottom:"20px"},children:"Loading your interactive 3D office"}),e.jsx("div",{style:{width:"40px",height:"40px",border:"3px solid rgba(255,255,255,0.2)",borderTop:"3px solid #fff",borderRadius:"50%",animation:"spin 1s linear infinite",margin:"0 auto"}}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}),e.jsxs(mt,{camera:{position:Ce,fov:50,near:.5,far:180},gl:{antialias:!0,powerPreference:"high-performance",toneMapping:St,toneMappingExposure:1.05},performance:{min:.5},style:{background:"#f0e8e0",width:"100%",height:"100%"},onPointerMissed:()=>r(null),frameloop:"always",shadows:"soft",children:[e.jsx("ambientLight",{intensity:.85,color:"#ffd9a8"}),e.jsx("directionalLight",{position:[20,30,15],intensity:1.2,color:"#ffd4a8",castShadow:!0,"shadow-mapSize":[1024,1024],"shadow-camera-far":120,"shadow-camera-left":-55,"shadow-camera-right":55,"shadow-camera-top":55,"shadow-camera-bottom":-55,"shadow-bias":-5e-4}),e.jsx("hemisphereLight",{args:["#ffe8cc","#d8cfc0",.5]}),e.jsx(Ms,{}),t.map(l=>e.jsx(Gs,{agentId:l,isSelected:l===n},l)),e.jsx(Es,{onReady:c}),e.jsx(ht,{ref:o,makeDefault:!0,enableDamping:!0,dampingFactor:.05,minDistance:3,maxDistance:70,maxPolarAngle:Math.PI/2.2,target:Oe}),e.jsx(Os,{controlsRef:o})]})]})},Es=({onReady:s})=>{const a=y.useRef(!1);return de(()=>{a.current||(a.current=!0,s())}),null},Ls=()=>{const{selectedCompanyId:s}=vt(),a=I(o=>o.setBackendSnapshot),{data:t}=ge({queryKey:ue.agents.list(s??""),queryFn:()=>It.list(s),enabled:!!s,refetchInterval:15e3}),{data:n}=ge({queryKey:ue.issues.list(s??""),queryFn:()=>Pt.list(s),enabled:!!s,refetchInterval:15e3}),{data:r}=ge({queryKey:ue.liveRuns(s??""),queryFn:()=>zt.liveRunsForCompany(s),enabled:!!s,refetchInterval:5e3});return y.useEffect(()=>{t&&a({agents:t.map(o=>({id:o.id,name:o.name,role:o.role??"engineer",title:o.title??null,status:o.status??"idle",capabilities:o.capabilities??null,lastHeartbeatAt:o.lastHeartbeatAt?o.lastHeartbeatAt instanceof Date?o.lastHeartbeatAt.toISOString():String(o.lastHeartbeatAt):null,reportsTo:o.reportsTo??null,urlKey:o.urlKey??null})),issues:(n??[]).map(o=>({id:o.id,companyId:o.companyId??s??"",title:o.title,status:o.status,assigneeAgentId:o.assigneeAgentId??null,updatedAt:o.updatedAt instanceof Date?o.updatedAt.toISOString():String(o.updatedAt)})),liveRuns:(r??[]).map(o=>({id:o.id,agentId:o.agentId}))})},[t,n,r,a,s]),null},Fs={ceo:"#d97706",pm:"#f97316",engineer:"#4a8ad4",researcher:"#8b5cf6",developer:"#4a8ad4",designer:"#9a5ec8",security:"#3aaa6a",manager:"#e87d3e"},$s={ceo:"👔",cmo:"📣",cto:"💻",pm:"📊",engineer:"⚙️",researcher:"🔬",developer:"👨‍💻",designer:"🎨",security:"🔐",manager:"👥"};function Ds({agents:s,selectedAgentId:a,onSelectAgent:t}){const[n,r]=y.useState(!1),o=y.useMemo(()=>s.filter(l=>l.status!=="sleeping"),[s]),c=l=>$s[l.toLowerCase()]||"🧍";return e.jsxs(e.Fragment,{children:[!n&&e.jsxs("button",{onClick:()=>r(!0),style:{position:"absolute",top:"16px",right:"16px",zIndex:10,padding:"10px 14px",borderRadius:"10px",background:"rgba(8,10,24,0.92)",color:"#c0d0f0",border:"1px solid rgba(100,140,220,0.35)",backdropFilter:"blur(14px)",boxShadow:"0 4px 28px rgba(0,0,0,0.4)",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:600,transition:"all 0.2s ease"},onMouseEnter:l=>{l.currentTarget.style.background="rgba(8,10,24,0.98)",l.currentTarget.style.borderColor="rgba(100,140,220,0.6)"},onMouseLeave:l=>{l.currentTarget.style.background="rgba(8,10,24,0.92)",l.currentTarget.style.borderColor="rgba(100,140,220,0.35)"},children:[e.jsx(Pe,{className:"h-4 w-4"}),e.jsx("span",{children:o.length})]}),n&&e.jsxs("div",{style:{position:"absolute",top:"16px",right:"16px",zIndex:20,width:"187px",maxHeight:"47vh",background:"rgba(8,10,24,0.92)",color:"#c0d0f0",backdropFilter:"blur(14px)",border:"1px solid rgba(100,140,220,0.35)",boxShadow:"0 4px 28px rgba(0,0,0,0.4)",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"10px 12px",borderBottom:"1px solid rgba(100,140,220,0.2)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"rgba(192,208,240,0.7)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(Pe,{className:"h-3 w-3"}),e.jsx("span",{children:"Agents"})]}),e.jsx("button",{onClick:()=>r(!1),style:{background:"none",border:"none",color:"rgba(192,208,240,0.6)",cursor:"pointer",padding:"0",display:"flex",alignItems:"center",transition:"color 0.2s"},onMouseEnter:l=>{l.currentTarget.style.color="rgba(192,208,240,1)"},onMouseLeave:l=>{l.currentTarget.style.color="rgba(192,208,240,0.6)"},children:e.jsx(kt,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{style:{overflowY:"auto",overflowX:"hidden",flex:1,scrollBehavior:"smooth"},children:o.length===0?e.jsx("div",{style:{padding:"16px 12px",textAlign:"center",fontSize:"11px",color:"rgba(192,208,240,0.4)"},children:"No agents"}):o.map(l=>{const i=a===l.id,p=Fs[l.role.toLowerCase()]||"#999999",u=c(l.role);return e.jsxs("div",{onClick:()=>{t(i?null:l.id)},style:{padding:"8px 10px",borderBottom:"1px solid rgba(100,140,220,0.1)",cursor:"pointer",background:i?"rgba(100,140,220,0.25)":"transparent",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"8px",borderLeft:i?`3px solid ${p}`:"3px solid transparent"},onMouseEnter:m=>{i||(m.currentTarget.style.background="rgba(100,140,220,0.1)")},onMouseLeave:m=>{i||(m.currentTarget.style.background="transparent")},children:[e.jsx("div",{style:{fontSize:"14px",minWidth:"20px",textAlign:"center"},children:u}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"1px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:i?"#ffffff":"#c0d0f0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.name}),e.jsx("div",{style:{fontSize:"9px",color:"rgba(192,208,240,0.5)",textTransform:"capitalize"},children:l.role})]}),e.jsx("div",{style:{width:"6px",height:"6px",borderRadius:"50%",background:p,opacity:i?1:.6,boxShadow:i?`0 0 8px ${p}80`:"none"}})]},l.id)})})]}),n&&e.jsx("div",{onClick:()=>r(!1),style:{position:"fixed",inset:0,zIndex:15,cursor:"pointer"}})]})}function Ys(){const s=I(c=>c.liveMode),a=I(c=>c.agents),t=I(c=>c.officeAgents),n=I(c=>c.selectedAgentId),r=I(c=>c.selectAgent);y.useMemo(()=>t.filter(c=>c.status==="working"||c.status==="collaborating"||c.status==="meeting").length,[t]);const o={background:"rgba(255,250,240,0.88)",color:"#5a4a3a",backdropFilter:"blur(10px)",border:"1px solid rgba(180,160,120,0.4)"};return e.jsxs("div",{className:"absolute inset-0 overflow-hidden",style:{background:"#f5efe6"},children:[e.jsx(Ls,{}),e.jsx("div",{className:"absolute inset-0",children:e.jsx(Ts,{})}),e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium",style:o,children:[s?e.jsx(Rt,{className:"h-3.5 w-3.5 text-green-500"}):e.jsx(At,{className:"h-3.5 w-3.5 text-yellow-500"}),e.jsx("span",{children:s?"Live":"Demo"}),e.jsx("span",{className:"opacity-50",children:"·"}),e.jsx(Pe,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[a.length>0?a.length:t.length," agents"]})]})}),e.jsx(Ds,{agents:t,selectedAgentId:n,onSelectAgent:r}),n&&(()=>{const c=t.find(l=>l.id===n);return c?e.jsxs("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 flex items-center gap-3 px-4 py-3 rounded-xl text-sm z-10",style:{background:"rgba(8,10,24,0.92)",color:"#c0d0f0",backdropFilter:"blur(14px)",border:"1px solid rgba(100,140,220,0.35)",boxShadow:"0 4px 28px rgba(0,0,0,0.4)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold",style:{color:"#ffffff"},children:c.name}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsx("span",{className:"opacity-80 capitalize",children:c.role}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsx("span",{className:"opacity-75",children:c.currentRoom.replace(/-/g," ").replace(/\b\w/g,l=>l.toUpperCase())})]}),e.jsxs("div",{className:"opacity-65 max-w-[240px] truncate",children:["⚡ ",c.task]}),e.jsx("button",{onClick:()=>r(null),className:"ml-2 opacity-40 hover:opacity-100 transition-opacity text-xs",children:"✕"})]}):null})(),e.jsx("div",{className:"absolute bottom-4 right-4 text-[10px] opacity-35 z-10 pointer-events-none",style:{color:"#888"},children:"Click an agent · Drag to orbit · Scroll to zoom"})]})}export{Ys as Office};