droidsembly 0.4.0-beta.3 → 0.4.0-beta.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.
Files changed (75) hide show
  1. package/README.it.md +7 -6
  2. package/README.md +7 -6
  3. package/bin/cubefarm.js +2 -296
  4. package/bin/droidsembly.js +304 -0
  5. package/bin/environment.d.ts +3 -0
  6. package/bin/environment.js +48 -0
  7. package/dist/assets/AccessibilitySettings-vd4x_sEq.js +30 -0
  8. package/dist/assets/{AppViewer-0Bly3EdB.js → AppViewer-BB9lvg-4.js} +1 -1
  9. package/dist/assets/{Balloon-B6odnAlm.js → Balloon-CWEK5uK2.js} +1 -1
  10. package/dist/assets/{Batched-CTJWq46z.js → Batched-yAiB-c-b.js} +1 -1
  11. package/dist/assets/{Birds-DSS0OIz9.js → Birds-ClBZkA83.js} +1 -1
  12. package/dist/assets/{Blimp-CZt6dddK.js → Blimp-VHMnVBQt.js} +1 -1
  13. package/dist/assets/{BufferGeometryUtils-CmpUrBC5.js → BufferGeometryUtils-B4Tnxtjb.js} +1 -1
  14. package/dist/assets/{Duck-BnRLkodp.js → Duck-CCThHMtF.js} +1 -1
  15. package/dist/assets/{Effects-Bkewth1L.js → Effects-BZfFy3yq.js} +1 -1
  16. package/dist/assets/{Fireworks-Cvn8YKWd.js → Fireworks-CxvvEwV_.js} +1 -1
  17. package/dist/assets/{Helicopter-BDrFQMNX.js → Helicopter-DXHDrTnQ.js} +1 -1
  18. package/dist/assets/{Hurricane-C8hyFXjx.js → Hurricane-WXNUxoUz.js} +1 -1
  19. package/dist/assets/{Kaiju-Bxxe9DG0.js → Kaiju-D-wVgKo-.js} +1 -1
  20. package/dist/assets/{Meteors-UdYL0Tbv.js → Meteors-DSr-7bEl.js} +1 -1
  21. package/dist/assets/{MissionConsole-DJRtojZP.js → MissionConsole-4G02S89d.js} +1 -1
  22. package/dist/assets/{Office-9Mank16i.js → Office-B_EroD2U.js} +44 -44
  23. package/dist/assets/{PhotoPanel-C_njIXp0.js → PhotoPanel-ByzwApow.js} +1 -1
  24. package/dist/assets/{PhotoScene-DwpeJjGe.js → PhotoScene-CW3yZkqH.js} +3 -3
  25. package/dist/assets/{Plane-DzvUAUYE.js → Plane-CT7-QFbA.js} +1 -1
  26. package/dist/assets/Pocket-B0o4siMl.js +2 -0
  27. package/dist/assets/{Rainbow-CV1rD6rW.js → Rainbow-DNvXfTl9.js} +1 -1
  28. package/dist/assets/{Roof-DSpKcGXK.js → Roof-yLX0ZK0x.js} +1 -1
  29. package/dist/assets/{Shell-GaQY3zre.js → Shell-lZOZ3aG8.js} +2 -2
  30. package/dist/assets/{Skywriting-D4B2ZvH7.js → Skywriting-N1GDZKYR.js} +1 -1
  31. package/dist/assets/TerminalView-cUAMhOxM.js +17 -0
  32. package/dist/assets/{ToyWorld-DeQUxcuy.js → ToyWorld-BYE8776A.js} +1 -1
  33. package/dist/assets/{Ufo-CitoxReu.js → Ufo-D_Wt75n1.js} +1 -1
  34. package/dist/assets/{Whale-Btx5ph-T.js → Whale-Kkz3B36R.js} +1 -1
  35. package/dist/assets/all-BMItClgN.js +11 -0
  36. package/dist/assets/{bloomMarks-DRhDp19k.js → bloomMarks-C22qSi5d.js} +1 -1
  37. package/dist/assets/{cheerRules-DWb8Qwzg.js → cheerRules-G9WFRB4C.js} +1 -1
  38. package/dist/assets/{cityLayout-aA2Ktgpu.js → cityLayout-C8f5-bpM.js} +1 -1
  39. package/dist/assets/{dogState-DY7tJEVD.js → dogState-9uong8D8.js} +1 -1
  40. package/dist/assets/{doors-BlKvxXVp.js → doors-DsKuGpOi.js} +1 -1
  41. package/dist/assets/{gallery-COKuWb9E.js → gallery-DSKvNkBq.js} +1 -1
  42. package/dist/assets/gate-D6_NXB1w.js +2 -0
  43. package/dist/assets/index-rznd4Djx.js +10 -0
  44. package/dist/assets/{instantReplay-BjoV6jrY.js → instantReplay-CiWMru53.js} +1 -1
  45. package/dist/assets/{interact-0jqx03Xr.js → interact-Bt-XX-z4.js} +1 -1
  46. package/dist/assets/{jsx-runtime-CXW0f58S.js → jsx-runtime-CZP6s5wa.js} +1 -1
  47. package/dist/assets/{kit-n-eqZ1AT.js → kit-CZEafHnz.js} +1 -1
  48. package/dist/assets/mic-DeYDrNoY.js +1 -0
  49. package/dist/assets/{photoMode-BybFMLKC.js → photoMode-BTxq9-gL.js} +1 -1
  50. package/dist/assets/{pipeline-BGPWXegt.js → pipeline-DNe3sjnP.js} +1 -1
  51. package/dist/assets/{rapier-CrXmTSyE.js → rapier-C-KFR0AR.js} +1 -1
  52. package/dist/assets/{rig-DfdntE8m.js → rig-B88WinIa.js} +1 -1
  53. package/dist/assets/{speechLanguage-DfsQvU9M.js → speechLanguage-Bq3BAswq.js} +1 -1
  54. package/dist/assets/store-9CvxLGNQ.js +5 -0
  55. package/dist/assets/useDayTime-Nrdy7kH1.js +1 -0
  56. package/dist/assets/useGraphics-Bhnj8CAm.js +1 -0
  57. package/dist/assets/voiceMessages-BF3P4sjw.js +1 -0
  58. package/dist/assets/{weatherState-BJVm5hU-.js → weatherState-CufaxiyU.js} +1 -1
  59. package/dist/index.html +3 -3
  60. package/dist-server/index.js +1251 -494
  61. package/dist-server/index.js.map +4 -4
  62. package/dist-server/ptyHost.js +6 -2
  63. package/dist-server/ptyHost.js.map +2 -2
  64. package/package.json +2 -2
  65. package/dist/assets/AccessibilitySettings-HB1JfQbh.js +0 -30
  66. package/dist/assets/Pocket-A1iI6Ivy.js +0 -2
  67. package/dist/assets/TerminalView-DhmLqjYn.js +0 -17
  68. package/dist/assets/all-gw-szDg1.js +0 -11
  69. package/dist/assets/gate-D0uU0wv5.js +0 -2
  70. package/dist/assets/index-CDJgPTOC.js +0 -10
  71. package/dist/assets/mic-BnAa4E99.js +0 -1
  72. package/dist/assets/store-CXLtXw8e.js +0 -5
  73. package/dist/assets/useDayTime-BjBDzh_t.js +0 -1
  74. package/dist/assets/useGraphics-Bg6L4EdS.js +0 -1
  75. package/dist/assets/voiceMessages-CFLyZLZ4.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{s as t,t as n}from"./jsx-runtime-CXW0f58S.js";import{en as r,l as i,p as a}from"./store-CXLtXw8e.js";import{CLIP_SECONDS as o,GOLDEN_HOUR as s,cam as c,d as l,focusCenter as u,leave as d,n as f,overlayOptions as p,requestFrame as m,setDaytime as h,setFrozen as g,t as _,takeShot as v,toggleRecording as y,u as b,update as x,usePhoto as S}from"./photoMode-BybFMLKC.js";import{a as C,c as w,d as T,i as E,o as D,r as O,u as k}from"./gallery-COKuWb9E.js";import{c as A,u as j}from"./gate-D0uU0wv5.js";import{s as M}from"./useDayTime-BjBDzh_t.js";import{M as N,j as P}from"./AccessibilitySettings-HB1JfQbh.js";import{o as F,s as I}from"./index-CDJgPTOC.js";var L=e(t(),1),R=n();function z(){let e=(0,L.useRef)(null),t=S(),n=a(e=>e.floor),[r,i]=(0,L.useState)({w:window.innerWidth,h:window.innerHeight});return(0,L.useEffect)(()=>{let e=()=>i({w:window.innerWidth,h:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,L.useEffect)(()=>{let t=e.current;if(!t)return;let n=window.devicePixelRatio||1;t.width=Math.round(r.w*n),t.height=Math.round(r.h*n);let i=t.getContext(`2d`);i&&(i.clearRect(0,0,t.width,t.height),_(i,t.width,t.height,p(!0)))},[t.filter,t.stamp,t.caption,t.guides,r,n]),(0,R.jsx)(`canvas`,{ref:e,className:`photo-preview`,"aria-hidden":`true`})}function B(){let e=S(e=>e.recording),[,t]=(0,L.useState)(0);if((0,L.useEffect)(()=>{if(!e)return;let n=setInterval(()=>t(e=>e+1),250);return()=>clearInterval(n)},[e]),!e)return null;let n=Math.min(e.limit,(performance.now()-e.started)/1e3),r=e=>`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`;return(0,R.jsxs)(`div`,{className:`photo-rec`,role:`status`,children:[(0,R.jsx)(`span`,{className:`photo-rec-dot`}),` REC `,r(n),` / `,r(e.limit),(0,R.jsxs)(`button`,{className:`btn btn-small`,onClick:()=>void y(),children:[(0,R.jsx)(F,{children:`■ Stop`}),` `,(0,R.jsx)(`kbd`,{children:`V`})]})]})}function V({item:e}){return e.kind===`shot`?(0,R.jsx)(`img`,{src:e.thumb??e.url,alt:``}):(0,R.jsx)(`video`,{src:e.url,muted:!0,preload:`metadata`})}function H(){let e=I(),t=C(e=>e.items),n=t.reduce((e,t)=>e+t.bytes,0);return(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsxs)(`h4`,{children:[(0,R.jsx)(F,{children:`Gallery`}),` `,(0,R.jsx)(`span`,{className:`muted small`,children:t.length?e(`{count} · {size} · this tab only`,{count:t.length,size:k(n)}):e(`empty`)})]}),t.length>0&&(0,R.jsx)(`ul`,{className:`photo-gallery`,children:[...t].reverse().map(t=>(0,R.jsxs)(`li`,{title:t.name,children:[(0,R.jsx)(V,{item:t}),(0,R.jsxs)(`div`,{className:`photo-gallery-meta`,children:[(0,R.jsx)(`span`,{children:t.kind===`shot`?`📸 ${t.width}×${t.height}`:`${t.kind===`replay`?`⏪`:`🎬`} ${Math.round(t.seconds??0)} s`}),(0,R.jsx)(`span`,{className:`muted`,children:k(t.bytes)})]}),(0,R.jsxs)(`div`,{className:`photo-gallery-actions`,children:[(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>E(t),"aria-label":e(`Download {name}`,{name:t.name}),children:`⬇`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>O(t.id),"aria-label":e(`Delete {name}`,{name:t.name}),children:`🗑`})]})]},t.id))})]})}function U(){let[e,t]=(0,L.useState)({fov:c.fov,roll:c.roll});return(0,L.useEffect)(()=>{let e=setInterval(()=>t(e=>e.fov===c.fov&&e.roll===c.roll?e:{fov:c.fov,roll:c.roll}),150);return()=>clearInterval(e)},[]),e}function W(){let e=I(),t=S(),n=j(e=>e.frozen),p=j(e=>e.replay),_=a(e=>e.toasts),C=a(e=>e.dismissToast),E=a(e=>e.floor),O=a(e=>e.floor===0?null:i(e.repos,e.floor)),k=a(e=>e.agents),{fov:L,roll:V}=U(),W=Object.values(k).filter(e=>(O?e.repoId===O.id:e.role===`ceo`)&&r(e.id)),G=T(window.innerWidth,window.innerHeight,window.devicePixelRatio||1,t.scale),K=M().t,q=t.daytime??K;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(z,{}),(0,R.jsx)(B,{}),t.panel?(0,R.jsxs)(`aside`,{className:`photo-panel`,"aria-label":e(`Photo mode`),children:[(0,R.jsxs)(`header`,{className:`photo-head`,children:[(0,R.jsx)(`b`,{children:(0,R.jsx)(F,{children:`📷 Photo mode`})}),(0,R.jsxs)(`button`,{className:`btn btn-small`,onClick:d,title:e(`Back to the office (or Esc with the mouse free)`),children:[(0,R.jsx)(F,{children:`Leave`}),` `,(0,R.jsx)(P,{action:`photo`})]})]}),t.note&&(0,R.jsx)(`p`,{className:`photo-note ${t.note.level===`error`?`photo-note-bad`:``}`,role:`status`,onClick:()=>x({note:null}),children:t.note.message?t.note.message.map(t=>e(t.key,t.values)).join(``):t.note.text}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>g(e.target.checked)}),` `,(0,R.jsx)(F,{children:`❄ Freeze the office`}),` `,(0,R.jsx)(`kbd`,{children:`F`})]}),(0,R.jsx)(`p`,{className:`muted small`,children:e(n?`Everyone holds still; the work carries on and catches up when you thaw.`:`Live: people, toys and the sky move. Good for clips.`)})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Camera`})}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Zoom`})}),(0,R.jsx)(`input`,{type:`range`,min:15,max:110,step:1,value:Math.round(L),onChange:e=>(c.fov=Number(e.target.value),m()),"aria-label":e(`Field of view`)}),(0,R.jsxs)(`b`,{children:[Math.round(L),`°`]})]}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Roll`})}),(0,R.jsx)(`input`,{type:`range`,min:-45,max:45,step:1,value:Math.round(V*180/Math.PI),onChange:e=>(c.roll=Math.max(-f,Math.min(f,Number(e.target.value)*Math.PI/180)),m()),"aria-label":e(`Roll`)}),(0,R.jsxs)(`b`,{children:[Math.round(V*180/Math.PI),`°`]})]}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.dof,onChange:e=>x({dof:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Depth of field`})]}),t.dof&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Focus`})}),(0,R.jsx)(`input`,{type:`range`,min:.3,max:40,step:.1,value:t.focus,onChange:e=>x({focus:Number(e.target.value)}),"aria-label":e(`Focus distance`)}),(0,R.jsxs)(`b`,{children:[t.focus.toFixed(1),` m`]})]}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Blur`})}),(0,R.jsx)(`input`,{type:`range`,min:0,max:1,step:.05,value:t.blur,onChange:e=>x({blur:Number(e.target.value)}),"aria-label":e(`Blur strength`)}),(0,R.jsxs)(`b`,{children:[Math.round(t.blur*100),`%`]})]})]}),(0,R.jsxs)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>u(),children:[(0,R.jsx)(F,{children:`◎ Focus on the middle`}),` `,(0,R.jsx)(`kbd`,{children:`T`})]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Filter`})}),(0,R.jsx)(`div`,{className:`photo-chips`,role:`radiogroup`,"aria-label":e(`Filter`),children:b.map(n=>(0,R.jsx)(`button`,{role:`radio`,"aria-checked":t.filter===n,className:`photo-chip ${t.filter===n?`on`:``}`,onClick:()=>x({filter:n}),children:e(l[n])},n))}),(0,R.jsxs)(`div`,{className:`photo-checks`,children:[(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.stamp,onChange:e=>x({stamp:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Logo stamp`})]}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.caption,onChange:e=>x({caption:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Floor and date`})]}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.guides,onChange:e=>x({guides:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Thirds guides`})]})]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsxs)(`h4`,{children:[(0,R.jsx)(F,{children:`Time of day`}),` `,(0,R.jsx)(`span`,{className:`muted small`,children:w(q)})]}),(0,R.jsx)(`input`,{type:`range`,min:0,max:1,step:.002,value:q,onChange:e=>h(Number(e.target.value)),"aria-label":e(`Time of day`),"aria-valuetext":w(q)}),(0,R.jsxs)(`div`,{className:`row wrap`,children:[(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(s),children:(0,R.jsx)(F,{children:`🌇 Golden hour`})}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(.5),children:(0,R.jsx)(F,{children:`☀️ Noon`})}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(.79),children:(0,R.jsx)(F,{children:`🌆 Blue hour`})}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(null),disabled:t.daytime===null,children:(0,R.jsx)(F,{children:`↺ As it is`})})]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Shot`})}),(0,R.jsxs)(`div`,{className:`photo-chips`,role:`radiogroup`,"aria-label":e(`Shot size`),children:[D.map(e=>(0,R.jsxs)(`button`,{role:`radio`,"aria-checked":t.scale===e,className:`photo-chip ${t.scale===e?`on`:``}`,onClick:()=>x({scale:e}),children:[e,`×`]},e)),(0,R.jsxs)(`span`,{className:`muted small`,children:[G.width,`×`,G.height]})]}),(0,R.jsxs)(`button`,{className:`btn photo-big`,disabled:!!t.busy,onClick:()=>void v(),children:[`📸 `,e(t.busy===`Developing…`?`Developing…`:`Take the shot`),` `,(0,R.jsx)(`kbd`,{children:`Enter`})]}),(0,R.jsx)(`p`,{className:`muted small`,children:(0,R.jsx)(F,{children:`Saves a PNG to your downloads and copies it.`})})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Clip`})}),(0,R.jsxs)(`div`,{className:`photo-chips`,children:[o.map(e=>(0,R.jsxs)(`button`,{className:`photo-chip ${t.clipSeconds===e?`on`:``}`,"aria-pressed":t.clipSeconds===e,onClick:()=>x({clipSeconds:e}),children:[e,` s`]},e)),[30,60].map(e=>(0,R.jsxs)(`button`,{className:`photo-chip ${t.fps===e?`on`:``}`,"aria-pressed":t.fps===e,onClick:()=>x({fps:e}),children:[e,` fps`]},e))]}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Camera`})}),(0,R.jsxs)(`select`,{value:t.orbit,onChange:e=>x({orbit:e.target.value}),"aria-label":e(`Cinematic orbit`),children:[(0,R.jsx)(`option`,{value:`free`,children:e(`Free (fly it yourself)`)}),E!==0&&(0,R.jsx)(`option`,{value:`gong`,children:e(`Orbit the gong`)}),E!==0&&(0,R.jsx)(`option`,{value:`board`,children:e(`Orbit the whiteboard`)}),W.map(t=>(0,R.jsx)(`option`,{value:`person:${t.id}`,children:e(`Orbit {name}`,{name:t.name})},t.id))]})]}),(0,R.jsxs)(`button`,{className:`btn photo-big ${t.recording?`photo-recording`:``}`,disabled:!t.recording&&!!t.busy,onClick:()=>void y(),children:[e(t.recording?`■ Stop recording`:t.busy===`Saving the clip…`?`Saving the clip…`:`⏺ Record`),` `,(0,R.jsx)(`kbd`,{children:`V`})]}),(0,R.jsxs)(`p`,{className:`muted small`,children:[(0,R.jsx)(F,{children:`A WebM with the office’s sound, up to a minute`}),n?e(` (frozen: a still scene, unless the camera moves)`):``,`.`]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Instant replay`})}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>A(e.target.checked)}),` `,(0,R.jsx)(F,{children:`Keep the last 15 s, any time`})]}),(0,R.jsxs)(`p`,{className:`muted small`,children:[(0,R.jsx)(F,{children:`Press`}),` `,(0,R.jsx)(P,{action:`saveReplay`}),` `,(0,R.jsx)(F,{children:`to save them. Off by default: it records all the time, which takes memory.`})]})]}),(0,R.jsx)(H,{}),(0,R.jsxs)(`p`,{className:`photo-keys muted small`,children:[(0,R.jsx)(F,{children:`Click the view to steer ·`}),` `,(0,R.jsx)(N,{joined:!0}),` `,(0,R.jsx)(F,{children:`fly`}),` · `,(0,R.jsx)(`kbd`,{children:`Space`}),`/`,(0,R.jsx)(`kbd`,{children:`C`}),` `,(0,R.jsx)(F,{children:`up/down`}),` · `,(0,R.jsx)(P,{action:`run`}),` `,(0,R.jsx)(F,{children:`faster`}),` · `,(0,R.jsx)(P,{action:`rotateLeft`}),`/`,(0,R.jsx)(P,{action:`rotateRight`}),` `,(0,R.jsx)(F,{children:`roll · wheel zoom ·`}),` `,(0,R.jsx)(`kbd`,{children:`R`}),` `,(0,R.jsx)(F,{children:`reset`}),` · `,(0,R.jsx)(`kbd`,{children:`H`}),` `,(0,R.jsx)(F,{children:`hide panel`}),` · `,(0,R.jsx)(`kbd`,{children:`Esc`}),` `,(0,R.jsx)(F,{children:`frees the mouse, then leaves`})]})]}):(0,R.jsxs)(`button`,{className:`photo-show`,onClick:()=>x({panel:!0}),children:[`📷 `,(0,R.jsx)(`kbd`,{children:`H`}),` `,(0,R.jsx)(F,{children:`show the panel`})]}),(0,R.jsx)(`div`,{className:`toasts photo-toasts`,children:_.map(e=>(0,R.jsx)(`div`,{className:`toast toast-${e.level}`,onClick:()=>C(e.id),children:e.text},e.id))})]})}export{W as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{en as r,l as i,p as a}from"./store-9CvxLGNQ.js";import{CLIP_SECONDS as o,GOLDEN_HOUR as s,cam as c,d as l,focusCenter as u,leave as d,n as f,overlayOptions as p,requestFrame as m,setDaytime as h,setFrozen as g,t as _,takeShot as v,toggleRecording as y,u as b,update as x,usePhoto as S}from"./photoMode-BTxq9-gL.js";import{a as C,c as w,d as T,i as E,o as D,r as O,u as k}from"./gallery-DSKvNkBq.js";import{c as A,u as j}from"./gate-D6_NXB1w.js";import{s as M}from"./useDayTime-Nrdy7kH1.js";import{M as N,j as P}from"./AccessibilitySettings-vd4x_sEq.js";import{o as F,s as I}from"./index-rznd4Djx.js";var L=e(t(),1),R=n();function z(){let e=(0,L.useRef)(null),t=S(),n=a(e=>e.floor),[r,i]=(0,L.useState)({w:window.innerWidth,h:window.innerHeight});return(0,L.useEffect)(()=>{let e=()=>i({w:window.innerWidth,h:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,L.useEffect)(()=>{let t=e.current;if(!t)return;let n=window.devicePixelRatio||1;t.width=Math.round(r.w*n),t.height=Math.round(r.h*n);let i=t.getContext(`2d`);i&&(i.clearRect(0,0,t.width,t.height),_(i,t.width,t.height,p(!0)))},[t.filter,t.stamp,t.caption,t.guides,r,n]),(0,R.jsx)(`canvas`,{ref:e,className:`photo-preview`,"aria-hidden":`true`})}function B(){let e=S(e=>e.recording),[,t]=(0,L.useState)(0);if((0,L.useEffect)(()=>{if(!e)return;let n=setInterval(()=>t(e=>e+1),250);return()=>clearInterval(n)},[e]),!e)return null;let n=Math.min(e.limit,(performance.now()-e.started)/1e3),r=e=>`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`;return(0,R.jsxs)(`div`,{className:`photo-rec`,role:`status`,children:[(0,R.jsx)(`span`,{className:`photo-rec-dot`}),` REC `,r(n),` / `,r(e.limit),(0,R.jsxs)(`button`,{className:`btn btn-small`,onClick:()=>void y(),children:[(0,R.jsx)(F,{children:`■ Stop`}),` `,(0,R.jsx)(`kbd`,{children:`V`})]})]})}function V({item:e}){return e.kind===`shot`?(0,R.jsx)(`img`,{src:e.thumb??e.url,alt:``}):(0,R.jsx)(`video`,{src:e.url,muted:!0,preload:`metadata`})}function H(){let e=I(),t=C(e=>e.items),n=t.reduce((e,t)=>e+t.bytes,0);return(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsxs)(`h4`,{children:[(0,R.jsx)(F,{children:`Gallery`}),` `,(0,R.jsx)(`span`,{className:`muted small`,children:t.length?e(`{count} · {size} · this tab only`,{count:t.length,size:k(n)}):e(`empty`)})]}),t.length>0&&(0,R.jsx)(`ul`,{className:`photo-gallery`,children:[...t].reverse().map(t=>(0,R.jsxs)(`li`,{title:t.name,children:[(0,R.jsx)(V,{item:t}),(0,R.jsxs)(`div`,{className:`photo-gallery-meta`,children:[(0,R.jsx)(`span`,{children:t.kind===`shot`?`📸 ${t.width}×${t.height}`:`${t.kind===`replay`?`⏪`:`🎬`} ${Math.round(t.seconds??0)} s`}),(0,R.jsx)(`span`,{className:`muted`,children:k(t.bytes)})]}),(0,R.jsxs)(`div`,{className:`photo-gallery-actions`,children:[(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>E(t),"aria-label":e(`Download {name}`,{name:t.name}),children:`⬇`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>O(t.id),"aria-label":e(`Delete {name}`,{name:t.name}),children:`🗑`})]})]},t.id))})]})}function U(){let[e,t]=(0,L.useState)({fov:c.fov,roll:c.roll});return(0,L.useEffect)(()=>{let e=setInterval(()=>t(e=>e.fov===c.fov&&e.roll===c.roll?e:{fov:c.fov,roll:c.roll}),150);return()=>clearInterval(e)},[]),e}function W(){let e=I(),t=S(),n=j(e=>e.frozen),p=j(e=>e.replay),_=a(e=>e.toasts),C=a(e=>e.dismissToast),E=a(e=>e.floor),O=a(e=>e.floor===0?null:i(e.repos,e.floor)),k=a(e=>e.agents),{fov:L,roll:V}=U(),W=Object.values(k).filter(e=>(O?e.repoId===O.id:e.role===`ceo`)&&r(e.id)),G=T(window.innerWidth,window.innerHeight,window.devicePixelRatio||1,t.scale),K=M().t,q=t.daytime??K;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(z,{}),(0,R.jsx)(B,{}),t.panel?(0,R.jsxs)(`aside`,{className:`photo-panel`,"aria-label":e(`Photo mode`),children:[(0,R.jsxs)(`header`,{className:`photo-head`,children:[(0,R.jsx)(`b`,{children:(0,R.jsx)(F,{children:`📷 Photo mode`})}),(0,R.jsxs)(`button`,{className:`btn btn-small`,onClick:d,title:e(`Back to the office (or Esc with the mouse free)`),children:[(0,R.jsx)(F,{children:`Leave`}),` `,(0,R.jsx)(P,{action:`photo`})]})]}),t.note&&(0,R.jsx)(`p`,{className:`photo-note ${t.note.level===`error`?`photo-note-bad`:``}`,role:`status`,onClick:()=>x({note:null}),children:t.note.message?t.note.message.map(t=>e(t.key,t.values)).join(``):t.note.text}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>g(e.target.checked)}),` `,(0,R.jsx)(F,{children:`❄ Freeze the office`}),` `,(0,R.jsx)(`kbd`,{children:`F`})]}),(0,R.jsx)(`p`,{className:`muted small`,children:e(n?`Everyone holds still; the work carries on and catches up when you thaw.`:`Live: people, toys and the sky move. Good for clips.`)})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Camera`})}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Zoom`})}),(0,R.jsx)(`input`,{type:`range`,min:15,max:110,step:1,value:Math.round(L),onChange:e=>(c.fov=Number(e.target.value),m()),"aria-label":e(`Field of view`)}),(0,R.jsxs)(`b`,{children:[Math.round(L),`°`]})]}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Roll`})}),(0,R.jsx)(`input`,{type:`range`,min:-45,max:45,step:1,value:Math.round(V*180/Math.PI),onChange:e=>(c.roll=Math.max(-f,Math.min(f,Number(e.target.value)*Math.PI/180)),m()),"aria-label":e(`Roll`)}),(0,R.jsxs)(`b`,{children:[Math.round(V*180/Math.PI),`°`]})]}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.dof,onChange:e=>x({dof:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Depth of field`})]}),t.dof&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Focus`})}),(0,R.jsx)(`input`,{type:`range`,min:.3,max:40,step:.1,value:t.focus,onChange:e=>x({focus:Number(e.target.value)}),"aria-label":e(`Focus distance`)}),(0,R.jsxs)(`b`,{children:[t.focus.toFixed(1),` m`]})]}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Blur`})}),(0,R.jsx)(`input`,{type:`range`,min:0,max:1,step:.05,value:t.blur,onChange:e=>x({blur:Number(e.target.value)}),"aria-label":e(`Blur strength`)}),(0,R.jsxs)(`b`,{children:[Math.round(t.blur*100),`%`]})]})]}),(0,R.jsxs)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>u(),children:[(0,R.jsx)(F,{children:`◎ Focus on the middle`}),` `,(0,R.jsx)(`kbd`,{children:`T`})]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Filter`})}),(0,R.jsx)(`div`,{className:`photo-chips`,role:`radiogroup`,"aria-label":e(`Filter`),children:b.map(n=>(0,R.jsx)(`button`,{role:`radio`,"aria-checked":t.filter===n,className:`photo-chip ${t.filter===n?`on`:``}`,onClick:()=>x({filter:n}),children:e(l[n])},n))}),(0,R.jsxs)(`div`,{className:`photo-checks`,children:[(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.stamp,onChange:e=>x({stamp:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Logo stamp`})]}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.caption,onChange:e=>x({caption:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Floor and date`})]}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t.guides,onChange:e=>x({guides:e.target.checked})}),` `,(0,R.jsx)(F,{children:`Thirds guides`})]})]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsxs)(`h4`,{children:[(0,R.jsx)(F,{children:`Time of day`}),` `,(0,R.jsx)(`span`,{className:`muted small`,children:w(q)})]}),(0,R.jsx)(`input`,{type:`range`,min:0,max:1,step:.002,value:q,onChange:e=>h(Number(e.target.value)),"aria-label":e(`Time of day`),"aria-valuetext":w(q)}),(0,R.jsxs)(`div`,{className:`row wrap`,children:[(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(s),children:(0,R.jsx)(F,{children:`🌇 Golden hour`})}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(.5),children:(0,R.jsx)(F,{children:`☀️ Noon`})}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(.79),children:(0,R.jsx)(F,{children:`🌆 Blue hour`})}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-small`,onClick:()=>h(null),disabled:t.daytime===null,children:(0,R.jsx)(F,{children:`↺ As it is`})})]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Shot`})}),(0,R.jsxs)(`div`,{className:`photo-chips`,role:`radiogroup`,"aria-label":e(`Shot size`),children:[D.map(e=>(0,R.jsxs)(`button`,{role:`radio`,"aria-checked":t.scale===e,className:`photo-chip ${t.scale===e?`on`:``}`,onClick:()=>x({scale:e}),children:[e,`×`]},e)),(0,R.jsxs)(`span`,{className:`muted small`,children:[G.width,`×`,G.height]})]}),(0,R.jsxs)(`button`,{className:`btn photo-big`,disabled:!!t.busy,onClick:()=>void v(),children:[`📸 `,e(t.busy===`Developing…`?`Developing…`:`Take the shot`),` `,(0,R.jsx)(`kbd`,{children:`Enter`})]}),(0,R.jsx)(`p`,{className:`muted small`,children:(0,R.jsx)(F,{children:`Saves a PNG to your downloads and copies it.`})})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Clip`})}),(0,R.jsxs)(`div`,{className:`photo-chips`,children:[o.map(e=>(0,R.jsxs)(`button`,{className:`photo-chip ${t.clipSeconds===e?`on`:``}`,"aria-pressed":t.clipSeconds===e,onClick:()=>x({clipSeconds:e}),children:[e,` s`]},e)),[30,60].map(e=>(0,R.jsxs)(`button`,{className:`photo-chip ${t.fps===e?`on`:``}`,"aria-pressed":t.fps===e,onClick:()=>x({fps:e}),children:[e,` fps`]},e))]}),(0,R.jsxs)(`label`,{className:`photo-row`,children:[(0,R.jsx)(`span`,{children:(0,R.jsx)(F,{children:`Camera`})}),(0,R.jsxs)(`select`,{value:t.orbit,onChange:e=>x({orbit:e.target.value}),"aria-label":e(`Cinematic orbit`),children:[(0,R.jsx)(`option`,{value:`free`,children:e(`Free (fly it yourself)`)}),E!==0&&(0,R.jsx)(`option`,{value:`gong`,children:e(`Orbit the gong`)}),E!==0&&(0,R.jsx)(`option`,{value:`board`,children:e(`Orbit the whiteboard`)}),W.map(t=>(0,R.jsx)(`option`,{value:`person:${t.id}`,children:e(`Orbit {name}`,{name:t.name})},t.id))]})]}),(0,R.jsxs)(`button`,{className:`btn photo-big ${t.recording?`photo-recording`:``}`,disabled:!t.recording&&!!t.busy,onClick:()=>void y(),children:[e(t.recording?`■ Stop recording`:t.busy===`Saving the clip…`?`Saving the clip…`:`⏺ Record`),` `,(0,R.jsx)(`kbd`,{children:`V`})]}),(0,R.jsxs)(`p`,{className:`muted small`,children:[(0,R.jsx)(F,{children:`A WebM with the office’s sound, up to a minute`}),n?e(` (frozen: a still scene, unless the camera moves)`):``,`.`]})]}),(0,R.jsxs)(`section`,{className:`photo-section`,children:[(0,R.jsx)(`h4`,{children:(0,R.jsx)(F,{children:`Instant replay`})}),(0,R.jsxs)(`label`,{className:`toggle`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>A(e.target.checked)}),` `,(0,R.jsx)(F,{children:`Keep the last 15 s, any time`})]}),(0,R.jsxs)(`p`,{className:`muted small`,children:[(0,R.jsx)(F,{children:`Press`}),` `,(0,R.jsx)(P,{action:`saveReplay`}),` `,(0,R.jsx)(F,{children:`to save them. Off by default: it records all the time, which takes memory.`})]})]}),(0,R.jsx)(H,{}),(0,R.jsxs)(`p`,{className:`photo-keys muted small`,children:[(0,R.jsx)(F,{children:`Click the view to steer ·`}),` `,(0,R.jsx)(N,{joined:!0}),` `,(0,R.jsx)(F,{children:`fly`}),` · `,(0,R.jsx)(`kbd`,{children:`Space`}),`/`,(0,R.jsx)(`kbd`,{children:`C`}),` `,(0,R.jsx)(F,{children:`up/down`}),` · `,(0,R.jsx)(P,{action:`run`}),` `,(0,R.jsx)(F,{children:`faster`}),` · `,(0,R.jsx)(P,{action:`rotateLeft`}),`/`,(0,R.jsx)(P,{action:`rotateRight`}),` `,(0,R.jsx)(F,{children:`roll · wheel zoom ·`}),` `,(0,R.jsx)(`kbd`,{children:`R`}),` `,(0,R.jsx)(F,{children:`reset`}),` · `,(0,R.jsx)(`kbd`,{children:`H`}),` `,(0,R.jsx)(F,{children:`hide panel`}),` · `,(0,R.jsx)(`kbd`,{children:`Esc`}),` `,(0,R.jsx)(F,{children:`frees the mouse, then leaves`})]})]}):(0,R.jsxs)(`button`,{className:`photo-show`,onClick:()=>x({panel:!0}),children:[`📷 `,(0,R.jsx)(`kbd`,{children:`H`}),` `,(0,R.jsx)(F,{children:`show the panel`})]}),(0,R.jsx)(`div`,{className:`toasts photo-toasts`,children:_.map(e=>(0,R.jsx)(`div`,{className:`toast toast-${e.level}`,onClick:()=>C(e.id),children:e.text},e.id))})]})}export{W as default};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pipeline-BGPWXegt.js","assets/bloomMarks-DRhDp19k.js","assets/rolldown-runtime-XKyaHtl9.js","assets/jsx-runtime-CXW0f58S.js","assets/index-CDJgPTOC.js","assets/store-CXLtXw8e.js","assets/index-COpmc42S.css","assets/useDayTime-BjBDzh_t.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{s as t}from"./jsx-runtime-CXW0f58S.js";import{Bt as n,F as r,Ht as i,O as a,Tt as o,V as s,X as c,_t as l,ct as u,dt as d,f,g as p,gt as m,it as h,nt as g,pt as _,ut as v,wt as y,yt as b,zt as x}from"./bloomMarks-DRhDp19k.js";import{G as S,H as C,k as w}from"./mic-BnAa4E99.js";import{l as ee,t as T}from"./useGraphics-Bg6L4EdS.js";import{Ra as E,en as D,m as O,wa as k}from"./store-CXLtXw8e.js";import{Ar as te,Mr as ne,Or as re,jr as ie,kr as ae}from"./Office-9Mank16i.js";import{r as oe}from"./useDayTime-BjBDzh_t.js";import{a as se,activeClip as A,c as ce,cam as j,f as M,focusCenter as N,i as P,l as F,leave as I,o as L,overlayOptions as R,p as z,r as B,requestFrame as V,s as H,setBridge as U,setFrozen as W,t as G,takeRedraw as le,takeShot as ue,toggleRecording as de,update as K,usePhoto as q}from"./photoMode-BybFMLKC.js";import{u as J}from"./gate-D0uU0wv5.js";import{_ as fe,d as pe,f as me,p as he}from"./gallery-COKuWb9E.js";var Y=e(t(),1),X=.014,Z=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pipeline-DNe3sjnP.js","assets/bloomMarks-C22qSi5d.js","assets/rolldown-runtime-XKyaHtl9.js","assets/jsx-runtime-CZP6s5wa.js","assets/index-rznd4Djx.js","assets/store-9CvxLGNQ.js","assets/index-COpmc42S.css","assets/useDayTime-Nrdy7kH1.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t}from"./jsx-runtime-CZP6s5wa.js";import{Bt as n,F as r,Ht as i,O as a,Tt as o,V as s,X as c,_t as l,ct as u,dt as d,f,g as p,gt as m,it as h,nt as g,pt as _,ut as v,wt as y,yt as b,zt as x}from"./bloomMarks-C22qSi5d.js";import{G as S,H as C,k as w}from"./mic-DeYDrNoY.js";import{l as ee,t as T}from"./useGraphics-Bhnj8CAm.js";import{Ra as E,en as D,m as O,wa as k}from"./store-9CvxLGNQ.js";import{Ar as te,Mr as ne,Or as re,jr as ie,kr as ae}from"./Office-B_EroD2U.js";import{r as oe}from"./useDayTime-Nrdy7kH1.js";import{a as se,activeClip as A,c as ce,cam as j,f as M,focusCenter as N,i as P,l as F,leave as I,o as L,overlayOptions as R,p as z,r as B,requestFrame as V,s as H,setBridge as U,setFrozen as W,t as G,takeRedraw as le,takeShot as ue,toggleRecording as de,update as K,usePhoto as q}from"./photoMode-BTxq9-gL.js";import{u as J}from"./gate-D6_NXB1w.js";import{_ as fe,d as pe,f as me,p as he}from"./gallery-DSKvNkBq.js";var Y=e(t(),1),X=.014,Z=`
3
3
  varying vec2 vUv;
4
4
  void main() {
5
5
  vUv = uv;
@@ -112,4 +112,4 @@ void main() {
112
112
  if (uGrain > 0.0) c += (hash(floor(full / max(1.0, uPx * 0.75))) - 0.5) * uGrain;
113
113
 
114
114
  gl_FragColor = vec4(clamp(c, 0.0, 1.0), 1.0);
115
- }`,_e=class{gl;color=null;depth=new i(1,1,{minFilter:u,magFilter:u,depthBuffer:!0});depthMaterial=new h({depthPacking:l});material;quad;quadScene=new y;quadCamera=new v(-1,1,1,-1,0,1);size=new x;clear=new a;shown=[];supported=!0;constructor(e){this.gl=e,this.depthMaterial.blending=0,this.material=new o({vertexShader:Z,fragmentShader:ge,depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{tColor:{value:null},tDepth:{value:this.depth.texture},uSize:{value:new x(1,1)},uOrigin:{value:new x},uFull:{value:new x(1,1)},uPx:{value:1},uSeed:{value:0},uDof:{value:0},uFocus:{value:5},uBlur:{value:0},uNear:{value:.05},uFar:{value:500},uSaturation:{value:1},uContrast:{value:1},uGain:{value:new n(1,1,1)},uLift:{value:new n},uVignette:{value:0},uGrain:{value:0},uPosterize:{value:0},uInk:{value:0}}}),this.quad=new g(new _(2,2),this.material),this.quad.frustumCulled=!1,this.quadScene.add(this.quad)}margin(e){let t=e.grade.ink>0?Math.ceil(e.px)+2:0;return e.dof&&(t=Math.max(t,Math.ceil(e.dof.blur*X*e.full[1])+2)),t}render(e,t,n,r,i){let a=this.gl;if(a.setRenderTarget(null),n)n.render(r);else{let n=a.autoClear;a.autoClear=!0,a.render(e,t),a.autoClear=n}if(!this.supported||!i.dof&&!z(i.grade))return;a.getDrawingBufferSize(this.size);let o=this.size.x,l=this.size.y;this.color&&this.color.image.width===o&&this.color.image.height===l||(this.color?.dispose(),this.color=new s(o,l),this.color.minFilter=c,this.color.magFilter=c);try{a.copyFramebufferToTexture(this.color)}catch{this.supported=!1;return}let u=this.material.uniforms;i.dof&&((this.depth.width!==o||this.depth.height!==l)&&this.depth.setSize(o,l),this.depthPass(e,t,i.seeThrough)),u.tColor.value=this.color,u.uSize.value.set(o,l),u.uOrigin.value.set(i.origin[0],i.origin[1]),u.uFull.value.set(i.full[0],i.full[1]),u.uPx.value=i.px,u.uSeed.value=i.seed,u.uDof.value=+!!i.dof,u.uFocus.value=i.dof?.focus??5,u.uBlur.value=i.dof?i.dof.blur*X*i.full[1]:0,u.uNear.value=t.near,u.uFar.value=t.far;let d=i.grade;u.uSaturation.value=d.saturation,u.uContrast.value=d.contrast,u.uGain.value.set(d.gain[0],d.gain[1],d.gain[2]),u.uLift.value.set(d.lift[0],d.lift[1],d.lift[2]),u.uVignette.value=d.vignette,u.uGrain.value=d.grain,u.uPosterize.value=d.posterize,u.uInk.value=d.ink,a.render(this.quadScene,this.quadCamera)}depthPass(e,t,n){let r=this.gl,i=e.background,a=r.shadowMap.autoUpdate,o=r.getClearAlpha();r.getClearColor(this.clear),this.shown.length=0;for(let e=0;e<n.length;e++)this.shown.push(n[e].visible),n[e].visible=!1;e.background=null,e.overrideMaterial=this.depthMaterial,r.shadowMap.autoUpdate=!1,r.setClearColor(16777215,1),r.setRenderTarget(this.depth),r.clear(),r.render(e,t),r.setRenderTarget(null),r.setClearColor(this.clear,o),r.shadowMap.autoUpdate=a,e.overrideMaterial=null,e.background=i;for(let e=0;e<n.length;e++)n[e].visible=this.shown[e]}dispose(){this.color?.dispose(),this.depth.dispose(),this.depthMaterial.dispose(),this.material.dispose(),this.quad.geometry.dispose()}},ve=[`forward`,`back`,`left`,`right`,`run`,`rotateLeft`,`rotateRight`],Q=`Space`,$=`KeyC`;function ye(e){let t=e.target;return!t||t===document.body?`view`:t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable?`text`:t.tagName===`INPUT`?[`range`,`checkbox`,`radio`,`button`].includes(t.type)?`control`:`text`:t.tagName===`BUTTON`?`control`:`view`}function be(e,t){if(e===`gong`)t.set(E.x,E.y,E.z);else if(e===`board`)t.set(0,k.y+k.h/2,k.z);else if(e.startsWith(`person:`)){let n=D(e.slice(7));if(!n)return!1;n.stage===`seated`?t.set(n.seatX,1.1,n.seatZ):t.set(n.x,1.35,n.z)}else return!1;return!0}function xe(e){for(;e;e=e.parent)if(!e.visible&&!e.userData.standIn)return!1;return!0}function Se(e){for(let t=0;e&&t<6;e=e.parent,t++){let t=e.userData;if(t.billboard||t.facesCamera)return!0}return!1}function Ce(e){for(;e;e=e.parent)if(e.userData.firstPerson)return!0;return!1}function we(){let e=p(e=>e.gl),t=p(e=>e.scene),i=p(e=>e.camera),a=p(e=>e.size),o=p(e=>e.get),s=J(e=>e.frozen),c=(0,Y.useMemo)(()=>new d(i.fov,1,i.near,i.far),[i]),l=(0,Y.useMemo)(()=>new _e(e),[e]);(0,Y.useEffect)(()=>()=>l.dispose(),[l]);let u=ee(T),[h,g]=(0,Y.useState)(null),_=(0,Y.useMemo)(()=>{let e={keys:new Set,input:{forward:0,right:0,up:0,roll:0,fast:!1},orbit:null,orbitKey:`free`,target:new n,facing:[],firstPerson:[],seeThrough:[],hidden:[],fogBack:0,scanAt:-1/0,frames:0,seed:0,q:new m,buf:new x,ray:new b,center:new x,unlockedAt:-1/0,lookFilter:ae(),width:1,height:1,pipe:null,delta:0,post:{grade:M.none,dof:null,seed:0,origin:[0,0],full:[1,1],px:1,seeThrough:[]},dof:{focus:4,blur:.5},visit:t=>{let n=t.userData;n.billboard&&t.children[0]&&e.facing.push(t.children[0]),n.facesCamera&&e.facing.push(t),n.firstPerson&&e.firstPerson.push(t);let r=t;r.isMesh&&!Array.isArray(r.material)&&r.material.transparent&&!Se(t)&&e.seeThrough.push(t)}};return e.post.seeThrough=e.seeThrough,e},[]);(0,Y.useLayoutEffect)(()=>{_.width=Math.max(1,a.width),_.height=Math.max(1,a.height),h?.setSize(_.width,_.height),V()},[_,a,h]),(0,Y.useEffect)(()=>{if(u===`low`)return;let n=!0,r=null;return O(async()=>{let{createPipeline:e}=await import(`./pipeline-BGPWXegt.js`);return{createPipeline:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({createPipeline:i})=>{if(n)try{r=i(e,t,c,u),r.setSize(_.width,_.height),_.pipe=r,g(r),V()}catch{}}),()=>{n=!1,_.pipe=null,r?.dispose(),g(null)}},[e,t,c,_,u]),(0,Y.useLayoutEffect)(()=>{let e=new r().setFromQuaternion(i.quaternion,`YXZ`);Object.assign(j,se(i.position.x,i.position.y,i.position.z,e.y,e.x,i.fov)),V()},[i]);let{prepare:v,putBack:y,frame:E}=(0,Y.useMemo)(()=>{let n=()=>{_.facing.length=0,_.firstPerson.length=0,_.seeThrough.length=0,t.traverse(_.visit),_.scanAt=_.frames},r=()=>{c.position.set(j.x,j.y,j.z),c.rotation.set(j.pitch,j.yaw,j.roll,`YXZ`);let e=_.width/_.height;(c.fov!==j.fov||c.aspect!==e)&&(c.fov=j.fov,c.aspect=e,c.updateProjectionMatrix()),c.updateMatrixWorld(),_.frames-_.scanAt>30&&n();for(let e=0;e<_.facing.length;e++){let t=_.facing[e];t.parent&&(t.parent.getWorldQuaternion(_.q),t.quaternion.copy(c.quaternion).premultiply(_.q.invert()))}_.hidden.length=0;for(let e=0;e<_.firstPerson.length;e++)_.hidden.push(_.firstPerson[e].visible),_.firstPerson[e].visible=!1;let r=t.fog;_.fogBack=r?.isFog?c.position.distanceTo(i.position):0,r&&_.fogBack&&(r.near+=_.fogBack,r.far+=_.fogBack);let a=q.getState(),o=_.post;o.grade=M[a.filter],_.dof.focus=a.focus,_.dof.blur=a.blur,o.dof=a.dof&&a.blur>0?_.dof:null},a=()=>{for(let e=0;e<_.firstPerson.length;e++)_.firstPerson[e].visible=_.hidden[e];let e=t.fog;e&&_.fogBack&&(e.near-=_.fogBack,e.far-=_.fogBack),_.fogBack=0},o=()=>{r(),e.getDrawingBufferSize(_.buf);let n=_.post;n.origin[0]=0,n.origin[1]=0,n.full[0]=_.buf.x,n.full[1]=_.buf.y,n.px=e.getPixelRatio(),n.seed=_.seed,l.render(t,c,_.pipe,_.delta,n),a(),A()?.draw(),_.frames++};return{prepare:r,putBack:a,frame:(e,t)=>{_.delta=e;let n=_.keys,r=_.input,i=w();r.forward=+!!C(i,`forward`,n)-!!C(i,`back`,n),r.right=+!!C(i,`right`,n)-!!C(i,`left`,n),r.up=+!!n.has(Q)-!!n.has($),r.roll=+!!C(i,`rotateRight`,n)-!!C(i,`rotateLeft`,n),r.fast=C(i,`run`,n);let a=q.getState().orbit,s=!1;if(a!==`free`&&be(a,_.target)){let t=_.target;_.orbitKey===a&&_.orbit||(_.orbit=L(j,t.x,t.y,t.z)),_.orbitKey=a,_.orbit.cx=t.x,_.orbit.cy=t.y,_.orbit.cz=t.z,H(_.orbit,j,e),ce(j,r.roll,e),s=!0}else a!==`free`&&K({orbit:`free`}),_.orbitKey=`free`,B(j,r,e),s=r.forward!==0||r.right!==0||r.up!==0||r.roll!==0||Math.abs(j.vx)+Math.abs(j.vy)+Math.abs(j.vz)>1e-4;let c=A()!==null;c&&(_.seed=(_.seed+.618)%64),(le()||s||t||c)&&o()}}},[e,t,c,i,l,_]);return(0,Y.useEffect)(()=>{if(!s)return;let e=0,t=performance.now(),n=r=>{E(Math.min(.1,Math.max(0,(r-t)/1e3)),!1),t=r,e=requestAnimationFrame(n)};return V(),e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[s,E]),f((e,t)=>{J.getState().frozen||E(Math.min(t,.1),!0)},1),(0,Y.useEffect)(()=>q.subscribe((e,t)=>{e.daytime!==t.daytime&&J.getState().frozen&&oe(o()),V()}),[o]),(0,Y.useEffect)(()=>{let t=e.domElement,n=_.keys,r=e=>{let t=ye(e);if(t===`text`||e.ctrlKey||e.metaKey||e.altKey)return;let r=e.code;if(r===`Escape`){!document.pointerLockElement&&performance.now()-_.unlockedAt>400&&I();return}let a=w();if(r===Q||r===$||ve.some(e=>S(a,e,r))){if(t===`control`&&(r.startsWith(`Arrow`)||r===Q))return;e.preventDefault(),n.add(r)}else if(!e.repeat){if(r===`Enter`&&t===`view`)ue();else if(r===`KeyF`)W(!J.getState().frozen);else if(r===`KeyH`)K({panel:!q.getState().panel});else if(r===`KeyT`)N();else if(r===`KeyV`)de();else if(r===`KeyR`)j.roll=0,j.fov=i.fov,V();else return;e.preventDefault()}},a=e=>void n.delete(e.code),o=()=>n.clear(),s=e=>{if(e.button===0&&document.pointerLockElement!==t)try{t.requestPointerLock?.()?.catch?.(()=>void 0)}catch{}},c=e=>{if(document.pointerLockElement!==t||q.getState().orbit!==`free`)return;let n=te(_.lookFilter,e.movementX,e.movementY,e.timeStamp);if(!n)return;let{sensitivity:r,invertY:i}=ne.getState(),a=re*r*Math.min(1,j.fov/72);P(j,n[0]*a,n[1]*a*(i?-1:1)),V()},l=e=>{e.target?.closest?.(`.photo-panel`)||(j.fov=F(j.fov,e.deltaMode===1?e.deltaY*40:e.deltaY),V())},u=()=>{ie(_.lookFilter),document.pointerLockElement||(_.unlockedAt=performance.now())};return window.addEventListener(`keydown`,r),window.addEventListener(`keyup`,a),window.addEventListener(`blur`,o),t.addEventListener(`mousedown`,s),document.addEventListener(`mousemove`,c),window.addEventListener(`wheel`,l,{passive:!0}),document.addEventListener(`pointerlockchange`,u),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`keyup`,a),window.removeEventListener(`blur`,o),t.removeEventListener(`mousedown`,s),document.removeEventListener(`mousemove`,c),window.removeEventListener(`wheel`,l),document.removeEventListener(`pointerlockchange`,u)}},[e,_,i]),(0,Y.useEffect)(()=>(U({frames:()=>_.frames,focusCenter(){v(),y(),_.ray.setFromCamera(_.center,c);for(let e of _.ray.intersectObjects(t.children,!0)){let t=e.object;if(t.isMesh&&t.frustumCulled&&xe(t)&&!Ce(t)&&(Array.isArray(t.material)||!t.material.transparent))return e.distance}return null},async shot(n){let{width:r,height:i,scale:a}=pe(_.width,_.height,window.devicePixelRatio||1,n),o=document.createElement(`canvas`);o.width=r,o.height=i;let s=o.getContext(`2d`);if(!s)throw Error(`the browser could not make a canvas that big`);v(),e.getDrawingBufferSize(_.buf);let u=_.buf.x,d=_.buf.y,f=_.post;f.full[0]=r,f.full[1]=i,f.px=r/_.width;let p=f.dof!==null||z(f.grade),m=Math.max(p?l.margin(f):0,_.pipe?Math.round(Math.min(u,d)*.08):0);for(let n of me(r,i,u,d,m))c.setViewOffset(r,i,n.viewX,n.viewY,u,d),f.origin[0]=n.viewX,f.origin[1]=i-(n.viewY+d),l.render(t,c,_.pipe,0,f),s.drawImage(e.domElement,n.x-n.viewX,n.y-n.viewY,n.w,n.h,n.x,n.y,n.w,n.h);c.clearViewOffset(),c.aspect=_.width/_.height,c.updateProjectionMatrix(),y(),V(),G(s,r,i,R(!1));let h=await he(o,`image/png`),g=await fe(o,r,i);return o.width=0,{png:h,thumb:g,width:r,height:i,scale:a}}}),()=>U(null)),[e,t,c,l,_,v,y]),null}export{we as default};
115
+ }`,_e=class{gl;color=null;depth=new i(1,1,{minFilter:u,magFilter:u,depthBuffer:!0});depthMaterial=new h({depthPacking:l});material;quad;quadScene=new y;quadCamera=new v(-1,1,1,-1,0,1);size=new x;clear=new a;shown=[];supported=!0;constructor(e){this.gl=e,this.depthMaterial.blending=0,this.material=new o({vertexShader:Z,fragmentShader:ge,depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{tColor:{value:null},tDepth:{value:this.depth.texture},uSize:{value:new x(1,1)},uOrigin:{value:new x},uFull:{value:new x(1,1)},uPx:{value:1},uSeed:{value:0},uDof:{value:0},uFocus:{value:5},uBlur:{value:0},uNear:{value:.05},uFar:{value:500},uSaturation:{value:1},uContrast:{value:1},uGain:{value:new n(1,1,1)},uLift:{value:new n},uVignette:{value:0},uGrain:{value:0},uPosterize:{value:0},uInk:{value:0}}}),this.quad=new g(new _(2,2),this.material),this.quad.frustumCulled=!1,this.quadScene.add(this.quad)}margin(e){let t=e.grade.ink>0?Math.ceil(e.px)+2:0;return e.dof&&(t=Math.max(t,Math.ceil(e.dof.blur*X*e.full[1])+2)),t}render(e,t,n,r,i){let a=this.gl;if(a.setRenderTarget(null),n)n.render(r);else{let n=a.autoClear;a.autoClear=!0,a.render(e,t),a.autoClear=n}if(!this.supported||!i.dof&&!z(i.grade))return;a.getDrawingBufferSize(this.size);let o=this.size.x,l=this.size.y;this.color&&this.color.image.width===o&&this.color.image.height===l||(this.color?.dispose(),this.color=new s(o,l),this.color.minFilter=c,this.color.magFilter=c);try{a.copyFramebufferToTexture(this.color)}catch{this.supported=!1;return}let u=this.material.uniforms;i.dof&&((this.depth.width!==o||this.depth.height!==l)&&this.depth.setSize(o,l),this.depthPass(e,t,i.seeThrough)),u.tColor.value=this.color,u.uSize.value.set(o,l),u.uOrigin.value.set(i.origin[0],i.origin[1]),u.uFull.value.set(i.full[0],i.full[1]),u.uPx.value=i.px,u.uSeed.value=i.seed,u.uDof.value=+!!i.dof,u.uFocus.value=i.dof?.focus??5,u.uBlur.value=i.dof?i.dof.blur*X*i.full[1]:0,u.uNear.value=t.near,u.uFar.value=t.far;let d=i.grade;u.uSaturation.value=d.saturation,u.uContrast.value=d.contrast,u.uGain.value.set(d.gain[0],d.gain[1],d.gain[2]),u.uLift.value.set(d.lift[0],d.lift[1],d.lift[2]),u.uVignette.value=d.vignette,u.uGrain.value=d.grain,u.uPosterize.value=d.posterize,u.uInk.value=d.ink,a.render(this.quadScene,this.quadCamera)}depthPass(e,t,n){let r=this.gl,i=e.background,a=r.shadowMap.autoUpdate,o=r.getClearAlpha();r.getClearColor(this.clear),this.shown.length=0;for(let e=0;e<n.length;e++)this.shown.push(n[e].visible),n[e].visible=!1;e.background=null,e.overrideMaterial=this.depthMaterial,r.shadowMap.autoUpdate=!1,r.setClearColor(16777215,1),r.setRenderTarget(this.depth),r.clear(),r.render(e,t),r.setRenderTarget(null),r.setClearColor(this.clear,o),r.shadowMap.autoUpdate=a,e.overrideMaterial=null,e.background=i;for(let e=0;e<n.length;e++)n[e].visible=this.shown[e]}dispose(){this.color?.dispose(),this.depth.dispose(),this.depthMaterial.dispose(),this.material.dispose(),this.quad.geometry.dispose()}},ve=[`forward`,`back`,`left`,`right`,`run`,`rotateLeft`,`rotateRight`],Q=`Space`,$=`KeyC`;function ye(e){let t=e.target;return!t||t===document.body?`view`:t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable?`text`:t.tagName===`INPUT`?[`range`,`checkbox`,`radio`,`button`].includes(t.type)?`control`:`text`:t.tagName===`BUTTON`?`control`:`view`}function be(e,t){if(e===`gong`)t.set(E.x,E.y,E.z);else if(e===`board`)t.set(0,k.y+k.h/2,k.z);else if(e.startsWith(`person:`)){let n=D(e.slice(7));if(!n)return!1;n.stage===`seated`?t.set(n.seatX,1.1,n.seatZ):t.set(n.x,1.35,n.z)}else return!1;return!0}function xe(e){for(;e;e=e.parent)if(!e.visible&&!e.userData.standIn)return!1;return!0}function Se(e){for(let t=0;e&&t<6;e=e.parent,t++){let t=e.userData;if(t.billboard||t.facesCamera)return!0}return!1}function Ce(e){for(;e;e=e.parent)if(e.userData.firstPerson)return!0;return!1}function we(){let e=p(e=>e.gl),t=p(e=>e.scene),i=p(e=>e.camera),a=p(e=>e.size),o=p(e=>e.get),s=J(e=>e.frozen),c=(0,Y.useMemo)(()=>new d(i.fov,1,i.near,i.far),[i]),l=(0,Y.useMemo)(()=>new _e(e),[e]);(0,Y.useEffect)(()=>()=>l.dispose(),[l]);let u=ee(T),[h,g]=(0,Y.useState)(null),_=(0,Y.useMemo)(()=>{let e={keys:new Set,input:{forward:0,right:0,up:0,roll:0,fast:!1},orbit:null,orbitKey:`free`,target:new n,facing:[],firstPerson:[],seeThrough:[],hidden:[],fogBack:0,scanAt:-1/0,frames:0,seed:0,q:new m,buf:new x,ray:new b,center:new x,unlockedAt:-1/0,lookFilter:ae(),width:1,height:1,pipe:null,delta:0,post:{grade:M.none,dof:null,seed:0,origin:[0,0],full:[1,1],px:1,seeThrough:[]},dof:{focus:4,blur:.5},visit:t=>{let n=t.userData;n.billboard&&t.children[0]&&e.facing.push(t.children[0]),n.facesCamera&&e.facing.push(t),n.firstPerson&&e.firstPerson.push(t);let r=t;r.isMesh&&!Array.isArray(r.material)&&r.material.transparent&&!Se(t)&&e.seeThrough.push(t)}};return e.post.seeThrough=e.seeThrough,e},[]);(0,Y.useLayoutEffect)(()=>{_.width=Math.max(1,a.width),_.height=Math.max(1,a.height),h?.setSize(_.width,_.height),V()},[_,a,h]),(0,Y.useEffect)(()=>{if(u===`low`)return;let n=!0,r=null;return O(async()=>{let{createPipeline:e}=await import(`./pipeline-DNe3sjnP.js`);return{createPipeline:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({createPipeline:i})=>{if(n)try{r=i(e,t,c,u),r.setSize(_.width,_.height),_.pipe=r,g(r),V()}catch{}}),()=>{n=!1,_.pipe=null,r?.dispose(),g(null)}},[e,t,c,_,u]),(0,Y.useLayoutEffect)(()=>{let e=new r().setFromQuaternion(i.quaternion,`YXZ`);Object.assign(j,se(i.position.x,i.position.y,i.position.z,e.y,e.x,i.fov)),V()},[i]);let{prepare:v,putBack:y,frame:E}=(0,Y.useMemo)(()=>{let n=()=>{_.facing.length=0,_.firstPerson.length=0,_.seeThrough.length=0,t.traverse(_.visit),_.scanAt=_.frames},r=()=>{c.position.set(j.x,j.y,j.z),c.rotation.set(j.pitch,j.yaw,j.roll,`YXZ`);let e=_.width/_.height;(c.fov!==j.fov||c.aspect!==e)&&(c.fov=j.fov,c.aspect=e,c.updateProjectionMatrix()),c.updateMatrixWorld(),_.frames-_.scanAt>30&&n();for(let e=0;e<_.facing.length;e++){let t=_.facing[e];t.parent&&(t.parent.getWorldQuaternion(_.q),t.quaternion.copy(c.quaternion).premultiply(_.q.invert()))}_.hidden.length=0;for(let e=0;e<_.firstPerson.length;e++)_.hidden.push(_.firstPerson[e].visible),_.firstPerson[e].visible=!1;let r=t.fog;_.fogBack=r?.isFog?c.position.distanceTo(i.position):0,r&&_.fogBack&&(r.near+=_.fogBack,r.far+=_.fogBack);let a=q.getState(),o=_.post;o.grade=M[a.filter],_.dof.focus=a.focus,_.dof.blur=a.blur,o.dof=a.dof&&a.blur>0?_.dof:null},a=()=>{for(let e=0;e<_.firstPerson.length;e++)_.firstPerson[e].visible=_.hidden[e];let e=t.fog;e&&_.fogBack&&(e.near-=_.fogBack,e.far-=_.fogBack),_.fogBack=0},o=()=>{r(),e.getDrawingBufferSize(_.buf);let n=_.post;n.origin[0]=0,n.origin[1]=0,n.full[0]=_.buf.x,n.full[1]=_.buf.y,n.px=e.getPixelRatio(),n.seed=_.seed,l.render(t,c,_.pipe,_.delta,n),a(),A()?.draw(),_.frames++};return{prepare:r,putBack:a,frame:(e,t)=>{_.delta=e;let n=_.keys,r=_.input,i=w();r.forward=+!!C(i,`forward`,n)-!!C(i,`back`,n),r.right=+!!C(i,`right`,n)-!!C(i,`left`,n),r.up=+!!n.has(Q)-!!n.has($),r.roll=+!!C(i,`rotateRight`,n)-!!C(i,`rotateLeft`,n),r.fast=C(i,`run`,n);let a=q.getState().orbit,s=!1;if(a!==`free`&&be(a,_.target)){let t=_.target;_.orbitKey===a&&_.orbit||(_.orbit=L(j,t.x,t.y,t.z)),_.orbitKey=a,_.orbit.cx=t.x,_.orbit.cy=t.y,_.orbit.cz=t.z,H(_.orbit,j,e),ce(j,r.roll,e),s=!0}else a!==`free`&&K({orbit:`free`}),_.orbitKey=`free`,B(j,r,e),s=r.forward!==0||r.right!==0||r.up!==0||r.roll!==0||Math.abs(j.vx)+Math.abs(j.vy)+Math.abs(j.vz)>1e-4;let c=A()!==null;c&&(_.seed=(_.seed+.618)%64),(le()||s||t||c)&&o()}}},[e,t,c,i,l,_]);return(0,Y.useEffect)(()=>{if(!s)return;let e=0,t=performance.now(),n=r=>{E(Math.min(.1,Math.max(0,(r-t)/1e3)),!1),t=r,e=requestAnimationFrame(n)};return V(),e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[s,E]),f((e,t)=>{J.getState().frozen||E(Math.min(t,.1),!0)},1),(0,Y.useEffect)(()=>q.subscribe((e,t)=>{e.daytime!==t.daytime&&J.getState().frozen&&oe(o()),V()}),[o]),(0,Y.useEffect)(()=>{let t=e.domElement,n=_.keys,r=e=>{let t=ye(e);if(t===`text`||e.ctrlKey||e.metaKey||e.altKey)return;let r=e.code;if(r===`Escape`){!document.pointerLockElement&&performance.now()-_.unlockedAt>400&&I();return}let a=w();if(r===Q||r===$||ve.some(e=>S(a,e,r))){if(t===`control`&&(r.startsWith(`Arrow`)||r===Q))return;e.preventDefault(),n.add(r)}else if(!e.repeat){if(r===`Enter`&&t===`view`)ue();else if(r===`KeyF`)W(!J.getState().frozen);else if(r===`KeyH`)K({panel:!q.getState().panel});else if(r===`KeyT`)N();else if(r===`KeyV`)de();else if(r===`KeyR`)j.roll=0,j.fov=i.fov,V();else return;e.preventDefault()}},a=e=>void n.delete(e.code),o=()=>n.clear(),s=e=>{if(e.button===0&&document.pointerLockElement!==t)try{t.requestPointerLock?.()?.catch?.(()=>void 0)}catch{}},c=e=>{if(document.pointerLockElement!==t||q.getState().orbit!==`free`)return;let n=te(_.lookFilter,e.movementX,e.movementY,e.timeStamp);if(!n)return;let{sensitivity:r,invertY:i}=ne.getState(),a=re*r*Math.min(1,j.fov/72);P(j,n[0]*a,n[1]*a*(i?-1:1)),V()},l=e=>{e.target?.closest?.(`.photo-panel`)||(j.fov=F(j.fov,e.deltaMode===1?e.deltaY*40:e.deltaY),V())},u=()=>{ie(_.lookFilter),document.pointerLockElement||(_.unlockedAt=performance.now())};return window.addEventListener(`keydown`,r),window.addEventListener(`keyup`,a),window.addEventListener(`blur`,o),t.addEventListener(`mousedown`,s),document.addEventListener(`mousemove`,c),window.addEventListener(`wheel`,l,{passive:!0}),document.addEventListener(`pointerlockchange`,u),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`keyup`,a),window.removeEventListener(`blur`,o),t.removeEventListener(`mousedown`,s),document.removeEventListener(`mousemove`,c),window.removeEventListener(`wheel`,l),document.removeEventListener(`pointerlockchange`,u)}},[e,_,i]),(0,Y.useEffect)(()=>(U({frames:()=>_.frames,focusCenter(){v(),y(),_.ray.setFromCamera(_.center,c);for(let e of _.ray.intersectObjects(t.children,!0)){let t=e.object;if(t.isMesh&&t.frustumCulled&&xe(t)&&!Ce(t)&&(Array.isArray(t.material)||!t.material.transparent))return e.distance}return null},async shot(n){let{width:r,height:i,scale:a}=pe(_.width,_.height,window.devicePixelRatio||1,n),o=document.createElement(`canvas`);o.width=r,o.height=i;let s=o.getContext(`2d`);if(!s)throw Error(`the browser could not make a canvas that big`);v(),e.getDrawingBufferSize(_.buf);let u=_.buf.x,d=_.buf.y,f=_.post;f.full[0]=r,f.full[1]=i,f.px=r/_.width;let p=f.dof!==null||z(f.grade),m=Math.max(p?l.margin(f):0,_.pipe?Math.round(Math.min(u,d)*.08):0);for(let n of me(r,i,u,d,m))c.setViewOffset(r,i,n.viewX,n.viewY,u,d),f.origin[0]=n.viewX,f.origin[1]=i-(n.viewY+d),l.render(t,c,_.pipe,0,f),s.drawImage(e.domElement,n.x-n.viewX,n.y-n.viewY,n.w,n.h,n.x,n.y,n.w,n.h);c.clearViewOffset(),c.aspect=_.width/_.height,c.updateProjectionMatrix(),y(),V(),G(s,r,i,R(!1));let h=await he(o,`image/png`),g=await fe(o,r,i);return o.width=0,{png:h,thumb:g,width:r,height:i,scale:a}}}),()=>U(null)),[e,t,c,l,_,v,y]),null}export{we as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{s as t,t as n}from"./jsx-runtime-CXW0f58S.js";import{Bt as r,f as i,gt as a,tt as o}from"./bloomMarks-DRhDp19k.js";import{n as s,r as c}from"./Office-9Mank16i.js";import{a as l}from"./director-CrzFgnoP.js";import{a as u,i as d,l as f,n as p,o as m}from"./kit-n-eqZ1AT.js";var h=e(t(),1),g=n(),_=44,v=260,y=_/(v/2),b=26;function x({run:e,elevation:t}){let n=(0,h.useRef)(null),x=(0,h.useRef)(null),S=m(e.side),C=(0,h.useMemo)(()=>{let n=l(e.seed),r=n()<.5?1:-1;return{dir:r,x:S*(290+n()*50),y:p(t)+70+n()*20,z0:-r*430,z1:r*430,livery:[`#e63946`,`#1d3557`,`#2a9d8f`,`#f4a261`][Math.floor(n()*4)]}},[e.seed,S,t]),w=(0,h.useMemo)(()=>({m:new o,q:new a,v:new r,sc:new r,born:new Float32Array(v).fill(-1),pos:new Float32Array(v*3),next:0}),[]);(0,h.useLayoutEffect)(()=>{let e=x.current;if(e){w.m.makeScale(0,0,0);for(let t=0;t<v;t++)e.setMatrixAt(t,w.m);e.instanceMatrix.needsUpdate=!0}},[w]);let T=(0,h.useMemo)(()=>({jet:null}),[]);(0,h.useEffect)(()=>(T.jet=s(`jet`),()=>T.jet?.stop(1.5)),[T]),i(()=>{let r=e.t,i=Math.min(1,r/_),a=u(C.z0,C.z1,i),o=n.current;o&&(o.visible=r<_,o.position.set(C.x,C.y,a),o.rotation.y=C.dir>0?0:Math.PI);let s=x.current;if(!s)return;for(;r<_&&w.next*y<=r&&w.next<v/2;){let e=u(C.z0,C.z1,Math.min(1,w.next*y/_))-C.dir*14;for(let t of[0,1]){let n=w.next*2+t;w.born[n]=w.next*y,w.pos[n*3]=C.x+(t?7:-7),w.pos[n*3+1]=C.y-1,w.pos[n*3+2]=e}w.next++}for(let e=0;e<v;e++){let t=w.born[e];if(t<0)continue;let n=r-t,i=n>b?0:(2.2+n*.25)*Math.min(1,(b-n)/6)*Math.min(1,n*3+.3);w.v.set(w.pos[e*3],w.pos[e*3+1]-n*.15,w.pos[e*3+2]),w.sc.set(i,i*.8,i*1.6),s.setMatrixAt(e,w.m.compose(w.v,w.q,w.sc))}s.instanceMatrix.needsUpdate=!0;let l=c(C.x,C.y-t,a,160);T.jet?.set(l.gain*d(r,_,6),l.pan,.9+.2*(1-i))});let E=f(`#f4f6fa`);return(0,g.jsxs)(`group`,{children:[(0,g.jsxs)(`group`,{ref:n,scale:1.15,children:[(0,g.jsx)(`mesh`,{material:E,"rotation-x":Math.PI/2,children:(0,g.jsx)(`capsuleGeometry`,{args:[2.1,30,6,12]})}),[-2.02,2.02].map(e=>(0,g.jsx)(`mesh`,{material:f(`#2b3a55`),position:[e,.6,1],children:(0,g.jsx)(`boxGeometry`,{args:[.12,.45,22]})},e)),(0,g.jsx)(`mesh`,{material:E,position:[0,-.6,-1],children:(0,g.jsx)(`boxGeometry`,{args:[34,.5,5]})}),(0,g.jsx)(`mesh`,{material:f(C.livery),position:[0,4.2,-14.5],children:(0,g.jsx)(`boxGeometry`,{args:[.6,6.5,4.5]})}),(0,g.jsx)(`mesh`,{material:E,position:[0,1,-15],children:(0,g.jsx)(`boxGeometry`,{args:[12,.4,3]})}),[-7,7].map(e=>(0,g.jsx)(`mesh`,{material:f(`#9aa3b5`),position:[e,-1.8,.8],"rotation-x":Math.PI/2,children:(0,g.jsx)(`cylinderGeometry`,{args:[1,1,4.5,10]})},e))]}),(0,g.jsx)(`instancedMesh`,{ref:x,args:[void 0,void 0,v],material:f(`#ffffff`,{opacity:.85}),frustumCulled:!1,children:(0,g.jsx)(`sphereGeometry`,{args:[1,8,6]})})]})}export{x as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{Bt as r,f as i,gt as a,tt as o}from"./bloomMarks-C22qSi5d.js";import{n as s,r as c}from"./Office-B_EroD2U.js";import{a as l}from"./director-CrzFgnoP.js";import{a as u,i as d,l as f,n as p,o as m}from"./kit-CZEafHnz.js";var h=e(t(),1),g=n(),_=44,v=260,y=_/(v/2),b=26;function x({run:e,elevation:t}){let n=(0,h.useRef)(null),x=(0,h.useRef)(null),S=m(e.side),C=(0,h.useMemo)(()=>{let n=l(e.seed),r=n()<.5?1:-1;return{dir:r,x:S*(290+n()*50),y:p(t)+70+n()*20,z0:-r*430,z1:r*430,livery:[`#e63946`,`#1d3557`,`#2a9d8f`,`#f4a261`][Math.floor(n()*4)]}},[e.seed,S,t]),w=(0,h.useMemo)(()=>({m:new o,q:new a,v:new r,sc:new r,born:new Float32Array(v).fill(-1),pos:new Float32Array(v*3),next:0}),[]);(0,h.useLayoutEffect)(()=>{let e=x.current;if(e){w.m.makeScale(0,0,0);for(let t=0;t<v;t++)e.setMatrixAt(t,w.m);e.instanceMatrix.needsUpdate=!0}},[w]);let T=(0,h.useMemo)(()=>({jet:null}),[]);(0,h.useEffect)(()=>(T.jet=s(`jet`),()=>T.jet?.stop(1.5)),[T]),i(()=>{let r=e.t,i=Math.min(1,r/_),a=u(C.z0,C.z1,i),o=n.current;o&&(o.visible=r<_,o.position.set(C.x,C.y,a),o.rotation.y=C.dir>0?0:Math.PI);let s=x.current;if(!s)return;for(;r<_&&w.next*y<=r&&w.next<v/2;){let e=u(C.z0,C.z1,Math.min(1,w.next*y/_))-C.dir*14;for(let t of[0,1]){let n=w.next*2+t;w.born[n]=w.next*y,w.pos[n*3]=C.x+(t?7:-7),w.pos[n*3+1]=C.y-1,w.pos[n*3+2]=e}w.next++}for(let e=0;e<v;e++){let t=w.born[e];if(t<0)continue;let n=r-t,i=n>b?0:(2.2+n*.25)*Math.min(1,(b-n)/6)*Math.min(1,n*3+.3);w.v.set(w.pos[e*3],w.pos[e*3+1]-n*.15,w.pos[e*3+2]),w.sc.set(i,i*.8,i*1.6),s.setMatrixAt(e,w.m.compose(w.v,w.q,w.sc))}s.instanceMatrix.needsUpdate=!0;let l=c(C.x,C.y-t,a,160);T.jet?.set(l.gain*d(r,_,6),l.pan,.9+.2*(1-i))});let E=f(`#f4f6fa`);return(0,g.jsxs)(`group`,{children:[(0,g.jsxs)(`group`,{ref:n,scale:1.15,children:[(0,g.jsx)(`mesh`,{material:E,"rotation-x":Math.PI/2,children:(0,g.jsx)(`capsuleGeometry`,{args:[2.1,30,6,12]})}),[-2.02,2.02].map(e=>(0,g.jsx)(`mesh`,{material:f(`#2b3a55`),position:[e,.6,1],children:(0,g.jsx)(`boxGeometry`,{args:[.12,.45,22]})},e)),(0,g.jsx)(`mesh`,{material:E,position:[0,-.6,-1],children:(0,g.jsx)(`boxGeometry`,{args:[34,.5,5]})}),(0,g.jsx)(`mesh`,{material:f(C.livery),position:[0,4.2,-14.5],children:(0,g.jsx)(`boxGeometry`,{args:[.6,6.5,4.5]})}),(0,g.jsx)(`mesh`,{material:E,position:[0,1,-15],children:(0,g.jsx)(`boxGeometry`,{args:[12,.4,3]})}),[-7,7].map(e=>(0,g.jsx)(`mesh`,{material:f(`#9aa3b5`),position:[e,-1.8,.8],"rotation-x":Math.PI/2,children:(0,g.jsx)(`cylinderGeometry`,{args:[1,1,4.5,10]})},e))]}),(0,g.jsx)(`instancedMesh`,{ref:x,args:[void 0,void 0,v],material:f(`#ffffff`,{opacity:.85}),frustumCulled:!1,children:(0,g.jsx)(`sphereGeometry`,{args:[1,8,6]})})]})}export{x as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-cUAMhOxM.js","assets/rolldown-runtime-XKyaHtl9.js","assets/jsx-runtime-CZP6s5wa.js","assets/index-rznd4Djx.js","assets/store-9CvxLGNQ.js","assets/index-COpmc42S.css","assets/AccessibilitySettings-vd4x_sEq.js","assets/mic-DeYDrNoY.js","assets/jukeboxSongs-CUwHJ1cS.js","assets/AccessibilitySettings-HrzBDUTN.css","assets/bloomMarks-C22qSi5d.js","assets/BufferGeometryUtils-B4Tnxtjb.js","assets/Batched-yAiB-c-b.js","assets/rig-B88WinIa.js","assets/TerminalView-BrP-ENHg.css","assets/AppViewer-BB9lvg-4.js","assets/MissionConsole-4G02S89d.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{O as r,a as i,c as a,l as o,o as s,s as c}from"./index-rznd4Djx.js";import{At as l,a as u,d,hs as f,li as p,m,ns as h,p as g,rs as _,t as v}from"./store-9CvxLGNQ.js";import{C as y,I as b,N as x,a as S,b as C,c as w,f as T,g as E,i as D,n as O,o as k,p as A,r as j,s as M,t as N,u as P,v as F}from"./AccessibilitySettings-vd4x_sEq.js";var I=e(t(),1),L=n();function R({repo:e,qa:t,ready:n}){let r=c(),i=g(e=>t.devAgentId?e.agents[t.devAgentId]:void 0),l=g(e=>e.settings.language),[u,d]=(0,I.useState)(!1),p=e.pulls.find(e=>e.number===t.prNumber);if(!p)return null;let{note:m,tone:h}=f(t,p,e.autoMerge,l),_=async e=>{d(!0);try{await e()}catch{}finally{d(!1)}},v=async()=>{await o(n?{icon:`🎉`,title:r(`Merge PR #{number}?`,{number:p.number}),body:r(`“{title}” passed QA. It will be squash-merged into {branch}.`,{title:p.title,branch:e.defaultBranch}),confirm:r(`Squash & merge`)}:{tone:`warn`,title:r(`Merge PR #{number} without QA?`,{number:p.number}),body:r(`“{title}” has not passed QA yet. Merge it into {branch} anyway?`,{title:p.title,branch:e.defaultBranch}),confirm:r(`Merge anyway`)})&&await _(()=>a.mergePull(e.id,p.number))},y=async()=>{let t=``;await o({icon:`🔧`,title:r(`Send PR #{number} back for a fix?`,{number:p.number}),body:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{children:(0,L.jsx)(s,{children:`Its author, or any free agent, fixes it with QA’s findings, then it’s tested once more.`})}),(0,L.jsx)(`input`,{maxLength:1e3,placeholder:r(`Optional note for whoever fixes it`),"aria-label":r(`Note for whoever fixes it`),onChange:e=>t=e.target.value})]}),confirm:r(`Send back`)})&&await _(()=>a.sendBack(e.id,p.number,t.trim()||void 0))},b=async()=>{await o({tone:`danger`,title:r(`Close PR #{number}?`,{number:p.number}),body:r(`“{title}” will be closed without merging. The branch stays on GitHub.`,{title:p.title}),confirm:r(`Close PR`)})&&await _(()=>a.closePull(e.id,p.number))};return(0,L.jsxs)(`div`,{className:`pk-card pk-pr kcard-${h??`plain`}`,style:{"--accent":e.color},children:[(0,L.jsxs)(`div`,{className:`pk-pr-head`,children:[(0,L.jsx)(`span`,{className:`floor-badge`,children:e.floor}),(0,L.jsxs)(`div`,{className:`grow`,children:[(0,L.jsx)(`a`,{href:p.url,target:`_blank`,rel:`noreferrer`,children:(0,L.jsxs)(`b`,{children:[`PR #`,p.number]})}),` `,p.title,(0,L.jsxs)(`div`,{className:`muted small`,children:[e.fullName.split(`/`)[1],i?` · ${r(`by {name}`,{name:i.name})}`:``,` · `,r(`round {number}`,{number:t.round}),` · `,m]})]})]}),t.summary&&(0,L.jsx)(`div`,{className:`small pk-pr-summary`,children:t.summary}),t.commentUrl&&(0,L.jsx)(`a`,{className:`small`,href:t.commentUrl,target:`_blank`,rel:`noreferrer`,children:(0,L.jsx)(s,{children:`QA report ↗`})}),(0,L.jsxs)(`div`,{className:`pk-actions`,children:[!n&&(0,L.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:u,onClick:()=>void _(()=>a.sendToQa(e.id,p.number)),children:(0,L.jsx)(s,{children:`Retry QA`})}),!n&&(0,L.jsx)(`button`,{className:`btn btn-small`,disabled:u,onClick:()=>void y(),children:(0,L.jsx)(s,{children:`Send back`})}),(0,L.jsx)(`button`,{className:`btn btn-small ${n?`btn-good`:``}`,disabled:u||p.isDraft,onClick:()=>void v(),children:r(n?`Merge`:`Merge anyway`)}),(0,L.jsx)(`button`,{className:`btn btn-small btn-ghost`,disabled:u,onClick:()=>void b(),children:(0,L.jsx)(s,{children:`Close`})})]})]})}function z(){let e=g(e=>e.repos),t=g(e=>e.qa),n=g(e=>e.requests),r=M(e,t,n),i=r.requests.length+r.stuck.length+r.ready.length===0;return(0,L.jsxs)(`div`,{className:`pk-page`,children:[i&&(0,L.jsx)(`p`,{className:`pk-empty`,children:(0,L.jsx)(s,{children:`Nothing waits on you. The team carries on, and your phone hears when that changes.`})}),r.requests.length>0&&(0,L.jsx)(`h3`,{className:`pk-h`,children:(0,L.jsx)(s,{children:`👥 Team changes`})}),r.requests.map(e=>(0,L.jsx)(y,{req:e},e.id)),r.stuck.length>0&&(0,L.jsx)(`h3`,{className:`pk-h`,children:(0,L.jsx)(s,{children:`⚠️ Pull requests that need you`})}),r.stuck.map(e=>(0,L.jsx)(R,{repo:e.repo,qa:e.qa},`${e.repo.id}#${e.qa.prNumber}`)),r.ready.length>0&&(0,L.jsx)(`h3`,{className:`pk-h`,children:(0,L.jsx)(s,{children:`✅ Ready to merge`})}),r.ready.map(e=>(0,L.jsx)(R,{repo:e.repo,qa:e.qa,ready:!0},`${e.repo.id}#${e.qa.prNumber}`))]})}var B={idle:`free`,preparing:`setting up`,working:`working`,done:`done`,error:`needs help`,stopped:`stopped`};function V({status:e}){let t=c();return(0,L.jsx)(`span`,{className:`status status-${e}`,children:t(B[e]??e)})}function H(){let[e,t]=(0,I.useState)(!1);return[e,async e=>{t(!0);try{return await e(),!0}catch{return!1}finally{t(!1)}}]}function U({agent:e,repo:t}){let n=c(),r=g(e=>e.agents),i=g(e=>e.qa),o=g(e=>e.settings),d=g(e=>e.clis),f=g(e=>e.openOverlay),p=(0,I.useMemo)(()=>u(t,v(r,t.id),i),[t,r,i]),[m,h]=H(),[_,y]=(0,I.useState)(``),[x,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(``),k=O(e),A=D(p),j=A.find(e=>e.key===_),M=e.status===`working`||e.status===`preparing`,N=F(e,o),P=async()=>{let t=w.trim();t&&await h(()=>a.message(e.id,t))&&(T(``),C(!1))};return(0,L.jsxs)(`div`,{className:`pk-card pk-agent ${e.status===`error`?`pk-agent-bad`:``}`,children:[(0,L.jsxs)(`div`,{className:`pk-agent-head`,children:[(0,L.jsx)(`span`,{className:`avatar`,style:{background:e.color},children:e.name[0]}),(0,L.jsxs)(`div`,{className:`grow`,children:[(0,L.jsx)(`b`,{children:e.name}),` `,(0,L.jsx)(`span`,{className:`muted small`,children:E(e,o,d)}),(0,L.jsxs)(`div`,{className:`small pk-ellipsis`,children:[S(e,o.language),M&&e.currentTool?(0,L.jsxs)(`span`,{className:`muted`,children:[` · `,n(l(e.currentTool)||e.currentTool),`…`]}):null]})]}),(0,L.jsx)(V,{status:e.status})]}),e.lastError&&!M&&(0,L.jsxs)(`div`,{className:`term-error small pk-error`,children:[`⚠️ `,e.lastError]}),N&&(0,L.jsxs)(`div`,{className:`small pk-sign-in`,children:[`🔑 `,n(`Waiting for you to sign {provider} in, in their terminal`,{provider:N}),`.`]}),(0,L.jsxs)(`div`,{className:`pk-actions`,children:[N&&(0,L.jsx)(`button`,{className:`btn btn-small btn-good`,onClick:()=>f({kind:`terminal`,agentId:e.id}),children:(0,L.jsx)(s,{children:`🔑 Sign in`})}),k.stop&&(0,L.jsx)(`button`,{className:`btn btn-small btn-bad`,disabled:m,onClick:()=>void h(()=>a.stop(e.id)),children:(0,L.jsx)(s,{children:`■ Stop`})}),k.assign&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`select`,{className:`pk-assign`,value:_,"aria-label":n(`Give {name} an issue or a pull request to test`,{name:e.name}),onChange:e=>y(e.target.value),disabled:m||A.length===0,children:[(0,L.jsx)(`option`,{value:``,children:n(A.length?`Pick an issue or a PR…`:`Nothing to pick up`)}),A.map(e=>(0,L.jsxs)(`option`,{value:e.key,children:[e.kind===`qa`?`🔍 PR `:``,`#`,e.number,` `,e.title]},e.key))]}),(0,L.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:m||!j,onClick:()=>j&&void h(()=>j.kind===`qa`?a.sendToQa(t.id,j.number,e.id):a.assign(e.id,j.number)).then(e=>e&&y(``)),children:n(j?.kind===`qa`?`🔍 Test`:`▶ Start`)})]}),k.clear&&(0,L.jsx)(`button`,{className:`btn btn-small`,disabled:m,onClick:()=>void h(()=>a.reset(e.id)),children:(0,L.jsx)(s,{children:`↺ Clear desk`})}),k.message&&(0,L.jsx)(`button`,{className:`btn btn-small ${x?`btn-ghost`:``}`,"aria-expanded":x,onClick:()=>C(!x),children:(0,L.jsx)(s,{children:`💬 Message`})}),(0,L.jsx)(`button`,{className:`btn btn-small btn-ghost`,onClick:()=>f({kind:`terminal`,agentId:e.id}),children:(0,L.jsx)(s,{children:`Terminal`})})]}),x&&k.message&&(0,L.jsxs)(`form`,{className:`pk-msg`,onSubmit:e=>{e.preventDefault(),P()},children:[(0,L.jsx)(b,{value:w,onChange:T,autoFocus:!0,"aria-label":n(`Message {name}`,{name:e.name}),placeholder:n(M?`Tell {name} something while they work…`:`Ask {name} for a follow-up…`,{name:e.name})}),(0,L.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:m||!w.trim(),children:(0,L.jsx)(s,{children:`Send`})})]})]})}function W(){let e=c(),t=g(e=>e.agents.ceo),n=g(e=>e.ceo),[r,i]=H();if(!t)return null;let o=t.status===`working`;return(0,L.jsxs)(`div`,{className:`pk-card pk-agent`,children:[(0,L.jsxs)(`div`,{className:`pk-agent-head`,children:[(0,L.jsx)(`span`,{className:`avatar`,style:{background:t.color},children:t.name[0]}),(0,L.jsxs)(`div`,{className:`grow`,children:[(0,L.jsx)(`b`,{children:t.name}),` `,(0,L.jsx)(`span`,{className:`muted small`,children:`CEO`}),(0,L.jsx)(`div`,{className:`small pk-ellipsis`,children:o?n.job?.label??e(`Working`):n.queue.length?e(`Up next: {jobs}`,{jobs:n.queue.map(e=>e.label).join(` → `)}):e(`Free`)})]}),(0,L.jsx)(V,{status:t.status})]}),o&&(0,L.jsx)(`div`,{className:`pk-actions`,children:(0,L.jsx)(`button`,{className:`btn btn-small btn-bad`,disabled:r,onClick:()=>void i(()=>a.stop(t.id)),children:(0,L.jsx)(s,{children:`■ Stop`})})})]})}function G({focusRepo:e}){let t=c(),n=g(e=>e.repos),r=g(e=>e.agents),i=(0,I.useRef)(null);return(0,I.useEffect)(()=>i.current?.scrollIntoView({block:`start`}),[]),(0,L.jsxs)(`div`,{className:`pk-page`,children:[(0,L.jsx)(W,{}),n.length===0&&(0,L.jsx)(`p`,{className:`muted`,children:(0,L.jsx)(s,{children:`No floors yet, so no team.`})}),n.map(n=>{let a=v(r,n.id);return(0,L.jsxs)(`section`,{ref:n.id===e?i:void 0,className:`pk-section`,style:{"--accent":n.color},children:[(0,L.jsxs)(`h3`,{className:`pk-h`,children:[(0,L.jsx)(`span`,{className:`floor-badge`,children:n.floor}),` `,n.fullName.split(`/`)[1],(0,L.jsxs)(`span`,{className:`muted small`,children:[` · `,t(a.length===1?`{count} agent`:`{count} agents`,{count:a.length})]})]}),a.length===0&&(0,L.jsx)(`p`,{className:`muted small`,children:(0,L.jsx)(s,{children:`Nobody works here yet.`})}),a.map(e=>(0,L.jsx)(U,{agent:e,repo:n},e.id))]},n.id)})]})}var K=(0,I.lazy)(()=>m(()=>import(`./TerminalView-cUAMhOxM.js`).then(e=>e.r).then(e=>({default:e.TerminalView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),q=(0,I.lazy)(()=>m(()=>import(`./AppViewer-BB9lvg-4.js`).then(e=>e.n).then(e=>({default:e.AppViewer})),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9]))),J=(0,I.lazy)(()=>m(()=>import(`./MissionConsole-4G02S89d.js`).then(e=>e.t).then(e=>({default:e.UsageCard})),__vite__mapDeps([16,1,2,4,3,5]))),Y=[`company`,`chat`,`kanban`,`team`,`approvals`];function X(e){let t=e?new URL(e,location.origin).searchParams.get(`tab`):null;return Y.includes(t)?t:null}var Z=e=>e.split(`/`)[1]??e;function Q(){g.getState().openOverlay(null),r(`office`)}var $=[[`building`,`🔨`,`Building`],[`qa`,`🔍`,`QA`],[`fixing`,`🔧`,`Fixing`],[`ready`,`✅`,`Ready`],[`needsYou`,`⚠️`,`Needs you`]];function ee(){let e=c(),t=g(e=>e.connected),n=g(e=>e.loaded),r=g(e=>e.usage),i=g(e=>e.restarting?`⟳ The office is restarting…`:p(e.officeUpdate,e.settings.language)),a=r.until?new Date(r.until).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null;return(0,L.jsxs)(L.Fragment,{children:[!t&&(0,L.jsx)(`div`,{className:`pk-banner pk-banner-bad`,children:e(n?`📡 Reconnecting to the office…`:`📡 Connecting to the office…`)}),r.state===`paused`&&(0,L.jsxs)(`div`,{className:`pk-banner pk-banner-bad`,children:[(0,L.jsx)(s,{children:`⏸ Claude’s usage limit was reached: no new work starts`}),a?e(` until {time}`,{time:a}):``,`.`]}),r.state===`pacing`&&(0,L.jsxs)(`div`,{className:`pk-banner`,children:[(0,L.jsx)(s,{children:`🐢 Pacing new work after a usage warning`}),a?e(` until {time}`,{time:a}):``,`.`]}),i&&(0,L.jsx)(`div`,{className:`pk-banner`,children:e(i)})]})}function te({go:e}){let t=c(),n=g(e=>e.repos),r=g(e=>e.agents),i=g(e=>e.qa),a=g(e=>e.requests),o=g(e=>e.ceo),l=g(e=>e.demo),d=g(e=>e.version),f=r.ceo,p=(0,I.useMemo)(()=>n.map(e=>{let t=v(r,e.id);return{repo:e,team:t.length,busy:t.filter(e=>e.status===`working`||e.status===`preparing`).length,p:k(u(e,t,i))}}),[n,r,i]),m=j(M(n,i,a));return(0,L.jsxs)(`div`,{className:`pk-page`,children:[(0,L.jsx)(ee,{}),m>0&&(0,L.jsxs)(`button`,{className:`pk-callout`,onClick:()=>e(`approvals`),children:[(0,L.jsxs)(`span`,{children:[`⚠️ `,t(m===1?`{count} decision waiting on you`:`{count} decisions waiting on you`,{count:m})]}),(0,L.jsx)(`span`,{children:(0,L.jsx)(s,{children:`Approvals →`})})]}),f&&(0,L.jsxs)(`div`,{className:`pk-card pk-ceo`,children:[(0,L.jsx)(`span`,{className:`avatar`,style:{background:f.color},children:f.name[0]}),(0,L.jsxs)(`div`,{className:`grow`,children:[(0,L.jsx)(`b`,{children:f.name}),` `,(0,L.jsx)(`span`,{className:`muted small`,children:`CEO`}),(0,L.jsx)(`div`,{className:`small`,children:f.status===`working`?o.job?.label??t(`Working`):o.queue.length?t(`Next: {job}`,{job:o.queue[0].label}):t(`Free`)})]}),(0,L.jsx)(`button`,{className:`btn btn-small`,onClick:()=>e(`chat`),children:(0,L.jsx)(s,{children:`💬 Chat`})})]}),p.length===0&&(0,L.jsx)(`p`,{className:`muted`,children:(0,L.jsx)(s,{children:`No projects yet. Connect a repo from the manager’s console in the 3D office.`})}),p.map(({repo:n,team:r,busy:i,p:a})=>(0,L.jsxs)(`div`,{className:`pk-card pk-floor`,style:{"--accent":n.color},children:[(0,L.jsxs)(`div`,{className:`pk-floor-head`,children:[(0,L.jsx)(`span`,{className:`floor-badge`,children:n.floor}),(0,L.jsxs)(`div`,{className:`grow`,children:[(0,L.jsx)(`b`,{className:`pk-floor-name`,children:Z(n.fullName)}),(0,L.jsx)(`div`,{className:`muted small pk-ellipsis`,children:n.summary||n.description||n.fullName})]})]}),(0,L.jsx)(`div`,{className:`pk-pipeline`,role:`list`,"aria-label":t(`Floor {floor} pipeline`,{floor:n.floor}),children:$.map(([e,n,r])=>(0,L.jsxs)(`div`,{role:`listitem`,className:`pk-stage ${a[e]?``:`pk-stage-zero`} ${e===`needsYou`&&a[e]?`pk-stage-hot`:``}`,children:[(0,L.jsxs)(`span`,{className:`pk-stage-n`,children:[(0,L.jsx)(`span`,{className:`pk-stage-icon`,"aria-hidden":!0,children:n}),a[e]]}),(0,L.jsx)(`span`,{className:`pk-stage-label`,children:t(r)})]},e))}),(0,L.jsxs)(`div`,{className:`pk-floor-foot small`,children:[(0,L.jsx)(`span`,{className:`muted`,children:t(`👥 {team} · {busy} busy · 📋 {backlog} in backlog`,{team:r,busy:i,backlog:a.backlog})}),(0,L.jsx)(`span`,{className:`spacer`}),(0,L.jsx)(`button`,{className:`btn btn-small`,onClick:()=>e(`kanban`,n.id),children:(0,L.jsx)(s,{children:`Board`})}),(0,L.jsx)(`button`,{className:`btn btn-small`,onClick:()=>e(`team`,n.id),children:(0,L.jsx)(s,{children:`Team`})})]})]},n.id)),(0,L.jsx)(`button`,{className:`btn pk-wide`,onClick:Q,children:(0,L.jsx)(s,{children:`🏢 Open the 3D office`})}),l&&(0,L.jsx)(`div`,{className:`pk-center small muted`,children:(0,L.jsx)(s,{children:`DEMO MODE: fake repos, fake agents`})}),d&&(0,L.jsxs)(`div`,{className:`pk-center small muted`,children:[`Droidsembly `,d]})]})}function ne({repoId:e,pick:t}){let n=c(),r=g(e=>e.repos),i=r.some(t=>t.id===e)?e:r[0]?.id;return i?(0,L.jsxs)(`div`,{className:`pk-page`,children:[r.length>1&&(0,L.jsx)(`div`,{className:`pk-chips`,role:`tablist`,"aria-label":n(`Floor`),children:r.map(e=>(0,L.jsxs)(`button`,{role:`tab`,"aria-selected":e.id===i,className:`pk-chip ${e.id===i?`pk-chip-on`:``}`,style:{"--accent":e.color},onClick:()=>t(e.id),children:[e.floor,` · `,Z(e.fullName)]},e.id))}),(0,L.jsx)(P,{repoId:i,embedded:!0},i)]}):(0,L.jsx)(`p`,{className:`muted pk-page`,children:(0,L.jsx)(s,{children:`No projects yet.`})})}function re(){let e=g(e=>e.toasts),t=g(e=>e.dismissToast);return(0,L.jsx)(`div`,{className:`toasts`,children:e.slice(-2).map(e=>(0,L.jsx)(`div`,{className:`toast toast-${e.level}`,onClick:()=>t(e.id),children:e.text},e.id))})}function ie(){let e=g(e=>e.overlay);return e?.kind===`terminal`&&e.agentId!==`ceo`?(0,L.jsx)(K,{agentId:e.agentId}):e?.kind===`app`?(0,L.jsx)(q,{repoId:e.repoId}):null}function ae({onClose:e}){let t=c();return(0,L.jsxs)(x,{title:t(`⚙️ This device and notifications`),onClose:e,className:`pk-settings`,children:[(0,L.jsx)(`div`,{className:`card`,children:(0,L.jsx)(i,{})}),(0,L.jsx)(I.Suspense,{fallback:null,children:(0,L.jsx)(J,{hot:!1})}),(0,L.jsx)(A,{}),(0,L.jsx)(w,{}),(0,L.jsx)(N,{pocket:!0}),(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`h3`,{children:(0,L.jsx)(s,{children:`📱 Pocket mode`})}),(0,L.jsxs)(`p`,{className:`muted small`,children:[(0,L.jsx)(s,{children:`This is the office without the 3D building, for phones and touch screens. It’s picked on its own on small or touch screens; this device remembers what you last chose. To reach the office from your phone safely, see`}),` `,(0,L.jsx)(`a`,{href:`https://github.com/leonvanzyl/cubefarm/blob/main/docs/pocket.md`,children:`docs/pocket.md`}),`.`]}),(0,L.jsx)(`button`,{className:`btn`,onClick:Q,children:(0,L.jsx)(s,{children:`🏢 Open the 3D office`})})]})]})}function oe(){let e=c(),[t,n]=(0,I.useState)(()=>X(location.href)??`company`),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(!1),l=g(e=>e.settings.companyName),u=g(e=>e.loaded),f=g(e=>e.settings.setupDone),p=g(e=>d(e.messages,e.phoneReadAt)),m=g(e=>j(M(e.repos,e.qa,e.requests))),v=g(e=>e.agents.ceo?.name??`CEO`),y=g(e=>e.usage.state),b=g(e=>e.connected),x=(e,t)=>{t&&i(t),n(e)};(0,I.useEffect)(()=>{let e=e=>{let t=X(e.detail);t&&n(t)};return window.addEventListener(_,e),window.addEventListener(h,e),()=>{window.removeEventListener(_,e),window.removeEventListener(h,e)}},[]),(0,I.useEffect)(()=>{let e=g.getState();t===`chat`?e.openOverlay({kind:`phone`,tab:`chat`}):e.overlay?.kind===`phone`&&e.openOverlay(null)},[t]),(0,I.useEffect)(()=>(document.title=`${l?`${l} · `:``}Droidsembly · pocket`,()=>void(document.title=`Droidsembly`)),[l]);let S=[[`company`,`📊`,`Company`,0],[`chat`,`💬`,v,t===`chat`?0:p],[`kanban`,`📋`,`Kanban`,0],[`team`,`👥`,`Team`,0],[`approvals`,`✋`,`Approvals`,m]];return(0,L.jsxs)(`div`,{className:`pocket`,children:[(0,L.jsxs)(`header`,{className:`pk-head`,children:[(0,L.jsx)(T,{}),(0,L.jsx)(`b`,{className:`pk-title`,children:l||`Droidsembly`}),(0,L.jsx)(`span`,{className:`pk-dot ${b?`pk-dot-on`:``}`,title:e(b?`Connected`:`Not connected`)}),(0,L.jsx)(`span`,{className:`spacer`}),y!==`normal`&&(0,L.jsx)(`span`,{className:`chip chip-warn`,children:e(y===`paused`?`⏸ paused`:`🐢 pacing`)}),(0,L.jsx)(`button`,{className:`pk-icon-btn`,onClick:()=>o(!0),"aria-label":e(`Settings and notifications`),title:e(`Settings and notifications`),children:`⚙️`})]}),(0,L.jsx)(`main`,{className:`pk-main ${t===`chat`?`pk-main-chat`:``}`,children:u&&!f?(0,L.jsxs)(`div`,{className:`pk-page`,children:[(0,L.jsx)(`p`,{children:(0,L.jsx)(s,{children:`The office isn’t set up yet. Finish the setup in the 3D office (on a computer is easiest), then come back.`})}),(0,L.jsx)(`button`,{className:`btn`,onClick:Q,children:(0,L.jsx)(s,{children:`🏢 Open the 3D office`})})]}):(0,L.jsxs)(L.Fragment,{children:[t===`company`&&(0,L.jsx)(te,{go:x}),t===`chat`&&(0,L.jsx)(C,{autoFocus:!1}),t===`kanban`&&(0,L.jsx)(ne,{repoId:r,pick:i}),t===`team`&&(0,L.jsx)(G,{focusRepo:r}),t===`approvals`&&(0,L.jsx)(z,{})]})}),(0,L.jsx)(`nav`,{className:`pk-tabs`,"aria-label":e(`Pocket office`),children:S.map(([r,i,a,o])=>(0,L.jsxs)(`button`,{className:`pk-tab ${t===r?`pk-tab-on`:``}`,"aria-current":t===r?`page`:void 0,onClick:()=>n(r),children:[(0,L.jsxs)(`span`,{className:`pk-tab-icon`,children:[i,o>0&&(0,L.jsx)(`span`,{className:`badge badge-dot`,children:o})]}),(0,L.jsx)(`span`,{className:`pk-tab-label`,children:r===`chat`?a:e(a)})]},r))}),(0,L.jsx)(re,{}),(0,L.jsx)(I.Suspense,{fallback:null,children:(0,L.jsx)(ie,{})}),a&&(0,L.jsx)(ae,{onClose:()=>o(!1)})]})}export{oe as default};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{s as t,t as n}from"./jsx-runtime-CXW0f58S.js";import{St as r,Tt as i,f as a,nt as o}from"./bloomMarks-DRhDp19k.js";import{i as s,r as c}from"./Office-9Mank16i.js";import{a as l}from"./director-CrzFgnoP.js";import{i as u,o as d}from"./kit-n-eqZ1AT.js";var f=e(t(),1),p=n(),m=`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{St as r,Tt as i,f as a,nt as o}from"./bloomMarks-C22qSi5d.js";import{i as s,r as c}from"./Office-B_EroD2U.js";import{a as l}from"./director-CrzFgnoP.js";import{i as u,o as d}from"./kit-CZEafHnz.js";var f=e(t(),1),p=n(),m=`
2
2
  varying vec2 vP;
3
3
  void main() {
4
4
  vP = position.xy;
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{s as t,t as n}from"./jsx-runtime-CXW0f58S.js";import{J as r,N as i,a,c as o,ht as s,l as c,o as l,u}from"./Shell-GaQY3zre.js";import{$a as d,Ao as f,Ba as p,Bo as m,E as h,I as ee,L as te,La as ne,Li as re,N as ie,Oa as g,Pa as ae,Ti as oe,To as se,Va as _,Vo as ce,Wa as le,Xa as ue,_n as de,b as fe,do as v,ea as pe,en as me,fo as he,hn as y,io as ge,ka as b,kt as _e,lo as ve,mn as ye,p as x,pt as be,r as xe,ro as Se,sr as Ce,vn as we,wo as Te,x as Ee,xo as De,yo as Oe}from"./store-CXLtXw8e.js";import{ar as ke,er as Ae,fn as je,ir as Me,nr as S,pn as Ne,rr as Pe,s as Fe,tr as Ie}from"./Office-9Mank16i.js";import{n as Le,r as Re}from"./interact-0jqx03Xr.js";import{o as ze}from"./cityLayout-aA2Ktgpu.js";import{i as Be,r as Ve,t as C}from"./billboardLayout-DSKGXPIM.js";import{f as He,n as Ue,u as We}from"./useDayTime-BjBDzh_t.js";import{Jn as Ge,Rn as Ke,Vn as qe,_ as Je,b as Ye,d as Xe,g as Ze,h as Qe,kn as $e,p as et,u as tt}from"./cheerRules-DWb8Qwzg.js";import{a as w}from"./Batched-CTJWq46z.js";import{B as nt,U as T}from"./rig-DfdntE8m.js";import{A as E,Bt as D,C as rt,Ct as it,D as at,Mt as ot,O,R as k,Tt as st,Y as ct,f as A,g as lt,gt as ut,ht as dt,k as ft,kt as j,pt,rt as mt,st as M,tt as ht,w as gt,x as N,xt as _t}from"./bloomMarks-DRhDp19k.js";var P=e(t(),1),vt=new Map,yt=new Map;function bt(e,t){let n=(0,P.useRef)(t);n.current=t,(0,P.useEffect)(()=>{let t=e=>n.current(e);return vt.set(e,t),()=>{vt.get(e)===t&&vt.delete(e)}},[e])}function F(e,t){let n=(0,P.useRef)(t);n.current=t,(0,P.useEffect)(()=>{let t=()=>n.current();return yt.set(e,t),()=>{yt.get(e)===t&&yt.delete(e)}},[e])}function xt(e){let t=e.indexOf(`:`);vt.get(t<0?e:e.slice(0,t))?.(t<0?``:e.slice(t+1))}var St=()=>Object.fromEntries([...yt].map(([e,t])=>[e,t()]));function Ct(){let[,e,t]=He(.5),n=Math.hypot(e,t);return[0,-t/n,e/n]}var wt=e=>2*Math.PI*(e-.5);function Tt(e,t,n=Ct()){let r=wt(t),i=Math.cos(r),a=Math.sin(r),[o,s,c]=n,[l,u,d]=e,f=o*l+s*u+c*d;return[l*i+(s*d-c*u)*a+o*f*(1-i),u*i+(c*l-o*d)*a+s*f*(1-i),d*i+(o*u-s*l)*a+c*f*(1-i)]}function Et(e){let[t,n,r]=He(e);return[-t,-n,-r]}function Dt(e){let t=e=>Math.round(e*1800/Math.PI)/10;return{yaw:t(Math.atan2(-e[0],-e[2])),pitch:t(Math.asin(Math.max(-1,Math.min(1,e[1]))))}}var Ot=[`The Coffee Mug`,`The Rubber Duck`,`The Merge Arrow`,`The Little Bug`,`The Gong`,`The Roomba`,`The Sticky Note`,`The Keyboard`],kt=9*Math.PI/180,At=22*Math.PI/180,jt=[.9,0,.1],Mt=.17,Nt=(e,t)=>Math.acos(Math.min(1,Math.max(-1,e[0]*t[0]+e[1]*t[1]+e[2]*t[2])));function Pt(e=6,t=Fe(700)){let n=t.sizes.length,r=e=>[t.positions[e*3],t.positions[e*3+1],t.positions[e*3+2]],i=Ct(),a=e=>jt.every(t=>Tt(r(e),t,i)[1]>Mt),o=Array.from({length:n},(e,t)=>t).filter(e=>t.sizes[e]>=3&&a(e)).sort((e,n)=>t.sizes[n]-t.sizes[e]||Tt(r(n),0,i)[1]-Tt(r(e),0,i)[1]),s=new Set,c=[];for(let i of o){if(c.length>=e)break;if(s.has(i)||c.some(e=>Nt(r(e.stars[0]),r(i))<At))continue;let a=Array.from({length:n},(e,t)=>t).filter(e=>e!==i&&!s.has(e)&&Nt(r(e),r(i))<kt).sort((e,t)=>Nt(r(e),r(i))-Nt(r(t),r(i))).slice(0,5);if(a.length<3)continue;let o=[i,...a.sort((e,n)=>t.sizes[n]-t.sizes[e])],l=[],u=new Set([i]);for(;u.size<o.length;){let e=null,t=1/0;for(let n of u)for(let i of o){if(u.has(i))continue;let a=Nt(r(n),r(i));a<t&&(t=a,e=[n,i])}l.push(e),u.add(e[1])}let d=o.reduce((e,t)=>[e[0]+r(t)[0],e[1]+r(t)[1],e[2]+r(t)[2]],[0,0,0]),f=Math.hypot(...d);for(let e of o)s.add(e);c.push({name:Ot[c.length%Ot.length],stars:o,lines:l,centre:[d[0]/f,d[1]/f,d[2]/f]})}return c}var Ft=null,It=()=>Ft??=Pt(),I=n(),L={w:1024,h:512},Lt=Math.round(L.w*C.h/C.w),Rt=null,zt=()=>Rt??=ze();function Bt(e,t,n){let r=t%2*L.w,i=Math.floor(t/2)*L.h,a=L.w,o=Lt;e.fillStyle=`#2b2d42`,e.fillRect(r,i,a,o),e.fillStyle=n.bg,_e(e,r+14,i+14,a-28,o-28,26),e.fill(),e.fillStyle=`rgba(255,255,255,0.75)`;for(let t=0;t<24;t++){let n=(t+.5)/24;for(let t of[i+30,i+o-30])e.beginPath(),e.arc(r+40+n*(a-80),t,6,0,Math.PI*2),e.fill()}e.fillStyle=n.fg,e.textAlign=`center`,e.textBaseline=`middle`,e.font=`700 54px ${be}`,e.fillText(n.top,r+a/2,i+92,a-120),e.font=`800 176px ${be}`,e.fillText(n.big,r+a/2,i+o/2+18,a-120),e.font=`600 46px ${be}`,e.fillText(n.under,r+a/2,i+o-82,a-120)}function Vt(){let e=x(e=>e.repos),t=x(e=>e.agents),n=x(e=>e.qa),r=x(e=>e.settings.companyName);return(0,P.useMemo)(()=>{let i=Object.values(t).filter(e=>e.role!==`ceo`);return{company:r,floors:e.length,agents:i.length,working:i.filter(e=>e.status===`working`||e.status===`preparing`).length,issues:e.reduce((e,t)=>e+t.issues.length,0),openPrs:e.reduce((e,t)=>e+t.pulls.filter(e=>e.state===`OPEN`).length,0),inQa:e.reduce((e,t)=>e+xe(t,n).inQa,0),merged:e.reduce((e,t)=>e+t.pulls.filter(e=>e.state===`MERGED`).length,0)}},[e,t,n,r])}function Ht(e){let t=e%2*.5,n=1-Math.floor(e/2)*.5;return{u0:t,u1:t+.5,v1:n,v0:n-Lt/(L.h*2)}}function Ut({top:e}){let t=ce(e),n=(0,P.useMemo)(()=>Ve(zt(),{x:v.x,y:t+v.eye,z:v.z}),[t]),r=Vt(),i=(0,P.useMemo)(()=>Be(r),[r]),a=JSON.stringify(i),o=Le(L.w*2,L.h*2,e=>i.forEach((t,n)=>Bt(e,n,t)),[a]),s=(0,P.useMemo)(()=>{let e=[],t=[];return n.forEach((n,r)=>{let i=(e,t,r,i)=>e.translate(t,r,i).rotateY(n.yaw).translate(n.x,n.y,n.z),a=new pt(C.w,C.h),{u0:o,u1:s,v0:c,v1:l}=Ht(r%4),u=a.attributes.uv;for(let e=0;e<u.count;e++)u.setXY(e,o+u.getX(e)*(s-o),c+u.getY(e)*(l-c));e.push(i(a,0,0,.2)),t.push(i(new N(C.w+.4,C.h+.4,.15),0,0,0)),t.push(i(new N(C.w,.12,.9),0,-C.h/2-.1,.5));let d=n.y-C.h/2-n.top;for(let e of[-C.w/3,C.w/3])t.push(i(new N(.3,d,.3),e,-C.h/2-d/2,-.1))}),{faces:c(e),frames:c(t)}},[n]);(0,P.useEffect)(()=>()=>Object.values(s).forEach(e=>e.dispose()),[s]);let l=(0,P.useMemo)(()=>({face:new mt({map:o,fog:!1,toneMapped:!1,polygonOffset:!0,polygonOffsetFactor:-2}),frame:new mt({color:`#3d405b`,fog:!1})}),[o]);return(0,P.useEffect)(()=>()=>Object.values(l).forEach(e=>e.dispose()),[l]),F(`billboards`,()=>n.map((e,n)=>{let r={x:e.x-v.x,y:e.y-t-v.eye,z:e.z-v.z},a=Math.hypot(r.x,r.y,r.z);return{x:Math.round(e.x),z:Math.round(e.z),dist:Math.round(e.dist),says:`${i[n%4].top}: ${i[n%4].big}`,...Dt([r.x/a,r.y/a,r.z/a])}})),(0,I.jsxs)(`group`,{position:[0,-t-.03,0],children:[(0,I.jsx)(`mesh`,{geometry:s.frames,material:l.frame}),(0,I.jsx)(`mesh`,{geometry:s.faces,material:l.face})]})}var Wt=new Map;function R(e,t,n,r,i=!0){let a=Wt.get(e);if(a)return a;let o=document.createElement(`canvas`);return o.width=t,o.height=n,r(o.getContext(`2d`)),a=new gt(o),a.colorSpace=it,a.anisotropy=8,i&&(a.wrapS=a.wrapT=_t),Wt.set(e,a),a}function Gt(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0,t/4294967296)}var Kt=()=>R(`paving`,256,256,e=>{e.fillStyle=`#d6d0c4`,e.fillRect(0,0,256,256);let t=Gt(3);for(let n=0;n<260;n++)e.fillStyle=t()<.5?`rgba(255,255,255,0.18)`:`rgba(90,80,70,0.08)`,e.fillRect(t()*256,t()*256,2+t()*3,2+t()*3);e.fillStyle=`#b3ab9d`,e.fillRect(0,0,256,4),e.fillRect(0,0,4,256)}),qt=()=>R(`decking`,512,512,e=>{let t=Gt(7);for(let n=0;n<8;n++){let r=n*64,i=150+Math.floor(t()*30);e.fillStyle=`rgb(${i+40},${i-20},${i-75})`,e.fillRect(0,r,512,64),e.strokeStyle=`rgba(80,40,10,0.18)`,e.lineWidth=2;for(let n=0;n<4;n++){let n=r+8+t()*48;e.beginPath(),e.moveTo(0,n),e.bezierCurveTo(170,n+(t()-.5)*8,340,n+(t()-.5)*8,512,n),e.stroke()}e.fillStyle=`#5b3a24`,e.fillRect(0,r,512,4);let a=(n%2?.3:.75)*512;e.fillRect(a,r,4,64)}}),Jt=()=>R(`helipad`,1024,1024,e=>{e.fillStyle=`#4a4f5a`,e.beginPath(),e.arc(512,512,508,0,Math.PI*2),e.fill(),e.strokeStyle=`#ffd166`,e.lineWidth=34,e.beginPath(),e.arc(512,512,440,0,Math.PI*2),e.stroke(),e.strokeStyle=`#f8f9fa`,e.lineWidth=10,e.setLineDash([60,40]),e.beginPath(),e.arc(512,512,495,0,Math.PI*2),e.stroke(),e.setLineDash([]),e.fillStyle=`#f8f9fa`,e.fillRect(322,282,70,460),e.fillRect(632,282,70,460),e.fillRect(322,477,380,70)},!1),Yt=()=>R(`stripes`,128,8,e=>{for(let t=0;t<4;t++)e.fillStyle=t%2?`#ffffff`:`#c9c9c9`,e.fillRect(t*32,0,32,8)}),Xt=()=>R(`windsock`,8,128,e=>{for(let t=0;t<5;t++)e.fillStyle=t%2?`#ffffff`:`#ff7b39`,e.fillRect(0,t*128/5,8,26.6)}),Zt=[`#e63946`,`#3a86ff`,`#ffb703`,`#2a9d8f`],Qt=.45,z=[0,.22,.12],B=[0,.45,-.42],V=[0,z[1]+.86*Math.cos(.5),z[2]+.86*Math.sin(.5)],$t=.28,en=.31,tn=[0,.98,.3],nn=.42,rn=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]];function H(e,t,n=.045){let r=new D(...e),i=new D(...t).clone().sub(r),a=new N(n,n,i.length());return a.applyQuaternion(new ut().setFromUnitVectors(new D(0,0,1),i.normalize())),a.translate((e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2)}function an(e,t,n){let r=new rt,i=[e[0]-$t,e[1],e[2],e[0]+$t,e[1],e[2],t[0]-$t,t[1],t[2],t[0]+$t,t[1],t[2]];return r.setAttribute(`position`,new k(i,3)),r.setAttribute(`uv`,new k([0,0,1,0,0,1,1,1],2)),r.setAttribute(`color`,new k(Array.from({length:4},()=>[n.r,n.g,n.b]).flat(),3)),r.setIndex([0,2,1,1,2,3]),r.computeVertexNormals(),r}function on(){let e=[],t=[];b.xs.forEach((n,r)=>{let i=se(r),a=e=>[e[0]+i.x,e[1],e[2]+i.z];for(let t of[-.31,en]){let n=[t,0,0];e.push(H(a(rn(B,n)),a(rn(z,n)))),e.push(H(a(rn(z,n)),a(rn(V,n)))),e.push(H(a([t,0,B[2]]),a([t,B[1]+.02,B[2]]))),e.push(H(a([t,0,.62]),a([t,.64,.34]))),e.push(H(a([t*1.07,.56,-.48]),a([t*1.07,.56,.2]),.07)),e.push(H(a([t*1.07,.56,-.44]),a([t,.3,-.42])))}e.push(H(a([-.31,V[1],V[2]]),a([en,V[1],V[2]]),.06)),e.push(H(a([-.31,B[1],B[2]]),a([en,B[1],B[2]]),.06));let o=new O(Zt[r%Zt.length]);t.push(an(a(B),a(z),o),an(a(z),a(V),o))});let n=c(ve.flatMap(e=>[new E(e.r,e.r,.05,20).translate(e.x,.55,e.z),new E(.04,.05,.53,8).translate(e.x,.27,e.z),new E(.2,.22,.03,16).translate(e.x,.015,e.z)]));return{frame:c(e),canvas:c(t),tables:n}}var sn=(e,t=Date.now())=>et(t).some(n=>n.kind===`break`&&n.chair===e&&Je(n,t)!==`down`);function cn({i:e}){let t=se(e),n=Re({id:`deckchair-${e}`,label:`Sit back in the deck chair`,action:{kind:`roof`,op:`chair:${e}`}},3);return(0,I.jsx)(`mesh`,{ref:n,position:[t.x,.5,t.z+.05],visible:!1,children:(0,I.jsx)(`boxGeometry`,{args:[b.w,1,b.l]})})}function ln(e){if(e<0||e>=b.xs.length)return;let t=x.getState();if(S.getState().sitting===e)return;if(sn(e)){t.pushToast(`info`,`🪑 Someone's sitting there: try another chair`);return}let n=se(e);ke({id:`deckchair-${e}`,x:n.x+tn[0],y:tn[1],z:n.z+tn[2],tilt:nn,look:1,minPitch:-.95,maxPitch:1.1,exit:Te(e),yaw:0,pitch:.05,onLeave:()=>{S.getState().sitting===e&&S.setState({sitting:null})}}),S.setState({sitting:e,telescope:!1}),Ge({x:n.x,y:.4,z:n.z})}function un(){let e=(0,P.useMemo)(on,[]);(0,P.useEffect)(()=>()=>Object.values(e).forEach(e=>e.dispose()),[e]);let t=(0,P.useMemo)(()=>new M({map:Yt(),vertexColors:!0,side:2}),[]);return(0,P.useEffect)(()=>()=>t.dispose(),[t]),bt(`chair`,e=>ln(Number(e))),F(`chairs`,()=>b.xs.map((e,t)=>S.getState().sitting===t?`you`:sn(t)?`taken`:`free`)),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:e.frame,material:T(`#c08552`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.012,color:`#1f1d2b`})}),(0,I.jsx)(`mesh`,{geometry:e.canvas,material:t,castShadow:!0,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.tables,material:T(`#e9ecef`),castShadow:!0,receiveShadow:!0}),b.xs.map((e,t)=>(0,I.jsx)(cn,{i:t},t))]})}var dn=`#1f1d2b`;function fn(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0,t/4294967296)}var pn=e=>({x:(e.minX+e.maxX)/2,z:(e.minZ+e.maxZ)/2,w:e.maxX-e.minX,d:e.maxZ-e.minZ,h:e.h??.6});function mn(){let e=fn(21),t=[],n=[],r=[],i=[],a=[],s=[],l=[];ne.forEach((o,c)=>{let{x:u,z:d,w:f,d:p,h:m}=pn(o);t.push({size:[f,m-.06,p],at:[u,(m-.06)/2,d]}),t.push({size:[f+.08,.06,p+.08],at:[u,m-.03,d]}),n.push({size:[f-.12,.04,p-.12],at:[u,m-.02,d]});let h=m,ee=(t,n)=>{for(let r=0;r<t;r++)n(u-f/2+.35+r*(f-.7)/Math.max(1,t-1),d+(e()-.5)*.25,r)};if(c===2)for(let e of[-.22,.22])ee(Math.round(f/.55),(t,n,i)=>r.push(new j(.17+i%3*.02,10,7).scale(1,.6,1).translate(t,h+.08,d+e)));else c===1?ee(Math.round(f/.9),(t,n)=>{l.push(new E(.015,.015,1.1,5).translate(t,h+.55,n)),i.push(new j(.28,10,8).scale(1,1.35,1).translate(t,h+.5,n));for(let r=0;r<4;r++)a.push(new j(.06,8,6).translate(t+(e()-.5)*.4,h+.3+e()*.5,n+(e()<.5?-.24:.24)))}):ee(Math.round(f/.8),(t,n)=>{let a=1.2+e()*.5;l.push(new E(.025,.03,a,6).translate(t,h+a/2,n+.2)),r.push(new j(.12,8,6).scale(1.6,.4,1).translate(t+.08,h+a*.5,n+.2)),s.push(new E(.24,.24,.04,14).rotateX(Math.PI/2).translate(t,h+a,n+.18)),l.push(new E(.11,.11,.06,12).rotateX(Math.PI/2).translate(t,h+a,n+.21)),i.push(new ft(.12,.3,7).translate(t+.25,h+.15,n-.22))})});for(let e of he)t.push({size:[e.w,e.h-.06,e.w],at:[e.x,(e.h-.06)/2,e.z]}),t.push({size:[e.w+.08,.06,e.w+.08],at:[e.x,e.h-.03,e.z]}),n.push({size:[e.w-.12,.04,e.w-.12],at:[e.x,e.h-.02,e.z]}),l.push(new E(.07,.1,1.5,8).translate(e.x,e.h+.75,e.z)),i.push(new j(.75,14,10).translate(e.x,e.h+1.75,e.z)),r.push(new j(.5,12,8).translate(e.x+.45,e.h+1.45,e.z+.2)),r.push(new j(.45,12,8).translate(e.x-.4,e.h+1.5,e.z-.25));return{wood:o(t),soil:o(n),leaves:c(r),dark:c(i),red:c(a),yellow:c(s),brown:c(l)}}function hn(){let{x:e,z:t,r:n,legs:r,h:i}=Oe,a=[],s=n*.75;for(let n of[-s,s])for(let i of[-s,s])a.push({size:[.16,r,.16],at:[e+n,r/2,t+i]});for(let n of[.5,1.4])a.push({size:[2*s,.08,.08],at:[e,n,t-s]}),a.push({size:[2*s,.08,.08],at:[e,n,t+s]}),a.push({size:[.08,.08,2*s],at:[e-s,n,t]}),a.push({size:[.08,.08,2*s],at:[e+s,n,t]});a.push({size:[2*s+.4,.12,2*s+.4],at:[e,r-.06,t]});for(let o of[-.22,.22])a.push({size:[.06,r+i*.8,.06],at:[e+o,(r+i*.8)/2,t+n+.12]});for(let o=1;o<9;o++)a.push({size:[.44,.04,.04],at:[e,o*(r+i*.8)/9,t+n+.12]});let l=new E(n,n*1.04,i,24).translate(e,r+i/2,t),u=c([.25,.55,.85].map(a=>new ot(n*1.03+.02,.035,6,32).rotateX(Math.PI/2).translate(e,r+i*a,t))),d=new ft(n*1.12,.9,24).translate(e,r+i+.45,t);return{stand:o(a),tank:l,hoops:u,hat:d}}function gn(){let{x:e,z:t,w:n,d:r,h:i}=ue,a=[{size:[n,.07,.8],at:[e,i,t]}];for(let i of[-1,1])a.push({size:[n,.06,.3],at:[e,.44,t+i*(r/2-.15)]});let s=[];for(let a of[-n/2+.25,n/2-.25])s.push({size:[.08,.06,r-.1],at:[e+a,.38,t]}),s.push({size:[.08,i,.08],at:[e+a,i/2,t-.3]}),s.push({size:[.08,i,.08],at:[e+a,i/2,t+.3]});return{top:o(a),legs:o(s)}}function _n(){let e=(0,P.useMemo)(mn,[]),t=(0,P.useMemo)(hn,[]),n=(0,P.useMemo)(gn,[]);return(0,P.useEffect)(()=>()=>[...Object.values(e),...Object.values(t),...Object.values(n)].forEach(e=>e.dispose()),[e,t,n]),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:e.wood,material:T(`#b07d4f`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:dn})}),(0,I.jsx)(`mesh`,{geometry:e.soil,material:T(`#5e4433`),receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.leaves,material:T(`#80c45c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.dark,material:T(`#3f9b4f`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.red,material:T(`#e63946`)}),(0,I.jsx)(`mesh`,{geometry:e.yellow,material:T(`#ffc93c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.brown,material:T(`#7a5a3c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:t.stand,material:T(`#5e4a3c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:t.tank,material:T(`#a8744a`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.025,color:dn})}),(0,I.jsx)(`mesh`,{geometry:t.hoops,material:T(`#495057`)}),(0,I.jsx)(`mesh`,{geometry:t.hat,material:T(`#6b4a33`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.025,color:dn})}),(0,I.jsx)(`mesh`,{geometry:n.top,material:T(`#c9905a`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.018,color:dn})}),(0,I.jsx)(`mesh`,{geometry:n.legs,material:T(`#8a5a32`),castShadow:!0})]})}var U={cook:7,char:30},vn=()=>({since:null,turns:0});function W(e,t){if(e.since===null)return`idle`;let n=t-e.since;return n<U.cook?`cooking`:n<U.cook+U.char?`ready`:`charred`}function yn(e,t){if(e.since===null)return 0;let n=Math.max(0,t-e.since);return n<U.cook?n/U.cook:1+Math.min(1,(n-U.cook)/U.char)}function bn(e,t){let n=W(e,t);return n===`cooking`?1:n===`idle`?0:.35}function xn(e,t,n){let r=W(e,t);return r===`cooking`?{op:`turn`,grill:{...e,turns:e.turns+1}}:n?{op:`full`,grill:e}:r===`idle`?{op:`start`,grill:{since:t,turns:0}}:{op:`take`,grill:vn()}}function Sn(e){return e===`idle`?`Grill a sausage`:e===`cooking`?`Turn the sausage`:e===`charred`?`Take the (charred) sausage`:`Take the sausage`}var Cn=`#1f1d2b`,wn=.86,Tn=new O(`#e9a0a0`),En=new O(`#b5532c`),Dn=new O(`#3b2922`),On=14,kn=2.2,An=1,jn={x:p.x,y:wn,z:p.z};function Mn(e){re({name:`grill-sizzle`,group:`toys`,pos:jn,dur:.06+Math.random()*.22,peak:(.012+Math.random()*.03)*e,filter:`highpass`,freq:2600+Math.random()*3800,attack:.004}),Math.random()<.18*e&&re({name:`grill-pop`,group:`toys`,pos:jn,dur:.03,peak:.05*e,filter:`bandpass`,freq:1500+Math.random()*1500,q:2,attack:.001})}function Nn(){re({name:`grill-hiss`,group:`toys`,pos:jn,dur:.9,peak:.07,filter:`highpass`,freq:3200,to:5200,attack:.01})}function Pn(){re({name:`grill-bun`,group:`toys`,pos:jn,dur:.12,peak:.04,filter:`lowpass`,freq:700,attack:.01}),pe({name:`grill-bun`,group:`toys`,pos:jn,freq:880,to:1320,type:`triangle`,dur:.12,peak:.03})}function Fn(){return{bowl:new j(p.r,24,12,0,Math.PI*2,Math.PI/2,Math.PI/2),lid:new j(p.r*1.02,24,12,0,Math.PI*2,0,Math.PI/2),coals:new at(p.r*.85,24).rotateX(-Math.PI/2),puff:new j(.11,10,8)}}function In(){let[e,t]=(0,P.useState)(vn),n=(0,P.useRef)(e);n.current=e;let r=(0,P.useMemo)(Fn,[]);(0,P.useEffect)(()=>()=>Object.values(r).forEach(e=>e.dispose()),[r]);let i=(0,P.useMemo)(()=>({sausage:new M({color:Tn.clone()}),coals:new mt({color:`#ff6b2c`,toneMapped:!1}),smoke:new mt({color:`#e9ecef`,transparent:!0,opacity:.38,depthWrite:!1})}),[]);(0,P.useEffect)(()=>()=>Object.values(i).forEach(e=>e.dispose()),[i]);let a=(0,P.useRef)(null),o=(0,P.useRef)(null),s=(0,P.useMemo)(()=>({nextCrackle:0,m:new ht,state:``}),[]),c=()=>performance.now()/1e3,l=W(e,c()),u=Re({id:`grill`,label:Sn(l),action:{kind:`roof`,op:`grill`}},3);return A(()=>{let e=c(),r=n.current,l=W(r,e);l!==s.state&&(s.state=l,S.setState({grill:l}),t({...r}));let u=yn(r,e);u<=1?i.sausage.color.lerpColors(Tn,En,u):i.sausage.color.lerpColors(En,Dn,u-1);let d=bn(r,e);i.coals.color.setRGB(1,.32+.12*Math.sin(e*7)*Math.sin(e*3.1),.08).multiplyScalar(.55+.45*Math.max(d,.3)),a.current&&(a.current.visible=r.since!==null,a.current.rotation.x=r.turns*Math.PI+(d>.5?Math.sin(e*9)*.03:0)),d>0&&e>=s.nextCrackle&&(Mn(d),s.nextCrackle=e+(d>.5?.06+Math.random()*.1:.25+Math.random()*.5));let f=o.current;if(f&&(f.visible=d>0,f.visible)){for(let t=0;t<On;t++){let n=(e/kn+t/On)%1,r=(.4+n*1.6)*(t/On<d),i=n*n*.9;s.m.makeScale(r,r,r).setPosition(p.x+Math.sin(t*2.3+e*.7)*.12*n,1.01+n*1.6,p.z+i),f.setMatrixAt(t,s.m)}f.instanceMatrix.needsUpdate=!0,i.smoke.opacity=.32*Math.min(1,d+.2)}}),bt(`grill`,()=>{let e=x.getState(),r=c(),{op:i,grill:a}=xn(n.current,r,e.held!==null);if(i===`full`){e.pushToast(`info`,e.held?.kind===`sausage`?`🌭 One at a time: eat that one first (E)`:`🙌 Your hands are full`);return}let o=n.current;n.current=a,t(a),(i===`start`||i===`turn`)&&Nn(),i===`take`&&(Pn(),e.setHeld({kind:`sausage`,id:`sausage-${An++}`,bites:3,charred:W(o,r)===`charred`}))}),F(`grill`,()=>{let e=c();return{state:W(n.current,e),doneness:Math.round(yn(n.current,e)*100)/100,turns:n.current.turns,sizzle:bn(n.current,e)}}),(0,I.jsxs)(`group`,{children:[(0,I.jsxs)(`group`,{ref:u,children:[(0,I.jsxs)(`group`,{position:[p.x,wn,p.z],children:[(0,I.jsx)(`mesh`,{geometry:r.bowl,material:T(`#2b2d42`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.015,color:Cn})}),(0,I.jsx)(`mesh`,{geometry:r.coals,position:[0,-.08,0],material:i.coals}),(0,I.jsx)(`mesh`,{position:[0,.01,0],rotation:[-Math.PI/2,0,0],material:T(`#adb5bd`),children:(0,I.jsx)(`ringGeometry`,{args:[p.r*.88,p.r*.95,24]})}),[-.24,-.12,0,.12,.24].map(e=>(0,I.jsx)(`mesh`,{position:[e,.01,0],material:T(`#adb5bd`),children:(0,I.jsx)(`boxGeometry`,{args:[.012,.012,Math.sqrt(p.r*p.r*.85-e*e)*2]})},e)),(0,I.jsx)(`group`,{position:[0,0,p.r],rotation:[1.75,0,0],children:(0,I.jsx)(`mesh`,{geometry:r.lid,position:[0,0,-p.r],material:T(`#2b2d42`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.015,color:Cn})})}),[0,1,2].map(e=>{let t=e/3*Math.PI*2+.5;return(0,I.jsx)(`mesh`,{position:[Math.cos(t)*.28,-.86/2-.05,Math.sin(t)*.28],rotation:[Math.sin(t)*.25,0,-Math.cos(t)*.25],material:T(`#495057`),castShadow:!0,children:(0,I.jsx)(`cylinderGeometry`,{args:[.022,.022,.91,6]})},e)}),(0,I.jsxs)(`group`,{ref:a,position:[.04,.05,0],rotation:[0,.3,0],visible:!1,children:[(0,I.jsx)(`mesh`,{rotation:[0,0,Math.PI/2],material:i.sausage,castShadow:!0,children:(0,I.jsx)(`capsuleGeometry`,{args:[.035,.2,4,10]})}),[-.06,0,.06].map(e=>(0,I.jsx)(`mesh`,{position:[e,-.03,0],material:T(`#5a2d1a`),children:(0,I.jsx)(`boxGeometry`,{args:[.012,.012,.072]})},e))]})]}),(0,I.jsxs)(`group`,{position:[p.x+p.shelf,0,p.z],children:[(0,I.jsxs)(`mesh`,{position:[0,.78,0],material:T(`#c9905a`),castShadow:!0,children:[(0,I.jsx)(`boxGeometry`,{args:[.6,.05,.5]}),(0,I.jsx)(w,{thickness:.012,color:Cn})]}),[-.25,.25].map(e=>[-.2,.2].map(t=>(0,I.jsx)(`mesh`,{position:[e,.38,t],material:T(`#8a5a32`),children:(0,I.jsx)(`boxGeometry`,{args:[.04,.76,.04]})},`${e}${t}`))),(0,I.jsx)(`mesh`,{position:[-.08,.86,0],material:T(`#d4a373`),children:(0,I.jsx)(`boxGeometry`,{args:[.3,.1,.22]})}),[-.05,.05].map(e=>(0,I.jsx)(`mesh`,{position:[-.08,.93,e],rotation:[0,0,Math.PI/2],material:T(`#f2c38b`),children:(0,I.jsx)(`capsuleGeometry`,{args:[.04,.14,4,8]})},e)),(0,I.jsx)(`mesh`,{position:[.17,.89,.1],material:T(`#d62828`),castShadow:!0,children:(0,I.jsx)(`cylinderGeometry`,{args:[.035,.04,.17,10]})}),(0,I.jsx)(`mesh`,{position:[.17,.99,.1],material:nt(`#f8f9fa`),children:(0,I.jsx)(`coneGeometry`,{args:[.02,.05,8]})})]})]}),(0,I.jsx)(`instancedMesh`,{ref:o,args:[r.puff,i.smoke,On],frustumCulled:!1,visible:!1,renderOrder:3})]})}var G={x:.17,y:-.15,z:-.42,tilt:-.5,turn:.7},Ln={x:.03,y:-.07,z:-.24,tilt:-.15,turn:1.35},Rn=`#1f1d2b`;function zn(){let e=x(e=>e.held?.kind===`sausage`?e.held:null),t=(0,P.useRef)(null),n=(0,P.useRef)(null);if(A(({camera:e})=>{let r=t.current,i=n.current;if(!r||!i)return;r.position.copy(e.position),r.quaternion.copy(e.quaternion);let a=Ye.lift,o=performance.now()/1e3;i.position.set(G.x+(Ln.x-G.x)*a,G.y+(Ln.y-G.y)*a+Math.sin(o*1.6)*.003*(1-a),G.z+(Ln.z-G.z)*a),i.rotation.set(G.tilt+(Ln.tilt-G.tilt)*a,G.turn+(Ln.turn-G.turn)*a,0,`YXZ`)}),!e)return null;let r=Math.max(.15,e.bites/3),i=.17*r;return(0,I.jsx)(`group`,{ref:t,userData:s,children:(0,I.jsx)(`group`,{ref:n,scale:.8,children:(0,I.jsxs)(`group`,{position:[0,0,-.085+i/2],children:[[-1,1].map(e=>(0,I.jsxs)(`mesh`,{position:[e*.026,-.012,0],rotation:[Math.PI/2,0,0],material:T(`#e9b872`),children:[(0,I.jsx)(`capsuleGeometry`,{args:[.026,i,4,10]}),(0,I.jsx)(w,{thickness:.004,color:Rn})]},e)),(0,I.jsxs)(`mesh`,{position:[0,.006,0],rotation:[Math.PI/2,0,0],material:T(e.charred?`#3b2922`:`#b5532c`),children:[(0,I.jsx)(`capsuleGeometry`,{args:[.02,i+.03,4,10]}),(0,I.jsx)(w,{thickness:.004,color:Rn})]}),Array.from({length:Math.max(1,Math.round(5*r))},(e,t)=>(0,I.jsx)(`mesh`,{position:[(t%2?1:-1)*.008,.027,-i/2+.02+t*.032],rotation:[0,(t%2?1:-1)*.9,0],material:T(t%3==2?`#ffc93c`:`#d62828`),children:(0,I.jsx)(`boxGeometry`,{args:[.006,.004,.03]})},t))]})})})}var Bn=`#1f1d2b`,{x:K,z:q,t:J,parapet:Y,h:Vn}=Se,X=ge,Hn=1.2;function Un(e,t,n){let r=new pt(e,t).rotateX(-Math.PI/2),i=r.attributes.uv;for(let r=0;r<i.count;r++)i.setXY(r,i.getX(r)*e/n,i.getY(r)*t/n);return r}var Wn=[[-K,K,-q,-q+J],[-K,-K+J,-q+J,q-J],[K-J,K,-q+J,q-J],[-K,X.minX,q-J,q],[X.maxX,K,q-J,q]];function Gn(){let e=[],t=[],n=[];for(let[r,i,a,o]of Wn){let s=i-r,c=o-a,l=(r+i)/2,u=(a+o)/2;e.push({size:[s,Y,c],at:[l,Y/2,u]}),t.push({size:[s+.06,.07,c+.06],at:[l,Y+.035,u]});let d=s>c,f=d?s:c,p=Math.max(1,Math.round(f/1.6));for(let e=0;e<=p;e++){let t=-f/2+e*f/p;n.push({size:[.06,Vn-Y,.06],at:[d?l+t:l,Y+(Vn-Y)/2,d?u:u+t]})}n.push({size:d?[s,.07,.09]:[.09,.07,c],at:[l,Vn,u]}),n.push({size:d?[s,.035,.035]:[.035,.035,c],at:[l,(Y+Vn)/2+.05,u]})}return{wall:o(e),cap:o(t),metal:o(n)}}var Z={half:.5,h:2.2};function Kn(e){let{doorHalf:t,doorHeight:n}=ae,r=X.front,i=12+r/2,a=X.stairX-Z.half,s=X.stairX+Z.half,c=(e,t,n,a)=>({size:[t-e,a-n,r],at:[(e+t)/2,(n+a)/2,i]}),l=[c(X.minX,a,0,X.h),c(a,s,Z.h,X.h),c(s,-t,0,X.h),c(-t,t,n,X.h),c(t,X.maxX,0,X.h),{size:[.25,X.h+e,X.maxZ-12],at:[X.minX+.125,(X.h-e)/2,(12+X.maxZ)/2]},{size:[.25,X.h+e,X.maxZ-12],at:[X.maxX-.125,(X.h-e)/2,(12+X.maxZ)/2]},{size:[X.maxX-X.minX,X.h+e,.25],at:[(X.minX+X.maxX)/2,(X.h-e)/2,X.maxZ-.125]}],u=[{size:[X.maxX-X.minX+.3,.2,X.maxZ-12+.3],at:[(X.minX+X.maxX)/2,X.h+.1,(12+X.maxZ)/2]},{size:[1.4,.7,1.1],at:[X.minX+1.4,X.h+.55,X.maxZ-1]},{size:[.9,.5,.9],at:[X.maxX-.9,X.h+.45,12.9]}],d=[{size:[X.maxX-X.minX+.04,.22,.04],at:[(X.minX+X.maxX)/2,X.h-.5,11.98]},{size:[.08,Z.h+.08,.08],at:[a-.04,Z.h/2,11.98]},{size:[.08,Z.h+.08,.08],at:[s+.04,Z.h/2,11.98]},{size:[Z.half*2+.16,.08,.08],at:[X.stairX,Z.h+.04,11.98]},{size:[.05,1.6,.05],at:[X.maxX-.6,X.h+.2+.8,12.5]}],f=[{size:[Z.half*2,Z.h,.05],at:[X.stairX,Z.h/2,12.06]}],p=[{size:[.05,.05,.08],at:[X.stairX+Z.half-.14,1.05,12]},{size:[.5,.04,.04],at:[X.stairX,1,12.01]}];return{walls:o(l),roof:o(u),trim:o(d),door:o(f),handle:o(p)}}function qn(){let e=[new N(.3,.14,.12).translate(X.stairX,Z.h+.35,11.94)];for(let t=0;t<12;t++){let n=t/12*Math.PI*2;e.push(new j(.09,10,6,0,Math.PI*2,0,Math.PI/2).translate(_.x+Math.cos(n)*(_.r+.25),0,_.z+Math.sin(n)*(_.r+.25)))}return c(e)}function Jn(){let e=(0,P.useRef)(null),t=(0,P.useMemo)(()=>new E(.2,.09,1.3,16,1,!0).rotateX(Math.PI/2).translate(0,0,.65),[]);(0,P.useEffect)(()=>()=>t.dispose(),[t]);let n=(0,P.useMemo)(()=>new M({map:Xt(),side:2}),[]);return(0,P.useEffect)(()=>()=>n.dispose(),[n]),A(({clock:t})=>{let n=e.current;if(!n)return;let r=t.elapsedTime,i=.5+.5*Math.sin(r*.35)*Math.sin(r*.13+1);n.rotation.set(.55*(1-i)+Math.sin(r*3.1)*.04,Math.sin(r*.27)*.5+Math.sin(r*1.7)*.06,0,`YXZ`)}),(0,I.jsxs)(`group`,{position:[De.x,0,De.z],children:[(0,I.jsx)(`mesh`,{position:[0,De.h/2,0],material:T(`#adb5bd`),castShadow:!0,children:(0,I.jsx)(`cylinderGeometry`,{args:[.045,.06,De.h,10]})}),(0,I.jsx)(`group`,{ref:e,position:[0,De.h-.12,0],children:(0,I.jsx)(`mesh`,{geometry:t,material:n,castShadow:!0})})]})}function Yn({top:e}){let t=ce(e),n=(0,P.useMemo)(()=>{let e=g.maxX-g.minX,t=g.maxZ-g.minZ;return{paving:Un(2*K,2*q,Hn).translate(0,0,0),decking:(()=>{let n=new N(e,.06,t),r=n.attributes.uv;for(let n=0;n<r.count;n++)r.setXY(n,r.getX(n)*e/Hn,r.getY(n)*t/Hn);return n.translate((g.minX+g.maxX)/2,.03,(g.minZ+g.maxZ)/2)})(),helipad:new at(_.r,64).rotateX(-Math.PI/2).translate(_.x,.005,_.z),bulbs:qn()}},[]),r=(0,P.useMemo)(Gn,[]),i=(0,P.useMemo)(()=>Kn(t),[t]);(0,P.useEffect)(()=>()=>[...Object.values(n),...Object.values(r)].forEach(e=>e.dispose()),[n,r]),(0,P.useEffect)(()=>()=>Object.values(i).forEach(e=>e.dispose()),[i]);let o=(0,P.useMemo)(()=>({paving:new M({map:Kt()}),decking:new M({map:qt()}),helipad:new M({map:Jt(),transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2})}),[]);return(0,P.useEffect)(()=>()=>Object.values(o).forEach(e=>e.dispose()),[o]),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:n.paving,material:o.paving,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:n.decking,material:o.decking,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:n.helipad,material:o.helipad,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:n.bulbs,material:a}),(0,I.jsx)(`mesh`,{geometry:r.wall,material:T(`#c9c2b4`),receiveShadow:!0,castShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:Bn})}),(0,I.jsx)(`mesh`,{geometry:r.cap,material:T(`#ece6da`),receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:r.metal,material:T(`#5c677d`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:i.walls,material:T(`#efe3cc`),receiveShadow:!0,castShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:Bn})}),(0,I.jsx)(`mesh`,{geometry:i.roof,material:T(`#8d99ae`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:Bn})}),(0,I.jsx)(`mesh`,{geometry:i.trim,material:T(`#ff8a5b`)}),(0,I.jsx)(`mesh`,{geometry:i.door,material:T(`#2a9d8f`)}),(0,I.jsx)(`mesh`,{geometry:i.handle,material:T(`#dee2e6`)}),(0,I.jsx)(Jn,{}),(0,I.jsx)(je,{top:e})]})}var Xn={x:0,z:11},Q=[{x:-14.4,z:-4.8},{x:-14.4,z:-1.2}],Zn=null,Qn=()=>Zn??=ee([...m(),f()],{planR:fe+.1,lineR:fe+.03,greed:1.3}),$n=(e,t)=>te(Qn(),e,t),er=0,tr=Math.PI/2,nr=.5,rr=.16,ir={every:6,breakChance:.2,callChance:.06,ride:2.5},ar=3e3,or=(e,t)=>$n(e,t)??[t];function sr({agent:e,chair:t}){let n=(0,P.useRef)(null),i=se(t);return A(()=>{let t=n.current;if(!t)return;let r=me(e.id),i=r?Ce(r.sit):1;t.rotation.x=Qt*i,t.position.y=nr-rr*i}),(0,I.jsx)(`group`,{position:[i.x,0,i.z],children:(0,I.jsx)(`group`,{ref:n,position:[0,.33999999999999997,0],rotation:[Qt,0,0],children:(0,I.jsx)(`group`,{position:[0,-.5,0],children:(0,I.jsx)(r,{agent:e})})})})}function cr({agent:e}){return(0,I.jsx)(`group`,{position:[Q[0].x,0,Q[0].z],rotation:[0,tr,0],children:(0,I.jsx)(r,{agent:e})})}function lr(){let e=lt(e=>e.camera),t=x(e=>e.agents),[n,r]=(0,P.useState)([]),a=(0,P.useMemo)(()=>new Map,[]),o=(0,P.useMemo)(()=>({roll:ir.every,mounted:Date.now(),dirty:!1}),[]);(0,P.useEffect)(()=>()=>{for(let e of a.keys())de(e),y(e,null);a.clear()},[a]);let s=(e,t)=>{if(!e||!Ke(e.status))return!1;let n=e.role===`ceo`?`call`:`break`,r=Xe(et(),e.id,n,Date.now(),Math.random(),{chairs:b.xs.length,playerChair:S.getState().sitting,ride:ir.ride,stay:t});return r&&Qe(r),!!r};bt(`visit`,e=>{let[t,n]=e.split(`:`);s(x.getState().agents[t],n?Number(n):void 0)||x.getState().pushToast(`info`,`🛗 No room on the roof for them just now (or they are busy)`)}),F(`visitors`,()=>[...a.values()].map(e=>({id:e.id,name:x.getState().agents[e.id]?.name??e.id,kind:e.kind,chair:e.chair,stage:e.stage,seated:me(e.id)?.stage===`seated`})));let c=(e,t)=>{o.dirty=!0,t?a.set(e.id,e):a.delete(e.id)},l=(e,t,n)=>{e.stage=`leave`,e.hurry=t,e.path=[...or(n,Xn),i],e.wp=0,e.waited=e.ghost=0,y(e.id,null),t&&Ze(e.id,{leave:Date.now()})},u=(t,n,r,i)=>{let o=me(t.id);if(!o)return!1;t.wp=qe(t.path,t.wp,o);let s=t.path[t.wp],c=t.wp===t.path.length-1,l=s.x-o.x,u=s.z-o.z,d=Math.hypot(l,u);if(c&&d<.08&&o.speed<.05)return!0;let f=c&&i!==void 0?i:Math.atan2(-l,-u),p=t.hurry?$e:Ee;if(d>.05&&t.ghost<=0){let i=[...a.values()].filter(e=>e!==t).flatMap(e=>{let t=me(e.id);return t?[{id:e.id,x:t.x,z:t.z}]:[]}),s=h({id:t.id,x:o.x,z:o.z,dx:l/d,dz:u/d},i,{x:e.position.x,z:e.position.z},(e,t)=>ie(Qn().rects,e,t,fe));if(s.wait||s.speed<.15)return t.waited+=n,t.waited>3&&(t.ghost=2),we(t.id,{mode:`standing`,x:o.x,z:o.z,heading:o.heading,gesture:r}),!1}return t.waited=0,t.ghost=Math.max(0,t.ghost-n),we(t.id,{mode:`walking`,x:s.x,z:s.z,heading:f,speed:p,gesture:r}),!1};return A((e,t)=>{let n=Math.min(t,.1),d=Date.now(),f=x.getState(),p=We(Ue.t)<.5,m=et(d);for(let e of m){if(a.has(e.id)||!f.agents[e.id])continue;let t=Je(e,d);if(t===`down`)continue;let n={id:e.id,kind:e.kind,chair:e.chair,stage:`riding`,t:0,path:[],wp:0,leg:0,hold:-1,hurry:!1,waited:0,ghost:0,quietAt:0};t===`up`&&(d-e.arrive>ar||d-o.mounted<1e3)&&(e.kind===`call`?(ye(e.id,Q[0].x,Q[0].z,tr),we(e.id,{gesture:`call`}),n.stage=`call`):n.stage=`seated`),c(n,!0)}for(let e of a.values()){let t=f.agents[e.id],r=m.find(t=>t.id===e.id);if(!t||!r&&e.stage===`riding`){de(e.id),c(e,!1);continue}e.t+=n;let a=me(e.id),s=!Ke(t.status),h=!r||d>=r.leave;switch(e.quietAt&&d>e.quietAt&&(y(e.id,null),e.quietAt=0),e.stage){case`riding`:r&&d>=r.arrive&&(ye(e.id,i.x,i.z,er),oe({x:0,y:2.6,z:12}),e.stage=`doors`,e.t=0,o.dirty=!0);break;case`doors`:if(e.t<1.2)break;e.path=[Xn,...or(Xn,e.kind===`call`?Q[0]:Te(e.chair))],e.wp=0,e.hurry=s,e.stage=`walk`;break;case`walk`:s&&!e.hurry&&a?l(e,!0,a):u(e,n,e.kind===`call`?`call`:`none`,e.kind===`call`?tr:er)&&(e.kind===`call`?(e.stage=`call`,e.t=0):(de(e.id),e.stage=`sitting`));break;case`sitting`:a?.stage===`seated`&&(e.stage=`seated`,y(e.id,p?`😎`:`🌙`),e.quietAt=d+3e3);break;case`seated`:(h||s)&&a&&l(e,s,Te(e.chair));break;case`call`:{if((h||s)&&a){l(e,s,a);break}let t=Q[e.leg];if(e.path.length&&e.path[e.path.length-1]===t||(e.path=[t],e.wp=0),!u(e,n,`call`,tr))break;e.hold<0&&(e.hold=4+Math.random()*5,Math.random()<.6&&(y(e.id,Math.random()<.5?`📞`:`💬`),e.quietAt=d+2500)),e.hold-=n,e.hold<=0&&(e.leg=1-e.leg,e.hold=-1);break}case`leave`:u(e,n,`none`)&&(tt(e.id),de(e.id),y(e.id,null),c(e,!1))}}if(o.roll-=n,o.roll<=0){o.roll=ir.every;let e=new Set(m.map(e=>e.id)),t=Object.values(f.agents).filter(t=>!e.has(t.id)&&Ke(t.status)),n=t.filter(e=>e.role!==`ceo`);n.length&&Math.random()<ir.breakChance&&s(n[Math.floor(Math.random()*n.length)]);let r=t.find(e=>e.role===`ceo`);r&&Math.random()<ir.callChance&&s(r)}o.dirty&&(o.dirty=!1,r([...a.values()].filter(e=>e.stage!==`riding`).map(e=>({id:e.id,kind:e.kind,chair:e.chair}))))}),(0,I.jsx)(`group`,{children:n.map(e=>{let n=t[e.id];return n?e.kind===`call`?(0,I.jsx)(cr,{agent:n},e.id):(0,I.jsx)(sr,{agent:n,chair:e.chair},e.id):null})})}var ur=[[0,3],[1,2],[2,5],[3,4],[0,2],[2,4],[1,3],[3,5]],dr=d.h-.12,fr=.62,pr=[`#fff1c9`,`#fff1c9`,`#ffb86b`,`#ff8fab`,`#8ecae6`,`#fff1c9`,`#b9fbc0`],mr=new O(`#bdb6a6`),hr=new O(`#ffffff`);function gr(e,t,n,r){return Array.from({length:n+1},(i,a)=>{let o=a/n;return new D(e.x+(t.x-e.x)*o,dr-r*4*o*(1-o),e.z+(t.z-e.z)*o)})}function _r(){let e=document.createElement(`canvas`);e.width=e.height=64;let t=e.getContext(`2d`),n=t.createRadialGradient(32,32,0,32,32,32);n.addColorStop(0,`rgba(255,255,255,1)`),n.addColorStop(.25,`rgba(255,255,255,0.55)`),n.addColorStop(1,`rgba(255,255,255,0)`),t.fillStyle=n,t.fillRect(0,0,64,64);let r=new gt(e);return r.colorSpace=it,r}function vr(){let e=(0,P.useRef)(null),t=(0,P.useMemo)(()=>{let e=[],t=[];for(let[n,r]of ur){let i=le[n],a=le[r],o=Math.hypot(a.x-i.x,a.z-i.z),s=gr(i,a,24,.12+o*.035);for(let t=0;t<s.length-1;t++)e.push(s[t].x,s[t].y,s[t].z,s[t+1].x,s[t+1].y,s[t+1].z);let c=Math.floor(o/fr);for(let e of gr(i,a,c,.12+o*.035).slice(1,-1))t.push(e.setY(e.y-.07))}let n=new rt;n.setAttribute(`position`,new k(e,3));let r=t.map((e,t)=>new O(pr[t%pr.length])),i=new rt;return i.setAttribute(`position`,new k(t.flatMap(e=>[e.x,e.y,e.z]),3)),i.setAttribute(`color`,new k(r.flatMap(e=>[e.r,e.g,e.b]),3)),{at:t,colors:r,wireGeo:n,haloGeo:i,poles:c(le.flatMap(e=>[new E(d.r,d.r*1.3,d.h,8).translate(e.x,d.h/2,e.z),new j(d.r*1.6,8,6).translate(e.x,d.h,e.z)])),bulbGeo:new j(.055,10,8).scale(1,1.3,1),bulbMat:new mt({color:mr.clone(),toneMapped:!1}),wireMat:new ct({color:`#2b2d42`}),haloMat:new dt({size:.55,map:_r(),vertexColors:!0,transparent:!0,opacity:0,depthWrite:!1,blending:2,toneMapped:!1}),level:-1}},[]);(0,P.useEffect)(()=>()=>{for(let e of[t.wireGeo,t.haloGeo,t.poles,t.bulbGeo,t.bulbMat,t.wireMat,t.haloMat,t.haloMat.map])e?.dispose()},[t]),(0,P.useEffect)(()=>{let n=e.current;if(!n)return;let r=new ht;t.at.forEach((e,i)=>{n.setMatrixAt(i,r.makeTranslation(e.x,e.y,e.z)),n.setColorAt(i,t.colors[i])}),n.instanceMatrix.needsUpdate=!0,n.instanceColor&&(n.instanceColor.needsUpdate=!0)},[t]);let n=(0,P.useRef)(null);return A(()=>{let e=l();Math.abs(e-t.level)<.004||(t.level=e,t.bulbMat.color.lerpColors(mr,hr,e),t.haloMat.opacity=e*.65,n.current&&(n.current.visible=e>.02))}),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:t.poles,material:T(`#3d405b`),castShadow:!0}),(0,I.jsx)(`lineSegments`,{geometry:t.wireGeo,material:t.wireMat}),(0,I.jsx)(`instancedMesh`,{ref:e,args:[t.bulbGeo,t.bulbMat,t.at.length]}),(0,I.jsx)(`points`,{ref:n,geometry:t.haloGeo,material:t.haloMat,visible:!1,renderOrder:2})]})}var yr=72,$=45,br=90*Math.tan(.0358)*1.25,xr=1.36,Sr={yaw:-.7,pitch:.08},Cr=`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{J as r,N as i,a,c as o,ht as s,l as c,o as l,u}from"./Shell-lZOZ3aG8.js";import{$a as d,Ao as f,Ba as p,Bo as m,E as h,I as ee,L as te,La as ne,Li as re,N as ie,Oa as g,Pa as ae,Ti as oe,To as se,Va as _,Vo as ce,Wa as le,Xa as ue,_n as de,b as fe,do as v,ea as pe,en as me,fo as he,hn as y,io as ge,ka as b,kt as _e,lo as ve,mn as ye,p as x,pt as be,r as xe,ro as Se,sr as Ce,vn as we,wo as Te,x as Ee,xo as De,yo as Oe}from"./store-9CvxLGNQ.js";import{ar as ke,er as Ae,fn as je,ir as Me,nr as S,pn as Ne,rr as Pe,s as Fe,tr as Ie}from"./Office-B_EroD2U.js";import{n as Le,r as Re}from"./interact-Bt-XX-z4.js";import{o as ze}from"./cityLayout-C8f5-bpM.js";import{i as Be,r as Ve,t as C}from"./billboardLayout-DSKGXPIM.js";import{f as He,n as Ue,u as We}from"./useDayTime-Nrdy7kH1.js";import{Jn as Ge,Rn as Ke,Vn as qe,_ as Je,b as Ye,d as Xe,g as Ze,h as Qe,kn as $e,p as et,u as tt}from"./cheerRules-G9WFRB4C.js";import{a as w}from"./Batched-yAiB-c-b.js";import{B as nt,U as T}from"./rig-B88WinIa.js";import{A as E,Bt as D,C as rt,Ct as it,D as at,Mt as ot,O,R as k,Tt as st,Y as ct,f as A,g as lt,gt as ut,ht as dt,k as ft,kt as j,pt,rt as mt,st as M,tt as ht,w as gt,x as N,xt as _t}from"./bloomMarks-C22qSi5d.js";var P=e(t(),1),vt=new Map,yt=new Map;function bt(e,t){let n=(0,P.useRef)(t);n.current=t,(0,P.useEffect)(()=>{let t=e=>n.current(e);return vt.set(e,t),()=>{vt.get(e)===t&&vt.delete(e)}},[e])}function F(e,t){let n=(0,P.useRef)(t);n.current=t,(0,P.useEffect)(()=>{let t=()=>n.current();return yt.set(e,t),()=>{yt.get(e)===t&&yt.delete(e)}},[e])}function xt(e){let t=e.indexOf(`:`);vt.get(t<0?e:e.slice(0,t))?.(t<0?``:e.slice(t+1))}var St=()=>Object.fromEntries([...yt].map(([e,t])=>[e,t()]));function Ct(){let[,e,t]=He(.5),n=Math.hypot(e,t);return[0,-t/n,e/n]}var wt=e=>2*Math.PI*(e-.5);function Tt(e,t,n=Ct()){let r=wt(t),i=Math.cos(r),a=Math.sin(r),[o,s,c]=n,[l,u,d]=e,f=o*l+s*u+c*d;return[l*i+(s*d-c*u)*a+o*f*(1-i),u*i+(c*l-o*d)*a+s*f*(1-i),d*i+(o*u-s*l)*a+c*f*(1-i)]}function Et(e){let[t,n,r]=He(e);return[-t,-n,-r]}function Dt(e){let t=e=>Math.round(e*1800/Math.PI)/10;return{yaw:t(Math.atan2(-e[0],-e[2])),pitch:t(Math.asin(Math.max(-1,Math.min(1,e[1]))))}}var Ot=[`The Coffee Mug`,`The Rubber Duck`,`The Merge Arrow`,`The Little Bug`,`The Gong`,`The Roomba`,`The Sticky Note`,`The Keyboard`],kt=9*Math.PI/180,At=22*Math.PI/180,jt=[.9,0,.1],Mt=.17,Nt=(e,t)=>Math.acos(Math.min(1,Math.max(-1,e[0]*t[0]+e[1]*t[1]+e[2]*t[2])));function Pt(e=6,t=Fe(700)){let n=t.sizes.length,r=e=>[t.positions[e*3],t.positions[e*3+1],t.positions[e*3+2]],i=Ct(),a=e=>jt.every(t=>Tt(r(e),t,i)[1]>Mt),o=Array.from({length:n},(e,t)=>t).filter(e=>t.sizes[e]>=3&&a(e)).sort((e,n)=>t.sizes[n]-t.sizes[e]||Tt(r(n),0,i)[1]-Tt(r(e),0,i)[1]),s=new Set,c=[];for(let i of o){if(c.length>=e)break;if(s.has(i)||c.some(e=>Nt(r(e.stars[0]),r(i))<At))continue;let a=Array.from({length:n},(e,t)=>t).filter(e=>e!==i&&!s.has(e)&&Nt(r(e),r(i))<kt).sort((e,t)=>Nt(r(e),r(i))-Nt(r(t),r(i))).slice(0,5);if(a.length<3)continue;let o=[i,...a.sort((e,n)=>t.sizes[n]-t.sizes[e])],l=[],u=new Set([i]);for(;u.size<o.length;){let e=null,t=1/0;for(let n of u)for(let i of o){if(u.has(i))continue;let a=Nt(r(n),r(i));a<t&&(t=a,e=[n,i])}l.push(e),u.add(e[1])}let d=o.reduce((e,t)=>[e[0]+r(t)[0],e[1]+r(t)[1],e[2]+r(t)[2]],[0,0,0]),f=Math.hypot(...d);for(let e of o)s.add(e);c.push({name:Ot[c.length%Ot.length],stars:o,lines:l,centre:[d[0]/f,d[1]/f,d[2]/f]})}return c}var Ft=null,It=()=>Ft??=Pt(),I=n(),L={w:1024,h:512},Lt=Math.round(L.w*C.h/C.w),Rt=null,zt=()=>Rt??=ze();function Bt(e,t,n){let r=t%2*L.w,i=Math.floor(t/2)*L.h,a=L.w,o=Lt;e.fillStyle=`#2b2d42`,e.fillRect(r,i,a,o),e.fillStyle=n.bg,_e(e,r+14,i+14,a-28,o-28,26),e.fill(),e.fillStyle=`rgba(255,255,255,0.75)`;for(let t=0;t<24;t++){let n=(t+.5)/24;for(let t of[i+30,i+o-30])e.beginPath(),e.arc(r+40+n*(a-80),t,6,0,Math.PI*2),e.fill()}e.fillStyle=n.fg,e.textAlign=`center`,e.textBaseline=`middle`,e.font=`700 54px ${be}`,e.fillText(n.top,r+a/2,i+92,a-120),e.font=`800 176px ${be}`,e.fillText(n.big,r+a/2,i+o/2+18,a-120),e.font=`600 46px ${be}`,e.fillText(n.under,r+a/2,i+o-82,a-120)}function Vt(){let e=x(e=>e.repos),t=x(e=>e.agents),n=x(e=>e.qa),r=x(e=>e.settings.companyName);return(0,P.useMemo)(()=>{let i=Object.values(t).filter(e=>e.role!==`ceo`);return{company:r,floors:e.length,agents:i.length,working:i.filter(e=>e.status===`working`||e.status===`preparing`).length,issues:e.reduce((e,t)=>e+t.issues.length,0),openPrs:e.reduce((e,t)=>e+t.pulls.filter(e=>e.state===`OPEN`).length,0),inQa:e.reduce((e,t)=>e+xe(t,n).inQa,0),merged:e.reduce((e,t)=>e+t.pulls.filter(e=>e.state===`MERGED`).length,0)}},[e,t,n,r])}function Ht(e){let t=e%2*.5,n=1-Math.floor(e/2)*.5;return{u0:t,u1:t+.5,v1:n,v0:n-Lt/(L.h*2)}}function Ut({top:e}){let t=ce(e),n=(0,P.useMemo)(()=>Ve(zt(),{x:v.x,y:t+v.eye,z:v.z}),[t]),r=Vt(),i=(0,P.useMemo)(()=>Be(r),[r]),a=JSON.stringify(i),o=Le(L.w*2,L.h*2,e=>i.forEach((t,n)=>Bt(e,n,t)),[a]),s=(0,P.useMemo)(()=>{let e=[],t=[];return n.forEach((n,r)=>{let i=(e,t,r,i)=>e.translate(t,r,i).rotateY(n.yaw).translate(n.x,n.y,n.z),a=new pt(C.w,C.h),{u0:o,u1:s,v0:c,v1:l}=Ht(r%4),u=a.attributes.uv;for(let e=0;e<u.count;e++)u.setXY(e,o+u.getX(e)*(s-o),c+u.getY(e)*(l-c));e.push(i(a,0,0,.2)),t.push(i(new N(C.w+.4,C.h+.4,.15),0,0,0)),t.push(i(new N(C.w,.12,.9),0,-C.h/2-.1,.5));let d=n.y-C.h/2-n.top;for(let e of[-C.w/3,C.w/3])t.push(i(new N(.3,d,.3),e,-C.h/2-d/2,-.1))}),{faces:c(e),frames:c(t)}},[n]);(0,P.useEffect)(()=>()=>Object.values(s).forEach(e=>e.dispose()),[s]);let l=(0,P.useMemo)(()=>({face:new mt({map:o,fog:!1,toneMapped:!1,polygonOffset:!0,polygonOffsetFactor:-2}),frame:new mt({color:`#3d405b`,fog:!1})}),[o]);return(0,P.useEffect)(()=>()=>Object.values(l).forEach(e=>e.dispose()),[l]),F(`billboards`,()=>n.map((e,n)=>{let r={x:e.x-v.x,y:e.y-t-v.eye,z:e.z-v.z},a=Math.hypot(r.x,r.y,r.z);return{x:Math.round(e.x),z:Math.round(e.z),dist:Math.round(e.dist),says:`${i[n%4].top}: ${i[n%4].big}`,...Dt([r.x/a,r.y/a,r.z/a])}})),(0,I.jsxs)(`group`,{position:[0,-t-.03,0],children:[(0,I.jsx)(`mesh`,{geometry:s.frames,material:l.frame}),(0,I.jsx)(`mesh`,{geometry:s.faces,material:l.face})]})}var Wt=new Map;function R(e,t,n,r,i=!0){let a=Wt.get(e);if(a)return a;let o=document.createElement(`canvas`);return o.width=t,o.height=n,r(o.getContext(`2d`)),a=new gt(o),a.colorSpace=it,a.anisotropy=8,i&&(a.wrapS=a.wrapT=_t),Wt.set(e,a),a}function Gt(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0,t/4294967296)}var Kt=()=>R(`paving`,256,256,e=>{e.fillStyle=`#d6d0c4`,e.fillRect(0,0,256,256);let t=Gt(3);for(let n=0;n<260;n++)e.fillStyle=t()<.5?`rgba(255,255,255,0.18)`:`rgba(90,80,70,0.08)`,e.fillRect(t()*256,t()*256,2+t()*3,2+t()*3);e.fillStyle=`#b3ab9d`,e.fillRect(0,0,256,4),e.fillRect(0,0,4,256)}),qt=()=>R(`decking`,512,512,e=>{let t=Gt(7);for(let n=0;n<8;n++){let r=n*64,i=150+Math.floor(t()*30);e.fillStyle=`rgb(${i+40},${i-20},${i-75})`,e.fillRect(0,r,512,64),e.strokeStyle=`rgba(80,40,10,0.18)`,e.lineWidth=2;for(let n=0;n<4;n++){let n=r+8+t()*48;e.beginPath(),e.moveTo(0,n),e.bezierCurveTo(170,n+(t()-.5)*8,340,n+(t()-.5)*8,512,n),e.stroke()}e.fillStyle=`#5b3a24`,e.fillRect(0,r,512,4);let a=(n%2?.3:.75)*512;e.fillRect(a,r,4,64)}}),Jt=()=>R(`helipad`,1024,1024,e=>{e.fillStyle=`#4a4f5a`,e.beginPath(),e.arc(512,512,508,0,Math.PI*2),e.fill(),e.strokeStyle=`#ffd166`,e.lineWidth=34,e.beginPath(),e.arc(512,512,440,0,Math.PI*2),e.stroke(),e.strokeStyle=`#f8f9fa`,e.lineWidth=10,e.setLineDash([60,40]),e.beginPath(),e.arc(512,512,495,0,Math.PI*2),e.stroke(),e.setLineDash([]),e.fillStyle=`#f8f9fa`,e.fillRect(322,282,70,460),e.fillRect(632,282,70,460),e.fillRect(322,477,380,70)},!1),Yt=()=>R(`stripes`,128,8,e=>{for(let t=0;t<4;t++)e.fillStyle=t%2?`#ffffff`:`#c9c9c9`,e.fillRect(t*32,0,32,8)}),Xt=()=>R(`windsock`,8,128,e=>{for(let t=0;t<5;t++)e.fillStyle=t%2?`#ffffff`:`#ff7b39`,e.fillRect(0,t*128/5,8,26.6)}),Zt=[`#e63946`,`#3a86ff`,`#ffb703`,`#2a9d8f`],Qt=.45,z=[0,.22,.12],B=[0,.45,-.42],V=[0,z[1]+.86*Math.cos(.5),z[2]+.86*Math.sin(.5)],$t=.28,en=.31,tn=[0,.98,.3],nn=.42,rn=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]];function H(e,t,n=.045){let r=new D(...e),i=new D(...t).clone().sub(r),a=new N(n,n,i.length());return a.applyQuaternion(new ut().setFromUnitVectors(new D(0,0,1),i.normalize())),a.translate((e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2)}function an(e,t,n){let r=new rt,i=[e[0]-$t,e[1],e[2],e[0]+$t,e[1],e[2],t[0]-$t,t[1],t[2],t[0]+$t,t[1],t[2]];return r.setAttribute(`position`,new k(i,3)),r.setAttribute(`uv`,new k([0,0,1,0,0,1,1,1],2)),r.setAttribute(`color`,new k(Array.from({length:4},()=>[n.r,n.g,n.b]).flat(),3)),r.setIndex([0,2,1,1,2,3]),r.computeVertexNormals(),r}function on(){let e=[],t=[];b.xs.forEach((n,r)=>{let i=se(r),a=e=>[e[0]+i.x,e[1],e[2]+i.z];for(let t of[-.31,en]){let n=[t,0,0];e.push(H(a(rn(B,n)),a(rn(z,n)))),e.push(H(a(rn(z,n)),a(rn(V,n)))),e.push(H(a([t,0,B[2]]),a([t,B[1]+.02,B[2]]))),e.push(H(a([t,0,.62]),a([t,.64,.34]))),e.push(H(a([t*1.07,.56,-.48]),a([t*1.07,.56,.2]),.07)),e.push(H(a([t*1.07,.56,-.44]),a([t,.3,-.42])))}e.push(H(a([-.31,V[1],V[2]]),a([en,V[1],V[2]]),.06)),e.push(H(a([-.31,B[1],B[2]]),a([en,B[1],B[2]]),.06));let o=new O(Zt[r%Zt.length]);t.push(an(a(B),a(z),o),an(a(z),a(V),o))});let n=c(ve.flatMap(e=>[new E(e.r,e.r,.05,20).translate(e.x,.55,e.z),new E(.04,.05,.53,8).translate(e.x,.27,e.z),new E(.2,.22,.03,16).translate(e.x,.015,e.z)]));return{frame:c(e),canvas:c(t),tables:n}}var sn=(e,t=Date.now())=>et(t).some(n=>n.kind===`break`&&n.chair===e&&Je(n,t)!==`down`);function cn({i:e}){let t=se(e),n=Re({id:`deckchair-${e}`,label:`Sit back in the deck chair`,action:{kind:`roof`,op:`chair:${e}`}},3);return(0,I.jsx)(`mesh`,{ref:n,position:[t.x,.5,t.z+.05],visible:!1,children:(0,I.jsx)(`boxGeometry`,{args:[b.w,1,b.l]})})}function ln(e){if(e<0||e>=b.xs.length)return;let t=x.getState();if(S.getState().sitting===e)return;if(sn(e)){t.pushToast(`info`,`🪑 Someone's sitting there: try another chair`);return}let n=se(e);ke({id:`deckchair-${e}`,x:n.x+tn[0],y:tn[1],z:n.z+tn[2],tilt:nn,look:1,minPitch:-.95,maxPitch:1.1,exit:Te(e),yaw:0,pitch:.05,onLeave:()=>{S.getState().sitting===e&&S.setState({sitting:null})}}),S.setState({sitting:e,telescope:!1}),Ge({x:n.x,y:.4,z:n.z})}function un(){let e=(0,P.useMemo)(on,[]);(0,P.useEffect)(()=>()=>Object.values(e).forEach(e=>e.dispose()),[e]);let t=(0,P.useMemo)(()=>new M({map:Yt(),vertexColors:!0,side:2}),[]);return(0,P.useEffect)(()=>()=>t.dispose(),[t]),bt(`chair`,e=>ln(Number(e))),F(`chairs`,()=>b.xs.map((e,t)=>S.getState().sitting===t?`you`:sn(t)?`taken`:`free`)),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:e.frame,material:T(`#c08552`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.012,color:`#1f1d2b`})}),(0,I.jsx)(`mesh`,{geometry:e.canvas,material:t,castShadow:!0,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.tables,material:T(`#e9ecef`),castShadow:!0,receiveShadow:!0}),b.xs.map((e,t)=>(0,I.jsx)(cn,{i:t},t))]})}var dn=`#1f1d2b`;function fn(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0,t/4294967296)}var pn=e=>({x:(e.minX+e.maxX)/2,z:(e.minZ+e.maxZ)/2,w:e.maxX-e.minX,d:e.maxZ-e.minZ,h:e.h??.6});function mn(){let e=fn(21),t=[],n=[],r=[],i=[],a=[],s=[],l=[];ne.forEach((o,c)=>{let{x:u,z:d,w:f,d:p,h:m}=pn(o);t.push({size:[f,m-.06,p],at:[u,(m-.06)/2,d]}),t.push({size:[f+.08,.06,p+.08],at:[u,m-.03,d]}),n.push({size:[f-.12,.04,p-.12],at:[u,m-.02,d]});let h=m,ee=(t,n)=>{for(let r=0;r<t;r++)n(u-f/2+.35+r*(f-.7)/Math.max(1,t-1),d+(e()-.5)*.25,r)};if(c===2)for(let e of[-.22,.22])ee(Math.round(f/.55),(t,n,i)=>r.push(new j(.17+i%3*.02,10,7).scale(1,.6,1).translate(t,h+.08,d+e)));else c===1?ee(Math.round(f/.9),(t,n)=>{l.push(new E(.015,.015,1.1,5).translate(t,h+.55,n)),i.push(new j(.28,10,8).scale(1,1.35,1).translate(t,h+.5,n));for(let r=0;r<4;r++)a.push(new j(.06,8,6).translate(t+(e()-.5)*.4,h+.3+e()*.5,n+(e()<.5?-.24:.24)))}):ee(Math.round(f/.8),(t,n)=>{let a=1.2+e()*.5;l.push(new E(.025,.03,a,6).translate(t,h+a/2,n+.2)),r.push(new j(.12,8,6).scale(1.6,.4,1).translate(t+.08,h+a*.5,n+.2)),s.push(new E(.24,.24,.04,14).rotateX(Math.PI/2).translate(t,h+a,n+.18)),l.push(new E(.11,.11,.06,12).rotateX(Math.PI/2).translate(t,h+a,n+.21)),i.push(new ft(.12,.3,7).translate(t+.25,h+.15,n-.22))})});for(let e of he)t.push({size:[e.w,e.h-.06,e.w],at:[e.x,(e.h-.06)/2,e.z]}),t.push({size:[e.w+.08,.06,e.w+.08],at:[e.x,e.h-.03,e.z]}),n.push({size:[e.w-.12,.04,e.w-.12],at:[e.x,e.h-.02,e.z]}),l.push(new E(.07,.1,1.5,8).translate(e.x,e.h+.75,e.z)),i.push(new j(.75,14,10).translate(e.x,e.h+1.75,e.z)),r.push(new j(.5,12,8).translate(e.x+.45,e.h+1.45,e.z+.2)),r.push(new j(.45,12,8).translate(e.x-.4,e.h+1.5,e.z-.25));return{wood:o(t),soil:o(n),leaves:c(r),dark:c(i),red:c(a),yellow:c(s),brown:c(l)}}function hn(){let{x:e,z:t,r:n,legs:r,h:i}=Oe,a=[],s=n*.75;for(let n of[-s,s])for(let i of[-s,s])a.push({size:[.16,r,.16],at:[e+n,r/2,t+i]});for(let n of[.5,1.4])a.push({size:[2*s,.08,.08],at:[e,n,t-s]}),a.push({size:[2*s,.08,.08],at:[e,n,t+s]}),a.push({size:[.08,.08,2*s],at:[e-s,n,t]}),a.push({size:[.08,.08,2*s],at:[e+s,n,t]});a.push({size:[2*s+.4,.12,2*s+.4],at:[e,r-.06,t]});for(let o of[-.22,.22])a.push({size:[.06,r+i*.8,.06],at:[e+o,(r+i*.8)/2,t+n+.12]});for(let o=1;o<9;o++)a.push({size:[.44,.04,.04],at:[e,o*(r+i*.8)/9,t+n+.12]});let l=new E(n,n*1.04,i,24).translate(e,r+i/2,t),u=c([.25,.55,.85].map(a=>new ot(n*1.03+.02,.035,6,32).rotateX(Math.PI/2).translate(e,r+i*a,t))),d=new ft(n*1.12,.9,24).translate(e,r+i+.45,t);return{stand:o(a),tank:l,hoops:u,hat:d}}function gn(){let{x:e,z:t,w:n,d:r,h:i}=ue,a=[{size:[n,.07,.8],at:[e,i,t]}];for(let i of[-1,1])a.push({size:[n,.06,.3],at:[e,.44,t+i*(r/2-.15)]});let s=[];for(let a of[-n/2+.25,n/2-.25])s.push({size:[.08,.06,r-.1],at:[e+a,.38,t]}),s.push({size:[.08,i,.08],at:[e+a,i/2,t-.3]}),s.push({size:[.08,i,.08],at:[e+a,i/2,t+.3]});return{top:o(a),legs:o(s)}}function _n(){let e=(0,P.useMemo)(mn,[]),t=(0,P.useMemo)(hn,[]),n=(0,P.useMemo)(gn,[]);return(0,P.useEffect)(()=>()=>[...Object.values(e),...Object.values(t),...Object.values(n)].forEach(e=>e.dispose()),[e,t,n]),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:e.wood,material:T(`#b07d4f`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:dn})}),(0,I.jsx)(`mesh`,{geometry:e.soil,material:T(`#5e4433`),receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.leaves,material:T(`#80c45c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.dark,material:T(`#3f9b4f`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.red,material:T(`#e63946`)}),(0,I.jsx)(`mesh`,{geometry:e.yellow,material:T(`#ffc93c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:e.brown,material:T(`#7a5a3c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:t.stand,material:T(`#5e4a3c`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:t.tank,material:T(`#a8744a`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.025,color:dn})}),(0,I.jsx)(`mesh`,{geometry:t.hoops,material:T(`#495057`)}),(0,I.jsx)(`mesh`,{geometry:t.hat,material:T(`#6b4a33`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.025,color:dn})}),(0,I.jsx)(`mesh`,{geometry:n.top,material:T(`#c9905a`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.018,color:dn})}),(0,I.jsx)(`mesh`,{geometry:n.legs,material:T(`#8a5a32`),castShadow:!0})]})}var U={cook:7,char:30},vn=()=>({since:null,turns:0});function W(e,t){if(e.since===null)return`idle`;let n=t-e.since;return n<U.cook?`cooking`:n<U.cook+U.char?`ready`:`charred`}function yn(e,t){if(e.since===null)return 0;let n=Math.max(0,t-e.since);return n<U.cook?n/U.cook:1+Math.min(1,(n-U.cook)/U.char)}function bn(e,t){let n=W(e,t);return n===`cooking`?1:n===`idle`?0:.35}function xn(e,t,n){let r=W(e,t);return r===`cooking`?{op:`turn`,grill:{...e,turns:e.turns+1}}:n?{op:`full`,grill:e}:r===`idle`?{op:`start`,grill:{since:t,turns:0}}:{op:`take`,grill:vn()}}function Sn(e){return e===`idle`?`Grill a sausage`:e===`cooking`?`Turn the sausage`:e===`charred`?`Take the (charred) sausage`:`Take the sausage`}var Cn=`#1f1d2b`,wn=.86,Tn=new O(`#e9a0a0`),En=new O(`#b5532c`),Dn=new O(`#3b2922`),On=14,kn=2.2,An=1,jn={x:p.x,y:wn,z:p.z};function Mn(e){re({name:`grill-sizzle`,group:`toys`,pos:jn,dur:.06+Math.random()*.22,peak:(.012+Math.random()*.03)*e,filter:`highpass`,freq:2600+Math.random()*3800,attack:.004}),Math.random()<.18*e&&re({name:`grill-pop`,group:`toys`,pos:jn,dur:.03,peak:.05*e,filter:`bandpass`,freq:1500+Math.random()*1500,q:2,attack:.001})}function Nn(){re({name:`grill-hiss`,group:`toys`,pos:jn,dur:.9,peak:.07,filter:`highpass`,freq:3200,to:5200,attack:.01})}function Pn(){re({name:`grill-bun`,group:`toys`,pos:jn,dur:.12,peak:.04,filter:`lowpass`,freq:700,attack:.01}),pe({name:`grill-bun`,group:`toys`,pos:jn,freq:880,to:1320,type:`triangle`,dur:.12,peak:.03})}function Fn(){return{bowl:new j(p.r,24,12,0,Math.PI*2,Math.PI/2,Math.PI/2),lid:new j(p.r*1.02,24,12,0,Math.PI*2,0,Math.PI/2),coals:new at(p.r*.85,24).rotateX(-Math.PI/2),puff:new j(.11,10,8)}}function In(){let[e,t]=(0,P.useState)(vn),n=(0,P.useRef)(e);n.current=e;let r=(0,P.useMemo)(Fn,[]);(0,P.useEffect)(()=>()=>Object.values(r).forEach(e=>e.dispose()),[r]);let i=(0,P.useMemo)(()=>({sausage:new M({color:Tn.clone()}),coals:new mt({color:`#ff6b2c`,toneMapped:!1}),smoke:new mt({color:`#e9ecef`,transparent:!0,opacity:.38,depthWrite:!1})}),[]);(0,P.useEffect)(()=>()=>Object.values(i).forEach(e=>e.dispose()),[i]);let a=(0,P.useRef)(null),o=(0,P.useRef)(null),s=(0,P.useMemo)(()=>({nextCrackle:0,m:new ht,state:``}),[]),c=()=>performance.now()/1e3,l=W(e,c()),u=Re({id:`grill`,label:Sn(l),action:{kind:`roof`,op:`grill`}},3);return A(()=>{let e=c(),r=n.current,l=W(r,e);l!==s.state&&(s.state=l,S.setState({grill:l}),t({...r}));let u=yn(r,e);u<=1?i.sausage.color.lerpColors(Tn,En,u):i.sausage.color.lerpColors(En,Dn,u-1);let d=bn(r,e);i.coals.color.setRGB(1,.32+.12*Math.sin(e*7)*Math.sin(e*3.1),.08).multiplyScalar(.55+.45*Math.max(d,.3)),a.current&&(a.current.visible=r.since!==null,a.current.rotation.x=r.turns*Math.PI+(d>.5?Math.sin(e*9)*.03:0)),d>0&&e>=s.nextCrackle&&(Mn(d),s.nextCrackle=e+(d>.5?.06+Math.random()*.1:.25+Math.random()*.5));let f=o.current;if(f&&(f.visible=d>0,f.visible)){for(let t=0;t<On;t++){let n=(e/kn+t/On)%1,r=(.4+n*1.6)*(t/On<d),i=n*n*.9;s.m.makeScale(r,r,r).setPosition(p.x+Math.sin(t*2.3+e*.7)*.12*n,1.01+n*1.6,p.z+i),f.setMatrixAt(t,s.m)}f.instanceMatrix.needsUpdate=!0,i.smoke.opacity=.32*Math.min(1,d+.2)}}),bt(`grill`,()=>{let e=x.getState(),r=c(),{op:i,grill:a}=xn(n.current,r,e.held!==null);if(i===`full`){e.pushToast(`info`,e.held?.kind===`sausage`?`🌭 One at a time: eat that one first (E)`:`🙌 Your hands are full`);return}let o=n.current;n.current=a,t(a),(i===`start`||i===`turn`)&&Nn(),i===`take`&&(Pn(),e.setHeld({kind:`sausage`,id:`sausage-${An++}`,bites:3,charred:W(o,r)===`charred`}))}),F(`grill`,()=>{let e=c();return{state:W(n.current,e),doneness:Math.round(yn(n.current,e)*100)/100,turns:n.current.turns,sizzle:bn(n.current,e)}}),(0,I.jsxs)(`group`,{children:[(0,I.jsxs)(`group`,{ref:u,children:[(0,I.jsxs)(`group`,{position:[p.x,wn,p.z],children:[(0,I.jsx)(`mesh`,{geometry:r.bowl,material:T(`#2b2d42`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.015,color:Cn})}),(0,I.jsx)(`mesh`,{geometry:r.coals,position:[0,-.08,0],material:i.coals}),(0,I.jsx)(`mesh`,{position:[0,.01,0],rotation:[-Math.PI/2,0,0],material:T(`#adb5bd`),children:(0,I.jsx)(`ringGeometry`,{args:[p.r*.88,p.r*.95,24]})}),[-.24,-.12,0,.12,.24].map(e=>(0,I.jsx)(`mesh`,{position:[e,.01,0],material:T(`#adb5bd`),children:(0,I.jsx)(`boxGeometry`,{args:[.012,.012,Math.sqrt(p.r*p.r*.85-e*e)*2]})},e)),(0,I.jsx)(`group`,{position:[0,0,p.r],rotation:[1.75,0,0],children:(0,I.jsx)(`mesh`,{geometry:r.lid,position:[0,0,-p.r],material:T(`#2b2d42`),castShadow:!0,children:(0,I.jsx)(w,{thickness:.015,color:Cn})})}),[0,1,2].map(e=>{let t=e/3*Math.PI*2+.5;return(0,I.jsx)(`mesh`,{position:[Math.cos(t)*.28,-.86/2-.05,Math.sin(t)*.28],rotation:[Math.sin(t)*.25,0,-Math.cos(t)*.25],material:T(`#495057`),castShadow:!0,children:(0,I.jsx)(`cylinderGeometry`,{args:[.022,.022,.91,6]})},e)}),(0,I.jsxs)(`group`,{ref:a,position:[.04,.05,0],rotation:[0,.3,0],visible:!1,children:[(0,I.jsx)(`mesh`,{rotation:[0,0,Math.PI/2],material:i.sausage,castShadow:!0,children:(0,I.jsx)(`capsuleGeometry`,{args:[.035,.2,4,10]})}),[-.06,0,.06].map(e=>(0,I.jsx)(`mesh`,{position:[e,-.03,0],material:T(`#5a2d1a`),children:(0,I.jsx)(`boxGeometry`,{args:[.012,.012,.072]})},e))]})]}),(0,I.jsxs)(`group`,{position:[p.x+p.shelf,0,p.z],children:[(0,I.jsxs)(`mesh`,{position:[0,.78,0],material:T(`#c9905a`),castShadow:!0,children:[(0,I.jsx)(`boxGeometry`,{args:[.6,.05,.5]}),(0,I.jsx)(w,{thickness:.012,color:Cn})]}),[-.25,.25].map(e=>[-.2,.2].map(t=>(0,I.jsx)(`mesh`,{position:[e,.38,t],material:T(`#8a5a32`),children:(0,I.jsx)(`boxGeometry`,{args:[.04,.76,.04]})},`${e}${t}`))),(0,I.jsx)(`mesh`,{position:[-.08,.86,0],material:T(`#d4a373`),children:(0,I.jsx)(`boxGeometry`,{args:[.3,.1,.22]})}),[-.05,.05].map(e=>(0,I.jsx)(`mesh`,{position:[-.08,.93,e],rotation:[0,0,Math.PI/2],material:T(`#f2c38b`),children:(0,I.jsx)(`capsuleGeometry`,{args:[.04,.14,4,8]})},e)),(0,I.jsx)(`mesh`,{position:[.17,.89,.1],material:T(`#d62828`),castShadow:!0,children:(0,I.jsx)(`cylinderGeometry`,{args:[.035,.04,.17,10]})}),(0,I.jsx)(`mesh`,{position:[.17,.99,.1],material:nt(`#f8f9fa`),children:(0,I.jsx)(`coneGeometry`,{args:[.02,.05,8]})})]})]}),(0,I.jsx)(`instancedMesh`,{ref:o,args:[r.puff,i.smoke,On],frustumCulled:!1,visible:!1,renderOrder:3})]})}var G={x:.17,y:-.15,z:-.42,tilt:-.5,turn:.7},Ln={x:.03,y:-.07,z:-.24,tilt:-.15,turn:1.35},Rn=`#1f1d2b`;function zn(){let e=x(e=>e.held?.kind===`sausage`?e.held:null),t=(0,P.useRef)(null),n=(0,P.useRef)(null);if(A(({camera:e})=>{let r=t.current,i=n.current;if(!r||!i)return;r.position.copy(e.position),r.quaternion.copy(e.quaternion);let a=Ye.lift,o=performance.now()/1e3;i.position.set(G.x+(Ln.x-G.x)*a,G.y+(Ln.y-G.y)*a+Math.sin(o*1.6)*.003*(1-a),G.z+(Ln.z-G.z)*a),i.rotation.set(G.tilt+(Ln.tilt-G.tilt)*a,G.turn+(Ln.turn-G.turn)*a,0,`YXZ`)}),!e)return null;let r=Math.max(.15,e.bites/3),i=.17*r;return(0,I.jsx)(`group`,{ref:t,userData:s,children:(0,I.jsx)(`group`,{ref:n,scale:.8,children:(0,I.jsxs)(`group`,{position:[0,0,-.085+i/2],children:[[-1,1].map(e=>(0,I.jsxs)(`mesh`,{position:[e*.026,-.012,0],rotation:[Math.PI/2,0,0],material:T(`#e9b872`),children:[(0,I.jsx)(`capsuleGeometry`,{args:[.026,i,4,10]}),(0,I.jsx)(w,{thickness:.004,color:Rn})]},e)),(0,I.jsxs)(`mesh`,{position:[0,.006,0],rotation:[Math.PI/2,0,0],material:T(e.charred?`#3b2922`:`#b5532c`),children:[(0,I.jsx)(`capsuleGeometry`,{args:[.02,i+.03,4,10]}),(0,I.jsx)(w,{thickness:.004,color:Rn})]}),Array.from({length:Math.max(1,Math.round(5*r))},(e,t)=>(0,I.jsx)(`mesh`,{position:[(t%2?1:-1)*.008,.027,-i/2+.02+t*.032],rotation:[0,(t%2?1:-1)*.9,0],material:T(t%3==2?`#ffc93c`:`#d62828`),children:(0,I.jsx)(`boxGeometry`,{args:[.006,.004,.03]})},t))]})})})}var Bn=`#1f1d2b`,{x:K,z:q,t:J,parapet:Y,h:Vn}=Se,X=ge,Hn=1.2;function Un(e,t,n){let r=new pt(e,t).rotateX(-Math.PI/2),i=r.attributes.uv;for(let r=0;r<i.count;r++)i.setXY(r,i.getX(r)*e/n,i.getY(r)*t/n);return r}var Wn=[[-K,K,-q,-q+J],[-K,-K+J,-q+J,q-J],[K-J,K,-q+J,q-J],[-K,X.minX,q-J,q],[X.maxX,K,q-J,q]];function Gn(){let e=[],t=[],n=[];for(let[r,i,a,o]of Wn){let s=i-r,c=o-a,l=(r+i)/2,u=(a+o)/2;e.push({size:[s,Y,c],at:[l,Y/2,u]}),t.push({size:[s+.06,.07,c+.06],at:[l,Y+.035,u]});let d=s>c,f=d?s:c,p=Math.max(1,Math.round(f/1.6));for(let e=0;e<=p;e++){let t=-f/2+e*f/p;n.push({size:[.06,Vn-Y,.06],at:[d?l+t:l,Y+(Vn-Y)/2,d?u:u+t]})}n.push({size:d?[s,.07,.09]:[.09,.07,c],at:[l,Vn,u]}),n.push({size:d?[s,.035,.035]:[.035,.035,c],at:[l,(Y+Vn)/2+.05,u]})}return{wall:o(e),cap:o(t),metal:o(n)}}var Z={half:.5,h:2.2};function Kn(e){let{doorHalf:t,doorHeight:n}=ae,r=X.front,i=12+r/2,a=X.stairX-Z.half,s=X.stairX+Z.half,c=(e,t,n,a)=>({size:[t-e,a-n,r],at:[(e+t)/2,(n+a)/2,i]}),l=[c(X.minX,a,0,X.h),c(a,s,Z.h,X.h),c(s,-t,0,X.h),c(-t,t,n,X.h),c(t,X.maxX,0,X.h),{size:[.25,X.h+e,X.maxZ-12],at:[X.minX+.125,(X.h-e)/2,(12+X.maxZ)/2]},{size:[.25,X.h+e,X.maxZ-12],at:[X.maxX-.125,(X.h-e)/2,(12+X.maxZ)/2]},{size:[X.maxX-X.minX,X.h+e,.25],at:[(X.minX+X.maxX)/2,(X.h-e)/2,X.maxZ-.125]}],u=[{size:[X.maxX-X.minX+.3,.2,X.maxZ-12+.3],at:[(X.minX+X.maxX)/2,X.h+.1,(12+X.maxZ)/2]},{size:[1.4,.7,1.1],at:[X.minX+1.4,X.h+.55,X.maxZ-1]},{size:[.9,.5,.9],at:[X.maxX-.9,X.h+.45,12.9]}],d=[{size:[X.maxX-X.minX+.04,.22,.04],at:[(X.minX+X.maxX)/2,X.h-.5,11.98]},{size:[.08,Z.h+.08,.08],at:[a-.04,Z.h/2,11.98]},{size:[.08,Z.h+.08,.08],at:[s+.04,Z.h/2,11.98]},{size:[Z.half*2+.16,.08,.08],at:[X.stairX,Z.h+.04,11.98]},{size:[.05,1.6,.05],at:[X.maxX-.6,X.h+.2+.8,12.5]}],f=[{size:[Z.half*2,Z.h,.05],at:[X.stairX,Z.h/2,12.06]}],p=[{size:[.05,.05,.08],at:[X.stairX+Z.half-.14,1.05,12]},{size:[.5,.04,.04],at:[X.stairX,1,12.01]}];return{walls:o(l),roof:o(u),trim:o(d),door:o(f),handle:o(p)}}function qn(){let e=[new N(.3,.14,.12).translate(X.stairX,Z.h+.35,11.94)];for(let t=0;t<12;t++){let n=t/12*Math.PI*2;e.push(new j(.09,10,6,0,Math.PI*2,0,Math.PI/2).translate(_.x+Math.cos(n)*(_.r+.25),0,_.z+Math.sin(n)*(_.r+.25)))}return c(e)}function Jn(){let e=(0,P.useRef)(null),t=(0,P.useMemo)(()=>new E(.2,.09,1.3,16,1,!0).rotateX(Math.PI/2).translate(0,0,.65),[]);(0,P.useEffect)(()=>()=>t.dispose(),[t]);let n=(0,P.useMemo)(()=>new M({map:Xt(),side:2}),[]);return(0,P.useEffect)(()=>()=>n.dispose(),[n]),A(({clock:t})=>{let n=e.current;if(!n)return;let r=t.elapsedTime,i=.5+.5*Math.sin(r*.35)*Math.sin(r*.13+1);n.rotation.set(.55*(1-i)+Math.sin(r*3.1)*.04,Math.sin(r*.27)*.5+Math.sin(r*1.7)*.06,0,`YXZ`)}),(0,I.jsxs)(`group`,{position:[De.x,0,De.z],children:[(0,I.jsx)(`mesh`,{position:[0,De.h/2,0],material:T(`#adb5bd`),castShadow:!0,children:(0,I.jsx)(`cylinderGeometry`,{args:[.045,.06,De.h,10]})}),(0,I.jsx)(`group`,{ref:e,position:[0,De.h-.12,0],children:(0,I.jsx)(`mesh`,{geometry:t,material:n,castShadow:!0})})]})}function Yn({top:e}){let t=ce(e),n=(0,P.useMemo)(()=>{let e=g.maxX-g.minX,t=g.maxZ-g.minZ;return{paving:Un(2*K,2*q,Hn).translate(0,0,0),decking:(()=>{let n=new N(e,.06,t),r=n.attributes.uv;for(let n=0;n<r.count;n++)r.setXY(n,r.getX(n)*e/Hn,r.getY(n)*t/Hn);return n.translate((g.minX+g.maxX)/2,.03,(g.minZ+g.maxZ)/2)})(),helipad:new at(_.r,64).rotateX(-Math.PI/2).translate(_.x,.005,_.z),bulbs:qn()}},[]),r=(0,P.useMemo)(Gn,[]),i=(0,P.useMemo)(()=>Kn(t),[t]);(0,P.useEffect)(()=>()=>[...Object.values(n),...Object.values(r)].forEach(e=>e.dispose()),[n,r]),(0,P.useEffect)(()=>()=>Object.values(i).forEach(e=>e.dispose()),[i]);let o=(0,P.useMemo)(()=>({paving:new M({map:Kt()}),decking:new M({map:qt()}),helipad:new M({map:Jt(),transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2})}),[]);return(0,P.useEffect)(()=>()=>Object.values(o).forEach(e=>e.dispose()),[o]),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:n.paving,material:o.paving,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:n.decking,material:o.decking,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:n.helipad,material:o.helipad,receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:n.bulbs,material:a}),(0,I.jsx)(`mesh`,{geometry:r.wall,material:T(`#c9c2b4`),receiveShadow:!0,castShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:Bn})}),(0,I.jsx)(`mesh`,{geometry:r.cap,material:T(`#ece6da`),receiveShadow:!0}),(0,I.jsx)(`mesh`,{geometry:r.metal,material:T(`#5c677d`),castShadow:!0}),(0,I.jsx)(`mesh`,{geometry:i.walls,material:T(`#efe3cc`),receiveShadow:!0,castShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:Bn})}),(0,I.jsx)(`mesh`,{geometry:i.roof,material:T(`#8d99ae`),castShadow:!0,receiveShadow:!0,children:(0,I.jsx)(w,{thickness:.02,color:Bn})}),(0,I.jsx)(`mesh`,{geometry:i.trim,material:T(`#ff8a5b`)}),(0,I.jsx)(`mesh`,{geometry:i.door,material:T(`#2a9d8f`)}),(0,I.jsx)(`mesh`,{geometry:i.handle,material:T(`#dee2e6`)}),(0,I.jsx)(Jn,{}),(0,I.jsx)(je,{top:e})]})}var Xn={x:0,z:11},Q=[{x:-14.4,z:-4.8},{x:-14.4,z:-1.2}],Zn=null,Qn=()=>Zn??=ee([...m(),f()],{planR:fe+.1,lineR:fe+.03,greed:1.3}),$n=(e,t)=>te(Qn(),e,t),er=0,tr=Math.PI/2,nr=.5,rr=.16,ir={every:6,breakChance:.2,callChance:.06,ride:2.5},ar=3e3,or=(e,t)=>$n(e,t)??[t];function sr({agent:e,chair:t}){let n=(0,P.useRef)(null),i=se(t);return A(()=>{let t=n.current;if(!t)return;let r=me(e.id),i=r?Ce(r.sit):1;t.rotation.x=Qt*i,t.position.y=nr-rr*i}),(0,I.jsx)(`group`,{position:[i.x,0,i.z],children:(0,I.jsx)(`group`,{ref:n,position:[0,.33999999999999997,0],rotation:[Qt,0,0],children:(0,I.jsx)(`group`,{position:[0,-.5,0],children:(0,I.jsx)(r,{agent:e})})})})}function cr({agent:e}){return(0,I.jsx)(`group`,{position:[Q[0].x,0,Q[0].z],rotation:[0,tr,0],children:(0,I.jsx)(r,{agent:e})})}function lr(){let e=lt(e=>e.camera),t=x(e=>e.agents),[n,r]=(0,P.useState)([]),a=(0,P.useMemo)(()=>new Map,[]),o=(0,P.useMemo)(()=>({roll:ir.every,mounted:Date.now(),dirty:!1}),[]);(0,P.useEffect)(()=>()=>{for(let e of a.keys())de(e),y(e,null);a.clear()},[a]);let s=(e,t)=>{if(!e||!Ke(e.status))return!1;let n=e.role===`ceo`?`call`:`break`,r=Xe(et(),e.id,n,Date.now(),Math.random(),{chairs:b.xs.length,playerChair:S.getState().sitting,ride:ir.ride,stay:t});return r&&Qe(r),!!r};bt(`visit`,e=>{let[t,n]=e.split(`:`);s(x.getState().agents[t],n?Number(n):void 0)||x.getState().pushToast(`info`,`🛗 No room on the roof for them just now (or they are busy)`)}),F(`visitors`,()=>[...a.values()].map(e=>({id:e.id,name:x.getState().agents[e.id]?.name??e.id,kind:e.kind,chair:e.chair,stage:e.stage,seated:me(e.id)?.stage===`seated`})));let c=(e,t)=>{o.dirty=!0,t?a.set(e.id,e):a.delete(e.id)},l=(e,t,n)=>{e.stage=`leave`,e.hurry=t,e.path=[...or(n,Xn),i],e.wp=0,e.waited=e.ghost=0,y(e.id,null),t&&Ze(e.id,{leave:Date.now()})},u=(t,n,r,i)=>{let o=me(t.id);if(!o)return!1;t.wp=qe(t.path,t.wp,o);let s=t.path[t.wp],c=t.wp===t.path.length-1,l=s.x-o.x,u=s.z-o.z,d=Math.hypot(l,u);if(c&&d<.08&&o.speed<.05)return!0;let f=c&&i!==void 0?i:Math.atan2(-l,-u),p=t.hurry?$e:Ee;if(d>.05&&t.ghost<=0){let i=[...a.values()].filter(e=>e!==t).flatMap(e=>{let t=me(e.id);return t?[{id:e.id,x:t.x,z:t.z}]:[]}),s=h({id:t.id,x:o.x,z:o.z,dx:l/d,dz:u/d},i,{x:e.position.x,z:e.position.z},(e,t)=>ie(Qn().rects,e,t,fe));if(s.wait||s.speed<.15)return t.waited+=n,t.waited>3&&(t.ghost=2),we(t.id,{mode:`standing`,x:o.x,z:o.z,heading:o.heading,gesture:r}),!1}return t.waited=0,t.ghost=Math.max(0,t.ghost-n),we(t.id,{mode:`walking`,x:s.x,z:s.z,heading:f,speed:p,gesture:r}),!1};return A((e,t)=>{let n=Math.min(t,.1),d=Date.now(),f=x.getState(),p=We(Ue.t)<.5,m=et(d);for(let e of m){if(a.has(e.id)||!f.agents[e.id])continue;let t=Je(e,d);if(t===`down`)continue;let n={id:e.id,kind:e.kind,chair:e.chair,stage:`riding`,t:0,path:[],wp:0,leg:0,hold:-1,hurry:!1,waited:0,ghost:0,quietAt:0};t===`up`&&(d-e.arrive>ar||d-o.mounted<1e3)&&(e.kind===`call`?(ye(e.id,Q[0].x,Q[0].z,tr),we(e.id,{gesture:`call`}),n.stage=`call`):n.stage=`seated`),c(n,!0)}for(let e of a.values()){let t=f.agents[e.id],r=m.find(t=>t.id===e.id);if(!t||!r&&e.stage===`riding`){de(e.id),c(e,!1);continue}e.t+=n;let a=me(e.id),s=!Ke(t.status),h=!r||d>=r.leave;switch(e.quietAt&&d>e.quietAt&&(y(e.id,null),e.quietAt=0),e.stage){case`riding`:r&&d>=r.arrive&&(ye(e.id,i.x,i.z,er),oe({x:0,y:2.6,z:12}),e.stage=`doors`,e.t=0,o.dirty=!0);break;case`doors`:if(e.t<1.2)break;e.path=[Xn,...or(Xn,e.kind===`call`?Q[0]:Te(e.chair))],e.wp=0,e.hurry=s,e.stage=`walk`;break;case`walk`:s&&!e.hurry&&a?l(e,!0,a):u(e,n,e.kind===`call`?`call`:`none`,e.kind===`call`?tr:er)&&(e.kind===`call`?(e.stage=`call`,e.t=0):(de(e.id),e.stage=`sitting`));break;case`sitting`:a?.stage===`seated`&&(e.stage=`seated`,y(e.id,p?`😎`:`🌙`),e.quietAt=d+3e3);break;case`seated`:(h||s)&&a&&l(e,s,Te(e.chair));break;case`call`:{if((h||s)&&a){l(e,s,a);break}let t=Q[e.leg];if(e.path.length&&e.path[e.path.length-1]===t||(e.path=[t],e.wp=0),!u(e,n,`call`,tr))break;e.hold<0&&(e.hold=4+Math.random()*5,Math.random()<.6&&(y(e.id,Math.random()<.5?`📞`:`💬`),e.quietAt=d+2500)),e.hold-=n,e.hold<=0&&(e.leg=1-e.leg,e.hold=-1);break}case`leave`:u(e,n,`none`)&&(tt(e.id),de(e.id),y(e.id,null),c(e,!1))}}if(o.roll-=n,o.roll<=0){o.roll=ir.every;let e=new Set(m.map(e=>e.id)),t=Object.values(f.agents).filter(t=>!e.has(t.id)&&Ke(t.status)),n=t.filter(e=>e.role!==`ceo`);n.length&&Math.random()<ir.breakChance&&s(n[Math.floor(Math.random()*n.length)]);let r=t.find(e=>e.role===`ceo`);r&&Math.random()<ir.callChance&&s(r)}o.dirty&&(o.dirty=!1,r([...a.values()].filter(e=>e.stage!==`riding`).map(e=>({id:e.id,kind:e.kind,chair:e.chair}))))}),(0,I.jsx)(`group`,{children:n.map(e=>{let n=t[e.id];return n?e.kind===`call`?(0,I.jsx)(cr,{agent:n},e.id):(0,I.jsx)(sr,{agent:n,chair:e.chair},e.id):null})})}var ur=[[0,3],[1,2],[2,5],[3,4],[0,2],[2,4],[1,3],[3,5]],dr=d.h-.12,fr=.62,pr=[`#fff1c9`,`#fff1c9`,`#ffb86b`,`#ff8fab`,`#8ecae6`,`#fff1c9`,`#b9fbc0`],mr=new O(`#bdb6a6`),hr=new O(`#ffffff`);function gr(e,t,n,r){return Array.from({length:n+1},(i,a)=>{let o=a/n;return new D(e.x+(t.x-e.x)*o,dr-r*4*o*(1-o),e.z+(t.z-e.z)*o)})}function _r(){let e=document.createElement(`canvas`);e.width=e.height=64;let t=e.getContext(`2d`),n=t.createRadialGradient(32,32,0,32,32,32);n.addColorStop(0,`rgba(255,255,255,1)`),n.addColorStop(.25,`rgba(255,255,255,0.55)`),n.addColorStop(1,`rgba(255,255,255,0)`),t.fillStyle=n,t.fillRect(0,0,64,64);let r=new gt(e);return r.colorSpace=it,r}function vr(){let e=(0,P.useRef)(null),t=(0,P.useMemo)(()=>{let e=[],t=[];for(let[n,r]of ur){let i=le[n],a=le[r],o=Math.hypot(a.x-i.x,a.z-i.z),s=gr(i,a,24,.12+o*.035);for(let t=0;t<s.length-1;t++)e.push(s[t].x,s[t].y,s[t].z,s[t+1].x,s[t+1].y,s[t+1].z);let c=Math.floor(o/fr);for(let e of gr(i,a,c,.12+o*.035).slice(1,-1))t.push(e.setY(e.y-.07))}let n=new rt;n.setAttribute(`position`,new k(e,3));let r=t.map((e,t)=>new O(pr[t%pr.length])),i=new rt;return i.setAttribute(`position`,new k(t.flatMap(e=>[e.x,e.y,e.z]),3)),i.setAttribute(`color`,new k(r.flatMap(e=>[e.r,e.g,e.b]),3)),{at:t,colors:r,wireGeo:n,haloGeo:i,poles:c(le.flatMap(e=>[new E(d.r,d.r*1.3,d.h,8).translate(e.x,d.h/2,e.z),new j(d.r*1.6,8,6).translate(e.x,d.h,e.z)])),bulbGeo:new j(.055,10,8).scale(1,1.3,1),bulbMat:new mt({color:mr.clone(),toneMapped:!1}),wireMat:new ct({color:`#2b2d42`}),haloMat:new dt({size:.55,map:_r(),vertexColors:!0,transparent:!0,opacity:0,depthWrite:!1,blending:2,toneMapped:!1}),level:-1}},[]);(0,P.useEffect)(()=>()=>{for(let e of[t.wireGeo,t.haloGeo,t.poles,t.bulbGeo,t.bulbMat,t.wireMat,t.haloMat,t.haloMat.map])e?.dispose()},[t]),(0,P.useEffect)(()=>{let n=e.current;if(!n)return;let r=new ht;t.at.forEach((e,i)=>{n.setMatrixAt(i,r.makeTranslation(e.x,e.y,e.z)),n.setColorAt(i,t.colors[i])}),n.instanceMatrix.needsUpdate=!0,n.instanceColor&&(n.instanceColor.needsUpdate=!0)},[t]);let n=(0,P.useRef)(null);return A(()=>{let e=l();Math.abs(e-t.level)<.004||(t.level=e,t.bulbMat.color.lerpColors(mr,hr,e),t.haloMat.opacity=e*.65,n.current&&(n.current.visible=e>.02))}),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(`mesh`,{geometry:t.poles,material:T(`#3d405b`),castShadow:!0}),(0,I.jsx)(`lineSegments`,{geometry:t.wireGeo,material:t.wireMat}),(0,I.jsx)(`instancedMesh`,{ref:e,args:[t.bulbGeo,t.bulbMat,t.at.length]}),(0,I.jsx)(`points`,{ref:n,geometry:t.haloGeo,material:t.haloMat,visible:!1,renderOrder:2})]})}var yr=72,$=45,br=90*Math.tan(.0358)*1.25,xr=1.36,Sr={yaw:-.7,pitch:.08},Cr=`
2
2
  varying vec2 vUv;
3
3
  void main() {
4
4
  vUv = uv;