droidsembly 0.4.0-beta.5 → 0.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.it.md +18 -10
- package/README.md +18 -10
- package/bin/distribution.js +3 -1
- package/dist/assets/AccessibilitySettings-C_l9iRUv.js +32 -0
- package/dist/assets/{AccessibilitySettings-HrzBDUTN.css → AccessibilitySettings-DGcxiTfe.css} +1 -1
- package/dist/assets/{AppViewer-BB9lvg-4.js → AppViewer-BQO9JR1i.js} +2 -2
- package/dist/assets/{Balloon-CWEK5uK2.js → Balloon-DVvWn18l.js} +1 -1
- package/dist/assets/{Batched-yAiB-c-b.js → Batched-CQd1jTn0.js} +2 -2
- package/dist/assets/{Birds-ClBZkA83.js → Birds-DJ4dABbV.js} +1 -1
- package/dist/assets/{Blimp-VHMnVBQt.js → Blimp-BJbSmwgF.js} +1 -1
- package/dist/assets/{BufferGeometryUtils-B4Tnxtjb.js → BufferGeometryUtils-CT65PqMz.js} +1 -1
- package/dist/assets/{Duck-CCThHMtF.js → Duck-C5792fKA.js} +1 -1
- package/dist/assets/{Effects-BZfFy3yq.js → Effects-CaCXr9Js.js} +2 -2
- package/dist/assets/{Fireworks-CxvvEwV_.js → Fireworks-iRvidmKy.js} +2 -2
- package/dist/assets/{Helicopter-DXHDrTnQ.js → Helicopter-D8ZNTU4I.js} +1 -1
- package/dist/assets/{Hurricane-WXNUxoUz.js → Hurricane-CAadFYBC.js} +2 -2
- package/dist/assets/{Kaiju-D-wVgKo-.js → Kaiju-C3EuNULz.js} +1 -1
- package/dist/assets/{Meteors-DSr-7bEl.js → Meteors-CGWkPuVY.js} +1 -1
- package/dist/assets/{MissionConsole-4G02S89d.js → MissionConsole-DZ6wViYJ.js} +1 -1
- package/dist/assets/{Office-B_EroD2U.js → Office-Dmaf62nb.js} +44 -44
- package/dist/assets/{PhotoPanel-ByzwApow.js → PhotoPanel-vRV9SyW6.js} +1 -1
- package/dist/assets/PhotoScene-CCfT0_dM.js +115 -0
- package/dist/assets/{Plane-CT7-QFbA.js → Plane-LzwrJzTl.js} +1 -1
- package/dist/assets/Pocket-CUs_Akxq.js +2 -0
- package/dist/assets/{Rainbow-DNvXfTl9.js → Rainbow-Bh87z-Ca.js} +2 -2
- package/dist/assets/Roof-5bxB8sll.js +34 -0
- package/dist/assets/Shell-BurGbVOK.js +13 -0
- package/dist/assets/{Skywriting-N1GDZKYR.js → Skywriting-DUf57ebJ.js} +1 -1
- package/dist/assets/{TerminalView-cUAMhOxM.js → TerminalView-BXlSvVFj.js} +11 -11
- package/dist/assets/ToyWorld-DtorYOnh.js +1 -0
- package/dist/assets/{Ufo-D_Wt75n1.js → Ufo-CFUHx9XE.js} +1 -1
- package/dist/assets/{Whale-Kkz3B36R.js → Whale-DeSPwwK9.js} +1 -1
- package/dist/assets/{all-BMItClgN.js → all-DOGLvkPi.js} +2 -2
- package/dist/assets/{bloomMarks-C22qSi5d.js → bloomMarks-C54fx8hS.js} +2 -2
- package/dist/assets/{cheerRules-G9WFRB4C.js → cheerRules-Cirk-C1A.js} +1 -1
- package/dist/assets/{cityLayout-C8f5-bpM.js → cityLayout-Ckx8BPp6.js} +1 -1
- package/dist/assets/{dogState-9uong8D8.js → dogState-COomoDy2.js} +1 -1
- package/dist/assets/{doors-DsKuGpOi.js → doors-bUEcoX0a.js} +1 -1
- package/dist/assets/floorRows-TXmh_fs7.js +1 -0
- package/dist/assets/{gallery-DSKvNkBq.js → gallery-DRHdZni1.js} +1 -1
- package/dist/assets/gate-D2IhTYgP.js +2 -0
- package/dist/assets/index-BJhDZdUC.css +1 -0
- package/dist/assets/{index-rznd4Djx.js → index-Bm599iDL.js} +3 -3
- package/dist/assets/{instantReplay-CiWMru53.js → instantReplay-DyovaQ30.js} +1 -1
- package/dist/assets/{interact-Bt-XX-z4.js → interact-5KlEmqSj.js} +1 -1
- package/dist/assets/{kit-CZEafHnz.js → kit-0ivWfN5y.js} +2 -2
- package/dist/assets/{mic-DeYDrNoY.js → mic-BhkfhZh_.js} +1 -1
- package/dist/assets/{photoMode-BTxq9-gL.js → photoMode-DaRgDVK0.js} +1 -1
- package/dist/assets/{pipeline-DNe3sjnP.js → pipeline-Bpizl8Xd.js} +50 -50
- package/dist/assets/{rapier-C-KFR0AR.js → rapier-BPbvA-KY.js} +1 -1
- package/dist/assets/rig-CrQ96zZT.js +1 -0
- package/dist/assets/{speechLanguage-Bq3BAswq.js → speechLanguage-DB5z7y_C.js} +1 -1
- package/dist/assets/store-D17hJxYS.js +5 -0
- package/dist/assets/{useDayTime-Nrdy7kH1.js → useDayTime-kseMHOa9.js} +1 -1
- package/dist/assets/{useGraphics-Bhnj8CAm.js → useGraphics-CJhpDhqZ.js} +1 -1
- package/dist/assets/{voiceMessages-BF3P4sjw.js → voiceMessages-DxK9WeCn.js} +1 -1
- package/dist/assets/{weatherState-CufaxiyU.js → weatherState-DighRn7p.js} +1 -1
- package/dist/index.html +3 -3
- package/dist-server/index.js +1824 -664
- package/dist-server/index.js.map +4 -4
- package/dist-server/skills/ceo-app-starter.md +53 -0
- package/docs/app-starter-provenance.md +25 -0
- package/docs/app-starter.md +107 -0
- package/package.json +6 -4
- package/dist/assets/AccessibilitySettings-vd4x_sEq.js +0 -30
- package/dist/assets/PhotoScene-CW3yZkqH.js +0 -115
- package/dist/assets/Pocket-B0o4siMl.js +0 -2
- package/dist/assets/Roof-yLX0ZK0x.js +0 -34
- package/dist/assets/Shell-lZOZ3aG8.js +0 -13
- package/dist/assets/ToyWorld-BYE8776A.js +0 -1
- package/dist/assets/gate-D6_NXB1w.js +0 -2
- package/dist/assets/index-COpmc42S.css +0 -1
- package/dist/assets/rig-B88WinIa.js +0 -1
- package/dist/assets/store-9CvxLGNQ.js +0 -5
|
@@ -1 +1 @@
|
|
|
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
|
+
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-D17hJxYS.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-DaRgDVK0.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-DRHdZni1.js";import{c as A,u as j}from"./gate-D2IhTYgP.js";import{s as M}from"./useDayTime-kseMHOa9.js";import{O as N,k as P}from"./AccessibilitySettings-C_l9iRUv.js";import{o as F,s as I}from"./index-Bm599iDL.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)(N,{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)(N,{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)(P,{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)(N,{action:`run`}),` `,(0,R.jsx)(F,{children:`faster`}),` · `,(0,R.jsx)(N,{action:`rotateLeft`}),`/`,(0,R.jsx)(N,{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};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pipeline-Bpizl8Xd.js","assets/bloomMarks-C54fx8hS.js","assets/rolldown-runtime-XKyaHtl9.js","assets/jsx-runtime-CZP6s5wa.js","assets/index-Bm599iDL.js","assets/store-D17hJxYS.js","assets/index-BJhDZdUC.css","assets/useDayTime-kseMHOa9.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{$ as n,Dt as r,Gt as i,Ht as a,L as o,Ot as s,St as c,U as l,Ut as u,at as d,bt as f,dt as p,f as m,g as h,gt as g,k as _,mt as ee,pt as v,st as y,yt as te}from"./bloomMarks-C54fx8hS.js";import{G as b,H as x,k as S}from"./mic-BhkfhZh_.js";import{l as C,t as w}from"./useGraphics-CJhpDhqZ.js";import{Ra as T,en as E,m as D,wa as O}from"./store-D17hJxYS.js";import{Ar as ne,Mr as re,Or as ie,jr as ae,kr as oe}from"./Office-Dmaf62nb.js";import{r as se}from"./useDayTime-kseMHOa9.js";import{a as ce,activeClip as k,c as A,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-DaRgDVK0.js";import{u as J}from"./gate-D2IhTYgP.js";import{_ as fe,d as pe,f as me,p as he}from"./gallery-DRHdZni1.js";var Y=e(t(),1),X=.014,Z=`
|
|
3
|
+
varying vec2 vUv;
|
|
4
|
+
void main() {
|
|
5
|
+
vUv = uv;
|
|
6
|
+
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
7
|
+
}`,ge=`
|
|
8
|
+
#include <packing>
|
|
9
|
+
uniform sampler2D tColor;
|
|
10
|
+
uniform sampler2D tDepth;
|
|
11
|
+
uniform vec2 uSize;
|
|
12
|
+
uniform vec2 uOrigin;
|
|
13
|
+
uniform vec2 uFull;
|
|
14
|
+
uniform float uPx;
|
|
15
|
+
uniform float uSeed;
|
|
16
|
+
uniform float uDof;
|
|
17
|
+
uniform float uFocus;
|
|
18
|
+
uniform float uBlur;
|
|
19
|
+
uniform float uNear;
|
|
20
|
+
uniform float uFar;
|
|
21
|
+
uniform float uSaturation;
|
|
22
|
+
uniform float uContrast;
|
|
23
|
+
uniform vec3 uGain;
|
|
24
|
+
uniform vec3 uLift;
|
|
25
|
+
uniform float uVignette;
|
|
26
|
+
uniform float uGrain;
|
|
27
|
+
uniform float uPosterize;
|
|
28
|
+
uniform float uInk;
|
|
29
|
+
varying vec2 vUv;
|
|
30
|
+
|
|
31
|
+
float distanceAt(vec2 uv) {
|
|
32
|
+
float d = unpackRGBAToDepth(texture2D(tDepth, uv));
|
|
33
|
+
return -perspectiveDepthToViewZ(d, uNear, uFar);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// How blurred a point at this distance is, 0..1 (thin-lens-like: grows with distance from the focus plane).
|
|
37
|
+
float coc(float dist) {
|
|
38
|
+
return clamp(abs(dist - uFocus) / max(dist, 0.05) * 1.6, 0.0, 1.0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
float luma(vec3 c) { return dot(c, vec3(0.2126, 0.7152, 0.0722)); }
|
|
42
|
+
|
|
43
|
+
// Flat bands of light and shade, as printed: the brightness is stepped, the hue kept (stepping each channel
|
|
44
|
+
// would turn smooth lighting into stripes of other colours), and each step is softened a little so faint noise in
|
|
45
|
+
// the lighting doesn't turn into ragged edges.
|
|
46
|
+
vec3 posterize(vec3 c) {
|
|
47
|
+
if (uPosterize < 2.0) return c;
|
|
48
|
+
float y = luma(c) * uPosterize;
|
|
49
|
+
float stepped = (floor(y) + smoothstep(0.3, 0.7, fract(y))) / uPosterize;
|
|
50
|
+
return c * (stepped / max(luma(c), 0.004));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
float hash(vec2 p) {
|
|
54
|
+
p = fract(p * vec2(123.34, 456.21));
|
|
55
|
+
p += dot(p, p + 45.32 + uSeed);
|
|
56
|
+
return fract(p.x * p.y);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void main() {
|
|
60
|
+
vec3 c = texture2D(tColor, vUv).rgb;
|
|
61
|
+
|
|
62
|
+
if (uDof > 0.5) {
|
|
63
|
+
// Gathering what spills onto this pixel: each sample reaches as far as its own blur, and one behind this pixel
|
|
64
|
+
// only as far as this pixel is blurred itself (a sharp face keeps its edge against a soft background).
|
|
65
|
+
float d0 = distanceAt(vUv);
|
|
66
|
+
float r0 = coc(d0) * uBlur;
|
|
67
|
+
vec3 sum = c;
|
|
68
|
+
float total = 1.0;
|
|
69
|
+
for (int i = 1; i < 32; i++) {
|
|
70
|
+
float rs = sqrt(float(i) / 31.0) * uBlur;
|
|
71
|
+
float a = float(i) * 2.39996;
|
|
72
|
+
vec2 uv = vUv + vec2(cos(a), sin(a)) * rs / uSize;
|
|
73
|
+
float d = distanceAt(uv);
|
|
74
|
+
float r = coc(d) * uBlur;
|
|
75
|
+
float reach = d > d0 ? min(r, r0) : r;
|
|
76
|
+
float w = clamp(reach - rs + 1.0, 0.0, 1.0);
|
|
77
|
+
sum += texture2D(tColor, uv).rgb * w;
|
|
78
|
+
total += w;
|
|
79
|
+
}
|
|
80
|
+
c = sum / total;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (uInk > 0.0) {
|
|
84
|
+
vec2 s = vec2(max(1.0, uPx)) / uSize;
|
|
85
|
+
float tl = luma(texture2D(tColor, vUv + vec2(-s.x, s.y)).rgb);
|
|
86
|
+
float t = luma(texture2D(tColor, vUv + vec2(0.0, s.y)).rgb);
|
|
87
|
+
float tr = luma(texture2D(tColor, vUv + vec2(s.x, s.y)).rgb);
|
|
88
|
+
float l = luma(texture2D(tColor, vUv + vec2(-s.x, 0.0)).rgb);
|
|
89
|
+
float r = luma(texture2D(tColor, vUv + vec2(s.x, 0.0)).rgb);
|
|
90
|
+
float bl = luma(texture2D(tColor, vUv + vec2(-s.x, -s.y)).rgb);
|
|
91
|
+
float b = luma(texture2D(tColor, vUv + vec2(0.0, -s.y)).rgb);
|
|
92
|
+
float br = luma(texture2D(tColor, vUv + vec2(s.x, -s.y)).rgb);
|
|
93
|
+
float gx = -tl - 2.0 * l - bl + tr + 2.0 * r + br;
|
|
94
|
+
float gy = -tl - 2.0 * t - tr + bl + 2.0 * b + br;
|
|
95
|
+
float edge = smoothstep(0.18, 0.5, length(vec2(gx, gy)));
|
|
96
|
+
c = posterize(c);
|
|
97
|
+
c = mix(c, vec3(0.06, 0.05, 0.08), edge * uInk);
|
|
98
|
+
} else {
|
|
99
|
+
c = posterize(c);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
float y = luma(c);
|
|
103
|
+
c = mix(vec3(y), c, uSaturation);
|
|
104
|
+
c = (c - 0.5) * uContrast + 0.5;
|
|
105
|
+
c = c * uGain + uLift;
|
|
106
|
+
|
|
107
|
+
vec2 full = uOrigin + gl_FragCoord.xy;
|
|
108
|
+
if (uVignette > 0.0) {
|
|
109
|
+
vec2 p = (full / uFull - 0.5) * vec2(uFull.x / uFull.y, 1.0);
|
|
110
|
+
c *= 1.0 - uVignette * smoothstep(0.35, 1.05, length(p));
|
|
111
|
+
}
|
|
112
|
+
if (uGrain > 0.0) c += (hash(floor(full / max(1.0, uPx * 0.75))) - 0.5) * uGrain;
|
|
113
|
+
|
|
114
|
+
gl_FragColor = vec4(clamp(c, 0.0, 1.0), 1.0);
|
|
115
|
+
}`,_e=class{gl;color=null;depth=new i(1,1,{minFilter:p,magFilter:p,depthBuffer:!0});depthMaterial=new y({depthPacking:f});material;quad;quadScene=new r;quadCamera=new v(-1,1,1,-1,0,1);size=new a;clear=new _;shown=[];supported=!0;constructor(e){this.gl=e,this.depthMaterial.blending=0,this.material=new s({vertexShader:Z,fragmentShader:ge,depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{tColor:{value:null},tDepth:{value:this.depth.texture},uSize:{value:new a(1,1)},uOrigin:{value:new a},uFull:{value:new a(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 u(1,1,1)},uLift:{value:new u},uVignette:{value:0},uGrain:{value:0},uPosterize:{value:0},uInk:{value:0}}}),this.quad=new d(new g(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,r,i,a){let o=this.gl;if(o.setRenderTarget(null),r)r.render(i);else{let n=o.autoClear;o.autoClear=!0,o.render(e,t),o.autoClear=n}if(!this.supported||!a.dof&&!z(a.grade))return;o.getDrawingBufferSize(this.size);let s=this.size.x,c=this.size.y;this.color&&this.color.image.width===s&&this.color.image.height===c||(this.color?.dispose(),this.color=new l(s,c),this.color.minFilter=n,this.color.magFilter=n);try{o.copyFramebufferToTexture(this.color)}catch{this.supported=!1;return}let u=this.material.uniforms;a.dof&&((this.depth.width!==s||this.depth.height!==c)&&this.depth.setSize(s,c),this.depthPass(e,t,a.seeThrough)),u.tColor.value=this.color,u.uSize.value.set(s,c),u.uOrigin.value.set(a.origin[0],a.origin[1]),u.uFull.value.set(a.full[0],a.full[1]),u.uPx.value=a.px,u.uSeed.value=a.seed,u.uDof.value=+!!a.dof,u.uFocus.value=a.dof?.focus??5,u.uBlur.value=a.dof?a.dof.blur*X*a.full[1]:0,u.uNear.value=t.near,u.uFar.value=t.far;let d=a.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,o.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(T.x,T.y,T.z);else if(e===`board`)t.set(0,O.y+O.h/2,O.z);else if(e.startsWith(`person:`)){let n=E(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=h(e=>e.gl),t=h(e=>e.scene),n=h(e=>e.camera),r=h(e=>e.size),i=h(e=>e.get),s=J(e=>e.frozen),l=(0,Y.useMemo)(()=>new ee(n.fov,1,n.near,n.far),[n]),d=(0,Y.useMemo)(()=>new _e(e),[e]);(0,Y.useEffect)(()=>()=>d.dispose(),[d]);let f=C(w),[p,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 u,facing:[],firstPerson:[],seeThrough:[],hidden:[],fogBack:0,scanAt:-1/0,frames:0,seed:0,q:new te,buf:new a,ray:new c,center:new a,unlockedAt:-1/0,lookFilter:oe(),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,r.width),_.height=Math.max(1,r.height),p?.setSize(_.width,_.height),V()},[_,r,p]),(0,Y.useEffect)(()=>{if(f===`low`)return;let n=!0,r=null;return D(async()=>{let{createPipeline:e}=await import(`./pipeline-Bpizl8Xd.js`);return{createPipeline:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({createPipeline:i})=>{if(n)try{r=i(e,t,l,f),r.setSize(_.width,_.height),_.pipe=r,g(r),V()}catch{}}),()=>{n=!1,_.pipe=null,r?.dispose(),g(null)}},[e,t,l,_,f]),(0,Y.useLayoutEffect)(()=>{let e=new o().setFromQuaternion(n.quaternion,`YXZ`);Object.assign(j,ce(n.position.x,n.position.y,n.position.z,e.y,e.x,n.fov)),V()},[n]);let{prepare:v,putBack:y,frame:T}=(0,Y.useMemo)(()=>{let r=()=>{_.facing.length=0,_.firstPerson.length=0,_.seeThrough.length=0,t.traverse(_.visit),_.scanAt=_.frames},i=()=>{l.position.set(j.x,j.y,j.z),l.rotation.set(j.pitch,j.yaw,j.roll,`YXZ`);let e=_.width/_.height;(l.fov!==j.fov||l.aspect!==e)&&(l.fov=j.fov,l.aspect=e,l.updateProjectionMatrix()),l.updateMatrixWorld(),_.frames-_.scanAt>30&&r();for(let e=0;e<_.facing.length;e++){let t=_.facing[e];t.parent&&(t.parent.getWorldQuaternion(_.q),t.quaternion.copy(l.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 i=t.fog;_.fogBack=i?.isFog?l.position.distanceTo(n.position):0,i&&_.fogBack&&(i.near+=_.fogBack,i.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=()=>{i(),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,d.render(t,l,_.pipe,_.delta,n),a(),k()?.draw(),_.frames++};return{prepare:i,putBack:a,frame:(e,t)=>{_.delta=e;let n=_.keys,r=_.input,i=S();r.forward=+!!x(i,`forward`,n)-!!x(i,`back`,n),r.right=+!!x(i,`right`,n)-!!x(i,`left`,n),r.up=+!!n.has(Q)-!!n.has($),r.roll=+!!x(i,`rotateRight`,n)-!!x(i,`rotateLeft`,n),r.fast=x(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),A(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=k()!==null;c&&(_.seed=(_.seed+.618)%64),(le()||s||t||c)&&o()}}},[e,t,l,n,d,_]);return(0,Y.useEffect)(()=>{if(!s)return;let e=0,t=performance.now(),n=r=>{T(Math.min(.1,Math.max(0,(r-t)/1e3)),!1),t=r,e=requestAnimationFrame(n)};return V(),e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[s,T]),m((e,t)=>{J.getState().frozen||T(Math.min(t,.1),!0)},1),(0,Y.useEffect)(()=>q.subscribe((e,t)=>{e.daytime!==t.daytime&&J.getState().frozen&&se(i()),V()}),[i]),(0,Y.useEffect)(()=>{let t=e.domElement,r=_.keys,i=e=>{let t=ye(e);if(t===`text`||e.ctrlKey||e.metaKey||e.altKey)return;let i=e.code;if(i===`Escape`){!document.pointerLockElement&&performance.now()-_.unlockedAt>400&&I();return}let a=S();if(i===Q||i===$||ve.some(e=>b(a,e,i))){if(t===`control`&&(i.startsWith(`Arrow`)||i===Q))return;e.preventDefault(),r.add(i)}else if(!e.repeat){if(i===`Enter`&&t===`view`)ue();else if(i===`KeyF`)W(!J.getState().frozen);else if(i===`KeyH`)K({panel:!q.getState().panel});else if(i===`KeyT`)N();else if(i===`KeyV`)de();else if(i===`KeyR`)j.roll=0,j.fov=n.fov,V();else return;e.preventDefault()}},a=e=>void r.delete(e.code),o=()=>r.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=ne(_.lookFilter,e.movementX,e.movementY,e.timeStamp);if(!n)return;let{sensitivity:r,invertY:i}=re.getState(),a=ie*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=()=>{ae(_.lookFilter),document.pointerLockElement||(_.unlockedAt=performance.now())};return window.addEventListener(`keydown`,i),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`,i),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,_,n]),(0,Y.useEffect)(()=>(U({frames:()=>_.frames,focusCenter(){v(),y(),_.ray.setFromCamera(_.center,l);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 c=_.buf.x,u=_.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?d.margin(f):0,_.pipe?Math.round(Math.min(c,u)*.08):0);for(let n of me(r,i,c,u,m))l.setViewOffset(r,i,n.viewX,n.viewY,c,u),f.origin[0]=n.viewX,f.origin[1]=i-(n.viewY+u),d.render(t,l,_.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);l.clearViewOffset(),l.aspect=_.width/_.height,l.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,l,d,_,v,y]),null}export{we as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{Ut as r,f as i,it as a,yt as o}from"./bloomMarks-C54fx8hS.js";import{n as s,r as c}from"./Office-Dmaf62nb.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-0ivWfN5y.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 a,q:new o,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-BXlSvVFj.js","assets/rolldown-runtime-XKyaHtl9.js","assets/jsx-runtime-CZP6s5wa.js","assets/index-Bm599iDL.js","assets/store-D17hJxYS.js","assets/index-BJhDZdUC.css","assets/AccessibilitySettings-C_l9iRUv.js","assets/mic-BhkfhZh_.js","assets/jukeboxSongs-CUwHJ1cS.js","assets/floorRows-TXmh_fs7.js","assets/AccessibilitySettings-DGcxiTfe.css","assets/bloomMarks-C54fx8hS.js","assets/BufferGeometryUtils-CT65PqMz.js","assets/Batched-CQd1jTn0.js","assets/rig-CrQ96zZT.js","assets/TerminalView-BrP-ENHg.css","assets/AppViewer-BQO9JR1i.js","assets/MissionConsole-DZ6wViYJ.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-Bm599iDL.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-D17hJxYS.js";import{A as y,N as b,a as x,c as S,f as C,g as w,i as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M,y as N}from"./AccessibilitySettings-C_l9iRUv.js";import{r as P,t as F}from"./floorRows-TXmh_fs7.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=A(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)(N,{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)(``),[S,C]=(0,I.useState)(!1),[w,D]=(0,I.useState)(``),O=E(e),k=T(p),A=k.find(e=>e.key===_),j=e.status===`working`||e.status===`preparing`,M=P(e,o),N=async()=>{let t=w.trim();t&&await h(()=>a.message(e.id,t))&&(D(``),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:F(e,o,d)}),(0,L.jsxs)(`div`,{className:`small pk-ellipsis`,children:[x(e,o.language),j&&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&&!j&&(0,L.jsxs)(`div`,{className:`term-error small pk-error`,children:[`⚠️ `,e.lastError]}),M&&(0,L.jsxs)(`div`,{className:`small pk-sign-in`,children:[`🔑 `,n(`Waiting for you to sign {provider} in, in their terminal`,{provider:M}),`.`]}),(0,L.jsxs)(`div`,{className:`pk-actions`,children:[M&&(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`})}),O.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`})}),O.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||k.length===0,children:[(0,L.jsx)(`option`,{value:``,children:n(k.length?`Pick an issue or a PR…`:`Nothing to pick up`)}),k.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||!A,onClick:()=>A&&void h(()=>A.kind===`qa`?a.sendToQa(t.id,A.number,e.id):a.assign(e.id,A.number)).then(e=>e&&y(``)),children:n(A?.kind===`qa`?`🔍 Test`:`▶ Start`)})]}),O.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`})}),O.message&&(0,L.jsx)(`button`,{className:`btn btn-small ${S?`btn-ghost`:``}`,"aria-expanded":S,onClick:()=>C(!S),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`})})]}),S&&O.message&&(0,L.jsxs)(`form`,{className:`pk-msg`,onSubmit:e=>{e.preventDefault(),N()},children:[(0,L.jsx)(b,{value:w,onChange:D,autoFocus:!0,"aria-label":n(`Message {name}`,{name:e.name}),placeholder:n(j?`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-BXlSvVFj.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,15]))),q=(0,I.lazy)(()=>m(()=>import(`./AppViewer-BQO9JR1i.js`).then(e=>e.n).then(e=>({default:e.AppViewer})),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10]))),J=(0,I.lazy)(()=>m(()=>import(`./MissionConsole-DZ6wViYJ.js`).then(e=>e.t).then(e=>({default:e.UsageCard})),__vite__mapDeps([17,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:D(u(e,t,i))}}),[n,r,i]),m=k(A(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)(M,{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)(y,{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)(O,{}),(0,L.jsx)(S,{}),(0,L.jsx)(j,{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=>k(A(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)(C,{}),(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)(w,{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{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{Ot as r,Tt as i,at as a,f as o}from"./bloomMarks-C54fx8hS.js";import{i as s,r as c}from"./Office-Dmaf62nb.js";import{a as l}from"./director-CrzFgnoP.js";import{i as u,o as d}from"./kit-0ivWfN5y.js";var f=e(t(),1),p=n(),m=`
|
|
2
2
|
varying vec2 vP;
|
|
3
3
|
void main() {
|
|
4
4
|
vP = position.xy;
|
|
@@ -25,4 +25,4 @@ void main() {
|
|
|
25
25
|
// its feet fade into the haze
|
|
26
26
|
float feet = smoothstep(5.0, 70.0, vP.y);
|
|
27
27
|
gl_FragColor = vec4(band(k), 0.5 * edge * feet * uFade);
|
|
28
|
-
}`;function g({run:e,elevation:t}){let n=d(e.side),g=(0,f.useMemo)(()=>{let t=l(e.seed),
|
|
28
|
+
}`;function g({run:e,elevation:t}){let n=d(e.side),g=(0,f.useMemo)(()=>{let t=l(e.seed),o=160+t()*30,s=o-16,c=new i(s,o,128,1,0,Math.PI),u=new r({vertexShader:m,fragmentShader:h,transparent:!0,depthWrite:!1,side:2,uniforms:{uInner:{value:s},uOuter:{value:o},uFade:{value:0}}}),d=new a(c,u);return d.position.set(n*(340+t()*40),-8,(t()-.5)*80),d.rotation.y=-n*Math.PI/2,d.renderOrder=2,d.frustumCulled=!1,{geo:c,mat:u,mesh:d,chimed:!1}},[e.seed,n]);return(0,f.useEffect)(()=>()=>{g.geo.dispose(),g.mat.dispose()},[g]),o(()=>{let n=e.t;if(g.mat.uniforms.uFade.value=u(n,e.seconds,9),!g.chimed&&n>1.5){g.chimed=!0;let e=c(g.mesh.position.x,60-t,g.mesh.position.z,400);s(`chime`,{gain:Math.max(.5,e.gain),pan:e.pan})}}),(0,p.jsx)(`primitive`,{object:g.mesh})}export{g as default};
|
|
@@ -0,0 +1,34 @@
|
|
|
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-BurGbVOK.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-D17hJxYS.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-Dmaf62nb.js";import{n as Le,r as Re}from"./interact-5KlEmqSj.js";import{o as ze}from"./cityLayout-Ckx8BPp6.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-kseMHOa9.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-Cirk-C1A.js";import{a as w}from"./Batched-CQd1jTn0.js";import{B as nt,U as T}from"./rig-CrQ96zZT.js";import{A as rt,B as E,Et as it,Ft as at,Mt as D,O as ot,Ot as st,Q as ct,S as O,T as lt,Ut as k,f as A,g as ut,gt as dt,it as ft,j,k as M,ot as pt,ut as N,vt as mt,w as ht,wt as gt,yt as _t}from"./bloomMarks-C54fx8hS.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 dt(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 O(C.w+.4,C.h+.4,.15),0,0,0)),t.push(i(new O(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 O(.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 pt({map:o,fog:!1,toneMapped:!1,polygonOffset:!0,polygonOffsetFactor:-2}),frame:new pt({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 lt(o),a.colorSpace=it,a.anisotropy=8,i&&(a.wrapS=a.wrapT=gt),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 k(...e),i=new k(...t).clone().sub(r),a=new O(n,n,i.length());return a.applyQuaternion(new _t().setFromUnitVectors(new k(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 ht,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 E(i,3)),r.setAttribute(`uv`,new E([0,0,1,0,0,1,1,1],2)),r.setAttribute(`color`,new E(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 M(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 j(e.r,e.r,.05,20).translate(e.x,.55,e.z),new j(.04,.05,.53,8).translate(e.x,.27,e.z),new j(.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 N({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 D(.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 j(.015,.015,1.1,5).translate(t,h+.55,n)),i.push(new D(.28,10,8).scale(1,1.35,1).translate(t,h+.5,n));for(let r=0;r<4;r++)a.push(new D(.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 j(.025,.03,a,6).translate(t,h+a/2,n+.2)),r.push(new D(.12,8,6).scale(1.6,.4,1).translate(t+.08,h+a*.5,n+.2)),s.push(new j(.24,.24,.04,14).rotateX(Math.PI/2).translate(t,h+a,n+.18)),l.push(new j(.11,.11,.06,12).rotateX(Math.PI/2).translate(t,h+a,n+.21)),i.push(new rt(.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 j(.07,.1,1.5,8).translate(e.x,e.h+.75,e.z)),i.push(new D(.75,14,10).translate(e.x,e.h+1.75,e.z)),r.push(new D(.5,12,8).translate(e.x+.45,e.h+1.45,e.z+.2)),r.push(new D(.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 j(n,n*1.04,i,24).translate(e,r+i/2,t),u=c([.25,.55,.85].map(a=>new at(n*1.03+.02,.035,6,32).rotateX(Math.PI/2).translate(e,r+i*a,t))),d=new rt(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 M(`#e9a0a0`),En=new M(`#b5532c`),Dn=new M(`#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 D(p.r,24,12,0,Math.PI*2,Math.PI/2,Math.PI/2),lid:new D(p.r*1.02,24,12,0,Math.PI*2,0,Math.PI/2),coals:new ot(p.r*.85,24).rotateX(-Math.PI/2),puff:new D(.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 N({color:Tn.clone()}),coals:new pt({color:`#ff6b2c`,toneMapped:!1}),smoke:new pt({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 ft,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 dt(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 O(.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 D(.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 j(.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 N({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 O(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 ot(_.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 N({map:Kt()}),decking:new N({map:qt()}),helipad:new N({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=ut(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 M(`#bdb6a6`),hr=new M(`#ffffff`);function gr(e,t,n,r){return Array.from({length:n+1},(i,a)=>{let o=a/n;return new k(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 lt(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 ht;n.setAttribute(`position`,new E(e,3));let r=t.map((e,t)=>new M(pr[t%pr.length])),i=new ht;return i.setAttribute(`position`,new E(t.flatMap(e=>[e.x,e.y,e.z]),3)),i.setAttribute(`color`,new E(r.flatMap(e=>[e.r,e.g,e.b]),3)),{at:t,colors:r,wireGeo:n,haloGeo:i,poles:c(le.flatMap(e=>[new j(d.r,d.r*1.3,d.h,8).translate(e.x,d.h/2,e.z),new D(d.r*1.6,8,6).translate(e.x,d.h,e.z)])),bulbGeo:new D(.055,10,8).scale(1,1.3,1),bulbMat:new pt({color:mr.clone(),toneMapped:!1}),wireMat:new ct({color:`#2b2d42`}),haloMat:new mt({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 ft;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
|
+
varying vec2 vUv;
|
|
3
|
+
void main() {
|
|
4
|
+
vUv = uv;
|
|
5
|
+
vec4 p = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
6
|
+
gl_Position = p.xyww;
|
|
7
|
+
}`,wr=`
|
|
8
|
+
uniform sampler2D map;
|
|
9
|
+
uniform vec3 color;
|
|
10
|
+
uniform float opacity;
|
|
11
|
+
uniform bool textured;
|
|
12
|
+
varying vec2 vUv;
|
|
13
|
+
void main() {
|
|
14
|
+
vec4 t = textured ? texture2D(map, vUv) : vec4(1.0);
|
|
15
|
+
gl_FragColor = vec4(color * t.rgb, t.a * opacity);
|
|
16
|
+
#include <colorspace_fragment>
|
|
17
|
+
}`,Tr=`
|
|
18
|
+
attribute float aSize;
|
|
19
|
+
uniform float uPixel;
|
|
20
|
+
uniform float uOpacity;
|
|
21
|
+
varying float vAlpha;
|
|
22
|
+
void main() {
|
|
23
|
+
vAlpha = uOpacity * smoothstep(0.0, 0.08, normalize(mat3(modelMatrix) * position).y);
|
|
24
|
+
vec4 p = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
25
|
+
gl_Position = p.xyww;
|
|
26
|
+
gl_PointSize = aSize * uPixel;
|
|
27
|
+
}`,Er=`
|
|
28
|
+
varying float vAlpha;
|
|
29
|
+
void main() {
|
|
30
|
+
float r = length(gl_PointCoord - 0.5);
|
|
31
|
+
float a = max(1.0 - smoothstep(0.1, 0.2, r), (1.0 - smoothstep(0.0, 0.5, r)) * 0.4);
|
|
32
|
+
gl_FragColor = vec4(1.0, 0.97, 0.88, vAlpha * a);
|
|
33
|
+
#include <colorspace_fragment>
|
|
34
|
+
}`;function Dr(e,t,n){return new st({vertexShader:Cr,fragmentShader:wr,uniforms:{map:{value:e},color:{value:new M(t)},opacity:{value:n},textured:{value:!!e}},transparent:!0,depthWrite:!1})}function Or(e,t,n){let r=document.createElement(`canvas`);r.width=e,r.height=t,n(r.getContext(`2d`));let i=new lt(r);return i.colorSpace=it,i.anisotropy=4,i}function kr(){return Or(512,512,e=>{let t=5,n=()=>((t=t*16807%2147483647)-1)/2147483646,r=e.createRadialGradient(256,256,184.5,256,256,256);r.addColorStop(0,`rgba(190,205,255,0.25)`),r.addColorStop(1,`rgba(190,205,255,0)`),e.fillStyle=r,e.fillRect(0,0,512,512);let i=e.createRadialGradient(216,216,10,256,256,205);i.addColorStop(0,`#fbf6e6`),i.addColorStop(.8,`#e9e0c6`),i.addColorStop(1,`#c9bfa4`),e.fillStyle=i,e.beginPath(),e.arc(256,256,205,0,Math.PI*2),e.fill(),e.save(),e.clip();let a=[[-60,-70,70,50,.3],[10,-95,55,40,-.2],[60,-40,60,45,.5],[-95,10,45,75,.2],[-30,25,65,45,-.4],[40,40,40,30,.1],[-120,-40,35,30,0]];e.fillStyle=`rgba(150,143,125,0.55)`;for(let[t,n,r,i,o]of a)e.beginPath(),e.ellipse(256+t,256+n,r,i,o,0,Math.PI*2),e.fill();for(let t=0;t<46;t++){let t=n()*Math.PI*2,r=Math.sqrt(n())*205*.92,i=256+Math.cos(t)*r,a=256+Math.sin(t)*r,o=3+n()**2*18;e.fillStyle=`rgba(120,112,96,0.45)`,e.beginPath(),e.arc(i,a,o,0,Math.PI*2),e.fill(),e.strokeStyle=`rgba(255,252,240,0.7)`,e.lineWidth=Math.max(1,o*.22),e.beginPath(),e.arc(i,a,o,Math.PI*.6,Math.PI*1.6),e.stroke()}e.strokeStyle=`rgba(255,255,250,0.22)`,e.lineWidth=3;for(let t=0;t<14;t++){let r=t/14*Math.PI*2+n()*.2;e.beginPath(),e.moveTo(231,391),e.lineTo(231+Math.cos(r)*(80+n()*120),391+Math.sin(r)*(80+n()*120)),e.stroke()}e.fillStyle=`#fffdf5`,e.beginPath(),e.arc(231,391,9,0,Math.PI*2),e.fill(),e.restore()})}function Ar(e){return Or(512,96,t=>{t.font=`600 44px ${be}`,t.textAlign=`center`,t.textBaseline=`middle`,t.lineWidth=8,t.strokeStyle=`rgba(8,12,40,0.85)`,t.strokeText(e,256,48),t.fillStyle=`#d7e3ff`,t.fillText(e,256,48)})}function jr({visible:e}){let t=(0,P.useRef)(null),n=(0,P.useRef)(null),r=(0,P.useRef)(null),i=(0,P.useMemo)(()=>{let e=Fe(700),t=It(),n=t=>new k(e.positions[t*3],e.positions[t*3+1],e.positions[t*3+2]),r=new ht;r.setAttribute(`position`,new E(t.flatMap(e=>e.lines.flatMap(([e,t])=>[...n(e).multiplyScalar($).toArray(),...n(t).multiplyScalar($).toArray()])),3));let i=t.map(e=>{let t=Ar(e.name),n=new k(...e.centre).multiplyScalar($);return{name:e.name,at:n,tex:t,mat:Dr(t,`#ffffff`,.9)}}),a=new k(...Ct()),o=new Set(t.flatMap(e=>e.stars)),s=new ht;return s.setAttribute(`position`,new E(Array.from(e.positions,e=>e*$),3)),s.setAttribute(`aSize`,new E(Array.from(e.sizes,(e,t)=>o.has(t)?6+e*1.5:e*2.6),1)),{figures:t,starGeo:s,starMat:new st({vertexShader:Tr,fragmentShader:Er,uniforms:{uPixel:{value:1},uOpacity:{value:0}},transparent:!0,depthWrite:!1}),lines:r,lineMat:Dr(null,`#9fc3ff`,.6),labels:i,labelGeo:new dt(3.6,.68),moonGeo:new dt(br,br),moonMat:Dr(kr(),`#ffffff`,1),axis:a,q:new _t,back:new _t}},[]);(0,P.useEffect)(()=>()=>{for(let e of[i.lines,i.lineMat,i.starGeo,i.starMat,i.labelGeo,i.moonGeo,i.moonMat,i.moonMat.uniforms.map.value])e.dispose();for(let e of i.labels)e.tex.dispose(),e.mat.dispose()},[i]);let a=(0,P.useRef)([]);return A(({camera:o,gl:s})=>{let c=t.current;if(!c)return;let l=Ue.t,u=We(l);if(c.visible=e.current&&u>.3,!c.visible)return;c.position.copy(o.position),i.q.setFromAxisAngle(i.axis,wt(l)),n.current?.quaternion.copy(i.q),i.back.copy(i.q).invert();let d=Math.min(1,(u-.3)/.4);i.lineMat.uniforms.opacity.value=.6*d,i.starMat.uniforms.uOpacity.value=d,i.starMat.uniforms.uPixel.value=s.getPixelRatio();for(let[e,t]of i.labels.entries()){let n=a.current[e];n&&(t.mat.uniforms.opacity.value=.9*d,n.quaternion.copy(i.back).multiply(o.quaternion))}let[f,p,m]=Et(l),h=r.current;h&&(h.visible=p>-.03,h.position.set(f*$,p*$,m*$),h.quaternion.copy(o.quaternion),i.moonMat.uniforms.opacity.value=d)}),(0,I.jsxs)(`group`,{ref:t,visible:!1,children:[(0,I.jsx)(`mesh`,{ref:r,geometry:i.moonGeo,material:i.moonMat,frustumCulled:!1,renderOrder:1001}),(0,I.jsxs)(`group`,{ref:n,children:[(0,I.jsx)(`points`,{geometry:i.starGeo,material:i.starMat,frustumCulled:!1,renderOrder:1001}),(0,I.jsx)(`lineSegments`,{geometry:i.lines,material:i.lineMat,frustumCulled:!1,renderOrder:1001}),i.labels.map((e,t)=>(0,I.jsx)(`mesh`,{ref:e=>void(a.current[t]=e),position:e.at,geometry:i.labelGeo,material:e.mat,frustumCulled:!1,renderOrder:1002},e.name))]})]})}function Mr(){let e=ut(e=>e.camera),t=(0,P.useRef)(null),n=(0,P.useMemo)(()=>({...Sr}),[]),r=(0,P.useRef)(!1),i=Re({id:`telescope`,label:`Look through the telescope`,action:{kind:`roof`,op:`telescope`}},3),a=()=>{r.current||(ke({id:`telescope`,x:v.x,y:v.eye,z:v.z,tilt:0,look:.9/S.getState().zoom,minPitch:-.5,maxPitch:1.45,exit:{x:v.x,z:v.z+1.05},yaw:n.yaw,pitch:n.pitch,onLeave:()=>S.setState({telescope:!1})}),S.setState({telescope:!0,sitting:null}))},o=e=>{Number.isFinite(e)&&S.setState({zoom:Math.min(Ae.max,Math.max(Ae.min,Math.round(e/Ae.step)*Ae.step))})};return bt(`telescope`,a),bt(`zoom`,e=>o(Number(e))),F(`telescope`,()=>({yaw:Math.round(n.yaw*180/Math.PI),pitch:Math.round(n.pitch*180/Math.PI),fov:Math.round(e.fov*10)/10})),F(`sky`,()=>{let e=Ue.t,t=Et(e);return{night:Math.round(We(e)*100)/100,moon:{...Dt(t),up:t[1]>0},constellations:It().map(t=>({name:t.name,stars:t.stars.length,...Dt(Tt(t.centre,e))}))}}),(0,P.useEffect)(()=>{let e=0,t=t=>{r.current&&(e-=t.deltaMode===1?t.deltaY*40:t.deltaY,Math.abs(e)<80||(o(S.getState().zoom+Math.sign(e)*Ae.step),e=0))};return window.addEventListener(`wheel`,t,{passive:!0}),()=>window.removeEventListener(`wheel`,t)},[]),(0,P.useEffect)(()=>()=>{Me()?.id===`telescope`&&Pe(),e.fov=yr,e.updateProjectionMatrix()},[e]),A((i,a)=>{let o=Me(),s=S.getState();r.current=s.telescope&&o?.id===`telescope`,r.current&&o&&(n.yaw=o.yaw,n.pitch=o.pitch,o.look=.9/s.zoom);let c=t.current;c&&(c.rotation.set(n.pitch,n.yaw,0,`YXZ`),c.visible=!r.current);let l=r.current?yr/s.zoom:yr;e.fov!==l&&(e.fov=Math.abs(l-e.fov)<.05?l:e.fov+(l-e.fov)*(1-Math.exp(-a*12)),e.updateProjectionMatrix())}),(0,I.jsxs)(`group`,{children:[(0,I.jsxs)(`group`,{ref:i,position:[v.x,0,v.z],children:[[0,1,2].map(e=>{let t=e/3*Math.PI*2+.3;return(0,I.jsx)(`mesh`,{position:[Math.cos(t)*.2,xr/2-.05,Math.sin(t)*.2],rotation:[Math.sin(t)*.3,0,-Math.cos(t)*.3],material:T(`#6c757d`),castShadow:!0,children:(0,I.jsx)(`cylinderGeometry`,{args:[.025,.03,1.4100000000000001,8]})},e)}),(0,I.jsx)(`mesh`,{position:[0,.55,0],material:T(`#adb5bd`),children:(0,I.jsx)(`cylinderGeometry`,{args:[.16,.16,.03,12]})}),(0,I.jsx)(`mesh`,{position:[0,1.3,0],material:T(`#343a40`),castShadow:!0,children:(0,I.jsx)(`boxGeometry`,{args:[.14,.16,.14]})}),(0,I.jsxs)(`group`,{ref:t,position:[0,1.4400000000000002,0],children:[(0,I.jsxs)(`mesh`,{position:[0,0,-.15],rotation:[Math.PI/2,0,0],material:T(`#f8f9fa`),castShadow:!0,children:[(0,I.jsx)(`cylinderGeometry`,{args:[.085,.085,1,20]}),(0,I.jsx)(w,{thickness:.012,color:`#1f1d2b`})]}),(0,I.jsxs)(`mesh`,{position:[0,0,-.7],rotation:[Math.PI/2,0,0],material:T(`#1d3557`),castShadow:!0,children:[(0,I.jsx)(`cylinderGeometry`,{args:[.105,.1,.22,20]}),(0,I.jsx)(w,{thickness:.012,color:`#1f1d2b`})]}),(0,I.jsx)(`mesh`,{position:[0,0,0],rotation:[Math.PI/2,0,0],material:T(`#d4a373`),children:(0,I.jsx)(`cylinderGeometry`,{args:[.09,.09,.05,20]})}),(0,I.jsx)(`mesh`,{position:[0,.06,.4],rotation:[Math.PI/2-.6,0,0],material:T(`#343a40`),children:(0,I.jsx)(`cylinderGeometry`,{args:[.025,.03,.14,10]})}),(0,I.jsx)(`mesh`,{position:[.08,.11,-.05],rotation:[Math.PI/2,0,0],material:T(`#d4a373`),children:(0,I.jsx)(`cylinderGeometry`,{args:[.022,.022,.3,10]})})]})]}),(0,I.jsx)(jr,{visible:r})]})}function Nr({top:e}){return(0,P.useEffect)(()=>Ie(xt,St),[]),(0,P.useEffect)(()=>()=>void Pe(),[]),F(`lights`,()=>Math.round(l()*100)/100),F(`elevation`,()=>ce(e)),(0,I.jsxs)(`group`,{children:[(0,I.jsx)(Yn,{top:e}),(0,I.jsx)(u,{floorLabel:`▲ R · Roof terrace`,accent:`#ff8a5b`}),(0,I.jsx)(_n,{}),(0,I.jsx)(vr,{}),(0,I.jsx)(un,{}),(0,I.jsx)(In,{}),(0,I.jsx)(Mr,{}),(0,I.jsx)(Ut,{top:e}),(0,I.jsx)(lr,{}),(0,I.jsx)(zn,{}),(0,I.jsx)(Ne,{kind:`roof`})]})}export{Nr as default};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{l as t,t as n}from"./jsx-runtime-CZP6s5wa.js";import{$t as r,An as i,Bn as a,C as o,En as s,Fi as c,Fn as l,Hn as u,In as d,Ji as f,Ln as p,Ni as m,On as h,Pa as g,Pn as ee,Qn as te,Ri as ne,Rn as re,Si as ie,Un as ae,Uo as oe,Vi as se,Wn as _,_ as ce,_n as le,_o as v,_t as y,an as ue,ar as de,bo as fe,bt as pe,c as b,cn as x,co as me,cr as he,dn as ge,dr as _e,en as ve,eo as ye,gn as be,ha as xe,jt as Se,kt as Ce,ln as we,lr as Te,mo as Ee,nr as S,on as De,oo as Oe,or as C,p as w,pt as T,qn as ke,rr as Ae,sn as je,so as E,sr as Me,tn as Ne,to as Pe,tr as Fe,va as Ie,vn as Le,vo as D,w as O,wi as k,xi as Re,zn as ze}from"./store-D17hJxYS.js";import{c as A,y as Be}from"./index-Bm599iDL.js";import{C as Ve,Et as j,I as He,Ot as Ue,S as We,T as M,Ut as N,f as P,g as F,gt as I,i as Ge,it as Ke,k as qe,n as Je,ot as Ye,rt as Xe,w as Ze,wt as Qe,yt as $e}from"./bloomMarks-C54fx8hS.js";import{d as et,l as tt,t as nt}from"./useGraphics-CJhpDhqZ.js";import{Dt as rt,In as L,J as it,Jt as R,K as at,Q as z,Rn as ot,Rt as B,Wn as V,X as H,Xn as st,Yn as ct,Z as U,a as lt,bt as ut,c as dt,ft,k as pt,kt as mt,n as ht,o as gt,pn as W,r as _t,t as vt}from"./cheerRules-Cirk-C1A.js";import{t as yt}from"./BufferGeometryUtils-CT65PqMz.js";import{a as bt,n as xt,o as St,r as Ct}from"./Batched-CQd1jTn0.js";import{B as wt,H as Tt,M as Et,U as G,V as Dt,y as Ot}from"./rig-CrQ96zZT.js";import{n as kt,r as At}from"./interact-5KlEmqSj.js";import{K as jt,Z as Mt}from"./AccessibilitySettings-C_l9iRUv.js";import{c as Nt,n as Pt,u as Ft}from"./useDayTime-kseMHOa9.js";import{C as It,D as Lt,E as Rt,M as zt,O as Bt,S as Vt,T as Ht,j as Ut,k as Wt,w as Gt}from"./TerminalView-BXlSvVFj.js";import{i as Kt}from"./dogState-COomoDy2.js";function qt(){return qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qt.apply(null,arguments)}var K=e(t()),Jt=K.forwardRef(function({children:e,follow:t=!0,lockX:n=!1,lockY:r=!1,lockZ:i=!1,...a},o){let s=K.useRef(null),c=K.useRef(null),l=new $e;return P(({camera:e})=>{if(!t||!c.current)return;let a=s.current.rotation.clone();c.current.updateMatrix(),c.current.updateWorldMatrix(!1,!1),c.current.getWorldQuaternion(l),e.getWorldQuaternion(s.current.quaternion).premultiply(l.invert()),n&&(s.current.rotation.x=a.x),r&&(s.current.rotation.y=a.y),i&&(s.current.rotation.z=a.z)}),K.useImperativeHandle(o,()=>c.current,[]),K.createElement(`group`,qt({ref:c},a),K.createElement(`group`,{ref:s},e))}),q=n(),Yt=`#a9d4ff`,Xt={desk:.42,floor:.3},Zt=.2,Qt=Ft(Pt.t),$t=null;function en(){if($t)return $t;let e=document.createElement(`canvas`);e.width=e.height=128;let t=e.getContext(`2d`),n=t.createRadialGradient(64,42,0,64,52,64);return n.addColorStop(0,`rgba(255,255,255,1)`),n.addColorStop(.35,`rgba(255,255,255,0.55)`),n.addColorStop(.7,`rgba(255,255,255,0.15)`),n.addColorStop(1,`rgba(255,255,255,0)`),t.fillStyle=n,t.fillRect(0,0,128,128),$t=new M(e),$t.colorSpace=j,$t}var tn=new Map;function nn(e,t){let n=`${e}|${t}`,r=tn.get(n);return r||(r={material:new Ye({map:en(),color:Dt(Yt,e,.3),transparent:!0,opacity:0,blending:2,depthWrite:!1,toneMapped:!1,fog:!1,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),strength:t},tn.set(n,r),rn(r)),r.material}function rn(e){e.material.opacity=e.strength*Qt,e.material.visible=Qt>.02}function an(){let e=(0,K.useRef)(-1);return Nt(()=>{if(Pt.t!==e.current){e.current=Pt.t,Qt=Ft(Pt.t);for(let e of tn.values())rn(e)}}),null}var on=()=>tt(e=>et(nt(e),`medium`)),sn=()=>null,cn=new I(1,1).rotateX(-Math.PI/2);function ln({color:e}){return on()?(0,q.jsx)(`mesh`,{geometry:cn,material:nn(e,Xt.desk),position:[0,.772,-.04],scale:[1.75,1,.86],raycast:sn}):null}function un({color:e,height:t}){return on()?(0,q.jsx)(`mesh`,{geometry:cn,material:nn(e,Xt.floor),position:[0,-t+.012,1.7],scale:[4.8,1,3.4],raycast:sn}):null}var dn=`
|
|
2
|
+
varying float vLit;
|
|
3
|
+
void main() {
|
|
4
|
+
// lit from the screen in front (the face looks down -z), a little from above
|
|
5
|
+
vLit = max(dot(normalize(normal), normalize(vec3(0.0, 0.25, -1.0))), 0.0);
|
|
6
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7
|
+
}`,fn=`
|
|
8
|
+
uniform vec3 uColor;
|
|
9
|
+
uniform float uStrength;
|
|
10
|
+
varying float vLit;
|
|
11
|
+
void main() {
|
|
12
|
+
gl_FragColor = vec4(uColor * (vLit * vLit * uStrength), 1.0);
|
|
13
|
+
}`;function pn(e){return on()?(0,q.jsx)(mn,{...e}):null}function mn({id:e,geometry:t}){let n=(0,K.useRef)(null),r=(0,K.useMemo)(()=>new Ue({vertexShader:dn,fragmentShader:fn,uniforms:{uColor:{value:new qe(Yt).convertLinearToSRGB()},uStrength:{value:0}},transparent:!0,blending:2,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-2}),[]);return(0,K.useEffect)(()=>()=>r.dispose(),[r]),P(()=>{let t=n.current;if(!t)return;let i=ve(e)?.sit??0,a=Zt*Qt*i;r.uniforms.uStrength.value=a,t.visible=a>.01}),(0,q.jsx)(`mesh`,{ref:n,geometry:t,material:r,visible:!1,raycast:sn})}var hn={w:1,h:.1875},gn={seated:1.74,standing:2.2},_n={from:2,clear:2.6};function vn(e,t){let n=gn.seated*e+gn.standing*(1-e);return t&&n+hn.h/2>_n.from?_n.clear:n}var yn={billboard:!0},bn={facesCamera:!0},xn={firstPerson:!0},Sn={leanBack:4.5,spin:2.6,phone:5,sip:3.4,stretch:4.2,doze:1/0,neckRoll:2.8,shoulders:2.6,scratch:2,facepalm:1.9,fistPump:1.7,wave:2.1},Cn=[`leanBack`,`spin`,`phone`,`sip`,`stretch`],wn={min:5,max:14},Tn={min:80,max:130},En={min:25,max:55},Dn=10,On=.35,kn=.45;function An(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t>>>0}function jn(e){e.rng=e.rng+1831565813|0;let t=e.rng;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}var Mn=(e,t)=>t.min+(t.max-t.min)*jn(e);function Nn(e,t,n=!0){let r={fidget:null,since:0,until:0,next:0,last:null,mood:`busy`,moodSince:t,sessionSince:t,dozeAfter:0,lastScratch:-1/0,rng:An(e),hasMug:n};return r.next=t+2+jn(r)*wn.max,r.dozeAfter=Mn(r,Tn),r}function Pn(e,t,n){e.fidget=t,e.since=n,e.until=n+Sn[t]*(t===`doze`?1:.9+jn(e)*.2)}function Fn(e,t,n){e.fidget=null,e.next=t+Mn(e,n)}var In=e=>Cn.includes(e)||e===`doze`,Ln=e=>e===`working`||e===`thinking`||e===`browsing`,Rn=e=>e===`facepalm`||e===`fistPump`||e===`wave`;function zn(e,t,n){Pn(e,t,n),t!==`doze`&&(e.moodSince=n)}function Bn(e,t){e.fidget===`doze`&&Fn(e,t,wn),e.moodSince=t}function Vn(e,t,n){if(t!==e.mood){Ln(t)&&!Ln(e.mood)&&(e.sessionSince=n,e.next=n+Mn(e,En)),t===`idle`&&(e.next=n+Mn(e,wn)*.5),e.mood=t,e.moodSince=n;let r=e.fidget;r&&!Rn(r)&&(t===`idle`?!In(r):t===`busy`||In(r))&&Fn(e,n,wn)}if(e.fidget){if(n<e.until)return e;let t=Rn(e.fidget);Fn(e,n,e.mood===`idle`?wn:En),t&&(e.next=Math.max(e.next,n+wn.min))}if(t===`idle`){if(n-e.moodSince>=e.dozeAfter)Pn(e,`doze`,n);else if(n>=e.next){let t=Cn[Math.floor(jn(e)*Cn.length)];(t===e.last||t===`sip`&&!e.hasMug)&&(t=Cn[(Cn.indexOf(t)+1+Math.floor(jn(e)*2))%Cn.length]),t===`sip`&&!e.hasMug&&(t=`leanBack`),e.last=t,Pn(e,t,n)}}else t===`thinking`?n-e.moodSince>=5&&n-e.lastScratch>=Dn&&(e.lastScratch=n,Pn(e,`scratch`,n)):t===`working`&&n>=e.next&&n-e.sessionSince>=60&&Pn(e,jn(e)<.5?`neckRoll`:`shoulders`,n);return e}function Hn(e,t){return e.fidget?e.until===1/0?t-e.since:Math.min(1,Math.max(0,(t-e.since)/(e.until-e.since))):0}function Un(e,t){if(!e.fidget)return 0;let n=Math.min(1,(t-e.since)/On),r=e.until===1/0?1:Math.min(1,(e.until-t)/kn),i=Math.max(0,Math.min(n,r));return i*i*(3-2*i)}var Wn=`#f6bd60`,Gn=`#d08c45`,Kn=`#c1121f`;function qn({r:e=.13}){return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(`mesh`,{castShadow:!0,material:G(Wn),children:(0,q.jsx)(`cylinderGeometry`,{args:[e,e,.014,6,1,!1,-Math.PI/8,Math.PI/4]})}),(0,q.jsx)(U,{size:[e*.78,.022,.03],position:[0,.002,e*.9],color:Gn,shadow:!1}),(0,q.jsx)(H,{r:.016,position:[.01,.01,e*.68],scale:[1,.35,1],color:Kn,shadow:!1}),(0,q.jsx)(H,{r:.013,position:[-.008,.01,e*.42],scale:[1,.35,1],color:Kn,shadow:!1})]})}function Jn({kind:e}){switch(e){case`lunchbox`:return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(U,{size:[.17,.08,.12],color:`#4cc9f0`,outline:!0,shadow:!1}),(0,q.jsx)(U,{size:[.175,.025,.125],position:[0,.045,0],color:`#ffd166`,shadow:!1})]});case`sandwich`:return(0,q.jsxs)(`group`,{rotation:[.3,0,0],children:[(0,q.jsx)(U,{size:[.13,.03,.11],position:[0,-.025,0],color:`#f4d58d`,outline:!0,shadow:!1}),(0,q.jsx)(U,{size:[.14,.012,.12],position:[0,-.004,0],color:`#80ed99`,shadow:!1}),(0,q.jsx)(U,{size:[.12,.012,.1],position:[0,.008,0],color:`#e63946`,shadow:!1}),(0,q.jsx)(U,{size:[.13,.03,.11],position:[0,.03,0],color:`#f4d58d`,outline:!0,shadow:!1})]});case`noodles`:return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(z,{r:.045,rTop:.06,h:.12,color:`#f8f9fa`,outline:!0,shadow:!1}),(0,q.jsx)(z,{r:.046,rTop:.052,h:.03,position:[0,-.01,0],color:`#e63946`,shadow:!1}),(0,q.jsx)(z,{r:.006,h:.2,position:[.015,.1,0],rotation:[0,0,.18],color:`#e9c46a`,shadow:!1}),(0,q.jsx)(z,{r:.006,h:.2,position:[-.012,.1,.01],rotation:[.1,0,.1],color:`#e9c46a`,shadow:!1})]});case`pizza`:return(0,q.jsx)(`group`,{position:[0,0,-.13],children:(0,q.jsx)(qn,{})})}}var Yn=`#d4a373`,Xn=`#b5835a`;function Zn({w:e=.42}){return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(U,{size:[e,.05,e],position:[0,.025,0],color:Yn,outline:!0}),(0,q.jsx)(U,{size:[e*.45,.004,e*.3],position:[0,.052,0],color:`#e63946`,shadow:!1})]})}var Qn=(0,q.jsx)(`group`,{position:[0,.16,-.46],children:[0,1,2].map(e=>(0,q.jsx)(`group`,{position:[0,e*.052,0],children:(0,q.jsx)(Zn,{w:.4})},e))});function $n({slices:e}){let t=.42;return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(U,{size:[t,.03,t],position:[0,.015,0],color:Yn,outline:!0}),(0,q.jsx)(U,{size:[t,t,.02],position:[0,t/2,-.42/2],rotation:[-.25,0,0],color:Xn,outline:!0}),Array.from({length:Math.max(0,Math.min(8,e))},(e,t)=>(0,q.jsx)(`group`,{position:[0,.038,0],rotation:[0,t*Math.PI/4,0],children:(0,q.jsx)(qn,{r:.17})},t))]})}var er={protein:.12,cheese:.12,chocolate:.12,pizza:.13},tr={overclock:.125,sparkling:.13,coldbrew:.17,mate:.19},nr={overclock:{body:`#22223b`,band:`#39ff14`,top:`#ced4da`},sparkling:{body:`#caf0f8`,band:`#ff8fab`,top:`#ced4da`},coldbrew:{body:`#3d2817`,band:`#d4a373`,top:`#1f1d2b`},mate:{body:`#74c69d`,band:`#2d6a4f`,top:`#f9c74f`}};function rr({snack:e,left:t}){let n=pt[e],r=t===void 0?1:Math.max(.25,t/n.portions);switch(e){case`overclock`:case`sparkling`:{let t=nr[e],n=tr[e],r=e===`sparkling`?.029:.033;return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(z,{r,h:n,color:t.body,shadow:!1,seg:14}),(0,q.jsx)(z,{r:r+.001,h:n*.3,position:[0,.005,0],color:t.band,shadow:!1,seg:14}),(0,q.jsx)(z,{r:r*.8,rTop:r*.75,h:.012,position:[0,n/2+.005,0],color:t.top,shadow:!1,seg:14})]})}case`coldbrew`:case`mate`:{let t=nr[e],n=tr[e],r=n*.66,i=n-r;return(0,q.jsxs)(`group`,{position:[0,-n/2,0],children:[(0,q.jsx)(z,{r:.034,h:r,position:[0,r/2,0],color:t.body,shadow:!1,seg:14}),(0,q.jsx)(z,{r:.035,h:r*.45,position:[0,r*.48,0],color:t.band,shadow:!1,seg:14}),(0,q.jsx)(z,{r:.016,rTop:.016,h:i*.8,position:[0,r+i*.4,0],color:t.body,shadow:!1,seg:10}),(0,q.jsx)(z,{r:.032,rTop:.017,h:.03,position:[0,r+.012,0],color:t.body,shadow:!1,seg:14}),(0,q.jsx)(z,{r:.018,h:.018,position:[0,n-.005,0],color:t.top,shadow:!1,seg:10})]})}case`pizza`:{let e=er.pizza;return(0,q.jsx)(`group`,{position:[0,0,-e/2],children:(0,q.jsx)(`group`,{position:[0,0,e*(1-r)],scale:[1,1,r],children:(0,q.jsx)(qn,{r:e})})})}case`protein`:{let e=er.protein*r;return(0,q.jsxs)(`group`,{position:[0,0,(er.protein-e)/2],children:[(0,q.jsx)(U,{size:[.036,.016,e],color:`#ff6b35`,shadow:!1}),(0,q.jsx)(U,{size:[.037,.017,Math.min(e,.035)],position:[0,0,e/2-Math.min(e,.035)/2-.004],color:`#1d3557`,shadow:!1}),r<1&&(0,q.jsx)(U,{size:[.03,.012,.004],position:[0,0,-e/2],color:`#a47148`,shadow:!1})]})}case`cheese`:{let e=er.cheese*r;return(0,q.jsxs)(`group`,{position:[0,0,(er.cheese-e)/2],children:[(0,q.jsx)(z,{r:.011,h:e,rotation:[Math.PI/2,0,0],color:`#fff1c1`,shadow:!1,seg:10}),(0,q.jsx)(z,{r:.013,h:.03,position:[0,0,e/2-.015],rotation:[Math.PI/2,0,0],color:`#ffd166`,shadow:!1,seg:10}),r<1&&(0,q.jsx)(H,{r:.011,position:[0,0,-e/2],scale:[1,1,.4],color:`#fff1c1`,shadow:!1})]})}case`chocolate`:{let e=er.chocolate*r,t=r<1?Math.min(e-.02,.035):0;return(0,q.jsxs)(`group`,{position:[0,0,(er.chocolate-e)/2],children:[(0,q.jsx)(U,{size:[.05,.012,e-t],position:[0,0,t/2],color:`#9d0208`,shadow:!1}),(0,q.jsx)(U,{size:[.051,.013,.02],position:[0,0,e/2-.03],color:`#ffba08`,shadow:!1}),t>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(U,{size:[.046,.01,t],position:[0,0,-e/2+t/2],color:`#5e3023`,shadow:!1}),(0,q.jsx)(U,{size:[.047,.012,.003],position:[0,0,-e/2+t+.001],color:`#ced4da`,shadow:!1})]})]})}}}function ir(){return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(U,{size:[.2,.08,.15],position:[0,.04,0],color:`#d8f3dc`,shadow:!1}),(0,q.jsx)(U,{size:[.17,.05,.12],position:[0,.035,0],color:`#e9c46a`,shadow:!1}),(0,q.jsx)(U,{size:[.21,.02,.16],position:[0,.09,0],color:`#4361ee`,shadow:!1}),(0,q.jsx)(U,{size:[.004,.035,.11],position:[-.101,.045,0],color:`#fefae0`,shadow:!1}),(0,q.jsx)(U,{size:[.005,.004,.08],position:[-.102,.052,-.005],color:`#e63946`,shadow:!1}),(0,q.jsx)(U,{size:[.005,.004,.06],position:[-.102,.04,.008],color:`#1f1d2b`,shadow:!1})]})}function ar(e,t){let n=[];for(let r in t){let i=e[r];i&&i.status!==`error`&&t[r].status===`error`&&n.push(r)}return n}function or(e,t){let n=[];for(let r in t){let i=t[r];i.status===`passed`&&e[r]?.status!==`passed`&&i.devAgentId&&n.push(i.devAgentId)}return n}function sr(e,t){let n=[];for(let r of t){let t=e.find(e=>e.id===r.id);if(t)for(let e of r.pulls)e.state===`MERGED`&&t.pulls.some(t=>t.number===e.number&&t.state===`OPEN`)&&n.push({repoId:r.id,number:e.number,headRefName:e.headRefName})}return n}function cr(e,t,n){return t||(n.find(t=>t.repoId===e.repoId&&(t.prNumber===e.number||t.branch!=null&&t.branch===e.headRefName))?.id??null)}function lr(e,t,n=4){let r=t.get(e);if(!r)return[];let i=[];for(let[n,a]of t){if(n===e)continue;let t=Math.hypot(a.seatX-r.seatX,a.seatZ-r.seatZ);t<=7.6&&i.push({id:n,d:t})}return i.sort((e,t)=>e.d-t.d).slice(0,n).map(e=>e.id)}var ur=3e3,dr=new Map,fr=new Map,pr=[],mr=new Map,hr=new Map,gr=e=>hr.get(e)??-1/0;function _r(e,t=Date.now()){let n=dr.get(e);if(n)return dr.delete(e),t-n.at<ur?n:void 0}function vr(e,t,n=0,r=0){let i=Date.now();dr.set(e,{fidget:t,x:n,z:r,at:i}),pr.push({id:e,fidget:t,at:i}),pr.length>30&&pr.shift()}function yr(e,t){return fr.set(e,t),()=>{fr.get(e)===t&&fr.delete(e)}}w.subscribe((e,t)=>{if(t.loaded){if(e.qa!==t.qa){for(let t in e.qa){let n=e.qa[t].devAgentId;n&&mr.set(t,n)}for(let n of or(t.qa,e.qa))vr(n,`fistPump`)}if(e.agents!==t.agents)for(let n of ar(t.agents,e.agents))vr(n,`facepalm`);if(e.repos!==t.repos){let n=sr(t.repos,e.repos);if(!n.length)return;let r=[...Object.values(t.agents),...Object.values(e.agents)],i=ge();for(let e of n){let t=cr(e,mr.get(`${e.repoId}#${e.number}`),r);t&&hr.set(t,Date.now());let n=t?i.get(t):void 0;if(t&&n)for(let e of lr(t,i))vr(e,`wave`,n.seatX,n.seatZ)}}}}),typeof window<`u`&&(window.__swarmDeskLife={play(e,t,n){let r=n?ge().get(n):void 0;vr(e,t,r?.seatX??0,r?.seatZ??0)},list(){return[...fr].map(([e,t])=>({id:e,mood:t.mood,fidget:t.fidget}))},recent:()=>[...pr]});var br={gapMs:2e3,ms:1500},xr={ball:2.5,dart:3};function Sr(e,t){let n=e&&typeof e==`object`?e.toy:void 0;return n===`dart`?`dart`:typeof n==`string`&&t.includes(n)?`ball`:null}function Cr(e,t,n){return e!==null&&!n&&t>=xr[e]}var wr=(e,t,n=br.gapMs)=>e===void 0||t-e>=n,Tr=e=>e*e*(3-2*e);function Er(e){return!(e>=0)||e>=br.ms?0:e<120?Tr(e/120):e<850?1:1-Tr((e-850)/(br.ms-850))}function Dr(e){return!(e>=0)||e>=400?0:e<70?Tr(e/70):1-Tr((e-70)/330)}var Or=(e,t,n)=>Math.min(n,Math.max(t,e));function kr(e,t,n=1.1,r=.5){if(e===0&&t===0)return{head:0,twist:0};let i=Math.atan2(-e,-t),a=Or(i,-n,n);return{head:a,twist:Or(i-a,-r,r)}}var Ar=[],jr=1,Mr=new Set,Nr=new Map,Pr=new Map,Fr=0;function Ir(e,t){let n={id:e,obj:t,key:jr++};Ar=[...Ar,n];for(let e of Mr)e();return()=>{Ar=Ar.filter(e=>e!==n);for(let e of Mr)e()}}var Lr=()=>Ar;function Rr(e){return Mr.add(e),()=>void Mr.delete(e)}function zr(e,t){let n=Nr.get(e);return n||Nr.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Nr.delete(e)}}function Br(e,t=performance.now()){if(!wr(Pr.get(e),t))return!1;Pr.set(e,t),Fr++;for(let t of Nr.get(e)??[])t();return!0}var Vr=()=>Fr,Hr=1.16,Ur=`#1f1d2b`;function Wr(e,t,n,r){let i=n-8-34;e.lineWidth=8,e.lineJoin=`round`,e.strokeStyle=Ur,e.fillStyle=`#ffffff`,e.beginPath(),e.roundRect(8,8,t-16,i-8,40),e.fill(),e.stroke(),e.beginPath(),e.moveTo(62,i-6),e.lineTo(28,n-8),e.lineTo(104,i-6),e.fill(),e.beginPath(),e.moveTo(62,i),e.lineTo(28,n-8),e.lineTo(104,i),e.stroke(),e.fillStyle=`#e63946`,e.font=`700 ${r.length>2?84:100}px ${T}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(r,t/2,(8+i)/2+4)}function Gr({text:e,since:t}){let n=(0,K.useRef)(null),r=kt(256,176,t=>Wr(t,256,176,e),[e]);return P(()=>{if(!n.current)return;let e=performance.now()-t,r=br.ms-e,i=e<90?.3+e/90*.9:e<170?1.2-(e-90)/80*.2:r<150?Math.max(.01,r/150):1;n.current.scale.setScalar(i)}),(0,q.jsx)(Jt,{position:[.18,1.45,0],userData:yn,children:(0,q.jsx)(`group`,{ref:n,scale:.3,children:(0,q.jsxs)(`mesh`,{position:[.195,.156,0],renderOrder:2,children:[(0,q.jsx)(`planeGeometry`,{args:[.5,.344]}),(0,q.jsx)(`meshBasicMaterial`,{map:r,transparent:!0,toneMapped:!1,depthWrite:!1})]})})})}function Kr(e,t){let n=F(e=>e.camera),r=(0,K.useRef)(-1/0),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>({w:0,flinch:0,headYaw:0,headPitch:0,twist:0}),[]),s=(0,K.useMemo)(()=>new N,[]);return(0,K.useEffect)(()=>{let n=t.current;return n?Ir(e,n):void 0},[e,t]),(0,K.useEffect)(()=>zr(e,()=>{let e=performance.now();r.current=e;let n=t.current?.getWorldPosition(new N);ie(n&&{x:n.x,y:n.y+Hr,z:n.z}),a({text:Math.random()<.65?`hey!`:`!`,since:e})}),[e,t]),(0,K.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(null),br.ms);return()=>clearTimeout(e)},[i]),{pose:e=>{let i=e-r.current;o.w=Er(i),o.flinch=Dr(i);let a=t.current;if(o.w===0||!a)return o.w=o.flinch=o.headYaw=o.headPitch=o.twist=0,o;a.worldToLocal(s.copy(n.position));let c=kr(s.x,s.z);return o.headYaw=c.head,o.twist=c.twist,o.headPitch=Math.min(.45,Math.max(-.3,Math.atan2(s.y-Hr,Math.hypot(s.x,s.z)))),o},bubble:i&&(0,q.jsx)(Gr,{text:i.text,since:i.since},i.since)}}var qr=512,Jr=176,Yr=8,Xr=28,Zr=`#1f1d2b`,Qr=40,$r=_n.clear-hn.h/2,ei=.327875,ti=4.5,ni=new N,ri=null,ii=new Map,ai=e=>!/[\p{L}\p{N}]/u.test(e)&&[...e].length<=3;function oi(e,t){if(e.font=`600 60px ${T}`,e.measureText(t).width<=560)return{lines:[t],size:60};let n=t.split(/\s+/).join(` `);for(let r of[48,42]){e.font=`600 ${r}px ${T}`;let i=e.measureText(t).width/2;for(let a=Math.max(160,i+24);a<=600;a+=24){let i=Se(e,t,a,2);if(i.join(` `)===n)return{lines:i,size:r}}}return{lines:Se(e,t,600,2),size:42}}function si(e){ri??=document.createElement(`canvas`).getContext(`2d`);let t=ri,{lines:n,size:r}=oi(t,e);t.font=`600 ${r}px ${T}`;let i=Math.max(...n.map(e=>t.measureText(e).width)),a=Math.ceil(Math.max(200,i+16+56)/8)*8,o=document.createElement(`canvas`);o.width=a,o.height=Jr;let s=o.getContext(`2d`);s.lineWidth=8,s.lineJoin=`round`,s.strokeStyle=Zr,s.fillStyle=`#ffffff`,s.beginPath(),s.roundRect(Yr,Yr,a-16,126,40),s.fill(),s.stroke(),s.beginPath(),s.moveTo(62,128),s.lineTo(Xr,168),s.lineTo(104,128),s.fill(),s.beginPath(),s.moveTo(62,134),s.lineTo(Xr,168),s.lineTo(104,134),s.stroke(),s.fillStyle=Zr,s.font=`600 ${r}px ${T}`,s.textAlign=`center`,s.textBaseline=`middle`;let c=r*1.08;return n.forEach((e,t)=>s.fillText(e,a/2,74+(t-(n.length-1)/2)*c)),o}function ci(e){let t=ii.get(e);if(t)return ii.delete(e),ii.set(e,t),t;let n;ai(e)?(n=document.createElement(`canvas`),n.width=256,n.height=Jr,Wr(n.getContext(`2d`),256,Jr,e)):n=si(e);let r=new M(n);if(r.colorSpace=j,r.anisotropy=4,t={tex:r,w:n.width/qr},ii.set(e,t),ii.size>Qr){let[e,t]=ii.entries().next().value;ii.delete(e),t.tex.dispose()}return t}function li({id:e,y:t}){let n=F(e=>e.camera),r=(0,K.useRef)(null),i=(0,K.useRef)(null),a=(0,K.useRef)(null);return P(()=>{let t=be(e),o=r.current;if(!o||!a.current||!i.current||(o.visible=!!t,!t))return;let s=ci(t.text);a.current.map!==s.tex&&(a.current.map=s.tex,a.current.needsUpdate=!0,i.current.scale.set(s.w,Jr/qr,1),i.current.position.set(s.w/2-Xr/qr,.156,0));let c=performance.now(),l=c-t.at,u=t.until===void 0?1/0:t.until-c,d=l<90?.3+l/90*.9:l<170?1.2-(l-90)/80*.2:u<150?Math.max(.01,u/150):1;o.getWorldPosition(ni);let f=Math.min(Math.max(1,($r-ni.y)/ei),Math.max(1,ni.distanceTo(n.position)/ti));o.scale.setScalar(d*f)}),(0,q.jsx)(Jt,{position:[.2,t,0],userData:yn,children:(0,q.jsx)(`group`,{ref:r,visible:!1,children:(0,q.jsxs)(`mesh`,{ref:i,position:[.195,.156,0],scale:[.5,Jr/qr,1],renderOrder:2,children:[(0,q.jsx)(`planeGeometry`,{args:[1,1]}),(0,q.jsx)(`meshBasicMaterial`,{ref:a,transparent:!0,toneMapped:!1,depthWrite:!1})]})})})}function ui(e){let t=jt(e=>e.costume);return t?(0,q.jsx)(t,{...e}):null}var di=`#1f1d2b`,J=Pe,fi=.03,pi=`#f8f9fa`;function mi({handle:e=!0}){return(0,q.jsxs)(`group`,{children:[(0,q.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],position:[0,0,-.004],material:G(`#e63946`),castShadow:!0,children:[(0,q.jsx)(`cylinderGeometry`,{args:[.078,.078,.008,24]}),(0,q.jsx)(bt,{thickness:.006,color:di})]}),(0,q.jsx)(`mesh`,{rotation:[Math.PI/2,0,0],position:[0,0,.004],material:G(`#22223b`),children:(0,q.jsx)(`cylinderGeometry`,{args:[.078,.078,.008,24]})}),e&&(0,q.jsx)(`mesh`,{position:[0,-.115,0],material:G(`#d4a373`),children:(0,q.jsx)(`boxGeometry`,{args:[.026,.085,.022]})})]})}var hi=null;function gi(){if(hi)return hi;let e=document.createElement(`canvas`);e.width=256,e.height=32;let t=e.getContext(`2d`);t.strokeStyle=`rgba(30,30,40,0.85)`,t.lineWidth=1.2;for(let e=0;e<=256;e+=6)t.beginPath(),t.moveTo(e,0),t.lineTo(e,32),t.stroke();for(let e=4;e<=32;e+=6)t.beginPath(),t.moveTo(0,e),t.lineTo(256,e),t.stroke();t.fillStyle=`#f8f9fa`,t.fillRect(0,0,256,5);let n=new M(e);return n.colorSpace=j,hi=new Ye({map:n,transparent:!0,side:2,depthWrite:!1}),hi}var _i=(0,K.memo)(function(){let e={x:J.len/2,z:J.wid/2},t=.02,n=R.net,r=J.wid+n.overhang*2;return(0,q.jsxs)(`group`,{position:[J.x,0,J.z],children:[(0,q.jsxs)(`mesh`,{position:[0,J.top-fi/2,0],material:G(`#1d4e89`),castShadow:!0,receiveShadow:!0,children:[(0,q.jsx)(`boxGeometry`,{args:[J.len,fi,J.wid]}),(0,q.jsx)(bt,{thickness:.012,color:di})]}),[[0,e.z-t/2,J.len,t],[0,-e.z+t/2,J.len,t],[e.x-t/2,0,t,J.wid],[-e.x+t/2,0,t,J.wid],[0,0,J.len,.006]].map(([e,t,n,r],i)=>(0,q.jsx)(`mesh`,{position:[e,J.top+.001,t],material:G(pi),children:(0,q.jsx)(`boxGeometry`,{args:[n,.002,r]})},i)),(0,q.jsx)(U,{size:[J.len-.3,.08,J.wid-.3],position:[0,J.top-fi-.04,0],color:`#495057`,shadow:!1}),[-1,1].flatMap(t=>[-1,1].map(n=>(0,q.jsx)(U,{size:[.05,J.top-fi,.05],position:[t*(e.x-.25),(J.top-fi)/2,n*(e.z-.2)],color:`#343a40`},`${t}${n}`))),(0,q.jsx)(`mesh`,{position:[0,J.top+n.h/2,0],rotation:[0,Math.PI/2,0],material:gi(),children:(0,q.jsx)(`planeGeometry`,{args:[r,n.h]})}),[-1,1].map(t=>(0,q.jsxs)(`group`,{children:[(0,q.jsx)(U,{size:[.03,n.h+.02,.03],position:[0,J.top+n.h/2,t*(e.z+n.overhang)],color:`#212529`}),(0,q.jsx)(U,{size:[.05,.03,.08],position:[0,J.top-.005,t*(e.z+.02)],color:`#212529`})]},t)),(0,q.jsxs)(`group`,{position:[.25,J.top-.03,-e.z-.05],children:[(0,q.jsx)(z,{r:.045,rTop:.05,h:.09,color:`#adb5bd`,outline:!0}),[[-.015,.05,.01],[.017,.055,-.008],[0,.075,.004]].map(([e,t,n],r)=>(0,q.jsx)(`mesh`,{position:[e,t,n],material:G(`#ff9f1c`),children:(0,q.jsx)(`sphereGeometry`,{args:[R.ball.r,12,10]})},r))]})]})});function vi(){return(0,K.useSyncExternalStore)(B,mt),[`west`,`east`].map(e=>ut(e)?null:(0,q.jsx)(`group`,{position:[J.x+(e===`west`?-1:1)*(J.len/2-.42),J.top-.16,J.z+J.wid/2+.025],rotation:[.08,Math.PI,0],children:(0,q.jsx)(mi,{})},e))}function yi(e,t,n){return e?e===`player`?n:t[e]??`?`:``}function bi(e,t,n,r,i,a,o){if(Ce(e,0,0,t,n,26),e.fillStyle=`#15151f`,e.fill(),e.textAlign=`center`,e.textBaseline=`middle`,!r||r.phase===`waiting`){let i=r&&(r.west||r.east);e.fillStyle=`#ffd166`,e.font=`700 52px ${T}`,e.fillText(`🏓`,t/2,n*.33),e.font=`700 34px ${T}`,e.fillStyle=`#f8f9fa`,e.fillText(i?`Waiting for a player…`:`Fancy a game? E at an end`,t/2,n*.7);return}let s=i===`west`?`east`:`west`;for(let[c,l]of[[i,t*.27],[s,t*.73]]){let i=yi(r[c],a,o);for(e.font=`600 30px ${T}`;i.length>3&&e.measureText(i).width>t*.42;)i=i.slice(0,-2);e.fillStyle=`#ced4da`,e.fillText(i,l,n*.2),e.fillStyle=r.phase===`over`&&r.last?.winner===c?`#06d6a0`:`#ffd166`,e.font=`800 104px ${T}`,e.fillText(String(r.score[c]),l,n*.6),r.server===c&&r.phase!==`over`&&(e.fillStyle=`#ff9f1c`,e.beginPath(),e.arc(l,n*.9,9,0,Math.PI*2),e.fill())}e.fillStyle=`#6c757d`,e.font=`800 70px ${T}`,e.fillText(`:`,t/2,n*.58)}function xi(){let e=(0,K.useSyncExternalStore)(B,mt),t=w(e=>e.agents),n=w(e=>e.settings.managerName.trim().split(/\s+/)[0]||`You`),r={};for(let e of Object.values(t))r[e.id]=e.name;let i=[e?.phase,e?.west,e?.east,e?.score.west,e?.score.east,e?.server,e?.last?.winner,n,e?.west&&r[e.west],e?.east&&r[e.east]],a=kt(512,300,t=>bi(t,512,300,e,`west`,r,n),i),o=kt(512,300,t=>bi(t,512,300,e,`east`,r,n),i),s=.56,c=.33;return(0,q.jsxs)(`group`,{position:[J.x,J.top+.42,J.z-J.wid/2-.1],children:[(0,q.jsx)(U,{size:[.03,J.top+.42,.03],position:[0,-(J.top+.42)/2,0],color:`#212529`,shadow:!1}),(0,q.jsx)(U,{size:[.24,.02,.18],position:[0,-(J.top+.42)+.01,0],color:`#212529`,shadow:!1}),(0,q.jsxs)(`mesh`,{material:G(`#2b2d42`),children:[(0,q.jsx)(`boxGeometry`,{args:[.6000000000000001,.37,.03]}),(0,q.jsx)(bt,{thickness:.01,color:di})]}),(0,q.jsxs)(`mesh`,{position:[0,0,.016],children:[(0,q.jsx)(`planeGeometry`,{args:[s,c]}),(0,q.jsx)(`meshBasicMaterial`,{map:a,toneMapped:!1})]}),(0,q.jsxs)(`mesh`,{position:[0,0,-.016],rotation:[0,Math.PI,0],children:[(0,q.jsx)(`planeGeometry`,{args:[s,c]}),(0,q.jsx)(`meshBasicMaterial`,{map:o,toneMapped:!1})]})]})}var Si=7;function Ci(e,t,n,r,i){if(Ce(e,0,0,t,n,30),e.fillStyle=`#1b4332`,e.fill(),e.lineWidth=10,e.strokeStyle=`#d4a373`,Ce(e,5,5,t-10,n-10,26),e.stroke(),e.textBaseline=`middle`,e.textAlign=`center`,e.fillStyle=`#ffd166`,e.font=`800 54px ${T}`,e.fillText(`🏓 PING-PONG LADDER`,t/2,62),e.font=`600 26px ${T}`,e.fillStyle=`rgba(255,255,255,0.7)`,e.fillText(`games won – lost on this floor`,t/2,108),!r.length){e.font=`600 36px ${T}`,e.fillStyle=`#f8f9fa`,e.fillText(`No games yet.`,t/2,n/2+20),e.fillText(`Pick up a paddle!`,t/2,n/2+70);return}let a=(n-150-24)/Si;r.slice(0,Si).forEach((n,r)=>{let o=150+a*(r+.5),s=n.id===W;s&&(e.fillStyle=`rgba(255,209,102,0.18)`,Ce(e,28,o-a/2+4,t-56,a-8,14),e.fill()),e.textAlign=`left`,e.font=`800 40px ${T}`,e.fillStyle=r===0?`#ffd166`:`#f8f9fa`,e.fillText(`${r+1}.`,48,o);let c=s?`${i} (you)`:n.name;for(e.font=`600 40px ${T}`;c.length>3&&e.measureText(c).width>t*.52;)c=c.slice(0,-2);e.fillText(c,118,o),e.textAlign=`right`,e.font=`700 40px ${T}`,e.fillText(`${n.wins}–${n.losses}`,t-48,o)})}function wi({repoId:e}){let t=w(t=>t.pong[e])??Ti,n=w(e=>e.settings.managerName.trim().split(/\s+/)[0]||`You`),r=kt(768,666,e=>Ci(e,768,666,t,n),[t,n]),i=ye;return(0,q.jsxs)(`group`,{position:[i.x,i.y,11.97],rotation:[0,Math.PI,0],children:[(0,q.jsxs)(`mesh`,{material:G(`#7f5539`),children:[(0,q.jsx)(`boxGeometry`,{args:[i.w+.06,i.h+.06,.03]}),(0,q.jsx)(bt,{thickness:.012,color:di})]}),(0,q.jsxs)(`mesh`,{position:[0,0,.017],children:[(0,q.jsx)(`planeGeometry`,{args:[i.w,i.h]}),(0,q.jsx)(`meshBasicMaterial`,{map:r,toneMapped:!1})]})]})}var Ti=[];function Ei({repoId:e}){return(0,q.jsxs)(`group`,{children:[(0,q.jsx)(_i,{}),(0,q.jsx)(vi,{}),(0,q.jsx)(xi,{}),(0,q.jsx)(wi,{repoId:e})]})}var Di=`#1f1d2b`,Oi=new I(.16,.16),ki=null;function Ai(){if(ki)return ki;let e=document.createElement(`canvas`);e.width=e.height=64;let t=e.getContext(`2d`);t.font=`700 54px ${T}`,t.textAlign=`center`,t.textBaseline=`middle`,t.lineWidth=9,t.lineJoin=`round`,t.strokeStyle=Di,t.fillStyle=`#ffffff`,t.strokeText(`z`,32,30),t.fillText(`z`,32,30);let n=new M(e);return n.colorSpace=j,ki=new Ye({map:n,transparent:!0,depthWrite:!1,toneMapped:!1}),ki}function ji({on:e,position:t}){let n=(0,K.useRef)(null),r=F(e=>e.camera),i=(0,K.useMemo)(()=>({parent:new $e,camera:new $e}),[]);return P(()=>{let t=n.current;if(!t||(t.visible=e.current,!e.current||!t.parent))return;t.parent.getWorldQuaternion(i.parent),t.quaternion.copy(i.parent.invert().multiply(r.getWorldQuaternion(i.camera)));let a=performance.now()/1e3;for(let e=0;e<t.children.length;e++){let n=t.children[e],r=(a*.4+e/3)%1,i=r<.15?r/.15:r>.75?(1-r)/.25:1;n.position.set(r*.16+Math.sin(r*7+e)*.03,r*.38,0),n.scale.setScalar(Math.max(.001,(.45+r*.75)*i)),n.rotation.z=Math.sin(r*5+e)*.25}}),(0,q.jsx)(`group`,{ref:n,position:t,visible:!1,userData:bn,children:[0,1,2].map(e=>(0,q.jsx)(`mesh`,{geometry:Oi,material:Ai(),renderOrder:2},e))})}var Mi=.1,Ni=.05,Pi=3,Fi={x:0,y:0,z:0},Ii=null;function Li(){let e=Re(),t=m(`typing`);if(!e||!t)return null;if(Ii?.ctx===e.ctx)return Ii;try{let{ctx:n}=e,r=()=>{let e=k(n,Fi);return e.connect(t),e},i=n.createBuffer(1,n.sampleRate,n.sampleRate),a=i.getChannelData(0);for(let e=0;e<a.length;e++)a[e]=Math.random()*2-1;return Ii={ctx:n,voices:Array.from({length:6},r),crowd:r(),noise:i},Ii}catch{return null}}var Ri=e=>e.positionX?{x:e.positionX.value,y:e.positionY.value,z:e.positionZ.value}:null;function zi(e,t,n,r){let i=ne(n);if(!i||(r.occluded=!0,r.gain*=i.gain,!e||!t))return t;let a=e.ctx.createBiquadFilter();a.type=`lowpass`,a.frequency.value=i.cutoff;let o=e.ctx.createGain();return o.gain.value=i.gain,a.connect(o).connect(t),a}var Bi={woo:{dur:.46,pitch:[.85,1.28,.92],f1:[300,370,340],f2:[640,920,820],breath:0},yay:{dur:.42,pitch:[1.06,1.3,1],f1:[290,620,450],f2:[2250,1850,2150],breath:0},hey:{dur:.34,pitch:[1.18,1.24,.95],f1:[520,580,420],f2:[1800,1900,2150],breath:.06}};function Vi(e,[t,n,r],i,a,o,s){e.setValueAtTime(t*i,a),e.exponentialRampToValueAtTime(n*i,o),e.exponentialRampToValueAtTime(r*i,s)}function Hi(e,t,n,r,i,a,o){let s=e.ctx.createBufferSource();s.buffer=e.noise;let c=e.ctx.createBiquadFilter();c.type=`bandpass`,c.frequency.value=a,c.Q.value=o;let l=e.ctx.createGain();l.gain.setValueAtTime(1e-4,n),l.gain.exponentialRampToValueAtTime(i,n+Math.min(.02,r*.3)),l.gain.exponentialRampToValueAtTime(1e-4,n+r),s.connect(c).connect(l).connect(t),s.start(n,Math.random()*.8),s.stop(n+r+.02)}function Ui(e,t,n,r,i,a,o=1,s=1){let c=Bi[i];c.breath&&Hi(e,t,n,c.breath+.04,a*.45,1500*r.formant,.9);let l=n+c.breath,u=l+c.dur*s,d=l+c.dur*s*.3,f=r.pitch*o*(.96+Math.random()*.08),p=e.ctx.createOscillator();p.type=`sawtooth`,Vi(p.frequency,c.pitch,f,l,d,u);let m=e.ctx.createBiquadFilter();m.type=`bandpass`,m.Q.value=2.5,Vi(m.frequency,c.f1,r.formant,l,d,u);let h=e.ctx.createBiquadFilter();h.type=`bandpass`,h.Q.value=5,Vi(h.frequency,c.f2,r.formant,l,d,u);let g=e.ctx.createGain();g.gain.value=.45+r.bright*.6;let ee=e.ctx.createGain();return ee.gain.setValueAtTime(1e-4,l),ee.gain.exponentialRampToValueAtTime(a*Pi,l+.04),ee.gain.exponentialRampToValueAtTime(a*Pi*.7,u-.1*s),ee.gain.exponentialRampToValueAtTime(1e-4,u),p.connect(m).connect(ee),p.connect(h).connect(g).connect(ee),ee.connect(t),p.start(l),p.stop(u+.05),u}function Wi(e,t,n,r){let i=Ui(e,t,n,r,r.word,Mi);if(r.extra===`woo`)Ui(e,t,i+.08+Math.random()*.1,r,`woo`,Mi*.55,1.12,.8);else if(r.extra===`clap`)for(let n=0;n<3;n++)Hi(e,t,i+.05+n*.14+Math.random()*.03,.045,Mi*.6,1200+Math.random()*400,1.3)}function Gi(e,t,n,r){let{ctx:i}=e,a=i.createGain();a.gain.value=r*Pi,a.connect(t);let o=i.createBiquadFilter();o.type=`bandpass`,o.frequency.value=620,o.Q.value=2.5;let s=i.createBiquadFilter();s.type=`bandpass`,s.frequency.value=1900,s.Q.value=4;let c=i.createGain();c.gain.value=.5,o.connect(a),s.connect(c).connect(a);for(let e=0;e<4;e++){let e=n+dt(Math.random()),t=.5+Math.random()*.25,r=230+Math.random()*190,a=i.createOscillator();a.type=`sawtooth`,Vi(a.frequency,Bi.yay.pitch,r,e,e+t*.3,e+t);let c=i.createGain();c.gain.setValueAtTime(1e-4,e),c.gain.exponentialRampToValueAtTime(.5,e+.08),c.gain.exponentialRampToValueAtTime(1e-4,e+t),a.connect(c),c.connect(o),c.connect(s),a.start(e),a.stop(e+t+.05)}Hi(e,a,n+.1,1.1,.15,2e3,.6)}var Ki=64,qi=Array.from({length:Ki},()=>({voice:null,x:0,y:0,z:0,d:0})),Y=[],Ji=!1,Yi=-1/0;function Xi(e,t,n,r){if(Y.length>=Ki)return;let i=qi[Y.length];i.voice=e,i.x=t,i.y=n,i.z=r,Y.push(i),Ji||(Ji=!0,queueMicrotask(Zi))}function Zi(){Ji=!1;let e=performance.now(),t=w.getState();if(!document.hidden&&t.travel===null&&t.overlay===null&<(Yi,e,Te.celebrateUntil-6e3)&&Y.length){Yi=e;try{Qi()}catch{}}for(let e of Y)e.voice=null;Y.length=0}function Qi(){let e=c();for(let t of Y)t.d=xe(e,t);let t=gt(Y),n=Li(),r=n?n.ctx.currentTime+vt:0;if(t.voiced.forEach((e,t)=>{let i=Y[e],a={x:i.x,y:i.y,z:i.z},o=n?.voices[t];o&&f(o,a.x,a.y,a.z);let s=se(`cheer:${i.voice.word}`,{group:`typing`,pos:a,peak:Mi,played:!!o});s.from=o?Ri(o):null;let c=zi(n,o,a,s);n&&c&&Wi(n,c,r+dt(Math.random()),i.voice)}),!t.crowd.length)return;let i={x:0,y:0,z:0};for(let e of t.crowd)i.x+=Y[e].x/t.crowd.length,i.y+=Y[e].y/t.crowd.length,i.z+=Y[e].z/t.crowd.length;let a=Ni*_t(t.crowd.length);n&&f(n.crowd,i.x,i.y,i.z);let o=se(`cheer:crowd`,{group:`typing`,pos:i,peak:a,played:!!n});o.from=n?Ri(n.crowd):null;let s=zi(n,n?.crowd,i,o);n&&s&&Gi(n,s,r+.05,a)}var $i={pitch:-.34,yaw:.26},ea={typing:{l:$i,r:$i,lean:.1,headPitch:-.02,headYaw:0,type:1,mouse:0},browsing:{l:$i,r:{pitch:-.4,yaw:-.22},lean:.06,headPitch:.05,headYaw:.04,type:.25,mouse:1},thinking:{l:$i,r:{pitch:.55,yaw:.95},lean:.02,headPitch:.1,headYaw:-.12,type:.3,mouse:0},relaxed:{l:{pitch:-.9,yaw:.35},r:{pitch:-.9,yaw:.35},lean:-.1,headPitch:.06,headYaw:0,type:0,mouse:0},cheer:{l:{pitch:1.45,yaw:-.35},r:{pitch:1.45,yaw:-.35},lean:-.05,headPitch:.2,headYaw:0,type:0,mouse:0},slump:{l:{pitch:-1.35,yaw:-.15},r:{pitch:-1.35,yaw:-.15},lean:.25,headPitch:-.45,headYaw:0,type:0,mouse:0}},ta=e=>({...e,l:{...e.l},r:{...e.r}}),na=Xe.lerp,ra={person:!0},ia=Ut.shell,X={x:.11,seatY:.5,seatZ:-.04,standY:.815,thigh:.32},aa={x:.62,z:-.1},oa=.18,sa=[0,1.98,-1.12],ca={pitch:-1.42,yaw:-.1},la={at:[0,-.02,-.52],ahead:-.07,scale:1.3,sipTilt:1},ua={none:{l:null,r:null,head:0},reach:{l:null,r:{pitch:1.05,yaw:.05},head:.15},post:{l:null,r:{pitch:1.05,yaw:.05},head:.15},hold:{l:{pitch:-.45,yaw:.4},r:{pitch:-.45,yaw:.4},head:-.05},sip:{l:null,r:{pitch:.7,yaw:.85},head:.25},stretch:{l:{pitch:1.55,yaw:.22},r:{pitch:1.55,yaw:.22},head:.3},stoop:{l:{pitch:-1,yaw:.3},r:{pitch:-1,yaw:.3},head:-.5},shoot:{l:{pitch:1.2,yaw:.35},r:{pitch:1.2,yaw:.35},head:.35},toss:{l:{pitch:.35,yaw:.3},r:{pitch:.35,yaw:.3},head:.05},catch:{l:{pitch:-.1,yaw:.1},r:{pitch:-.1,yaw:.1},head:.1},shrug:{l:{pitch:-.7,yaw:-.75},r:{pitch:-.7,yaw:-.75},head:-.12},mug:{l:null,r:{pitch:-.75,yaw:.3},head:-.05},tap:{l:null,r:{pitch:-.3,yaw:.05},head:-.3},chat:{l:{pitch:-.55,yaw:-.45},r:{pitch:-.75,yaw:.3},head:.08},cheer:{l:ea.cheer.l,r:ea.cheer.r,head:ea.cheer.headPitch},wave:{l:null,r:{pitch:1.25,yaw:-.3},head:.1},talk:{l:null,r:{pitch:-.3,yaw:.45},head:.05},take:{l:null,r:{pitch:.75,yaw:-.3},head:.1},windup:{l:{pitch:.2,yaw:.3},r:{pitch:2.1,yaw:.05},head:.1},strike:{l:{pitch:-.6,yaw:.2},r:{pitch:-.25,yaw:.25},head:0},point:{l:null,r:{pitch:.6,yaw:-.12},head:.28},gasp:{l:{pitch:.72,yaw:.95},r:{pitch:.72,yaw:.95},head:.18},clap:{l:{pitch:.05,yaw:.62},r:{pitch:.05,yaw:.62},head:.08},nod:{l:null,r:null,head:-.05},thumbs:{l:null,r:{pitch:.45,yaw:.25},head:.12},call:{l:{pitch:-.75,yaw:.55},r:{pitch:.62,yaw:.8},head:.06},shake:{l:null,r:{pitch:-.12,yaw:.15},head:.08},paddle:{l:{pitch:-.5,yaw:.5},r:{pitch:-.35,yaw:-.25},head:.05}},da={hand:-.5,blade:-.17},fa={l:ea.cheer.l,r:ea.cheer.r,head:ea.cheer.headPitch},pa={pitch:-.12,yaw:-.55},ma={pitch:.55,yaw:.7},ha=(e,t,n)=>Me(Math.min(1,Math.max(0,(e-t)/(n-t)))),Z=(e,t,n)=>{e.pitch=t,e.yaw=n};function ga(e,t,n,r,i){switch(i.lw=i.rw=i.leanW=i.pitchW=i.yaw=i.roll=i.twist=i.spin=0,e){case`leanBack`:Z(i.l,2.45,.75),Z(i.r,2.45,.75),i.lw=i.rw=i.leanW=i.pitchW=1,i.lean=-.2+Math.sin(n*1.4)*.025,i.pitch=.14;break;case`spin`:i.spin=Math.sin(t*Math.PI*2)*.55,i.yaw=-i.spin*.5;break;case`phone`:Z(i.l,-.3,.6),Z(i.r,-.26+(Math.sin(n*11)>.4?.04:0),.55),i.lw=i.rw=i.pitchW=i.leanW=1,i.pitch=-.42,i.lean=.05;break;case`sip`:{let e=ha(t,.3,.45)-ha(t,.62,.77);Z(i.r,pa.pitch+(ma.pitch-pa.pitch)*e,pa.yaw+(ma.yaw-pa.yaw)*e),i.rw=1,i.twist=-.32*(1-e),i.lean=.16*(1-e),i.leanW=1,i.pitch=.28*e,i.pitchW=e;break}case`doze`:i.pitch=-.6+Math.sin(t*.9)*.05+(Math.sin(t*.37)>.97?.12:0),i.pitchW=1,i.roll=.16,i.lean=.08,i.leanW=1;break;case`neckRoll`:{let e=t*Math.PI*2.4;i.pitch=Math.sin(e)*.24-.05,i.pitchW=1,i.roll=Math.cos(e)*.3;break}case`shoulders`:Z(i.l,.05,1.35),i.lw=1,i.yaw=.3,i.twist=-.12;break;case`scratch`:Z(i.r,1.42+Math.sin(n*17)*.06,.6+Math.sin(n*17+1)*.05),i.rw=1,i.roll=-.14,i.pitch=.04,i.pitchW=1;break;case`facepalm`:Z(i.r,.73,.6),i.rw=1,i.pitch=-.3,i.pitchW=1,i.yaw=Math.sin(n*5)*.12,i.lean=.12,i.leanW=1;break;case`fistPump`:Z(i.r,1.15+Math.max(0,Math.sin(t*Math.PI*6))*.45,-.15),i.rw=1,i.pitch=.18,i.pitchW=1,i.lean=-.06,i.leanW=1;break;case`wave`:Z(r>0?i.l:i.r,1.3,-.3+Math.sin(n*10)*.35),r>0?i.lw=1:i.rw=1,i.yaw=Math.max(-1.1,Math.min(1.1,r*.7)),i.twist=Math.max(-.4,Math.min(.4,r*.3)),i.pitch=.08,i.pitchW=1}return i}function _a({agent:e,chair:t,mug:n,carrying:r,standAt:o=aa,scale:c=1,children:f}){let m=(0,K.useRef)(null),g=(0,K.useRef)(null),ne=(0,K.useRef)(null),ie=(0,K.useRef)(null),oe=(0,K.useRef)(ta(ea.relaxed)),se=(0,K.useMemo)(()=>S(e.id),[e.id]),v=(0,K.useRef)({name:null,at:0}),y=(0,K.useMemo)(()=>zt(e),[e.id,e.look,e.role,e.style]),fe=(0,K.useRef)(null),pe=(0,K.useRef)(null),me=(0,K.useRef)(null),ge=(0,K.useRef)(null),ve=(0,K.useRef)(null),ye=(0,K.useRef)(null),be=(0,K.useRef)(null),xe=(0,K.useRef)(null),Se=(0,K.useRef)(null),Ce=(0,K.useRef)(null),Te=(0,K.useRef)(null),Ee=(0,K.useRef)(null),Oe=(0,K.useRef)(null),T=(0,K.useRef)(null),E=(0,K.useRef)(null),Pe=(0,K.useRef)(null),Ie=(0,K.useSyncExternalStore)(s,()=>je(e.id)),D=(0,K.useSyncExternalStore)(s,()=>De(e.id)),O=(0,K.useSyncExternalStore)(s,()=>x(e.id)),k=(0,K.useMemo)(()=>({s:C(),g:{stride:0,cadence:0,bob:0,lean:0},placed:!1,gl:0,gr:0,gh:0,l:{...ca},r:{...ca},bat:new N,shoulder:new N,q:new $e}),[]),Re=(0,K.useMemo)(()=>({v:ht(e.id,e.look),party:!1,head:new N}),[e.id,e.look]),A=(0,K.useMemo)(()=>({s:Nn(e.id,performance.now()/1e3,n!=null),o:{l:{...ca},r:{...ca},lw:0,rw:0,lean:0,leanW:0,pitch:0,pitchW:0,yaw:0,roll:0,twist:0,spin:0},stretch:null,tx:0,tz:0,toward:0,browse:0,rest:null,held:!1,v:new N}),[e.id,n]),Be=(0,K.useRef)(!1),Ve=(0,K.useRef)(null),j=(0,K.useRef)(null),He=Kr(e.id,pe),Ue=w(t=>re(e,t.repos,e.prNumber==null?void 0:t.qa[b(e.repoId,e.prNumber)])),We=(0,K.useMemo)(()=>({s:p(),seed:_(e.id)%10007}),[e.id]),M=(0,K.useRef)(null),F=(0,K.useMemo)(()=>({expression:We.s.expression,lid:0,look:y}),[We]);F.look=y,(0,K.useEffect)(()=>i(e.id,F),[e.id,F]),e.currentTool&&(v.current={name:e.currentTool,at:performance.now()}),(0,K.useEffect)(()=>h(e.id,k.s),[e.id,k]),(0,K.useEffect)(()=>yr(e.id,A.s),[e.id,A]),(0,K.useEffect)(()=>()=>{A.stretch&&Ne(e.id)===A.stretch&&le(e.id)},[e.id,A]),(0,K.useEffect)(()=>st(e.id),[e.id]),P((r,i)=>{let s=Math.min(i,.1),c=performance.now(),f=c/1e3+se,p=_e(e.repoId,c);p&&!Re.party&&g.current&&(g.current.getWorldPosition(Re.head),Xi(Re.v,Re.head.x,Re.head.y,Re.head.z)),Re.party=p;let h=k.s,re=fe.current,_=Ne(e.id);if(re){re.visible=!we(e.id),k.placed||=(re.updateWorldMatrix(!0,!1),!0);let t=re.matrixWorld.elements;h.seatX=t[12],h.seatZ=t[14],h.seatHeading=Math.atan2(t[8],t[10]),h.standX=t[0]*o.x+t[8]*o.z+t[12],h.standZ=t[2]*o.x+t[10]*o.z+t[14],he(h,_??null,s);let n=pe.current;if(n&&h.stage===`seated`)n.position.set(0,0,0),n.rotation.y=0;else if(n){let e=h.x-t[12],r=h.z-t[14];n.position.set(t[0]*e+t[2]*r,0,t[8]*e+t[10]*r),n.rotation.y=h.heading-h.seatHeading}let r=h.stage===`up`?_?.gesture??`none`:`none`,i=h.stage===`up`&&ce()===e.id,a=p&&!i?fa:ua[r],c=1-Math.exp(-s*6);a.l&&Object.assign(k.l,a.l),a.r&&Object.assign(k.r,a.r);let l=h.stage===`up`&&!p?rt(e.id):null;if(l&&m.current){m.current.localToWorld(k.shoulder.set(.25*Lt(y),.44,0));let e=k.bat.set(l.x,l.y,l.z).sub(k.shoulder).applyQuaternion(m.current.getWorldQuaternion(k.q).invert()).normalize();k.r.yaw=Math.asin(Math.max(-1,Math.min(1,-e.x))),k.r.pitch=Math.atan2(e.y,-e.z)}if(r===`wave`&&(k.r.yaw+=Math.sin(f*9)*.4),r===`shake`&&(k.r.pitch+=Math.sin(f*11)*.13),r===`talk`&&(k.r.pitch+=Math.sin(f*4.3)*.18,k.r.yaw+=Math.sin(f*2.6)*.2),r===`clap`&&!p){let e=Math.abs(Math.sin(f*7))*.3;k.l.yaw-=e,k.r.yaw-=e}T.current&&(T.current.visible=r===`hold`),k.gl+=(+!!a.l-k.gl)*c,k.gr+=(+!!a.r-k.gr)*(l?1-Math.exp(-s*25):c),k.gh+=(a.head-k.gh)*c,ct(e.id,h,h.stage===`up`?_?.gesture??`none`:`none`,s,t[13]),Ce.current&&(Ce.current.visible=i),Te.current&&(Te.current.visible=h.stage===`up`&&ft(e.id))}let b=h.stage===`seated`,x=Me(h.sit),S=1-x,De=de(h.speed,k.g),C=Math.min(1,h.speed/.5),w=Math.sin(h.phase)*De.stride*C,je=-De.bob*C*Math.sin(h.phase)**2;t?.current&&(E.current??=t.current.position.z,t.current.position.z=E.current+oa*S);let Ie=e.status===`working`||e.status===`preparing`,D=p||e.status===`done`&&e.endedAt!=null&&Date.now()-e.endedAt<7e3,O=p?`cheer`:te(e.status,e.currentTool,v.current.name,c-v.current.at,D),N=ea[O],P=oe.current,I=1-Math.exp(-s*5);for(let e of[`l`,`r`])P[e].pitch+=(N[e].pitch-P[e].pitch)*I,P[e].yaw+=(N[e].yaw-P[e].yaw)*I;for(let e of[`lean`,`headPitch`,`headYaw`,`type`,`mouse`])P[e]+=(N[e]-P[e])*I;let Ge=u(f),Ke=P.type*Ge*.1,qe=Fe(e.status),Je=ae(f,qe,a.l)*Ke,Ye=ae(f,qe,a.r)*Ke*(1-P.mouse),Xe=Math.sin(f*3.1)*.05*P.type,Ze=Math.sin(f*2.7+1)*.05*P.type,Qe=Math.sin(f*1.9)*.06*P.mouse,$e=ke(f)*P.mouse,et=D?Math.sin(f*9)*.35:0,tt=p?et*S:0,nt=-(y.height-1)*.55,L=He.pose(c),it=L.flinch*.55,R=A.s,at=c/1e3,z=_r(e.id);if(z&&(zn(R,z.fidget,at),re)){let e=re.matrixWorld.elements,t=z.x-e[12],n=z.z-e[14];A.toward=Math.atan2(-(e[0]*t+e[2]*n),-(e[8]*t+e[10]*n))}L.w>0&&Bn(R,at);let ot=_!=null&&_===A.stretch;Vn(R,_&&!ot||D||e.status===`preparing`||e.status===`error`?`busy`:Ie?O===`browsing`?`browsing`:O===`thinking`?`thinking`:`working`:`idle`,at);let B=Hn(R,at);R.fidget===`stretch`&&B<.8?!A.stretch&&!_&&b&&B<.2&&(Le(e.id,{mode:`standing`,x:h.standX,z:h.standZ,heading:h.seatHeading,speed:Ae,gesture:`stretch`}),A.stretch=Ne(e.id)??null):A.stretch&&=(Ne(e.id)===A.stretch&&le(e.id),null);let V=Un(R,at),H=ga(V>0?R.fidget:null,B,f,A.toward,A.o),st=H.lw*V,U=H.rw*V;A.browse+=(+(O===`browsing`)-A.browse)*(1-Math.exp(-s*1.2)),Be.current=b&&R.fidget===`doze`&&V>.5;let lt=h.stage===`up`&&(_?.gesture===`shake`||_?.gesture===`cheer`),ut=ue(e.id,c)??l({status:e.status,hit:L.w>0,cheering:D||lt,asleep:Be.current,drowsy:d(R.mood===`idle`?at-R.moodSince:0,!Ie&&e.endedAt!=null?(Date.now()-e.endedAt)/1e3:0),pr:Ue,justMerged:Date.now()-gr(e.id)<9e4});ze(We.s,ut,s),F.expression=ut,F.lid=Be.current?1:ee(f,We.seed),Rt(M,We.s,F.lid),Ve.current&&(Ve.current.visible=b&&R.fidget===`phone`&&V>.35||h.stage===`up`&&_?.gesture===`call`),b&&pe.current&&(pe.current.rotation.y=H.spin*V),t?.current&&(t.current.rotation.y=b?H.spin*V:0);let dt=Math.sin(f*1.1)*.03*(1-C),pt=(ca.pitch-w*1.1+dt)*(1-k.gl)+k.l.pitch*k.gl,mt=ca.yaw*(1-k.gl)+k.l.yaw*k.gl,ht=(ca.pitch+w*1.1+dt)*(1-k.gr)+k.r.pitch*k.gr,gt=ca.yaw*(1-k.gr)+k.r.yaw*k.gr;if(ne.current&&ie.current){ne.current.rotation.set(na(P.l.pitch+nt+Je,H.l.pitch,st)*x+pt*S+it,na(-(P.l.yaw+Xe)+et,-H.l.yaw,st)*x-mt*S+tt,0),ie.current.rotation.set(na(P.r.pitch+nt+Ye-$e,H.r.pitch,U)*x+ht*S+it,na(P.r.yaw+Ze*(1-P.mouse)+Qe-et,H.r.yaw,U)*x+gt*S-tt,0);let e=Ee.current;e&&Te.current?.visible&&e.rotation.set(-ie.current.rotation.x,-ie.current.rotation.y,0,`YXZ`);let t=Pe.current;if(t){let e=!p&&_?.gesture===`sip`?k.gr*la.sipTilt:0;t.rotation.set(e-ie.current.rotation.x,-ie.current.rotation.y,0,`YXZ`),t.visible=!b}}if(m.current){let e=Math.sin(f*1.6)*.015,t=na(P.lean,H.lean,H.leanW*V)+A.browse*.1;m.current.rotation.x=(-t+e+(Ie?Math.sin(f*9)*.006*Ge:0))*x+(e-De.lean*C)*S+L.flinch*.2,m.current.rotation.y=L.twist*L.w+Math.sin(h.phase)*.1*C*S+H.twist*V*x,m.current.rotation.z=(Math.sin(f*.5)*.03*(1-C)+Math.sin(h.phase)*.035*C)*S,m.current.position.set(0,X.seatY*x+(X.standY+je)*S,-(y.height-1)*.25*x)}if(me.current&&(me.current.visible=b),ge.current&&(ge.current.visible=!b),!b&&ve.current&&ye.current&&be.current&&xe.current){let e=.3+De.stride,t=Math.sin(f*.5)*.15*(1-C),n=-(Math.max(0,Math.cos(h.phase))*e*C+Math.max(0,t)+.04),r=-(Math.max(0,-Math.cos(h.phase))*e*C+Math.max(0,-t)+.04),i=X.seatY*x+(X.standY+je)*S,a=X.seatZ*x;ve.current.position.set(-X.x,i,a),ye.current.position.set(X.x,i,a),ve.current.rotation.x=Math.PI/2*x+(w-n*.4)*S,ye.current.rotation.x=Math.PI/2*x+(-w-r*.4)*S,be.current.rotation.x=-Math.PI/2*x+n*S,xe.current.rotation.x=-Math.PI/2*x+r*S}if(Oe.current&&(Oe.current.position.y=(X.standY-X.seatY)*S),Se.current){let[e,t,n]=sa;Se.current.position.set(e*x,t*x+(X.standY+y.height*1.18+.26)*S,n*x)}if(g.current){let t=Ie&&Math.sin(f*.55+2)>.92?-.22:0,n=e.status===`preparing`?Math.sin(f*1.3)*.5:Math.sin(f*.4)*.08,r=h.stage===`up`&&_?.gesture===`nod`?Math.max(0,Math.sin(f*6))*.22:0,i=na(P.headPitch+t+(Ie?Math.sin(f*4.5)*.02*Ge:0),H.pitch,H.pitchW*V)*x+(Math.sin(f*.3)*.05+k.gh-r)*S,a=(n+P.headYaw+H.yaw*V)*x+Math.sin(f*.4)*.15*(1-C)*S;g.current.rotation.set(i+(L.headPitch-i)*L.w,a+(L.headYaw-a)*L.w,((O===`thinking`?.12:0)+H.roll*V)*x*(1-L.w))}let W=n?.current;if(W){let e=R.fidget===`sip`&&b?ha(B,.2,.3)-ha(B,.78,.88):0;e>0&&j.current&&W.parent?(A.rest??=W.position.clone(),j.current.getWorldPosition(A.v),W.parent.worldToLocal(A.v),W.position.lerpVectors(A.rest,A.v,e),W.rotation.x=.7*(ha(B,.3,.45)-ha(B,.62,.77)),A.held=!0):A.held&&A.rest&&(W.position.copy(A.rest),W.rotation.x=0,A.held=!1)}});let I=e.status===`working`||e.status===`preparing`;return(0,q.jsx)(`group`,{ref:fe,userData:ra,children:(0,q.jsxs)(`group`,{ref:pe,scale:c,children:[(0,q.jsx)(`group`,{ref:Oe,children:He.bubble}),(0,q.jsx)(ji,{on:Be,position:[.24,1.6,-.14]}),(0,q.jsxs)(`group`,{ref:me,children:[(0,q.jsx)(Ct,{geometry:Bt.legs,color:ia,castShadow:!0,outline:.008}),(0,q.jsx)(Ct,{geometry:Bt.shoes,color:It,castShadow:!0})]}),(0,q.jsx)(`group`,{ref:ge,visible:!1,children:[{hip:ve,knee:be,x:-X.x},{hip:ye,knee:xe,x:X.x}].map(({hip:e,knee:t,x:n})=>(0,q.jsxs)(`group`,{ref:e,position:[n,X.seatY,X.seatZ],rotation:[Math.PI/2,0,0],children:[(0,q.jsx)(Ct,{geometry:Bt.joint,color:It}),(0,q.jsx)(Ct,{geometry:Bt.thigh,color:ia,castShadow:!0,outline:.008}),(0,q.jsxs)(`group`,{ref:t,position:[0,-X.thigh,0],rotation:[-Math.PI/2,0,0],children:[(0,q.jsx)(Ct,{geometry:Bt.joint,color:It}),(0,q.jsx)(Ct,{geometry:Bt.shin,color:ia,castShadow:!0,outline:.008}),(0,q.jsx)(Ct,{geometry:Bt.shoe,color:It,castShadow:!0})]})]},n))}),(0,q.jsxs)(`group`,{ref:m,position:[0,.5,-(y.height-1)*.25],scale:y.height,children:[(0,q.jsx)(Ht,{agent:e,look:y,busy:I}),(0,q.jsx)(`group`,{scale:[Lt(y),1,Mt[y.build].depth],children:(0,q.jsx)(ui,{agent:e,look:y,part:`body`})}),[{ref:ne,x:-.25},{ref:ie,x:.25}].map(({ref:t,x:n})=>(0,q.jsxs)(`group`,{ref:t,position:[n*Lt(y),.44,0],children:[(0,q.jsx)(Gt,{agent:e,look:y}),t===ie&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`group`,{ref:j,position:[0,.03,-.56]}),(0,q.jsxs)(`group`,{ref:Ve,position:[-.03,.06,-.52],rotation:[.7,-.55,0],visible:!1,children:[(0,q.jsx)(Ct,{geometry:Wt.phone,color:It}),(0,q.jsx)(`mesh`,{geometry:Wt.phoneScreen,material:G(`#8ecae6`,{emissive:`#8ecae6`,emissiveIntensity:.5})})]}),D&&(0,q.jsx)(`group`,{position:la.at,children:(0,q.jsx)(Jn,{kind:D})}),O&&(0,q.jsx)(`group`,{position:la.at,children:(0,q.jsx)(rr,{snack:O.snack,left:O.left})}),Ie&&(0,q.jsx)(`group`,{ref:Pe,position:la.at,visible:!1,children:(0,q.jsx)(`group`,{position:[0,0,la.ahead],rotation:[0,-Math.PI/2,0],scale:la.scale,children:(0,q.jsx)(at,{color:it(Ie.id),sips:Ie.sips,shadow:!1})})}),(0,q.jsxs)(`group`,{ref:Te,position:[0,0,da.hand],visible:!1,children:[(0,q.jsx)(z,{r:.014,h:.1,position:[0,0,-.05],rotation:[Math.PI/2,0,0],color:`#d4a373`,shadow:!1}),(0,q.jsx)(`group`,{ref:Ee,position:[0,0,da.blade],children:(0,q.jsx)(mi,{handle:!1})})]}),(0,q.jsxs)(`group`,{ref:Ce,position:[0,0,-.5],rotation:[.5,0,0],visible:!1,children:[(0,q.jsx)(z,{r:.025,h:.55,position:[0,0,-.27],rotation:[Math.PI/2,0,0],color:`#f1d19b`,shadow:!1}),(0,q.jsx)(H,{r:.12,position:[0,0,-.56],color:`#e76f51`,outline:!0,shadow:!1}),(0,q.jsx)(z,{r:.125,h:.05,position:[0,0,-.56],rotation:[Math.PI/2,0,0],color:`#f4a261`,shadow:!1})]})]})]},n)),(0,q.jsxs)(`group`,{ref:g,position:[0,.7,0],scale:1.12,children:[(0,q.jsx)(Vt,{agent:e,look:y,busy:I,face:M}),(0,q.jsx)(`group`,{scale:[1.4,1.15,1.15],children:(0,q.jsx)(ui,{agent:e,look:y,part:`head`})}),t&&(0,q.jsx)(pn,{id:e.id,geometry:Bt.head})]}),r&&(0,q.jsx)(`group`,{ref:T,visible:!1,children:r})]}),(0,q.jsx)(li,{id:e.id,y:X.standY+y.height*1.18+.4}),f&&(0,q.jsx)(`group`,{ref:Se,position:sa,children:f})]})})}var va=e=>e.seatedFor>=e.restless,ya={x:0,z:12.9},ba=1.2,xa={name:`arrive`,work:!0,when:()=>!1,spot:[],steps:[{gesture:`none`,seconds:1.1,turn:.8},{gesture:`none`,seconds:1.1,turn:-.8},{gesture:`wave`,seconds:1.8,face:`peer`},{gesture:`none`,seconds:.4,face:`peer`}]},Sa={name:`leave`,work:!0,when:()=>!1,spot:[],steps:[{gesture:`reach`,seconds:1.1},{gesture:`hold`,seconds:.6}],carry:`hold`};function Ca(e,t,n){let r=o(e,t,n);return r&&[{x:t.x,z:t.z},...r]}function wa(e,t,n){let r=o(e,n,t);return r&&[{x:n.x,z:n.z},...r,ya]}function Ta(e,t){let n=null,r=1/0;for(let i of t){if(i.id===e.id)continue;let t=Math.hypot(i.x-e.x,i.z-e.z);t<r&&(r=t,n=i)}return n}var Ea=(e,t)=>Math.atan2(-(t.x-e.x),-(t.z-e.z));function Da(e,t){let n=t.filter(t=>t.id!==e.id&&t.role!==`ceo`&&t.status===`working`).filter(t=>Math.hypot(t.home.x-e.home.x,t.home.z-e.home.z)<=9);return Ta({id:e.id,...e.home},n.map(e=>({...e,x:e.home.x,z:e.home.z})))}function Oa(e){let{x:t,z:n,facing:r}=e.home;return{id:`visit-${e.id}`,x:t-Math.sin(r)*.45,z:n+Math.cos(r)*.45,facing:r}}V({name:`visit`,when:(e,t)=>e.role!==`ceo`&&t.floor===`office`&&ot(e.status)&&va(t)&&!!t.home&&!!t.others&&!!Da({id:e.id,home:t.home},t.others),spot:[],place:(e,t)=>{let n=t.home&&t.others?Da({id:e.id,home:t.home},t.others):null;return n&&Oa(n)},steps:[{gesture:`none`,seconds:2.5},{gesture:`none`,seconds:2,turn:.15},{gesture:`talk`,seconds:1.6},{gesture:`none`,seconds:1}],weight:.7}),V({name:`stroll`,when:(e,t)=>e.role===`ceo`&&t.floor===`lobby`&&ot(e.status)&&va(t),spot:[`reception`,`window-*`],steps:[{gesture:`none`,seconds:3},{gesture:`none`,seconds:2,turn:.6},{gesture:`none`,seconds:2,turn:-.5}],weight:2});var ka={cooler:{x:13.9,z:-9.4},couch:{x:-12.6,z:8.6}},Aa={name:`chat`,when:()=>!1,spot:[],steps:[{gesture:`none`,seconds:1.5},{gesture:`talk`,seconds:3,say:!0},{gesture:`none`,seconds:3.5},{gesture:`talk`,seconds:2.5,say:!0},{gesture:`none`,seconds:3},{gesture:`talk`,seconds:3,say:!0},{gesture:`none`,seconds:3},{gesture:`talk`,seconds:2,say:!0},{gesture:`none`,seconds:1.5}]};function ja(e,t){if(t.sinceLast<40||!t.venues.length)return null;let n=t.cap-t.away;if(n<2)return null;let r=e.filter(e=>e.seatedFor>=e.restless);if(!r.length||t.rand()>=.6)return null;let i=r[Math.floor(t.rand()*r.length)],a=e=>Math.hypot(e.home.x-i.home.x,e.home.z-i.home.z),o=e.filter(e=>e.id!==i.id&&e.seatedFor>=8).sort((e,t)=>a(e)-a(t)),s=Math.min(t.rand()<.5?2:3,n,o.length+1);return s<2?null:{ids:[i.id,...o.slice(0,s-1).map(e=>e.id)],venue:t.venues[Math.floor(t.rand()*t.venues.length)]}}function Ma(e,t,n,r=.7){for(let i=0;i<12;i++){let a=i*Math.PI/6,o=[];for(let n=0;n<t;n++){let i=a+n*Math.PI*2/t,s=e.x+Math.cos(i)*r,c=e.z+Math.sin(i)*r;o.push({id:`chat-${n}`,x:s,z:c,facing:Math.atan2(e.z-c,e.x-s)})}if(o.every(e=>n(e.x,e.z)))return o}return null}function Na(e,t,n,r){let i=(e?.pulls??[]).map(e=>e.mergedAt?Date.parse(e.mergedAt):NaN).filter(e=>Number.isFinite(e)),a=t.filter(e=>e.status===`failed`||e.status===`needs-human`).map(e=>e.updatedAt),o=e=>e.length?Math.max(0,(r-Math.max(...e))/1e3):null;return{mergedAgo:o(i),failedAgo:o(a),working:n}}function Pa(e,t,n){return e===`🎉`?(t?.pulls??[]).filter(e=>e.mergedAt).sort((e,t)=>Date.parse(t.mergedAt)-Date.parse(e.mergedAt))[0]?.number??null:e===`🐛`?[...n].filter(e=>e.status===`failed`||e.status===`needs-human`).sort((e,t)=>t.updatedAt-e.updatedAt)[0]?.prNumber??null:null}function Fa(e){let t=e=>e!=null&&e<600;return[[`☕`,2],[`😂`,2],[`🚀`,e.working>0?2:.5],[`🎉`,t(e.mergedAgo)?5:.3],[`🐛`,t(e.failedAgo)?5:.3]]}function Ia(e,t){let n=Fa(e),r=t*n.reduce((e,[,t])=>e+t,0);for(let[e,t]of n)if(r-=t,r<0)return e;return n[0][0]}function La(e,t,n=Ee.seats.length){let r=new Map(t.map(e=>[e.id,e])),i=[];for(let t of e.list){let e=r.get(t.id);t.phase===`waiting`?e?.status===`pending`?i.push(t):e&&i.push({...t,phase:e.status===`approved`?`hired`:`declined`}):i.push(t)}let a=new Set(i.map(e=>e.seat)),o=new Set(i.map(e=>e.id)),s=0,c=t.filter(e=>e.kind===`hire`&&e.status===`pending`&&!o.has(e.id)).sort((e,t)=>e.createdAt-t.createdAt);for(let e of c){let t=0;for(;t<n&&a.has(t);)t++;t>=n?s++:(a.add(t),i.push({id:e.id,seat:t,phase:`waiting`}))}return i.length===e.list.length&&i.every((t,n)=>t===e.list[n])&&s===e.outside?e:{list:i,outside:s}}function Ra(e,t){return e.list.some(e=>e.id===t)?{...e,list:e.list.filter(e=>e.id!==t)}:e}function za(e,t){let n=new Map(e.map(e=>[e.id,e.status]));return t.filter(e=>e.kind===`hire`&&e.status===`approved`&&e.agentId&&n.get(e.id)===`pending`).map(e=>({agentId:e.agentId,repoId:e.repoId}))}function Ba(e,t){let n=[];for(let r of t)r.role!==`ceo`&&!e.has(r.id)&&n.push({agentId:r.id,repoId:r.repoId});return n}function Va(e,t){return e===`declined`?{gesture:`nod`,seconds:2,say:`🙂`}:t?{gesture:`shake`,seconds:3,say:`🤝`}:{gesture:`cheer`,seconds:2.2,say:`🎉`}}var Ha=1.1,Ua=e=>({x:Ee.x-.6,z:Ee.seats[e]??Ee.seats[0]});function Wa(e,t,n){let r=Ua(e),i=Math.hypot(r.x-t.x,r.z-t.z);if(i>4.5)return{at:r,near:!1};for(let e of[1,1.25,1.5]){if(e>=i)break;let a={x:t.x+(r.x-t.x)*e/i,z:t.z+(r.z-t.z)*e/i};if(n(a.x,a.z))return{at:a,near:!0}}return{at:r,near:!0}}var Ga=me.lobby.east.door,Ka={inside:{x:15.1,z:Ga},outside:{x:17.3,z:Ga},away:{x:17.3,z:Ie.maxZ-.9}};function qa(e,t){let n=O(e,`elevator`),r=n?o(e,t,n):null;return r&&[...r,ya]}function Ja(e,t){let n=o(e,t,Ka.inside);return n&&[...n,Ka.outside,Ka.away]}var Ya=[{what:`whiteboard`,ids:e=>e.spots.filter(e=>e.id.startsWith(`board-`)).sort((e,t)=>Math.abs(e.x)-Math.abs(t.x)).map(e=>e.id),gesture:`none`,seconds:2.2},{what:`coffee machine`,ids:()=>[`coffee`],gesture:`tap`,seconds:1.8},{what:`gong`,ids:()=>[`gong`],gesture:`none`,seconds:1.8}],Xa={m:1.6,s:2};function Za(e,t){let n=Ya.flatMap(t=>{let n=t.ids(e).map(t=>O(e,t)).find(e=>!!e);return n?[{spot:n,what:t.what,gesture:t.gesture,seconds:t.seconds}]:[]}),r=[],i=t;for(;n.length;){let e=e=>Math.hypot(e.spot.x-i.x,e.spot.z-i.z),t=n.reduce((t,r,i)=>e(r)<e(n[t])?i:t,0),[a]=n.splice(t,1);r.push(a),i=a.spot}return r}var Qa=.75;function $a(e,t,n){if(Math.hypot(t.x-e.x,t.z-e.z)>2)return{x:e.x,z:e.z};let r=-Math.sign(t.x-e.x),i=Math.abs(t.x-e.x)>.1?r:Math.sign((n?.x??e.x+1)-e.x)||1;return{x:e.x+i*Qa,z:e.z}}function eo(e,t){let n=0,r=!1,i=0,a=0,o={x:NaN,z:NaN},s=-1,c=null,l={x:0,z:0},u=()=>{n++,r=!1,i=0,a=0,s=-1,c=null,t.progress(e[n]??null)},d=f=>{let p=e[n];if(!p)return{do:`done`,x:f.x,z:f.z,heading:f.heading,gesture:`none`};let m=L(p.spot.facing);if(s<0){let e=Math.hypot(f.x-p.spot.x,f.z-p.spot.z);a=Math.hypot(f.x-o.x,f.z-o.z)<.02?a+f.dt:0,o={x:f.x,z:f.z};let n=r&&(f.arrived&&e<.6||e<Xa.m&&a>Xa.s);if(r=!0,i+=f.dt,i>30)return u(),d({...f,dt:0});if(!n)return{do:`walk`,x:p.spot.x,z:p.spot.z,heading:m,gesture:`none`};s=0,l={x:f.x,z:f.z},c=t.arrive(p,l)}return s+=f.dt,s<p.seconds?{do:`stand`,x:l.x,z:l.z,heading:m,gesture:p.gesture}:c&&s<p.seconds+1.2?{do:`stand`,x:l.x,z:l.z,heading:Ea(l,c),gesture:`wave`}:(u(),d({...f,dt:0}))};return t.progress(e[0]??null),{tick:d,end:()=>t.progress(null)}}var to=(e,t,n)=>Ta({id:e,...t},n),no=null,ro=new Map,Q=new Map,io=null,ao=new Set;function oo(e){no=e}function so(e,t=Date.now()){let n=ro.get(e);return ro.delete(e),n!==void 0&&t-n<3e5&&!Q.has(e)}function co(e,t){Q.set(e,{state:`touring`,stop:t[0]?.what??null,stops:t.map(e=>e.what),at:Date.now()})}function lo(e,t){let n=Q.get(e);n?.state===`touring`&&(n.stop=t?.what??null)}function uo(e,t){let n=Q.get(e);Q.set(e,{state:t,stop:null,stops:n?.stops??[],at:Date.now()}),Q.size>20&&Q.delete(Q.keys().next().value)}var fo=w.getState();if(fo.loaded&&!fo.replaying&&(io=new Set(Object.keys(fo.agents))),w.subscribe((e,t)=>{if(!e.loaded||e.replaying)return;if(!io){io=new Set(Object.keys(e.agents));return}if(e.agents===t.agents&&e.requests===t.requests)return;let n=Date.now();for(let[e,t]of ro)n-t>=3e5&&ro.delete(e);let r=e=>{io.has(e)||(io.add(e),Q.has(e)||ro.set(e,n))};if(e.agents!==t.agents)for(let t of Ba(io,Object.values(e.agents)))r(t.agentId);if(e.requests!==t.requests)for(let n of za(t.requests,e.requests))r(n.agentId)}),typeof window<`u`){let e=e=>{let t=w.getState().requests.find(t=>t.id===e),n=t?w.getState().repos.find(e=>e.id===t.repoId)?.floor??null:null;return{name:t?.name??null,cli:t?.cli??null,floor:n}};window.__swarmHiring={candidates:()=>no?.list.map(t=>({...t,...e(t.id)}))??null,seats:()=>no&&{seats:Ee.seats.map((e,t)=>({seat:t,z:e,candidate:no?.list.find(e=>e.seat===t)?.id??null})),outside:no.outside},tours:()=>({tours:Object.fromEntries(Q),due:[...ro.keys()]}),propose:(e=`hire`,t)=>A.demoPropose(e,t),interview:e=>w.getState().openOverlay({kind:`interview`,requestId:e})}}var $={ivory:`#faf8f5`,graphite:`#202b38`,metal:`#596d7b`,cyan:`#54dfff`,amber:`#ffbb66`,orange:`#e99743`,floor:`#cdd5d8`,rug:`#718797`,petrol:`#17485c`,ceiling:`#dce3e5`};function po(e){let t=Number.parseInt(e.slice(1),16);return`#`+[146,153,154].map((e,n)=>Math.round((t>>16-n*8&255)*.55+e*.45).toString(16).padStart(2,`0`)).join(``)}var mo=new We(1,1,1),ho=()=>{};function go({at:e,size:t,color:n=$.cyan}){return(0,q.jsx)(`mesh`,{geometry:mo,material:wt(n),position:e,scale:t,raycast:ho})}var _o=`#b9c2cf`;function vo({floorLabel:e,accent:t}){let n=(0,K.useRef)(null),i=(0,K.useRef)(null),a=(0,K.useRef)(0),o=(0,K.useRef)(null),{doorHalf:s,cabinHalf:c,depth:l,doorHeight:u}=g,d=12.15,f=At({id:`elevator`,label:`Use the elevator`,action:{kind:`elevator`}},3.5),p=At({id:`elevator-panel`,label:`Choose a floor`,action:{kind:`elevator`}},2.5),m=kt(512,128,t=>pe(t,512,128,[{text:e,size:56,color:`#7CFFB2`}],`#15151f`),[e]);return P((e,t)=>{let c=w.getState().travel,l=Ot.x,u=Ot.z-d,f=Math.hypot(l,u)<2.8;for(let e of r())e.stage!==`seated`&&Math.abs(e.x)<s+.6&&Math.abs(e.z-d)<2&&(f=!0);Kt.drawn&&Math.abs(Kt.x)<s+.6&&Math.abs(Kt.z-d)<2&&(f=!0);let p=c?.phase===`closing`?0:f||c?.phase===`opening`?1:0;a.current=Be()?p:a.current+(p-a.current)*(1-Math.exp(-t*5));let m=a.current*s*.98;n.current&&(n.current.position.x=-s/2-m),i.current&&(i.current.position.x=s/2+m),o.current&&(o.current.visible=Et().z!==1)}),(0,q.jsxs)(`group`,{ref:o,children:[(0,q.jsxs)(`group`,{ref:f,children:[(0,q.jsx)(U,{size:[.22,u+.1,.36],position:[-s-.05,(u+.1)/2,12],color:_o,outline:!0}),(0,q.jsx)(U,{size:[.22,u+.1,.36],position:[s+.05,(u+.1)/2,12],color:_o,outline:!0}),(0,q.jsx)(U,{size:[s*2+.32,.22,.36],position:[0,u+.08,12],color:_o,outline:!0}),(0,q.jsx)(`mesh`,{ref:n,position:[-s/2,u/2,d],material:G(`#d9dee6`),castShadow:!0,children:(0,q.jsx)(`boxGeometry`,{args:[s,u,.06]})}),(0,q.jsx)(`mesh`,{ref:i,position:[s/2,u/2,d],material:G(`#d9dee6`),castShadow:!0,children:(0,q.jsx)(`boxGeometry`,{args:[s,u,.06]})})]}),(0,q.jsxs)(`mesh`,{position:[0,u+.55,11.97],rotation:[0,Math.PI,0],children:[(0,q.jsx)(`planeGeometry`,{args:[1.6,.4]}),(0,q.jsx)(`meshBasicMaterial`,{map:m,toneMapped:!1})]}),(0,q.jsxs)(`group`,{position:[s+.55,1.2,11.97],rotation:[0,Math.PI,0],children:[(0,q.jsx)(U,{size:[.22,.4,.04],position:[0,0,0],color:_o,outline:!0}),(0,q.jsx)(`mesh`,{position:[0,.08,.025],material:wt(t),children:(0,q.jsx)(`circleGeometry`,{args:[.05,20]})}),(0,q.jsx)(`mesh`,{position:[0,-.08,.025],material:wt(`#ffffff`),children:(0,q.jsx)(`circleGeometry`,{args:[.05,20]})})]}),(0,q.jsxs)(`group`,{position:[0,0,12],children:[(0,q.jsx)(`mesh`,{position:[0,.01,l/2],rotation:[-Math.PI/2,0,0],receiveShadow:!0,material:G(`#8d7b68`),children:(0,q.jsx)(`planeGeometry`,{args:[c*2,l]})}),(0,q.jsx)(`mesh`,{position:[0,u+.2,l/2],rotation:[Math.PI/2,0,0],material:G(`#f1f3f5`),children:(0,q.jsx)(`planeGeometry`,{args:[c*2,l]})}),(0,q.jsx)(`mesh`,{position:[0,u+.18,l/2],rotation:[Math.PI/2,0,0],material:wt(`#fff6d6`),children:(0,q.jsx)(`circleGeometry`,{args:[.45,32]})}),[-1,1].map(e=>(0,q.jsx)(`mesh`,{position:[e*(c+.05),v/2,(l+.05)/2],material:G(`#c8ced8`),children:(0,q.jsx)(`boxGeometry`,{args:[.1,v,l-.05]})},e)),(0,q.jsx)(`mesh`,{position:[0,v/2,l+.05],material:G(`#c8ced8`),children:(0,q.jsx)(`boxGeometry`,{args:[c*2+.2,v,.1]})}),(0,q.jsx)(U,{size:[c*2-.2,.05,.08],position:[0,.95,l-.05],color:`#e9c46a`,outline:!0}),(0,q.jsxs)(`group`,{ref:p,position:[c-.02,1.25,.9],rotation:[0,-Math.PI/2,0],children:[(0,q.jsx)(U,{size:[.36,.7,.04],position:[0,0,0],color:_o,outline:!0}),[.22,.08,-.06,-.2].map((e,n)=>(0,q.jsx)(`mesh`,{position:[0,e,.025],material:wt(n===0?t:`#fdfdfd`),children:(0,q.jsx)(`circleGeometry`,{args:[.04,16]})},e))]})]})]})}function yo(e){let t=e.length&&yt(e)||new Ze;for(let t of e)t.dispose();return t}var bo=e=>yo(e.map(({size:e,at:t})=>new We(...e).translate(...t))),xo=.5;function So(){let e=document.createElement(`canvas`);e.width=e.height=128;let t=e.getContext(`2d`),n=t.createRadialGradient(64,64,0,64,64,64);n.addColorStop(0,`rgba(255,255,255,1)`),n.addColorStop(.42,`rgba(255,255,255,0.8)`),n.addColorStop(.5,`rgba(255,255,255,0.35)`),n.addColorStop(.8,`rgba(255,255,255,0.22)`),n.addColorStop(1,`rgba(255,255,255,0)`),t.fillStyle=n,t.fillRect(0,0,128,128);let r=new M(e);return r.colorSpace=j,r}var Co=new Ye({map:So(),color:`#ffcf85`,transparent:!0,opacity:0,blending:2,depthWrite:!1,toneMapped:!1,fog:!1,visible:!1,userData:Je}),wo={ceiling:new I(3.2,2).rotateX(Math.PI/2),bulb:new I(1.5,1.5).rotateX(Math.PI/2)},To=new qe(`#d6d0c2`),Eo=new qe(`#fffbe8`),Do=Ge(new Ye({color:To,toneMapped:!1}),`night`),Oo=0,ko=()=>Oo;function Ao(e){Oo=e,Co.opacity=e*xo,Co.visible=e>.01,Do.color.lerpColors(To,Eo,e)}function jo({positions:e,size:t=`ceiling`}){let n=(0,K.useRef)(null);return(0,K.useLayoutEffect)(()=>{let t=n.current;if(!t)return;let r=new Ke;e.forEach(([e,n,i],a)=>t.setMatrixAt(a,r.makeTranslation(e,n+.02,i))),t.instanceMatrix.needsUpdate=!0},[e]),(0,q.jsx)(`instancedMesh`,{ref:n,args:[wo[t],Co,e.length],frustumCulled:!1})}var Mo=.06,No=.1,Po=.08,Fo=.06;function Io(e){let{w:t,h:n,y:r}=fe;return Oe.flatMap(i=>{let{door:a,windows:o}=me[e][i],s=r-n/2+Mo,c=r+n/2-No;return[...o.flatMap(e=>[{side:i,z0:e-t/2+Po,z1:e-Fo,y0:s,y1:c},{side:i,z0:e+Fo,z1:e+t/2-Po,y0:s,y1:c}]),{side:i,z0:a-E.half,z1:a+E.half,y0:0,y1:E.h}]})}var Lo=[new Float32Array(16),new Float32Array(16)];function Ro(e,t,n,r,i,a){let o=0;for(let s=0;s<t;s++){let c=(s+1)%t,l=(e[s*2+r]-i)*a,u=(e[c*2+r]-i)*a;if(l>=0&&(n[o*2]=e[s*2],n[o*2+1]=e[s*2+1],o++),l>=0!=u>=0){let t=l/(l-u);n[o*2]=e[s*2]+(e[c*2]-e[s*2])*t,n[o*2+1]=e[s*2+1]+(e[c*2+1]-e[s*2+1])*t,o++}}return o}function zo(e,t,n){let r=oe(e.side),[i,a,o]=t;if(a<=0||i*r<=0)return 0;let s=r*16,c=Lo[0];for(let t=0;t<4;t++){let n=t===0||t===3?e.y0:e.y1,r=t<2?e.z0:e.z1;c[t*2]=s-i*n/a,c[t*2+1]=r-o*n/a}let l=4,u=Lo[1];for(let e=0;e<4;e++){l=Ro(c,l,u,e<2?0:1,e<2?16*(e===0?-1:1):12*(e===2?-1:1),e%2==0?1:-1);let t=c;if(c=u,u=t,l===0)return 0}for(let e=0;e<l*2;e++)n[e]=c[e];return l}var Bo=.2,Vo=.012,Ho=new Ye({color:0,transparent:!0,blending:2,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-4,side:2,fog:!1,visible:!1}),Uo={dir:[0,1,0],version:0};function Wo(e,t,n){Uo.dir[0]=e[0],Uo.dir[1]=e[1],Uo.dir[2]=e[2],Uo.version++,Ho.color.setHex(t).multiplyScalar(n*Bo),Ho.visible=n>.01}var Go=new Float32Array(16);function Ko({kind:e}){let t=(0,K.useMemo)(()=>Io(e),[e]),n=(0,K.useMemo)(()=>{let e=new Ze;e.setAttribute(`position`,new Ve(new Float32Array(t.length*8*3),3).setUsage(He));let n=[];for(let e=0;e<t.length;e++)for(let t=1;t<7;t++)n.push(e*8,e*8+t,e*8+t+1);return e.setIndex(n),e},[t]);(0,K.useEffect)(()=>()=>n.dispose(),[n]);let r=(0,K.useRef)(-1);return Nt(()=>{if(r.current===Uo.version)return;r.current=Uo.version;let e=n.attributes.position,i=e.array;for(let e=0;e<t.length;e++){let n=zo(t[e],Uo.dir,Go);for(let t=0;t<8;t++){let r=(e*8+t)*3,a=t<n?t:0;i[r]=n?Go[a*2]:0,i[r+1]=Vo,i[r+2]=n?Go[a*2+1]:0}}e.needsUpdate=!0}),(0,q.jsx)(`mesh`,{geometry:n,material:Ho,frustumCulled:!1,renderOrder:1})}var qo=$.ivory,Jo=`#1f1d2b`,Yo=null;function Xo(){if(Yo)return Yo;let e=document.createElement(`canvas`);e.width=256,e.height=128,y(e.getContext(`2d`),256,128);let t=new M(e);return t.colorSpace=j,Yo=new Ye({map:t,transparent:!0,depthWrite:!1,side:2,toneMapped:!1}),Yo}function Zo(e,t){let{door:n,windows:r}=me[e][t],{w:i,h:a,y:o}=fe;return[{z0:n-E.half,z1:n+E.half,y0:0,y1:E.h},...r.map(e=>({z0:e-i/2,z1:e+i/2,y0:o-a/2,y1:o+a/2}))].sort((e,t)=>e.z0-t.z0)}function Qo(e){let t=D,n=[];for(let r of Oe){let i=oe(r)*(16+t/2),a=-12;for(let o of Zo(e,r)){let e=(o.z0+o.z1)/2;o.z0>a&&n.push({size:[t,v,o.z0-a],at:[i,v/2,(a+o.z0)/2]}),o.y0>0&&n.push({size:[t,o.y0,o.z1-o.z0],at:[i,o.y0/2,e]}),n.push({size:[t,v-o.y1,o.z1-o.z0],at:[i,(o.y1+v)/2,e]}),a=o.z1}n.push({size:[t,v,12-a],at:[i,v/2,(a+12)/2]})}return bo(n)}function $o(e){let t=D+.06,n=[];for(let r of Oe){let i=oe(r)*(16+D/2);for(let a of Zo(e,r)){let e=(a.z0+a.z1)/2,r=a.z1-a.z0,o=a.y1-a.y0;if(a.y0===0){n.push({size:[t,.12,r+.24],at:[i,a.y1+.06,e]});for(let e of[a.z0-.06,a.z1+.06])n.push({size:[t,a.y1,.12],at:[i,a.y1/2,e]})}else{n.push({size:[t,.1,r],at:[i,a.y1-.05,e]}),n.push({size:[D+.22,.08,r+.2],at:[i,a.y0+.02,e]});for(let e of[a.z0+.04,a.z1-.04])n.push({size:[t,o,.08],at:[i,(a.y0+a.y1)/2,e]});n.push({size:[.12,o,.07],at:[i,(a.y0+a.y1)/2,e]})}}}return bo(n)}function es(e){let{w:t,h:n,y:r}=fe;return yo(Oe.flatMap(i=>me[e][i].windows.map(e=>new I(t,n).rotateY(Math.PI/2).translate(oe(i)*(16+D/2),r,e))))}function ts({kind:e}){let t=(0,K.useMemo)(()=>Qo(e),[e]),n=(0,K.useMemo)(()=>$o(e),[e]),r=(0,K.useMemo)(()=>es(e),[e]);return(0,K.useEffect)(()=>()=>[t,n,r].forEach(e=>e.dispose()),[t,n,r]),(0,q.jsxs)(`group`,{children:[(0,q.jsx)(`mesh`,{geometry:t,material:G(qo),receiveShadow:!0}),(0,q.jsx)(`mesh`,{geometry:n,material:G($.graphite),children:(0,q.jsx)(bt,{thickness:.018,color:Jo})}),(0,q.jsx)(`mesh`,{geometry:r,material:Xo(),renderOrder:1})]})}var ns=St(new I(1.25,.38),{shading:`glowNight`});function rs({position:e}){return(0,q.jsxs)(`group`,{position:e,children:[(0,q.jsx)(U,{size:[1.4,.06,.5],position:[0,0,0],color:$.graphite,shadow:!1}),(0,q.jsx)(xt,{look:ns,color:`#ffe4bc`,position:[0,-.035,0],rotation:[Math.PI/2,0,0]})]})}function is({kind:e,accent:t,floorColor:n}){let r=G(qo),i=.3,{doorHalf:a,doorHeight:o}=g,s=(0,K.useMemo)(()=>{let e=[];for(let t=-12;t<=12;t+=6)for(let n=-8;n<=8;n+=5.5)e.push([t,v-.04,n]);return e},[]),c=(0,K.useMemo)(()=>{let e=document.createElement(`canvas`);e.width=e.height=512;let t=e.getContext(`2d`);for(let e=0;e<2;e++){for(let r=-0;r<512;r+=256){let i=(e*7+Math.floor((r+0)/256)*3)%5*.012-.024;t.fillStyle=Tt(n,i),t.fillRect(r,e*256,256,256),t.fillStyle=Tt(n,-.1),t.fillRect(r,e*256,2,256),t.fillStyle=Tt(n,i-.035),t.fillRect(r+12,e*256+12,20,2),t.fillRect(r+12,e*256+12,2,20)}t.fillStyle=Tt(n,-.12),t.fillRect(0,e*256,512,2)}let r=new M(e);return r.colorSpace=j,r.wrapS=r.wrapT=Qe,r.repeat.set(8,6),r.anisotropy=8,r},[n]),l=16-a,u=Oe.flatMap(t=>{let n=oe(t),r=me[e][t].door;return[[-12,r-E.half-.12],[r+E.half+.12,12]].map(([e,t])=>({p:[n*15.98,0,(e+t)/2],r:-n*Math.PI/2,w:t-e}))});return(0,q.jsxs)(`group`,{children:[(0,q.jsxs)(`mesh`,{rotation:[-Math.PI/2,0,0],receiveShadow:!0,children:[(0,q.jsx)(`planeGeometry`,{args:[32,24]}),(0,q.jsx)(`meshToonMaterial`,{map:c})]}),(0,q.jsx)(`mesh`,{rotation:[Math.PI/2,0,0],position:[0,v,0],material:G($.ceiling),children:(0,q.jsx)(`planeGeometry`,{args:[32,24]})}),[-9,-3,3,9].map((e,t)=>(0,q.jsxs)(`group`,{children:[(0,q.jsx)(U,{size:[.34,.018,23.2],position:[e,v-.012,0],color:$.graphite,shadow:!1}),(0,q.jsx)(go,{at:[e-.11,v-.024,0],size:[.035,.006,22.8],color:t%2==0?$.cyan:$.amber}),[-8,-2.5,3,8.5].map(n=>(0,q.jsx)(go,{at:[e+.08,v-.024,n],size:[.1,.006,.65],color:t%2==0?$.amber:$.cyan},n))]},e)),s.map(e=>(0,q.jsx)(rs,{position:e},e.join())),(0,q.jsx)(jo,{positions:s}),(0,q.jsx)(Ko,{kind:e}),(0,q.jsx)(`mesh`,{position:[0,v/2,-12-i/2],material:r,receiveShadow:!0,children:(0,q.jsx)(`boxGeometry`,{args:[32.6,v,i]})}),(0,q.jsx)(ts,{kind:e}),[-1,1].map(e=>(0,q.jsx)(`mesh`,{position:[e*(a+l/2),v/2,12.15],material:r,receiveShadow:!0,children:(0,q.jsx)(`boxGeometry`,{args:[l,v,i]})},e)),(0,q.jsx)(`mesh`,{position:[0,(v+o)/2,12.15],material:r,children:(0,q.jsx)(`boxGeometry`,{args:[a*2,v-o,i]})}),[{p:[0,0,-11.98],r:0,w:32},...u,{p:[-(a+l/2),0,11.98],r:Math.PI,w:l},{p:[a+l/2,0,11.98],r:Math.PI,w:l}].map(({p:n,r,w:i},a)=>(0,q.jsxs)(`group`,{position:[n[0],0,n[2]],rotation:[0,r,0],children:[(0,q.jsx)(`mesh`,{position:[0,.06,0],material:G($.graphite),children:(0,q.jsx)(`boxGeometry`,{args:[i,.12,.04]})}),(0,q.jsx)(`mesh`,{position:[0,.95,0],material:G(t),children:(0,q.jsx)(`boxGeometry`,{args:[i,e===`office`?.06:.12,.03]})}),(0,q.jsx)(go,{at:[0,.98,.018],size:[i,.018,.006]}),(0,q.jsx)(`mesh`,{position:[0,v-.22,0],material:G($.graphite),children:(0,q.jsx)(`boxGeometry`,{args:[i,.26,.04]})}),(0,q.jsx)(go,{at:[0,v-.36,.025],size:[i,.025,.008],color:$.amber})]},a))]})}export{Sr as $,eo as A,Na as B,Wa as C,Va as D,Za as E,ka as F,ja as G,Ma as H,ba as I,_a as J,Oa as K,Sa as L,xa as M,ya as N,$a as O,Aa as P,Cr as Q,Ca as R,Ja as S,Ra as T,Ta as U,Ea as V,Ia as W,mi as X,ji as Y,Ei as Z,lo as _,vn as _t,Do as a,tr as at,Ha as b,an as bt,bo as c,Jn as ct,go as d,Zn as dt,Lr as et,$ as f,qn as ft,so as g,hn as gt,oo as h,xn as ht,jo as i,vr as it,to as j,La as k,yo as l,$n as lt,ao as m,bn as mt,Xo as n,Vr as nt,ko as o,rr as ot,po as p,yn as pt,Pa as q,Wo as r,Br as rt,Ao as s,ir as st,is as t,Rr as tt,vo as u,Qn as ut,uo as v,un as vt,qa as w,Ua as x,Jt as xt,co as y,ln as yt,wa as z};
|