busybits 2.4.0 → 2.5.0

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 (27) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +12 -0
  3. package/dist/build.json +2 -2
  4. package/dist/cli/busybits.js +39 -0
  5. package/dist/client/bundle/app-QVC1DacC.js +24 -0
  6. package/dist/client/bundle/{city-CdnZXWrk.js → city-S-WD2HZe.js} +1 -1
  7. package/dist/client/bundle/{daystats-BkQMrXRq.js → daystats-BaQmwDUl.js} +1 -1
  8. package/dist/client/bundle/{dom-DWAK9rwv.js → dom-z_NH7Uh7.js} +1 -1
  9. package/dist/client/bundle/{en-BD-d_FWo.js → en-DK_q-bO7.js} +1 -1
  10. package/dist/client/bundle/{es-ZgMlZ_LY.js → es-CUFTupoF.js} +1 -1
  11. package/dist/client/bundle/{format-BejmJ6Mv.js → format-BrkFnmVF.js} +1 -1
  12. package/dist/client/bundle/{fr-DOSCFvER.js → fr-CY87v2sh.js} +1 -1
  13. package/dist/client/bundle/{main-CdDU0hle.js → main-DNVSCypp.js} +2 -2
  14. package/dist/client/bundle/{ptypane-CHGZb-H_.js → ptypane-DAVYBQ48.js} +1 -1
  15. package/dist/client/bundle/{room-name-tykoJBug.js → room-name-Cg36nI5X.js} +1 -1
  16. package/dist/client/bundle/{simulator-BjUGGls6.js → simulator-CDeHv4xc.js} +1 -1
  17. package/dist/client/bundle/world-model-CPBvh77_.js +1 -0
  18. package/dist/client/bundle/{world-stream-1LIEwTsn.js → world-stream-FBFp8Oax.js} +1 -1
  19. package/dist/client/index.html +1 -1
  20. package/dist/server/index.js +76 -19
  21. package/mod/habblaud/.claude-plugin/plugin.json +1 -1
  22. package/mod/habblaud-mensagens/.claude-plugin/plugin.json +1 -1
  23. package/mod/habblaud-permissoes/.claude-plugin/plugin.json +1 -1
  24. package/mod/habblaud-pi/package.json +1 -1
  25. package/package.json +1 -1
  26. package/dist/client/bundle/app-Chm8kKN4.js +0 -24
  27. package/dist/client/bundle/world-model-Bi4Y820L.js +0 -1
@@ -0,0 +1 @@
1
+ import{s as e}from"./main-DNVSCypp.js";import{l as t,n}from"./simulator-CDeHv4xc.js";import{c as r,g as i}from"./format-BrkFnmVF.js";var a=e=>new TextEncoder().encode(e).length;function o(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}var s=e=>typeof e==`object`&&!!e&&!Array.isArray(e),c=e=>typeof e==`number`&&Number.isFinite(e);function l(e){if(s(e)){if(e.kind===`agent`&&typeof e.agentId==`string`&&e.agentId)return{kind:`agent`,agentId:e.agentId};if(e.kind===`script`&&(e.name===void 0||typeof e.name==`string`))return{kind:`script`,...typeof e.name==`string`?{name:e.name}:{}}}}function u(e){if(!s(e))return;let t=l(e.from);if(typeof e.id!=`string`||!e.id||typeof e.title!=`string`||!e.title||!t||e.status!==`open`&&e.status!==`resolved`||!c(e.createdAt)||!c(e.updatedAt))return;let n={id:e.id,title:e.title.slice(0,200),from:t,scope:`local`,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt};return typeof e.key==`string`&&e.key&&(n.key=e.key.slice(0,128)),typeof e.body==`string`&&a(e.body)<=8192&&(n.body=e.body),typeof e.link==`string`&&e.link.length<=2048&&o(e.link)&&(n.link=e.link),c(e.resolvedAt)&&(n.resolvedAt=e.resolvedAt),typeof e.machine==`string`&&e.machine&&(n.machine=e.machine),n}var d=32768;function f(e){let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=[];for(let t=0;t<e.length;t+=d)n.push(String.fromCharCode.apply(null,e.subarray(t,t+d)));return btoa(n.join(``))}async function p(t){try{return f(new Uint8Array(await t.arrayBuffer()))}catch{throw Error(e(`não deu para ler o arquivo`))}}function m(e=import.meta.url){try{return/\/bundle\/(main-[\w-]+)\.js$/.exec(new URL(e).pathname)?.[1]}catch{return}}function h(e){return e.behavior}var ee=2,te=2e3,g=3e4;function _(e){return Math.min(g,te*2**Math.max(0,e))}function ne(e){let t=new URLSearchParams(e),n=e=>{let n=t.get(e);if(n===null||n.trim()===``)return null;let r=Number(n);return Number.isFinite(r)?r:null},r=n(`speed`),i=n(`sessions`),a=n(`seed`);return{speed:r!==null&&r>0?Math.min(r,50):1,sessions:i!==null&&i>=0?Math.min(Math.floor(i),40):4,...a!==null&&a>=0?{seed:Math.floor(a)}:{},...t.get(`noquota`)===`1`?{codexNoQuota:!0}:{}}}var re=[{name:`compact`,description:e(`Resume a conversa para liberar contexto`),source:`builtin`},{name:`context`,description:e(`Mostra o uso do contexto`),source:`builtin`},{name:`review`,description:e(`Revisa um pull request`),source:`plugin`,plugin:`code-review`}],ie=class{snapshot=null;feed=[];connection=`connecting`;mock;inboxFrame={items:[]};listeners=new Map;agentIndex=new Map;roomIndex=new Map;source=null;mockTimer=null;search;openStream;attempts=0;retryTimer=null;retryAt=null;stopped=!0;onOnline=()=>{!this.stopped&&this.connection===`closed`&&this.reconnectNow()};replay=!1;live=null;constructor(e={}){this.mock=!!e.mock,this.search=e.search??(typeof location<`u`?location.search:``),this.openStream=e.eventSource??(e=>new EventSource(e))}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>void n.delete(t)}connect(){if(this.stopped){if(this.stopped=!1,this.mock)return this.startMock();this.startSSE()}}disconnect(){this.stopped=!0,typeof removeEventListener==`function`&&removeEventListener(`online`,this.onOnline),this.clearRetry(),this.closeSource(),this.mockTimer&&clearInterval(this.mockTimer),this.mockTimer=null}reconnectNow(){this.mock||(this.clearRetry(),this.closeSource(),this.stopped=!1,this.startSSE())}get nextRetryAt(){return this.retryAt}agent(e){return this.agentIndex.get(e)}room(e){return this.roomIndex.get(e)}agentsInRoom(e){return(this.snapshot?.agents??[]).filter(t=>t.roomId===e)}async agentHistory(e){if(this.mock||this.replay)return this.agent(e)?.recent??[];let t=await fetch(`/api/agents/${encodeURIComponent(e)}`);return t.ok?(await t.json()).history:this.agent(e)?.recent??[]}async setDemo(e){return this.mock?!0:(await fetch(`/api/demo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})})).ok}async checkUpdates(){return!this.mock&&(await fetch(`/api/updates/check`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`})).ok}async applyUpdate(){if(this.mock)return{ok:!1};let e=await fetch(`/api/updates/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(e.ok)return{ok:!0};let t=await e.json().catch(()=>({}));return t.error?{ok:!1,error:t.error}:{ok:!1}}get replaying(){return this.replay}get liveSnapshot(){return this.replay?this.live?.snap??null:this.snapshot}pushReplay(e){this.replay||(this.replay=!0,this.live=this.snapshot?{snap:this.snapshot,at:Date.now()}:null),this.setSnapshot(e)}stopReplay(){if(!this.replay)return;this.replay=!1;let e=this.live;this.live=null,e?this.setSnapshot({...e.snap,serverTime:e.snap.serverTime+(Date.now()-e.at)}):(this.snapshot=null,this.agentIndex=new Map,this.roomIndex=new Map)}async permissionDetail(e,t){let n=this.agent(e)?.permission;if(n?.id===t&&n.input!==void 0)return n;if(this.mock)return n?.id===t?n:void 0;let r=await fetch(`/api/permissions/${encodeURIComponent(t)}`);if(r.ok)return await r.json()}async decidePermission(t,n){let r=this.snapshot?.agents.find(e=>e.permission?.id===t)?.id,i=()=>{r&&this.emit(`decided`,{agentId:r,verdict:h(n)})};if(this.mock){let r=this.mockSim;if(!r?.decidePermission(t,n))return e(`Este pedido já foi respondido.`);this.applySnapshot(r.snapshot()),i();return}let a=await fetch(`/api/permissions/${encodeURIComponent(t)}/decision`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(a.ok){i();return}try{let e=await a.json();if(typeof e.error==`string`)return e.error}catch{}return e(`Não foi possível responder (erro {0}).`,[a.status])}async saveCharacter(e,t){return this.characterRequest(e,`PUT`,t)}async resetCharacter(e){return this.characterRequest(e,`DELETE`,{})}async characterRequest(t,n,r){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/agents/${encodeURIComponent(t)}/character`,n,r,t=>e(`Não foi possível salvar o personagem (erro {0}).`,[t]))}async writeRequest(t,n,r,i){let a;try{a=await fetch(t,{method:n,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})}catch{return e(`Sem conexão com o Habblaud.`)}if(!a.ok){try{let e=await a.json();if(typeof e.error==`string`)return e.error}catch{}return i(a.status)}}async loadAvatar(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/avatar`);return e.ok?await e.json():null}catch{return null}}async saveAvatar(e){return this.avatarRequest(`PUT`,e)}async resetAvatar(){return this.avatarRequest(`DELETE`,{})}async avatarRequest(t,n){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/avatar`,t,n,t=>e(`Não foi possível salvar o avatar (erro {0}).`,[t]))}get inboxItems(){return this.inboxFrame.items}async resolveInbox(t){return this.mock||this.replay?e(`A mesa só funciona com o escritório ao vivo.`):this.writeRequest(`/api/inbox/${encodeURIComponent(t)}/resolve`,`POST`,{},t=>e(`Não foi possível resolver o item (erro {0}).`,[t]))}applyInbox(e){if(!e||!Array.isArray(e.items))return;let t=e.items.map(u).filter(e=>!!e),n=e.arrived?u(e.arrived):void 0;this.inboxFrame={items:t},this.emit(`inbox`,n?{items:t,arrived:n}:{items:t})}get defaultLook(){return(this.liveSnapshot??this.snapshot)?.defaultLook??{parts:{},since:0}}async loadDefaultLook(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/settings/default-look`);return e.ok?await e.json():null}catch{return null}}async saveDefaultLook(t){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/settings/default-look`,`PUT`,t,t=>e(`Não foi possível salvar o estilo padrão (erro {0}).`,[t]))}async resetDefaultLook(){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/settings/default-look`,`DELETE`,{},t=>e(`Não foi possível salvar o estilo padrão (erro {0}).`,[t]))}async loadAttachmentSettings(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/settings/attachments`);if(!e.ok)return null;let t=(await e.json()).retentionDays;return t===null||typeof t==`number`?{retentionDays:t}:null}catch{return null}}async saveAttachmentSettings(t){return this.mock||this.replay?e(`Editar a limpeza dos anexos só funciona com o escritório ao vivo.`):this.writeRequest(`/api/settings/attachments`,`PUT`,t,t=>e(`Não foi possível salvar a limpeza dos anexos (erro {0}).`,[t]))}async loadMachines(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/central/machines`,{cache:`no-store`});if(!e.ok)return null;let t=(await e.json()).machines;return Array.isArray(t)?t:null}catch{return null}}async createPairing(){if(this.mock||this.replay)return{error:e(`Parear máquinas só funciona com o escritório ao vivo.`)};let t;try{t=await fetch(`/api/central/pairing`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`,cache:`no-store`})}catch{return{error:e(`Sem conexão com o Habblaud.`)}}try{let e=await t.json();if(t.ok&&typeof e.pairing==`string`&&typeof e.code==`string`&&typeof e.expiresAt==`number`&&typeof e.fingerprint==`string`)return{pairing:e.pairing,code:e.code,expiresAt:e.expiresAt,fingerprint:e.fingerprint};if(typeof e.error==`string`)return{error:e.error}}catch{}return{error:e(`Não foi possível gerar o código (erro {0}).`,[t.status])}}async revokeMachine(t){return this.mock||this.replay?e(`Revogar máquinas só funciona com o escritório ao vivo.`):this.writeRequest(`/api/central/machines/${encodeURIComponent(t)}/revoke`,`POST`,{},t=>e(`Não foi possível revogar a máquina (erro {0}).`,[t]))}async loadSatelliteLink(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/satellite/status`,{cache:`no-store`});if(!e.ok)return null;let t=await e.json();return(t.status===`up`||t.status===`down`||t.status===`revoked`||t.status===`unpaired`)&&typeof t.url==`string`&&typeof t.label==`string`?{status:t.status,url:t.url,label:t.label}:null}catch{return null}}async sendMessage(t,n,r=[]){if(this.mock){let e=this.mockSend(t,n);return`message`in e&&this.emit(`sent`,{agentId:t}),e}let i=r.length?{agentId:t,text:n,attachments:r}:{agentId:t,text:n},a=await fetch(`/api/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),o;try{o=await a.json()}catch{}if(a.status===201&&o&&typeof o==`object`)return this.emit(`sent`,{agentId:t}),{message:o};let s=o?.error,c=typeof s==`string`?s:e(`erro {0}`,[a.status]);if(r.length>0&&a.status===410){let e=o?.expired,t=Array.isArray(e)?e.filter(e=>typeof e==`string`):[];return{error:c,expired:t.length?t:r}}return r.length>0&&a.status===500?{error:c,expired:r}:{error:c}}async uploadMessageImage(t){if(this.mock)return{error:e(`imagens só funcionam com o escritório ao vivo`)};let n=await p(t),r=await fetch(`/api/messages/attachments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t.name,type:t.type,data:n})}),i;try{i=await r.json()}catch{}let a=i;return r.ok&&typeof a?.id==`string`?{id:a.id}:{error:typeof a?.error==`string`?a.error:e(`erro {0}`,[r.status])}}async dropMessageImage(e){if(!this.mock)try{await fetch(`/api/messages/attachments/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:`{}`})}catch{}}async messageStatus(t){if(this.mock){let e=this.mockOutbox.get(t);return e?{...e}:null}let n=await fetch(`/api/messages/${encodeURIComponent(t)}`);if(n.status===404)return null;if(!n.ok)throw Error(e(`erro {0}`,[n.status]));return await n.json()}async slashCommands(e){if(this.mock)return re.map(e=>({...e}));try{let t=await fetch(`/api/messages/commands/${encodeURIComponent(e)}`);if(!t.ok)return[];let n=await t.json();return Array.isArray(n.commands)?n.commands:[]}catch{return[]}}mockOutbox=new Map;mockSeq=0;mockSend(t,n){let r=this.agent(t);if(!r)return{error:e(`agente desconhecido: ele já saiu do escritório?`)};if(!r.canMessage||r.kind!==`main`||r.status===`offline`)return{error:e(`este agente não recebe mensagens agora`)};let i=Date.now(),a={id:`mock-${i.toString(36)}-${++this.mockSeq}`,agentId:t,status:`queued`,createdAt:i,updatedAt:i};return this.mockOutbox.set(a.id,a),setTimeout(()=>{let r=this.mockSim,i=!!r?.receiveMessage(t,n);Object.assign(a,{status:i?`delivered`:`failed`,updatedAt:Date.now()},i?{}:{error:e(`o agente saiu do escritório`)}),i&&r&&this.applySnapshot(r.snapshot())},1e3),{message:{...a}}}emit(e,t){this.listeners.get(e)?.forEach(n=>{try{n(t)}catch(t){console.error(`[store] listener de "${e}" falhou`,t)}})}setConnection(e){this.connection!==e&&(this.connection=e,this.emit(`connection`,e))}applySnapshot(e){let t=this.replay?this.live?.snap:this.snapshot;t&&e.rev<t.rev&&e.meta.startedAt===t.meta.startedAt||(this.replay?this.live={snap:e,at:Date.now()}:this.setSnapshot(e),this.checkBuild(e.meta.build))}setSnapshot(e){this.snapshot=e,this.agentIndex=new Map(e.agents.map(e=>[e.id,e])),this.roomIndex=new Map(e.rooms.map(e=>[e.id,e])),this.emit(`snapshot`,e),this.emit(`defaultLook`,e.defaultLook??{parts:{},since:0})}updateAnnounced=!1;pageBuildId=m();checkBuild(e){if(this.updateAnnounced||this.mock||!e)return;let t=this.pageBuildId;t&&t!==e&&(this.updateAnnounced=!0,this.emit(`update`,{build:e,current:t}))}applyFeed(e){if(!e.length)return;let t=new Set(this.feed.map(e=>e.id)),n=e.filter(e=>!t.has(e.id));n.length&&(this.feed=[...this.feed,...n].slice(-200),this.emit(`feed`,n))}parse(e,t){try{return JSON.parse(e.data)}catch(e){return console.warn(`[store] ${t} inválido ignorado`,e),null}}startSSE(){typeof addEventListener==`function`&&addEventListener(`online`,this.onOnline),this.setConnection(`connecting`);let e;try{e=this.openStream(`/api/stream`)}catch(e){console.error(`[store] não foi possível abrir o stream`,e),this.setConnection(`closed`),this.scheduleRetry();return}this.source=e;let t=()=>this.source===e;e.addEventListener(`open`,()=>{t()&&(this.attempts=0,this.clearRetry(),this.setConnection(`open`))}),e.addEventListener(`error`,()=>{t()&&(e.readyState===ee?(this.setConnection(`closed`),this.scheduleRetry()):this.setConnection(`connecting`))}),e.addEventListener(`snapshot`,e=>{if(!t())return;let n=this.parse(e,`snapshot`);n&&this.applySnapshot(n)}),e.addEventListener(`feed`,e=>{if(!t())return;let n=this.parse(e,`feed`);n&&this.applyFeed(n)}),e.addEventListener(`notice`,e=>{if(!t())return;let n=this.parse(e,`aviso`);n&&this.emit(`notice`,n)}),e.addEventListener(`attention`,e=>{if(!t())return;let n=this.parse(e,`attention`);n&&this.emit(`attention`,n)}),e.addEventListener(`presence`,e=>{if(!t())return;let n=this.parse(e,`presence`);n&&this.emit(`presence`,n)}),e.addEventListener(`avatar`,e=>{if(!t())return;let n=this.parse(e,`avatar`);n&&this.emit(`avatar`,n)}),e.addEventListener(`inbox`,e=>{if(!t())return;let n=this.parse(e,`inbox`);n&&this.applyInbox(n)}),e.addEventListener(`defaultLook`,e=>{if(!t())return;let n=this.parse(e,`defaultLook`);n&&this.emit(`defaultLook`,n)})}closeSource(){this.source?.close(),this.source=null}scheduleRetry(){if(this.retryTimer||this.mock||this.stopped)return;let e=_(this.attempts);this.attempts++,this.retryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.retryAt=null,!this.stopped&&this.connection===`closed`&&(this.closeSource(),this.startSSE())},e)}clearRetry(){this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=null,this.retryAt=null}mockSim=null;startMock(){if(this.mockTimer)return;this.setConnection(`mock`);let e=new n({...ne(this.search),crowd:!0});this.mockSim=e,this.applySnapshot(e.snapshot()),this.mockTimer=setInterval(()=>{let t=Date.now(),n=e.tick(t);n.changed&&this.applySnapshot(e.snapshot(t)),this.applyFeed(n.feed),n.notices.forEach(e=>this.emit(`notice`,e))},250)}},v=[`short`,`buzz`,`spiky`,`side_part`,`curly`,`afro`,`bob`,`long`,`ponytail`,`bun`,`pigtails`,`mohawk`,`bald`,`wavy`],y=[`tshirt`,`hoodie`,`shirt_tie`,`sweater`,`jacket`,`blouse`,`polo`,`hoodie_up`],b=[`none`,`glasses`,`sunglasses`,`headphones`,`cap`,`beanie`,`earrings`,`bow`,`gamer_headphones`],x=[`none`,`led_mask`,`bandana`,`respirator`,`visor`,`ar_monocle`,`smile_mask`],ae=[`none`,`stubble`,`beard`,`mustache`,`goatee`],oe=[`pants`,`shorts`,`skirt`],S=[`skin`,`hair`,`hairStyle`,`eyes`,`top`,`topAccent`,`topStyle`,`bottom`,`bottomStyle`,`shoes`,`accessory`,`accessoryColor`,`facialHair`],se=[`face`,`faceColor`],C=[...S,...se],ce={hoodie_up:`hoodie`,gamer_headphones:`headphones`};function w(e){return ce[e]??e}var le={hairStyle:v,topStyle:y,bottomStyle:oe,accessory:b,facialHair:ae,face:x},ue=/^#[0-9a-f]{6}$/i,de=/[\p{Cc}\u2028\u2029\u200e\u200f\u202a-\u202e\u2066-\u2069]/u,fe=Object.keys(ce);function pe(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return null;let r=e;for(let e of Object.keys(r))if(!t.includes(e))return null;let i={};for(let e of t){let t=r[e];if(t===void 0)continue;if(typeof t!=`string`)return null;let a=n(e);if(a?!a.includes(t):!ue.test(t))return null;i[e]=a?t:t.toLowerCase()}return i}function me(e){return pe(e,S,e=>le[e]?.filter(e=>!fe.includes(e)))}function he(e){if(typeof e!=`string`)return null;let t=e.normalize(`NFC`).replace(/\s+/g,` `).trim();return!t||de.test(t)||[...t].length>24?null:t}function ge(e){if(!e)return``;let t=S.map(t=>e[t]??``).join(`,`);return e.face===void 0&&e.faceColor===void 0?t:`${t},${e.face??``},${e.faceColor??``}`}function _e(e,t){return e.custom||!t||typeof t.since!=`number`?!1:e.startedAt>=t.since}function ve(e,t){if(typeof e.startedAt!=`number`||!t||!_e({custom:e.custom,startedAt:e.startedAt},t))return e.parts;let n={};for(let r of C){let i=e.parts?.[r]??t.parts?.[r];i!==void 0&&(n[r]=i)}return Object.keys(n).length?n:void 0}var ye=[`#ffe2cc`,`#f6cfb0`,`#eab894`,`#d69f78`,`#bd8560`,`#9a6444`,`#7a4a31`,`#5a3623`],be=[[`#2b2530`,5],[`#3f2c22`,5],[`#5f3c28`,4],[`#87593a`,2.5],[`#b0703c`,1.2],[`#8e3b2b`,1],[`#d6ae68`,1.8],[`#ebdcb0`,.7],[`#8f929b`,.7],[`#d9dbe0`,.5]],xe=[`#e47aa8`,`#5b8fe0`,`#8f6ad8`,`#3fb3a0`,`#e0584e`,`#7cc45a`,`#f0a24a`],Se=[`#2b2236`,`#2b2236`,`#4a2f22`,`#5a3b22`,`#2f5f9e`,`#3c7a52`],T=[`#e2604f`,`#4a86d8`,`#4bab72`,`#efb54a`,`#8d66cf`,`#36b0b0`,`#e47aa8`,`#3d4352`,`#f1efe9`,`#8a96a3`,`#2f4c7d`,`#c9713f`,`#76913f`,`#e3d3b2`,`#f29b72`,`#5bc0de`,`#b04a5a`,`#f2d16b`],Ce=[`#f4f4f0`,`#d3e3f4`,`#f3d6de`,`#dfe3e8`,`#e9f1dc`,`#fbf0d6`],we=[`#c0392b`,`#2f4c7d`,`#7b2d44`,`#2e7d4f`,`#d9a42e`,`#5b3a8c`,`#3d4352`],Te=[`#2f3b55`,`#3d4352`,`#6b4a35`,`#55613b`,`#262a33`,`#b08a5e`,`#7a2f3a`,`#4a6a8a`],E=[`#f4f4f0`,`#e8e3d6`,`#dfe7ef`,`#f6e7c8`,`#c9ced6`],Ee=[[`#3f5f8c`,5],[`#2e3e5e`,4],[`#2c2c35`,4],[`#b49c72`,2],[`#6d7480`,2],[`#6e4c38`,1.5],[`#5f6845`,1.2],[`#2c3655`,2],[`#7f9cc4`,1.5],[`#e2ded5`,.5],[`#9b3b3b`,.4]],De=[[`#2b2b33`,5],[`#6b4630`,3],[`#ececec`,3],[`#d04848`,1],[`#3f63a8`,1],[`#b88752`,1.5],[`#7d8592`,1]],Oe={none:[`#2b2b33`],glasses:[`#2b2b33`,`#5a3a28`,`#3f63a8`,`#b03a3a`,`#8a8f99`],sunglasses:[`#22232b`],headphones:[`#2b2b33`,`#f1efe9`,`#e2604f`,`#4a86d8`,`#efb54a`,`#36b0b0`],cap:[`#e2604f`,`#4a86d8`,`#2b2b33`,`#4bab72`,`#efb54a`,`#f1efe9`,`#2f4c7d`],beanie:[`#e2604f`,`#efb54a`,`#4bab72`,`#8d66cf`,`#3d4352`,`#36b0b0`],earrings:[`#f2c14e`,`#d9dde3`],bow:[`#e2604f`,`#e47aa8`,`#efb54a`,`#4a86d8`,`#8d66cf`],gamer_headphones:[`#2b2b33`,`#f1efe9`,`#8d66cf`,`#e2604f`,`#4a86d8`]},D=[`#f2b33d`,`#e2604f`,`#4a86d8`,`#4bab72`,`#8d66cf`,`#36b0b0`],ke={m:{short:16,buzz:9,spiky:9,side_part:12,curly:9,afro:6,bob:2,long:4,ponytail:3,bun:4,pigtails:.4,mohawk:4,bald:5,wavy:9},f:{short:4,buzz:1.2,spiky:2,side_part:4,curly:9,afro:7,bob:13,long:16,ponytail:13,bun:10,pigtails:6,mohawk:1,bald:.4,wavy:13}},Ae={m:{tshirt:20,hoodie:16,shirt_tie:10,sweater:13,jacket:13,blouse:2,hoodie_up:0,polo:14},f:{tshirt:17,hoodie:14,shirt_tie:5,sweater:14,jacket:12,blouse:20,hoodie_up:0,polo:8}},je={m:{none:40,glasses:18,sunglasses:4,headphones:13,cap:7,beanie:6,earrings:2,gamer_headphones:0,bow:.3},f:{none:36,glasses:16,sunglasses:4,headphones:11,cap:4,beanie:5,earrings:13,gamer_headphones:0,bow:7}},Me={none:62,stubble:12,beard:13,mustache:7,goatee:6},Ne={m:{pants:88,shorts:12,skirt:0},f:{pants:62,shorts:10,skirt:28}};function Pe(e){let t=(e^2654435769)>>>0;return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}function O(e,n={}){let r=t(Pe(e)),i=e=>e[Math.floor(r()*e.length)%e.length],a=e=>{let t=Object.entries(e),n=t.reduce((e,[,t])=>e+t,0),i=r()*n;for(let[e,n]of t)if(i-=n,i<0)return e;return t[t.length-1][0]},o=e=>a(Object.fromEntries(e)),s=r(),c=n.look??(s<.5?`f`:`m`),l=i(ye),u=r()<.08?i(xe):o(be),d=a(ke[c]),f=i(Se),p=a(Ae[c]),m,h;switch(p){case`shirt_tie`:m=i(Ce),h=i(we);break;case`jacket`:m=i(Te),h=r()<.7?i(E):i(T);break;case`hoodie`:case`polo`:m=i(T),h=r()<.6?i(E):i(T);break;default:m=i(T),h=i(T)}h===m&&(h=i(E));let ee=o(Ee),te=o(De),g=a(je[c]);(g===`cap`||g===`beanie`)&&(d===`afro`||d===`bun`||d===`mohawk`||d===`pigtails`)&&(g=`glasses`),g===`bow`&&(d===`bald`||d===`buzz`)&&(g=`earrings`);let _=i(Oe[g]),ne=r(),re=a(Me),ie=c===`m`?re:`none`,v=a(Ne[c]);c===`f`&&d===`bald`&&(d=`buzz`);let y={skin:l,hair:u,hairStyle:d,eyes:f,top:m,topAccent:h,topStyle:p,bottom:ee,shoes:te,accessory:g,accessoryColor:_,lanyard:n.sub?D[Math.floor(ne*D.length)%D.length]:null,look:c,facialHair:ie,bottomStyle:v},b=n.parts;if(!b)return y;let x=Object.fromEntries(C.filter(e=>b[e]!==void 0).map(e=>[e,b[e]]));return{...y,...x}}function Fe(e,t,n){let r=O(e,{look:n,parts:t}),i={};for(let e of S){let t=r[e];t!==void 0&&(i[e]=w(t))}return i}function Ie(e){return[e.skin,e.hair,e.hairStyle,e.eyes,e.top,e.topAccent,e.topStyle,e.bottom,e.shoes,e.accessory,e.accessoryColor,e.lanyard??`-`,e.look,e.facialHair??`-`,e.bottomStyle??`-`].join(`|`)+(e.face&&e.face!==`none`?`|${e.face}|${e.faceColor??``}`:``)}var Le=e=>[...new Set(e)],k=e=>e.map(([e])=>e),Re={none:[`#2b2b33`],led_mask:[`#2b2f3a`,`#f1efe9`,`#e2604f`,`#4a86d8`,`#8d66cf`],bandana:[`#2b2b33`,`#c0392b`,`#2f4c7d`,`#2e7d4f`,`#efb54a`,`#8d66cf`,`#f1efe9`],respirator:[`#3d4352`,`#2b2b33`,`#55613b`,`#8a96a3`,`#7a2f3a`],visor:[`#39f0ff`,`#ff3df0`,`#7dff4a`,`#ffe03a`,`#ff5a4a`],ar_monocle:[`#39f0ff`,`#ff3df0`,`#7dff4a`,`#ffe03a`,`#ff5a4a`],smile_mask:[`#f4f2ee`,`#e9e1d0`,`#bfe3f5`,`#f2c7d6`]},ze=Le([...E,...T]);function Be(e){switch(e){case`shirt_tie`:return{top:Ce,topAccent:we};case`jacket`:return{top:Te,topAccent:ze};default:return{top:T,topAccent:ze}}}function Ve(e){let t=Be(e.topStyle);return{skin:ye,hair:[...k(be),...xe],hairStyle:v,eyes:Le(Se),top:t.top,topAccent:t.topAccent,topStyle:y,bottom:k(Ee),bottomStyle:oe,shoes:k(De),accessory:b,accessoryColor:Oe[e.accessory],facialHair:ae,face:x,faceColor:Re[e.face??`none`]}}var A=[`afro`,`bun`,`mohawk`,`pigtails`],He=[`led_mask`,`visor`,`ar_monocle`,`smile_mask`],Ue=[`glasses`,`sunglasses`],We=[`cap`,`beanie`,`bow`],Ge=[`bald`,`buzz`];function Ke(t,n,r){if(n===`accessory`){if((r===`cap`||r===`beanie`)&&A.includes(t.hairStyle)||r===`bow`&&Ge.includes(t.hairStyle))return e(`Não combina com este cabelo`);if(We.includes(r)&&t.topStyle===`hoodie_up`)return e(`Não combina com o capuz`);if(Ue.includes(r)&&t.face&&He.includes(t.face))return e(`Não combina com a máscara`)}if(n===`topStyle`&&r===`hoodie_up`){if(t.accessory===`cap`||t.accessory===`beanie`)return e(`Não combina com o boné ou o gorro`);if(t.accessory===`bow`)return e(`Não combina com o laço`);if(A.includes(t.hairStyle))return e(`Não combina com este cabelo`)}if(n===`face`&&He.includes(r)&&Ue.includes(t.accessory))return e(`Não combina com os óculos`);if(n===`hairStyle`){if((t.accessory===`cap`||t.accessory===`beanie`)&&A.includes(r))return e(`Não combina com o boné ou o gorro`);if(t.accessory===`bow`&&Ge.includes(r))return e(`Não combina com o laço`);if(t.topStyle===`hoodie_up`&&A.includes(r))return e(`Não combina com o capuz`)}}function qe(e){let t=Ve(e),n=(e,t)=>t.includes(e)?e:t[0],r={...e,top:n(e.top,t.top),topAccent:n(e.topAccent,t.topAccent),accessoryColor:n(e.accessoryColor,t.accessoryColor)};return e.face&&e.face!==`none`&&(r.faceColor=n(e.faceColor??``,t.faceColor)),r}function Je(e,t){if(e&&e!==`auto`)return e;let n=t.getMonth();return n===9?`halloween`:n===10||n===11&&t.getDate()<=26?`christmas`:`none`}var Ye={showNames:!0,bubbles:`important`,liveliness:`normal`,followSelected:!1,dayNight:!0,theme:`auto`},Xe=[`competicao`,`apostas`,`games`,`series`,`fofoca`,`vaidade`,`cafeina`,`piadas`,`esporte`,`timidez`,`economia`,`sonecas`,`calma`,`leitura`],Ze=[[`timidez`,`piadas`],[`timidez`,`fofoca`],[`apostas`,`economia`],[`esporte`,`sonecas`],[`calma`,`competicao`]],j={min:2,max:3},Qe=[`night_owl`,`early_bird`,`coffee`,`tea`,`tabs`,`spaces`,`dark_mode`,`light_mode`,`vim`,`tests_first`,`ship_fast`,`refactor`,`pixel_art`,`music`,`silence`,`cats`,`dogs`,`open_source`,`learning`,`hello`],$e=[`hello`,`nice_building`,`coffee`,`congrats`,`nice_to_meet`,`bye`,`thanks`,`good_luck`,`wave`,`clap`],et=[`offensive_name`,`impersonation`,`harassment`,`greeting_spam`,`fake_building`,`other`],tt=[`visited`,`nice_building`,`keep_going`,`coffee`,`wave`,`star`,`heart`,`rocket`],nt=[`agent_hours_10k`,`agent_hours_50k`,`agent_hours_100k`],rt=[`deploy`,`other-device`,`banned`,`suspended`,`waiting`,`update`,`unauthorized`,`no_player`,`deleted`],it=[`schema`,`limits`,`name_pool`,`parts`,`ids`,`rate`,`internal`,`left`,`implausible`],at={floors:64,agentsPerFloor:64,agentsTotal:256,bytes:65536},M={min:3,max:20},ot=[`habblaud`,`admin`,`staff`,`claude`,`anthropic`,`codex`,`openai`,`moderador`,`moderator`,`suporte`,`support`,`system`,`world`],st=`invalid.invalid_code.invalid_credentials.email_not_verified.banned.suspended.unauthorized.name_taken.name_invalid.name_blocked.name_cooldown.password_invalid.password_weak.password_pwned.altcha_required.altcha_invalid.device_limit.rate_limited.not_found.no_player.unavailable.maintenance.invalid_json.too_large.unsupported_media_type.method_not_allowed.internal`.split(`.`),ct={competicao:{id:`competicao`,emoji:`🏆`,label:e(`Competição`),desc:e(`Adora competir: desafia os colegas no ping-pong, no videogame e no jokenpô.`)},apostas:{id:`apostas`,emoji:`🎲`,label:e(`Apostas`),desc:e(`Topa qualquer aposta e aposta alto no jokenpô.`)},games:{id:`games`,emoji:`🎮`,label:e(`Games`),desc:e(`Vive no videogame do lounge e nos fliperamas — e costuma ganhar.`)},series:{id:`series`,emoji:`📺`,label:e(`Séries e TV`),desc:e(`Não perde um programa na TV do lounge (de preferência com pipoca).`)},fofoca:{id:`fofoca`,emoji:`🗣️`,label:e(`Fofoca`),desc:e(`Puxa papo na copa e sabe de tudo o que acontece nas salas.`)},vaidade:{id:`vaidade`,emoji:`💄`,label:e(`Vaidade`),desc:e(`Passa no espelho do banheiro para se arrumar sempre que pode.`)},cafeina:{id:`cafeina`,emoji:`☕`,label:e(`Cafeína`),desc:e(`Movido a café: a cafeteira da copa é a segunda casa.`)},piadas:{id:`piadas`,emoji:`😂`,label:e(`Piadas`),desc:e(`Conta piada em toda conversa e faz a roda rir.`)},esporte:{id:`esporte`,emoji:`🏓`,label:e(`Esporte`),desc:e(`Joga ping-pong, se alonga e vibra com o futebol na TV.`)},timidez:{id:`timidez`,emoji:`🙈`,label:e(`Timidez`),desc:e(`Prefere ficar na sua: lê, olha a janela e entra menos nas rodas.`)},economia:{id:`economia`,emoji:`💰`,label:e(`Economia`),desc:e(`Pão-duro: aposta pouco e às vezes foge da aposta.`)},sonecas:{id:`sonecas`,emoji:`😴`,label:e(`Sonecas`),desc:e(`Qualquer sofá ou puff vira cama.`)},calma:{id:`calma`,emoji:`🧘`,label:e(`Calma`),desc:e(`Zen: alongamentos, janela e conversas tranquilas.`)},leitura:{id:`leitura`,emoji:`📚`,label:e(`Leitura`),desc:e(`Sempre com um livro da estante (ou o celular) na mão.`)}};function lt(e){return typeof e==`string`&&Xe.includes(e)}function N(e,t){return Ze.some(([n,r])=>n===e&&r===t||n===t&&r===e)}function ut(e){if(!Array.isArray(e)||e.length<j.min||e.length>j.max)return null;let t=[];for(let n of e){if(!lt(n)||t.includes(n)||t.some(e=>N(e,n)))return null;t.push(n)}return t}var dt=[`auto`,`none`,`halloween`,`christmas`];function ft(e){return typeof e==`string`&&dt.includes(e)}var pt={cmdsPerBatch:20,batchesPerSec:5,streams:4},mt=[`area`,`area.patch`,`players`,`player.join`,`player.leave`,`pos`,`minimap`,`afk`,`profile`,`notice`,`like.update`,`greeting`,`building`,`building.patch`,`visitors`,`city`,`city.fireworks`,`likes.today`,`away.summary`,`knock`],ht=[`not_configured`,`local_only`,`terminal_off`,`not_logged_in`,`session_expired`,`invalid_email`,`altcha_failed`,`world_unreachable`,`world_timeout`,`world_bad_response`,`world_error`,`storage_failed`,`too_many_streams`,`no_stream`,`not_connected`,`account_deleted`,`network`,`unknown`],gt=[...new Set([...st,...ht])];function _t(e){return typeof e==`string`&&gt.includes(e)}var vt=3,yt=/[\p{C}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\p{Bidi_Control}]/u,bt=/(?! )[\p{Zs}\s]/u,xt=/^\p{L}$/u,St=/^\p{M}$/u,Ct=/^[0-9 _.-]$/,wt=`Latin.Greek.Cyrillic.Armenian.Hebrew.Arabic.Syriac.Thaana.Devanagari.Bengali.Gurmukhi.Gujarati.Oriya.Tamil.Telugu.Kannada.Malayalam.Sinhala.Thai.Lao.Tibetan.Myanmar.Georgian.Hangul.Ethiopic.Khmer.Mongolian.Hiragana.Katakana.Bopomofo.Han`.split(`.`),Tt=wt.map(e=>[e,RegExp(`^\\p{Script_Extensions=${e}}$`,`u`)]),Et=`Other`,Dt=[...wt.map(e=>[e]),[`Han`,`Hiragana`,`Katakana`],[`Hangul`,`Han`],[`Han`,`Bopomofo`],[Et]];function Ot(e){let t=Tt.filter(([,t])=>t.test(e)).map(([e])=>e);return t.length?t:[Et]}function kt(e){let t=[...new Set(e)].map(Ot);return Dt.some(e=>t.every(t=>t.some(t=>e.includes(t))))}function At(e){return e.normalize(`NFC`).trim().replace(/ {2,}/g,` `)}function jt(e){return e.normalize(`NFKC`).toLowerCase().normalize(`NFD`).replace(/[\p{Mn}\p{Me}]/gu,``).normalize(`NFC`).replace(/\s+/g,` `).trim()}function Mt(e){return e.replace(/[ _.-]/g,``)}var P=e=>({ok:!1,code:`name_invalid`,problem:e});function Nt(e){if(typeof e!=`string`)return P(`type`);if(e.length>M.max*8)return P(`length`);let t=At(e);if(yt.test(t)||bt.test(t))return P(`invisible`);let n=[...t];if(n.length<M.min||n.length>M.max)return P(`length`);let r=[],i=0,a=!1;for(let e of n)if(xt.test(e))r.push(e),i=0,a=!0;else if(St.test(e)){if(!a||++i>vt)return P(`chars`)}else if(Ct.test(e))i=0,a=!1;else return P(`chars`);if(!r.length)return P(`no_letter`);if(!kt(r))return P(`scripts`);let o=jt(t);return ot.includes(Mt(o))?{ok:!1,code:`name_blocked`,problem:`reserved`}:{ok:!0,name:t,key:o}}var F={w:14,h:12},I={w:3,h:2},L={w:F.w*I.w,h:F.h*I.h},R={x:L.w+4+5,y:L.h+4+5},Pt={w:2,h:2},z={x:0,y:0},B={x:19,y:10,w:4,h:3},V={x:21,y:15},H={dx:6,w:2},U=(e,t)=>Math.floor(e/t);function*Ft(){let e=0,t=0;yield{x:e,y:t};let n=[[1,0],[0,1],[-1,0],[0,-1]];for(let r=1,i=0;;r++)for(let a=0;a<2;a++,i++){let a=n[i%4]??n[0];for(let n=0;n<r;n++)e+=a[0],t+=a[1],yield{x:e,y:t}}}function W(e){return e.x===z.x&&e.y===z.y}function*It(){for(let e of Ft())if(!W(e))for(let t=0;t<I.h;t++)for(let n=0;n<I.w;n++)yield{x:e.x*I.w+n,y:e.y*I.h+t}}function G(e){return{x:U(e.x,I.w),y:U(e.y,I.h)}}function Lt(e){return{x:e.x*R.x,y:e.y*R.y}}function Rt(e){let t=G(e),n=Lt(t);return{x:n.x+F.w*(e.x-I.w*t.x),y:n.y+F.h*(e.y-I.h*t.y)}}function zt(e){let t=Rt(e),n=e.y-I.h*G(e).y===0,r=n?t.y:t.y+F.h-1;return{side:n?`n`:`s`,tiles:[{x:t.x+H.dx,y:r},{x:t.x+H.dx+1,y:r}],front:{x:t.x+H.dx+H.w/2,y:n?t.y-1:t.y+F.h}}}function Bt(e,t){let n=(R.x-L.w)/2,r=(R.y-L.h)/2;return{x:U(e+n,R.x),y:U(t+r,R.y)}}function Vt(e){return{x:U(e.x,Pt.w),y:U(e.y,Pt.h)}}function Ht(e,t){return`${e}:${t.x},${t.y}`}function Ut(e){let t=/^([a-z0-9_-]{1,32}):(-?\d{1,6}),(-?\d{1,6})$/.exec(e);return t?{district:t[1]??``,chunk:{x:Number(t[2]),y:Number(t[3])}}:null}function Wt(e,t=1){let n=[];for(let r=-t;r<=t;r++)for(let i=-t;i<=t;i++)n.push({x:e.x+i,y:e.y+r});return n}function Gt(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t))return!1;let r=Math.floor(e),i=Math.floor(t),a=U(r,R.x),o=U(i,R.y),s=r-a*R.x,c=i-o*R.y;return s>=L.w||c>=L.h?!0:W({x:a,y:o})?!(s>=B.x&&s<B.x+B.w&&c>=B.y&&c<B.y+B.h):!1}function Kt(){return{x:V.x,y:V.y}}var K=e=>!!e&&typeof e==`object`&&!Array.isArray(e),q=e=>typeof e==`number`&&Number.isFinite(e),J=e=>q(e)&&Number.isInteger(e)&&e>=0&&e<=1e9;function qt(e){if(!K(e)||!J(e.lit))return;let t={lit:e.lit},n=e.goal;return K(n)&&typeof n.id==`string`&&n.id.length<=64&&nt.includes(n.label)&&q(n.target)&&n.target>0&&q(n.progress)&&n.progress>=0&&q(n.until)&&(t.goal={id:n.id,label:n.label,target:n.target,progress:n.progress,until:n.until}),q(e.tokensBand)&&Number.isInteger(e.tokensBand)&&e.tokensBand>=0&&e.tokensBand<=5&&(t.tokensBand=e.tokensBand),t}function Jt(e){if(!K(e)||typeof e.since!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e.since)||!J(e.visits)||!J(e.likes))return;let t=[];for(let n of Array.isArray(e.stamps)?e.stamps:[])K(n)&&tt.includes(n.stampId)&&J(n.count)&&n.count!==0&&(t.some(e=>e.stampId===n.stampId)||t.push({stampId:n.stampId,count:n.count}));return{since:e.since,visits:e.visits,likes:e.likes,stamps:t}}function Yt(e){return!!e&&(e.visits>0||e.likes>0||e.stamps.some(e=>e.count>0))}function Xt(e){let t=-1;return e.forEach((e,n)=>{e.t===`move`&&(t=n)}),e.filter((e,n)=>e.t!==`move`||n===t)}var Zt={night_owl:()=>e(`Codo de madrugada`),early_bird:()=>e(`Acordo cedo para codar`),coffee:()=>e(`Movido a café`),tea:()=>e(`Time do chá`),tabs:()=>e(`Time dos tabs`),spaces:()=>e(`Time dos espaços`),dark_mode:()=>e(`Modo escuro sempre`),light_mode:()=>e(`Modo claro, sem medo`),vim:()=>e(`Vim até o fim`),tests_first:()=>e(`Testo antes de escrever`),ship_fast:()=>e(`Entrego rápido`),refactor:()=>e(`Refatorar é meu hobby`),pixel_art:()=>e(`Fã de pixel art`),music:()=>e(`Codo ouvindo música`),silence:()=>e(`Codo em silêncio`),cats:()=>e(`Gente de gato`),dogs:()=>e(`Gente de cachorro`),open_source:()=>e(`Vivo de código aberto`),learning:()=>e(`Sempre aprendendo`),hello:()=>e(`Oi, prazer!`)};function Qt(e){return typeof e==`string`&&Qe.includes(e)}function $t(e){return Zt[e]?.()??String(e)}function Y(e,t){return!e?.enabled||!e.configured||e.state===`off`||t.remote?`hidden`:!t.fake&&(!t.local||!t.terminal)?`local_only`:`active`}function en(e){return!!e&&(e.scene!==void 0||e.building!==void 0)}var tn=`habblaud:world-invite-seen`,nn=`habblaud:world-launch`,rn=`habblaud:world-waitlist-seen`,an=`habblaud:world-approved-seen`,on={launch:null,waitlistSeen:!1,approvedSeen:!1};function sn(e){let t=null;if(e.launch===`never`||e.legacy===`never`)t=`never`;else if(e.launch)try{let n=JSON.parse(e.launch);n&&typeof n==`object`&&typeof n.shown==`number`&&typeof n.last==`number`&&Number.isFinite(n.shown)&&Number.isFinite(n.last)&&(t={shown:Math.max(0,Math.floor(n.shown)),last:Math.max(0,n.last)})}catch{}return{launch:t,waitlistSeen:e.waitlist!==null,approvedSeen:e.approved!==null}}function cn(e){return{launch:e.launch===`never`?`never`:e.launch?JSON.stringify(e.launch):null,waitlist:e.waitlistSeen?`1`:null,approved:e.approvedSeen?`1`:null}}function ln(e,t,n,r){if(t.fake||t.replaying||Y(e,t)!==`active`||!e)return{show:null,memory:null};if(e.state===`logged_out`){let e=n.launch;return e===`never`||e&&(e.shown>=3||r-e.last<2592e5)?{show:null,memory:null}:{show:`launch`,memory:{...n,launch:{shown:(e?.shown??0)+1,last:r}}}}let i=n.launch===`never`?n:{...n,launch:`never`},a=i!==n;return e.state===`waiting`&&!n.waitlistSeen?{show:`waitlist`,memory:{...i,waitlistSeen:!0}}:e.state===`approved`&&!n.approvedSeen&&!en(e)?{show:`approved`,memory:{...i,approvedSeen:!0}}:{show:null,memory:a?i:null}}var un=[`welcome`,`register`,`login`,`verify`,`forgot`,`reset`],dn=[`home`,`character`,`visibility`,`devices`,`account`,`blocked`];function fn(e){return e===`waiting`||e===`approved`?dn:e===`logged_out`?un:[]}function pn(){return{server:null,screen:`welcome`,email:``,name:``,flash:null}}function X(e){if(!e.server)return e;let t=fn(e.server);return!t.length||t.includes(e.screen)?e:{...e,screen:t[0]}}function mn(e,t){switch(t.type){case`server`:return X({...e,server:t.state});case`go`:return X({...e,screen:t.screen,flash:null});case`code_sent`:return X({...e,screen:`verify`,email:t.email,name:t.name??e.name,flash:`code_sent`});case`reset_code_sent`:return X({...e,screen:`reset`,email:t.email,flash:`code_sent`});case`password_changed`:return X({...e,screen:`login`,flash:`password_changed`});case`signed_in`:return{...e,flash:null};case`flash`:return{...e,flash:t.flash}}}function Z(e){return e.normalize(`NFC`).trim()}function hn(e){let t=Z(e);return t.length<=254&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function gn(e){return e.replace(/\D/g,``).slice(0,6)}function _n(e){return/^\d{6}$/.test(gn(e))}function vn(e,t=``){let n=e.normalize(`NFC`),r=[...n].length;if(r<12)return`short`;if(r>128)return`long`;let i=Z(t).toLowerCase(),a=n.toLowerCase();return i&&(a===i||a===i.split(`@`)[0])?`email`:/^(.+?)\1+$/su.test(n)?`repeated`:null}function yn(t){switch(t){case`short`:return e(`A senha precisa ter pelo menos 12 caracteres.`);case`long`:return e(`A senha pode ter no máximo 128 caracteres.`);case`email`:return e(`A senha não pode ser o seu e-mail.`);case`repeated`:return e(`A senha não pode ser só uma repetição (como "aaaaaaaaaaaa").`)}}function bn(t){switch(t){case`type`:case`length`:return e(`O nome precisa ter de 3 a 20 caracteres.`);case`invisible`:return e(`Tire do nome os caracteres invisíveis e os espaços especiais.`);case`chars`:return e(`Use só letras, números, espaço, _ - e . no nome.`);case`scripts`:return e(`Use letras de um só alfabeto no nome.`);case`no_letter`:return e(`O nome precisa ter pelo menos uma letra.`);case`reserved`:return e(`Este nome é reservado. Escolha outro.`)}}function xn(e,t){if(e.includes(t))return null;let n=e.find(e=>N(e,t));return n?{reason:`clash`,with:n}:e.length>=j.max?{reason:`full`}:null}function Sn(e,t){return e.includes(t)?e.filter(e=>e!==t):xn(e,t)?[...e]:[...e,t]}function Cn(e){return ut(e)!==null}var wn=24301;function Tn(e){let t={};for(let n of S)t[n]=w(n===`facialHair`?e.facialHair??`none`:n===`bottomStyle`?e.bottomStyle??`pants`:e[n]);return t}function En(e,t,n=wn){return O(n,{look:e,parts:t})}function Dn(e){let t=Nt(e.name);return t.ok?Cn(e.traits)?!e.intro||!Qt(e.intro)?{field:`intro`}:null:{field:`traits`}:{field:`name`,problem:t.problem}}var On={mode:`live`,closed:!1,hideCountry:!1,tokensVisible:!0,leaderboard:!1,compactions:!1,knocks:!1},kn=[`closed`,`hideCountry`,`tokensVisible`,`leaderboard`,`compactions`,`knocks`];function An(e){return e?.notifyInactivity!==!1}var jn=`habblaud-world-dados.json`,Q=`privacidade@habblaud.com`,Mn=`Recurso Habblaud World`;function Nn(e){let t=e&&/^[A-Za-z0-9_-]{1,64}$/.test(e)?e:``;return`mailto:${Q}?subject=${encodeURIComponent(t?`${Mn} ${t}`:Mn)}`}function Pn(t,n){switch(_t(t)||t===`offline`||t===`forbidden`?t:`unknown`){case`invalid_code`:return e(`Código errado ou vencido. Confira o e-mail ou peça outro código.`);case`invalid_credentials`:return e(`E-mail ou senha não conferem.`);case`email_not_verified`:return e(`Falta confirmar o e-mail: mandamos um código novo.`);case`banned`:return e(`Esta conta foi banida do Habblaud World. Para recorrer, responda ao e-mail do banimento.`);case`suspended`:return e(`Esta conta está suspensa no Habblaud World por enquanto.`);case`unauthorized`:case`not_logged_in`:case`session_expired`:return e(`A sessão do Habblaud World neste computador terminou. Entre de novo.`);case`name_taken`:return e(`Este nome já está em uso no mundo. Escolha outro.`);case`name_invalid`:return e(`Nome inválido: de 3 a 20 caracteres, com letras de um só alfabeto, números, espaço, _ - e .`);case`name_blocked`:return e(`Este nome não é permitido. Escolha outro.`);case`name_cooldown`:return e(`O nome só pode ser trocado uma vez a cada 30 dias.`);case`password_invalid`:return e(`A senha precisa ter de 12 a 128 caracteres.`);case`password_weak`:return e(`Senha fraca: não use o e-mail, o nome de jogador nem só repetição.`);case`password_pwned`:return e(`Esta senha aparece em vazamentos de dados conhecidos. Escolha outra.`);case`invalid_email`:return e(`E-mail inválido. Confira o endereço.`);case`altcha_required`:case`altcha_invalid`:case`altcha_failed`:return e(`A verificação anti-robô não passou. Tente de novo em instantes.`);case`device_limit`:return e(`Esta conta já tem 3 computadores; revogue um em Dispositivos.`);case`no_player`:return e(`Crie o personagem primeiro.`);case`unavailable`:return e(`O Habblaud World está em manutenção. Tente de novo mais tarde.`);case`maintenance`:return e(`O mundo está em manutenção; tentamos de novo em instantes.`);case`not_found`:return e(n===`revoke`?`Este dispositivo não está mais na conta.`:`O servidor do Habblaud World não encontrou o que foi pedido.`);case`invalid_json`:case`too_large`:case`unsupported_media_type`:case`method_not_allowed`:return e(`O pedido saiu num formato que o servidor não aceita. Atualize o Habblaud e tente de novo.`);case`not_configured`:return e(`O Habblaud World não está ligado neste Habblaud (HABBLAUD_WORLD_URL recusada; veja o log do servidor).`);case`rate_limited`:return e(n===`export`?`Dá para baixar os dados uma vez por dia. Tente de novo amanhã.`:`Muitas tentativas seguidas. Espere alguns minutos e tente de novo.`);case`network`:case`world_unreachable`:case`world_timeout`:return e(`O servidor do Habblaud World não respondeu. Tente de novo em instantes.`);case`world_bad_response`:return e(`O servidor do Habblaud World respondeu algo inesperado. Tente de novo em instantes.`);case`account_deleted`:return e(`A conta do Habblaud World foi excluída. O prédio e o perfil saíram do mundo na hora; o resto é apagado do banco em 7 dias e dos backups em até 30.`);case`storage_failed`:return e(`Não deu para gravar a sessão neste computador: ela vale só até o Habblaud reiniciar.`);case`too_many_streams`:return e(`A cidade já está aberta em outras abas do Habblaud. Feche uma delas para abrir aqui.`);case`no_stream`:return e(`A cena Mundo perdeu a conexão com o Habblaud. Abra a cidade de novo.`);case`not_connected`:return e(n===`unblock`?`Sem conexão com o Habblaud World agora: desbloquear precisa do prédio aceso ou da cidade aberta.`:`Sem conexão com o Habblaud World agora; o Habblaud tenta de novo sozinho.`);case`offline`:return e(`Sem conexão com o Habblaud.`);case`forbidden`:case`local_only`:return e(`A conta do World só pode ser mexida pelo próprio computador, com o Habblaud aberto em localhost.`);case`terminal_off`:return e(`A conta do World só pode ser mexida com o Habblaud acessível apenas pelo próprio computador (acesso local, bind 127.0.0.1).`);case`invalid`:switch(n){case`register`:case`reset`:return e(`O servidor recusou o e-mail ou a senha. A senha precisa ter de 12 a 128 caracteres e não pode estar numa lista de senhas vazadas.`);case`character`:return e(`O servidor recusou o personagem. Confira o nome, os traços (2 ou 3) e a frase de apresentação.`);case`visibility`:case`inactivity`:return e(`O servidor recusou as opções de visibilidade.`);default:return e(`O servidor recusou o pedido. Confira os dados e tente de novo.`)}case`internal`:return e(`O servidor do mundo teve um erro; tente de novo.`);case`world_error`:case`unknown`:return e(`Algo deu errado. Tente de novo em instantes.`)}}function Fn(e,t){return t?e?.left?`left`:e?.paused?`paused`:e?.stopped?`stopped`:e?.connected?`connected`:`reconnecting`:`no_player`}function In(t){switch(t){case`update`:return{label:e(`Atualize o Habblaud`),desc:e(`Esta versão do Habblaud não entra mais no mundo. Atualize para o prédio voltar a acender.`),toggle:null};case`other-device`:return{label:e(`Conectado em outro computador`),desc:e(`A sua conta conectou o prédio em outro computador, e este parou de enviar.`),toggle:{action:`resume`,text:e(`Trazer para este computador`),hint:e(`O prédio volta a subir daqui, e o outro computador para de enviar.`)}};case`banned`:return{label:e(`Conta banida`),desc:e(`O Habblaud World baniu esta conta: o prédio saiu do mundo e nada mais sai deste computador.`),toggle:null};case`suspended`:return{label:e(`Conta suspensa`),desc:e(`Esta conta está suspensa no Habblaud World: o prédio fica apagado e nada sai deste computador.`),toggle:{action:`resume`,text:e(`Tentar de novo`),hint:e(`Se a suspensão já acabou, o prédio volta a acender.`)}};case`waiting`:return{label:e(`Na lista de espera`),desc:e(`A conta voltou para a lista de espera: o prédio sai do mundo até o acesso ser liberado de novo.`),toggle:null};case`no_player`:return{label:e(`Sem personagem`),desc:e(`O mundo não encontrou o seu personagem: crie de novo para o prédio voltar.`),toggle:null};case`unauthorized`:return{label:e(`Entre de novo`),desc:e(`O servidor do mundo não reconheceu este computador: entre de novo na conta.`),toggle:null};case`deleted`:return{label:e(`Conta excluída`),desc:e(`A conta do Habblaud World foi excluída: o prédio e o perfil saíram do mundo e nada mais sai deste computador.`),toggle:null}}}function Ln(t){switch(t){case`schema`:return e(`O pacote saiu fora do formato do protocolo. Atualize o Habblaud.`);case`limits`:return e(`O escritório passou dos limites do mundo (64 andares, 64 agentes por andar, 256 agentes ou 64 KB).`);case`name_pool`:return e(`Um nome de personagem não está na lista de nomes do mundo.`);case`parts`:return e(`Uma peça de aparência está fora das paletas do editor.`);case`ids`:return e(`Um código de andar ou de agente está fora do formato.`);case`rate`:return e(`Remessas demais em pouco tempo (o limite é 12 por minuto). A próxima vai normalmente.`);case`internal`:return e(`Um erro no servidor do mundo. A próxima remessa tenta de novo.`);case`left`:return e(`A conta saiu do mundo (por este ou por outro computador): nada mais sai até você voltar ao mundo.`);case`implausible`:return e(`O pacote contradiz o anterior de um jeito que o Habblaud não produz: o mundo o descartou, e o prédio fica com o último aceito. As próximas remessas vão normalmente.`);default:return e(`Um motivo que esta versão do Habblaud não conhece.`)}}function Rn(t){return t===`appeal`?{text:e(`Recorrer por e-mail`),hint:e(`Abre um e-mail para {0}: conte o que aconteceu, e uma pessoa revê o caso.`,[Q])}:{text:e(`Contestar por e-mail`),hint:e(`Abre um e-mail para {0}: se for engano, uma pessoa revê os números e tira o selo.`,[Q])}}function $(t){return t===1?e(`1 byte`):e(`{0} bytes`,[r(t)])}function zn(t){return t===1?e(`1 andar`):e(`{0} andares`,[r(t)])}function Bn(t){return t===1?e(`1 agente`):e(`{0} agentes`,[r(t)])}function Vn(t){return t===1?e(`1 visitante agora`):e(`{0} visitantes agora`,[r(t)])}var Hn={started:!1,last:void 0,notified:!1};function Un(e,t,n){let r=typeof t==`number`&&t>0?t:t===0?0:void 0;if(!e.started)return{state:{started:!0,last:r,notified:r!==void 0&&r>0},notify:!1};if(r===void 0)return{state:{started:!0,last:void 0,notified:!1},notify:!1};let i=r>0&&(e.last??0)===0,a=i&&!e.notified&&n;return{state:{started:!0,last:r,notified:e.notified||i},notify:a}}function Wn(t,n,r,i={}){let a=Gn(t,n,r,i);return a.state===`stopped`&&(t?.stopped===`banned`||t?.stopped===`suspended`)?{...a,appeal:Rn(`appeal`)}:t?.unverified&&a.state!==`stopped`&&a.state!==`left`&&a.state!==`no_player`?{...a,unverified:e(`O mundo marcou o seu prédio como "não verificado": os números pareceram fora do normal e estão em revisão. Ele continua no mundo, mas fora de placares e destaques.`),appeal:Rn(`contest`)}:a}function Gn(t,n,r,a){let o=Fn(t,n),s={unverified:null,appeal:null},c=t?.floors??0,l=t?.agents??0,u=o===`no_player`||o===`left`?[]:[zn(c),Bn(l),t?.lastUplinkAt?e(`Última remessa: {0}`,[i(t.lastUplinkAt,r)]):e(`Nenhuma remessa ainda`),...t?.visitors?[`👀 ${Vn(t.visitors)}`]:[]],d=(o===`connected`||o===`reconnecting`||o===`paused`)&&t?.lastAck?.ok===!1?Ln(t.lastAck.error):null,f=e(`Pausado por 30 dias, o prédio some do mapa e, 30 dias depois, é retirado; retomar antes disso traz de volta, no mesmo lote.`);switch(o){case`no_player`:return{state:o,label:e(`Sem personagem`),desc:e(`Crie o seu personagem: o prédio entra no mundo junto com ele.`),stats:u,rejected:d,toggle:null,leave:!1,...s};case`left`:return{state:o,label:e(`Fora do mundo`),desc:e(`Você saiu do mundo: o prédio foi retirado e o lote, liberado. Dá para andar pela cidade; nada do escritório sai deste computador.`),stats:u,rejected:null,toggle:{action:`join`,text:e(`Voltar ao mundo`),hint:e(`Voltar cria um prédio novo, em outro lote; a conta e o personagem são os mesmos.`)},leave:!1,...s};case`stopped`:{let e=t.stopped;return{state:o,...In(e),stats:u,rejected:d,leave:e===`update`||e===`other-device`||e===`suspended`,...s}}case`paused`:return{state:o,label:e(`Pausado`),desc:e(`Pausado: seu prédio está apagado, mas você pode andar pela cidade. Nada do escritório sai deste computador.`),stats:u,rejected:d,toggle:{action:`resume`,text:e(`Retomar`),hint:`${e(`Retomar volta a enviar e acende o prédio.`)} ${f}`},leave:!0,...s};case`connected`:case`reconnecting`:{let n=o===`connected`,r=!t?.lastUplinkAt,i=!n&&!!a.maintenance;return{state:o,label:e(n?`Conectado`:i?`Em manutenção`:r?`Conectando…`:`Reconectando…`),desc:e(n?`Aceso no mundo: um andar por sala aberta e cada personagem no status de agora. Os tokens, se você deixar, aparecem só em faixas, no medidor da fachada.`:i?`O mundo está em manutenção; tentamos de novo em instantes.`:r?`O prédio acende com a primeira remessa.`:`Sem conexão com o mundo agora: o Habblaud tenta de novo sozinho. Com 2 minutos sem notícias, o prédio apaga.`),stats:u,rejected:d,toggle:{action:`pause`,text:e(`Pausar`),hint:`${e(`Pausar interrompe o envio na hora e apaga o prédio no mundo.`)} ${f}`},leave:!0,...s}}}}function Kn(){return e(`Pausar apaga o prédio e guarda o lote: retomar traz de volta, no mesmo lugar. Sair do mundo retira o prédio na hora e libera o lote; a conta e o personagem continuam, e voltar depois cria um prédio novo, em outro lote.`)}function qn(t,n){if(!t)return{kind:`pending`,label:e(`Sem resposta do mundo ainda.`),reason:null};if(t.ok){let r=t.bytes===void 0?null:t.bytes===n?e(`O mundo recebeu os mesmos {0}.`,[$(t.bytes)]):e(`O mundo contou {0}.`,[$(t.bytes)]);return{kind:`accepted`,label:e(`Aceita pelo mundo.`),reason:r}}return{kind:`rejected`,label:e(`Recusada pelo mundo.`),reason:Ln(t.error)}}function Jn(e){return JSON.stringify(e,null,2)}function Yn(e,t){return Y(e,t)===`active`&&e?.state===`approved`}function Xn(e,t){let n=e?.building;return!n||n.left||e.state!==`approved`||Y(e,t)===`hidden`?null:n.paused?`paused`:n.stopped?`stopped`:n.connected?`live`:n.lastUplinkAt?`reconnecting`:null}export{H as $,ie as $t,sn as A,Qe as At,Xn as B,Ke as Bt,Kn as C,ft as Ct,gn as D,nt as Dt,ln as E,N as Et,Yn as F,it as Ft,Qt as G,C as Gt,mn as H,qe as Ht,Sn as I,at as It,Xt as J,ve as Jt,Jt as K,S as Kt,xn as L,Ye as Lt,yn as M,et as Mt,Jn as N,tt as Nt,Z as O,rt as Ot,cn as P,Xe as Pt,L as Q,w as Qt,Cn as R,Je as Rt,pn as S,dt as St,Un as T,lt as Tt,Y as U,O as Ut,Pn as V,Ve as Vt,$t as W,Fe as Wt,I as X,he as Xt,Yt as Y,me as Yt,R as Z,ge as Zt,_n as _,Nt as _t,jn as a,G as at,zn as b,pt as bt,kn as c,Vt as ct,qn as d,Gt as dt,_ as en,B as et,Bn as f,zt as ft,Dn as g,Kt as gt,$ as h,Ut as ht,on as i,Bt as it,vn as j,M as jt,An as k,$e as kt,Hn as l,Wt as lt,Wn as m,It as mt,an as n,o as nn,z as nt,tn as o,Lt as ot,Nn as p,Rt as pt,qt as q,_e as qt,On as r,V as rt,nn as s,Ht as st,Q as t,p as tn,F as tt,rn as u,W as ut,En as v,jt as vt,bn as w,ct as wt,Tn as x,mt as xt,hn as y,gt as yt,Vn as z,Ie as zt};
@@ -1 +1 @@
1
- import{c as e,l as t}from"./simulator-BjUGGls6.js";import{J as n,Q as r,Qt as i,Wt as a,at as o,bt as s,ct as c,dt as l,et as u,ft as d,gt as f,it as p,kt as m,mt as h,nt as g,ot as _,st as v,xt as ee}from"./world-model-Bi4Y820L.js";import{f as y}from"./app-Chm8kKN4.js";function b(t,n,r,i,o,s,c){return{id:t,kind:i,...c?{parentId:c}:{},provider:o,status:s,look:r,name:n,parts:a(e(t),void 0,r)}}function x(e=`live`){let t=e===`live`,n=[{id:`f_0a1b2c3d4e`,label:`ipe`,agents:[b(`a_1f2e3d4c`,`Marina`,`f`,`main`,`claude`,`working`),b(`a_2a3b4c5d`,`Rafael`,`m`,`sub`,`claude`,`working`,`a_1f2e3d4c`)]},{id:`f_1b2c3d4e5f`,label:`jade`,agents:[b(`a_3c4d5e6f`,`Beatriz`,`f`,`main`,`codex`,`waiting`),b(`a_4d5e6f70`,`Thiago`,`m`,`sub`,`codex`,`shell`)]},{id:`f_2c3d4e5f60`,label:`aurora`,agents:[b(`a_5e6f7081`,`Larissa`,`f`,`main`,`claude`,`idle`),b(`a_6f708192`,`Gustavo`,`m`,`main`,`codex`,`idle`)]}].map(e=>t?e:{...e,agents:[]});return{building:{id:`o_7a8b9c0d1e2f`,lot:{district:`centro`,x:3,y:5},owner:{id:`o_7a8b9c0d1e2f`,name:`Helena`,country:`BR`},state:e===`away`?`away`:`online`,theme:`none`,floors:n.length,...t?{agents:{total:6,working:3,waiting:1,idle:2}}:{},...e===`discreet`?{discreet:!0}:{},rev:12,likes:3,sinceMonth:`2026-10`},floors:n,visitors:1}}var S=200,te=s.cmdsPerBatch-1,C=2,w=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function T(e,t){let r=n([...e,...t]),i=r.filter(e=>e.t!==`move`),a=new Set(i.slice(Math.max(0,i.length-te)));return r.filter(e=>e.t===`move`||a.has(e))}var E=class{set=new Set;add(e){return this.set.add(e),()=>void this.set.delete(e)}emit(e){for(let t of[...this.set])try{t(e)}catch(e){console.error(`[world-stream]`,e)}}clear(){this.set.clear()}},D=class{listeners=new E;open;fetchImpl;setT;clearT;now;base;es=null;stream=null;queue=[];flushTimer=null;retryTimer=null;inflight=!1;lastPostAt=-1/0;holdUntil=0;attempts=0;closed=!1;status=`connecting`;constructor(e={}){this.open=e.eventSource??(e=>new EventSource(e)),this.fetchImpl=e.fetch??((e,t)=>fetch(e,t)),this.setT=e.setTimeout??((e,t)=>setTimeout(e,t)),this.clearT=e.clearTimeout??(e=>clearTimeout(e)),this.now=e.now??Date.now,this.base=e.base??`/api/world`,this.connect()}on(e){return this.listeners.add(e)}send(e){!this.closed&&e.length&&(this.queue=T(this.queue,e),this.schedule())}close(){this.closed||(this.closed=!0,this.es?.close(),this.es=null,this.flushTimer&&this.clearT(this.flushTimer),this.retryTimer&&this.clearT(this.retryTimer),this.flushTimer=this.retryTimer=null,this.queue=[],this.setStatus(`closed`),this.listeners.clear())}setStatus(e){this.status!==e&&(this.status=e,this.listeners.emit({type:`status`,status:e}))}connect(){if(this.closed)return;this.stream=null;let e;try{e=this.open(`${this.base}/stream`)}catch{return this.retry()}this.es=e;let t=()=>this.es===e&&!this.closed;e.addEventListener(`world.snapshot`,e=>{if(!t())return;let n=O(e);w(n)&&typeof n.stream==`string`&&Array.isArray(n.chunks)&&Array.isArray(n.players)&&(this.stream=n.stream,this.attempts=0,this.setStatus(`open`),this.listeners.emit({type:`snapshot`,snapshot:n}),this.schedule())}),e.addEventListener(`world`,e=>{if(!t())return;let n=O(e);w(n)&&ee.includes(n.t)&&this.listeners.emit({type:`message`,msg:n})}),e.addEventListener(`error`,()=>{t()&&(this.stream=null,e.readyState===C?(e.close(),this.es=null,this.retry()):this.setStatus(`connecting`))})}retry(){if(this.closed||this.retryTimer)return;this.setStatus(`retrying`);let e=i(this.attempts++);this.retryTimer=this.setT(()=>{this.retryTimer=null,this.setStatus(`connecting`),this.connect()},e)}schedule(){if(this.closed||this.flushTimer||this.inflight||!this.queue.length||!this.stream)return;let e=Math.max(0,this.lastPostAt+200-this.now(),this.holdUntil-this.now());this.flushTimer=this.setT(()=>{this.flushTimer=null,this.flush()},e)}async flush(){let e=this.stream;if(this.closed||!e||!this.queue.length)return;let t=this.queue;this.queue=[],this.inflight=!0,this.lastPostAt=this.now();let n=0,r=`offline`,i=1;try{let a=await this.fetchImpl(`${this.base}/cmd`,{method:`POST`,credentials:`same-origin`,cache:`no-store`,headers:{"Content-Type":`application/json`},body:JSON.stringify({stream:e,cmds:t})});if(n=a.status,!a.ok){let e=await a.json().catch(()=>null);typeof e?.error?.code==`string`&&(r=e.error.code),typeof e?.error?.retryAfter==`number`&&(i=e.error.retryAfter)}}catch{n=0}this.inflight=!1,!this.closed&&(n===429&&r===`rate_limited`?(this.queue=T(t,this.queue),this.holdUntil=this.now()+i*1e3):(n<200||n>=300)&&this.listeners.emit({type:`error`,code:r}),this.schedule())}};function O(e){try{return JSON.parse(String(e.data))}catch{return}}var k=`centro`,A=6e4,ne=3,j=[{},{Beatriz:`waiting`,Larissa:`idle`,Thiago:`shell`},{Beatriz:`working`,Larissa:`idle`,Thiago:`shell`},{Beatriz:`working`,Larissa:`working`,Thiago:`working`}],M={id:`p_voce`,name:`Pixel Dev`,look:`f`,parts:{skin:`#d69f78`,hair:`#2b2530`,hairStyle:`bob`,eyes:`#2f5f9e`,top:`#4a86d8`,topAccent:`#f4f4f0`,topStyle:`hoodie`,bottom:`#2c2c35`,bottomStyle:`pants`,shoes:`#ececec`,accessory:`glasses`,accessoryColor:`#2b2b33`,facialHair:`none`},traits:[`cafeina`,`games`],intro:`night_owl`,country:`BR`,buildingId:`p_voce`},N=3,P=`HB-4F2K`,re=`23456789ABCDEFGHJKMNPQRSTVWXYZ`;function F(e){let t=(Math.imul(e+7,2654435761)>>>0)%30**4,n=``;for(let e=0;e<4;e++)n=re[t%30]+n,t=Math.floor(t/30);let r=`HB-${n}`;return r===`HB-4F2K`?`HB-7777`:r}function I(e){let t=e.trim().toUpperCase().replace(/[\s_]+/g,``),n=t.startsWith(`HB-`)?t.slice(3):t.startsWith(`HB`)&&t.length===6?t.slice(2):t;return/^[2-9A-HJKMNP-TV-Z]{4}$/.test(n)?`HB-${n}`:null}var L={hello:`nice_to_meet`,wave:`hello`,nice_building:`thanks`,congrats:`thanks`,clap:`thanks`,good_luck:`thanks`,coffee:`coffee`,bye:`bye`,thanks:`clap`,nice_to_meet:`wave`},R=[[`Ana Pixel`,`BR`],[`Bruno Byte`,`PT`],[`Camille Code`,`FR`],[`Diego Deploy`,`MX`],[`Emma Stack`,`US`],[`Felipe Fork`,`AR`],[`Gabi Git`,`BR`],[`Hiro Hash`,`JP`],[`Inês Infra`,`ES`],[`Jonas Json`,`DE`],[`Kai Kernel`,`CA`],[`Lia Lambda`,`IT`],[`Marco Merge`,`CL`],[`Nina Node`,`CO`],[`Oscar Ops`,`GB`],[`Priya Patch`,`IN`],[`Quim Query`,void 0],[`Rosa Regex`,`BR`],[`Sami Shell`,`KR`],[`Téo Test`,`PT`]],z=[2,6,13,4,9,3,16,5,0,11,4,7,2,20,8,3,12,1,6,10],B=[`none`,`halloween`,`none`,`christmas`,`none`,`halloween`],V=[[`games`,`piadas`],[`leitura`,`calma`],[`competicao`,`esporte`,`cafeina`],[`series`,`fofoca`],[`esporte`,`cafeina`],[`timidez`,`leitura`]],H=[`coffee`,`tabs`,`pixel_art`,`cats`,`ship_fast`,`music`],U=[{name:`Luna Loop`,look:`f`,block:{x:1,y:0},cw:!0,speed:3,phase:12,owns:1},{name:`Max Merge`,look:`m`,block:{x:1,y:0},cw:!1,speed:3.2,phase:70},{name:`Zoe Zip`,look:`f`,block:{x:0,y:0},cw:!0,speed:2.9,phase:40,owns:7},{name:`Rafa Runtime`,look:`m`,block:{x:1,y:1},cw:!1,speed:3.1,phase:110},{name:`Yuki Yarn`,look:`f`,block:{x:0,y:1},cw:!0,speed:5.6,phase:25,owns:13}],W={name:`Ravi Repo`,look:`m`},G=[`BR`,`US`,`FR`,`ES`,`JP`,`IN`];function K(e){let t=_(e),n=t.x-1,i=t.y-1,a=t.x+r.w+1,o=t.y+r.h+1;return{x0:n,y0:i,x1:a,y1:o,length:2*(a-n+(o-i))}}function q(e,t,n){let r=K(e),i=r.x1-r.x0,a=r.y1-r.y0,o=((n?t:-t)%r.length+r.length)%r.length,s=e=>Math.round(e*100)/100,c=(e,t,r,i)=>({x:s(e),y:s(t),dir:n?r:i,moving:!0});return o<i?c(r.x0+o,r.y0,`e`,`w`):(o-=i,o<a?c(r.x1,r.y0+o,`s`,`n`):(o-=a,o<i?c(r.x1-o,r.y1,`w`,`e`):(o-=i,c(r.x0,r.y1-o,`n`,`s`))))}function J(){let e=_(g);return{x:e.x+u.x+u.w/2+5,y:e.y+u.y+u.h+2+.85}}function Y(){return d(Z(4)[N]).front}var ie=(e,t)=>v(k,c(p(e,t)));function X(e){let t=new Date(e),n=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),r=n-(new Date(n).getUTCDay()+6)%7*864e5;return{id:`${new Date(r).toISOString().slice(0,10)}:agent_hours_10k`,label:`agent_hours_10k`,target:1e4,progress:8e3,until:r+6048e5}}function Z(e){let t=[];for(let n of h()){if(t.length>=e)break;t.push(n)}return t}function Q(e=20){let n=t(12680215),r=Math.max(1,Math.min(2e3,Math.floor(e))),i=new Map;return U.forEach((e,t)=>e.owns!==void 0&&i.set(e.owns,t)),Z(r).map((e,t)=>{let a=t===N,[o,s]=R[t%R.length],c=i.get(t),l=a?4:z[t%z.length],u=Math.max(1,Math.round(l*(1+n()*1.5))),d=Math.round(u*n()),f=Math.min(u-d,n()<.4?1+Math.floor(n()*2):0),p=!a&&(t%7==5||t%11==9),m=!a&&t%9==7,h=a?M.id:c===void 0?`b_${t.toString(36).padStart(3,`0`)}`:`p_${c+1}`,g=a?{id:h,name:M.name,country:M.country}:c===void 0?{id:h,name:r>R.length?`${o} ${Math.floor(t/R.length)+1}`:o,...s?{country:s}:{}}:{id:h,name:U[c].name,country:G[c]},_={id:h,lot:{district:k,x:e.x,y:e.y},owner:g,state:p?`away`:`online`,theme:a?`halloween`:B[t%B.length],floors:l,rev:1,likes:Math.floor(n()*240),sinceMonth:`2026-${String(8+t%3).padStart(2,`0`)}`};return m||(_.agents={total:u,working:d,waiting:f,idle:u-d-f}),t%4!=1&&(_.tokens={day:t%5,week:Math.min(5,t%5+1)}),t%8==6&&(_.closed=!0),_.code=a?P:F(t),(t%3==1||t===4)&&(_.knocks=!0),t===10&&(_.unverified=!0),_})}var $=class{listeners=new E;now;start;buildings;revs=new Map;walkers;me;viewing=!0;closed=!1;ticks=0;lastMoveAt;afkSent=!1;timer=null;pending=[];inside=null;later=[];social=t(5292449);memory;summarySeen=!1;hidden=new Set;stamped=new Set;greetedMe=new Map;goal;constructor(e={}){this.now=e.now??Date.now,this.start=this.now(),this.lastMoveAt=this.start,this.buildings=Q(e.buildings??20);for(let e of this.buildings)this.revs.set(this.chunkOfBuilding(e),1);let n=this.buildings.find(e=>e.id===M.id),r=n?d(n.lot).front:f();this.memory=e.memory;let i=e.memory?.pos;this.me=i?{x:i.x,y:i.y,dir:i.dir,moving:!1}:{x:r.x,y:r.y,dir:`s`,moving:!1},this.goal=X(this.start);let o=t(40474),s=(e,t,n,r)=>{let i=U[e]?.owns,s=`p_${e+1}`;return{id:s,name:t,...e===3?{}:{country:G[e]},look:n,parts:a(1e3+e*97,void 0,n),traits:[...V[e%V.length]],intro:H[e%H.length],...i!==void 0&&i<this.buildings.length?{buildingId:s}:{},likesReceived:Math.floor(o()*60),pos:r,where:`street`}};this.walkers=U.map((e,t)=>s(t,e.name,e.look,q(e.block,e.phase,e.cw)));let c=J();this.walkers.push(s(U.length,W.name,W.look,{x:c.x,y:c.y,dir:`s`,moving:!1})),e.autoplay!==!1&&(this.timer=setInterval(()=>this.tick(),200))}on(e){let t=this.listeners.add(e);return Promise.resolve().then(()=>{this.closed||(e({type:`status`,status:`open`}),e({type:`snapshot`,snapshot:this.snapshot()}))}),t}snapshot(){let e=new Map;for(let t of this.buildings){let n=this.chunkOfBuilding(t);e.has(n)||e.set(n,[]),e.get(n).push(t)}return structuredClone({stream:`fake`,connected:!0,viewing:this.viewing,district:k,me:M,pos:this.me,afk:this.afkSent,chunks:this.viewing?[...e.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({chunk:e,rev:this.revs.get(e)??1,buildings:t})):[],players:this.viewing&&!this.inside?this.walkers.filter(e=>!this.hidden.has(e.id)):[],minimap:this.viewing?this.minimap():null,...this.inside?{inside:{id:this.inside.id,rev:this.inside.rev,detail:this.inside.detail}}:{},...this.viewing?{city:this.cityStatus()}:{},likesToday:3,...this.summarySeen?{}:{summary:structuredClone(y)}})}cityStatus(){return{lit:this.buildings.filter(e=>e.state===`online`).length,goal:{...this.goal},tokensBand:4}}celebrate(){if(this.closed)return;let e=this.goal;this.emit({t:`city.fireworks`,goalId:e.id});let t=e.label===`agent_hours_10k`?`agent_hours_50k`:`agent_hours_100k`,n=t===`agent_hours_50k`?5e4:1e5;this.goal={id:e.id.replace(e.label,t),label:t,target:n,progress:Math.max(e.target,e.progress),until:e.until},this.emit({t:`city`,...this.cityStatus()})}send(e){if(!this.closed)for(let t of n(e))this.command(t)}close(){this.closed||(this.remember(),this.closed=!0,this.timer&&clearInterval(this.timer),this.timer=null,this.listeners.emit({type:`status`,status:`closed`}),this.listeners.clear())}remember(){this.memory&&(this.memory.pos={x:this.me.x,y:this.me.y,dir:this.me.dir,moving:!1})}tick(){if(this.closed)return;this.ticks++;let e=this.pending;this.pending=[];for(let t of e)this.emit(t);if(!this.viewing)return;if(this.inside){this.ticks%15==0&&this.patchInside();return}let t=this.now(),n=this.later.filter(e=>e.at<=t);if(n.length){this.later=this.later.filter(e=>e.at>t);for(let e of n)this.emit(e.msg)}let r=(t-this.start)/1e3,i=new Map;U.forEach((e,t)=>{let n=this.walkers[t];if(n.pos=q(e.block,e.phase+e.speed*r,e.cw),this.hidden.has(n.id))return;let a=ie(n.pos.x,n.pos.y);i.has(a)||i.set(a,[]),i.get(a).push({id:n.id,pos:{...n.pos}})});for(let[e,t]of i)this.emit({t:`players`,chunk:e,players:t});this.ticks%15==0&&this.changeBuilding(this.ticks/15),this.ticks%300==0&&this.emit({t:`minimap`,blocks:this.minimap()}),this.ticks%300==0&&(this.goal={...this.goal,progress:Math.min(this.goal.target-1,this.goal.progress+7)},this.emit({t:`city`,...this.cityStatus()})),this.ticks%25==0&&this.botsGreet(t),!this.afkSent&&t-this.lastMoveAt>=A&&(this.afkSent=!0,this.emit({t:`afk`}))}botsGreet(e){let t=this.walkers.filter(e=>!this.hidden.has(e.id));if(t.length>=2){let n=t[Math.floor(this.social()*t.length)],r=t.filter(e=>e!==n).sort((e,t)=>Math.hypot(e.pos.x-n.pos.x,e.pos.y-n.pos.y)-Math.hypot(t.pos.x-n.pos.x,t.pos.y-n.pos.y))[0],i=m[Math.floor(this.social()*m.length)];this.emit({t:`greeting`,from:n.id,to:r.id,greetingId:i,until:e+5e3}),this.later.push({at:e+1600,msg:{t:`greeting`,from:r.id,to:n.id,greetingId:L[i],until:e+6600}})}for(let n of t){if(Math.hypot(n.pos.x-this.me.x,n.pos.y-this.me.y)>7||e-(this.greetedMe.get(n.id)??-1/0)<3e4||this.social()<.5)continue;this.greetedMe.set(n.id,e);let t=this.social()<.5?`hello`:`wave`;this.emit({t:`greeting`,from:n.id,to:M.id,greetingId:t,until:e+5e3});break}}changeBuilding(e){let t=this.buildings[e*7%this.buildings.length];if(!t.agents||t.state!==`online`)return;let n=e%4==0&&t.agents.working>0?0:(t.agents.working+1)%(t.agents.total+1),r=Math.min(t.agents.total-n,e%2);t.agents={total:t.agents.total,working:n,waiting:r,idle:t.agents.total-n-r},e%3==0&&t.likes++,t.rev++;let i=this.chunkOfBuilding(t),a=(this.revs.get(i)??1)+1;this.revs.set(i,a),this.emit({t:`area.patch`,chunk:i,rev:a,changes:[{id:t.id,agents:{...t.agents},likes:t.likes,rev:t.rev}]})}command(e){switch(e.t){case`move`:{let t=Math.hypot(e.x-this.me.x,e.y-this.me.y)>6;if(!l(e.x,e.y,()=>!0)||t){this.pending.push({t:`pos`,x:this.me.x,y:this.me.y});return}let n=e.x!==this.me.x||e.y!==this.me.y||e.dir!==this.me.dir||e.moving!==this.me.moving;this.me={x:e.x,y:e.y,dir:e.dir,moving:e.moving},n&&(this.lastMoveAt=this.now(),this.afkSent=!1);return}case`profile`:{let t=this.walkers.find(t=>t.id===e.playerId);this.pending.push(t?{t:`profile`,player:structuredClone(t)}:{t:`notice`,level:`info`,text:`not_found`});return}case`like`:case`unlike`:{let t=this.near(e.buildingId,4);if(typeof t==`string`)return void this.pending.push({t:`notice`,level:`warn`,text:t});let n=e.t===`like`;!!t.likedByMe!==n&&(t.likes+=n?1:-1),t.likedByMe=n,this.pending.push({t:`like.update`,buildingId:t.id,likes:t.likes,likedByMe:n}),this.inside?.id===t.id&&Object.assign(this.inside.detail.building,{likes:t.likes,likedByMe:n});return}case`greet`:{if(!this.walkers.find(t=>t.id===e.playerId&&!this.hidden.has(t.id)))return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});let t=this.now();this.pending.push({t:`greeting`,from:M.id,to:e.playerId,greetingId:e.greetingId,until:t+5e3}),this.later.push({at:t+1200,msg:{t:`greeting`,from:e.playerId,to:M.id,greetingId:L[e.greetingId]??`wave`,until:t+6200}});return}case`stamp`:{let t=this.near(e.buildingId,2);if(typeof t==`string`)return void this.pending.push({t:`notice`,level:`warn`,text:t});if(this.stamped.has(t.id))return void this.pending.push({t:`notice`,level:`info`,text:`already_done`});this.stamped.add(t.id),this.pending.push({t:`notice`,level:`info`,text:`stamped`});return}case`knock`:{let t=this.near(e.buildingId,2);typeof t==`string`&&this.pending.push({t:`notice`,level:`warn`,text:t});return}case`teleport`:{let t=e.code===void 0?null:I(e.code),n;if(e.code!==void 0)n=t?this.buildings.find(e=>e.code===t&&!this.hidden.has(e.id)):void 0;else{let e=this.buildings.filter(e=>e.state===`online`&&e.id!==M.id&&!this.hidden.has(e.id));n=e[Math.floor(this.social()*e.length)]}if(!n)return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});let r=d(n.lot);this.me={x:r.front.x,y:r.front.y,dir:r.side,moving:!1},this.lastMoveAt=this.now(),this.afkSent=!1,this.pending.push({t:`pos`,x:r.front.x,y:r.front.y});for(let e of this.snapshot().chunks)this.pending.push({t:`area`,chunk:e.chunk,rev:e.rev,buildings:e.buildings});return}case`block`:{let t=this.walkers.find(t=>t.id===e.playerId);if(!t)return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});this.hidden.add(t.id),this.pending.push({t:`player.leave`,id:t.id},{t:`notice`,level:`info`,text:`blocked_ok`});return}case`unblock`:{let t=this.walkers.find(t=>t.id===e.playerId);if(!t||!this.hidden.delete(t.id))return;this.pending.push({t:`player.join`,player:structuredClone(t)});return}case`resync`:for(let t of this.snapshot().chunks)(e.chunk===void 0||t.chunk===e.chunk)&&this.pending.push({t:`area`,chunk:t.chunk,rev:t.rev,buildings:t.buildings});return;case`view`:this.viewing=!0,Promise.resolve().then(()=>!this.closed&&this.listeners.emit({type:`snapshot`,snapshot:this.snapshot()}));return;case`view.off`:this.remember(),this.viewing=!1,this.inside=null;return;case`enter`:this.enter(e.buildingId);return;case`leave`:{let e=this.inside?this.buildings.find(e=>e.id===this.inside.id):void 0;if(this.inside=null,e){let t=d(e.lot);this.me={x:t.front.x,y:t.front.y,dir:t.side===`s`?`s`:`n`,moving:!1}}this.lastMoveAt=this.now(),this.pending.push({t:`pos`,x:this.me.x,y:this.me.y});for(let e of this.snapshot().chunks)this.pending.push({t:`area`,chunk:e.chunk,rev:e.rev,buildings:e.buildings});return}default:e.t===`report`&&this.pending.push({t:`notice`,level:`info`,text:`reported`}),e.t===`summary.seen`&&(this.summarySeen=!0);return}}enter(e){let t=this.buildings.find(t=>t.id===e);if(!t){this.pending.push({t:`notice`,level:`info`,text:`not_found`});return}let n=t.id===M.id,r=d(t.lot).front;if(!n&&Math.hypot(this.me.x-r.x,this.me.y-r.y)>ne){this.pending.push({t:`notice`,level:`info`,text:`too_far`});return}if(!n&&t.closed){this.pending.push({t:`notice`,level:`info`,text:`closed`});return}let i=t.state===`away`?`away`:t.agents?`live`:`discreet`,a=x(i),{agents:o,...s}=t;a.building={...s,...a.building.agents?{agents:a.building.agents}:{},floors:a.floors.length,...i===`discreet`?{discreet:!0}:{}},a.visitors=n?0:2,this.inside={id:t.id,rev:1,detail:a,patches:0},this.pending.push({t:`building`,rev:1,detail:structuredClone(a)})}patchInside(){let e=this.inside;if(!e)return;if(e.patches++,e.patches%4==0){e.detail.visitors=e.detail.visitors>=3?2:e.detail.visitors+1,e.rev++,this.emit({t:`building.patch`,rev:e.rev,visitors:e.detail.visitors});return}if(e.detail.building.state!==`online`||e.detail.building.discreet)return;let t=j[e.patches%j.length];for(let n of e.detail.floors)for(let e of n.agents)t[e.name]&&(e.status=t[e.name]);e.rev++,this.emit({t:`building.patch`,rev:e.rev,floors:structuredClone(e.detail.floors)})}near(e,t){if(e===M.id)return`invalid`;let n=this.buildings.find(t=>t.id===e);if(!n)return`not_found`;if(this.inside?.id===e)return n;let r=d(n.lot).front;return Math.hypot(r.x-this.me.x,r.y-this.me.y)<=t+1e-9?n:`too_far`}emit(e){this.listeners.emit({type:`message`,msg:structuredClone(e)})}chunkOfBuilding(e){return v(k,c(o(e.lot)))}minimap(){let e=new Map;for(let t of this.buildings){let n=o(t.lot),r=`${n.x},${n.y}`;e.has(r)||e.set(r,{x:n.x,y:n.y,lit:0}),t.state===`online`&&e.get(r).lit++}return[...e.values()].sort((e,t)=>e.y-t.y||e.x-t.x)}};function ae(e){return e.mock?new $(e):new D(e)}export{S as CMD_BATCH_MS,M as FAKE_ME,P as FAKE_MY_CODE,$ as FakeWorldStream,D as HttpWorldStream,ae as createWorldStream,T as enqueueCommands,J as fakeBenchSeat,F as fakeBuildingCode,Q as fakeCityBuildings,X as fakeGoal,Y as fakeMyDoor,q as loopPosition};
1
+ import{c as e,l as t}from"./simulator-CDeHv4xc.js";import{J as n,Q as r,Wt as i,at as a,bt as o,ct as s,dt as c,en as l,et as u,ft as d,gt as f,it as p,kt as m,mt as h,nt as g,ot as _,st as v,xt as ee}from"./world-model-CPBvh77_.js";import{f as y}from"./app-QVC1DacC.js";function b(t,n,r,a,o,s,c){return{id:t,kind:a,...c?{parentId:c}:{},provider:o,status:s,look:r,name:n,parts:i(e(t),void 0,r)}}function x(e=`live`){let t=e===`live`,n=[{id:`f_0a1b2c3d4e`,label:`ipe`,agents:[b(`a_1f2e3d4c`,`Marina`,`f`,`main`,`claude`,`working`),b(`a_2a3b4c5d`,`Rafael`,`m`,`sub`,`claude`,`working`,`a_1f2e3d4c`)]},{id:`f_1b2c3d4e5f`,label:`jade`,agents:[b(`a_3c4d5e6f`,`Beatriz`,`f`,`main`,`codex`,`waiting`),b(`a_4d5e6f70`,`Thiago`,`m`,`sub`,`codex`,`shell`)]},{id:`f_2c3d4e5f60`,label:`aurora`,agents:[b(`a_5e6f7081`,`Larissa`,`f`,`main`,`claude`,`idle`),b(`a_6f708192`,`Gustavo`,`m`,`main`,`codex`,`idle`)]}].map(e=>t?e:{...e,agents:[]});return{building:{id:`o_7a8b9c0d1e2f`,lot:{district:`centro`,x:3,y:5},owner:{id:`o_7a8b9c0d1e2f`,name:`Helena`,country:`BR`},state:e===`away`?`away`:`online`,theme:`none`,floors:n.length,...t?{agents:{total:6,working:3,waiting:1,idle:2}}:{},...e===`discreet`?{discreet:!0}:{},rev:12,likes:3,sinceMonth:`2026-10`},floors:n,visitors:1}}var S=200,te=o.cmdsPerBatch-1,C=2,w=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function T(e,t){let r=n([...e,...t]),i=r.filter(e=>e.t!==`move`),a=new Set(i.slice(Math.max(0,i.length-te)));return r.filter(e=>e.t===`move`||a.has(e))}var E=class{set=new Set;add(e){return this.set.add(e),()=>void this.set.delete(e)}emit(e){for(let t of[...this.set])try{t(e)}catch(e){console.error(`[world-stream]`,e)}}clear(){this.set.clear()}},D=class{listeners=new E;open;fetchImpl;setT;clearT;now;base;es=null;stream=null;queue=[];flushTimer=null;retryTimer=null;inflight=!1;lastPostAt=-1/0;holdUntil=0;attempts=0;closed=!1;status=`connecting`;constructor(e={}){this.open=e.eventSource??(e=>new EventSource(e)),this.fetchImpl=e.fetch??((e,t)=>fetch(e,t)),this.setT=e.setTimeout??((e,t)=>setTimeout(e,t)),this.clearT=e.clearTimeout??(e=>clearTimeout(e)),this.now=e.now??Date.now,this.base=e.base??`/api/world`,this.connect()}on(e){return this.listeners.add(e)}send(e){!this.closed&&e.length&&(this.queue=T(this.queue,e),this.schedule())}close(){this.closed||(this.closed=!0,this.es?.close(),this.es=null,this.flushTimer&&this.clearT(this.flushTimer),this.retryTimer&&this.clearT(this.retryTimer),this.flushTimer=this.retryTimer=null,this.queue=[],this.setStatus(`closed`),this.listeners.clear())}setStatus(e){this.status!==e&&(this.status=e,this.listeners.emit({type:`status`,status:e}))}connect(){if(this.closed)return;this.stream=null;let e;try{e=this.open(`${this.base}/stream`)}catch{return this.retry()}this.es=e;let t=()=>this.es===e&&!this.closed;e.addEventListener(`world.snapshot`,e=>{if(!t())return;let n=O(e);w(n)&&typeof n.stream==`string`&&Array.isArray(n.chunks)&&Array.isArray(n.players)&&(this.stream=n.stream,this.attempts=0,this.setStatus(`open`),this.listeners.emit({type:`snapshot`,snapshot:n}),this.schedule())}),e.addEventListener(`world`,e=>{if(!t())return;let n=O(e);w(n)&&ee.includes(n.t)&&this.listeners.emit({type:`message`,msg:n})}),e.addEventListener(`error`,()=>{t()&&(this.stream=null,e.readyState===C?(e.close(),this.es=null,this.retry()):this.setStatus(`connecting`))})}retry(){if(this.closed||this.retryTimer)return;this.setStatus(`retrying`);let e=l(this.attempts++);this.retryTimer=this.setT(()=>{this.retryTimer=null,this.setStatus(`connecting`),this.connect()},e)}schedule(){if(this.closed||this.flushTimer||this.inflight||!this.queue.length||!this.stream)return;let e=Math.max(0,this.lastPostAt+200-this.now(),this.holdUntil-this.now());this.flushTimer=this.setT(()=>{this.flushTimer=null,this.flush()},e)}async flush(){let e=this.stream;if(this.closed||!e||!this.queue.length)return;let t=this.queue;this.queue=[],this.inflight=!0,this.lastPostAt=this.now();let n=0,r=`offline`,i=1;try{let a=await this.fetchImpl(`${this.base}/cmd`,{method:`POST`,credentials:`same-origin`,cache:`no-store`,headers:{"Content-Type":`application/json`},body:JSON.stringify({stream:e,cmds:t})});if(n=a.status,!a.ok){let e=await a.json().catch(()=>null);typeof e?.error?.code==`string`&&(r=e.error.code),typeof e?.error?.retryAfter==`number`&&(i=e.error.retryAfter)}}catch{n=0}this.inflight=!1,!this.closed&&(n===429&&r===`rate_limited`?(this.queue=T(t,this.queue),this.holdUntil=this.now()+i*1e3):(n<200||n>=300)&&this.listeners.emit({type:`error`,code:r}),this.schedule())}};function O(e){try{return JSON.parse(String(e.data))}catch{return}}var k=`centro`,A=6e4,ne=3,j=[{},{Beatriz:`waiting`,Larissa:`idle`,Thiago:`shell`},{Beatriz:`working`,Larissa:`idle`,Thiago:`shell`},{Beatriz:`working`,Larissa:`working`,Thiago:`working`}],M={id:`p_voce`,name:`Pixel Dev`,look:`f`,parts:{skin:`#d69f78`,hair:`#2b2530`,hairStyle:`bob`,eyes:`#2f5f9e`,top:`#4a86d8`,topAccent:`#f4f4f0`,topStyle:`hoodie`,bottom:`#2c2c35`,bottomStyle:`pants`,shoes:`#ececec`,accessory:`glasses`,accessoryColor:`#2b2b33`,facialHair:`none`},traits:[`cafeina`,`games`],intro:`night_owl`,country:`BR`,buildingId:`p_voce`},N=3,P=`HB-4F2K`,re=`23456789ABCDEFGHJKMNPQRSTVWXYZ`;function F(e){let t=(Math.imul(e+7,2654435761)>>>0)%30**4,n=``;for(let e=0;e<4;e++)n=re[t%30]+n,t=Math.floor(t/30);let r=`HB-${n}`;return r===`HB-4F2K`?`HB-7777`:r}function I(e){let t=e.trim().toUpperCase().replace(/[\s_]+/g,``),n=t.startsWith(`HB-`)?t.slice(3):t.startsWith(`HB`)&&t.length===6?t.slice(2):t;return/^[2-9A-HJKMNP-TV-Z]{4}$/.test(n)?`HB-${n}`:null}var L={hello:`nice_to_meet`,wave:`hello`,nice_building:`thanks`,congrats:`thanks`,clap:`thanks`,good_luck:`thanks`,coffee:`coffee`,bye:`bye`,thanks:`clap`,nice_to_meet:`wave`},R=[[`Ana Pixel`,`BR`],[`Bruno Byte`,`PT`],[`Camille Code`,`FR`],[`Diego Deploy`,`MX`],[`Emma Stack`,`US`],[`Felipe Fork`,`AR`],[`Gabi Git`,`BR`],[`Hiro Hash`,`JP`],[`Inês Infra`,`ES`],[`Jonas Json`,`DE`],[`Kai Kernel`,`CA`],[`Lia Lambda`,`IT`],[`Marco Merge`,`CL`],[`Nina Node`,`CO`],[`Oscar Ops`,`GB`],[`Priya Patch`,`IN`],[`Quim Query`,void 0],[`Rosa Regex`,`BR`],[`Sami Shell`,`KR`],[`Téo Test`,`PT`]],z=[2,6,13,4,9,3,16,5,0,11,4,7,2,20,8,3,12,1,6,10],B=[`none`,`halloween`,`none`,`christmas`,`none`,`halloween`],V=[[`games`,`piadas`],[`leitura`,`calma`],[`competicao`,`esporte`,`cafeina`],[`series`,`fofoca`],[`esporte`,`cafeina`],[`timidez`,`leitura`]],H=[`coffee`,`tabs`,`pixel_art`,`cats`,`ship_fast`,`music`],U=[{name:`Luna Loop`,look:`f`,block:{x:1,y:0},cw:!0,speed:3,phase:12,owns:1},{name:`Max Merge`,look:`m`,block:{x:1,y:0},cw:!1,speed:3.2,phase:70},{name:`Zoe Zip`,look:`f`,block:{x:0,y:0},cw:!0,speed:2.9,phase:40,owns:7},{name:`Rafa Runtime`,look:`m`,block:{x:1,y:1},cw:!1,speed:3.1,phase:110},{name:`Yuki Yarn`,look:`f`,block:{x:0,y:1},cw:!0,speed:5.6,phase:25,owns:13}],W={name:`Ravi Repo`,look:`m`},G=[`BR`,`US`,`FR`,`ES`,`JP`,`IN`];function K(e){let t=_(e),n=t.x-1,i=t.y-1,a=t.x+r.w+1,o=t.y+r.h+1;return{x0:n,y0:i,x1:a,y1:o,length:2*(a-n+(o-i))}}function q(e,t,n){let r=K(e),i=r.x1-r.x0,a=r.y1-r.y0,o=((n?t:-t)%r.length+r.length)%r.length,s=e=>Math.round(e*100)/100,c=(e,t,r,i)=>({x:s(e),y:s(t),dir:n?r:i,moving:!0});return o<i?c(r.x0+o,r.y0,`e`,`w`):(o-=i,o<a?c(r.x1,r.y0+o,`s`,`n`):(o-=a,o<i?c(r.x1-o,r.y1,`w`,`e`):(o-=i,c(r.x0,r.y1-o,`n`,`s`))))}function J(){let e=_(g);return{x:e.x+u.x+u.w/2+5,y:e.y+u.y+u.h+2+.85}}function Y(){return d(Z(4)[N]).front}var ie=(e,t)=>v(k,s(p(e,t)));function X(e){let t=new Date(e),n=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),r=n-(new Date(n).getUTCDay()+6)%7*864e5;return{id:`${new Date(r).toISOString().slice(0,10)}:agent_hours_10k`,label:`agent_hours_10k`,target:1e4,progress:8e3,until:r+6048e5}}function Z(e){let t=[];for(let n of h()){if(t.length>=e)break;t.push(n)}return t}function Q(e=20){let n=t(12680215),r=Math.max(1,Math.min(2e3,Math.floor(e))),i=new Map;return U.forEach((e,t)=>e.owns!==void 0&&i.set(e.owns,t)),Z(r).map((e,t)=>{let a=t===N,[o,s]=R[t%R.length],c=i.get(t),l=a?4:z[t%z.length],u=Math.max(1,Math.round(l*(1+n()*1.5))),d=Math.round(u*n()),f=Math.min(u-d,n()<.4?1+Math.floor(n()*2):0),p=!a&&(t%7==5||t%11==9),m=!a&&t%9==7,h=a?M.id:c===void 0?`b_${t.toString(36).padStart(3,`0`)}`:`p_${c+1}`,g=a?{id:h,name:M.name,country:M.country}:c===void 0?{id:h,name:r>R.length?`${o} ${Math.floor(t/R.length)+1}`:o,...s?{country:s}:{}}:{id:h,name:U[c].name,country:G[c]},_={id:h,lot:{district:k,x:e.x,y:e.y},owner:g,state:p?`away`:`online`,theme:a?`halloween`:B[t%B.length],floors:l,rev:1,likes:Math.floor(n()*240),sinceMonth:`2026-${String(8+t%3).padStart(2,`0`)}`};return m||(_.agents={total:u,working:d,waiting:f,idle:u-d-f}),t%4!=1&&(_.tokens={day:t%5,week:Math.min(5,t%5+1)}),t%8==6&&(_.closed=!0),_.code=a?P:F(t),(t%3==1||t===4)&&(_.knocks=!0),t===10&&(_.unverified=!0),_})}var $=class{listeners=new E;now;start;buildings;revs=new Map;walkers;me;viewing=!0;closed=!1;ticks=0;lastMoveAt;afkSent=!1;timer=null;pending=[];inside=null;later=[];social=t(5292449);memory;summarySeen=!1;hidden=new Set;stamped=new Set;greetedMe=new Map;goal;constructor(e={}){this.now=e.now??Date.now,this.start=this.now(),this.lastMoveAt=this.start,this.buildings=Q(e.buildings??20);for(let e of this.buildings)this.revs.set(this.chunkOfBuilding(e),1);let n=this.buildings.find(e=>e.id===M.id),r=n?d(n.lot).front:f();this.memory=e.memory;let a=e.memory?.pos;this.me=a?{x:a.x,y:a.y,dir:a.dir,moving:!1}:{x:r.x,y:r.y,dir:`s`,moving:!1},this.goal=X(this.start);let o=t(40474),s=(e,t,n,r)=>{let a=U[e]?.owns,s=`p_${e+1}`;return{id:s,name:t,...e===3?{}:{country:G[e]},look:n,parts:i(1e3+e*97,void 0,n),traits:[...V[e%V.length]],intro:H[e%H.length],...a!==void 0&&a<this.buildings.length?{buildingId:s}:{},likesReceived:Math.floor(o()*60),pos:r,where:`street`}};this.walkers=U.map((e,t)=>s(t,e.name,e.look,q(e.block,e.phase,e.cw)));let c=J();this.walkers.push(s(U.length,W.name,W.look,{x:c.x,y:c.y,dir:`s`,moving:!1})),e.autoplay!==!1&&(this.timer=setInterval(()=>this.tick(),200))}on(e){let t=this.listeners.add(e);return Promise.resolve().then(()=>{this.closed||(e({type:`status`,status:`open`}),e({type:`snapshot`,snapshot:this.snapshot()}))}),t}snapshot(){let e=new Map;for(let t of this.buildings){let n=this.chunkOfBuilding(t);e.has(n)||e.set(n,[]),e.get(n).push(t)}return structuredClone({stream:`fake`,connected:!0,viewing:this.viewing,district:k,me:M,pos:this.me,afk:this.afkSent,chunks:this.viewing?[...e.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({chunk:e,rev:this.revs.get(e)??1,buildings:t})):[],players:this.viewing&&!this.inside?this.walkers.filter(e=>!this.hidden.has(e.id)):[],minimap:this.viewing?this.minimap():null,...this.inside?{inside:{id:this.inside.id,rev:this.inside.rev,detail:this.inside.detail}}:{},...this.viewing?{city:this.cityStatus()}:{},likesToday:3,...this.summarySeen?{}:{summary:structuredClone(y)}})}cityStatus(){return{lit:this.buildings.filter(e=>e.state===`online`).length,goal:{...this.goal},tokensBand:4}}celebrate(){if(this.closed)return;let e=this.goal;this.emit({t:`city.fireworks`,goalId:e.id});let t=e.label===`agent_hours_10k`?`agent_hours_50k`:`agent_hours_100k`,n=t===`agent_hours_50k`?5e4:1e5;this.goal={id:e.id.replace(e.label,t),label:t,target:n,progress:Math.max(e.target,e.progress),until:e.until},this.emit({t:`city`,...this.cityStatus()})}send(e){if(!this.closed)for(let t of n(e))this.command(t)}close(){this.closed||(this.remember(),this.closed=!0,this.timer&&clearInterval(this.timer),this.timer=null,this.listeners.emit({type:`status`,status:`closed`}),this.listeners.clear())}remember(){this.memory&&(this.memory.pos={x:this.me.x,y:this.me.y,dir:this.me.dir,moving:!1})}tick(){if(this.closed)return;this.ticks++;let e=this.pending;this.pending=[];for(let t of e)this.emit(t);if(!this.viewing)return;if(this.inside){this.ticks%15==0&&this.patchInside();return}let t=this.now(),n=this.later.filter(e=>e.at<=t);if(n.length){this.later=this.later.filter(e=>e.at>t);for(let e of n)this.emit(e.msg)}let r=(t-this.start)/1e3,i=new Map;U.forEach((e,t)=>{let n=this.walkers[t];if(n.pos=q(e.block,e.phase+e.speed*r,e.cw),this.hidden.has(n.id))return;let a=ie(n.pos.x,n.pos.y);i.has(a)||i.set(a,[]),i.get(a).push({id:n.id,pos:{...n.pos}})});for(let[e,t]of i)this.emit({t:`players`,chunk:e,players:t});this.ticks%15==0&&this.changeBuilding(this.ticks/15),this.ticks%300==0&&this.emit({t:`minimap`,blocks:this.minimap()}),this.ticks%300==0&&(this.goal={...this.goal,progress:Math.min(this.goal.target-1,this.goal.progress+7)},this.emit({t:`city`,...this.cityStatus()})),this.ticks%25==0&&this.botsGreet(t),!this.afkSent&&t-this.lastMoveAt>=A&&(this.afkSent=!0,this.emit({t:`afk`}))}botsGreet(e){let t=this.walkers.filter(e=>!this.hidden.has(e.id));if(t.length>=2){let n=t[Math.floor(this.social()*t.length)],r=t.filter(e=>e!==n).sort((e,t)=>Math.hypot(e.pos.x-n.pos.x,e.pos.y-n.pos.y)-Math.hypot(t.pos.x-n.pos.x,t.pos.y-n.pos.y))[0],i=m[Math.floor(this.social()*m.length)];this.emit({t:`greeting`,from:n.id,to:r.id,greetingId:i,until:e+5e3}),this.later.push({at:e+1600,msg:{t:`greeting`,from:r.id,to:n.id,greetingId:L[i],until:e+6600}})}for(let n of t){if(Math.hypot(n.pos.x-this.me.x,n.pos.y-this.me.y)>7||e-(this.greetedMe.get(n.id)??-1/0)<3e4||this.social()<.5)continue;this.greetedMe.set(n.id,e);let t=this.social()<.5?`hello`:`wave`;this.emit({t:`greeting`,from:n.id,to:M.id,greetingId:t,until:e+5e3});break}}changeBuilding(e){let t=this.buildings[e*7%this.buildings.length];if(!t.agents||t.state!==`online`)return;let n=e%4==0&&t.agents.working>0?0:(t.agents.working+1)%(t.agents.total+1),r=Math.min(t.agents.total-n,e%2);t.agents={total:t.agents.total,working:n,waiting:r,idle:t.agents.total-n-r},e%3==0&&t.likes++,t.rev++;let i=this.chunkOfBuilding(t),a=(this.revs.get(i)??1)+1;this.revs.set(i,a),this.emit({t:`area.patch`,chunk:i,rev:a,changes:[{id:t.id,agents:{...t.agents},likes:t.likes,rev:t.rev}]})}command(e){switch(e.t){case`move`:{let t=Math.hypot(e.x-this.me.x,e.y-this.me.y)>6;if(!c(e.x,e.y,()=>!0)||t){this.pending.push({t:`pos`,x:this.me.x,y:this.me.y});return}let n=e.x!==this.me.x||e.y!==this.me.y||e.dir!==this.me.dir||e.moving!==this.me.moving;this.me={x:e.x,y:e.y,dir:e.dir,moving:e.moving},n&&(this.lastMoveAt=this.now(),this.afkSent=!1);return}case`profile`:{let t=this.walkers.find(t=>t.id===e.playerId);this.pending.push(t?{t:`profile`,player:structuredClone(t)}:{t:`notice`,level:`info`,text:`not_found`});return}case`like`:case`unlike`:{let t=this.near(e.buildingId,4);if(typeof t==`string`)return void this.pending.push({t:`notice`,level:`warn`,text:t});let n=e.t===`like`;!!t.likedByMe!==n&&(t.likes+=n?1:-1),t.likedByMe=n,this.pending.push({t:`like.update`,buildingId:t.id,likes:t.likes,likedByMe:n}),this.inside?.id===t.id&&Object.assign(this.inside.detail.building,{likes:t.likes,likedByMe:n});return}case`greet`:{if(!this.walkers.find(t=>t.id===e.playerId&&!this.hidden.has(t.id)))return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});let t=this.now();this.pending.push({t:`greeting`,from:M.id,to:e.playerId,greetingId:e.greetingId,until:t+5e3}),this.later.push({at:t+1200,msg:{t:`greeting`,from:e.playerId,to:M.id,greetingId:L[e.greetingId]??`wave`,until:t+6200}});return}case`stamp`:{let t=this.near(e.buildingId,2);if(typeof t==`string`)return void this.pending.push({t:`notice`,level:`warn`,text:t});if(this.stamped.has(t.id))return void this.pending.push({t:`notice`,level:`info`,text:`already_done`});this.stamped.add(t.id),this.pending.push({t:`notice`,level:`info`,text:`stamped`});return}case`knock`:{let t=this.near(e.buildingId,2);typeof t==`string`&&this.pending.push({t:`notice`,level:`warn`,text:t});return}case`teleport`:{let t=e.code===void 0?null:I(e.code),n;if(e.code!==void 0)n=t?this.buildings.find(e=>e.code===t&&!this.hidden.has(e.id)):void 0;else{let e=this.buildings.filter(e=>e.state===`online`&&e.id!==M.id&&!this.hidden.has(e.id));n=e[Math.floor(this.social()*e.length)]}if(!n)return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});let r=d(n.lot);this.me={x:r.front.x,y:r.front.y,dir:r.side,moving:!1},this.lastMoveAt=this.now(),this.afkSent=!1,this.pending.push({t:`pos`,x:r.front.x,y:r.front.y});for(let e of this.snapshot().chunks)this.pending.push({t:`area`,chunk:e.chunk,rev:e.rev,buildings:e.buildings});return}case`block`:{let t=this.walkers.find(t=>t.id===e.playerId);if(!t)return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});this.hidden.add(t.id),this.pending.push({t:`player.leave`,id:t.id},{t:`notice`,level:`info`,text:`blocked_ok`});return}case`unblock`:{let t=this.walkers.find(t=>t.id===e.playerId);if(!t||!this.hidden.delete(t.id))return;this.pending.push({t:`player.join`,player:structuredClone(t)});return}case`resync`:for(let t of this.snapshot().chunks)(e.chunk===void 0||t.chunk===e.chunk)&&this.pending.push({t:`area`,chunk:t.chunk,rev:t.rev,buildings:t.buildings});return;case`view`:this.viewing=!0,Promise.resolve().then(()=>!this.closed&&this.listeners.emit({type:`snapshot`,snapshot:this.snapshot()}));return;case`view.off`:this.remember(),this.viewing=!1,this.inside=null;return;case`enter`:this.enter(e.buildingId);return;case`leave`:{let e=this.inside?this.buildings.find(e=>e.id===this.inside.id):void 0;if(this.inside=null,e){let t=d(e.lot);this.me={x:t.front.x,y:t.front.y,dir:t.side===`s`?`s`:`n`,moving:!1}}this.lastMoveAt=this.now(),this.pending.push({t:`pos`,x:this.me.x,y:this.me.y});for(let e of this.snapshot().chunks)this.pending.push({t:`area`,chunk:e.chunk,rev:e.rev,buildings:e.buildings});return}default:e.t===`report`&&this.pending.push({t:`notice`,level:`info`,text:`reported`}),e.t===`summary.seen`&&(this.summarySeen=!0);return}}enter(e){let t=this.buildings.find(t=>t.id===e);if(!t){this.pending.push({t:`notice`,level:`info`,text:`not_found`});return}let n=t.id===M.id,r=d(t.lot).front;if(!n&&Math.hypot(this.me.x-r.x,this.me.y-r.y)>ne){this.pending.push({t:`notice`,level:`info`,text:`too_far`});return}if(!n&&t.closed){this.pending.push({t:`notice`,level:`info`,text:`closed`});return}let i=t.state===`away`?`away`:t.agents?`live`:`discreet`,a=x(i),{agents:o,...s}=t;a.building={...s,...a.building.agents?{agents:a.building.agents}:{},floors:a.floors.length,...i===`discreet`?{discreet:!0}:{}},a.visitors=n?0:2,this.inside={id:t.id,rev:1,detail:a,patches:0},this.pending.push({t:`building`,rev:1,detail:structuredClone(a)})}patchInside(){let e=this.inside;if(!e)return;if(e.patches++,e.patches%4==0){e.detail.visitors=e.detail.visitors>=3?2:e.detail.visitors+1,e.rev++,this.emit({t:`building.patch`,rev:e.rev,visitors:e.detail.visitors});return}if(e.detail.building.state!==`online`||e.detail.building.discreet)return;let t=j[e.patches%j.length];for(let n of e.detail.floors)for(let e of n.agents)t[e.name]&&(e.status=t[e.name]);e.rev++,this.emit({t:`building.patch`,rev:e.rev,floors:structuredClone(e.detail.floors)})}near(e,t){if(e===M.id)return`invalid`;let n=this.buildings.find(t=>t.id===e);if(!n)return`not_found`;if(this.inside?.id===e)return n;let r=d(n.lot).front;return Math.hypot(r.x-this.me.x,r.y-this.me.y)<=t+1e-9?n:`too_far`}emit(e){this.listeners.emit({type:`message`,msg:structuredClone(e)})}chunkOfBuilding(e){return v(k,s(a(e.lot)))}minimap(){let e=new Map;for(let t of this.buildings){let n=a(t.lot),r=`${n.x},${n.y}`;e.has(r)||e.set(r,{x:n.x,y:n.y,lit:0}),t.state===`online`&&e.get(r).lit++}return[...e.values()].sort((e,t)=>e.y-t.y||e.x-t.x)}};function ae(e){return e.mock?new $(e):new D(e)}export{S as CMD_BATCH_MS,M as FAKE_ME,P as FAKE_MY_CODE,$ as FakeWorldStream,D as HttpWorldStream,ae as createWorldStream,T as enqueueCommands,J as fakeBenchSeat,F as fakeBuildingCode,Q as fakeCityBuildings,X as fakeGoal,Y as fakeMyDoor,q as loopPosition};
@@ -32,7 +32,7 @@
32
32
  <meta name="apple-mobile-web-app-title" content="Busybits" />
33
33
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
34
34
  <style>html,body{background:#12151d;height:100%;margin:0;overflow:hidden}#world,#city,#visit{width:100vw;height:100vh;image-rendering:pixelated;display:block;position:fixed;inset:0}#world[hidden],#city[hidden],#visit[hidden]{display:none}#ui{pointer-events:none;position:fixed;inset:0}#ui>*{pointer-events:auto}</style>
35
- <script type="module" crossorigin src="/bundle/main-CdDU0hle.js"></script>
35
+ <script type="module" crossorigin src="/bundle/main-DNVSCypp.js"></script>
36
36
  </head>
37
37
  <body>
38
38
  <canvas id="world"></canvas>
@@ -2607,6 +2607,19 @@ var EN = {
2607
2607
  "N\xE3o combina com este cabelo": "Doesn't go with this hair",
2608
2608
  "N\xE3o combina com o bon\xE9 ou o gorro": "Doesn't go with the cap or beanie",
2609
2609
  "N\xE3o combina com o la\xE7o": "Doesn't go with the bow",
2610
+ "N\xE3o combina com o capuz": "Doesn't go with the hood",
2611
+ "N\xE3o combina com a m\xE1scara": "Doesn't go with the mask",
2612
+ "N\xE3o combina com os \xF3culos": "Doesn't go with the glasses",
2613
+ "M\xE1scara": "Mask",
2614
+ "Moletom com capuz": "Hoodie, hood up",
2615
+ "Fone gamer": "Gamer headset",
2616
+ "Nenhuma": "None",
2617
+ "M\xE1scara de LED": "LED mask",
2618
+ "Bandana": "Bandana",
2619
+ "Respirador": "Respirator",
2620
+ "Viseira neon": "Neon visor",
2621
+ "Mon\xF3culo AR": "AR monocle",
2622
+ "M\xE1scara sorridente": "Smile mask",
2610
2623
  // shared/world/intro.ts
2611
2624
  "Codo de madrugada": "I code late at night",
2612
2625
  "Acordo cedo para codar": "I get up early to code",
@@ -6331,6 +6344,19 @@ var ES = {
6331
6344
  "N\xE3o combina com este cabelo": "No combina con este pelo",
6332
6345
  "N\xE3o combina com o bon\xE9 ou o gorro": "No combina con la gorra o el gorro",
6333
6346
  "N\xE3o combina com o la\xE7o": "No combina con el lazo",
6347
+ "N\xE3o combina com o capuz": "No combina con la capucha",
6348
+ "N\xE3o combina com a m\xE1scara": "No combina con la m\xE1scara",
6349
+ "N\xE3o combina com os \xF3culos": "No combina con las gafas",
6350
+ "M\xE1scara": "M\xE1scara",
6351
+ "Moletom com capuz": "Sudadera con capucha puesta",
6352
+ "Fone gamer": "Auriculares gamer",
6353
+ "Nenhuma": "Ninguna",
6354
+ "M\xE1scara de LED": "M\xE1scara LED",
6355
+ "Bandana": "Bandana",
6356
+ "Respirador": "Respirador",
6357
+ "Viseira neon": "Visor ne\xF3n",
6358
+ "Mon\xF3culo AR": "Mon\xF3culo AR",
6359
+ "M\xE1scara sorridente": "M\xE1scara sonriente",
6334
6360
  // shared/world/intro.ts
6335
6361
  "Codo de madrugada": "Programo de madrugada",
6336
6362
  "Acordo cedo para codar": "Madrugo para programar",
@@ -10063,6 +10089,19 @@ var FR = {
10063
10089
  "N\xE3o combina com este cabelo": "Ne va pas avec cette coiffure",
10064
10090
  "N\xE3o combina com o bon\xE9 ou o gorro": "Ne va pas avec la casquette ou le bonnet",
10065
10091
  "N\xE3o combina com o la\xE7o": "Ne va pas avec le n\u0153ud",
10092
+ "N\xE3o combina com o capuz": "Ne va pas avec la capuche",
10093
+ "N\xE3o combina com a m\xE1scara": "Ne va pas avec le masque",
10094
+ "N\xE3o combina com os \xF3culos": "Ne va pas avec les lunettes",
10095
+ "M\xE1scara": "Masque",
10096
+ "Moletom com capuz": "Sweat \xE0 capuche relev\xE9e",
10097
+ "Fone gamer": "Casque gamer",
10098
+ "Nenhuma": "Aucun",
10099
+ "M\xE1scara de LED": "Masque LED",
10100
+ "Bandana": "Bandana",
10101
+ "Respirador": "Respirateur",
10102
+ "Viseira neon": "Visi\xE8re n\xE9on",
10103
+ "Mon\xF3culo AR": "Monocle RA",
10104
+ "M\xE1scara sorridente": "Masque souriant",
10066
10105
  // shared/world/intro.ts
10067
10106
  "Codo de madrugada": "Je code la nuit",
10068
10107
  "Acordo cedo para codar": "Je me l\xE8ve t\xF4t pour coder",
@@ -12900,7 +12939,10 @@ var HAIR_STYLES = [
12900
12939
  "wavy"
12901
12940
  ];
12902
12941
  var TOP_STYLES = ["tshirt", "hoodie", "shirt_tie", "sweater", "jacket", "blouse", "polo"];
12942
+ var ALL_TOP_STYLES = [...TOP_STYLES, "hoodie_up"];
12903
12943
  var ACCESSORIES = ["none", "glasses", "sunglasses", "headphones", "cap", "beanie", "earrings", "bow"];
12944
+ var ALL_ACCESSORIES = [...ACCESSORIES, "gamer_headphones"];
12945
+ var FACE_ITEMS = ["none", "led_mask", "bandana", "respirator", "visor", "ar_monocle", "smile_mask"];
12904
12946
  var FACIAL_HAIR = ["none", "stubble", "beard", "mustache", "goatee"];
12905
12947
  var BOTTOM_STYLES = ["pants", "shorts", "skirt"];
12906
12948
  var PART_KEYS = [
@@ -12918,31 +12960,45 @@ var PART_KEYS = [
12918
12960
  "accessoryColor",
12919
12961
  "facialHair"
12920
12962
  ];
12963
+ var LOCAL_PART_KEYS = ["face", "faceColor"];
12964
+ var ALL_PART_KEYS = [...PART_KEYS, ...LOCAL_PART_KEYS];
12965
+ var WORLD_VALUE = { hoodie_up: "hoodie", gamer_headphones: "headphones" };
12966
+ function worldValue(value) {
12967
+ return WORLD_VALUE[value] ?? value;
12968
+ }
12921
12969
  var STYLE_VALUES = {
12922
12970
  hairStyle: HAIR_STYLES,
12923
- topStyle: TOP_STYLES,
12971
+ topStyle: ALL_TOP_STYLES,
12924
12972
  bottomStyle: BOTTOM_STYLES,
12925
- accessory: ACCESSORIES,
12926
- facialHair: FACIAL_HAIR
12973
+ accessory: ALL_ACCESSORIES,
12974
+ facialHair: FACIAL_HAIR,
12975
+ face: FACE_ITEMS
12927
12976
  };
12928
12977
  var COLOR = /^#[0-9a-f]{6}$/i;
12929
12978
  var CONTROL = /[\p{Cc}\u2028\u2029\u200e\u200f\u202a-\u202e\u2066-\u2069]/u;
12930
12979
  var NAME_MAX = 24;
12931
- function parseAppearanceParts(raw) {
12980
+ var WORLD_UNKNOWN = Object.keys(WORLD_VALUE);
12981
+ function parseParts(raw, keys, allowedOf) {
12932
12982
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
12933
12983
  const src = raw;
12934
- for (const k of Object.keys(src)) if (!PART_KEYS.includes(k)) return null;
12984
+ for (const k of Object.keys(src)) if (!keys.includes(k)) return null;
12935
12985
  const out = {};
12936
- for (const k of PART_KEYS) {
12986
+ for (const k of keys) {
12937
12987
  const v = src[k];
12938
12988
  if (v === void 0) continue;
12939
12989
  if (typeof v !== "string") return null;
12940
- const allowed = STYLE_VALUES[k];
12990
+ const allowed = allowedOf(k);
12941
12991
  if (allowed ? !allowed.includes(v) : !COLOR.test(v)) return null;
12942
12992
  out[k] = allowed ? v : v.toLowerCase();
12943
12993
  }
12944
12994
  return out;
12945
12995
  }
12996
+ function parseAppearanceParts(raw) {
12997
+ return parseParts(raw, PART_KEYS, (k) => STYLE_VALUES[k]?.filter((v) => !WORLD_UNKNOWN.includes(v)));
12998
+ }
12999
+ function parseLocalAppearanceParts(raw) {
13000
+ return parseParts(raw, ALL_PART_KEYS, (k) => STYLE_VALUES[k]);
13001
+ }
12946
13002
  function parseCharacterName(raw) {
12947
13003
  if (typeof raw !== "string") return null;
12948
13004
  const name = raw.normalize("NFC").replace(/\s+/g, " ").trim();
@@ -19903,7 +19959,7 @@ function createApiHandler(deps) {
19903
19959
  const body2 = await readJson(req);
19904
19960
  const name = parseCharacterName(body2?.name);
19905
19961
  const seed = parseSeed(body2?.seed);
19906
- const parts = parseAppearanceParts(body2?.parts);
19962
+ const parts = parseLocalAppearanceParts(body2?.parts);
19907
19963
  if (!name || seed === null || !parts) {
19908
19964
  throw new HttpError(400, tr("esperado {name: texto de 1 a {0} caracteres, seed: inteiro de 0 a 4294967295, parts: pe\xE7as da apar\xEAncia}", [NAME_MAX]));
19909
19965
  }
@@ -27858,7 +27914,7 @@ function parseStoredCharacter(raw) {
27858
27914
  const v = raw;
27859
27915
  const name = parseCharacterName(v.name);
27860
27916
  const seed = parseSeed(v.seed);
27861
- const parts = v.parts === void 0 ? {} : parseAppearanceParts(v.parts);
27917
+ const parts = v.parts === void 0 ? {} : parseLocalAppearanceParts(v.parts);
27862
27918
  if (!name || seed === null || v.look !== "f" && v.look !== "m" || !parts) return null;
27863
27919
  const c = { name, look: v.look, seed, at: typeof v.at === "number" ? v.at : 0 };
27864
27920
  if (Object.keys(parts).length) c.parts = parts;
@@ -28071,7 +28127,7 @@ function parseDefaultLookPayload(raw, fallbackSince) {
28071
28127
  for (const k of Object.keys(r)) {
28072
28128
  if (k !== "parts" && k !== "since" && k !== "applyToAll") return null;
28073
28129
  }
28074
- const parts = r.parts === void 0 ? {} : parseAppearanceParts(r.parts);
28130
+ const parts = r.parts === void 0 ? {} : parseLocalAppearanceParts(r.parts);
28075
28131
  if (!parts) return null;
28076
28132
  let since;
28077
28133
  if (r.applyToAll === true) {
@@ -28124,7 +28180,7 @@ var DefaultLookStore = class {
28124
28180
  const candidate = j.defaultLook ?? j;
28125
28181
  if (!candidate || typeof candidate !== "object") return null;
28126
28182
  const c = candidate;
28127
- const parts = c.parts === void 0 ? {} : parseAppearanceParts(c.parts);
28183
+ const parts = c.parts === void 0 ? {} : parseLocalAppearanceParts(c.parts);
28128
28184
  if (!parts) return null;
28129
28185
  const since = typeof c.since === "number" && Number.isFinite(c.since) && c.since >= 0 ? c.since : 0;
28130
28186
  return { parts, since };
@@ -29854,7 +29910,7 @@ function parseAvatarLook(raw) {
29854
29910
  if (name === null || seed === null || r.look !== "f" && r.look !== "m") return null;
29855
29911
  const out = { name, look: r.look, seed };
29856
29912
  if (r.parts !== void 0) {
29857
- const parts = parseAppearanceParts(r.parts);
29913
+ const parts = parseLocalAppearanceParts(r.parts);
29858
29914
  if (!parts) return null;
29859
29915
  out.parts = parts;
29860
29916
  }
@@ -38527,7 +38583,8 @@ var ACC_COLORS = {
38527
38583
  cap: ["#e2604f", "#4a86d8", "#2b2b33", "#4bab72", "#efb54a", "#f1efe9", "#2f4c7d"],
38528
38584
  beanie: ["#e2604f", "#efb54a", "#4bab72", "#8d66cf", "#3d4352", "#36b0b0"],
38529
38585
  earrings: ["#f2c14e", "#d9dde3"],
38530
- bow: ["#e2604f", "#e47aa8", "#efb54a", "#4a86d8", "#8d66cf"]
38586
+ bow: ["#e2604f", "#e47aa8", "#efb54a", "#4a86d8", "#8d66cf"],
38587
+ gamer_headphones: ["#2b2b33", "#f1efe9", "#8d66cf", "#e2604f", "#4a86d8"]
38531
38588
  };
38532
38589
  var LANYARDS = ["#f2b33d", "#e2604f", "#4a86d8", "#4bab72", "#8d66cf", "#36b0b0"];
38533
38590
  var HAIR_W = {
@@ -38565,12 +38622,12 @@ var HAIR_W = {
38565
38622
  }
38566
38623
  };
38567
38624
  var TOP_W = {
38568
- m: { tshirt: 20, hoodie: 16, shirt_tie: 10, sweater: 13, jacket: 13, blouse: 2, polo: 14 },
38569
- f: { tshirt: 17, hoodie: 14, shirt_tie: 5, sweater: 14, jacket: 12, blouse: 20, polo: 8 }
38625
+ m: { tshirt: 20, hoodie: 16, shirt_tie: 10, sweater: 13, jacket: 13, blouse: 2, hoodie_up: 0, polo: 14 },
38626
+ f: { tshirt: 17, hoodie: 14, shirt_tie: 5, sweater: 14, jacket: 12, blouse: 20, hoodie_up: 0, polo: 8 }
38570
38627
  };
38571
38628
  var ACC_W = {
38572
- m: { none: 40, glasses: 18, sunglasses: 4, headphones: 13, cap: 7, beanie: 6, earrings: 2, bow: 0.3 },
38573
- f: { none: 36, glasses: 16, sunglasses: 4, headphones: 11, cap: 4, beanie: 5, earrings: 13, bow: 7 }
38629
+ m: { none: 40, glasses: 18, sunglasses: 4, headphones: 13, cap: 7, beanie: 6, earrings: 2, gamer_headphones: 0, bow: 0.3 },
38630
+ f: { none: 36, glasses: 16, sunglasses: 4, headphones: 11, cap: 4, beanie: 5, earrings: 13, gamer_headphones: 0, bow: 7 }
38574
38631
  };
38575
38632
  var FACIAL_W = { none: 62, stubble: 12, beard: 13, mustache: 7, goatee: 6 };
38576
38633
  var BOTTOM_W = {
@@ -38658,7 +38715,7 @@ function appearanceFromSeed(seed, opts = {}) {
38658
38715
  };
38659
38716
  const parts = opts.parts;
38660
38717
  if (!parts) return a;
38661
- const chosen = Object.fromEntries(PART_KEYS.filter((k) => parts[k] !== void 0).map((k) => [k, parts[k]]));
38718
+ const chosen = Object.fromEntries(ALL_PART_KEYS.filter((k) => parts[k] !== void 0).map((k) => [k, parts[k]]));
38662
38719
  return { ...a, ...chosen };
38663
38720
  }
38664
38721
  function flattenAppearance(seed, parts, look) {
@@ -38666,7 +38723,7 @@ function flattenAppearance(seed, parts, look) {
38666
38723
  const out = {};
38667
38724
  for (const k of PART_KEYS) {
38668
38725
  const v = a[k];
38669
- if (v !== void 0) out[k] = v;
38726
+ if (v !== void 0) out[k] = worldValue(v);
38670
38727
  }
38671
38728
  return out;
38672
38729
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "busybits",
3
3
  "displayName": "Busybits",
4
- "version": "2.4.0",
4
+ "version": "2.5.0",
5
5
  "description": "Connects the session to Busybits: records plan usage (5h and weekly) for the office, shows a line under the prompt when another session needs you, and adds the /busybits command.",
6
6
  "author": { "name": "Márcio Junior", "url": "https://github.com/marmottajr" },
7
7
  "homepage": "https://github.com/marmottajr/habblaud#readme",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "busybits-messages",
3
3
  "displayName": "Busybits: messages from the office",
4
- "version": "2.4.0",
4
+ "version": "2.5.0",
5
5
  "description": "Delivers to the Claude Code session the messages you type in Busybits (agent panel or terminal), as if you had typed them in the terminal.",
6
6
  "author": { "name": "Márcio Junior", "url": "https://github.com/marmottajr" },
7
7
  "homepage": "https://github.com/marmottajr/habblaud#readme",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "busybits-permissions",
3
3
  "displayName": "Busybits: permissions from the office",
4
- "version": "2.4.0",
4
+ "version": "2.5.0",
5
5
  "description": "PermissionRequest hook that lets you approve or deny Claude Code permission requests and answer AskUserQuestion prompts from Busybits; the dialog stays in the terminal and whichever answer comes first wins.",
6
6
  "author": { "name": "Márcio Junior", "url": "https://github.com/marmottajr" },
7
7
  "homepage": "https://github.com/marmottajr/habblaud#readme",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "habblaud-pi",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "private": true,
5
5
  "description": "Extensão do Pi / Gentle Shell para o Habblaud: recebe as mensagens do escritório e mostra quando o agente precisa de você.",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busybits",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Animated pixel-art office that shows what your Claude Code, Codex and Pi agents are doing, live.",
5
5
  "license": "MIT",
6
6
  "bin": {