@johpaz/hive-agents 1.1.5 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/README.md +4 -10
  2. package/dist/hive.js +218257 -148718
  3. package/dist/tool-worker.js +68422 -1622
  4. package/dist/ui/assets/{A2UIPage-Dr3p75oE.js → A2UIPage-v-VggXW3.js} +4 -4
  5. package/dist/ui/assets/{AgentCreateForm-DqYhH_gm.js → AgentCreateForm-Dr1l4Cvg.js} +1 -1
  6. package/dist/ui/assets/AgentDetailPage-Dsh_grrr.js +1 -0
  7. package/dist/ui/assets/{AgentNewPage-BRpFxJIT.js → AgentNewPage-D7557C0J.js} +1 -1
  8. package/dist/ui/assets/AgentsPage-C_Z56LL1.js +10 -0
  9. package/dist/ui/assets/{ApiClientPage-R9UDWfR2.js → ApiClientPage-uuBnrh0y.js} +1 -1
  10. package/dist/ui/assets/ChannelsPage-BI4mAgRU.js +8 -0
  11. package/dist/ui/assets/DashboardPage-BjAxvzYP.js +6 -0
  12. package/dist/ui/assets/LoginPage-D7IZKON0.js +1 -0
  13. package/dist/ui/assets/{LogsPage-DICMU_7m.js → LogsPage-mcqOYvGw.js} +1 -1
  14. package/dist/ui/assets/MeetingPage-qPJ1z5HA.js +1 -0
  15. package/dist/ui/assets/ModelSelector-njfNhkng.js +1 -0
  16. package/dist/ui/assets/{NotFound-D4ZlDVg9.js → NotFound-DY8e1RKh.js} +1 -1
  17. package/dist/ui/assets/{Office3DPage-31AMJ-LN.css → Office3DPage-C3SIzd2H.css} +1 -1
  18. package/dist/ui/assets/Office3DPage-Du42LRwi.js +319 -0
  19. package/dist/ui/assets/ProvidersPage-GDCJs8Zb.js +1 -0
  20. package/dist/ui/assets/{RecoverPage-Blms3NBa.js → RecoverPage-B6qvBBIl.js} +1 -1
  21. package/dist/ui/assets/SettingsPage-Br4PfWuc.js +9 -0
  22. package/dist/ui/assets/{SetupPage-CAjLseE_.js → SetupPage-OaouFLGD.js} +1 -1
  23. package/dist/ui/assets/{Vignette-DrI2yK2m.js → Vignette-GSZ-owcN.js} +17 -17
  24. package/dist/ui/assets/VoicePage-DRQZBl3j.js +307 -0
  25. package/dist/ui/assets/WebChatPage-Cypq-SYi.js +29 -0
  26. package/dist/ui/assets/{agentCapabilities-CDSfJWhw.js → agentCapabilities-Bf71Gir4.js} +1 -1
  27. package/dist/ui/assets/{alert-CjiX20jI.js → alert-Dn604uVs.js} +1 -1
  28. package/dist/ui/assets/{badge-B5AKge1b.js → badge-C6H33ePv.js} +1 -1
  29. package/dist/ui/assets/{card-mTJ4oZbL.js → card-D0qneq1i.js} +1 -1
  30. package/dist/ui/assets/{conversationsStore-DhM07qYi.js → conversationsStore-D6XgjMr1.js} +1 -1
  31. package/dist/ui/assets/{dialog-BP3GTCPn.js → dialog-DO1fQCF7.js} +1 -1
  32. package/dist/ui/assets/dist-js-C2MfmbEW.js +1 -0
  33. package/dist/ui/assets/{dist-js-CkNhvsFc.js → dist-js-Djxbxbst.js} +1 -1
  34. package/dist/ui/assets/google-external-e9lvWjy4.js +1 -0
  35. package/dist/ui/assets/index-BKNFH2al.css +2 -0
  36. package/dist/ui/assets/index-U0e4e5mL.js +156 -0
  37. package/dist/ui/assets/{key-DPkOY-J0.js → key-round-Ca0Ns34v.js} +1 -1
  38. package/dist/ui/assets/{label-D_fvqJyD.js → label-CvAtVE-v.js} +1 -1
  39. package/dist/ui/assets/{scroll-area-CbH8FOo8.js → scroll-area-CYMu7sU0.js} +1 -1
  40. package/dist/ui/assets/select-BjBXxyxL.js +1 -0
  41. package/dist/ui/assets/{slider-DXS4h1LB.js → slider-DR31eN3r.js} +1 -1
  42. package/dist/ui/assets/{switch-ndx8VCpm.js → switch-B5dAwb54.js} +1 -1
  43. package/dist/ui/assets/{tabs-epu-3Tl4.js → tabs-Ct92cLXr.js} +1 -1
  44. package/dist/ui/assets/{earth-BJRGJbVn.js → terminal-CpBDERBE.js} +1 -1
  45. package/dist/ui/assets/{textarea-BgZJFZTX.js → textarea-xtFAVuPf.js} +1 -1
  46. package/dist/ui/assets/{useAudioDevices-zj0fuGwZ.js → useAudioDevices-wZArmV3m.js} +1 -1
  47. package/dist/ui/assets/{useHiveAgentsModelLoad-Cd9p-bjs.js → useHiveAgentsModelLoad-CqJkzTOT.js} +1 -1
  48. package/dist/ui/assets/useOfficeModel-DZvwZRCw.js +1 -0
  49. package/dist/ui/assets/{useProviders-Dj1k5PCk.js → useProviders-CeSzDnx-.js} +1 -1
  50. package/dist/ui/assets/vendor-router-DxU0Uf4R.js +3 -0
  51. package/dist/ui/index.html +5 -5
  52. package/package.json +1 -3
  53. package/packages/cli/src/commands/onboard.ts +3 -2
  54. package/packages/core/src/agent/agent-catalog.ts +98 -1
  55. package/packages/core/src/agent/agent-loop.ts +5 -44
  56. package/packages/core/src/agent/context-compiler.ts +6 -94
  57. package/packages/core/src/agent/conversation-store.ts +23 -1
  58. package/packages/core/src/agent/llm-providers/openai-compat-base.ts +1 -1
  59. package/packages/core/src/agent/minimal-loadout.ts +1 -0
  60. package/packages/core/src/agent/prompt-builder.ts +17 -1
  61. package/packages/core/src/agent/tool-selector.ts +12 -0
  62. package/packages/core/src/artifacts/store.ts +73 -9
  63. package/packages/core/src/canvas/emitter.ts +0 -19
  64. package/packages/core/src/channels/base.ts +26 -0
  65. package/packages/core/src/channels/discord.ts +18 -2
  66. package/packages/core/src/channels/slack.ts +37 -7
  67. package/packages/core/src/channels/telegram.ts +39 -11
  68. package/packages/core/src/channels/whatsapp.ts +16 -1
  69. package/packages/core/src/gateway/channel-notify.ts +42 -0
  70. package/packages/core/src/gateway/google-host.ts +228 -0
  71. package/packages/core/src/gateway/initializer.ts +8 -0
  72. package/packages/core/src/gateway/routes/agents.ts +14 -0
  73. package/packages/core/src/gateway/routes/artifacts.ts +4 -0
  74. package/packages/core/src/gateway/routes/auth.ts +25 -3
  75. package/packages/core/src/gateway/routes/chat.ts +14 -1
  76. package/packages/core/src/gateway/routes/google.ts +252 -0
  77. package/packages/core/src/gateway/routes/meeting.ts +11 -3
  78. package/packages/core/src/gateway/routes/models.ts +27 -11
  79. package/packages/core/src/gateway/routes/multimodal.ts +38 -0
  80. package/packages/core/src/gateway/routes/providers.ts +19 -18
  81. package/packages/core/src/gateway/routes/system.ts +1 -3
  82. package/packages/core/src/gateway/routes/tts-local.ts +20 -374
  83. package/packages/core/src/gateway/routes/voice.ts +29 -35
  84. package/packages/core/src/gateway/server.ts +97 -48
  85. package/packages/core/src/gateway/tts/README.md +7 -86
  86. package/packages/core/src/gateway/tts/build.py +105 -0
  87. package/packages/core/src/gateway/tts/kitten.ts +282 -0
  88. package/packages/core/src/gateway/tts/python.d.ts +4 -0
  89. package/packages/core/src/gateway/tts/src/detect.ts +33 -39
  90. package/packages/core/src/gateway/tts/worker.py +80 -0
  91. package/packages/core/src/gateway/webchat-turn.ts +15 -13
  92. package/packages/core/src/google/client.ts +123 -0
  93. package/packages/core/src/google/config.ts +60 -0
  94. package/packages/core/src/google/google.test.ts +287 -0
  95. package/packages/core/src/google/index.ts +5 -0
  96. package/packages/core/src/google/oauth.ts +144 -0
  97. package/packages/core/src/google/scopes.ts +41 -0
  98. package/packages/core/src/google/token-store.ts +33 -0
  99. package/packages/core/src/multimodal/attachment-ingest.ts +190 -0
  100. package/packages/core/src/multimodal/image-generation.ts +244 -0
  101. package/packages/core/src/multimodal/vision-analyzer.ts +94 -0
  102. package/packages/core/src/multimodal/vision-service.ts +25 -0
  103. package/packages/core/src/storage/collections.ts +8 -8
  104. package/packages/core/src/storage/google-capabilities.ts +91 -0
  105. package/packages/core/src/storage/model-activation.ts +18 -0
  106. package/packages/core/src/storage/model-sync.ts +66 -14
  107. package/packages/core/src/storage/onboarding.ts +10 -2
  108. package/packages/core/src/storage/seed.ts +107 -24
  109. package/packages/core/src/storage/usage.ts +0 -52
  110. package/packages/core/src/tool-runtime/index.ts +2 -0
  111. package/packages/core/src/tools/agents/get-available-models.ts +1 -3
  112. package/packages/core/src/tools/core/index.ts +80 -2
  113. package/packages/core/src/tools/google/calendar.ts +204 -0
  114. package/packages/core/src/tools/google/drive.ts +160 -0
  115. package/packages/core/src/tools/google/gmail.ts +579 -0
  116. package/packages/core/src/tools/google/index.ts +18 -0
  117. package/packages/core/src/tools/google/shared.ts +80 -0
  118. package/packages/core/src/tools/image/image-generate.ts +90 -0
  119. package/packages/core/src/tools/image/index.ts +13 -0
  120. package/packages/core/src/tools/image/office-leer-imagenes.ts +198 -0
  121. package/packages/core/src/tools/index.ts +27 -0
  122. package/packages/core/src/tools/office/index.ts +9 -0
  123. package/packages/core/src/tools/office/office-editar-docx.ts +184 -0
  124. package/packages/core/src/tools/office/office-editar-pptx.ts +126 -0
  125. package/packages/core/src/tools/office/office-editar-xlsx.ts +122 -0
  126. package/packages/core/src/tools/office/office-escribir-docx.ts +3 -2
  127. package/packages/core/src/tools/office/office-escribir-pdf.ts +3 -2
  128. package/packages/core/src/tools/office/office-escribir-pptx.ts +3 -2
  129. package/packages/core/src/tools/office/office-escribir-xlsx.ts +3 -2
  130. package/packages/core/src/tools/office/office-images.ts +137 -0
  131. package/packages/core/src/tools/office/office-leer-docx.ts +16 -3
  132. package/packages/core/src/tools/office/office-leer-pdf.ts +41 -57
  133. package/packages/core/src/tools/office/office-leer-pptx.ts +54 -88
  134. package/packages/core/src/tools/office/office-leer-xlsx.ts +6 -2
  135. package/packages/core/src/tools/office/office-pdf-images.ts +225 -0
  136. package/packages/core/src/tools/office/pdf-text.ts +186 -0
  137. package/packages/core/src/tools/office/pptx-slides.ts +83 -0
  138. package/packages/core/src/tools/office/resolve-input.ts +49 -0
  139. package/packages/core/src/tools/web/browser-screenshot.ts +7 -0
  140. package/packages/core/src/voice/index.ts +123 -155
  141. package/packages/core/src/voice/local-model.ts +8 -0
  142. package/packages/core/src/voice/stt-models.ts +39 -0
  143. package/packages/skills/src/bundled/google/google_calendar/SKILL.md +51 -0
  144. package/packages/skills/src/bundled/google/google_drive/SKILL.md +50 -0
  145. package/packages/skills/src/bundled/google/google_gmail/SKILL.md +61 -0
  146. package/packages/skills/src/bundled-data.generated.ts +45 -0
  147. package/dist/ui/assets/AgentDetailPage-BVtE88U5.js +0 -1
  148. package/dist/ui/assets/AgentsPage-BOIJ55cj.js +0 -10
  149. package/dist/ui/assets/ChannelsPage-C5V2BmjL.js +0 -8
  150. package/dist/ui/assets/DashboardPage-B18gMzNj.js +0 -6
  151. package/dist/ui/assets/LoginPage-nrsYF9AY.js +0 -1
  152. package/dist/ui/assets/MeetingPage-xslJGfIz.js +0 -1
  153. package/dist/ui/assets/ModelSelector-BX4IvuYY.js +0 -1
  154. package/dist/ui/assets/Office3DPage-a6cuzt5X.js +0 -727
  155. package/dist/ui/assets/ProvidersPage-C8-xGoeh.js +0 -1
  156. package/dist/ui/assets/SettingsPage-BBeeq_QS.js +0 -9
  157. package/dist/ui/assets/VoicePage-BeSSYstD.js +0 -307
  158. package/dist/ui/assets/WebChatPage-Bat7uUfd.js +0 -29
  159. package/dist/ui/assets/dist-js-jWCEHSkB.js +0 -1
  160. package/dist/ui/assets/index-BG3nUPKq.js +0 -156
  161. package/dist/ui/assets/index-DmFPF9xQ.css +0 -2
  162. package/dist/ui/assets/lock-open-v0EphssG.js +0 -1
  163. package/dist/ui/assets/select-v_3QBYrD.js +0 -1
  164. package/dist/ui/assets/terminal-BEcTK780.js +0 -1
  165. package/dist/ui/assets/useOfficeModel-BaDn7U-X.js +0 -1
  166. package/dist/ui/assets/vendor-router-DSMCk-Ka.js +0 -3
  167. package/packages/core/src/agent/jev-decisions.ts +0 -242
  168. package/packages/core/src/agent/jev-planner.ts +0 -293
  169. package/packages/core/src/gateway/tts/package.json +0 -25
  170. package/packages/core/src/gateway/tts/src/client.ts +0 -59
  171. package/packages/core/src/gateway/tts/src/index.ts +0 -15
  172. package/packages/core/src/gateway/tts/src/install.ts +0 -137
  173. package/packages/core/src/gateway/tts/src/models.ts +0 -50
  174. package/packages/core/src/gateway/tts/src/server.ts +0 -253
  175. /package/dist/ui/assets/{core-p4c5dns5.js → core-npANj14X.js} +0 -0
  176. /package/dist/ui/assets/{download-BQXrpH0m.js → download-D0aDV8Y_.js} +0 -0
  177. /package/dist/ui/assets/{ellipsis-vertical-D7uFJLGh.js → ellipsis-vertical-BOW_iEOO.js} +0 -0
  178. /package/dist/ui/assets/{external-link-6oTH9pUM.js → external-link-DNJH7epD.js} +0 -0
  179. /package/dist/ui/assets/{eye-CxvxtQT5.js → eye-BVfTWOME.js} +0 -0
  180. /package/dist/ui/assets/{file-text-D5ZJEx3E.js → file-text-ByqNMpXm.js} +0 -0
  181. /package/dist/ui/assets/{gateway-url-BALS_wVh.js → gateway-url-BzQV75Ig.js} +0 -0
  182. /package/dist/ui/assets/{gauge-CEu7PhTW.js → gauge-CB4np0Vz.js} +0 -0
  183. /package/dist/ui/assets/{history-DLK5rTlP.js → history-CbhJX41s.js} +0 -0
  184. /package/dist/ui/assets/{info-8ReWzubE.js → info-BCD3-QX9.js} +0 -0
  185. /package/dist/ui/assets/{lock-3IApZyVy.js → lock-DpBean4K.js} +0 -0
  186. /package/dist/ui/assets/{mail-vwCEHyhQ.js → mail-Biwn8WrV.js} +0 -0
  187. /package/dist/ui/assets/{mic-CpDU_2as.js → mic-Rq4BxU1R.js} +0 -0
  188. /package/dist/ui/assets/{pause-BAMsNQkh.js → pause-87NGXbsz.js} +0 -0
  189. /package/dist/ui/assets/{pencil-CKritjT_.js → pencil-BG8EFaS3.js} +0 -0
  190. /package/dist/ui/assets/{play-Cwpe4tp6.js → play-D3De6YsQ.js} +0 -0
  191. /package/dist/ui/assets/{plus-RD44ce15.js → plus-Bp8-V68t.js} +0 -0
  192. /package/dist/ui/assets/{radio-lFPMHi6-.js → radio-m7rzuDKK.js} +0 -0
  193. /package/dist/ui/assets/{refresh-cw-DtJMHRHO.js → refresh-cw-D6F1zoC6.js} +0 -0
  194. /package/dist/ui/assets/{rotate-ccw-b3E_4PoX.js → rotate-ccw-DUlEC1_D.js} +0 -0
  195. /package/dist/ui/assets/{search-z2oZt00P.js → search-CfNwwpMW.js} +0 -0
  196. /package/dist/ui/assets/{send-CpoY_2F-.js → send-CI868CBV.js} +0 -0
  197. /package/dist/ui/assets/{settings-qV3kVkeG.js → settings-AEM2uWiD.js} +0 -0
  198. /package/dist/ui/assets/{shield-CIarwBvx.js → shield-DvVIcbzd.js} +0 -0
  199. /package/dist/ui/assets/{sparkles-DVvY6jDT.js → sparkles-DRe4GbSH.js} +0 -0
  200. /package/dist/ui/assets/{square-D5zdNkAY.js → square-DTWkjTT3.js} +0 -0
  201. /package/dist/ui/assets/{trash-2-D6oziYAK.js → trash-2-BZsMCfso.js} +0 -0
  202. /package/dist/ui/assets/{utils-DEmd_M8c.js → utils-lc8H6VGT.js} +0 -0
  203. /package/dist/ui/assets/{volume-2-EaA0JRvD.js → volume-2-CBMYsuF3.js} +0 -0
  204. /package/dist/ui/assets/{volume-x-CROXNMGT.js → volume-x-vNFf2e4-.js} +0 -0
  205. /package/dist/ui/assets/{wifi-BUJuOcgP.js → wifi-DNv53AfN.js} +0 -0
  206. /package/dist/ui/assets/{zap-DSoX9NDk.js → zap-Yed86Sh8.js} +0 -0
@@ -0,0 +1,319 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{n,t as r}from"./vendor-react-kUOwxn0g.js";import{o as i}from"./vendor-query-Dj8xYhQD.js";import{t as a}from"./createLucideIcon-BRaPSYgN.js";import{t as o}from"./activity-C_GS5wrG.js";import{t as s}from"./arrow-right-BuNjN-bk.js";import{t as c}from"./chevron-left-GK4EQOyZ.js";import{t as l}from"./chevron-right-BupZqrxu.js";import{t as u}from"./circle-check-BKNT2_q6.js";import{t as d}from"./gauge-CB4np0Vz.js";import{t as f}from"./radio-m7rzuDKK.js";import{t as p}from"./send-CI868CBV.js";import{t as m}from"./volume-2-CBMYsuF3.js";import{t as h}from"./volume-x-vNFf2e4-.js";import{n as g,t as _}from"./wifi-DNv53AfN.js";import{r as v}from"./gateway-url-BzQV75Ig.js";import{Q as y,R as b,S as x,rt as S,ut as C}from"./index-U0e4e5mL.js";import{t as w}from"./useOfficeModel-DZvwZRCw.js";import{E as T,Et as E,J as D,Tt as O,at as k,c as A,d as j,dt as ee,gt as M,i as N,it as P,l as F,m as I,n as L,ot as R,p as z,q as B,s as V,t as H,u as te,v as U,x as W,y as ne}from"./Vignette-GSZ-owcN.js";var G=a(`Crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),re=a(`SearchCheck`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),K=r(),q=e(t(),1);function ie(){let e=(0,K.c)(9),{agents:t,fetchAgents:n}=x(),r=b(ce),i=b(se),a=b(oe),o=b(ae),s,c;e[0]===n?(s=e[1],c=e[2]):(s=()=>{n()},c=[n],e[0]=n,e[1]=s,e[2]=c),(0,q.useEffect)(s,c);let{coordinator:l,desks:u,interactions:d}=w(t,r,i),f;return e[3]!==l||e[4]!==u||e[5]!==d||e[6]!==o||e[7]!==a?(f={coordinator:l,desks:u,interactions:d,workEvents:a,isConnected:o},e[3]=l,e[4]=u,e[5]=d,e[6]=o,e[7]=a,e[8]=f):f=e[8],f}function ae(e){return e.isConnected}function oe(e){return e.workEvents}function se(e){return e.graphEdges}function ce(e){return e.graphNodes}function le(){return typeof window>`u`?!1:window.localStorage.getItem(`office3d-sound`)===`on`}var J=v(e=>({selectedAgentId:null,quality:`high`,motion:`calm`,introDone:!1,soundEnabled:le(),activeCue:null,select:t=>e({selectedAgentId:t}),setQuality:t=>e({quality:t}),setMotion:t=>e({motion:t}),setIntroDone:()=>e({introDone:!0}),setSoundEnabled:t=>{typeof window<`u`&&window.localStorage.setItem(`office3d-sound`,t?`on`:`off`),e({soundEnabled:t})},setActiveCue:t=>e({activeCue:t})})),ue=e(n()),Y=new E,de=new E,fe=new E,pe=new O;function me(e,t,n){let r=Y.setFromMatrixPosition(e.matrixWorld);r.project(t);let i=n.width/2,a=n.height/2;return[r.x*i+i,-(r.y*a)+a]}function he(e,t){let n=Y.setFromMatrixPosition(e.matrixWorld),r=de.setFromMatrixPosition(t.matrixWorld),i=n.sub(r),a=t.getWorldDirection(fe);return i.angleTo(a)>Math.PI/2}function ge(e,t,n,r){let i=Y.setFromMatrixPosition(e.matrixWorld),a=i.clone();a.project(t),pe.set(a.x,a.y),n.setFromCamera(pe,t);let o=n.intersectObjects(r,!0);if(o.length){let e=o[0].distance;return i.distanceTo(n.ray.origin)<e}return!0}function _e(e,t){if(t instanceof k)return t.zoom;if(t instanceof R){let n=Y.setFromMatrixPosition(e.matrixWorld),r=de.setFromMatrixPosition(t.matrixWorld),i=t.fov*Math.PI/180,a=n.distanceTo(r);return 1/(2*Math.tan(i/2)*a)}else return 1}function ve(e,t,n){if(t instanceof R||t instanceof k){let r=Y.setFromMatrixPosition(e.matrixWorld),i=de.setFromMatrixPosition(t.matrixWorld),a=r.distanceTo(i),o=(n[1]-n[0])/(t.far-t.near),s=n[1]-o*t.far;return Math.round(o*a+s)}}var ye=e=>Math.abs(e)<1e-10?0:e;function be(e,t,n=``){let r=`matrix3d(`;for(let n=0;n!==16;n++)r+=ye(t[n]*e.elements[n])+(n===15?`)`:`,`);return n+r}var xe=(e=>t=>be(t,e))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Se=(e=>(t,n)=>be(t,e(n),`translate(-50%,-50%)`))(e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1]);function Ce(e){return e&&typeof e==`object`&&`current`in e}var we=q.forwardRef(({children:e,eps:t=.001,style:n,className:r,prepend:i,center:a,fullscreen:o,portal:s,distanceFactor:c,sprite:l=!1,transform:u=!1,occlude:d,onOcclude:f,castShadow:p,receiveShadow:m,material:h,geometry:g,zIndexRange:_=[16777271,0],calculatePosition:v=me,as:y=`div`,wrapperClass:b,pointerEvents:x=`auto`,...S},C)=>{let{gl:w,camera:T,scene:D,size:O,raycaster:k,events:ee,viewport:M}=z(),[N]=q.useState(()=>document.createElement(y)),P=q.useRef(),F=q.useRef(null),I=q.useRef(0),L=q.useRef([0,0]),R=q.useRef(null),B=q.useRef(null),V=s?.current||ee.connected||w.domElement.parentNode,H=q.useRef(null),te=q.useRef(!1),U=q.useMemo(()=>d&&d!==`blending`||Array.isArray(d)&&d.length&&Ce(d[0]),[d]);q.useLayoutEffect(()=>{let e=w.domElement;d&&d===`blending`?(e.style.zIndex=`${Math.floor(_[0]/2)}`,e.style.position=`absolute`,e.style.pointerEvents=`none`):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[d]),q.useLayoutEffect(()=>{if(F.current){let e=P.current=ue.createRoot(N);if(D.updateMatrixWorld(),u)N.style.cssText=`position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;`;else{let e=v(F.current,T,O);N.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return V&&(i?V.prepend(N):V.appendChild(N)),()=>{V&&V.removeChild(N),e.unmount()}}},[V,u]),q.useLayoutEffect(()=>{b&&(N.className=b)},[b]);let W=q.useMemo(()=>u?{position:`absolute`,top:0,left:0,width:O.width,height:O.height,transformStyle:`preserve-3d`,pointerEvents:`none`}:{position:`absolute`,transform:a?`translate3d(-50%,-50%,0)`:`none`,...o&&{top:-O.height/2,left:-O.width/2,width:O.width,height:O.height},...n},[n,a,o,O,u]),ne=q.useMemo(()=>({position:`absolute`,pointerEvents:x}),[x]);q.useLayoutEffect(()=>{if(te.current=!1,u){var t;(t=P.current)==null||t.render(q.createElement(`div`,{ref:R,style:W},q.createElement(`div`,{ref:B,style:ne},q.createElement(`div`,{ref:C,className:r,style:n,children:e}))))}else{var i;(i=P.current)==null||i.render(q.createElement(`div`,{ref:C,style:W,className:r,children:e}))}});let G=q.useRef(!0);j(e=>{if(F.current){T.updateMatrixWorld(),F.current.updateWorldMatrix(!0,!1);let e=u?L.current:v(F.current,T,O);if(u||Math.abs(I.current-T.zoom)>t||Math.abs(L.current[0]-e[0])>t||Math.abs(L.current[1]-e[1])>t){let t=he(F.current,T),n=!1;U&&(Array.isArray(d)?n=d.map(e=>e.current):d!==`blending`&&(n=[D]));let r=G.current;n?G.current=ge(F.current,T,k,n)&&!t:G.current=!t,r!==G.current&&(f?f(!G.current):N.style.display=G.current?`block`:`none`);let i=Math.floor(_[0]/2),a=d?U?[_[0],i]:[i-1,0]:_;if(N.style.zIndex=`${ve(F.current,T,a)}`,u){let[e,t]=[O.width/2,O.height/2],n=T.projectionMatrix.elements[5]*t,{isOrthographicCamera:r,top:i,left:a,bottom:o,right:s}=T,u=xe(T.matrixWorldInverse),d=r?`scale(${n})translate(${ye(-(s+a)/2)}px,${ye((i+o)/2)}px)`:`translateZ(${n}px)`,f=F.current.matrixWorld;l&&(f=T.matrixWorldInverse.clone().transpose().copyPosition(f).scale(F.current.scale),f.elements[3]=f.elements[7]=f.elements[11]=0,f.elements[15]=1),N.style.width=O.width+`px`,N.style.height=O.height+`px`,N.style.perspective=r?``:`${n}px`,R.current&&B.current&&(R.current.style.transform=`${d}${u}translate(${e}px,${t}px)`,B.current.style.transform=Se(f,1/((c||10)/400)))}else{let t=c===void 0?1:_e(F.current,T)*c;N.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}L.current=e,I.current=T.zoom}}if(!U&&H.current&&!te.current)if(u){if(R.current){let e=R.current.children[0];if(e!=null&&e.clientWidth&&e!=null&&e.clientHeight){let{isOrthographicCamera:t}=T;if(t||g)S.scale&&(Array.isArray(S.scale)?S.scale instanceof E?H.current.scale.copy(S.scale.clone().divideScalar(1)):H.current.scale.set(1/S.scale[0],1/S.scale[1],1/S.scale[2]):H.current.scale.setScalar(1/S.scale));else{let t=(c||10)/400,n=e.clientWidth*t,r=e.clientHeight*t;H.current.scale.set(n,r,1)}te.current=!0}}}else{let t=N.children[0];if(t!=null&&t.clientWidth&&t!=null&&t.clientHeight){let e=1/M.factor,n=t.clientWidth*e,r=t.clientHeight*e;H.current.scale.set(n,r,1),te.current=!0}H.current.lookAt(e.camera.position)}});let re=q.useMemo(()=>({vertexShader:u?void 0:`
2
+ /*
3
+ This shader is from the THREE's SpriteMaterial.
4
+ We need to turn the backing plane into a Sprite
5
+ (make it always face the camera) if "transfrom"
6
+ is false.
7
+ */
8
+ #include <common>
9
+
10
+ void main() {
11
+ vec2 center = vec2(0., 1.);
12
+ float rotation = 0.0;
13
+
14
+ // This is somewhat arbitrary, but it seems to work well
15
+ // Need to figure out how to derive this dynamically if it even matters
16
+ float size = 0.03;
17
+
18
+ vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
19
+ vec2 scale;
20
+ scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
21
+ scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
22
+
23
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
24
+ if ( isPerspective ) scale *= - mvPosition.z;
25
+
26
+ vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
27
+ vec2 rotatedPosition;
28
+ rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
29
+ rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
30
+ mvPosition.xy += rotatedPosition;
31
+
32
+ gl_Position = projectionMatrix * mvPosition;
33
+ }
34
+ `,fragmentShader:`
35
+ void main() {
36
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
37
+ }
38
+ `}),[u]);return q.createElement(`group`,A({},S,{ref:F}),d&&!U&&q.createElement(`mesh`,{castShadow:p,receiveShadow:m,ref:H},g||q.createElement(`planeGeometry`,null),h||q.createElement(`shaderMaterial`,{side:2,vertexShader:re.vertexShader,fragmentShader:re.fragmentShader})))}),Te=Object.defineProperty,Ee=(e,t,n)=>t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,X=(e,t,n)=>(Ee(e,typeof t==`symbol`?t:t+``,n),n);function De(e,t,n,r,i){let a;if(e=e.subarray||e.slice?e:e.buffer,n=n.subarray||n.slice?n:n.buffer,e=t?e.subarray?e.subarray(t,i&&t+i):e.slice(t,i&&t+i):e,n.set)n.set(e,r);else for(a=0;a<e.length;a++)n[a+r]=e[a];return n}function Oe(e){return e instanceof Float32Array?e:e instanceof ne?e.getAttribute(`position`).array:e.map(e=>{let t=Array.isArray(e);return e instanceof E?[e.x,e.y,e.z]:e instanceof O?[e.x,e.y,0]:t&&e.length===3?[e[0],e[1],e[2]]:t&&e.length===2?[e[0],e[1],0]:e}).flat()}var ke=class extends ne{constructor(){super(),X(this,`type`,`MeshLine`),X(this,`isMeshLine`,!0),X(this,`positions`,[]),X(this,`previous`,[]),X(this,`next`,[]),X(this,`side`,[]),X(this,`width`,[]),X(this,`indices_array`,[]),X(this,`uvs`,[]),X(this,`counters`,[]),X(this,`widthCallback`,null),X(this,`_attributes`),X(this,`_points`,[]),X(this,`points`),X(this,`matrixWorld`,new D),Object.defineProperties(this,{points:{enumerable:!0,get(){return this._points},set(e){this.setPoints(e,this.widthCallback)}}})}setMatrixWorld(e){this.matrixWorld=e}setPoints(e,t){if(e=Oe(e),this._points=e,this.widthCallback=t??null,this.positions=[],this.counters=[],e.length&&e[0]instanceof E)for(let t=0;t<e.length;t++){let n=e[t],r=t/(e.length-1);this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(let t=0;t<e.length;t+=3){let n=t/(e.length-1);this.positions.push(e[t],e[t+1],e[t+2]),this.positions.push(e[t],e[t+1],e[t+2]),this.counters.push(n),this.counters.push(n)}this.process()}compareV3(e,t){let n=e*6,r=t*6;return this.positions[n]===this.positions[r]&&this.positions[n+1]===this.positions[r+1]&&this.positions[n+2]===this.positions[r+2]}copyV3(e){let t=e*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]}process(){let e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];let t,n;n=this.compareV3(0,e-1)?this.copyV3(e-2):this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(let r=0;r<e;r++){if(this.side.push(1),this.side.push(-1),t=this.widthCallback?this.widthCallback(r/(e-1)):1,this.width.push(t),this.width.push(t),this.uvs.push(r/(e-1),0),this.uvs.push(r/(e-1),1),r<e-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);let e=r*2;this.indices_array.push(e,e+1,e+2),this.indices_array.push(e+2,e+1,e+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}n=this.compareV3(e-1,0)?this.copyV3(1):this.copyV3(e-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.counters.length?this._attributes={position:new U(new Float32Array(this.positions),3),previous:new U(new Float32Array(this.previous),3),next:new U(new Float32Array(this.next),3),side:new U(new Float32Array(this.side),1),width:new U(new Float32Array(this.width),1),uv:new U(new Float32Array(this.uvs),2),index:new U(new Uint16Array(this.indices_array),1),counters:new U(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute(`position`,this._attributes.position),this.setAttribute(`previous`,this._attributes.previous),this.setAttribute(`next`,this._attributes.next),this.setAttribute(`side`,this._attributes.side),this.setAttribute(`width`,this._attributes.width),this.setAttribute(`uv`,this._attributes.uv),this.setAttribute(`counters`,this._attributes.counters),this.setAttribute(`position`,this._attributes.position),this.setAttribute(`previous`,this._attributes.previous),this.setAttribute(`next`,this._attributes.next),this.setAttribute(`side`,this._attributes.side),this.setAttribute(`width`,this._attributes.width),this.setAttribute(`uv`,this._attributes.uv),this.setAttribute(`counters`,this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}advance({x:e,y:t,z:n}){let r=this._attributes.position.array,i=this._attributes.previous.array,a=this._attributes.next.array,o=r.length;De(r,0,i,0,o),De(r,6,r,0,o-6),r[o-6]=e,r[o-5]=t,r[o-4]=n,r[o-3]=e,r[o-2]=t,r[o-1]=n,De(r,6,a,0,o-6),a[o-6]=e,a[o-5]=t,a[o-4]=n,a[o-3]=e,a[o-2]=t,a[o-1]=n,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}},Ae=`
39
+ #include <common>
40
+ #include <logdepthbuf_pars_vertex>
41
+ #include <fog_pars_vertex>
42
+ #include <clipping_planes_pars_vertex>
43
+
44
+ attribute vec3 previous;
45
+ attribute vec3 next;
46
+ attribute float side;
47
+ attribute float width;
48
+ attribute float counters;
49
+
50
+ uniform vec2 resolution;
51
+ uniform float lineWidth;
52
+ uniform vec3 color;
53
+ uniform float opacity;
54
+ uniform float sizeAttenuation;
55
+
56
+ varying vec2 vUV;
57
+ varying vec4 vColor;
58
+ varying float vCounters;
59
+
60
+ vec2 fix(vec4 i, float aspect) {
61
+ vec2 res = i.xy / i.w;
62
+ res.x *= aspect;
63
+ return res;
64
+ }
65
+
66
+ void main() {
67
+ float aspect = resolution.x / resolution.y;
68
+ vColor = vec4(color, opacity);
69
+ vUV = uv;
70
+ vCounters = counters;
71
+
72
+ mat4 m = projectionMatrix * modelViewMatrix;
73
+ vec4 finalPosition = m * vec4(position, 1.0) * aspect;
74
+ vec4 prevPos = m * vec4(previous, 1.0);
75
+ vec4 nextPos = m * vec4(next, 1.0);
76
+
77
+ vec2 currentP = fix(finalPosition, aspect);
78
+ vec2 prevP = fix(prevPos, aspect);
79
+ vec2 nextP = fix(nextPos, aspect);
80
+
81
+ float w = lineWidth * width;
82
+
83
+ vec2 dir;
84
+ if (nextP == currentP) dir = normalize(currentP - prevP);
85
+ else if (prevP == currentP) dir = normalize(nextP - currentP);
86
+ else {
87
+ vec2 dir1 = normalize(currentP - prevP);
88
+ vec2 dir2 = normalize(nextP - currentP);
89
+ dir = normalize(dir1 + dir2);
90
+
91
+ vec2 perp = vec2(-dir1.y, dir1.x);
92
+ vec2 miter = vec2(-dir.y, dir.x);
93
+ //w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);
94
+ }
95
+
96
+ //vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;
97
+ vec4 normal = vec4(-dir.y, dir.x, 0., 1.);
98
+ normal.xy *= .5 * w;
99
+ //normal *= projectionMatrix;
100
+ if (sizeAttenuation == 0.) {
101
+ normal.xy *= finalPosition.w;
102
+ normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy * aspect;
103
+ }
104
+
105
+ finalPosition.xy += normal.xy * side;
106
+ gl_Position = finalPosition;
107
+ #include <logdepthbuf_vertex>
108
+ #include <fog_vertex>
109
+ vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
110
+ #include <clipping_planes_vertex>
111
+ #include <fog_vertex>
112
+ }
113
+ `,je=`
114
+ #include <fog_pars_fragment>
115
+ #include <logdepthbuf_pars_fragment>
116
+ #include <clipping_planes_pars_fragment>
117
+
118
+ uniform sampler2D map;
119
+ uniform sampler2D alphaMap;
120
+ uniform float useGradient;
121
+ uniform float useMap;
122
+ uniform float useAlphaMap;
123
+ uniform float useDash;
124
+ uniform float dashArray;
125
+ uniform float dashOffset;
126
+ uniform float dashRatio;
127
+ uniform float visibility;
128
+ uniform float alphaTest;
129
+ uniform vec2 repeat;
130
+ uniform vec3 gradient[2];
131
+
132
+ varying vec2 vUV;
133
+ varying vec4 vColor;
134
+ varying float vCounters;
135
+
136
+ void main() {
137
+ #include <logdepthbuf_fragment>
138
+ vec4 diffuseColor = vColor;
139
+ if (useGradient == 1.) diffuseColor = vec4(mix(gradient[0], gradient[1], vCounters), 1.0);
140
+ if (useMap == 1.) diffuseColor *= texture2D(map, vUV * repeat);
141
+ if (useAlphaMap == 1.) diffuseColor.a *= texture2D(alphaMap, vUV * repeat).a;
142
+ if (diffuseColor.a < alphaTest) discard;
143
+ if (useDash == 1.) diffuseColor.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
144
+ diffuseColor.a *= step(vCounters, visibility);
145
+ #include <clipping_planes_fragment>
146
+ gl_FragColor = diffuseColor;
147
+ #include <fog_fragment>
148
+ #include <tonemapping_fragment>
149
+ #include <${parseInt(`185`.replace(/\D+/g,``))>=154?`colorspace_fragment`:`encodings_fragment`}>
150
+ }
151
+ `,Me=class extends M{constructor(e){super({uniforms:{...I.fog,lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new W(16777215)},gradient:{value:[new W(16711680),new W(65280)]},opacity:{value:1},resolution:{value:new O(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useGradient:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new O(1,1)}},vertexShader:Ae,fragmentShader:je}),X(this,`lineWidth`),X(this,`map`),X(this,`useMap`),X(this,`alphaMap`),X(this,`useAlphaMap`),X(this,`color`),X(this,`gradient`),X(this,`resolution`),X(this,`sizeAttenuation`),X(this,`dashArray`),X(this,`dashOffset`),X(this,`dashRatio`),X(this,`useDash`),X(this,`useGradient`),X(this,`visibility`),X(this,`repeat`),this.type=`MeshLineMaterial`,Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(e){this.uniforms.color.value=e}},gradient:{enumerable:!0,get(){return this.uniforms.gradient.value},set(e){this.uniforms.gradient.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(e){this.uniforms.dashArray.value=e,this.useDash=e===0?0:1}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(e){this.uniforms.useDash.value=e}},useGradient:{enumerable:!0,get(){return this.uniforms.useGradient.value},set(e){this.uniforms.useGradient.value=e}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(e){this.uniforms.repeat.value.copy(e)}}}),this.setValues(e)}copy(e){return super.copy(e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.gradient=e.gradient,this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.useGradient=e.useGradient,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}},Ne={width:.2,length:1,decay:1,local:!1,stride:0,interval:1},Pe=(e,t=1)=>(e.set(e.subarray(t)),e.fill(-1/0,-t),e);function Fe(e,t){let{length:n,local:r,decay:i,interval:a,stride:o}={...Ne,...t},s=q.useRef(),[c]=q.useState(()=>new E);q.useLayoutEffect(()=>{e&&(s.current=Float32Array.from({length:n*10*3},(t,n)=>e.position.getComponent(n%3)))},[n,e]);let l=q.useRef(new E),u=q.useRef(0);return j(()=>{if(e&&s.current){if(u.current===0){let t;r?t=e.position:(e.getWorldPosition(c),t=c);let n=1*i;for(let e=0;e<n;e++)t.distanceTo(l.current)<o||(Pe(s.current,3),s.current.set(t.toArray(),s.current.length-3));l.current.copy(t)}u.current++,u.current%=a}}),s}var Ie=q.forwardRef((e,t)=>{let{children:n}=e,{width:r,length:i,decay:a,local:o,stride:s,interval:c}={...Ne,...e},{color:l=`hotpink`,attenuation:u,target:d}=e,f=z(e=>e.size),p=z(e=>e.scene),m=q.useRef(null),[h,g]=q.useState(null),_=Fe(h,{length:i,decay:a,local:o,stride:s,interval:c});q.useEffect(()=>{let e=d?.current||m.current.children.find(e=>e instanceof P);e&&g(e)},[_,d]);let v=q.useMemo(()=>new ke,[]),y=q.useMemo(()=>{let e=new Me({lineWidth:.1*r,color:l,sizeAttenuation:1,resolution:new O(f.width,f.height)}),t;if(n)if(Array.isArray(n))t=n.find(e=>{let t=e;return typeof t.type==`string`&&t.type===`meshLineMaterial`});else{let e=n;typeof e.type==`string`&&e.type===`meshLineMaterial`&&(t=e)}return typeof t?.props==`object`&&e.setValues(t.props),e},[r,l,f,n]);return q.useEffect(()=>{y.uniforms.resolution.value.set(f.width,f.height)},[f]),j(()=>{_.current&&v.setPoints(_.current,u)}),q.createElement(`group`,null,te(q.createElement(`mesh`,{ref:t,geometry:v,material:y}),p),q.createElement(`group`,{ref:m},n))}),Le=(0,q.createContext)(null);function Re({iterations:e=10,ms:t=250,threshold:n=.75,step:r=.1,factor:i=.5,flipflops:a=1/0,bounds:o=e=>e>100?[60,100]:[40,60],onIncline:s,onDecline:c,onChange:l,onFallback:u,children:d}){let[f,p]=(0,q.useState)(()=>({fps:0,index:0,factor:i,flipped:0,refreshrate:0,fallback:!1,frames:[],averages:[],subscriptions:new Map,subscribe:e=>{let t=Symbol();return f.subscriptions.set(t,e.current),()=>void f.subscriptions.delete(t)}})),m=0;return j(()=>{let{frames:i,averages:d}=f;if(!f.fallback&&d.length<e){i.push(performance.now());let p=i[i.length-1]-i[0];if(p>=t){if(f.fps=Math.round(i.length/p*1e3*1)/1,f.refreshrate=Math.max(f.refreshrate,f.fps),d[f.index++%e]=f.fps,d.length===e){let[t,i]=o(f.refreshrate),p=d.filter(e=>e>=i),h=d.filter(e=>e<t);p.length>e*n&&(f.factor=Math.min(1,f.factor+r),f.flipped++,s&&s(f),f.subscriptions.forEach(e=>e.onIncline&&e.onIncline(f))),h.length>e*n&&(f.factor=Math.max(0,f.factor-r),f.flipped++,c&&c(f),f.subscriptions.forEach(e=>e.onDecline&&e.onDecline(f))),m!==f.factor&&(m=f.factor,l&&l(f),f.subscriptions.forEach(e=>e.onChange&&e.onChange(f))),f.flipped>a&&!f.fallback&&(f.fallback=!0,u&&u(f),f.subscriptions.forEach(e=>e.onFallback&&e.onFallback(f))),f.averages=[]}f.frames=[]}}}),q.createElement(Le.Provider,{value:f},d)}function ze(e,t){let n=t.clone(),r=0;e&&(r=e.distanceTo(t),n.add(e).multiplyScalar(.5));let i=Math.max(22,14+r*1.05);return{target:n,position:new E(n.x,n.y+i,n.z+.8)}}var Z=i(),Be=new E(0,46,62),Ve=new E(0,15.5,24.5),He=1.35,Ue=new E(0,2.2,0),We=new E(0,15.5,24.5),Ge=new E(0,3.1,0),Ke=.025;function qe(e){return 1-(1-e)**3}function Je(e){let t=(0,K.c)(26),{coordinatorId:n,selectedAgentId:r,swarmRef:i,motion:a}=e,o=(0,q.useRef)(null),s=z(et),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t[0]=c):c=t[0];let l=c,u=J($e),d=J(Qe),f=J(Ze),p=(0,q.useRef)(null),m=(0,q.useRef)(!1),[h]=(0,q.useState)(Xe),[g]=(0,q.useState)(Ye),_=(0,q.useRef)(null),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v={position:We.clone(),target:Ue.clone()},t[1]=v):v=t[1];let y=(0,q.useRef)(v),b=(0,q.useRef)(!1),x,S;t[2]!==f||t[3]!==n||t[4]!==a?(x=()=>{if(a!==`calm`||l){_.current=null;return}f?_.current={sourceId:f.actorId,targetId:f.targetId||n||f.actorId,phase:`focus`}:_.current?.phase===`focus`&&(_.current.phase=`return`)},S=[f,n,a,l],t[2]=f,t[3]=n,t[4]=a,t[5]=x,t[6]=S):(x=t[5],S=t[6]),(0,q.useEffect)(x,S);let C,w;t[7]===r?(C=t[8],w=t[9]):(C=()=>{r?b.current=!0:b.current&&(b.current=!1,_.current={sourceId:null,targetId:``,phase:`return`})},w=[r],t[7]=r,t[8]=C,t[9]=w),(0,q.useEffect)(C,w);let T;t[10]!==s||t[11]!==n||t[12]!==g||t[13]!==h||t[14]!==u||t[15]!==a||t[16]!==r||t[17]!==d||t[18]!==i?(T=(e,t)=>{if(l&&!u){s.position.copy(We),s.lookAt(Ue),d();return}if(!u){p.current===null&&(p.current=e.clock.elapsedTime,s.position.copy(Be));let t=Math.min(1,(e.clock.elapsedTime-p.current)/He);s.position.lerpVectors(Be,Ve,qe(t)),s.lookAt(Ue),t>=1&&(y.current.position.copy(We),y.current.target.copy(Ue),d());return}let c=o.current;if(c){if(!m.current){s.position.copy(We),c.target.copy(Ue),y.current.position.copy(We),y.current.target.copy(Ue),c.update(),m.current=!0;return}let e=_.current;if(e&&a===`calm`&&!l){if(e.phase===`focus`){let t=e.sourceId===n?Ge:e.sourceId?i.current.get(e.sourceId)?.pos:null,r=e.targetId===n?Ge:i.current.get(e.targetId)?.pos;if(r){let e=ze(t??null,r);h.copy(e.target),g.copy(e.position)}}else{let e=r===n?Ge:r?i.current.get(r)?.pos:null;b.current&&e?(h.copy(e),g.set(e.x,e.y+7,e.z+11)):(h.copy(y.current.target),g.copy(y.current.position))}let a=1-.035**t,o=1-.06**t;c.target.lerp(h,a),s.position.lerp(g,o),e.phase===`return`&&c.target.distanceToSquared(h)<Ke&&s.position.distanceToSquared(g)<Ke&&(_.current=null)}else if(b.current&&r&&a===`calm`&&!l){let e=r===n?Ge:i.current.get(r)?.pos;e&&(h.copy(e),g.set(e.x,e.y+7,e.z+11),c.target.lerp(h,1-.035**t),s.position.lerp(g,1-.06**t))}c.update()}},t[10]=s,t[11]=n,t[12]=g,t[13]=h,t[14]=u,t[15]=a,t[16]=r,t[17]=d,t[18]=i,t[19]=T):T=t[19],j(T);let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{_.current=null,b.current=!1},t[20]=E):E=t[20];let D;t[21]===s?D=t[22]:(D=()=>{let e=o.current;e&&(y.current.position.copy(s.position),y.current.target.copy(e.target))},t[21]=s,t[22]=D);let O;return t[23]!==u||t[24]!==D?(O=(0,Z.jsx)(V,{ref:o,makeDefault:!0,enabled:u,enableDamping:!0,dampingFactor:.06,enablePan:!0,minDistance:9,maxDistance:60,maxPolarAngle:1.42,autoRotate:!1,onStart:E,onEnd:D}),t[23]=u,t[24]=D,t[25]=O):O=t[25],O}function Ye(){return We.clone()}function Xe(){return Ue.clone()}function Ze(e){return e.activeCue}function Qe(e){return e.setIntroDone}function $e(e){return e.introDone}function et(e){return e.camera}var tt=`
152
+ varying vec3 vWorldPos;
153
+ void main() {
154
+ vec4 world = modelMatrix * vec4(position, 1.0);
155
+ vWorldPos = world.xyz;
156
+ gl_Position = projectionMatrix * viewMatrix * world;
157
+ }
158
+ `,nt=`
159
+ varying vec3 vWorldPos;
160
+ uniform vec3 uColor;
161
+
162
+ // Distancia a aristas de un tiling hexagonal (pointy-top).
163
+ float hexEdge(vec2 p) {
164
+ p.x *= 0.57735 * 2.0;
165
+ p.y += mod(floor(p.x), 2.0) * 0.5;
166
+ p = abs(fract(p) - 0.5);
167
+ return abs(max(p.x * 1.5 + p.y, p.y * 2.0) - 1.0);
168
+ }
169
+
170
+ void main() {
171
+ vec2 uv = vWorldPos.xz;
172
+ float dist = length(uv);
173
+
174
+ // Una referencia espacial estable, sin barridos ni pulsos.
175
+ float g1 = hexEdge(uv * 0.55);
176
+ float g2 = hexEdge(uv * 2.2);
177
+ float lines = smoothstep(0.065, 0.0, g1) * 0.42 + smoothstep(0.035, 0.0, g2) * 0.035;
178
+
179
+ // Fade radial hacia el vacío
180
+ float fade = smoothstep(46.0, 14.0, dist);
181
+ float centerGlow = exp(-dist * 0.11) * 0.12;
182
+
183
+ vec3 col = uColor * (lines + centerGlow);
184
+ float alpha = clamp((lines * 0.22 + centerGlow) * fade, 0.0, 0.22);
185
+ gl_FragColor = vec4(col, alpha);
186
+ }
187
+ `;function rt(){let e=(0,K.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={uColor:{value:new W(`#4f8ff7`)}},e[0]=t):t=e[0];let n=t,r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`mesh`,{rotation:[-Math.PI/2,0,0],position:[0,.01,0],children:[(0,Z.jsx)(`circleGeometry`,{args:[48,72]}),(0,Z.jsx)(`shaderMaterial`,{vertexShader:tt,fragmentShader:nt,uniforms:n,transparent:!0,depthWrite:!1,blending:2})]}),e[1]=r):r=e[1],r}var it=[0,0,0],at=4.2,ot=4.4,st=[{radius:7.5,yBase:2.8,inclination:.55},{radius:10.5,yBase:3.8,inclination:.9},{radius:13.5,yBase:4.8,inclination:1.25}],ct=Math.PI*(3-Math.sqrt(5));function lt(e,t){let n=st[e%st.length],r=Math.floor(e/st.length),i=Math.max(1,Math.ceil(t/st.length));return{radius:n.radius,yBase:n.yBase,inclination:n.inclination,phase:r*Math.PI*2/i+e%st.length*ct*.37,angularSpeed:.05+e*7%5*.016}}function ut(e,t,n,r,i){return[Math.cos(r)*t,n+Math.sin(r)*e.inclination,Math.sin(r)*t]}function dt(e,t){return e===`disabled`||e===`archived`?0:e===`tool_call`?.65:e===`thinking`?t?.42:.2:e===`stuck`?.08:0}function ft(e,t,n){return e===`disabled`||e===`archived`?20:t?at:n}function pt(e,t,n){return e===`disabled`||e===`archived`?1.4:t?ot:n}var mt=`#f59e0b`;function ht({coordinator:e,active:t,swarmRef:n}){let r=(0,q.useRef)(null),i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=J(t=>!!e&&t.selectedAgentId===e.id),u=J(e=>e.select),d=J(e=>e.motion),f=J(e=>e.activeCue),p=e?.status===`thinking`||e?.status===`tool_call`;return j((l,u)=>{let m=l.clock.elapsedTime,h=!!e&&(f?.actorId===e.id||f?.targetId===e.id),g=f?.actorId===e?.id?f.targetId:f?.actorId,_=g?n.current.get(g)?.pos:null;if(r.current){let e=d===`calm`&&(t||p)?Math.sin(m*2.1)*.04:0;r.current.position.y=1.05+e;let n=d===`calm`?Math.sin(m*.38)*.08:0,i=h&&_?Math.atan2(_.x,_.z):n;r.current.rotation.y=B.damp(r.current.rotation.y,i,4.5,u);let a=h&&d===`calm`?1.08:1,o=B.damp(r.current.scale.x,a,5,u);r.current.scale.setScalar(o)}let v=d===`calm`?Math.sin(m*(h?7:t||p?4.2:1.4))*(h?.34:t||p?.24:.08):0;i.current&&(i.current.rotation.z=.28+v),a.current&&(a.current.rotation.z=-.28-v),o.current&&(o.current.intensity+=((t||p?12:6)-o.current.intensity)*.04),s.current&&(s.current.rotation.y+=u*(h?1.2:.22)),c.current&&(c.current.rotation.z=h&&d===`calm`?Math.sin(m*7)*.08:0)}),(0,Z.jsxs)(`group`,{position:it,children:[(0,Z.jsxs)(`mesh`,{position:[0,.3,0],children:[(0,Z.jsx)(`cylinderGeometry`,{args:[2.5,2.8,.45,6]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#0b0f1a`,metalness:.7,roughness:.35,emissive:mt,emissiveIntensity:l?.5:.18})]}),(0,Z.jsxs)(`mesh`,{position:[0,.54,0],rotation:[-Math.PI/2,0,0],children:[(0,Z.jsx)(`ringGeometry`,{args:[1.85,2.22,6]}),(0,Z.jsx)(`meshBasicMaterial`,{color:mt,transparent:!0,opacity:l?.9:.48,blending:2})]}),(0,Z.jsxs)(`group`,{ref:r,onClick:t=>{t.stopPropagation(),e&&u(l?null:e.id)},onPointerOver:e=>{e.stopPropagation(),document.body.style.cursor=`pointer`},onPointerOut:()=>{document.body.style.cursor=`auto`},children:[(0,Z.jsxs)(`mesh`,{position:[0,1.2,0],scale:[.74,1.28,.68],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.72,24,20]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#e6a519`,emissive:mt,emissiveIntensity:l?.8:.42,metalness:.34,roughness:.36})]}),[.58,1.02,1.46].map((e,t)=>(0,Z.jsxs)(`mesh`,{position:[0,e,0],rotation:[Math.PI/2,0,0],children:[(0,Z.jsx)(`torusGeometry`,{args:[.5-t*.035,.075,8,28]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#251807`,metalness:.52,roughness:.48})]},e)),(0,Z.jsxs)(`mesh`,{position:[0,-.02,0],rotation:[0,0,Math.PI],children:[(0,Z.jsx)(`coneGeometry`,{args:[.14,.52,8]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#ffcf6a`,emissive:mt,emissiveIntensity:.5})]}),(0,Z.jsxs)(`mesh`,{position:[0,2.25,0],scale:[1,.9,.82],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.7,22,18]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#593c12`,emissive:mt,emissiveIntensity:l?.55:.24,metalness:.48,roughness:.42})]}),(0,Z.jsxs)(`mesh`,{position:[0,3.15,0],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.54,22,18]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#d69113`,emissive:mt,emissiveIntensity:l?.95:.48,metalness:.38,roughness:.34})]}),[-1,1].map(e=>(0,Z.jsxs)(`mesh`,{position:[e*.34,3.2,.4],scale:[1,1.18,.42],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.15,12,10]}),(0,Z.jsx)(`meshBasicMaterial`,{color:`#fff1a8`})]},e)),(0,Z.jsx)(`group`,{ref:c,position:[0,3.55,0],children:[-1,1].map(e=>(0,Z.jsxs)(`group`,{rotation:[0,0,e*-.36],children:[(0,Z.jsxs)(`mesh`,{position:[e*.22,.28,0],children:[(0,Z.jsx)(`capsuleGeometry`,{args:[.035,.42,4,8]}),(0,Z.jsx)(`meshBasicMaterial`,{color:`#ffd465`})]}),(0,Z.jsxs)(`mesh`,{position:[e*.32,.53,0],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.07,8,8]}),(0,Z.jsx)(`meshBasicMaterial`,{color:`#fff0a6`})]})]},e))}),(0,Z.jsxs)(`group`,{ref:i,position:[.48,2.45,0],children:[(0,Z.jsxs)(`mesh`,{position:[.62,.18,0],rotation:[.08,.15,-.18],scale:[1.65,.12,.72],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.48,16,12]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#e8f8ff`,emissive:`#8cdcff`,emissiveIntensity:.58,transparent:!0,opacity:.48,side:2,depthWrite:!1})]}),(0,Z.jsxs)(`mesh`,{position:[.46,-.34,.05],rotation:[.08,.1,.2],scale:[1.25,.1,.58],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.4,14,10]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#dff7ff`,emissive:`#77c8ff`,emissiveIntensity:.42,transparent:!0,opacity:.38,side:2,depthWrite:!1})]})]}),(0,Z.jsxs)(`group`,{ref:a,position:[-.48,2.45,0],children:[(0,Z.jsxs)(`mesh`,{position:[-.62,.18,0],rotation:[.08,-.15,.18],scale:[1.65,.12,.72],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.48,16,12]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#e8f8ff`,emissive:`#8cdcff`,emissiveIntensity:.58,transparent:!0,opacity:.48,side:2,depthWrite:!1})]}),(0,Z.jsxs)(`mesh`,{position:[-.46,-.34,.05],rotation:[.08,-.1,-.2],scale:[1.25,.1,.58],children:[(0,Z.jsx)(`sphereGeometry`,{args:[.4,14,10]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#dff7ff`,emissive:`#77c8ff`,emissiveIntensity:.42,transparent:!0,opacity:.38,side:2,depthWrite:!1})]})]}),(0,Z.jsxs)(`group`,{ref:s,position:[0,4.08,0],children:[(0,Z.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,Z.jsx)(`torusGeometry`,{args:[.48,.055,6,6]}),(0,Z.jsx)(`meshBasicMaterial`,{color:`#ffe38a`,blending:2})]}),[-.4,0,.4].map((e,t)=>(0,Z.jsxs)(`mesh`,{position:[e,t===1?.25:.14,0],children:[(0,Z.jsx)(`coneGeometry`,{args:[.11,t===1?.48:.34,5]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#ffd465`,emissive:mt,emissiveIntensity:.9,metalness:.6,roughness:.2})]},e))]})]}),(0,Z.jsx)(`pointLight`,{ref:o,position:[0,3,0],color:mt,intensity:6,distance:18,decay:1.8})]})}var gt=`
188
+ varying vec2 vUv;
189
+ void main() {
190
+ vUv = uv;
191
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
192
+ }
193
+ `,_t=`
194
+ varying vec2 vUv;
195
+ uniform vec3 uColor;
196
+ uniform float uTime;
197
+ uniform float uSpeed;
198
+ uniform float uIntensity;
199
+
200
+ void main() {
201
+ // uv.y recorre la longitud del cilindro (delegante → worker)
202
+ float flow = fract(vUv.y * 3.0 - uTime * uSpeed);
203
+ float packet = smoothstep(0.0, 0.12, flow) * smoothstep(0.42, 0.12, flow);
204
+ float flow2 = fract(vUv.y * 7.0 - uTime * uSpeed * 1.7);
205
+ float packet2 = smoothstep(0.0, 0.06, flow2) * smoothstep(0.2, 0.06, flow2);
206
+
207
+ float core = 0.3 + packet * 1.6 + packet2 * 0.9;
208
+ float ends = smoothstep(0.0, 0.05, vUv.y) * smoothstep(1.0, 0.95, vUv.y);
209
+ float glow = core * uIntensity;
210
+ gl_FragColor = vec4(uColor * glow, clamp(glow * 0.6 * ends, 0.0, 1.0));
211
+ }
212
+ `,vt=new E(0,4.4,0),yt=new E,bt=new E,xt=new E,St=new E,Ct=new E(0,1,0),wt=new ee;function Tt(e){let t=(0,K.c)(11),{desks:n,interactions:r,swarmRef:i,coordinatorId:a}=e,o;if(t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i){let e;t[5]!==a||t[6]!==n||t[7]!==i?(e=e=>(0,Z.jsx)(Et,{interaction:e,targetDesk:n.find(t=>t.agent.id===e.targetId)??null,swarmRef:i,coordinatorId:a},e.id),t[5]=a,t[6]=n,t[7]=i,t[8]=e):e=t[8],o=r.map(e),t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,Z.jsx)(`group`,{children:o}),t[9]=o,t[10]=s),s}function Et({interaction:e,targetDesk:t,swarmRef:n,coordinatorId:r}){let i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useMemo)(()=>({uTime:{value:0},uColor:{value:new W(t?.color??`#f59e0b`)},uSpeed:{value:.52},uIntensity:{value:.82}}),[t?.color]);return j(t=>{o.uTime.value=t.clock.elapsedTime;let s=n.current.get(e.targetId);if(!s||!i.current)return;if(e.sourceId===r)yt.copy(vt);else{let t=n.current.get(e.sourceId);if(!t){i.current.visible=!1;return}yt.copy(t.pos)}bt.copy(s.pos),xt.subVectors(bt,yt);let c=xt.length();i.current.visible=c>.5,!(c<=.5)&&(St.addVectors(yt,bt).multiplyScalar(.5),i.current.position.copy(St),a.current?.position.copy(St),wt.setFromUnitVectors(Ct,xt.normalize()),i.current.quaternion.copy(wt),i.current.scale.set(.055,c,.055))}),(0,Z.jsxs)(`group`,{children:[(0,Z.jsxs)(`mesh`,{ref:i,visible:!1,children:[(0,Z.jsx)(`cylinderGeometry`,{args:[1,1,1,6,1,!0]}),(0,Z.jsx)(`shaderMaterial`,{vertexShader:gt,fragmentShader:_t,uniforms:o,transparent:!0,depthWrite:!1,side:2,blending:2})]}),(0,Z.jsx)(`group`,{ref:a,children:(0,Z.jsx)(we,{position:[0,.55,0],center:!0,distanceFactor:24,className:`pointer-events-none select-none`,children:(0,Z.jsxs)(`div`,{className:`office3d-beam-label`,style:{"--chip-color":t?.color??`#f59e0b`},children:[(0,Z.jsx)(`strong`,{children:e.kind===`reviews`?`REVISIÓN EN CURSO`:`TRABAJO DELEGADO`}),e.taskName&&(0,Z.jsx)(`span`,{children:e.taskName})]})})})]})}var Dt=`
213
+ attribute float aSeed;
214
+ uniform float uTime;
215
+ uniform float uPixelRatio;
216
+ varying float vSeed;
217
+ varying float vFade;
218
+
219
+ void main() {
220
+ vSeed = aSeed;
221
+ vec3 pos = position;
222
+ float t = uTime * (0.08 + aSeed * 0.12);
223
+ // Deriva orgánica
224
+ pos.x += sin(uTime * 0.25 + aSeed * 40.0) * 1.6;
225
+ pos.z += cos(uTime * 0.2 + aSeed * 31.0) * 1.6;
226
+ // Ascenso envolvente (polen que sube y reaparece abajo)
227
+ pos.y = mod(position.y + t * 6.0, 22.0);
228
+ vFade = smoothstep(0.0, 3.0, pos.y) * smoothstep(22.0, 16.0, pos.y);
229
+
230
+ vec4 mv = modelViewMatrix * vec4(pos, 1.0);
231
+ gl_PointSize = (1.4 + aSeed * 2.4) * uPixelRatio * (28.0 / -mv.z);
232
+ gl_Position = projectionMatrix * mv;
233
+ }
234
+ `,Ot=`
235
+ uniform vec3 uColor;
236
+ uniform float uOpacity;
237
+ varying float vSeed;
238
+ varying float vFade;
239
+
240
+ void main() {
241
+ vec2 c = gl_PointCoord - 0.5;
242
+ float d = length(c);
243
+ float disc = smoothstep(0.5, 0.05, d);
244
+ gl_FragColor = vec4(uColor * (0.6 + vSeed * 0.8), disc * uOpacity * vFade);
245
+ }
246
+ `,kt=`
247
+ attribute vec3 aVel;
248
+ attribute float aSeed;
249
+ uniform float uTime;
250
+ uniform float uStart;
251
+ uniform float uPixelRatio;
252
+ varying float vLife;
253
+
254
+ void main() {
255
+ float t = clamp((uTime - uStart) / 1.4, 0.0, 1.0);
256
+ vLife = 1.0 - t;
257
+ vec3 pos = aVel * (t * 3.2 - t * t * 1.1); // desaceleración
258
+ pos.y += t * 1.2; // ligera ascensión
259
+ vec4 mv = modelViewMatrix * vec4(pos, 1.0);
260
+ gl_PointSize = (2.2 + aSeed * 2.0) * vLife * uPixelRatio * (30.0 / -mv.z);
261
+ gl_Position = projectionMatrix * mv;
262
+ }
263
+ `,At=`
264
+ uniform vec3 uColor;
265
+ varying float vLife;
266
+ void main() {
267
+ vec2 c = gl_PointCoord - 0.5;
268
+ float disc = smoothstep(0.5, 0.05, length(c));
269
+ gl_FragColor = vec4(uColor * (0.8 + vLife), disc * vLife);
270
+ }
271
+ `,jt=780,Mt=42,Nt=22;function Pt(){let e=(0,q.useRef)(null),t=z(e=>e.viewport.dpr),n=(0,q.useMemo)(()=>{let e=new ne,t=new Float32Array(jt*3),n=new Float32Array(jt);for(let e=0;e<jt;e++){let r=Math.sqrt(Math.random())*Mt,i=Math.random()*Math.PI*2;t[e*3]=Math.cos(i)*r,t[e*3+1]=Math.random()*Nt,t[e*3+2]=Math.sin(i)*r,n[e]=Math.random()}return e.setAttribute(`position`,new T(t,3)),e.setAttribute(`aSeed`,new T(n,1)),e},[]),r=(0,q.useMemo)(()=>({uTime:{value:0},uColor:{value:new W(`#6aa9ff`)},uOpacity:{value:.16},uPixelRatio:{value:t}}),[]);return j(e=>{r.uTime.value=e.clock.elapsedTime,r.uPixelRatio.value=e.viewport.dpr}),(0,Z.jsx)(`points`,{geometry:n,frustumCulled:!1,children:(0,Z.jsx)(`shaderMaterial`,{ref:e,vertexShader:Dt,fragmentShader:Ot,uniforms:r,transparent:!0,depthWrite:!1,blending:2})})}var Ft=64,It=1700,Lt=0;function Rt({desks:e,swarmRef:t}){let[n,r]=(0,q.useState)([]),i=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>{let n=i.current;for(let i of e){if(n.get(i.agent.id)===`tool_call`&&i.state!==`tool_call`){let e=t.current.get(i.agent.id);if(e){let t=++Lt;r(n=>[...n,{id:t,position:e.pos.toArray(),color:i.color}]),setTimeout(()=>{r(e=>e.filter(e=>e.id!==t))},It)}}n.set(i.agent.id,i.state)}},[e,t]),(0,Z.jsx)(`group`,{children:n.map(e=>(0,Z.jsx)(zt,{burst:e},e.id))})}function zt({burst:e}){let t=(0,q.useMemo)(()=>{let e=new ne,t=new Float32Array(Ft*3),n=new Float32Array(Ft*3),r=new Float32Array(Ft);for(let e=0;e<Ft;e++){let t=Math.random()*Math.PI*2,i=Math.acos(2*Math.random()-1),a=.6+Math.random()*1.4;n[e*3]=Math.sin(i)*Math.cos(t)*a,n[e*3+1]=Math.cos(i)*a*.9,n[e*3+2]=Math.sin(i)*Math.sin(t)*a,r[e]=Math.random()}return e.setAttribute(`position`,new T(t,3)),e.setAttribute(`aVel`,new T(n,3)),e.setAttribute(`aSeed`,new T(r,1)),e},[]),n=(0,q.useMemo)(()=>({uTime:{value:0},uStart:{value:-1},uColor:{value:new W(e.color)},uPixelRatio:{value:1}}),[e.color]);return j(e=>{n.uTime.value=e.clock.elapsedTime,n.uStart.value<0&&(n.uStart.value=e.clock.elapsedTime),n.uPixelRatio.value=e.viewport.dpr}),(0,Z.jsx)(`points`,{geometry:t,position:e.position,frustumCulled:!1,children:(0,Z.jsx)(`shaderMaterial`,{vertexShader:kt,fragmentShader:At,uniforms:n,transparent:!0,depthWrite:!1,blending:2})})}function Bt(e){let t=(0,K.c)(5),{quality:n}=e,r=n===`high`?.52:.32,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(L,{mipmapBlur:!0,intensity:r,luminanceThreshold:.38,luminanceSmoothing:.22}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(H,{offset:.34,darkness:.38}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,Z.jsxs)(N,{multisampling:0,children:[i,a]}),t[3]=i,t[4]=o),o}var Vt=new E;function Ht(e){let t=(0,K.c)(11),{desks:n,swarmRef:r,motion:i}=e,a;if(t[0]!==n){let e;t[2]===n.length?e=t[3]:(e=(e,t)=>[e.agent.id,lt(t,n.length)],t[2]=n.length,t[3]=e),a=new Map(n.map(e)),t[0]=n,t[1]=a}else a=t[1];let o=a,s=(0,q.useRef)(n),c,l;t[4]===n?(c=t[5],l=t[6]):(c=()=>{s.current=n},l=[n],t[4]=n,t[5]=c,t[6]=l),(0,q.useEffect)(c,l);let u;return t[7]!==i||t[8]!==o||t[9]!==r?(u=(e,t)=>{let n=e.clock.elapsedTime,a=r.current;for(let e of s.current){let r=e.agent.id,s=o.get(r);if(!s)continue;let c=a.get(r);if(!c){let[e,t,i]=ut(s,s.radius,s.yBase,s.phase,n);c={pos:new E(e,t,i),prevPos:new E(e,t,i),angle:s.phase,radius:s.radius,y:s.yBase,speedMul:1},a.set(r,c)}let l=!!e.currentTask,u=ft(e.state,l,s.radius),d=pt(e.state,l,s.yBase),f=i===`off`?0:dt(e.state,l),p=1-.12**t;c.radius+=(u-c.radius)*p,c.y+=(d-c.y)*p,c.speedMul+=(f-c.speedMul)*p,c.angle+=s.angularSpeed*c.speedMul*t,c.prevPos.copy(c.pos);let[m,h,g]=ut(s,c.radius,c.y,c.angle,n);Vt.set(m,h,g),i===`calm`&&e.state===`stuck`&&(Vt.x+=Math.sin(n*31+s.phase*7)*.22,Vt.y+=Math.cos(n*41+s.phase*3)*.15,Vt.z+=Math.sin(n*37+s.phase*5)*.22),c.pos.copy(Vt)}for(let e of a.keys())o.has(e)||a.delete(e)},t[7]=i,t[8]=o,t[9]=r,t[10]=u):u=t[10],j(u,-1),null}var Ut={task_delegate:`Delegando tarea`,task_status:`Consultando estado`,web_search:`Buscando en la web`,web_fetch:`Leyendo página web`,browser_navigate:`Navegando`,browser_click:`Haciendo clic`,browser_type:`Escribiendo en la página`,browser_screenshot:`Tomando captura`,computer_use_task:`Operando el navegador`,browser_extract:`Extrayendo datos`,fs_read:`Leyendo archivo`,fs_write:`Escribiendo archivo`,fs_exists:`Verificando archivo`,exec:`Ejecutando comando`,search_knowledge:`Buscando herramientas`,a2ui_create_surface:`Creando interfaz`,a2ui_update_components:`Actualizando interfaz`,a2ui_update_data_model:`Actualizando datos`,memory_write:`Guardando en memoria`,memory_read:`Leyendo memoria`,memory_search:`Buscando en memoria`,save_note:`Guardando nota`,"cron.create":`Programando tarea`,notify:`Enviando aviso`,report_progress:`Reportando avance`};function Wt(e){if(!e)return null;if(Ut[e])return Ut[e];let t=e.split(`__`)[0];if(t&&t!==e)return`Usando ${t}`;let n=e.replace(/[_.]+/g,` `).trim();return n.charAt(0).toUpperCase()+n.slice(1)}var Gt=`
272
+ varying vec3 vNormal;
273
+ varying vec3 vWorldPos;
274
+ varying vec3 vViewDir;
275
+ uniform float uTime;
276
+ uniform float uGlitch;
277
+
278
+ float hash(float n) { return fract(sin(n) * 43758.5453123); }
279
+
280
+ void main() {
281
+ vec3 pos = position;
282
+ if (uGlitch > 0.01) {
283
+ float row = floor(position.y * 14.0 + uTime * 18.0);
284
+ float slice = step(0.94, hash(row));
285
+ pos.x += slice * uGlitch * (hash(uTime * 43.0) - 0.5) * 0.45;
286
+ pos.z += slice * uGlitch * (hash(uTime * 71.0) - 0.5) * 0.2;
287
+ }
288
+ vec4 world = modelMatrix * vec4(pos, 1.0);
289
+ vWorldPos = world.xyz;
290
+ vNormal = normalize(normalMatrix * normal);
291
+ vViewDir = cameraPosition - world.xyz;
292
+ gl_Position = projectionMatrix * viewMatrix * world;
293
+ }
294
+ `,Kt=`
295
+ varying vec3 vNormal;
296
+ varying vec3 vWorldPos;
297
+ varying vec3 vViewDir;
298
+ uniform vec3 uColor;
299
+ uniform float uTime;
300
+ uniform float uIntensity;
301
+ uniform float uGlitch;
302
+ uniform float uOpacity;
303
+
304
+ void main() {
305
+ vec3 n = normalize(vNormal);
306
+ vec3 v = normalize(vViewDir);
307
+ float fresnel = pow(1.0 - abs(dot(n, v)), 2.2);
308
+ float scan = 0.82 + 0.18 * sin(vWorldPos.y * 90.0 - uTime * 6.0);
309
+ float flicker = 0.93 + 0.07 * sin(uTime * 37.0 + vWorldPos.x * 10.0);
310
+ vec3 col = uColor;
311
+ if (uGlitch > 0.01) {
312
+ col = mix(col, vec3(1.0, 0.28, 0.2), uGlitch * 0.65);
313
+ flicker *= 0.75 + 0.25 * step(0.5, fract(uTime * 24.0));
314
+ }
315
+ float alpha = (0.16 + fresnel * 0.95) * scan * flicker * uOpacity;
316
+ vec3 glow = col * (uIntensity * (0.45 + fresnel * 1.7));
317
+ gl_FragColor = vec4(glow, alpha);
318
+ }
319
+ `;function qt(e){let t=e?.toLowerCase()??``;return/knowledge|memory|rag|embed|document|vector/.test(t)?`knowledge`:/browser|web|search|fetch|http|url/.test(t)?`browser`:/file|code|exec|shell|terminal|git|patch|write|read/.test(t)?`code`:/message|mail|slack|discord|telegram|whatsapp|notify/.test(t)?`communication`:`generic`}function Q(e){let t=(0,K.c)(2),{color:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`meshBasicMaterial`,{color:n,transparent:!0,opacity:.72,wireframe:!0,blending:2,depthWrite:!1}),t[0]=n,t[1]=r),r}function Jt(e){let t=(0,K.c)(27),{toolName:n,color:r}=e,i=(0,q.useRef)(null),a;t[0]===n?a=t[1]:(a=qt(n),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{i.current&&(i.current.rotation.y=i.current.rotation.y+t*.85,i.current.position.y=1.05+Math.sin(e.clock.elapsedTime*2.4)*.08)},t[2]=s):s=t[2],j(s);let c;t[3]!==o||t[4]!==r?(c=o===`browser`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`mesh`,{children:[(0,Z.jsx)(`sphereGeometry`,{args:[.42,10,8]}),(0,Z.jsx)(Q,{color:r})]}),(0,Z.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,Z.jsx)(`torusGeometry`,{args:[.53,.035,6,24]}),(0,Z.jsx)(Q,{color:r})]})]}),t[3]=o,t[4]=r,t[5]=c):c=t[5];let l;t[6]!==o||t[7]!==r?(l=o===`code`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`mesh`,{children:[(0,Z.jsx)(`boxGeometry`,{args:[.75,.55,.12]}),(0,Z.jsx)(Q,{color:r})]}),(0,Z.jsxs)(`mesh`,{position:[-.16,0,.1],rotation:[0,0,-.55],children:[(0,Z.jsx)(`boxGeometry`,{args:[.06,.32,.05]}),(0,Z.jsx)(Q,{color:r})]}),(0,Z.jsxs)(`mesh`,{position:[.16,0,.1],rotation:[0,0,.55],children:[(0,Z.jsx)(`boxGeometry`,{args:[.06,.32,.05]}),(0,Z.jsx)(Q,{color:r})]})]}),t[6]=o,t[7]=r,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==r?(u=o===`knowledge`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`mesh`,{children:[(0,Z.jsx)(`octahedronGeometry`,{args:[.46,0]}),(0,Z.jsx)(Q,{color:r})]}),(0,Z.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,Z.jsx)(`torusGeometry`,{args:[.58,.025,6,6]}),(0,Z.jsx)(Q,{color:r})]})]}),t[9]=o,t[10]=r,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==r?(d=o===`communication`&&(0,Z.jsx)(Z.Fragment,{children:[.25,.42,.59].map(e=>(0,Z.jsxs)(`mesh`,{rotation:[0,Math.PI/2,0],children:[(0,Z.jsx)(`torusGeometry`,{args:[e,.025,5,20,Math.PI]}),(0,Z.jsx)(Q,{color:r})]},e))}),t[12]=o,t[13]=r,t[14]=d):d=t[14];let f;t[15]!==o||t[16]!==r?(f=o===`generic`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`mesh`,{children:[(0,Z.jsx)(`icosahedronGeometry`,{args:[.4,0]}),(0,Z.jsx)(Q,{color:r})]}),(0,Z.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,Z.jsx)(`torusGeometry`,{args:[.56,.025,5,24]}),(0,Z.jsx)(Q,{color:r})]})]}),t[15]=o,t[16]=r,t[17]=f):f=t[17];let p;t[18]===r?p=t[19]:(p=(0,Z.jsx)(`pointLight`,{color:r,intensity:2.2,distance:4,decay:2}),t[18]=r,t[19]=p);let m;return t[20]!==c||t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Z.jsxs)(`group`,{ref:i,scale:.7,children:[c,l,u,d,f,p]}),t[20]=c,t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}var Yt=new E,Xt=new D,Zt=new ee,Qt=new E(0,1,0),$t=new E(0,0,0),en={archived:{flap:0,intensity:.08,opacity:.12},idle:{flap:0,intensity:.45,opacity:.72},thinking:{flap:5,intensity:.85,opacity:.9},tool_call:{flap:8,intensity:1.05,opacity:1},stuck:{flap:2,intensity:.9,opacity:.95},disabled:{flap:0,intensity:.12,opacity:.06}};function tn({desk:e,swarmRef:t}){let{agent:n,state:r,color:i}=e,a=J(e=>e.selectedAgentId===n.id),o=J(e=>e.select),s=J(e=>e.motion),c=J(e=>e.activeCue),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(null),p=(0,q.useRef)(null),m=(0,q.useRef)(null),h=(0,q.useMemo)(()=>new M({vertexShader:Gt,fragmentShader:Kt,uniforms:{uTime:{value:0},uColor:{value:new W(i)},uIntensity:{value:.65},uGlitch:{value:0},uOpacity:{value:.8}},transparent:!0,depthWrite:!1,side:2,blending:2}),[i]),g=(0,q.useMemo)(()=>new M({vertexShader:Gt,fragmentShader:Kt,uniforms:{uTime:{value:0},uColor:{value:new W(i).lerp(new W(`#ffffff`),.55)},uIntensity:{value:.9},uGlitch:{value:0},uOpacity:{value:.4}},transparent:!0,depthWrite:!1,side:2,blending:2}),[i]),_=(0,q.useMemo)(()=>new W(i),[i]);j((e,i)=>{let o=e.clock.elapsedTime,_=en[r],v=c?.actorId===n.id||c?.targetId===n.id,y=c&&!v&&!a?.28:1;h.uniforms.uTime.value=o,g.uniforms.uTime.value=o;let b=1-.002**i;h.uniforms.uIntensity.value+=(_.intensity-h.uniforms.uIntensity.value)*b,h.uniforms.uOpacity.value+=(_.opacity*y-h.uniforms.uOpacity.value)*b,g.uniforms.uOpacity.value+=(.4*y-g.uniforms.uOpacity.value)*b,h.uniforms.uGlitch.value+=(+(r===`stuck`)-h.uniforms.uGlitch.value)*b;let x=t.current.get(n.id);x&&l.current&&(l.current.position.copy(x.pos),u.current&&(Yt.subVectors(x.pos,x.prevPos),Yt.lengthSq()>1e-8&&(Xt.lookAt(Yt,$t,Qt),Zt.setFromRotationMatrix(Xt),u.current.quaternion.slerp(Zt,1-.01**i))));let S=s===`calm`&&_.flap>0?Math.sin(o*_.flap)*.45+.2:.15;if(f.current&&(f.current.rotation.z=S),p.current&&(p.current.rotation.z=-S),m.current){let e=r===`disabled`||r===`archived`?0:r===`tool_call`?7:2.6;m.current.intensity+=(e-m.current.intensity)*b}if(d.current){let e=c?.phase===`delegated`&&c.targetId===n.id,t=c?.actorId===n.id&&(c.phase===`completed`||c.phase===`failed`),r=s===`calm`&&e?Math.sin(o*8.5)*.22:s===`calm`&&t?-.16:0;d.current.rotation.x=B.damp(d.current.rotation.x,r,7,i);let a=v&&s===`calm`?1.12:1,l=B.damp(d.current.scale.x,a,6,i);d.current.scale.setScalar(l)}});let v=e=>{e.stopPropagation(),o(a?null:n.id)},y=r===`tool_call`?Wt(e.currentTool):null;return(0,Z.jsxs)(`group`,{ref:l,children:[(0,Z.jsx)(`group`,{onClick:v,onPointerOver:e=>{e.stopPropagation(),document.body.style.cursor=`pointer`},onPointerOut:()=>{document.body.style.cursor=`auto`},children:(0,Z.jsx)(Ie,{width:r===`idle`||r===`disabled`||r===`archived`?0:.65,length:2.2,color:_,attenuation:e=>e*e,children:(0,Z.jsx)(`group`,{ref:u,scale:a?.85:.62,children:(0,Z.jsxs)(`group`,{ref:d,children:[(0,Z.jsx)(`mesh`,{material:h,scale:[.85,.75,1.35],children:(0,Z.jsx)(`sphereGeometry`,{args:[.32,14,14]})}),(0,Z.jsxs)(`mesh`,{position:[0,0,.1],children:[(0,Z.jsx)(`torusGeometry`,{args:[.24,.045,8,20]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#241804`,metalness:.4,roughness:.6})]}),(0,Z.jsxs)(`mesh`,{position:[0,0,-.14],children:[(0,Z.jsx)(`torusGeometry`,{args:[.22,.04,8,20]}),(0,Z.jsx)(`meshStandardMaterial`,{color:`#241804`,metalness:.4,roughness:.6})]}),(0,Z.jsx)(`mesh`,{material:h,position:[0,.03,.5],children:(0,Z.jsx)(`sphereGeometry`,{args:[.18,12,12]})}),(0,Z.jsx)(`mesh`,{material:h,position:[0,0,-.52],rotation:[-Math.PI/2,0,0],children:(0,Z.jsx)(`coneGeometry`,{args:[.07,.22,8]})}),(0,Z.jsx)(`mesh`,{ref:f,material:g,position:[.26,.24,.05],rotation:[.35,0,.5],scale:[1,.08,.55],children:(0,Z.jsx)(`sphereGeometry`,{args:[.3,10,10]})}),(0,Z.jsx)(`mesh`,{ref:p,material:g,position:[-.26,.24,.05],rotation:[.35,0,-.5],scale:[1,.08,.55],children:(0,Z.jsx)(`sphereGeometry`,{args:[.3,10,10]})})]})})})}),(0,Z.jsx)(`pointLight`,{ref:m,color:i,intensity:2.6,distance:8,decay:1.7}),r===`tool_call`&&(0,Z.jsx)(Jt,{toolName:e.currentTool,color:i}),r===`thinking`&&(0,Z.jsxs)(`mesh`,{position:[0,.95,0],rotation:[-Math.PI/2,0,0],children:[(0,Z.jsx)(`ringGeometry`,{args:[.42,.52,6]}),(0,Z.jsx)(`meshBasicMaterial`,{color:i,transparent:!0,opacity:.42,blending:2,depthWrite:!1})]}),r===`stuck`&&(0,Z.jsxs)(`mesh`,{position:[0,1.05,0],rotation:[-Math.PI/2,0,0],children:[(0,Z.jsx)(`ringGeometry`,{args:[.52,.68,6]}),(0,Z.jsx)(`meshBasicMaterial`,{color:`#fb7185`,transparent:!0,opacity:.86,blending:2,depthWrite:!1})]}),e.currentTask&&(0,Z.jsx)(we,{position:[0,1.55,0],center:!0,distanceFactor:17,className:`pointer-events-none select-none`,children:(0,Z.jsxs)(`div`,{className:`office3d-task-chip`,style:{"--chip-color":i},children:[(0,Z.jsx)(`span`,{className:`office3d-task-chip-prefix`,children:`◈`}),` `,e.currentTask]})}),y&&(0,Z.jsx)(we,{position:[0,e.currentTask?1.05:1.3,0],center:!0,distanceFactor:17,className:`pointer-events-none select-none`,children:(0,Z.jsx)(`div`,{className:`office3d-tool-chip`,style:{"--chip-color":i},children:y})}),(0,Z.jsx)(we,{position:[0,-.85,0],center:!0,distanceFactor:16,className:`pointer-events-none select-none`,zIndexRange:[10,0],children:(0,Z.jsxs)(`div`,{className:`office3d-name-plate ${a?`is-active`:``}`,style:{"--chip-color":i},children:[(0,Z.jsx)(`span`,{className:`office3d-name-dot office3d-name-dot--${r}`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`strong`,{children:n.name}),(0,Z.jsx)(`small`,{children:n.description||`Agente especialista`})]})]})})]})}var nn=new Set([`failed`,`aborted`,`review_failed`,`blocked`]);function rn(e){return nn.has(e)?4200:e===`completed`?3200:2800}function an(e){return nn.has(e)}function on(e,t){return e.some(e=>e.eventId===t.eventId)?e:(an(t.phase)?[t,...e]:[...e,t]).slice(0,3)}function sn(e){switch(e){case`delegated`:return`Delegando trabajo`;case`review_passed`:return`Revisión aprobada`;case`review_failed`:return`Revisión no aprobada`;case`completed`:return`Entregando resultado`;case`failed`:return`Trabajo fallido`;case`aborted`:return`Trabajo interrumpido`;case`blocked`:return`Agente bloqueado`}}function cn(e){return e===`failed`||e===`aborted`||e===`review_failed`?`alert`:e===`completed`||e===`review_passed`?`done`:`work`}var ln=new E(0,4.4,0),un=2.25,dn=0;function fn(e,t){let n=cn(e.phase);return n===`alert`?`#fb7185`:n===`done`?`#86efac`:n===`review`?`#67e8f9`:t??`#f59e0b`}function pn({desks:e,events:t,swarmRef:n,coordinatorId:r,coordinatorName:i}){let[a,o]=(0,q.useState)([]),s=(0,q.useRef)(new Set),c=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{if(!c.current){t.forEach(e=>s.current.add(e.eventId)),c.current=!0;return}let n=new Map(e.map(e=>[e.agent.id,e])),a=e=>e===r?i:n.get(e)?.agent.name??`Agente`,l=[];for(let e of t){if(s.current.has(e.eventId))continue;s.current.add(e.eventId);let t=e.targetId||r;t&&l.push({id:++dn,event:e,startId:e.actorId,endId:t,sourceName:a(e.actorId),targetName:a(t),color:fn(e,n.get(t)?.color??n.get(e.actorId)?.color)})}l.length>0&&o(e=>[...e,...l].slice(-8))},[r,i,e,t]),(0,Z.jsx)(`group`,{children:a.map(e=>(0,Z.jsx)(mn,{transfer:e,swarmRef:n,coordinatorId:r,onDone:()=>o(t=>t.filter(t=>t.id!==e.id))},e.id))})}function mn({transfer:e,swarmRef:t,coordinatorId:n,onDone:r}){let i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(0),c=(0,q.useRef)(!1),l=(0,q.useRef)(new E),u=(0,q.useRef)(new E);j((d,f)=>{if(c.current||!i.current)return;s.current=Math.min(un,s.current+f);let p=e.startId===n?ln:t.current.get(e.startId)?.pos,m=e.endId===n?ln:t.current.get(e.endId)?.pos;if(!p||!m){i.current.visible=!1,s.current>=un&&(c.current=!0,r());return}i.current.visible=!0,l.current.copy(p),u.current.copy(m);let h=s.current/un,g=1-(1-Math.min(1,Math.max(0,(h-.14)/.86)))**3;if(i.current.position.lerpVectors(l.current,u.current,g),i.current.position.y+=Math.sin(g*Math.PI)*2.2,i.current.rotation.x+=f*2.4,i.current.rotation.y+=f*3.2,o.current?.position.copy(i.current.position),a.current){a.current.position.copy(l.current),a.current.visible=h<.46;let e=.8+h*5.2%1*1.35;a.current.scale.setScalar(e),a.current.rotation.y+=f*.8}s.current>=un&&(c.current=!0,r())});let d=e.event.phase===`delegated`?`${e.sourceName} llama a ${e.targetName}`:e.event.phase===`completed`?`${e.sourceName} entrega a ${e.targetName}`:`${e.sourceName} informa a ${e.targetName}`;return(0,Z.jsxs)(`group`,{children:[(0,Z.jsx)(`group`,{ref:a,children:[.72,1.08].map((t,n)=>(0,Z.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,Z.jsx)(`torusGeometry`,{args:[t,n===0?.055:.035,6,28]}),(0,Z.jsx)(`meshBasicMaterial`,{color:e.color,transparent:!0,opacity:n===0?.72:.42,blending:2,depthWrite:!1})]},t))}),(0,Z.jsxs)(`mesh`,{ref:i,children:[(0,Z.jsx)(`octahedronGeometry`,{args:[.3,0]}),(0,Z.jsx)(`meshBasicMaterial`,{color:e.color,transparent:!0,opacity:.98,blending:2,depthWrite:!1})]}),(0,Z.jsx)(`group`,{ref:o,children:(0,Z.jsx)(we,{position:[0,.75,0],center:!0,distanceFactor:20,className:`pointer-events-none select-none`,children:(0,Z.jsxs)(`div`,{className:`office3d-transfer-label is-compact is-${cn(e.event.phase)}`,style:{"--chip-color":e.color},children:[(0,Z.jsx)(`span`,{children:d}),(0,Z.jsx)(`strong`,{children:sn(e.event.phase).toUpperCase()})]})})})]})}function hn({events:e,desks:t,coordinatorId:n}){let r=J(e=>e.setActiveCue),i=(0,q.useRef)(new Set),a=(0,q.useRef)(!1),o=(0,q.useRef)([]),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(new Map),u=(0,q.useRef)(!1),d=(0,q.useCallback)(function e(){if(s.current||o.current.length===0)return;let t=o.current.shift()??null;s.current=t,r(t),t&&(c.current=setTimeout(()=>{s.current=null,r(null),c.current=null,e()},rn(t.phase)))},[r]),f=(0,q.useCallback)(e=>{an(e.phase)&&s.current&&!an(s.current.phase)&&(c.current&&clearTimeout(c.current),o.current=on(o.current,s.current),s.current=null,r(null)),o.current=on(o.current,e),d()},[d,r]);return(0,q.useEffect)(()=>{if(!a.current){e.forEach(e=>i.current.add(e.eventId)),a.current=!0;return}for(let t of e)i.current.has(t.eventId)||(i.current.add(t.eventId),f(t))},[e,f]),(0,q.useEffect)(()=>{if(!u.current){l.current=new Map(t.map(e=>[e.agent.id,e.state])),u.current=!0;return}for(let e of t){let t=l.current.get(e.agent.id);e.state===`stuck`&&t!==`stuck`&&f({eventId:`blocked:${e.agent.id}:${Date.now()}`,phase:`blocked`,taskRef:e.taskId??`agent:${e.agent.id}`,taskName:e.currentTask??`Ejecución del agente`,actorId:e.agent.id,targetId:n,detail:`El agente necesita atención`,timestamp:Date.now()}),l.current.set(e.agent.id,e.state)}},[n,t,f]),(0,q.useEffect)(()=>()=>{c.current&&clearTimeout(c.current),r(null)},[r]),null}function gn(e){let t=(0,K.c)(68),{desks:n,coordinator:r,interactions:i,workEvents:a}=e,o=J(Cn),s=J(Sn),c=J(xn),l=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`off`:c,u=J(bn),d=J(yn),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Map,t[0]=f):f=t[0];let p=(0,q.useRef)(f),m;t[1]===n?m=t[2]:(m=n.some(vn),t[1]=n,t[2]=m);let h=m,g;t[3]===o?g=t[4]:(g=o===`high`?[1,1.75]:1,t[3]=o,t[4]=g);let _;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_={antialias:!1,alpha:!1,powerPreference:`high-performance`},t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={fov:42,near:.1,far:220,position:[0,46,62]},t[6]=v):v=t[6];let y;t[7]===d?y=t[8]:(y=()=>d(null),t[7]=d,t[8]=y);let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(`color`,{attach:`background`,args:[`#04060c`]}),t[9]=b):b=t[9];let x,S,C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(`fog`,{attach:`fog`,args:[`#04060c`,34,100]}),C=(0,Z.jsx)(`ambientLight`,{intensity:.35}),x=(0,Z.jsx)(`directionalLight`,{position:[12,24,8],intensity:.35,color:`#9db8ff`}),t[10]=x,t[11]=S,t[12]=C):(x=t[10],S=t[11],C=t[12]);let w=r?.id??null,T;t[13]!==n||t[14]!==w||t[15]!==a?(T=(0,Z.jsx)(hn,{events:a,desks:n,coordinatorId:w}),t[13]=n,t[14]=w,t[15]=a,t[16]=T):T=t[16];let E;t[17]!==n||t[18]!==l?(E=(0,Z.jsx)(Ht,{desks:n,swarmRef:p,motion:l}),t[17]=n,t[18]=l,t[19]=E):E=t[19];let D=r?.id??null,O;t[20]!==l||t[21]!==u||t[22]!==D?(O=(0,Z.jsx)(Je,{coordinatorId:D,selectedAgentId:u,swarmRef:p,motion:l}),t[20]=l,t[21]=u,t[22]=D,t[23]=O):O=t[23];let k;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(rt,{}),t[24]=k):k=t[24];let A;t[25]!==h||t[26]!==r?(A=(0,Z.jsx)(ht,{coordinator:r,active:h,swarmRef:p}),t[25]=h,t[26]=r,t[27]=A):A=t[27];let j;t[28]===n?j=t[29]:(j=n.map(e=>(0,Z.jsx)(tn,{desk:e,swarmRef:p},e.agent.id)),t[28]=n,t[29]=j);let ee=r?.id??null,M;t[30]!==n||t[31]!==i||t[32]!==ee?(M=(0,Z.jsx)(Tt,{desks:n,interactions:i,swarmRef:p,coordinatorId:ee}),t[30]=n,t[31]=i,t[32]=ee,t[33]=M):M=t[33];let N;t[34]!==r?.id||t[35]!==r?.name||t[36]!==n||t[37]!==l||t[38]!==a?(N=l===`calm`&&(0,Z.jsx)(pn,{desks:n,events:a,swarmRef:p,coordinatorId:r?.id??null,coordinatorName:r?.name??`Coordinador`}),t[34]=r?.id,t[35]=r?.name,t[36]=n,t[37]=l,t[38]=a,t[39]=N):N=t[39];let P;t[40]!==n||t[41]!==l||t[42]!==o?(P=l===`calm`&&o===`high`&&(0,Z.jsx)(Rt,{desks:n,swarmRef:p}),t[40]=n,t[41]=l,t[42]=o,t[43]=P):P=t[43];let I;t[44]!==l||t[45]!==o?(I=l===`calm`&&o===`high`&&(0,Z.jsx)(Pt,{}),t[44]=l,t[45]=o,t[46]=I):I=t[46];let L;t[47]===o?L=t[48]:(L=(0,Z.jsx)(Bt,{quality:o}),t[47]=o,t[48]=L);let R;t[49]!==o||t[50]!==s?(R=(0,Z.jsx)(Re,{bounds:_n,onDecline:()=>{o===`high`&&s(`low`)}}),t[49]=o,t[50]=s,t[51]=R):R=t[51];let z;t[52]!==T||t[53]!==E||t[54]!==O||t[55]!==A||t[56]!==j||t[57]!==M||t[58]!==N||t[59]!==P||t[60]!==I||t[61]!==L||t[62]!==R?(z=(0,Z.jsxs)(q.Suspense,{fallback:null,children:[T,E,O,k,A,j,M,N,P,I,L,R]}),t[52]=T,t[53]=E,t[54]=O,t[55]=A,t[56]=j,t[57]=M,t[58]=N,t[59]=P,t[60]=I,t[61]=L,t[62]=R,t[63]=z):z=t[63];let B;return t[64]!==z||t[65]!==g||t[66]!==y?(B=(0,Z.jsxs)(F,{dpr:g,gl:_,camera:v,onPointerMissed:y,children:[b,S,C,x,z]}),t[64]=z,t[65]=g,t[66]=y,t[67]=B):B=t[67],B}function _n(e){return[Math.min(42,e*.68),e*.92]}function vn(e){return e.state===`thinking`||e.state===`tool_call`||e.state===`stuck`}function yn(e){return e.select}function bn(e){return e.selectedAgentId}function xn(e){return e.motion}function Sn(e){return e.setQuality}function Cn(e){return e.quality}function wn(e){let t=(0,K.c)(8),{events:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`office3d-ticker-title`,children:`Actividad`}),t[0]=r):r=t[0];let i;t[1]===n.length?i=t[2]:(i=n.length===0&&(0,Z.jsx)(`div`,{className:`office3d-ticker-empty`,children:`Sin eventos todavía…`}),t[1]=n.length,t[2]=i);let a;t[3]===n?a=t[4]:(a=n.slice(0,6).map(Tn),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`office3d-ticker`,children:[r,(0,Z.jsxs)(`div`,{className:`office3d-ticker-list`,role:`log`,"aria-live":`polite`,"aria-relevant":`additions`,children:[i,a]})]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function Tn(e){return(0,Z.jsxs)(`div`,{className:`office3d-ticker-item office3d-ticker-item--${e.kind}`,children:[(0,Z.jsx)(`span`,{className:`office3d-ticker-dot`,style:{background:e.color}}),(0,Z.jsx)(`span`,{className:`office3d-ticker-text`,children:e.text}),(0,Z.jsx)(`span`,{className:`office3d-ticker-time`,children:e.time})]},e.id)}var En=0;function Dn(e,t){return t===`tool_call`&&!e.currentTask?{text:`${e.agent.name} · ${Wt(e.currentTool)??`Ejecutando herramienta`}`,color:e.color,kind:`work`}:t===`thinking`&&!e.currentTask?{text:`${e.agent.name} está pensando…`,color:e.color,kind:`info`}:t===`stuck`?{text:`${e.agent.name} necesita ayuda`,color:`#f87171`,kind:`warn`}:null}function On(e,t,n,r){let[i,a]=(0,q.useState)([]),o=(0,q.useRef)(new Map),s=(0,q.useRef)(new Set),c=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{let i=o.current,l=new Map(e.map(e=>[e.agent.id,e])),u=[],d=new Date().toLocaleTimeString(`es`,{hour12:!1}),f=e=>e===n?.id?n.name:l.get(e)?.agent.name??e;if(c.current)for(let e of r){if(s.current.has(e.eventId))continue;s.current.add(e.eventId);let t=cn(e.phase);u.push({id:++En,time:new Date(e.timestamp).toLocaleTimeString(`es`,{hour12:!1}),text:`${sn(e.phase)} · ${f(e.actorId)}${e.targetId?` → ${f(e.targetId)}`:``}: «${e.taskName}»`,color:t===`alert`?`#fb7185`:t===`done`?`#86efac`:l.get(e.targetId??``)?.color??`#f59e0b`,kind:t===`alert`?`warn`:t===`done`?`done`:`work`})}else{r.forEach(e=>s.current.add(e.eventId));for(let e of t)u.push({id:++En,time:d,text:`${f(e.sourceId)} → ${f(e.targetId)}: «${e.taskName??`Flujo activo`}»`,color:l.get(e.targetId)?.color??`#f59e0b`,kind:`work`});c.current=!0}for(let t of e){let e=i.get(t.agent.id);if(e&&e.state!==t.state){let e=Dn(t,t.state);e&&u.push({id:++En,time:d,...e})}i.set(t.agent.id,{state:t.state})}u.length&&a(e=>[...u.reverse(),...e].slice(0,24))},[e,t,n,r]),i}var kn={archived:`Archivado manualmente`,disabled:`Desactivado`,idle:`En espera`,thinking:`Pensando`,tool_call:`Ejecutando herramienta`,stuck:`Atascado`};function An({desk:e,delegatorName:t}){let n=J(e=>e.select);if(!e)return null;let{agent:r}=e;return(0,Z.jsxs)(`aside`,{className:`office3d-inspector`,style:{"--agent-color":e.color},children:[(0,Z.jsx)(`button`,{type:`button`,className:`office3d-inspector-close`,onClick:()=>n(null),"aria-label":`Cerrar`,children:(0,Z.jsx)(y,{size:14})}),(0,Z.jsxs)(`div`,{className:`office3d-inspector-head`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-orb`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`office3d-inspector-name`,children:r.name}),(0,Z.jsx)(`span`,{className:`office3d-inspector-id`,children:r.id})]})]}),(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Rol`}),(0,Z.jsx)(`span`,{children:r.role===`coordinator`?`Coordinador`:`Especialista`})]}),(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Estado`}),(0,Z.jsx)(`span`,{className:`office3d-state-chip office3d-state-chip--${e.state}`,children:kn[e.state]})]}),e.currentTask&&(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Tarea`}),(0,Z.jsx)(`span`,{className:`office3d-inspector-task`,children:e.currentTask})]}),e.delegatedBy&&(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Delegado por`}),(0,Z.jsx)(`span`,{children:t})]}),e.currentTool&&(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Herramienta`}),(0,Z.jsx)(`span`,{className:`office3d-inspector-tool`,children:Wt(e.currentTool)})]}),(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Workers`}),(0,Z.jsx)(`span`,{className:`font-mono`,children:e.workerCount})]}),r.description&&(0,Z.jsx)(`p`,{className:`office3d-inspector-desc`,children:r.description})]})}function jn({coordinator:e}){let t=J(e=>e.select);return e?(0,Z.jsxs)(`aside`,{className:`office3d-inspector office3d-inspector--coordinator`,style:{"--agent-color":`#f59e0b`},children:[(0,Z.jsx)(`button`,{type:`button`,className:`office3d-inspector-close`,onClick:()=>t(null),"aria-label":`Cerrar`,children:(0,Z.jsx)(y,{size:14})}),(0,Z.jsxs)(`div`,{className:`office3d-inspector-head`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-orb`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-eyebrow`,children:`Coordinador principal`}),(0,Z.jsx)(`h3`,{className:`office3d-inspector-name`,children:e.name})]})]}),(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Función`}),(0,Z.jsx)(`span`,{children:`Asigna y supervisa`})]}),(0,Z.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,Z.jsx)(`span`,{className:`office3d-inspector-label`,children:`Estado`}),(0,Z.jsx)(`span`,{className:`office3d-state-chip office3d-state-chip--${e.status}`,children:e.status===`tool_call`?`Ejecutando herramienta`:e.status===`thinking`?`Pensando`:`En espera`})]}),typeof e.description==`string`&&(0,Z.jsx)(`p`,{className:`office3d-inspector-desc`,children:e.description})]}):null}var Mn={archived:`Archivado`,disabled:`Desactivado`,idle:`Disponible`,thinking:`Pensando`,tool_call:`Ejecutando`,stuck:`Necesita ayuda`};function Nn(e){let t=e.agent.description?.trim();return t?t.length>62?`${t.slice(0,59)}…`:t:`Agente especialista`}function Pn({coordinator:e,desks:t,interactions:n,workEvents:r}){let[i,a]=(0,q.useState)(!1),o=J(e=>e.selectedAgentId),u=J(e=>e.select),d=new Map(t.map(e=>[e.agent.id,e])),p=t=>t===e?.id?e.name:d.get(t)?.agent.name??t,m=new Map;for(let e of r)m.set(e.taskRef,e);return(0,Z.jsxs)(`aside`,{className:`office3d-roster office3d-glass ${i?`is-collapsed`:``}`,"aria-label":`Equipo y flujo de trabajo`,children:[(0,Z.jsxs)(`div`,{className:`office3d-roster-heading`,children:[(0,Z.jsxs)(`div`,{className:`office3d-roster-title`,children:[(0,Z.jsx)(`span`,{className:`office3d-section-kicker`,children:`CENTRO DE OPERACIONES`}),(0,Z.jsx)(`h2`,{children:`Quién hace qué`})]}),(0,Z.jsx)(`span`,{className:`office3d-roster-live`,"aria-label":`${n.length} flujos activos`,children:(0,Z.jsx)(f,{size:15,className:n.length?`is-active`:``})}),(0,Z.jsx)(`button`,{type:`button`,className:`office3d-roster-toggle`,onClick:()=>a(e=>!e),"aria-expanded":!i,"aria-label":i?`Abrir centro de operaciones`:`Colapsar centro de operaciones`,title:i?`Abrir centro de operaciones`:`Colapsar centro de operaciones`,children:i?(0,Z.jsx)(c,{size:16}):(0,Z.jsx)(l,{size:16})})]}),(0,Z.jsxs)(`div`,{className:`office3d-roster-content`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`office3d-roster-coordinator ${o===e?.id?`is-selected`:``}`,onClick:()=>e&&u(o===e.id?null:e.id),disabled:!e,children:[(0,Z.jsx)(G,{size:17}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`small`,{children:`ABEJA REINA · COORDINADOR`}),(0,Z.jsx)(`strong`,{children:e?.name??`Conectando…`}),(0,Z.jsx)(`em`,{children:`Asigna · supervisa · recibe`})]})]}),(0,Z.jsxs)(`div`,{className:`office3d-flow`,children:[(0,Z.jsxs)(`div`,{className:`office3d-section-title`,children:[`Flujo activo `,(0,Z.jsx)(`span`,{children:n.length})]}),n.length===0?(0,Z.jsx)(`p`,{className:`office3d-flow-empty`,children:`El equipo está disponible. Las delegaciones aparecerán aquí.`}):n.map(e=>{let t=d.get(e.targetId),n=e.taskId?m.get(e.taskId):null,r=n?.phase===`completed`||n?.phase===`review_passed`?3:e.kind===`reviews`?2:+(t?.state===`thinking`||t?.state===`tool_call`),i=n?.phase===`failed`||n?.phase===`aborted`||n?.phase===`review_failed`||n?.phase===`blocked`;return(0,Z.jsxs)(`div`,{className:`office3d-flow-item ${i?`is-failed`:``}`,children:[(0,Z.jsx)(`span`,{children:p(e.sourceId)}),(0,Z.jsx)(s,{size:12}),(0,Z.jsx)(`span`,{children:p(e.targetId)}),(0,Z.jsx)(`strong`,{children:e.kind===`reviews`?`Revisión`:`Delegación`}),e.taskName&&(0,Z.jsx)(`small`,{children:e.taskName}),(0,Z.jsx)(`div`,{className:`office3d-flow-steps`,"aria-label":`Progreso del trabajo`,children:[`Delegado`,`Trabajando`,`Revisando`,i?`Atención`:`Entregado`].map((e,t)=>(0,Z.jsx)(`span`,{className:`${t<r?`is-done`:``} ${t===r?`is-current`:``}`,children:e},e))})]},e.id)})]}),(0,Z.jsxs)(`div`,{className:`office3d-agents-list`,children:[(0,Z.jsxs)(`div`,{className:`office3d-section-title`,children:[`Especialistas `,(0,Z.jsx)(`span`,{children:t.length})]}),t.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`office3d-agent-row ${o===e.agent.id?`is-selected`:``}`,onClick:()=>u(o===e.agent.id?null:e.agent.id),style:{"--agent-color":e.color},children:[(0,Z.jsx)(`span`,{className:`office3d-agent-status office3d-name-dot--${e.state}`}),(0,Z.jsxs)(`span`,{className:`office3d-agent-copy`,children:[(0,Z.jsx)(`strong`,{children:e.agent.name}),(0,Z.jsx)(`small`,{children:e.currentTask||Nn(e)})]}),(0,Z.jsx)(`em`,{children:Mn[e.state]})]},e.agent.id))]})]})]})}function Fn(e){let t=(0,K.c)(46),{coordinator:n,desks:r}=e,i=J(Ln);if(!i)return null;let a,o,s,c,l,d,m,h,g,_;if(t[0]!==n||t[1]!==i.actorId||t[2]!==i.phase||t[3]!==i.targetId||t[4]!==r){let e=new Map(r.map(In)),v=t=>t?t===n?.id?n.name:e.get(t)?.agent.name??`Agente`:n?.name??`Coordinador`,y;t[15]===i.phase?y=t[16]:(y=cn(i.phase),t[15]=i.phase,t[16]=y);let b=y,x=b===`alert`?S:b===`done`?u:b===`review`?re:i.phase===`delegated`?p:f;h=`office3d-now office3d-glass is-${b}`,g=b===`alert`?`assertive`:`polite`,_=`true`,t[17]===x?o=t[18]:(o=(0,Z.jsx)(`div`,{className:`office3d-now-icon`,children:(0,Z.jsx)(x,{size:17})}),t[17]=x,t[18]=o),l=`office3d-now-copy`,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`span`,{children:`AHORA OCURRE`}),t[19]=d):d=t[19];let C;t[20]===i.phase?C=t[21]:(C=sn(i.phase),t[20]=i.phase,t[21]=C),t[22]===C?m=t[23]:(m=(0,Z.jsx)(`strong`,{children:C}),t[22]=C,t[23]=m),a=v(i.actorId),t[24]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`b`,{children:`→`}),t[24]=s):s=t[24],c=v(i.targetId),t[0]=n,t[1]=i.actorId,t[2]=i.phase,t[3]=i.targetId,t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c,t[9]=l,t[10]=d,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else a=t[5],o=t[6],s=t[7],c=t[8],l=t[9],d=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[25]!==a||t[26]!==s||t[27]!==c?(v=(0,Z.jsxs)(`p`,{children:[a,s,c]}),t[25]=a,t[26]=s,t[27]=c,t[28]=v):v=t[28];let y;t[29]===i.taskName?y=t[30]:(y=(0,Z.jsx)(`small`,{children:i.taskName}),t[29]=i.taskName,t[30]=y);let b;t[31]===i.detail?b=t[32]:(b=i.detail&&(0,Z.jsx)(`em`,{children:i.detail}),t[31]=i.detail,t[32]=b);let x;t[33]!==v||t[34]!==y||t[35]!==b||t[36]!==l||t[37]!==d||t[38]!==m?(x=(0,Z.jsxs)(`div`,{className:l,children:[d,m,v,y,b]}),t[33]=v,t[34]=y,t[35]=b,t[36]=l,t[37]=d,t[38]=m,t[39]=x):x=t[39];let C;return t[40]!==o||t[41]!==x||t[42]!==h||t[43]!==g||t[44]!==_?(C=(0,Z.jsxs)(`section`,{className:h,"aria-live":g,"aria-atomic":_,children:[o,x]}),t[40]=o,t[41]=x,t[42]=h,t[43]=g,t[44]=_,t[45]=C):C=t[45],C}function In(e){return[e.agent.id,e]}function Ln(e){return e.activeCue}var $=null;function Rn(){if(!(typeof window>`u`))try{$??=new AudioContext,$.state===`suspended`&&$.resume()}catch{$=null}}var zn={delegated:[520,680],review_passed:[720,960],review_failed:[260,190],completed:[660,880],failed:[220,150],aborted:[280,210],blocked:[240,180]};function Bn(e){if(Rn(),!$||$.state!==`running`)return;let[t,n]=zn[e.phase],r=$.currentTime,i=$.createGain();i.gain.setValueAtTime(1e-4,r),i.gain.exponentialRampToValueAtTime(.045,r+.018),i.gain.exponentialRampToValueAtTime(1e-4,r+.34),i.connect($.destination);for(let[e,a]of[[t,0],[n,.12]]){let t=$.createOscillator();t.type=`sine`,t.frequency.setValueAtTime(e,r+a),t.connect(i),t.start(r+a),t.stop(r+a+.2)}}function Vn(e){let t=(0,K.c)(80),{desks:n,coordinator:r,interactions:i,workEvents:a,isConnected:s,selectedDesk:c,coordinatorSelected:l,coordinatorName:u}=e,f=J(Jn),p=J(qn),v=J(Kn),y=J(Gn),b=J(Wn),x=J(Un),S=On(n,i,r,a),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=new Set,t[0]=w):w=t[0];let T=(0,q.useRef)(w),E=(0,q.useRef)(!1),D,O;t[1]!==b||t[2]!==a?(D=()=>{if(!E.current){a.forEach(e=>T.current.add(e.eventId)),E.current=!0;return}for(let e of a)T.current.has(e.eventId)||(T.current.add(e.eventId),b&&Bn(e))},O=[b,a],t[1]=b,t[2]=a,t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,q.useEffect)(D,O);let k;t[5]===n?k=t[6]:(k=n.filter(Hn),t[5]=n,t[6]=k);let A=k.length,j;t[7]!==u||t[8]!==n||t[9]!==c?(j=c?.delegatedBy?n.find(e=>e.agent.id===c.delegatedBy)?.agent.name??u:u,t[7]=u,t[8]=n,t[9]=c,t[10]=j):j=t[10];let ee=j,M,N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`div`,{className:`office3d-logo`,children:(0,Z.jsx)(C,{size:18})}),N=(0,Z.jsx)(`h1`,{className:`office3d-title`,children:`HoloHive · Oficina 3D`}),t[11]=M,t[12]=N):(M=t[11],N=t[12]);let P;t[13]!==n.length||t[14]!==A?(P=(0,Z.jsxs)(`div`,{className:`office3d-topbar-left`,children:[M,(0,Z.jsxs)(`div`,{children:[N,(0,Z.jsxs)(`p`,{className:`office3d-subtitle`,children:[n.length,` especialistas · `,A,` trabajando`]})]})]}),t[13]=n.length,t[14]=A,t[15]=P):P=t[15];let F=`office3d-live-badge ${s?`is-live`:`is-off`}`,I;t[16]===s?I=t[17]:(I=s?(0,Z.jsx)(_,{size:12}):(0,Z.jsx)(g,{size:12}),t[16]=s,t[17]=I);let L=s?`LIVE`:`OFFLINE`,R;t[18]!==I||t[19]!==L||t[20]!==F?(R=(0,Z.jsxs)(`span`,{className:F,children:[I,L]}),t[18]=I,t[19]=L,t[20]=F,t[21]=R):R=t[21];let z;t[22]!==f||t[23]!==p?(z=()=>p(f===`high`?`low`:`high`),t[22]=f,t[23]=p,t[24]=z):z=t[24];let B;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(d,{size:13}),t[25]=B):B=t[25];let V=f===`high`?`Alta`:`Eco`,H;t[26]!==z||t[27]!==V?(H=(0,Z.jsxs)(`button`,{type:`button`,className:`office3d-hud-btn`,onClick:z,title:`Alternar calidad gráfica`,children:[B,V]}),t[26]=z,t[27]=V,t[28]=H):H=t[28];let te=`office3d-hud-btn ${v===`calm`?`is-on`:``}`,U;t[29]!==v||t[30]!==y?(U=()=>y(v===`calm`?`off`:`calm`),t[29]=v,t[30]=y,t[31]=U):U=t[31];let W;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(o,{size:13}),t[32]=W):W=t[32];let ne=v===`calm`?`Enfoque`:`Fijo`,G;t[33]!==te||t[34]!==U||t[35]!==ne?(G=(0,Z.jsxs)(`button`,{type:`button`,className:te,onClick:U,title:`Alternar enfoque y movimiento de eventos`,children:[W,ne]}),t[33]=te,t[34]=U,t[35]=ne,t[36]=G):G=t[36];let re=`office3d-hud-btn ${b?`is-on`:``}`,ie;t[37]!==x||t[38]!==b?(ie=()=>{b||Rn(),x(!b)},t[37]=x,t[38]=b,t[39]=ie):ie=t[39];let ae=b?`Desactivar sonido de eventos`:`Activar sonido de eventos`,oe;t[40]===b?oe=t[41]:(oe=b?(0,Z.jsx)(m,{size:13}):(0,Z.jsx)(h,{size:13}),t[40]=b,t[41]=oe);let se=b?`Audio`:`Silencio`,ce;t[42]!==b||t[43]!==re||t[44]!==ie||t[45]!==ae||t[46]!==oe||t[47]!==se?(ce=(0,Z.jsxs)(`button`,{type:`button`,className:re,onClick:ie,title:ae,"aria-pressed":b,children:[oe,se]}),t[42]=b,t[43]=re,t[44]=ie,t[45]=ae,t[46]=oe,t[47]=se,t[48]=ce):ce=t[48];let le;t[49]!==R||t[50]!==H||t[51]!==G||t[52]!==ce?(le=(0,Z.jsxs)(`div`,{className:`office3d-topbar-right`,children:[R,H,G,ce]}),t[49]=R,t[50]=H,t[51]=G,t[52]=ce,t[53]=le):le=t[53];let ue;t[54]!==le||t[55]!==P?(ue=(0,Z.jsxs)(`header`,{className:`office3d-topbar office3d-glass`,children:[P,le]}),t[54]=le,t[55]=P,t[56]=ue):ue=t[56];let Y;t[57]!==r||t[58]!==n?(Y=(0,Z.jsx)(Fn,{coordinator:r,desks:n}),t[57]=r,t[58]=n,t[59]=Y):Y=t[59];let de;t[60]!==r||t[61]!==n||t[62]!==i||t[63]!==a?(de=(0,Z.jsx)(Pn,{coordinator:r,desks:n,interactions:i,workEvents:a}),t[60]=r,t[61]=n,t[62]=i,t[63]=a,t[64]=de):de=t[64];let fe;t[65]===S?fe=t[66]:(fe=(0,Z.jsx)(`div`,{className:`office3d-bottom-left`,children:(0,Z.jsx)(wn,{events:S})}),t[65]=S,t[66]=fe);let pe;t[67]!==ee||t[68]!==c?(pe=(0,Z.jsx)(An,{desk:c,delegatorName:ee}),t[67]=ee,t[68]=c,t[69]=pe):pe=t[69];let me;t[70]!==r||t[71]!==l?(me=l&&(0,Z.jsx)(jn,{coordinator:r}),t[70]=r,t[71]=l,t[72]=me):me=t[72];let he;return t[73]!==ue||t[74]!==Y||t[75]!==de||t[76]!==fe||t[77]!==pe||t[78]!==me?(he=(0,Z.jsxs)(`div`,{className:`office3d-hud`,children:[ue,Y,de,fe,pe,me]}),t[73]=ue,t[74]=Y,t[75]=de,t[76]=fe,t[77]=pe,t[78]=me,t[79]=he):he=t[79],he}function Hn(e){return e.state===`thinking`||e.state===`tool_call`}function Un(e){return e.setSoundEnabled}function Wn(e){return e.soundEnabled}function Gn(e){return e.setMotion}function Kn(e){return e.motion}function qn(e){return e.setQuality}function Jn(e){return e.quality}function Yn(){let e=(0,K.c)(20),{coordinator:t,desks:n,interactions:r,workEvents:i,isConnected:a}=ie(),o=J(Xn),s;e[0]!==n||e[1]!==o?(s=n.find(e=>e.agent.id===o)??null,e[0]=n,e[1]=o,e[2]=s):s=e[2];let c=s,l=!!t&&o===t.id,u=t?.name??`Coordinador`,d=t??null,f;e[3]!==n||e[4]!==r||e[5]!==d||e[6]!==i?(f=(0,Z.jsx)(gn,{desks:n,coordinator:d,interactions:r,workEvents:i}),e[3]=n,e[4]=r,e[5]=d,e[6]=i,e[7]=f):f=e[7];let p=t??null,m;e[8]!==u||e[9]!==l||e[10]!==n||e[11]!==r||e[12]!==a||e[13]!==c||e[14]!==p||e[15]!==i?(m=(0,Z.jsx)(Vn,{desks:n,coordinator:p,interactions:r,workEvents:i,isConnected:a,selectedDesk:c,coordinatorSelected:l,coordinatorName:u}),e[8]=u,e[9]=l,e[10]=n,e[11]=r,e[12]=a,e[13]=c,e[14]=p,e[15]=i,e[16]=m):m=e[16];let h;return e[17]!==f||e[18]!==m?(h=(0,Z.jsxs)(`div`,{className:`office3d-root`,children:[f,m]}),e[17]=f,e[18]=m,e[19]=h):h=e[19],h}function Xn(e){return e.selectedAgentId}export{Yn as default};