busybits 0.0.0-stage → 2.0.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 (111) hide show
  1. package/.claude-plugin/marketplace.json +26 -0
  2. package/CHANGELOG.md +675 -0
  3. package/LICENSE +21 -0
  4. package/README.es.md +1457 -0
  5. package/README.fr.md +1435 -0
  6. package/README.md +1605 -2
  7. package/README.pt-BR.md +1373 -0
  8. package/dist/build.json +5 -0
  9. package/dist/cli/busybits.js +14708 -0
  10. package/dist/client/assets/art/framed/painting-abstract.png +0 -0
  11. package/dist/client/assets/art/framed/painting-beach.png +0 -0
  12. package/dist/client/assets/art/framed/painting-cat.png +0 -0
  13. package/dist/client/assets/art/framed/painting-city-night.png +0 -0
  14. package/dist/client/assets/art/framed/painting-mountains.png +0 -0
  15. package/dist/client/assets/art/framed/painting-rio.png +0 -0
  16. package/dist/client/assets/art/framed/painting-sunflowers.png +0 -0
  17. package/dist/client/assets/art/framed/painting-wave.png +0 -0
  18. package/dist/client/assets/art/framed/painting-wide-aurora.png +0 -0
  19. package/dist/client/assets/art/framed/painting-wide-color-fields.png +0 -0
  20. package/dist/client/assets/art/framed/painting-wide-forest-lake.png +0 -0
  21. package/dist/client/assets/art/painting-abstract.png +0 -0
  22. package/dist/client/assets/art/painting-beach.png +0 -0
  23. package/dist/client/assets/art/painting-cat.png +0 -0
  24. package/dist/client/assets/art/painting-city-night.png +0 -0
  25. package/dist/client/assets/art/painting-mountains.png +0 -0
  26. package/dist/client/assets/art/painting-rio.png +0 -0
  27. package/dist/client/assets/art/painting-sunflowers.png +0 -0
  28. package/dist/client/assets/art/painting-wave.png +0 -0
  29. package/dist/client/assets/art/painting-wide-aurora.png +0 -0
  30. package/dist/client/assets/art/painting-wide-color-fields.png +0 -0
  31. package/dist/client/assets/art/painting-wide-forest-lake.png +0 -0
  32. package/dist/client/assets/art/poster-bug.png +0 -0
  33. package/dist/client/assets/art/poster-cat.png +0 -0
  34. package/dist/client/assets/art/poster-code.png +0 -0
  35. package/dist/client/assets/art/poster-coffee.png +0 -0
  36. package/dist/client/assets/art/poster-rocket.png +0 -0
  37. package/dist/client/assets/art/poster-ship-it.png +0 -0
  38. package/dist/client/assets/brand/apple-touch-icon.png +0 -0
  39. package/dist/client/assets/brand/favicon-16.png +0 -0
  40. package/dist/client/assets/brand/favicon-32.png +0 -0
  41. package/dist/client/assets/brand/icon-192.png +0 -0
  42. package/dist/client/assets/brand/icon-512.png +0 -0
  43. package/dist/client/assets/brand/logo-detailed.png +0 -0
  44. package/dist/client/assets/brand/logo-mark.png +0 -0
  45. package/dist/client/assets/brand/logo-mark@4x.png +0 -0
  46. package/dist/client/assets/brand/signage.png +0 -0
  47. package/dist/client/assets/brand/signage@4x.png +0 -0
  48. package/dist/client/assets/emoji/LICENSE-SerenityOS.txt +28 -0
  49. package/dist/client/assets/emoji/sheet.png +0 -0
  50. package/dist/client/assets/illustrations/empty-office.png +0 -0
  51. package/dist/client/assets/manifest.json +260 -0
  52. package/dist/client/assets/og-image.png +0 -0
  53. package/dist/client/bundle/app-AwZeKIeu.js +24 -0
  54. package/dist/client/bundle/app-CoDOLwxe.css +1 -0
  55. package/dist/client/bundle/city-DPTwQLdi.css +1 -0
  56. package/dist/client/bundle/city-YoIG0FsX.js +1 -0
  57. package/dist/client/bundle/daystats-DGzYOP8l.js +1 -0
  58. package/dist/client/bundle/dom-D2vx0KTo.js +1 -0
  59. package/dist/client/bundle/en-DBfNt5uV.js +169 -0
  60. package/dist/client/bundle/es-pnWdszTE.js +169 -0
  61. package/dist/client/bundle/format-C7qb6Cn-.js +1 -0
  62. package/dist/client/bundle/fr-CY8q9pj4.js +169 -0
  63. package/dist/client/bundle/main-DktU0GfB.js +2 -0
  64. package/dist/client/bundle/pixelify-sans-cyrillic-400-normal-Ckz2YJkH.woff2 +0 -0
  65. package/dist/client/bundle/pixelify-sans-cyrillic-400-normal-DfOZNMlW.woff +0 -0
  66. package/dist/client/bundle/pixelify-sans-cyrillic-500-normal--wrb4dVK.woff2 +0 -0
  67. package/dist/client/bundle/pixelify-sans-cyrillic-500-normal-CR9SIKMr.woff +0 -0
  68. package/dist/client/bundle/pixelify-sans-cyrillic-600-normal-B3EuUOZG.woff +0 -0
  69. package/dist/client/bundle/pixelify-sans-cyrillic-600-normal-BhqNJYOZ.woff2 +0 -0
  70. package/dist/client/bundle/pixelify-sans-cyrillic-700-normal-BrZTw8tu.woff +0 -0
  71. package/dist/client/bundle/pixelify-sans-cyrillic-700-normal-CYtG5Rfp.woff2 +0 -0
  72. package/dist/client/bundle/pixelify-sans-latin-400-normal-DLrIX9QE.woff2 +0 -0
  73. package/dist/client/bundle/pixelify-sans-latin-400-normal-JapMNN6Z.woff +0 -0
  74. package/dist/client/bundle/pixelify-sans-latin-500-normal-Bq6pAlou.woff +0 -0
  75. package/dist/client/bundle/pixelify-sans-latin-500-normal-DC052d-m.woff2 +0 -0
  76. package/dist/client/bundle/pixelify-sans-latin-600-normal-BNlgYbDL.woff +0 -0
  77. package/dist/client/bundle/pixelify-sans-latin-600-normal-Dd_Dy7u5.woff2 +0 -0
  78. package/dist/client/bundle/pixelify-sans-latin-700-normal-BctWAS0u.woff +0 -0
  79. package/dist/client/bundle/pixelify-sans-latin-700-normal-D3Xxx3QE.woff2 +0 -0
  80. package/dist/client/bundle/pixelify-sans-latin-ext-400-normal-BkfTUL4s.woff +0 -0
  81. package/dist/client/bundle/pixelify-sans-latin-ext-400-normal-DdH6zlBQ.woff2 +0 -0
  82. package/dist/client/bundle/pixelify-sans-latin-ext-500-normal-BHT4w5qI.woff2 +0 -0
  83. package/dist/client/bundle/pixelify-sans-latin-ext-500-normal-Bkr-oq6R.woff +0 -0
  84. package/dist/client/bundle/pixelify-sans-latin-ext-600-normal-CDaIumwU.woff +0 -0
  85. package/dist/client/bundle/pixelify-sans-latin-ext-600-normal-Dha6RiOG.woff2 +0 -0
  86. package/dist/client/bundle/pixelify-sans-latin-ext-700-normal-BadXkHzZ.woff +0 -0
  87. package/dist/client/bundle/pixelify-sans-latin-ext-700-normal-ClyJstAh.woff2 +0 -0
  88. package/dist/client/bundle/ptypane-BrP-ENHg.css +1 -0
  89. package/dist/client/bundle/ptypane-NIZ2Y8QM.js +16 -0
  90. package/dist/client/bundle/room-name-CFJfHE5L.js +1 -0
  91. package/dist/client/bundle/simulator-BnBPS_Ws.js +7 -0
  92. package/dist/client/bundle/world-model-BIYmgAWC.js +1 -0
  93. package/dist/client/bundle/world-stream-BRkL9Eme.js +1 -0
  94. package/dist/client/index.html +41 -0
  95. package/dist/client/manifest.webmanifest +17 -0
  96. package/dist/server/index.js +40327 -0
  97. package/mod/README.md +193 -0
  98. package/mod/habblaud/.claude-plugin/plugin.json +11 -0
  99. package/mod/habblaud/hooks/hooks.json +4 -0
  100. package/mod/habblaud/hooks/register.ts +517 -0
  101. package/mod/habblaud-codex/hook.mjs +274 -0
  102. package/mod/habblaud-mensagens/.claude-plugin/plugin.json +11 -0
  103. package/mod/habblaud-mensagens/hooks/hooks.json +4 -0
  104. package/mod/habblaud-mensagens/hooks/register.ts +384 -0
  105. package/mod/habblaud-permissoes/.claude-plugin/plugin.json +11 -0
  106. package/mod/habblaud-permissoes/hooks/hooks.json +18 -0
  107. package/mod/habblaud-permissoes/hooks/permission-hook.mjs +265 -0
  108. package/mod/habblaud-pi/core.ts +325 -0
  109. package/mod/habblaud-pi/extension.ts +119 -0
  110. package/mod/habblaud-pi/package.json +12 -0
  111. package/package.json +96 -4
@@ -0,0 +1 @@
1
+ import{s as e}from"./main-DktU0GfB.js";var t=/^[a-z2-7]{12}$/;function n(e){if(e.charCodeAt(0)!==64||e.charCodeAt(13)!==46)return;let n=e.slice(1,13),r=e.slice(14);if(t.test(n)&&r)return{machine:n,local:r}}function r(e){return(typeof e==`string`?e:``).replace(/[\u0000-\u001f\u007f-\u009f\p{Cf}]/gu,``).trim()}var i=`agent-hub`;function a(t){return t.id===`agent-hub`?e(`Agent Hub`):t.custom&&(!t.name.trim()||t.name.trim()===t.id)?e(`Favoritos`):t.name}export{n as i,a as n,r,i as t};
@@ -0,0 +1,7 @@
1
+ import{s as e}from"./main-DktU0GfB.js";var t=4,n=6;function r(e){let r=(e,t)=>typeof e==`string`&&e.trim()?o(p(e.slice(0,t*4)),t):``,i=e=>!!e&&typeof e==`object`;return(Array.isArray(e)?e.slice(0,t):[]).flatMap((e,t)=>{if(!i(e))return[];let a=r(e.question,300);if(!a)return[];let o=(Array.isArray(e.options)?e.options.slice(0,n):[]).flatMap((e,t)=>{if(!i(e))return[];let n=r(e.label,80);if(!n)return[];let a=r(e.description,200);return[{index:t,label:n,...a?{description:a}:{}}]}),s=r(e.header,30);return[{index:t,question:a,...s?{header:s}:{},...e.multiSelect===!0?{multiSelect:!0}:{},options:o}]})}var i=46,a=300;function o(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,Math.max(1,t-1)).trimEnd()}…`:n}function s(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0?t.slice(n+1):t}function c(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return o(e,30)}}function l(e){return typeof e==`string`?e:``}function u(e,t,n,r){return{kind:e,icon:t,text:o(p(n.slice(0,368)),i),...r?{detail:o(p(r.slice(0,a*4)),a)}:{}}}var d=/\.(png|jpe?g|gif|webp|svg|bmp|ico|heic)$/i,f=[[/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,e(`[chave privada]`)],[/\b(authorization|proxy-authorization|cookie|set-cookie|x-api-key|api-key|x-auth-token|private-token)(\s*:\s*)[^'"\n]+/gi,`$1$2***`],[/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{6,}/g,`$1 ***`],[/(\b[a-z][a-z0-9+.-]*:\/\/[^\s:@/'"]+:)[^\s@/'"]+@/gi,`$1***@`],[/(\bhttps?:\/\/hooks\.slack\.com\/services\/)T[A-Z0-9]+\/B[A-Z0-9]+\/[A-Za-z0-9]+/gi,`$1***`],[/(\bhttps?:\/\/(?:discordapp|discord)\.com\/api\/webhooks\/)\d+\/[A-Za-z0-9_-]+/gi,`$1***`],[/(\bhttps?:\/\/api\.telegram\.org\/bot)\d+:[A-Za-z0-9_-]+/gi,`$1***`],[/((?:^|\s)(?:-u|--user)\s+['"]?[^\s:'"]+:)[^\s'"]+/g,`$1***`],[/((?:^|\s)--?(?:token|password|passwd|pass|secret|api-key|apikey|access-token|auth-token)(?:\s+|=))(['"]?)[^\s'"]+\2/gi,`$1$2***$2`],[/\b([A-Za-z0-9_.-]*?(?:token|secret|passw(?:or)?d|pwd|api[_-]?key|access[_-]?key|private[_-]?key|_key|credentials?))(["']?\s*[=:]\s*)(["']?)([^\s"'&;|,}]+)\3/gi,`$1$2$3***$3`],[/\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{8,}/g,`sk-***`],[/\bgh[pousr]_[A-Za-z0-9]{16,}/g,`gh*_***`],[/\bgithub_pat_[A-Za-z0-9_]{16,}/g,`github_pat_***`],[/\bglpat-[A-Za-z0-9_-]{16,}/g,`glpat-***`],[/\bxox[abposr]-[A-Za-z0-9-]{8,}/g,`xox*-***`],[/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,`AKIA***`],[/\bAIza[0-9A-Za-z_-]{30,}/g,`AIza***`],[/\b(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{10,}/g,`sk_***`],[/\bnpm_[A-Za-z0-9]{30,}/g,`npm_***`],[/\bhf_[A-Za-z0-9]{30,}/g,`hf_***`],[/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,`eyJ***`]];function p(e){let t=e;for(let[e,n]of f)t=t.replace(e,n);return t}function m(e){let t=[],n=``,r=!1,i=null,a=0,o=!1;for(let s=0;s<e.length;s++){let c=e[s];if(i===`'`){c===`'`?i=null:n+=c;continue}if(i===`"`){c===`"`?i=null:c===`\\`&&s+1<e.length&&'"\\$`'.includes(e[s+1])?n+=e[++s]:n+=c;continue}c===`'`||c===`"`?(i=c,r=!0):c===`\\`&&s+1<e.length?(n+=e[++s],r=!0):c==="`"?(o=!o,n+=c,r=!0):c===`$`&&e[s+1]===`(`?(a++,n+=`$(`,s++,r=!0):a&&c===`(`?(a++,n+=c):a&&c===`)`?(a--,n+=c):/\s/.test(c)&&!a&&!o?(r&&t.push(n),n=``,r=!1):(n+=c,r=!0)}return r&&t.push(n),t}function h(e){let t=[],n=0,r=null,i=0;for(let a=0;a<e.length;a++){let o=e[a];if(r){o===`\\`&&r!==`'`?a++:o===r&&(r=null);continue}if(o===`\\`){a++;continue}if(o===`'`||o===`"`||o==="`"){r=o;continue}if(o===`(`?i++:o===`)`&&(i=Math.max(0,i-1)),i)continue;let s=0;o===`&`&&e[a+1]===`&`||o===`|`&&e[a+1]===`|`?s=2:(o===`|`||o===`;`||o===`&`&&e[a-1]!==`>`&&e[a-1]!==`<`&&e[a+1]!==`>`)&&(s=1),s&&(t.push(e.slice(n,a)),a+=s-1,n=a+1)}return t.push(e.slice(n)),t.map(e=>e.trim()).filter(Boolean)}var g=/^[A-Za-z_][A-Za-z0-9_]*=/,_={sudo:new Set([`-u`,`-g`,`-p`,`-C`,`-h`,`-U`]),time:new Set,nohup:new Set,exec:new Set([`-a`]),builtin:new Set,nice:new Set([`-n`]),caffeinate:new Set([`-t`,`-w`]),stdbuf:new Set,unbuffer:new Set,command:new Set,npx:new Set([`-p`,`--package`,`-c`,`--call`]),bunx:new Set([`-p`,`--package`]),env:new Set([`-u`,`-C`,`-S`,`--unset`,`--chdir`])};function v(e){let t=e.slice();for(let e=0;e<12&&t.length;e++){let e=t[0];if(g.test(e)){t=t.slice(1);continue}if(e===`(`||e===`{`||e===`!`){t=t.slice(1);continue}if(e===`command`&&(t[1]===`-v`||t[1]===`-V`))break;if(e===`timeout`||e===`gtimeout`){let e=1;for(;e<t.length&&t[e].startsWith(`-`);)e+=t[e]===`-s`||t[e]===`-k`?2:1;t=t.slice(e+1);continue}if((e===`pnpm`||e===`yarn`)&&(t[1]===`dlx`||t[1]===`exec`)){t=t.slice(2);continue}if(e===`npm`&&t[1]===`exec`){t=t.slice(2);continue}let n=Object.hasOwn(_,e)?_[e]:void 0;if(!n||t.length===1)break;let r=1;for(;r<t.length&&t[r].startsWith(`-`)&&t[r]!==`--`;)r+=n.has(t[r])?2:1;t[r]===`--`&&r++,t=t.slice(r)}for(;t.length&&/^[)}]$/.test(t[t.length-1]);)t=t.slice(0,-1);return t}function y(e){for(let t=0;t<e.length;t++){let n=/^1?(>>?)(.*)$/.exec(e[t]);if(n)return n[2]||e[t+1]}}function b(e){if(!e.length)return!0;let[t]=e;return e.every(e=>g.test(e))?!0:t===`export`||t===`unset`||t===`local`||t===`readonly`?e.slice(1).every(e=>g.test(e)||/^[A-Za-z_]\w*$/.test(e)||e.startsWith(`-`)):(t===`echo`||t===`printf`)&&y(e.slice(1))?!1:/^(cd|pushd|popd|set|shopt|source|\.|true|false|:|trap|ulimit|umask|clear|sleep|echo|printf|do|done|then|fi|else|esac)$/.test(t)}function x(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(/^\d*(?:>>?|<<?<?|>&|&>)$/.test(r)){n++;continue}/^\d*(?:>>?|<<?<?|>&|&>)/.test(r)||t.push(r)}return t}function S(e,t=new Set){let n=[],r=x(e);for(let e=0;e<r.length;e++){let i=r[e];if(i===`--`){n.push(...r.slice(e+1));break}if(i.startsWith(`-`)&&i.length>1){t.has(i)&&e++;continue}n.push(i)}return n}var C=e=>!!e&&!e.includes(`$`)&&!/^\d+$/.test(e)&&e!==`-`;function ee(t){let n=t.filter(C).map(e=>s(e)||e);if(n.length)return n.length===1?n[0]:n.length===2?`${n[0]} e ${n[1]}`:e(`{0} e mais {1}`,[n[0],n.length-1])}var te=new Set([`-e`,`-f`,`-A`,`-B`,`-C`,`-m`,`-d`,`-D`,`--regexp`,`--file`,`--max-count`,`--context`,`--include`,`--exclude`,`--exclude-dir`,`-g`,`-t`,`-T`,`--glob`,`--type`,`--type-not`,`-j`,`--threads`,`-M`,`--max-columns`]),ne=new Set(`-H.-d.-X.-o.-u.-A.-e.-b.-c.-F.-T.-w.-m.-x.-K.-r.-E.-U.-Y.-y.-z.-P.-Q.--header.--data.--data-raw.--data-binary.--data-urlencode.--json.--request.--output.--user.--user-agent.--referer.--cookie.--cookie-jar.--form.--upload-file.--write-out.--max-time.--connect-timeout.--proxy.--retry.--retry-delay.--cacert.--cert.--key.--resolve.--interface.--limit-rate.--range.--config.-O.-P.-t.-T.--output-document.--directory-prefix.--tries.--timeout.--password.--http-user.--http-password`.split(`.`));function re(t){let n,r=x(t);for(let e=0;e<r.length;e++){let t=r[e];if(t===`--url`){n=r[e+1];break}if(t.startsWith(`-`)){ne.has(t)&&e++;continue}if(/^(?:https?:\/\/)?(?:localhost|\[[0-9a-f:]+\]|[\w-]+(?:\.[\w-]+)+)(?::\d+)?(?:[/?#]\S*)?$/i.test(t)){n=t;break}}if(!n)return e(`Fazendo uma requisição HTTP`);let i;try{i=new URL(/^https?:\/\//i.test(n)?n:`http://${n}`)}catch{return e(`Fazendo uma requisição HTTP`)}let a=i.hostname.replace(/^\[|\]$/g,``);if(a===`localhost`||a===`0.0.0.0`||a===`::1`||/^127\./.test(a)){let t=`${i.port?`:${i.port}`:``}${i.pathname===`/`&&!i.port?`/`:i.pathname}`;return`${i.pathname.startsWith(`/api`)?e(`Testando a API local`):e(`Testando o servidor local`)} (${o(t,22)})`}return e(`Chamando {0}`,[a.replace(/^www\./,``)])}function ie(e){let t=(e.match(/\b(de|da|do|das|dos|para|pra|com|em|no|na|nos|nas|um|uma|os|as|que|por|sem|ao|aos|pelo|pela|e|o)\b/gi)??[]).length,n=(e.match(/[ãõçáéíóúâêôà]/gi)??[]).length,r=(e.match(/\b\w+(?:ando|endo|indo)\b/gi)??[]).length,i=(e.match(/\b(the|of|to|for|with|and|in|on|from|an|by|into|all|its|is|are|run|check|start|stop|show|list|get|read|count|find|kill|build|test|verify|wait|open|print|fetch|install|update|create|remove|screenshot)\b/gi)??[]).length;return t+r+n*2>i}var ae={node:`Node`,python:`Python`,python3:`Python`,ruby:`Ruby`,php:`PHP`,deno:`Deno`,bun:`Bun`,tsx:`TypeScript`,"ts-node":`TypeScript`,perl:`Perl`},oe={commit:[`📦`,e(`Fazendo commit`)],push:[`🚀`,e(`Enviando commits (git push)`)],pull:[`⬇️`,e(`Atualizando do remoto (git pull)`)],fetch:[`⬇️`,e(`Buscando do remoto (git fetch)`)],checkout:[`🌿`,e(`Trocando de branch`)],switch:[`🌿`,e(`Trocando de branch`)],merge:[`🔀`,e(`Fazendo merge`)],rebase:[`🔀`,e(`Fazendo rebase`)],status:[`🌿`,e(`Conferindo o git status`)],diff:[`🌿`,e(`Conferindo as mudanças (diff)`)],show:[`🌿`,e(`Olhando um commit (git show)`)],log:[`🌿`,e(`Lendo o histórico do git`)],add:[`🌿`,e(`Preparando arquivos (git add)`)],stash:[`🌿`,e(`Guardando mudanças (stash)`)],clone:[`⬇️`,e(`Clonando repositório`)],branch:[`🌿`,e(`Conferindo as branches`)],worktree:[`🌿`,e(`Mexendo nas worktrees`)],reset:[`🌿`,e(`Desfazendo mudanças (git reset)`)],restore:[`🌿`,e(`Restaurando arquivos (git restore)`)],tag:[`🏷️`,e(`Mexendo nas tags`)],blame:[`🌿`,e(`Vendo quem mudou cada linha`)],"cherry-pick":[`🍒`,e(`Trazendo um commit (cherry-pick)`)]},se={head:new Set([`-n`,`-c`,`--lines`,`--bytes`]),tail:new Set([`-n`,`-c`,`-s`,`--lines`,`--bytes`]),sed:new Set([`-e`,`-f`,`-l`]),gsed:new Set([`-e`,`-f`,`-l`]),awk:new Set([`-F`,`-v`,`-f`]),gawk:new Set([`-F`,`-v`,`-f`]),jq:new Set([`-f`,`--indent`,`--tab`]),sort:new Set([`-k`,`-t`,`-o`,`-S`,`-T`]),cut:new Set([`-d`,`-f`,`-c`,`-b`]),column:new Set([`-s`,`-c`,`-o`]),bat:new Set([`-l`,`--language`,`-r`,`--line-range`,`-H`,`--highlight-line`,`--style`]),less:new Set([`-p`,`-x`,`-y`,`-z`])};function ce(t,n){if(!t.length)return;let r=s(t[0]),i=t.slice(1),a=t.join(` `),c=(e,t,n)=>u(e,t,n);if(/\b(vitest|jest|pytest|phpunit|mocha|ava|rspec)\b|\b(go|cargo|deno|bun)\s+test\b|playwright\s+test|\b(npm|pnpm|yarn|bun)\s+(run\s+)?test\b|\bnode\s+--test\b|-m\s+(pytest|unittest)\b/.test(a))return c(`test`,`🧪`,e(`Rodando testes`));if(r===`git`){let t=0;for(;t<i.length&&i[t].startsWith(`-`);)t+=i[t]===`-C`||i[t]===`-c`?2:1;let n=i[t]??``,[r,a]=oe[n]??[`🌿`,n?`git ${n}`:e(`Usando o git`)];return c(`git`,r,a)}if(r===`gh`)return c(`git`,`🐙`,e(`GitHub CLI: gh {0}`,[i.slice(0,2).join(` `)]).trim());if(/\b(npm|pnpm|yarn|bun)\s+(i|install|add|ci)\b|\bpip3?\s+install\b|\bbrew\s+install\b|\bcomposer\s+(install|require)\b|\bpoetry\s+(add|install)\b|\bcargo\s+add\b|\bgo\s+get\b|\buv\s+(add|sync|pip\s+install)\b/.test(a))return c(`run`,`📦`,e(`Instalando dependências`));if(r===`tsc`&&i.includes(`--noEmit`)||/\b(npm|pnpm|yarn|bun)\s+(run\s+)?(typecheck|type-check|check-types)\b/.test(a))return c(`run`,`🔍`,e(`Conferindo os tipos (TypeScript)`));if(/\b(npm|pnpm|yarn|bun)\s+(run\s+)?build\b|\bvite\s+build\b|^tsc\b|\bwebpack\b|\bcargo\s+build\b|\bgo\s+build\b|^make\b|\bgradle\b|\bmvn\b|\besbuild\b|\brollup\b/.test(a))return c(`run`,`🏗️`,e(`Compilando o projeto`));if(/\b(npm|pnpm|yarn|bun)\s+(run\s+)?(dev|start|serve|preview)\b|^vite(\s|$)(?!build)|^(next|nuxt|astro)\s+dev\b|^expo\s+start\b|^nodemon\b|^tsx\s+watch\b/.test(a))return c(`run`,`▶️`,/\bpreview\b/.test(a)?e(`Subindo o preview do build`):e(`Subindo o servidor de dev`));if(/\b(eslint|prettier|ruff|black|biome|rubocop|phpcs|stylelint|oxlint)\b|\b(npm|pnpm|yarn)\s+(run\s+)?(lint|format)\b/.test(a))return c(`run`,`🧹`,e(`Rodando o linter`));if(/^(npm|pnpm|yarn|bun)$/.test(r)&&i[0]===`run`&&i[1])return c(`run`,`▶️`,e(`Rodando o script {0}`,[i[1]]));if(r===`docker`||r===`docker-compose`)return c(`run`,`🐳`,e(`Docker: {0}`,[i.filter(e=>!e.startsWith(`-`)).slice(0,2).join(` `)]).trim());if(/^(kubectl|helm|terraform|aws|gcloud|az|flyctl|fly|vercel|wrangler|netlify|railway)$/.test(r))return c(`run`,`☁️`,e(`Mexendo na nuvem ({0})`,[r]));if(/^(curl|wget|http|https|xh)$/.test(r))return c(`web`,`🌐`,re(i));if(/^(psql|mysql|sqlite3|redis-cli|mongosh|mongo|duckdb)$/.test(r))return c(`run`,`🗄️`,e(`Consultando o banco de dados`));if(/^(rg|grep|egrep|fgrep|ag|ack|git-grep)$/.test(r)){let t=i.findIndex(e=>e===`-e`||e===`--regexp`),n=(t>=0?i[t+1]:S(i,te)[0])?.replace(/\\\|/g,` | `).replace(/\\([.()[\]{}+?*^$])/g,`$1`);return c(`search`,`🔎`,n?e(`Buscando “{0}”`,[o(n,24)]):e(`Buscando no código`))}if(/^(ls|find|tree|fd|du|df|eza|exa)$/.test(r))return c(`read`,`📂`,e(`Explorando pastas`));if(r===`cd`||r===`pushd`)return c(`read`,`📂`,e(`Mudando de pasta`));if(r===`cat`||r===`tee`||r===`echo`||r===`printf`){let t=r===`tee`?S(i)[0]:y(i);if(t&&C(t)&&t!==`/dev/null`)return c(`write`,`📝`,e(`Escrevendo {0}`,[s(t)]));if(r===`tee`)return c(`write`,`📝`,e(`Escrevendo um arquivo`));if(r!==`cat`)return c(`run`,`💬`,e(`Mostrando texto no terminal`))}if(/^(sed|gsed|perl)$/.test(r)&&i.some(e=>/^-i|^--in-place|^-pi/.test(e))){let t=S(i,new Set([`-e`,`-f`])).pop();return c(`edit`,`✏️`,t&&C(t)&&/[./]/.test(t)?e(`Editando {0}`,[s(t)]):e(`Editando via terminal`))}if(/^(cat|head|tail|less|more|bat|nl|sed|gsed|awk|gawk|jq|wc|strings|xxd|od|hexdump|column|sort|uniq|cut)$/.test(r)){let t=S(r===`jq`?i.filter((e,t)=>!/^--(arg|argjson|slurpfile|rawfile)$/.test(i[t-1]??``)&&!/^--(arg|argjson|slurpfile|rawfile)$/.test(i[t-2]??``)):i,se[r]);/^(sed|gsed|awk|gawk|jq)$/.test(r)&&!i.includes(`-e`)&&!i.includes(`-f`)&&(t=t.slice(1));let n=ee(t);if(r===`wc`){let r=t.filter(C).length;return c(`read`,`🔢`,r>2?e(`Contando linhas de {0} arquivos`,[r]):n?e(`Contando linhas de {0}`,[n]):e(`Contando linhas`))}return r===`tail`&&i.some(e=>e===`-f`||e===`-F`)?c(`read`,`📜`,n?e(`Acompanhando {0}`,[n]):e(`Acompanhando um log`)):r===`jq`&&!n?c(`read`,`🔎`,e(`Filtrando JSON`)):/^(sort|uniq|cut|column)$/.test(r)&&!n?void 0:c(`read`,`📖`,n?e(`Lendo {0}`,[n]):e(`Lendo arquivo`))}if(/^(rm|mv|cp|mkdir|rmdir|touch|chmod|chown|ln|rsync|tar|zip|unzip|gzip|gunzip|xattr)$/.test(r))return c(`run`,`🗂️`,e(`Organizando arquivos`));if(r===`sleep`||r===`wait`)return c(`wait`,`⏳`,e(`Aguardando um pouco`));if(r===`open`||r===`xdg-open`)return c(`run`,`🖥️`,e(`Abrindo no computador`));if(/^(code|cursor|subl|vim|nvim|nano|emacs)$/.test(r))return c(`edit`,`✏️`,e(`Abrindo no editor`));if(/^(pkill|kill|killall)$/.test(r))return c(`run`,`🛑`,e(`Parando um processo`));if(r===`lsof`){let t=i.map(e=>/^(?:-i)?(?:tcp)?:(\d{2,5})$/i.exec(e)?.[1]).find(Boolean);return c(`run`,`🔌`,t?e(`Conferindo quem usa a porta {0}`,[t]):e(`Conferindo processos e portas`))}if(/^(ps|pgrep|top|htop|jobs)$/.test(r))return c(`run`,`🔍`,e(`Conferindo processos`));if(/^(which|whereis|type)$/.test(r)||r===`command`&&/^-[vV]$/.test(i[0]??``))return c(`search`,`🔎`,e(`Procurando um programa`));if(/^(diff|cmp|comm|colordiff|delta)$/.test(r))return c(`read`,`🔀`,e(`Comparando arquivos`));if(r===`date`)return c(`run`,`🕒`,e(`Conferindo a data e a hora`));if(r===`env`||r===`printenv`)return c(`run`,`🔍`,e(`Conferindo variáveis de ambiente`));if(/^(stat|file|md5|md5sum|shasum|sha256sum|realpath|readlink)$/.test(r))return c(`read`,`🔍`,e(`Conferindo um arquivo`));if(r===`claude`)return c(`run`,`🤖`,e(`Rodando o Claude Code`));if(/^(pbcopy|pbpaste)$/.test(r))return c(`run`,`📋`,e(`Usando a área de transferência`));if(/^(bash|sh|zsh|fish)$/.test(r)){let t=i.indexOf(`-c`);if(t>=0&&i[t+1]&&n<3)return w(i[t+1],n+1).desc;let r=S(i).find(C);return c(`run`,`▶️`,r?e(`Executando {0}`,[s(r)]):e(`Executando um script de shell`))}if(/^(node|python3?|ruby|php|deno|bun|tsx|ts-node|perl|java)$/.test(r)||r===`go`&&i[0]===`run`){let t=x(r===`go`?i.slice(1):i),n=t.find((e,n)=>!e.startsWith(`-`)&&!/^-[ecpr]$|^--(eval|print|import|require|loader)$/.test(t[n-1]??``)&&/[./]/.test(e)&&!/^\d+(\.\d+)*$/.test(e));return n&&!/^(-m|-c)$/.test(t[0]??``)?c(`run`,`▶️`,e(`Executando {0}`,[s(n)])):t[0]===`-m`&&t[1]?c(`run`,`▶️`,e(`Executando o módulo {0}`,[t[1]])):c(`run`,`▶️`,e(`Executando um script {0}`,[ae[r]??r]))}if(/^(\.{0,2}\/|~\/)/.test(t[0])||/\.(sh|bash|zsh|py|rb|mjs|js|ts)$/.test(t[0]))return c(`run`,`▶️`,e(`Executando {0}`,[r]))}function w(t,n){let r=t.replace(/\\\r?\n/g,` `).split(/\r?\n/);for(let t=0;t<r.length;t++){let i=r[t].trim();if(!i||i.startsWith(`#`))continue;let a=h(i),o,s=-1;for(let e=0;e<a.length;e++){let t=a[e];if(/^\(.*\)$/.test(t)&&n<3){let e=w(t.slice(1,-1),n+1);if(e.desc||e.prog)return e;continue}t=t.replace(/^\{\s*/,``);let r=v(m(t));if(!b(r)){o=r,s=e;break}}if(!o){if(r.slice(t+1).some(e=>e.trim()&&!e.trim().startsWith(`#`)))continue;let e=v(m(a[0]??``));return{desc:ce(e,n),prog:e[0]}}if(/^(for|while|until|if|select)$/.test(o[0])&&n<3){let i=a.slice(s+1).join(`; `),o=[/^(?:do|then)\b\s*(.*)$/s.exec(i.replace(/^.*?;\s*(?=(do|then)\b)/s,``))?.[1]?.trim(),...r.slice(t+1)].filter(e=>e&&e.trim()&&!/^(done|fi|else|esac)\b/.test(e.trim())).join(`
2
+ `),c=o?w(o,n+1):{};return c.desc?c:{desc:u(`run`,`🔁`,e(`Repetindo um comando em lote`))}}return{desc:ce(o,n),prog:o[0]}}return{}}function T(t,n){let r=t.trim(),i={};try{i=w(r.slice(0,8e3),0)}catch{i={}}if(i.desc)return u(i.desc.kind,i.desc.icon,i.desc.text,r);let a=n?.trim();if(a&&ie(a))return u(`run`,`💻`,a,r);let o=s(i.prog??``);return u(`run`,`💻`,/^[A-Za-z][\w.+-]{0,23}$/.test(o)?e(`Rodando {0}`,[o]):e(`Rodando um comando no terminal`),a?`${a} — ${r}`:r)}function E(e){return e.replace(/[_-]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim().toLowerCase()}function le(t,n){let[,r=``,...i]=t.split(`__`),a=i.join(`__`),o=r.replace(/^claude_ai_/,``);if(/playwright|chrome|browser|puppeteer/i.test(o)){let t=l(n.url);return/navigate/.test(a)?u(`browser`,`🧭`,t?e(`Abrindo {0}`,[c(t)]):e(`Navegando no navegador`),t):/screenshot/.test(a)?u(`browser`,`📸`,e(`Tirando print da página`)):/click/.test(a)?u(`browser`,`🖱️`,e(`Clicando na página`)):/type|fill|form/.test(a)?u(`browser`,`⌨️`,e(`Preenchendo formulário`)):/snapshot|read|get_page|find/.test(a)?u(`browser`,`🧭`,e(`Lendo a página`)):u(`browser`,`🧭`,e(`Navegador: {0}`,[E(a)]))}return/github/i.test(o)?u(`mcp`,`🐙`,`GitHub: ${E(a)}`):/gmail|mail/i.test(o)?u(`mcp`,`✉️`,`E-mail: ${E(a)}`):/drive|docs|notion|confluence/i.test(o)?u(`mcp`,`📄`,`${o}: ${E(a)}`):/sql|postgres|mysql|mongo|elastic|redis|db/i.test(o)?u(`mcp`,`🗄️`,e(`Banco ({0}): {1}`,[o,E(a)])):u(`mcp`,`🔌`,`${o}: ${E(a)}`)}function D(t,n){let i=n&&typeof n==`object`?n:{},a=l(i.file_path)||l(i.notebook_path)||l(i.path);switch(t){case`Read`:return d.test(a)?u(`read`,`🖼️`,e(`Olhando {0}`,[s(a)]),a):/\.pdf$/i.test(a)?u(`read`,`📕`,e(`Lendo {0}`,[s(a)]),a):u(`read`,`📖`,a?e(`Lendo {0}`,[s(a)]):e(`Lendo arquivo`),a);case`Edit`:case`MultiEdit`:return u(`edit`,`✏️`,a?e(`Editando {0}`,[s(a)]):e(`Editando arquivo`),a);case`Write`:return u(`write`,`📝`,a?e(`Escrevendo {0}`,[s(a)]):e(`Escrevendo arquivo`),a);case`NotebookEdit`:return u(`edit`,`📓`,e(`Editando notebook {0}`,[s(a)]),a);case`Glob`:return u(`search`,`🔎`,e(`Procurando {0}`,[o(l(i.pattern)||e(`arquivos`),30)]),l(i.pattern));case`Grep`:{let t=l(i.pattern);return u(`search`,`🔎`,t?e(`Buscando “{0}”`,[o(t,26)]):e(`Buscando no código`),t)}case`LS`:return u(`read`,`📂`,e(`Listando {0}`,[s(a)||e(`pasta`)]),a);case`Bash`:return T(l(i.command),l(i.description));case`BashOutput`:case`TaskOutput`:return u(`run`,`📟`,e(`Conferindo saída do terminal`));case`Monitor`:return u(`run`,`📟`,e(`Monitorando um processo`),l(i.description)||l(i.command));case`KillShell`:case`KillBash`:case`TaskStop`:return u(`run`,`🛑`,e(`Parando um processo`));case`WebSearch`:{let t=l(i.query);return u(`web`,`🌐`,t?e(`Pesquisando “{0}”`,[o(t,28)]):e(`Pesquisando na web`),t)}case`WebFetch`:{let t=l(i.url);return u(`web`,`🌐`,t?e(`Lendo {0}`,[c(t)]):e(`Lendo uma página`),t)}case`TodoWrite`:{let t=Array.isArray(i.todos)?i.todos.filter(e=>!!e&&typeof e==`object`):[],n=t.filter(e=>e.status===`completed`).length;return u(`plan`,`🗒️`,e(`Atualizando a lista de tarefas`),t.length?e(`{0}/{1} concluídas`,[n,t.length]):void 0)}case`TaskCreate`:return u(`plan`,`🗒️`,e(`Nova tarefa: {0}`,[l(i.subject)||e(`sem título`)]),l(i.description));case`TaskUpdate`:{let t=l(i.status);return t===`completed`?u(`plan`,`✅`,e(`Concluiu a tarefa #{0}`,[l(i.taskId)])):t===`in_progress`?u(`plan`,`🗒️`,e(`Começou a tarefa #{0}`,[l(i.taskId)])):u(`plan`,`🗒️`,e(`Atualizando a tarefa #{0}`,[l(i.taskId)]))}case`TaskList`:case`TaskGet`:return u(`plan`,`🗒️`,e(`Revisando as tarefas`));case`EnterPlanMode`:return u(`plan`,`🧭`,e(`Entrando no modo de planejamento`));case`ExitPlanMode`:return u(`plan`,`🧭`,e(`Apresentando o plano`));case`Agent`:case`Task`:{let t=l(i.description),n=l(i.subagent_type);return u(`delegate`,`👥`,t?e(`Delegando: {0}`,[t]):e(`Chamando um subagente`),[n,l(i.prompt)].filter(Boolean).join(` — `))}case`Workflow`:return u(`delegate`,`🕸️`,e(`Orquestrando um workflow`));case`StructuredOutput`:return u(`communicate`,`📤`,e(`Entregando o resultado`));case`ListAgents`:return u(`communicate`,`👥`,e(`Conferindo a equipe`));case`SendMessage`:return u(`communicate`,`💬`,e(`Mensagem para {0}`,[l(i.to)||e(`outro agente`)]),l(i.message));case`AskUserQuestion`:{let t=Array.isArray(i.questions)?i.questions:[],n=r(t);return{...u(`ask`,`❓`,e(`Fazendo uma pergunta a você`),t[0]?l(t[0].question):void 0),...n.length?{questions:n}:{}}}case`Skill`:return u(`skill`,`🧩`,e(`Usando a skill {0}`,[l(i.skill)||l(i.command)]));case`SlashCommand`:return u(`skill`,`⌨️`,e(`Rodando {0}`,[l(i.command)]));case`ToolSearch`:return u(`other`,`🧰`,e(`Procurando ferramentas`));case`ListMcpResourcesTool`:case`ReadMcpResourceTool`:return u(`mcp`,`🔌`,e(`Lendo recursos MCP`));case`Artifact`:return u(`other`,`🖼️`,e(`Publicando uma página`));case`ArtifactData`:case`ArtifactComments`:return u(`other`,`🖼️`,e(`Atualizando uma página publicada`));case`CronCreate`:case`CronDelete`:case`CronList`:case`ScheduleWakeup`:case`RemoteTrigger`:return u(`plan`,`⏰`,e(`Agendando uma tarefa`));case`EnterWorktree`:case`ExitWorktree`:return u(`git`,`🌿`,e(`Trocando de worktree`));case`PushNotification`:case`SendUserFile`:return u(`communicate`,`📣`,e(`Enviando algo para você`));default:return t.startsWith(`mcp__`)?le(t,i):u(`other`,`🛠️`,e(`Usando {0}`,[t]))}}function O(t){return u(`prompt`,`📨`,e(`Nova tarefa: “{0}”`,[o(t,30)]),t)}function ue(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}min${t%60?` ${t%60}s`:``}`:`${Math.floor(n/60)}h${n%60?` ${n%60}min`:``}`}var k=`ShellDone`,de=`ShellWait`;function A(t,n){let r=n&&typeof n==`object`?n:{},s=t===`Monitor`?`monitor`:`shell`,u=r.ws&&typeof r.ws==`object`?l(r.ws.url):``,d=l(r.command).trim()||u.trim(),f=l(r.description).trim(),m;m=f?o(p(f.slice(0,368)),i):s===`monitor`?u?e(`Escutando {0}`,[c(u)]):e(`Monitorando um processo`):d?T(d).text:e(`Comando no terminal`);let h={label:m,kind:s};return d&&(h.command=o(p(d.slice(0,a*4)),a)),h}function j(e,t,n=``){return t?`${e}${o(t,Math.max(8,i-e.length-n.length))}${n}`:`${e.replace(/:\s*$/,``)}${n}`}var M={think:()=>u(`think`,`💭`,e(`Pensando…`)),respond:t=>u(`respond`,`💬`,e(`Escrevendo a resposta`),t),turnDone:t=>u(`done`,`✅`,t?e(`Concluiu em {0}`,[ue(t)]):e(`Concluiu`)),error:(t,n)=>u(`error`,`⚠️`,t?e(`Erro em {0}`,[t]):e(`Algo deu errado`),n),interrupted:()=>u(`wait`,`✋`,e(`Interrompido por você`)),compact:()=>u(`compact`,`🧹`,e(`Organizando a memória (compactando)`)),waiting:t=>u(`wait`,`✋`,t?e(`Precisa de você: {0}`,[t]):e(`Precisa de você`)),backgroundResult:t=>u(`other`,`📬`,e(`Recebeu resultado em segundo plano`),t),apiRetry:()=>u(`wait`,`🔁`,e(`Instabilidade na API, tentando de novo`)),rejected:t=>u(`wait`,`🚫`,t?e(`Você recusou: {0}`,[t]):e(`Você recusou a ação`)),cleared:()=>u(`compact`,`🧽`,e(`Começou uma conversa nova (/clear)`)),supervising:()=>u(`delegate`,`👥`,e(`Acompanhando os subagentes`)),answered:t=>u(`ask`,`💬`,e(`Recebeu a sua resposta`),t),waitingShell:(t,n=1,r)=>({...u(`wait`,`⏳`,j(n>1?e(`Esperando {0} shells: `,[n]):e(`Esperando o shell: `),t),r),tool:de}),shellDone:(t,n,r,i)=>{if(n===`failed`)return{...u(`run`,`❌`,j(e(`Shell falhou: `),t),i),tool:k,error:!0};if(n===`killed`)return{...u(`run`,`🛑`,j(e(`Shell interrompido: `),t),i),tool:k,error:!0};let a=r!==void 0&&r>=1e3?` (${ue(r)})`:``;return{...u(`run`,`✅`,j(e(`Shell terminou: `),t,a),i),tool:k}}},N=2e3,P=`AskUserQuestion`,fe=300;function F(e,t){if(!e.length||!Array.isArray(t)||t.length!==e.length)return;let n=new Map;for(let e of t){if(!e||typeof e!=`object`||n.has(e.question))return;n.set(e.question,e)}let r=[];for(let t of e){let e=n.get(t.index);if(!e)return;let i=Array.isArray(e.options)?e.options:[],a=[...new Set(i)].sort((e,t)=>e-t);if(a.length!==i.length||a.some(e=>!t.options.some(t=>t.index===e)))return;let o=typeof e.other==`string`?e.other.trim():``;if(o.length>2e3)return;let s=a.length+ +!!o;if(t.multiSelect?s<1:s!==1)return;r.push({question:t.index,...a.length?{options:a}:{},...o?{other:o}:{}})}return r}function pe(t,n){return o(n.flatMap(n=>{let r=t.find(e=>e.index===n.question);if(!r)return[];let i=(n.options??[]).map(t=>r.options.find(e=>e.index===t)?.label??e(`opção {0}`,[t+1]));return n.other&&i.push(`“${o(p(n.other.slice(0,N)),80)}”`),[`${r.header??o(r.question,40)}: ${i.join(`, `)}`]}).join(` · `),fe)}var me=`GitHub`,he=12e3,ge=6e5,_e=46,ve=30;function I(e,t){return o(p(e.slice(0,t*4)),t)}function L(e){return e.branch?I(e.branch,28):e.number===void 0?e.workflow?I(e.workflow,28):void 0:`PR #${e.number}`}function ye(e){return e.workflow&&!/^ci$/i.test(e.workflow.trim())?e.workflow:L(e)}function R(t){let n=t.number===void 0?`PR`:`PR #${t.number}`;switch(t.kind){case`pr_opened`:return e(`{0} aberto!`,[n]);case`pr_merged`:return e(`{0} mergeado!`,[n]);case`release`:return t.tag?I(e(`Release {0} no ar!`,[t.tag]),ve):e(`Release no ar!`);case`ci_failed`:{let n=L(t);return I(n?e(`CI falhou ({0})`,[n]):e(`CI falhou`),ve)}case`ci_passed`:return e(`CI verde de novo!`);default:return}}function be(t,n,r){let i=t.number===void 0?e(`um PR`):e(`o PR #{0}`,[t.number]),a=(e,n,r,i=!1)=>{let a={kind:`git`,icon:e,text:I(n,_e),tool:me},o=r??t.url??t.repo;return o&&(a.detail=I(o,300)),i&&(a.error=!0),a};switch(t.kind){case`pr_opened`:return{notice:e(`🎉 {0} abriu {1} em {2}`,[n,i,r]),level:`success`,activity:a(`🎉`,e(`Abriu {0}`,[i]))};case`pr_merged`:return{notice:e(`🎉 {0} mergeou {1} em {2}`,[n,i,r]),level:`success`,activity:a(`🎉`,e(`Mergeou {0}`,[i]))};case`release`:{let i=t.tag?I(t.tag,24):void 0;return{notice:e(`🎉 {0} publicou {1} em {2}`,[n,i?e(`a release {0}`,[i]):e(`uma release`),r]),level:`success`,activity:a(`🎉`,i?e(`Publicou a release {0}`,[i]):e(`Publicou uma release`))}}case`push`:{let i=t.branch?I(t.branch,28):void 0;return{notice:e(`🚀 {0} enviou commits {1}em {2}`,[n,i?e(`para {0} `,[i]):``,r]),level:`info`,activity:a(`🚀`,i?e(`Enviou commits para {0}`,[i]):e(`Enviou commits ao GitHub`))}}case`ci_failed`:{let n=L(t),i=ye(t);return{notice:e(`🚨 CI falhou em {0}{1}`,[r,n?` (${n})`:``]),level:`warn`,activity:a(`🚨`,i?e(`CI falhou: {0}`,[i]):e(`CI falhou`),[t.workflow,t.branch,t.url].filter(Boolean).join(` — `)||void 0,!0)}}case`ci_passed`:{let n=L(t),i=ye(t);return{notice:e(`✅ CI passou em {0}{1}`,[r,n?` (${n})`:``]),level:`success`,activity:a(`✅`,i?e(`CI passou: {0}`,[i]):e(`CI passou`),[t.workflow,t.branch,t.url].filter(Boolean).join(` — `)||void 0)}}}}var xe=class{rooms=new Map;apply(e,t,n,r){let i=this.rooms.get(e)??{},a=(e,t,i)=>{let a={kind:e,text:t,at:n,until:n+i};return r&&(a.agentId=r),a};switch(t.kind){case`pr_opened`:case`pr_merged`:case`release`:i.party=a(`party`,R(t),he);break;case`ci_failed`:i.alarm=a(`alarm`,R(t),ge),delete i.party;break;case`ci_passed`:if(!i.alarm||i.alarm.until<=n)return!1;delete i.alarm,i.party=a(`party`,R(t),he);break;default:return!1}return this.rooms.set(e,i),!0}get(e,t){let n=this.rooms.get(e);if(n){if(n.party&&n.party.until>t)return n.party;if(n.alarm&&n.alarm.until>t)return n.alarm}}prune(e){let t=!1;for(let[n,r]of this.rooms)r.party&&r.party.until<=e&&(delete r.party,t=!0),r.alarm&&r.alarm.until<=e&&(delete r.alarm,t=!0),!r.party&&!r.alarm&&this.rooms.delete(n);return t}};function z(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function B(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var Se=2e4,Ce=`HabblaudMessage`,V=300;function H(t,n=0){let r=o(p(t.slice(0,V*4)),V),i=n>0?n===1?e(`com 1 imagem`):e(`com {0} imagens`,[n]):``,a=r&&i?`${r} · ${i}`:r||i;return{kind:`communicate`,icon:`✉️`,text:e(`Mensagem pelo Habblaud`),tool:Ce,...a?{detail:a}:{}}}var we=15728640,Te=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`];function Ee(e){return/^\s*\/[^\s/]+(?:\s[\s\S]*)?$/.test(e)}var De=`Ana.Beatriz.Camila.Daniela.Eduarda.Fernanda.Gabriela.Helena.Isabela.Júlia.Larissa.Mariana.Natália.Olívia.Paula.Rebeca.Sofia.Tatiana.Valentina.Yasmin.Alice.Bianca.Cecília.Débora.Elisa.Flávia.Giovana.Heloísa.Iara.Jéssica.Lívia.Manuela.Melissa.Nina.Priscila.Rafaela.Sabrina.Teresa.Vitória.Zoe.Aline.Bruna.Clara.Estela.Fabiana.Glória.Ingrid.Joana.Kátia.Lara.Maitê.Mirela.Noemi.Pietra.Renata.Simone.Sara.Vanessa.Luana.Marina`.split(`.`),U=`Arthur.Bruno.Caio.Diego.Enzo.Felipe.Gustavo.Henrique.Igor.João.Kauã.Lucas.Mateus.Nicolas.Otávio.Pedro.Rafael.Samuel.Thiago.Vinícius.Bernardo.Danilo.Davi.Emanuel.Fábio.Gael.Heitor.Hugo.Joaquim.Jorge.Leonardo.Lorenzo.Luan.Marcelo.Murilo.Noah.Otto.Raul.Renato.Ricardo.Rodrigo.Sérgio.Theo.Tomás.Ulisses.Vicente.Wagner.Yuri.Augusto.Benício.César.Douglas.Elias.Francisco.Guilherme.Ícaro.Jonas.Leandro.Miguel.Paulo`.split(`.`),W=Object.freeze(De.flatMap((e,t)=>[{name:e,look:`f`},...U[t]?[{name:U[t],look:`m`}]:[]]));function G(e,t){let n=W.length,r=z(e)%n;for(let e=0;e<n;e++){let i=W[(r+e)%n];if(!t.has(i.name))return i}let i=W[r];for(let e=2;;e++){let n=`${i.name} ${e}`;if(!t.has(n))return{name:n,look:i.look}}}var K=[`CI`,`build-test`,e(`Testes`),e(`Lint e tipos`),`Deploy`];function Oe(e,t){let n=t.branch??`main`,r=K[Math.floor(e()*K.length)];if(t.alarm&&e()<.75)return{kind:`ci_passed`,branch:n,workflow:r};let i=e();return i<.32?{kind:`pr_opened`,number:t.pr}:i<.58?{kind:`pr_merged`,number:Math.max(1,t.pr-1-Math.floor(e()*3))}:i<.84?{kind:`ci_failed`,branch:n,workflow:r}:i<.92?{kind:`ci_passed`,branch:n,workflow:r}:{kind:`release`,tag:`v${1+Math.floor(e()*3)}.${Math.floor(e()*10)}.${Math.floor(e()*10)}`}}var ke=3e5,q=[[`- const total = items.reduce((s, i) => s + i.price, 0);`,`+ const total = items.reduce((s, i) => s + i.price * i.qty, 0);`,`+ if (total < 0) throw new Error("total inválido");`],[`- export const TIMEOUT = 5_000;`,`+ export const TIMEOUT = 15_000;`],[`- <button onClick={save}>Salvar</button>`,`+ <button onClick={save} disabled={saving}>`,`+ {saving ? "Salvando…" : "Salvar"}`,`+ </button>`]],Ae=[[{header:`Cache`,question:e(`Onde guardo o cache das sessões de login?`),options:[{label:`Redis`,description:e(`Rápido, e já roda no docker-compose do projeto`)},{label:`PostgreSQL`,description:e(`Uma tabela a mais no banco que já existe`)},{label:e(`Memória`),description:e(`Mais simples, mas some quando o servidor reinicia`)}]},{header:e(`Testes`),question:e(`Quais testes eu rodo antes do commit?`),multiSelect:!0,options:[{label:e(`Unidade`),description:e(`npm test, cerca de 40 s`)},{label:e(`Integração`),description:e(`Sobe um banco de teste no Docker`)},{label:`E2E`,description:e(`Playwright no navegador, uns 5 min`)}]}],[{header:e(`Erro de rede`),question:e(`Como trato a falha de rede no checkout?`),options:[{label:e(`Tentar de novo`),description:e(`Até 3 tentativas, com espera crescente`)},{label:e(`Avisar o cliente`),description:e(`Mensagem com um botão para tentar de novo`)},{label:e(`Guardar e enviar depois`),description:e(`Fila local até a conexão voltar`)}]},{header:e(`Telas`),question:e(`Em quais telas aplico a mudança?`),multiSelect:!0,options:[{label:e(`Carrinho`)},{label:e(`Pagamento`)},{label:e(`Confirmação do pedido`)}]}]];function je(e){return e.map(e=>[e.question,...e.options.map(e=>` - ${e.label}${e.description?`: ${e.description}`:``}`)].join(`
3
+ `)).join(`
4
+
5
+ `)}function Me(t,n,r,i,a){let o=e=>e[Math.floor(r()*e.length)],s=a===`question`?1:a===`permission`?r()*.9:r(),c={id:t,createdAt:i,expiresAt:i+ke};if(s>=.9){let e=o(Ae),t=D(`AskUserQuestion`,{questions:e});return{...c,tool:`AskUserQuestion`,title:`AskUserQuestion(${e[0].question})`,text:t.text,icon:t.icon,input:je(e),inputKind:`text`,questions:t.questions}}if(s<.55&&n.commands.length){let e=o(n.commands),t=D(`Bash`,{command:e}),r=e.split(/\s+/).slice(0,2).join(` `);return{...c,tool:`Bash`,title:`Bash(${e})`,text:t.text,icon:t.icon,input:e,inputKind:`command`,suggestions:[{index:0,rules:[`Bash(${r}:*)`],destination:`localSettings`}]}}if(s<.8&&n.files.length){let e=o(n.files),t=D(`Edit`,{file_path:e});return{...c,tool:`Edit`,title:`Edit(${e})`,text:t.text,icon:t.icon,input:o(q).join(`
6
+ `),inputKind:`diff`}}let l=`https://developer.mozilla.org/pt-BR/docs/Web/API/Fetch_API`,u=D(`WebFetch`,{url:l});return{...c,tool:`WebFetch`,title:`WebFetch(${l})`,text:u.text,icon:u.icon,input:e(`Resuma como tratar erros de rede com fetch`),inputKind:`text`,suggestions:[{index:0,rules:[`WebFetch(domain:developer.mozilla.org)`],destination:`localSettings`}]}}var Ne=25e3,Pe=[[`registry.npmjs.org`,`npm install`],[`pypi.org`,`pip install -r requirements.txt`],[`api.github.com`,`gh pr view --json title`]];function Fe(e,t,n=!1){let r=t.map(e=>e.startsWith(`- `)?`-${e.slice(2)}`:e.startsWith(`+ `)?`+${e.slice(2)}`:n?`+${e}`:` ${e}`);return[`*** Begin Patch`,`*** ${n?`Add`:`Update`} File: ${e}`,...n?[]:[`@@`],...r,`*** End Patch`].join(`
7
+ `)}function Ie(t,n,r,i){let a=e=>e[Math.floor(r()*e.length)],o=r(),s={id:t,provider:`codex`,createdAt:i,expiresAt:i+Ne};if(o<.3&&n.files.length){let e=a(n.files),t=D(`Edit`,{file_path:e});return{...s,tool:`apply_patch`,title:`apply_patch(${e})`,text:t.text,icon:t.icon,input:Fe(e,a(q)),inputKind:`diff`}}if(o<.45){let[t,n]=a(Pe);return{...s,tool:`Bash`,title:`Bash(${n})`,text:e(`Acesso à rede: {0}`,[t]),icon:`🌐`,input:n,inputKind:`command`}}let c=n.commands.length?a(n.commands):`npm test`,l=D(`Bash`,{command:c});return{...s,tool:`Bash`,title:`Bash(${c})`,text:l.text,icon:l.icon,input:c,inputKind:`command`}}var J=`/Users/dev/projetos`,Y=[{name:`loja-virtual`,files:[`src/pages/Checkout.tsx`,`src/components/Cart.tsx`,`src/api/orders.ts`,`src/hooks/useCart.ts`,`src/styles/theme.css`,`tests/cart.test.ts`,`package.json`],prompts:[e(`Cria a página de checkout com resumo do pedido`),e(`O total do carrinho não atualiza ao remover item`),e(`Adiciona cupom de desconto no checkout`),e(`Melhora o layout mobile da vitrine`)],tasks:[e(`Criar página de checkout`),e(`Validar formulário de endereço`),e(`Integrar cálculo de frete`),e(`Escrever testes do carrinho`),e(`Ajustar layout mobile`)],queries:[`react checkout form validation`,e(`cálculo de frete correios api`)],commands:[`npm test`,`npm run build`,`git status`,`git diff`,`npm run lint`,`git commit -m "feat: checkout"`],greps:[`useCart`,`calculateTotal`,`TODO`]},{name:`api-pagamentos`,files:[`src/routes/payments.ts`,`src/services/pix.ts`,`src/db/migrations/004_refunds.sql`,`src/middleware/auth.ts`,`tests/pix.test.ts`,`docker-compose.yml`],prompts:[e(`Implementa estorno de pagamentos via Pix`),e(`Os webhooks estão duplicando cobranças, investiga`),e(`Adiciona rate limit nas rotas públicas`)],tasks:[e(`Mapear fluxo de estorno`),e(`Criar migration de refunds`),e(`Implementar rota POST /refunds`),e(`Idempotência nos webhooks`),e(`Cobrir com testes`)],queries:[e(`pix devolução api bacen`),`idempotency key webhook best practices`],commands:[`npm test`,`docker compose up -d db`,`psql -c "select count(*) from payments"`,`git status`,`curl -s http://localhost:3000/health`],greps:[`webhook`,`idempotencyKey`,`refund`]},{name:`app-mobile`,files:[`app/screens/Home.tsx`,`app/screens/Profile.tsx`,`app/navigation/index.tsx`,`app/services/api.ts`,`app.json`],prompts:[e(`Cria a tela de perfil com foto e edição`),e(`A navegação trava ao voltar da tela de detalhes`),e(`Adiciona modo escuro no app`)],tasks:[e(`Criar tela de perfil`),e(`Upload de foto`),e(`Corrigir navegação`),e(`Tema escuro`)],queries:[`react native navigation goBack freeze`,`expo image picker permissions`],commands:[`npx expo start`,`npm test`,`git status`,`npm install react-native-reanimated`],greps:[`navigation.goBack`,`useTheme`]},{name:`data-pipeline`,files:[`pipelines/ingest.py`,`pipelines/transform.py`,`dags/daily_report.py`,`requirements.txt`,`tests/test_transform.py`],prompts:[e(`O relatório diário está vindo com datas erradas`),e(`Adiciona deduplicação na ingestão`),e(`Otimiza a transformação que está lenta`)],tasks:[e(`Investigar fuso horário`),e(`Corrigir parse de datas`),e(`Deduplicar eventos`),e(`Testes de regressão`)],queries:[`pandas tz_convert daylight saving`,`airflow dag catchup false`],commands:[`pytest -q`,`python pipelines/ingest.py --dry-run`,`pip install -r requirements.txt`,`git status`],greps:[`tz_localize`,`drop_duplicates`]},{name:`site-institucional`,files:[`src/pages/index.astro`,`src/components/Hero.astro`,`src/content/blog/lancamento.md`,`astro.config.mjs`,`public/robots.txt`],prompts:[e(`Cria a seção de depoimentos na home`),e(`Melhora o SEO das páginas do blog`),e(`Adiciona formulário de contato`)],tasks:[e(`Seção de depoimentos`),e(`Meta tags do blog`),`Sitemap`,e(`Formulário de contato`)],queries:[`astro sitemap integration`,`schema.org organization json-ld`],commands:[`npm run build`,`npm run dev`,`git status`,`npx lighthouse http://localhost:4321`],greps:[`<meta`,`description`]},{name:`chatbot-suporte`,files:[`bot/handlers/faq.ts`,`bot/llm/prompt.ts`,`bot/integrations/zendesk.ts`,`bot/index.ts`,`tests/faq.test.ts`],prompts:[e(`O bot não está encaminhando para humano`),e(`Adiciona integração com o Zendesk`),e(`Melhora o prompt para respostas mais curtas`)],tasks:[e(`Regra de escalonamento`),e(`Cliente Zendesk`),e(`Ajustar prompt`),e(`Testes de conversa`)],queries:[`zendesk tickets api create`,`llm handoff to human patterns`],commands:[`npm test`,`npm run dev`,`git status`,`git push`],greps:[`handoff`,`escalate`]}],Le={name:`monorepo-plataforma`,files:[`packages/core/src/index.ts`,`packages/ui/src/Button.tsx`,`apps/web/src/main.tsx`,`pnpm-workspace.yaml`,`tests/e2e/smoke.spec.ts`],prompts:[e(`Migra os pacotes para o novo build`),e(`Padroniza os componentes de formulário`),e(`Corrige os testes instáveis da CI`),e(`Atualiza as dependências do monorepo`)],tasks:[e(`Migrar pacote core`),e(`Atualizar a CI`),e(`Revisar tipos compartilhados`),e(`Rodar os testes do monorepo`)],queries:[`pnpm workspaces filter run`,`turborepo remote cache`],commands:[`pnpm -r test`,`pnpm build`,`git status`,`git diff`],greps:[`export default`,`TODO`]},Re=19,ze=3,Be=15e4,Ve=15e4,He=Y.map(e=>e.name),Ue=[`Explore`,`general-purpose`,`Plan`,`code-reviewer`,`test-runner`],We=[e(`Mapear arquivos envolvidos`),e(`Revisar código existente`),e(`Pesquisar documentação`),e(`Rodar suíte de testes`),e(`Investigar causa do bug`),e(`Propor plano de implementação`),e(`Verificar cobertura de testes`),e(`Analisar logs de erro`)],Ge=[`claude-opus-5-5`,`claude-sonnet-5-5`,`claude-fable-5-1`],Ke=[`gpt-5.3-codex`,`gpt-5.2-codex`,`gpt-5.1-codex-mini`],qe=[`explorer`,`worker`,`reviewer`],Je=30,Ye=[{description:e(`Rodar a suíte de testes`),command:`npm test -- --runInBand`},{description:e(`Build de produção`),command:`npm run build -- --mode production`},{description:e(`Migração do banco`),command:`npm run db:migrate && npm run db:seed`},{description:e(`Rodar os testes de integração`),command:`pytest -q tests/integration`},{description:e(`Gerar o relatório completo`),command:`python pipelines/report.py --full`},{description:e(`Subir os containers`),command:`docker compose up --build --wait`},{description:e(`Testes de ponta a ponta`),command:`npx playwright test`},{description:e(`Auditoria de desempenho`),command:`npx lighthouse http://localhost:4321 --quiet`}],Xe=[{description:e(`Instalar as dependências`),command:`npm ci`},{description:e(`Rodar os testes do módulo`),command:`npm test -- src/api`},{description:e(`Compilar o projeto`),command:`npm run build`},{description:e(`Baixar a imagem do banco`),command:`docker pull postgres:17`}],Ze=.35,Qe=.15,$e=[{id:`.claude`,short:`C`,name:`Conta C`,email:`dev@empresa.example`,organization:e(`Empresa`),plan:`Max`,color:`#f08a3c`,configDir:`~/.claude`},{id:`.claude-conta2`,short:`D`,name:`Conta D`,email:`dev@pessoal.example`,plan:`Max`,color:`#4aa8e8`,configDir:`~/.claude-conta2`}],X={id:`.codex`,provider:`codex`,short:`X`,name:`Codex`,plan:`Team`,color:`#a77bf3`,configDir:`~/.codex`},et=[{short:`X`,name:`Demo X`,color:`#5cc97b`},{short:`Y`,name:`Demo Y`,color:`#a77bf3`}],tt={short:`Z`,name:`Demo Codex`,color:`#f06fa0`},Z=36e5,Q=6e4,nt=30*Q,rt=2e3,it=6e3,at=3e4,$=2e4,ot=25e3,st=class{rng;speed;target;prefix;tag;accounts;agents=new Map;rooms=new Map;slotFreedAt=new Map;rev=0;dirty=!0;seq=0;nextSpawnAt=0;startedAt;pendingFeed=[];pendingNotices=[];usage=new Map;ghRng;effects=new xe;nextGitHubAt;prSeq;codexAccount;codexRng;codexFetchedAt;codexNoQuotaAlways;noQuotaFrom;noQuotaUntil;codexReadNoQuota;mainsSpawned=0;crowdEnabled;crowdRng;crowdOn=!1;crowdNextAt=0;constructor(t={},n=Date.now()){this.rng=B(t.seed??z(String(n))),this.speed=t.speed??1,this.ghRng=B(((t.seed??z(String(n)))^1779033703)>>>0),this.nextGitHubAt=n+(1e4+this.ghRng()*1e4)/this.speed,this.prSeq=12+Math.floor(this.ghRng()*80),this.codexRng=B(((t.seed??z(String(n)))^1013904242)>>>0),this.target=t.sessions??4,this.prefix=t.idPrefix??``,this.tag=n.toString(36),this.accounts=this.prefix?$e.map((t,n)=>({...t,...et[n],id:`${this.prefix}${t.id}`,configDir:e(`(demonstração)`)})):$e,this.codexAccount=this.prefix?{...X,...tt,id:`${this.prefix}${X.id}`,configDir:e(`(demonstração)`)}:X,this.startedAt=n,this.accounts.forEach((e,t)=>this.usage.set(e.id,{five:12+this.rng()*30,week:20+this.rng()*35,fiveReset:n+(1.5+t*1.7)*Z,weekReset:n+(2+t*2.5)*24*Z})),this.usage.set(this.codexAccount.id,{five:30+this.codexRng()*40,week:25+this.codexRng()*45,fiveReset:n+(.8+this.codexRng()*3)*Z,weekReset:n+(1+this.codexRng()*5)*24*Z}),this.codexFetchedAt=n-(4+this.codexRng()*20)*Q,this.crowdEnabled=!!t.crowd,this.crowdRng=B(((t.seed??z(String(n)))^1359893119)>>>0),this.codexNoQuotaAlways=!!t.codexNoQuota,this.noQuotaFrom=n+(6+this.codexRng()*6)*Q/this.speed,this.noQuotaUntil=this.noQuotaFrom+(2+this.codexRng()*2)*Q/this.speed,this.codexReadNoQuota=this.codexNoQuotaAlways;for(let e=0;e<this.target-1;e++)this.spawnSession(n,!0);let r=[...this.agents.values()].find(e=>e.info.kind===`main`);r&&this.startBackgroundShells(r,n,!0),this.nextSpawnAt=n+this.ms(2e4,4e4),this.crowdEnabled&&this.startCrowd(n),this.pendingFeed=[],this.pendingNotices=[]}setSessions(e){this.target=Math.max(0,Math.floor(e))}receiveMessage(e,t,n=Date.now()){let r=this.agents.get(e);return!r||r.info.kind!==`main`||r.removeAt!==void 0||r.phase===`leaving`?!1:r.info.provider===`codex`?((r.inbox??=[]).push(t),r.inboxAt=Math.max(r.inboxAt??0,n+(rt+z(`${e}:${t}:${n}`)%it)/this.speed),!0):(this.activity(r,n,H(t)),r.phase===`idle`&&(r.phaseUntil=Math.min(r.phaseUntil,n+this.ms(1500,3e3))),!0)}tick(e){e>=this.nextSpawnAt&&([...this.agents.values()].filter(e=>e.info.kind===`main`&&e.phase!==`leaving`&&!e.crowd).length<this.target&&this.spawnSession(e,!1),this.nextSpawnAt=e+this.ms(25e3,7e4)),this.crowdEnabled&&e>=this.crowdNextAt&&(this.crowdOn?this.releaseCrowd(e):this.startCrowd(e));for(let t of[...this.agents.values()])this.step(t,e);e>=this.nextGitHubAt&&(this.nextGitHubAt=e+(35e3+this.ghRng()*45e3)/this.speed,this.gitHubEvent(e)),this.effects.prune(e)&&(this.dirty=!0),this.gc(e);let t=this.dirty;t&&this.rev++,this.dirty=!1;let n=this.pendingFeed,r=this.pendingNotices;return this.pendingFeed=[],this.pendingNotices=[],{changed:t,feed:n,notices:r}}snapshot(e=Date.now()){return{rev:this.rev,serverTime:e,rooms:[...this.rooms.values()].map(t=>{let n=this.effects.get(t.id,e);return n?{...t,effect:{...n}}:{...t}}),agents:[...this.agents.values()].map(e=>lt(e.info)),accounts:[...this.accounts.map(t=>{let n=this.usage.get(t.id);return{...t,sessions:this.sessionsOf(t.id),usage:{fiveHour:{utilization:Math.round(n.five),resetsAt:n.fiveReset},sevenDay:{utilization:Math.round(n.week),resetsAt:n.weekReset},source:`statusline`,fetchedAt:e},usageStatus:`ok`}}),this.codexAccountInfo(e)],meta:{demo:!0,sources:[],startedAt:this.startedAt,version:`demo`}}}sessionsOf(e){return[...this.agents.values()].filter(t=>t.info.kind===`main`&&t.info.account===e&&t.info.status!==`offline`).length}codexAccountInfo(e){let t=this.codexAccount,n=this.usage.get(t.id),r=this.codexFetchedAt,i=this.codexReadNoQuota?{source:`codex`,noQuota:!0,fetchedAt:r}:{fiveHour:{utilization:Math.round(n.five),resetsAt:n.fiveReset},sevenDay:{utilization:Math.round(n.week),resetsAt:n.weekReset},source:`codex`,fetchedAt:r};return{...t,sessions:this.sessionsOf(t.id),usage:i,usageStatus:e-r>nt?`stale`:`ok`}}codexNoQuota(e){return e>=this.noQuotaUntil&&(this.noQuotaFrom=e+(12+this.codexRng()*8)*Q/this.speed,this.noQuotaUntil=this.noQuotaFrom+(2+this.codexRng()*2)*Q/this.speed),this.codexNoQuotaAlways||e>=this.noQuotaFrom}decidePermission(t,n,r=Date.now()){let i=[...this.agents.values()].find(e=>e.info.permission?.id===t);if(!i||i.phase!==`waiting`)return!1;let a=i.info.permission;if(a.provider===`codex`&&(n.behavior===`answer`||n.suggestion!==void 0||n.interrupt||n.behavior===`deny`&&!n.message?.trim()))return!1;let o=a.tool===P,s=n.behavior===`answer`&&o?F(a.questions??[],n.answers):void 0;if(n.behavior===`answer`&&!s||n.behavior===`allow`&&o)return!1;let c=a.title;return delete i.info.permission,this.dirty=!0,n.behavior===`terminal`?(i.phaseUntil=Math.min(i.phaseUntil,r+this.ms(3e3,8e3)),!0):(s?this.activity(i,r,{kind:`other`,icon:`💬`,text:e(`Respondido no Habblaud`),detail:pe(a.questions??[],s),tool:`PermissionRequest`}):n.behavior===`allow`?this.activity(i,r,{kind:`other`,icon:`✅`,text:n.suggestion===void 0?e(`Aprovado no Habblaud`):e(`Aprovado no Habblaud (sempre permitir)`),detail:c,tool:`PermissionRequest`}):this.activity(i,r,{kind:`wait`,icon:`🚫`,text:e(`Recusado no Habblaud`),detail:n.message?`${c} — ${n.message}`:c,tool:`PermissionRequest`}),this.resumeFromWaiting(i,r),!0)}forcePermission(e=Date.now(),t,n=`claude`){let r=[...this.agents.values()].filter(e=>e.info.kind===`main`&&e.removeAt===void 0&&(e.info.provider??`claude`)===n),i=r.find(e=>e.phase===`working`)??r.find(e=>e.phase===`idle`)??r.find(e=>e.phase===`shell`);if(i)return i.phase!==`working`&&(i.phase=`working`,i.actionsLeft=3,this.setStatus(i,`working`,e)),this.askPermission(i,e,t),i.info.id}askPermission(t,n,r){t.phase=`waiting`,t.phaseUntil=n+this.ms(25e3,5e4);let i=`${this.prefix}perm-${this.tag}-${++this.seq}`,a=t.info.provider===`codex`;t.info.permission=a?Ie(i,t.project,t.rng,n):Me(i,t.project,t.rng,n,r);let o=a?e(`aprovar um comando`):t.info.permission.tool===`AskUserQuestion`?e(`responder uma pergunta`):e(`aprovar uma permissão`);t.info.waitingFor=o,this.setStatus(t,`waiting`,n),this.activity(t,n,M.waiting(o)),this.notice(n,`alert`,e(`✋ {0} precisa de você em {1}: {2}`,[t.info.name,t.project.name,o]),t.info.id,t.info.roomId)}resumeFromWaiting(e,t){e.phase=`working`,e.info.waitingFor=void 0,delete e.info.permission,this.setStatus(e,`working`,t),e.nextActionAt=t+this.ms(800,1500),this.dirty=!0}ms(e,t){return(e+this.rng()*(t-e))/this.speed}pick(e,t=this.rng){return e[Math.floor(t()*e.length)]}usedNames(){return new Set([...this.agents.values()].map(e=>e.info.name))}ensureRoom(t,n){let r=`${this.prefix}${J}/${t.name}`,i=this.rooms.get(r);if(i)return i;let a=new Set([...this.rooms.values()].map(e=>e.slot)),o=0;for(;a.has(o)||n-(this.slotFreedAt.get(o)??-1/0)<at;)o++;let s={id:r,name:t.name,path:`${J}/${t.name}`,slot:o,seed:z(r),createdAt:n};return this.rooms.set(r,s),this.notice(n,`info`,e(`🏗️ Nova sala: {0}`,[t.name]),void 0,r),this.dirty=!0,s}spawnSession(t,n){let r=this.mainsSpawned++,i=new Set([...this.rooms.values()].map(e=>e.name)),a=i.size>0&&this.rng()<.35,o=Y.filter(e=>a?i.has(e.name):!i.has(e.name)),s=this.pick(o.length?o:Y),c=n&&r===1?[...this.agents.values()].find(e=>e.info.kind===`main`):void 0;c&&(s=c.project);let l=this.ensureRoom(s,t),u=++this.seq,d=`${this.prefix}sess-${this.tag}-${u}-${Math.floor(this.rng()*1e9).toString(36)}`,f=`${this.prefix||`demo:`}${this.tag}-${u}`,p=!!c||!n&&z(`codex:${d}`)%100<Je,m=G(d,this.usedNames()),h=B(z(d)),g=s.tasks.slice(0,3+Math.floor(h()*2)).map((e,t)=>({id:String(t+1),title:e,status:`pending`})),_=this.rng()<.6?this.accounts[0].id:this.accounts[1].id,v={id:f,kind:`main`,roomId:l.id,name:m.name,look:m.look,role:e(`Agente principal`),title:this.pick(s.prompts,h),sessionId:d,account:p?this.codexAccount.id:_,status:`idle`,recent:[],tasks:g,model:this.pick(p?Ke:Ge,h),gitBranch:this.pick([`main`,`develop`,`feat/checkout`,`fix/webhooks`],h),permissionMode:p?`on-request`:`default`,startedAt:t,lastEventAt:t,statusSince:t,stats:p?{toolCalls:0,tokensIn:0,tokensOut:0,linesAdded:0,linesRemoved:0,subagents:0}:{toolCalls:0,tokensIn:0,tokensOut:0,costUSD:0,linesAdded:0,linesRemoved:0,subagents:0},seed:z(f),canMessage:!0};p&&(v.provider=`codex`);let y={info:v,project:s,rng:h,phase:`idle`,phaseUntil:t+(n?this.ms(0,8e3):this.ms(2e3,5e3)),nextActionAt:t,actionsLeft:0,children:[],closeAt:t+this.ms(15e4,42e4),taskCursor:0,shellEnds:new Map,shelledThisTurn:!1,foregroundThisTurn:!1};this.agents.set(f,y);let b=this.accounts.find(e=>e.id===v.account);n||this.notice(t,`info`,e(`👋 {0} chegou em {1}{2}`,[v.name,s.name,b?` (${b.name})`:``]),f,l.id),this.dirty=!0}startCrowd(e){this.crowdOn=!0,this.crowdNextAt=e+Be/this.speed;let t=this.ensureRoom(Le,e),n=[...this.agents.values()].filter(e=>e.crowd&&e.info.kind===`main`&&e.removeAt===void 0&&e.phase!==`leaving`);for(let e of n)e.closeAt=1/0;for(let r=n.length;r<Re;r++)this.spawnCrowdAgent(t,e);this.dirty=!0}releaseCrowd(e){this.crowdOn=!1,this.crowdNextAt=e+Ve/this.speed;let t=[...this.agents.values()].filter(e=>e.crowd&&e.info.kind===`main`&&e.removeAt===void 0&&e.phase!==`leaving`);t.slice(ze).forEach((t,n)=>{t.phase=`leaving`,this.setStatus(t,`offline`,e),delete t.info.canMessage,t.removeAt=e+$+n*700/this.speed});for(let n of t.slice(0,ze))n.closeAt=e+6e5/this.speed;this.dirty=!0}spawnCrowdAgent(t,n){let r=Le,i=++this.seq,a=`${this.prefix}sess-${this.tag}-${i}-crowd`,o=`${this.prefix||`demo:`}${this.tag}-${i}`,s=G(a,this.usedNames()),c=B(z(a)),l=r.tasks.map((e,t)=>({id:String(t+1),title:e,status:`pending`})),u={id:o,kind:`main`,roomId:t.id,name:s.name,look:s.look,role:e(`Agente principal`),title:this.pick(r.prompts,c),sessionId:a,account:this.accounts[Math.floor(this.crowdRng()*this.accounts.length)].id,status:`idle`,recent:[],tasks:l,model:this.pick(Ge,c),gitBranch:`main`,permissionMode:`default`,startedAt:n,lastEventAt:n,statusSince:n,stats:{toolCalls:0,tokensIn:0,tokensOut:0,costUSD:0,linesAdded:0,linesRemoved:0,subagents:0},seed:z(o),canMessage:!0};this.agents.set(o,{info:u,project:r,rng:c,phase:`idle`,phaseUntil:n+this.crowdRng()*2e3/this.speed,nextActionAt:n,actionsLeft:0,children:[],closeAt:1/0,taskCursor:0,shellEnds:new Map,shelledThisTurn:!1,foregroundThisTurn:!1,crowd:!0})}spawnSub(t,n){let r=++this.seq,i=`a${Math.floor(this.rng()*0xe8d4a51000).toString(16)}`,a=`${t.info.sessionId}:${i}`,o=G(a,this.usedNames()),s=B(z(a)),c=this.pick(We,s),l={id:a,kind:`sub`,parentId:t.info.id,roomId:t.info.roomId,name:o.name,look:o.look,role:this.pick(t.info.provider===`codex`?qe:Ue,s),title:c,sessionId:t.info.sessionId,account:t.info.account,status:`working`,recent:[],tasks:[],model:t.info.model,gitBranch:t.info.gitBranch,startedAt:n,lastEventAt:n,statusSince:n,stats:{toolCalls:0,tokensIn:0,tokensOut:0,subagents:0},seed:z(a),background:s()<.3};t.info.provider===`codex`&&(l.provider=`codex`);let u={info:l,project:t.project,rng:s,phase:`working`,phaseUntil:n+this.ms(18e3,55e3),nextActionAt:n+this.ms(1500,3e3),actionsLeft:99,children:[],closeAt:1/0,taskCursor:r,shellEnds:new Map,shelledThisTurn:!0,foregroundThisTurn:!0};this.agents.set(a,u),t.children.push(a),t.info.stats.subagents++,this.activity(u,n,{kind:`prompt`,icon:`📨`,text:e(`Nova tarefa: “{0}”`,[c]),detail:c}),this.dirty=!0}step(t,n){if(t.removeAt===void 0){if(t.info.kind===`sub`)return this.stepSub(t,n);if(t.inbox?.length&&t.phase===`idle`&&n>=(t.inboxAt??0)){for(let e of t.inbox.splice(0))this.activity(t,n,H(e));t.phaseUntil=Math.min(t.phaseUntil,n+1500/this.speed),t.closeAt=Math.max(t.closeAt,n+3e4/this.speed)}if(n>=t.closeAt&&t.phase===`idle`){t.phase=`leaving`,this.setStatus(t,`offline`,n),delete t.info.canMessage,t.removeAt=n+$,this.notice(n,`info`,e(`🚪 {0} encerrou a sessão`,[t.info.name]),t.info.id,t.info.roomId);return}switch(t.phase){case`idle`:if(n>=t.phaseUntil){let e=this.pick(t.project.prompts,t.rng);t.info.title=e,t.phase=`working`,t.shelledThisTurn=!1,t.foregroundThisTurn=!1,t.actionsLeft=5+Math.floor(t.rng()*9),t.nextActionAt=n+this.ms(1200,2500),this.setStatus(t,`working`,n),this.activity(t,n,O(e)),this.advanceTask(t,`in_progress`)}break;case`waiting`:t.info.permission&&n>=t.info.permission.expiresAt&&(delete t.info.permission,this.dirty=!0),n>=t.phaseUntil&&this.resumeFromWaiting(t,n);break;case`delegating`:t.children.filter(e=>this.agents.get(e)?.info.status===`working`).length===0&&(t.phase=`working`,t.children=[],this.activity(t,n,{kind:`think`,icon:`📥`,text:e(`Juntando os resultados da equipe`)}),t.nextActionAt=n+this.ms(2e3,4e3));break;case`shell`:{let e=[...t.shellEnds].filter(([,e])=>e.at<=n).map(([e])=>e);if(!e.length)break;for(let r of e)this.finishShell(t,r,n);t.phase=`working`,t.actionsLeft=1+Math.floor(t.rng()*3),t.nextActionAt=n+this.ms(2e3,3500),this.setStatus(t,`working`,n);break}case`working`:if(n<t.nextActionAt)break;t.foregroundUntil!==void 0&&this.endForeground(t);for(let[e,r]of[...t.shellEnds])r.at>n||(this.finishShell(t,e,n),t.actionsLeft=Math.max(t.actionsLeft,1),t.nextActionAt=n+this.ms(2e3,3500));if(n<t.nextActionAt)break;if(t.crowd&&this.crowdOn&&t.actionsLeft<=0&&!t.shellEnds.size&&(t.actionsLeft=4+Math.floor(t.rng()*6)),t.actionsLeft<=0){if(t.shellEnds.size){this.waitForShells(t,n,!1);break}if(!t.shelledThisTurn&&t.rng()<Ze){this.startBackgroundShells(t,n,!1);break}t.phase=`idle`,t.phaseUntil=n+this.ms(2e4,75e3),this.advanceTask(t,`completed`),this.activity(t,n,M.turnDone(this.ms(4e4,24e4)*this.speed)),this.setStatus(t,`idle`,n),this.notice(n,`success`,e(`✅ {0} concluiu em {1}`,[t.info.name,t.project.name]),t.info.id,t.info.roomId);break}t.actionsLeft--;{let r=t.rng();if(r<.1)this.askPermission(t,n);else if(r<.2&&t.children.length===0&&!t.crowd){let r=2+Math.floor(t.rng()*3);this.activity(t,n,D(`Agent`,{description:e(`{0} frentes em paralelo`,[r]),subagent_type:`general-purpose`}));for(let e=0;e<r;e++)this.spawnSub(t,n);t.phase=`delegating`}else r<.27&&!t.foregroundThisTurn&&t.actionsLeft>0?this.startForeground(t,n):(this.activity(t,n,this.randomTool(t)),t.nextActionAt=n+this.ms(1800,5500))}}}}stepSub(t,n){if(t.info.status===`working`){if(n>=t.phaseUntil){this.activity(t,n,M.turnDone(n-t.info.startedAt)),this.setStatus(t,`done`,n),t.removeAt=n+ot;let r=t.info.parentId?this.agents.get(t.info.parentId):void 0;this.notice(n,`success`,e(`📦 {0} entregou “{1}” para {2}`,[t.info.name,t.info.title,r?.info.name??e(`o agente`)]),t.info.id,t.info.roomId);return}n>=t.nextActionAt&&(this.activity(t,n,this.randomTool(t)),t.nextActionAt=n+this.ms(1500,4500))}}startBackgroundShells(e,t,n){let r=e.rng()<.25?2:1,i=Ye.slice(),a=[];n&&(e.info.title=this.pick(e.project.prompts,e.rng),this.activity(e,t,O(e.info.title)));let o=n?t-this.ms(2e4,15e4):t;for(let n=0;n<r;n++){let s=i.splice(Math.floor(e.rng()*i.length),1)[0],c=A(`Bash`,s),l=`b${Math.floor(this.rng()*2**40).toString(36)}`,u={id:l,label:c.label,startedAt:o-(r-1-n)*1200,background:!0,kind:`shell`};c.command&&(u.command=c.command),a.push(u),e.shellEnds.set(l,{at:t+this.ms(4e4,15e4),outcome:e.rng()<Qe?`failed`:`ok`}),this.activity(e,t,D(`Bash`,{...s,run_in_background:!0}))}e.info.shells=[...e.info.shells??[],...a].sort(ct),e.shelledThisTurn=!0,n||this.advanceTask(e,`completed`),this.waitForShells(e,t,!n)}waitForShells(t,n,r){let i=(t.info.shells??[]).filter(e=>e.background),a=i[0];t.phase=`shell`,this.setStatus(t,`shell`,n),this.activity(t,n,M.waitingShell(a?.label,i.length,a?.command)),r&&a&&this.notice(n,`info`,e(`⏳ {0} está esperando o shell em {1}: {2}`,[t.info.name,t.project.name,a.label]),t.info.id,t.info.roomId)}finishShell(t,n,r){let i=t.shellEnds.get(n);t.shellEnds.delete(n);let a=t.info.shells?.find(e=>e.id===n);this.setShells(t,(t.info.shells??[]).filter(e=>e.id!==n)),a&&i&&(this.activity(t,r,M.shellDone(a.label,i.outcome,r-a.startedAt,a.command)),i.outcome===`ok`?this.notice(r,`success`,e(`✅ {0}: shell terminou em {1} — {2}`,[t.info.name,t.project.name,a.label]),t.info.id,t.info.roomId):this.notice(r,`warn`,e(`❌ {0}: shell falhou em {1} — {2}`,[t.info.name,t.project.name,a.label]),t.info.id,t.info.roomId))}gitHubEvent(e){let t=[...this.agents.values()].filter(e=>e.info.kind===`main`&&(e.phase===`working`||e.phase===`idle`));if(!t.length)return;let n=t.filter(t=>this.effects.get(t.info.roomId,e)?.kind===`alarm`),r=n.length&&this.ghRng()<.6?n:t,i=r[Math.floor(this.ghRng()*r.length)],a=this.effects.get(i.info.roomId,e)?.kind===`alarm`,o=Oe(this.ghRng,{branch:i.info.gitBranch,alarm:a,pr:this.prSeq});o.kind===`pr_opened`&&this.prSeq++;let s=be(o,i.info.name,i.project.name);this.activity(i,e,s.activity),this.notice(e,s.level,s.notice,i.info.id,i.info.roomId),this.effects.apply(i.info.roomId,o,e,i.info.id)&&(this.dirty=!0)}startForeground(e,t){let n=this.pick(Xe,e.rng),r=A(`Bash`,n),i={id:`toolu_demo_${this.tag}_${++this.seq}`,label:r.label,startedAt:t,background:!1,kind:`shell`};r.command&&(i.command=r.command),this.setShells(e,[...e.info.shells??[],i]),e.foregroundThisTurn=!0,e.foregroundUntil=t+this.ms(15e3,4e4),e.nextActionAt=e.foregroundUntil,this.activity(e,t,D(`Bash`,n))}endForeground(e){e.foregroundUntil=void 0,this.setShells(e,(e.info.shells??[]).filter(e=>e.background))}setShells(e,t){t.length?e.info.shells=t.sort(ct):delete e.info.shells,this.dirty=!0}randomTool(e){let t=e.project,n=e.rng(),r=this.pick(t.files,e.rng);return n<.26?D(`Read`,{file_path:`${J}/${t.name}/${r}`}):n<.44?D(`Edit`,{file_path:`${J}/${t.name}/${r}`}):n<.5?D(`Write`,{file_path:`${J}/${t.name}/${r}`}):n<.62?D(`Grep`,{pattern:this.pick(t.greps,e.rng)}):n<.66?D(`Glob`,{pattern:`**/*.ts`}):n<.82?D(`Bash`,{command:this.pick(t.commands,e.rng)}):n<.88?D(`WebSearch`,{query:this.pick(t.queries,e.rng)}):n<.91?D(`WebFetch`,{url:`https://developer.mozilla.org/pt-BR/docs/Web`}):n<.95?M.think():D(`TodoWrite`,{todos:e.info.tasks.map(e=>({status:e.status}))})}advanceTask(e,t){let n=e.info.tasks;if(n.length){if(t===`in_progress`){let e=n.find(e=>e.status===`pending`);e&&!n.some(e=>e.status===`in_progress`)&&(e.status=`in_progress`)}else{let e=n.find(e=>e.status===`in_progress`);e&&(e.status=`completed`)}this.dirty=!0}}setStatus(e,t,n){e.info.status!==t&&(e.info.status=t,e.info.statusSince=n,this.dirty=!0)}activity(e,t,n){let r={id:`${this.prefix}${this.tag}-a${++this.seq}`,at:t,...n};e.info.activity=r,e.info.recent=[...e.info.recent,r].slice(-30),e.info.lastEventAt=t,n.tool!==`ShellDone`&&n.tool!==`ShellWait`&&n.tool!==`GitHub`&&n.tool!==`HabblaudMessage`&&n.kind!==`prompt`&&n.kind!==`done`&&n.kind!==`wait`&&n.kind!==`think`&&e.info.stats.toolCalls++,e.info.provider===`codex`&&(this.codexFetchedAt=t,this.codexReadNoQuota=this.codexNoQuota(t));let i=this.usage.get(e.info.account);i&&(t>i.fiveReset&&Object.assign(i,{five:0,fiveReset:t+5*Z}),i.five=Math.min(100,i.five+.01+e.rng()*.02),i.week=Math.min(100,i.week+.001+e.rng()*.002)),e.info.stats.tokensIn+=Math.floor(2e3+e.rng()*12e3),e.info.stats.tokensOut+=Math.floor(80+e.rng()*900),e.info.stats.costUSD!==void 0&&(e.info.stats.costUSD=+(e.info.stats.costUSD+e.rng()*.04).toFixed(4)),(n.kind===`edit`||n.kind===`write`)&&(e.info.stats.linesAdded=(e.info.stats.linesAdded??0)+Math.floor(e.rng()*40),e.info.stats.linesRemoved=(e.info.stats.linesRemoved??0)+Math.floor(e.rng()*15));let a=this.rooms.get(e.info.roomId);this.pendingFeed.push({id:r.id,agentId:e.info.id,roomId:e.info.roomId,agentName:e.info.name,roomName:a?.name??``,account:e.info.account,activity:r}),this.dirty=!0}notice(e,t,n,r,i){let a={id:`${this.prefix}${this.tag}-n${++this.seq}`,level:t,text:n,at:e};r&&(a.agentId=r),i&&(a.roomId=i),this.pendingNotices.push(a)}gc(e){for(let[t,n]of this.agents)n.removeAt!==void 0&&e>=n.removeAt&&(this.agents.delete(t),this.dirty=!0);let t=new Set([...this.agents.values()].map(e=>e.info.roomId));for(let[n,r]of this.rooms)t.has(n)||(this.rooms.delete(n),this.slotFreedAt.set(r.slot,e),this.dirty=!0)}},ct=(e,t)=>e.startedAt-t.startedAt||e.id.localeCompare(t.id);function lt(e){let t={...e,recent:e.recent.slice(),tasks:e.tasks.map(e=>({...e})),stats:{...e.stats},activity:e.activity?{...e.activity}:void 0};return e.shells&&(t.shells=e.shells.map(e=>({...e}))),e.permission&&(t.permission={...e.permission,suggestions:e.permission.suggestions?.map(e=>({...e,rules:e.rules.slice()}))},e.permission.questions&&(t.permission.questions=e.permission.questions.map(e=>({...e,options:e.options.map(e=>({...e}))})))),t}export{Te as a,z as c,N as d,P as f,we as i,B as l,M as m,st as n,Se as o,F as p,G as r,Ee as s,He as t,me as u};
@@ -0,0 +1 @@
1
+ import{s as e}from"./main-DktU0GfB.js";import{l as t,n}from"./simulator-BnBPS_Ws.js";import{c as r,g as i}from"./format-C7qb6Cn-.js";var a=32768;function o(e){let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=[];for(let t=0;t<e.length;t+=a)n.push(String.fromCharCode.apply(null,e.subarray(t,t+a)));return btoa(n.join(``))}async function s(t){try{return o(new Uint8Array(await t.arrayBuffer()))}catch{throw Error(e(`não deu para ler o arquivo`))}}function c(e=import.meta.url){try{return/\/bundle\/(main-[\w-]+)\.js$/.exec(new URL(e).pathname)?.[1]}catch{return}}function l(e){return e.behavior}var u=2,d=2e3,f=3e4;function p(e){return Math.min(f,d*2**Math.max(0,e))}function m(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 h=[{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`}],ee=class{snapshot=null;feed=[];connection=`connecting`;mock;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:l(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 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 s(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 h.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=c();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===u?(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(`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=p(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({...m(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)}},g=[`short`,`buzz`,`spiky`,`side_part`,`curly`,`afro`,`bob`,`long`,`ponytail`,`bun`,`pigtails`,`mohawk`,`bald`,`wavy`],_=[`tshirt`,`hoodie`,`shirt_tie`,`sweater`,`jacket`,`blouse`,`polo`],v=[`none`,`glasses`,`sunglasses`,`headphones`,`cap`,`beanie`,`earrings`,`bow`],y=[`none`,`stubble`,`beard`,`mustache`,`goatee`],b=[`pants`,`shorts`,`skirt`],x=[`skin`,`hair`,`hairStyle`,`eyes`,`top`,`topAccent`,`topStyle`,`bottom`,`bottomStyle`,`shoes`,`accessory`,`accessoryColor`,`facialHair`],te={hairStyle:g,topStyle:_,bottomStyle:b,accessory:v,facialHair:y},ne=/^#[0-9a-f]{6}$/i,S=/[\p{Cc}\u2028\u2029\u200e\u200f\u202a-\u202e\u2066-\u2069]/u;function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;for(let e of Object.keys(t))if(!x.includes(e))return null;let n={};for(let e of x){let r=t[e];if(r===void 0)continue;if(typeof r!=`string`)return null;let i=te[e];if(i?!i.includes(r):!ne.test(r))return null;n[e]=i?r:r.toLowerCase()}return n}function re(e){if(typeof e!=`string`)return null;let t=e.normalize(`NFC`).replace(/\s+/g,` `).trim();return!t||S.test(t)||[...t].length>24?null:t}function ie(e){return e?x.map(t=>e[t]??``).join(`,`):``}function ae(e,t){return e.custom||!t||typeof t.since!=`number`?!1:e.startedAt>=t.since}function oe(e,t){if(typeof e.startedAt!=`number`||!t||!ae({custom:e.custom,startedAt:e.startedAt},t))return e.parts;let n={};for(let r of x){let i=e.parts?.[r]??t.parts?.[r];i!==void 0&&(n[r]=i)}return Object.keys(n).length?n:void 0}var se=[`#ffe2cc`,`#f6cfb0`,`#eab894`,`#d69f78`,`#bd8560`,`#9a6444`,`#7a4a31`,`#5a3623`],ce=[[`#2b2530`,5],[`#3f2c22`,5],[`#5f3c28`,4],[`#87593a`,2.5],[`#b0703c`,1.2],[`#8e3b2b`,1],[`#d6ae68`,1.8],[`#ebdcb0`,.7],[`#8f929b`,.7],[`#d9dbe0`,.5]],le=[`#e47aa8`,`#5b8fe0`,`#8f6ad8`,`#3fb3a0`,`#e0584e`,`#7cc45a`,`#f0a24a`],ue=[`#2b2236`,`#2b2236`,`#4a2f22`,`#5a3b22`,`#2f5f9e`,`#3c7a52`],w=[`#e2604f`,`#4a86d8`,`#4bab72`,`#efb54a`,`#8d66cf`,`#36b0b0`,`#e47aa8`,`#3d4352`,`#f1efe9`,`#8a96a3`,`#2f4c7d`,`#c9713f`,`#76913f`,`#e3d3b2`,`#f29b72`,`#5bc0de`,`#b04a5a`,`#f2d16b`],T=[`#f4f4f0`,`#d3e3f4`,`#f3d6de`,`#dfe3e8`,`#e9f1dc`,`#fbf0d6`],de=[`#c0392b`,`#2f4c7d`,`#7b2d44`,`#2e7d4f`,`#d9a42e`,`#5b3a8c`,`#3d4352`],fe=[`#2f3b55`,`#3d4352`,`#6b4a35`,`#55613b`,`#262a33`,`#b08a5e`,`#7a2f3a`,`#4a6a8a`],E=[`#f4f4f0`,`#e8e3d6`,`#dfe7ef`,`#f6e7c8`,`#c9ced6`],pe=[[`#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]],me=[[`#2b2b33`,5],[`#6b4630`,3],[`#ececec`,3],[`#d04848`,1],[`#3f63a8`,1],[`#b88752`,1.5],[`#7d8592`,1]],he={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`]},D=[`#f2b33d`,`#e2604f`,`#4a86d8`,`#4bab72`,`#8d66cf`,`#36b0b0`],ge={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}},_e={m:{tshirt:20,hoodie:16,shirt_tie:10,sweater:13,jacket:13,blouse:2,polo:14},f:{tshirt:17,hoodie:14,shirt_tie:5,sweater:14,jacket:12,blouse:20,polo:8}},ve={m:{none:40,glasses:18,sunglasses:4,headphones:13,cap:7,beanie:6,earrings:2,bow:.3},f:{none:36,glasses:16,sunglasses:4,headphones:11,cap:4,beanie:5,earrings:13,bow:7}},ye={none:62,stubble:12,beard:13,mustache:7,goatee:6},be={m:{pants:88,shorts:12,skirt:0},f:{pants:62,shorts:10,skirt:28}};function xe(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(xe(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(se),u=r()<.08?i(le):o(ce),d=a(ge[c]),f=i(ue),p=a(_e[c]),m,h;switch(p){case`shirt_tie`:m=i(T),h=i(de);break;case`jacket`:m=i(fe),h=r()<.7?i(E):i(w);break;case`hoodie`:case`polo`:m=i(w),h=r()<.6?i(E):i(w);break;default:m=i(w),h=i(w)}h===m&&(h=i(E));let ee=o(pe),g=o(me),_=a(ve[c]);(_===`cap`||_===`beanie`)&&(d===`afro`||d===`bun`||d===`mohawk`||d===`pigtails`)&&(_=`glasses`),_===`bow`&&(d===`bald`||d===`buzz`)&&(_=`earrings`);let v=i(he[_]),y=r(),b=a(ye),te=c===`m`?b:`none`,ne=a(be[c]);c===`f`&&d===`bald`&&(d=`buzz`);let S={skin:l,hair:u,hairStyle:d,eyes:f,top:m,topAccent:h,topStyle:p,bottom:ee,shoes:g,accessory:_,accessoryColor:v,lanyard:n.sub?D[Math.floor(y*D.length)%D.length]:null,look:c,facialHair:te,bottomStyle:ne},C=n.parts;if(!C)return S;let re=Object.fromEntries(x.filter(e=>C[e]!==void 0).map(e=>[e,C[e]]));return{...S,...re}}function Se(e,t,n){let r=O(e,{look:n,parts:t}),i={};for(let e of x){let t=r[e];t!==void 0&&(i[e]=t)}return i}function Ce(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(`|`)}var we=e=>[...new Set(e)],k=e=>e.map(([e])=>e),A=we([...E,...w]);function Te(e){switch(e){case`shirt_tie`:return{top:T,topAccent:de};case`jacket`:return{top:fe,topAccent:A};default:return{top:w,topAccent:A}}}function Ee(e){let t=Te(e.topStyle);return{skin:se,hair:[...k(ce),...le],hairStyle:g,eyes:we(ue),top:t.top,topAccent:t.topAccent,topStyle:_,bottom:k(pe),bottomStyle:b,shoes:k(me),accessory:v,accessoryColor:he[e.accessory],facialHair:y}}var De=[`afro`,`bun`,`mohawk`,`pigtails`],Oe=[`bald`,`buzz`];function ke(t,n,r){if(n===`accessory`&&((r===`cap`||r===`beanie`)&&De.includes(t.hairStyle)||r===`bow`&&Oe.includes(t.hairStyle)))return e(`Não combina com este cabelo`);if(n===`hairStyle`){if((t.accessory===`cap`||t.accessory===`beanie`)&&De.includes(r))return e(`Não combina com o boné ou o gorro`);if(t.accessory===`bow`&&Oe.includes(r))return e(`Não combina com o laço`)}}function Ae(e){let t=Ee(e),n=(e,t)=>t.includes(e)?e:t[0];return{...e,top:n(e.top,t.top),topAccent:n(e.topAccent,t.topAccent),accessoryColor:n(e.accessoryColor,t.accessoryColor)}}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 Me={showNames:!0,bubbles:`important`,liveliness:`normal`,followSelected:!1,dayNight:!0,theme:`auto`},Ne=[`competicao`,`apostas`,`games`,`series`,`fofoca`,`vaidade`,`cafeina`,`piadas`,`esporte`,`timidez`,`economia`,`sonecas`,`calma`,`leitura`],Pe=[[`timidez`,`piadas`],[`timidez`,`fofoca`],[`apostas`,`economia`],[`esporte`,`sonecas`],[`calma`,`competicao`]],j={min:2,max:3},Fe=[`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`],Ie=[`hello`,`nice_building`,`coffee`,`congrats`,`nice_to_meet`,`bye`,`thanks`,`good_luck`,`wave`,`clap`],Le=[`offensive_name`,`impersonation`,`harassment`,`greeting_spam`,`fake_building`,`other`],Re=[`visited`,`nice_building`,`keep_going`,`coffee`,`wave`,`star`,`heart`,`rocket`],ze=[`agent_hours_10k`,`agent_hours_50k`,`agent_hours_100k`],Be=[`deploy`,`other-device`,`banned`,`suspended`,`waiting`,`update`,`unauthorized`,`no_player`,`deleted`],Ve=[`schema`,`limits`,`name_pool`,`parts`,`ids`,`rate`,`internal`,`left`,`implausible`],He={floors:64,agentsPerFloor:64,agentsTotal:256,bytes:65536},M={min:3,max:20},Ue=[`habblaud`,`admin`,`staff`,`claude`,`anthropic`,`codex`,`openai`,`moderador`,`moderator`,`suporte`,`support`,`system`,`world`],We=`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(`.`),Ge={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 Ke(e){return typeof e==`string`&&Ne.includes(e)}function N(e,t){return Pe.some(([n,r])=>n===e&&r===t||n===t&&r===e)}function qe(e){if(!Array.isArray(e)||e.length<j.min||e.length>j.max)return null;let t=[];for(let n of e){if(!Ke(n)||t.includes(n)||t.some(e=>N(e,n)))return null;t.push(n)}return t}var Je=[`auto`,`none`,`halloween`,`christmas`];function Ye(e){return typeof e==`string`&&Je.includes(e)}var Xe={cmdsPerBatch:20,batchesPerSec:5,streams:4},Ze=[`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`],Qe=[`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`],$e=[...new Set([...We,...Qe])];function et(e){return typeof e==`string`&&$e.includes(e)}var tt=3,nt=/[\p{C}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\p{Bidi_Control}]/u,rt=/(?! )[\p{Zs}\s]/u,it=/^\p{L}$/u,at=/^\p{M}$/u,ot=/^[0-9 _.-]$/,st=`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(`.`),ct=st.map(e=>[e,RegExp(`^\\p{Script_Extensions=${e}}$`,`u`)]),lt=`Other`,ut=[...st.map(e=>[e]),[`Han`,`Hiragana`,`Katakana`],[`Hangul`,`Han`],[`Han`,`Bopomofo`],[lt]];function dt(e){let t=ct.filter(([,t])=>t.test(e)).map(([e])=>e);return t.length?t:[lt]}function ft(e){let t=[...new Set(e)].map(dt);return ut.some(e=>t.every(t=>t.some(t=>e.includes(t))))}function pt(e){return e.normalize(`NFC`).trim().replace(/ {2,}/g,` `)}function mt(e){return e.normalize(`NFKC`).toLowerCase().normalize(`NFD`).replace(/[\p{Mn}\p{Me}]/gu,``).normalize(`NFC`).replace(/\s+/g,` `).trim()}function ht(e){return e.replace(/[ _.-]/g,``)}var P=e=>({ok:!1,code:`name_invalid`,problem:e});function gt(e){if(typeof e!=`string`)return P(`type`);if(e.length>M.max*8)return P(`length`);let t=pt(e);if(nt.test(t)||rt.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(it.test(e))r.push(e),i=0,a=!0;else if(at.test(e)){if(!a||++i>tt)return P(`chars`)}else if(ot.test(e))i=0,a=!1;else return P(`chars`);if(!r.length)return P(`no_letter`);if(!ft(r))return P(`scripts`);let o=mt(t);return Ue.includes(ht(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},_t={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*vt(){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*yt(){for(let e of vt())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 bt(e){return{x:e.x*R.x,y:e.y*R.y}}function xt(e){let t=G(e),n=bt(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 St(e){let t=xt(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 Ct(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 wt(e){return{x:U(e.x,_t.w),y:U(e.y,_t.h)}}function Tt(e,t){return`${e}:${t.x},${t.y}`}function Et(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 Dt(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 Ot(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 At(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&&ze.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)&&Re.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 Mt(e){return!!e&&(e.visits>0||e.likes>0||e.stamps.some(e=>e.count>0))}function Nt(e){let t=-1;return e.forEach((e,n)=>{e.t===`move`&&(t=n)}),e.filter((e,n)=>e.t!==`move`||n===t)}var Pt={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 Ft(e){return typeof e==`string`&&Fe.includes(e)}function It(e){return Pt[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 Lt(e){return!!e&&(e.scene!==void 0||e.building!==void 0)}var Rt=`habblaud:world-invite-seen`,zt=`habblaud:world-launch`,Bt=`habblaud:world-waitlist-seen`,Vt=`habblaud:world-approved-seen`,Ht={launch:null,waitlistSeen:!1,approvedSeen:!1};function Ut(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 Wt(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 Gt(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&&!Lt(e)?{show:`approved`,memory:{...i,approvedSeen:!0}}:{show:null,memory:a?i:null}}var Kt=[`welcome`,`register`,`login`,`verify`,`forgot`,`reset`],qt=[`home`,`character`,`visibility`,`devices`,`account`,`blocked`];function Jt(e){return e===`waiting`||e===`approved`?qt:e===`logged_out`?Kt:[]}function Yt(){return{server:null,screen:`welcome`,email:``,name:``,flash:null}}function X(e){if(!e.server)return e;let t=Jt(e.server);return!t.length||t.includes(e.screen)?e:{...e,screen:t[0]}}function Xt(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 Zt(e){let t=Z(e);return t.length<=254&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function Qt(e){return e.replace(/\D/g,``).slice(0,6)}function $t(e){return/^\d{6}$/.test(Qt(e))}function en(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 tn(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 nn(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 rn(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 an(e,t){return e.includes(t)?e.filter(e=>e!==t):rn(e,t)?[...e]:[...e,t]}function on(e){return qe(e)!==null}var sn=24301;function cn(e){let t={};for(let n of x)t[n]=n===`facialHair`?e.facialHair??`none`:n===`bottomStyle`?e.bottomStyle??`pants`:e[n];return t}function ln(e,t,n=sn){return O(n,{look:e,parts:t})}function un(e){let t=gt(e.name);return t.ok?on(e.traits)?!e.intro||!Ft(e.intro)?{field:`intro`}:null:{field:`traits`}:{field:`name`,problem:t.problem}}var dn={mode:`live`,closed:!1,hideCountry:!1,tokensVisible:!0,leaderboard:!1,compactions:!1,knocks:!1},fn=[`closed`,`hideCountry`,`tokensVisible`,`leaderboard`,`compactions`,`knocks`];function pn(e){return e?.notifyInactivity!==!1}var mn=`habblaud-world-dados.json`,Q=`privacidade@habblaud.com`,hn=`Recurso Habblaud World`;function gn(e){let t=e&&/^[A-Za-z0-9_-]{1,64}$/.test(e)?e:``;return`mailto:${Q}?subject=${encodeURIComponent(t?`${hn} ${t}`:hn)}`}function _n(t,n){switch(et(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 vn(e,t){return t?e?.left?`left`:e?.paused?`paused`:e?.stopped?`stopped`:e?.connected?`connected`:`reconnecting`:`no_player`}function yn(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 bn(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 xn(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 Sn(t){return t===1?e(`1 andar`):e(`{0} andares`,[r(t)])}function Cn(t){return t===1?e(`1 agente`):e(`{0} agentes`,[r(t)])}function wn(t){return t===1?e(`1 visitante agora`):e(`{0} visitantes agora`,[r(t)])}var Tn={started:!1,last:void 0,notified:!1};function En(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 Dn(t,n,r,i={}){let a=On(t,n,r,i);return a.state===`stopped`&&(t?.stopped===`banned`||t?.stopped===`suspended`)?{...a,appeal:xn(`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:xn(`contest`)}:a}function On(t,n,r,a){let o=vn(t,n),s={unverified:null,appeal:null},c=t?.floors??0,l=t?.agents??0,u=o===`no_player`||o===`left`?[]:[Sn(c),Cn(l),t?.lastUplinkAt?e(`Última remessa: {0}`,[i(t.lastUplinkAt,r)]):e(`Nenhuma remessa ainda`),...t?.visitors?[`👀 ${wn(t.visitors)}`]:[]],d=(o===`connected`||o===`reconnecting`||o===`paused`)&&t?.lastAck?.ok===!1?bn(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,...yn(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 An(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:bn(t.error)}}function jn(e){return JSON.stringify(e,null,2)}function Mn(e,t){return Y(e,t)===`active`&&e?.state===`approved`}function Nn(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 $,s as $t,Ut as A,Fe as At,Nn as B,ke as Bt,kn as C,Ye as Ct,Qt as D,ze as Dt,Gt as E,N as Et,Mn as F,Ve as Ft,Ft as G,x as Gt,Xt as H,Ae as Ht,an as I,He as It,Nt as J,C as Jt,jt as K,ae as Kt,rn as L,Me as Lt,tn as M,Le as Mt,jn as N,Re as Nt,Z as O,Be as Ot,Wt as P,Ne as Pt,L as Q,p as Qt,on as R,je as Rt,Yt as S,Je as St,En as T,Ke as Tt,Y as U,O as Ut,_n as V,Ee as Vt,It as W,Se as Wt,I as X,ie as Xt,Mt as Y,re as Yt,R as Z,ee as Zt,$t as _,gt as _t,mn as a,G as at,Sn as b,Xe as bt,fn as c,wt as ct,An as d,Ot as dt,B as et,Cn as f,St as ft,un as g,kt as gt,$ as h,Et as ht,Ht as i,Ct as it,en as j,M as jt,pn as k,Ie as kt,Tn as l,Dt as lt,Dn as m,yt as mt,Vt as n,z as nt,Rt as o,bt as ot,gn as p,xt as pt,At as q,oe as qt,dn as r,V as rt,zt as s,Tt as st,Q as t,F as tt,Bt as u,W as ut,ln as v,mt as vt,nn as w,Ge as wt,cn as x,Ze as xt,Zt as y,$e as yt,wn as z,Ce as zt};
@@ -0,0 +1 @@
1
+ import{c as e,l as t}from"./simulator-BnBPS_Ws.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-BIYmgAWC.js";import{f as y}from"./app-AwZeKIeu.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};
@@ -0,0 +1,41 @@
1
+ <!doctype html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
6
+ <meta name="color-scheme" content="dark" />
7
+ <meta name="theme-color" content="#12151d" />
8
+ <meta name="description" content="Escritório virtual em pixel art que mostra, em tempo real, o que seus agentes do Claude Code estão fazendo." />
9
+ <title>Busybits</title>
10
+ <!-- Prévia ao compartilhar o link (Open Graph / Twitter). -->
11
+ <meta property="og:type" content="website" />
12
+ <meta property="og:site_name" content="Busybits" />
13
+ <meta property="og:title" content="Busybits" />
14
+ <meta property="og:description" content="Escritório virtual em pixel art que mostra, em tempo real, o que seus agentes do Claude Code estão fazendo." />
15
+ <meta property="og:locale" content="pt_BR" />
16
+ <meta property="og:image" content="/assets/og-image.png" />
17
+ <meta property="og:image:type" content="image/png" />
18
+ <meta property="og:image:width" content="1200" />
19
+ <meta property="og:image:height" content="630" />
20
+ <meta property="og:image:alt" content="O escritório do Busybits em pixel art, com salas de projeto e agentes trabalhando." />
21
+ <meta name="twitter:card" content="summary_large_image" />
22
+ <meta name="twitter:title" content="Busybits" />
23
+ <meta name="twitter:description" content="Escritório virtual em pixel art que mostra, em tempo real, o que seus agentes do Claude Code estão fazendo." />
24
+ <meta name="twitter:image" content="/assets/og-image.png" />
25
+ <link rel="icon" href="/assets/brand/favicon-32.png" type="image/png" sizes="32x32" />
26
+ <link rel="icon" href="/assets/brand/favicon-16.png" type="image/png" sizes="16x16" />
27
+ <link rel="apple-touch-icon" href="/assets/brand/apple-touch-icon.png" />
28
+ <!-- App na Tela de Início (celular): tela cheia, ícone e nome. -->
29
+ <link rel="manifest" href="/manifest.webmanifest" />
30
+ <meta name="apple-mobile-web-app-capable" content="yes" />
31
+ <meta name="mobile-web-app-capable" content="yes" />
32
+ <meta name="apple-mobile-web-app-title" content="Busybits" />
33
+ <meta name="apple-mobile-web-app-status-bar-style" content="black" />
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-DktU0GfB.js"></script>
36
+ </head>
37
+ <body>
38
+ <canvas id="world"></canvas>
39
+ <div id="ui"></div>
40
+ </body>
41
+ </html>
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "Busybits",
3
+ "short_name": "Busybits",
4
+ "description": "O escritório dos seus agentes: quem trabalha, quem precisa de você e o que foi entregue.",
5
+ "lang": "pt-BR",
6
+ "start_url": "/?app=1",
7
+ "scope": "/",
8
+ "display": "standalone",
9
+ "orientation": "any",
10
+ "background_color": "#12151d",
11
+ "theme_color": "#12151d",
12
+ "icons": [
13
+ { "src": "/assets/brand/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
14
+ { "src": "/assets/brand/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" },
15
+ { "src": "/assets/brand/apple-touch-icon.png", "sizes": "180x180", "type": "image/png" }
16
+ ]
17
+ }