busybits 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a as e,s as t}from"./main-CIX7XLHO.js";import{c as n,l as r,r as i,t as a}from"./simulator-mIkQohaY.js";import{_ as o,c as s,i as c,l,r as u,s as d,v as f}from"./dom-DTQ3fgr0.js";import{c as p,d as m,i as h,l as g}from"./format-Cq9YWBaH.js";import{_,g as v,h as y,m as b}from"./app-9Vl0ffKz.js";var x=36e5;24*x;var S=12e4,C=2e4,w=9e4;6*x;var T=1e4,E={toolCalls:60,tokensIn:5e6,tokensOut:5e5,costUSD:50},D=1500,O=[`waiting`,`working`,`idle`,`shell`],ee=[`prompts`,`toolCalls`,`tasksDone`,`tokensIn`,`tokensOut`,`costUSD`];function k(){return{waiting:0,working:0,idle:0,shell:0}}function A(){return{prompts:0,toolCalls:0,tasksDone:0,tokensIn:0,tokensOut:0,costUSD:0}}function j(e){return e.waiting+e.working+e.idle+e.shell}function te(e){return e===`waiting`||e===`working`||e===`idle`||e===`shell`}function M(e){return{waiting:Math.round(e.waiting),working:Math.round(e.working),idle:Math.round(e.idle),shell:Math.round(e.shell)}}function N(e,t){for(let n of O)e[n]+=t[n]}function P(e,t){for(let n of ee)e[n]+=t[n]}function F(e){return Math.floor(e/x)*x}function I(e,t,n){let r=e;for(;r<t;){let e=F(r),i=Math.min(t,e+x);n(e,i-r),r=i}}function ne(e){let t=e.filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n[n.length-1];t&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}var re=/^(\d{4})-(\d{2})-(\d{2})$/,ie=/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){0,2}$/,L=new Map,ae=64;function oe(e){let t=L.get(e);return t||(L.size>=ae&&L.clear(),t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),L.set(e,t)),t}function R(e,t){let n={y:1970,mo:1,d:1,h:0,mi:0,s:0};for(let r of oe(t).formatToParts(e)){let e=Number(r.value);r.type===`year`?n.y=e:r.type===`month`?n.mo=e:r.type===`day`?n.d=e:r.type===`hour`?n.h=e%24:r.type===`minute`?n.mi=e:r.type===`second`&&(n.s=e)}return n}function se(e){if(e.length>64||!ie.test(e))return null;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).resolvedOptions().timeZone}catch{return null}}function ce(e){return se(e)!==null}function le(){try{let e=Intl.DateTimeFormat().resolvedOptions().timeZone;return e&&ce(e)?e:`UTC`}catch{return`UTC`}}var z=e=>String(e).padStart(2,`0`);function B(e,t){let n=R(e,t);return`${n.y}-${z(n.mo)}-${z(n.d)}`}function V(e,t){return R(e,t).h}function H(e){let t=re.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);if(n<1970||r<1||r>12||i<1||i>31)return null;let a=new Date(Date.UTC(n,r-1,i));return a.getUTCFullYear()!==n||a.getUTCMonth()!==r-1||a.getUTCDate()!==i?null:{y:n,m:r,d:i}}function U(e,t){let n=H(e);if(!n)return e;let r=new Date(Date.UTC(n.y,n.m-1,n.d+t));return`${r.getUTCFullYear()}-${z(r.getUTCMonth()+1)}-${z(r.getUTCDate())}`}function W(e,t){let n=R(e,t);return Date.UTC(n.y,n.mo-1,n.d,n.h,n.mi,n.s)-Math.floor(e/1e3)*1e3}function G(e,n){let r=H(e);if(!r)throw RangeError(t(`dia inválido: {0}`,[e]));let i=Date.UTC(r.y,r.m-1,r.d),a=i-W(i,n);a=i-W(a,n);let o=9e5;for(let t=0;t<16&&B(a,n)<e;t++)a+=o;for(let t=0;t<16&&B(a-o,n)===e;t++)a-=o;return a}function ue(e,t){return{start:G(e,t),end:G(U(e,1),t)}}function K(e,t,n){let r=e+x/2;return r>=t&&r<n}function de(e){return{t:e,ms:k(),waitWallMs:0,counts:A(),rooms:new Map,accounts:new Map,agents:new Map}}function q(e,t){let n=e.get(t);return n||e.set(t,n={ms:k(),counts:A()}),n}function fe(e){return j(e.ms)>0||e.counts.prompts>0||e.counts.toolCalls>0||e.counts.tokensIn>0||e.counts.tokensOut>0}var pe=class{key;hours=new Map;rooms=new Map;accounts=new Map;waits=[];dirty=!1;updatedAt=0;constructor(e){this.key=e}hour(e){let t=this.hours.get(e);return t||this.hours.set(e,t=de(e)),t}hoursWithData(){return[...this.hours.values()].filter(fe).map(e=>e.t)}toFile(){let e=e=>[...e].map(([e,t])=>[e,{ms:{...t.ms},counts:{...t.counts}}]);return{version:1,day:this.key,updatedAt:this.updatedAt,hours:[...this.hours.values()].sort((e,t)=>e.t-t.t).map(t=>({t:t.t,ms:{...t.ms},waitWallMs:t.waitWallMs,counts:{...t.counts},rooms:e(t.rooms),accounts:e(t.accounts),agents:[...t.agents].map(([e,[t,n]])=>[e,t,n])})),rooms:[...this.rooms],accounts:[...this.accounts].map(([e,t])=>[e,{...t}]),waits:this.waits.map(e=>({...e}))}}};function J(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}var me=class{fileDayOf;loader;days=new Map;idx=new Map;constructor(e,t){this.fileDayOf=e,this.loader=t}day(e){let t=this.days.get(e);if(!t){t=this.loader?.(e)??new pe(e),this.days.set(e,t);for(let e of t.hours.values())this.idx.set(e.t,{day:t,b:e})}return t}peek(e){return this.days.get(e)}list(){return[...this.days.values()]}evictBefore(e){for(let[t,n]of this.days)if(!(t>=e||n.dirty)){this.days.delete(t);for(let e of n.hours.keys())this.idx.delete(e)}}slot(e){let t=F(e),n=this.idx.get(t);if(!n){let e=this.day(this.fileDayOf(t));n={day:e,b:e.hour(t)},this.idx.set(t,n)}return n}touch(e,t){e.dirty=!0,t>e.updatedAt&&(e.updatedAt=t)}note(e,t){t.roomName&&e.rooms.get(t.room)!==t.roomName&&e.rooms.set(t.room,t.roomName);let n=t.accountMeta,r=e.accounts.get(t.account);n&&(!r||r.name!==n.name||r.short!==n.short||r.color!==n.color)&&e.accounts.set(t.account,{...n})}addMsAt(e,t,n,r,i=n){if(!(r>0))return;let{day:a,b:o}=this.slot(n);o.ms[t]+=r,q(o.rooms,e.room).ms[t]+=r,q(o.accounts,e.account).ms[t]+=r,o.agents.has(e.key)||o.agents.set(e.key,[e.room,e.account]),this.note(a,e),this.touch(a,i)}markPresent(e,t){let{day:n,b:r}=this.slot(t);r.agents.has(e.key)||(r.agents.set(e.key,[e.room,e.account]),this.note(n,e),this.touch(n,t))}addTime(e,t,n,r){I(n,r,(n,i)=>this.addMsAt(e,t,n,i,r))}addCount(e,t,n,r){if(!(n>0))return;let{day:i,b:a}=this.slot(r);a.counts[t]+=n,q(a.rooms,e.room).counts[t]+=n,q(a.accounts,e.account).counts[t]+=n,this.note(i,e),this.touch(i,r)}addWaitWallAt(e,t,n=e){if(!(t>0))return;let{day:r,b:i}=this.slot(e);i.waitWallMs+=t,this.touch(r,n)}addWaitWall(e,t){I(e,t,(e,n)=>this.addWaitWallAt(e,n,t))}addWait(e){let{day:t}=this.slot(e.start);if(t.waits.push(e),t.waits.length>1e3){let n=e=>t.waits[e].end-t.waits[e].start,r=-1;if(t.waits.forEach((t,i)=>{t.open||t===e||(r<0||n(i)<n(r))&&(r=i)}),r<0)for(let e=0;e<t.waits.length;e++)(r<0||n(e)<n(r))&&(r=e);t.waits.splice(r,1)}this.touch(t,e.end)}touchWait(e){this.touch(this.slot(e.start).day,e.end)}removeWait(e){let{day:t}=this.slot(e.start),n=t.waits.indexOf(e);n>=0&&(t.waits.splice(n,1),this.touch(t,e.end))}findOpenWait(e,t){for(let n of this.days.values())for(let r=n.waits.length-1;r>=0;r--){let i=n.waits[r];if(i.open&&i.agentId===e&&i.end>=t)return i}}};function he(){return{ms:k(),counts:A(),sessions:0,subagents:0,waits:0,longestWaitMs:0,agents:new Set}}function Y(e){let t=0,n=0;for(let r of e.agents)r.startsWith(`m:`)?t++:r.startsWith(`s:`)&&n++;let r={...e.counts,costUSD:Math.round(e.counts.costUSD*1e4)/1e4};return{ms:M(e.ms),counts:r,sessions:t,subagents:n,waits:e.waits,longestWaitMs:Math.round(e.longestWaitMs)}}function X(e,t){let n=e.get(t);return n||e.set(t,n=he()),n}function ge(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function _e(e,t,n,r,i={}){let{start:a,end:o}=ue(t,n),s=[...e].sort((e,t)=>e.key.localeCompare(t.key)),c=new Map,l=new Map,u=new Map,d=0;for(let e of s){for(let[t,n]of e.rooms)c.set(t,n);for(let[t,n]of e.accounts)l.set(t,n);for(let[t,n]of e.hours)K(t,a,o)&&u.set(t,n)}let f=he(),p=0,m=new Map,h=new Map;for(let e of u.values()){N(f.ms,e.ms),P(f.counts,e.counts),p+=e.waitWallMs;for(let[t,n]of e.rooms){let e=X(m,t);N(e.ms,n.ms),P(e.counts,n.counts)}for(let[t,n]of e.accounts){let e=X(h,t);N(e.ms,n.ms),P(e.counts,n.counts)}for(let[t,[n,r]]of e.agents)f.agents.add(t),X(m,n).agents.add(t),X(h,r).agents.add(t);for(let t of s)t.hours.get(e.t)===e&&t.updatedAt>d&&(d=t.updatedAt)}let g=new Set,_=[];for(let e of s)for(let t of e.waits){if(t.end<=a||t.start>=o||t.end-t.start<3e3)continue;let e=`${t.agentId}|${t.start}`;g.has(e)||(g.add(e),_.push(t))}for(let e of _){let t=e.end-e.start;for(let n of[f,X(m,e.roomId),X(h,e.account)])n.waits++,t>n.longestWaitMs&&(n.longestWaitMs=t)}let v=[..._].sort((e,t)=>t.end-t.start-(e.end-e.start)||e.start-t.start).slice(0,i.top??10),y=[];for(let e=F(a);e<o;e+=x)K(e,a,o)&&y.push({t:e,hour:V(Math.max(e,a),n),ms:M(u.get(e)?.ms??k())});let b=e=>c.get(e)??ge(e),S=[...m].map(([e,t])=>({id:e,name:b(e),...Y(t)})).sort((e,t)=>t.ms.waiting-e.ms.waiting||j(t.ms)-j(e.ms)||e.name.localeCompare(t.name)),C=[...h].map(([e,t])=>{let n=l.get(e);return{id:e,name:n?.name??e,short:n?.short??`?`,color:n?.color??`#8b98b3`,...Y(t)}}).sort((e,t)=>t.ms.working-e.ms.working||j(t.ms)-j(e.ms)||e.name.localeCompare(t.name)),w={day:t,tz:n,start:a,end:o,totals:{...Y(f),waitWallMs:Math.round(p)},rooms:S,accounts:C,hours:y,waits:v.map(e=>{let t={agentId:e.agentId,agentName:e.agentName,roomId:e.roomId,roomName:b(e.roomId),account:e.account,start:e.start,end:e.end,ms:e.end-e.start};return e.reason&&(t.reason=e.reason),e.open&&r-e.end<1e4&&(t.ongoing=!0),t})};return d&&(w.updatedAt=d),w}function ve(e,t){let n=new Set;for(let r of e)n.add(B(r+x/2,t));return n}function ye(e){let t=e.stats;return{toolCalls:J(t.toolCalls),tokensIn:J(t.tokensIn),tokensOut:J(t.tokensOut),costUSD:J(t.costUSD)}}function be(e,t){return{toolCalls:Math.max(e.toolCalls,t.toolCalls),tokensIn:Math.max(e.tokensIn,t.tokensIn),tokensOut:Math.max(e.tokensOut,t.tokensOut),costUSD:Math.max(e.costUSD,t.costUSD)}}var xe={toolCalls:0,tokensIn:0,tokensOut:0,costUSD:0};function Se(e){return e.toolCalls===0&&e.tokensIn===0&&e.tokensOut===0}function Ce(e){return e.tasks.reduce((e,t)=>e+ +(t.status===`completed`),0)}var we=class{book;tracks=new Map;lastSample;startedAt;constructor(e,t){this.book=e,this.startedAt=t.startedAt}get size(){return this.tracks.size}observe(e,t){let n=this.lastSample===void 0?1/0:t-this.lastSample;this.lastSample=t;let r=new Map(e.rooms.map(e=>[e.id,e.name])),i=new Map(e.accounts.map(e=>[e.id,{name:e.name,short:e.short,color:e.color}])),a=[],o=new Set;for(let s of e.agents){o.add(s.id);let e={key:s.kind===`main`?`m:${s.sessionId}`:`s:${s.id}`,room:s.roomId,roomName:r.get(s.roomId)??ge(s.roomId),account:s.account},c=i.get(s.account);c&&(e.accountMeta=c);let l=this.tracks.get(s.id),u=n;l?this.integrate(l,s,e,t,a):(l=this.begin(s,t),this.tracks.set(s.id,l),u=0,(te(s.status)||l.fresh)&&this.book.markPresent(e,t)),l.seenAt=t,l.status=s.status,this.countPrompts(l,s,e,t),this.countDeltas(l,s,e,t,u)}for(let[e,n]of this.tracks)o.has(e)||(t-n.seenAt>12e4&&this.closeWait(n),t-n.seenAt>216e5&&this.tracks.delete(e));for(let[e,t]of ne(a))this.book.addWaitWall(e,t)}begin(e,t){let n=ye(e),r=e.startedAt>=this.startedAt&&(e.kind===`sub`||Se(n));return{sessionId:e.sessionId,status:e.status,lastAt:t,seenAt:t,hw:r?{...xe}:n,costKnown:r||e.stats.costUSD!==void 0,fresh:r,tasksDone:r?0:Ce(e),settleUntil:r?0:t+Math.max(C,this.startedAt+w-t),prompts:[]}}integrate(e,t,n,r,i){let a=e.lastAt;if(e.lastAt=r,r<=a)return;if(r-a>12e4){this.closeWait(e);return}let o=t.statusSince>a&&t.statusSince<r?t.statusSince:void 0;o!==void 0&&e.status!==t.status?(this.segment(e,t,n,e.status,a,o,i),this.segment(e,t,n,t.status,o,r,i)):this.segment(e,t,n,t.status,a,r,i)}segment(e,t,n,r,i,a,o){if(a<=i)return;if(!te(r)){this.closeWait(e);return}if(this.book.addTime(n,r,i,a),r!==`waiting`){this.closeWait(e);return}if(o.push([i,a]),e.wait&&i-e.wait.end<=D){e.wait.end=a,this.book.touchWait(e.wait);return}this.closeWait(e);let s=this.book.findOpenWait(t.id,i-S);if(s){s.end=a,this.book.touchWait(s),e.wait=s;return}let c={agentId:t.id,agentName:t.name,roomId:t.roomId,account:t.account,start:i,end:a,open:!0};t.waitingFor&&(c.reason=t.waitingFor),this.book.addWait(c),e.wait=c}closeWait(e){let t=e.wait;t&&(e.wait=void 0,delete t.open,t.end-t.start<3e3?this.book.removeWait(t):this.book.touchWait(t))}countPrompts(e,t,n,r){for(let i of t.recent)i.kind!==`prompt`||i.at<this.startedAt||e.prompts.includes(i.id)||(e.prompts.push(i.id),e.prompts.length>64&&e.prompts.shift(),this.book.addCount(n,`prompts`,1,Math.min(i.at,r)))}countDeltas(e,t,n,r,i){let a=ye(t),o=Ce(t);if(t.sessionId!==e.sessionId){e.sessionId=t.sessionId,e.fresh=Se(a),e.hw=e.fresh?{...xe}:a,e.costKnown=e.fresh||t.stats.costUSD!==void 0,e.tasksDone=e.fresh?0:o,e.settleUntil=e.fresh?0:r+C,e.prompts=[];return}if(t.stats.costUSD!==void 0&&!e.costKnown&&(e.costKnown=!0,e.fresh||(e.hw.costUSD=Math.max(e.hw.costUSD,a.costUSD))),r<e.settleUntil){e.hw=be(e.hw,a),e.tasksDone=o;return}let s={toolCalls:Math.max(0,a.toolCalls-e.hw.toolCalls),tokensIn:Math.max(0,a.tokensIn-e.hw.tokensIn),tokensOut:Math.max(0,a.tokensOut-e.hw.tokensOut),costUSD:Math.max(0,a.costUSD-e.hw.costUSD)};e.hw=be(e.hw,a);let c=s.toolCalls>E.toolCalls||s.tokensIn>E.tokensIn||s.tokensOut>E.tokensOut||s.costUSD>E.costUSD;if(i<=T&&c){e.tasksDone=o;return}this.book.addCount(n,`toolCalls`,s.toolCalls,r),this.book.addCount(n,`tokensIn`,s.tokensIn,r),this.book.addCount(n,`tokensOut`,s.tokensOut,r),this.book.addCount(n,`costUSD`,s.costUSD,r),o>e.tasksDone&&this.book.addCount(n,`tasksDone`,o-e.tasksDone,r),e.tasksDone=o}},Te=[.03,.01,0,0,0,0,.02,.1,.4,.75,.95,.85,.4,.55,.9,1,.95,.8,.55,.35,.3,.25,.15,.06],Ee=[t(`aprovar uma permissão`),t(`responder uma pergunta`),t(`escolher uma opção`),t(`aprovar o plano`)];function De(e,o,s,c,l=n(`meu-dia:${F(s)}`)){let u=r(l),d=(e,t)=>e+u()*(t-e),f=o.accounts.map(e=>({id:e.id,codex:`provider`in e&&e.provider===`codex`,meta:{name:e.name,short:e.short,color:e.color}})),p=f.filter(e=>!e.codex),m=f.find(e=>e.codex),h=e=>m&&p.length?e<.5?p[0]:e<.8?p[p.length-1]:m:f[e<.6?0:f.length-1],g=new Map(o.rooms.map(e=>[e.id,e.name])),_=new Set(o.agents.map(e=>e.name)),v=new Map;for(let e of o.agents){let t=v.get(e.roomId)??new Map;t.set(e.account,(t.get(e.account)??0)+1),v.set(e.roomId,t)}let y=[...v.keys()][0];if(!y||!f.length)return;let b=y.slice(0,y.lastIndexOf(`/`)),S=[];for(let e of a){let t=`${b}/${e}`;v.has(t)||(v.set(t,new Map([[h(u()).id,1]])),S.push(t))}let C=S.some(e=>v.get(e).has(m?.id??``));m&&S.length&&!C&&v.set(S[S.length-1],new Map([[m.id,1]]));let w=[...v].map(([e,t])=>{let n=[...t].sort((e,t)=>t[1]-e[1])[0]?.[0]??f[0].id,r=[0,1,2].map(t=>{let n=i(`${e}:${t}:${l}`,_);return _.add(n.name),n.name}),a={id:e,name:g.get(e)??e.split(`/`).pop()??e,account:n,codex:!!f.find(e=>e.id===n)?.codex,weight:d(.35,1.1),waitiness:d(.05,.3),people:r},o=f.find(e=>e.id===n)?.meta;return o&&(a.accountMeta=o),a}),T=F(s),E=F(G(U(B(s,c),-1),c));for(let n=E;n<=T;n+=x){let r=Math.min(x,s-n);if(r<=0)continue;let i=r/x,a=Te[V(n,c)]??0,o=0;w.forEach((c,l)=>{let f=a*c.weight*d(.7,1.3);if(f<.04)return;let p=f>.6?2:1,m=e=>{let t={key:e,room:c.id,roomName:c.name,account:c.account};return c.accountMeta&&(t.accountMeta=c.accountMeta),t},h=Array.from({length:p},(e,t)=>m(`m:demo-dia-${l}-${t}`)),g=Math.min(.92,f*d(.55,.85))*x*i,_=g*c.waitiness*d(.5,1.4),v=g*d(0,.12),y=Math.max(0,p*x*i*.9-g-_-v)*d(.3,.7),b=[[`working`,g],[`waiting`,_],[`shell`,v],[`idle`,y]];for(let[t,i]of b)for(let a of h)e.addMsAt(a,t,n,i/p,Math.min(s,n+r));let S=Math.round(f*d(0,2.2));for(let t=0;t<S;t++)e.addMsAt(m(`s:demo-dia-${l}-${n}-${t}`),`working`,n,g*d(.15,.45),Math.min(s,n+r));let C=g/6e4,w=n+r/2,T=h[0];e.addCount(T,`prompts`,Math.round(C/7*d(.6,1.4)),w),e.addCount(T,`toolCalls`,Math.round(C*d(1.5,3)),w),e.addCount(T,`tasksDone`,Math.round(C/12*d(.4,1.2)),w);let E=Math.round(C*d(9e4,16e4)),D=Math.round(C*d(1e3,2200));if(e.addCount(T,`tokensIn`,E,w),e.addCount(T,`tokensOut`,D,w),c.codex||e.addCount(T,`costUSD`,Math.round((E*3e-7+D*15e-6)*1e4)/1e4,w),_>=3e4){let i=1+Math.floor(u()*Math.min(3,_/6e4)),a=_;for(let o=0;o<i&&a>=5e3;o++){let s=o===i-1?a:a*d(.3,.7);a-=s;let f=n+u()*Math.max(0,r-s),p=c.people[Math.floor(u()*c.people.length)],m=Ee[Math.floor(u()*Ee.length)];e.addWait({agentId:`demo-dia:${l}:${p}`,agentName:p,roomId:c.id,account:c.account,start:Math.round(f),end:Math.round(f+s),reason:c.codex?t(`aprovar um comando`):m})}o+=_*d(.75,.95)}}),e.addWaitWallAt(n,Math.min(o,r),Math.min(s,n+r))}}var Z={waiting:t(`Esperando você`),working:t(`Trabalhando`),idle:t(`Ocioso`),shell:t(`Esperando o shell`)};function Q(e){let t=Number.isFinite(e)?Math.max(0,e):0;if(t<6e4)return`${Math.floor(t/1e3)} s`;if(t<36e5)return`${Math.floor(t/6e4)} min`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return r?`${n} h ${r} min`:`${n} h`}var Oe=new Set(O);function $(e,t){return O.reduce((n,r)=>n+(t.has(r)?e[r]:0),0)}function ke(e,t,n){return n>0?O.filter(n=>t.has(n)&&e[n]>0).map(t=>({status:t,ms:e[t],pct:e[t]/n*100})):[]}function Ae(e,n=Oe){let r=O.filter(t=>n.has(t)&&e[t]>0).map(t=>`${Z[t].toLowerCase()} ${Q(e[t])}`);return r.length?r.join(`, `):t(`sem tempo registrado`)}function je(e,n,r=!1,i){let a=e.totals,s=a.counts,c=e.waits[0],l=(e,t,n)=>`${p(e)} ${e===1?t:n}`;return{waiting:Q(a.ms.waiting),waitingMs:a.ms.waiting,longest:c?t(`{0} · {1} em {2}, às {3}{4}`,[Q(c.ms),o(c.agentId,c.agentName,i),c.roomName,n(c.start),c.ongoing?t(` (ainda esperando)`):``]):``,wall:a.waitWallMs>0?t(`Alguém esperou por você durante {0} do dia`,[Q(a.waitWallMs)]):``,waits:a.waits?l(a.waits,t(`espera`),t(`esperas`)):a.ms.waiting>0?t(`só esperas de poucos segundos`):t(`nenhuma espera`),working:Q(a.ms.working),sessions:p(a.sessions),subagents:l(a.subagents,t(`subagente`),t(`subagentes`)),tokens:g(s.tokensIn+s.tokensOut),tokensDetail:t(`{0} entrada · {1} saída`,[g(s.tokensIn),g(s.tokensOut)]),cost:s.costUSD>0?m(s.costUSD):`—`,costHint:s.costUSD>0?t(r?`Só do Claude Code: o Codex não grava custo, só tokens`:`Custo calculado pelo próprio Claude Code`):s.tokensIn+s.tokensOut>0?t(r?`O Codex não grava custo, só tokens`:`Os transcripts não trouxeram o custo`):t(`Nenhum gasto registrado`),prompts:p(s.prompts),activity:`${l(s.toolCalls,t(`ferramenta`),t(`ferramentas`))} · ${l(s.tasksDone,t(`tarefa concluída`),t(`tarefas concluídas`))}`}}function Me(e,n){let r=Math.max(0,...e.map(e=>$(e.ms,n)));return e.filter(e=>j(e.ms)>0).map(e=>{let i=$(e.ms,n);return{id:e.id,name:e.name,ms:e.ms,total:i,segments:ke(e.ms,n,r),waiting:t(`{0} esperando você`,[Q(e.ms.waiting)]),totalText:t(`{0} no total`,[Q(i)]),label:`${e.name}: ${Ae(e.ms,n)}`}})}var Ne=[5,10,15,20,30,45,60,90,120,180,240,300,360,480,600,720,960,1200,1440];function Pe(e){let t=Math.max(1,e/6e4),n=Ne.find(e=>e>=t)??Math.ceil(t/1440)*1440,r=n>=120?[60,30]:[5],i=1;for(let e of r){let t=[4,3,2].find(t=>Number.isInteger(n/t)&&n/t%e===0);if(t){i=t;break}}let a=n/i;return{max:n*6e4,ticks:Array.from({length:i},(e,t)=>(t+1)*a*6e4)}}function Fe(e){let t=Math.round(e/6e4);if(t<60)return`${t} min`;let n=Math.floor(t/60),r=t%60;return r?`${n} h ${String(r).padStart(2,`0`)}`:`${n} h`}function Ie(e,t,n,r=3){let i=Pe(Math.max(0,...e.map(e=>$(e.ms,t))));return{columns:e.map((a,o)=>{let s=$(a.ms,t),c=(a.hour+1)%24,l=`${a.hour}h–${c}h`;return{t:a.t,hour:a.hour,ms:a.ms,total:s,segments:ke(a.ms,t,i.max),range:l,label:`${l}: ${Ae(a.ms,t)}`,now:n>=a.t&&n<(e[o+1]?.t??a.t+36e5),future:a.t>n,tick:a.hour%r===0}}),axis:i}}function Le(e,n=()=>!1){let r=e.reduce((e,t)=>e+t.ms.working,0);return e.filter(e=>j(e.ms)>0||e.counts.tokensIn>0).map(e=>{let i=r>0?Math.round(e.ms.working/r*100):0,a=n(e.id);return{id:e.id,name:e.name,short:e.short,color:e.color,share:i,shareText:t(`{0}% do trabalho do dia`,[i]),working:Q(e.ms.working),waiting:Q(e.ms.waiting),sessions:`${p(e.sessions)} ${e.sessions===1?t(`sessão`):t(`sessões`)}${e.subagents?` · ${p(e.subagents)} sub`:``}`,tokens:g(e.counts.tokensIn+e.counts.tokensOut),cost:a?null:e.counts.costUSD>0?m(e.counts.costUSD):`—`,codex:a}})}function Re(e,n,r){let i=Math.max(1,...e.map(e=>e.ms));return e.map((e,a)=>{let s=e.ongoing?t(`desde {0}`,[n(e.start)]):`${n(e.start)}–${n(e.end)}`,c=o(e.agentId,e.agentName,r),l={key:`${e.agentId}|${e.start}`,rank:a+1,duration:Q(e.ms),pct:Math.max(2,e.ms/i*100),agentName:c,roomName:e.roomName,account:e.account,when:s,ongoing:!!e.ongoing,label:`${a+1}º: ${Q(e.ms)}, ${c} em ${e.roomName}, ${s}${e.reason?t(`, para {0}`,[e.reason]):``}${e.ongoing?t(`, ainda esperando`):``}`};return e.reason&&(l.reason=e.reason),l})}function ze(e,t,n){let r=O.filter(e=>n.has(e));return{head:[...r.map(e=>Z[e]),`Total`],rows:e.map(e=>[t(e),...r.map(t=>e.ms[t]>0?Q(e.ms[t]):`—`),Q($(e.ms,n))])}}var Be=new Intl.DateTimeFormat(e(),{weekday:`short`,day:`2-digit`,month:`2-digit`,timeZone:`UTC`});function Ve(e,n){if(e===n)return t(`Hoje`);let[r,i,a]=e.split(`-`).map(Number),o=Date.UTC(r,i-1,a),[s,c,l]=n.split(`-`).map(Number);return Date.UTC(s,c-1,l)-o===864e5?t(`Ontem`):Be.format(o)}function He(e,t,n){let r=new URLSearchParams({day:e,tz:t});return n&&r.set(`source`,n),`/api/stats?${r}`}function Ue(e){return`/api/stats/days?${new URLSearchParams({tz:e})}`}function We(e,t,n){return e&&t===n}function Ge(e){return j(e.totals.ms)===0&&e.totals.counts.tokensIn===0&&e.waits.length===0}var Ke=3e4,qe=t(`Tempo de agentes é a soma de todos eles: dois agentes trabalhando por 1 hora contam 2 horas. `)+t(`“Esperando você” é o tempo de mão levantada no escritório (permissão, pergunta ou escolha). `)+t(`O Habblaud só conta o que acontece enquanto ele está rodando.`);async function Je(e){let n=await fetch(e,{cache:`no-store`}),r=await n.json().catch(()=>null);if(!n.ok||!r)throw Error(r?.error??t(`erro {0}`,[n.status]));return r}var Ye={days:e=>Je(Ue(e)),day:(e,t,n)=>Je(He(e,t,n))},Xe=class{tz=le();book=new me(e=>B(e,this.tz));tracker=new we(this.book,{startedAt:Date.now()});seeded=!1;last=0;constructor(e){e.on(`snapshot`,e=>{let t=Date.now();t-this.last<1e3||(this.last=t,this.seeded||=(De(this.book,e,t,this.tz),!0),this.tracker.observe(e,t))})}async days(e){let t=B(Date.now(),e),n=new Set([t]);for(let t of this.book.list())for(let r of ve(t.hoursWithData(),e))n.add(r);return{tz:e,today:t,days:[...n].sort().reverse(),demoAvailable:!1}}async day(e,t){let n=Date.now();return{source:`demo`,demoAvailable:!1,today:B(n,t),serverTime:n,stats:_e(this.book.list(),e,t,n)}}},Ze=class{ctx;button;el;source;tz=le();days=null;data=null;day=null;sourcePref;visible=new Set(Oe);tables=new Set;loading=!1;error=null;seq=0;timer=null;demoSeen;opener=null;select;seg;badge;status;statusText;retry;content;tip;constructor(e,n){this.ctx=e,this.button=n,this.source=e.store.mock?new Xe(e.store):Ye,this.select=new v({label:t(`Dia`),className:`ui-day__select`,onChange:e=>this.pickDay(e)}),this.seg=new y({label:t(`Dados exibidos`),options:[{value:`demo`,label:t(`Demonstração`),className:`ui-seg__opt`},{value:`real`,label:t(`Dados reais`),className:`ui-seg__opt`}],indicator:!1,className:`ui-seg ui-day__source`,onChange:e=>this.pickSource(e)}),this.seg.el.hidden=!0,this.badge=u(`span`,{class:`ui-day__badge`,text:t(`demonstração`),title:t(`Números fictícios do modo demonstração`),hidden:!0});let r=c(_.close,t(`Fechar (Esc)`),()=>this.close(),`ui-icon-btn--sm`);this.statusText=u(`span`,{}),this.retry=u(`button`,{class:`ui-link-btn`,type:`button`,text:t(`Tentar de novo`),hidden:!0,on:{click:()=>void this.load(!0)}}),this.status=u(`p`,{class:`ui-day__status`},this.statusText,this.retry),this.content=u(`div`,{class:`ui-day__content`}),this.tip=u(`div`,{class:`ui-day__tip`,role:`tooltip`,hidden:!0,attrs:{"aria-hidden":`true`}}),this.el=u(`dialog`,{class:`ui-dialog ui-day`,attrs:{"aria-labelledby":`ui-day-title`}},u(`div`,{class:`ui-dialog__head ui-day__head`},u(`div`,{class:`ui-day__title`},u(`h2`,{text:t(`Meu dia`),attrs:{id:`ui-day-title`}}),this.badge),u(`div`,{class:`ui-day__controls`},this.select.el,this.seg.el),r),u(`div`,{class:`ui-day__body`},this.status,this.content,u(`p`,{class:`ui-day__note`,text:qe})),this.tip),this.el.addEventListener(`click`,e=>{e.target===this.el&&this.close()}),this.el.addEventListener(`keydown`,e=>e.stopPropagation()),this.el.addEventListener(`close`,()=>this.onClosed()),this.el.addEventListener(`scroll`,()=>this.hideTip(),!0)}get isOpen(){return this.el.open}open(){this.el.open||(this.opener=document.activeElement instanceof HTMLElement?document.activeElement:null,this.day=null,this.el.showModal(),this.button.setAttribute(`aria-expanded`,`true`),this.load(!0))}close(){this.el.open&&this.el.close()}toggle(){this.el.open?this.close():this.open()}render(){let e=this.ctx.store.snapshot?.meta.demo;if(e===this.demoSeen)return;let t=this.demoSeen!==void 0;this.demoSeen=e,t&&this.el.open&&!this.ctx.store.mock&&this.load(!0)}onClosed(){this.seq++,this.stopTimer(),this.hideTip(),this.button.setAttribute(`aria-expanded`,`false`),this.opener?.isConnected&&this.opener.focus({preventScroll:!0}),this.opener=null}pickDay(e){this.day=e,this.sourcePref??=this.data?.source,this.load(!1)}pickSource(e){if(this.data?.source===e)return;this.sourcePref=e;let t=e===`demo`?this.days?.demoDays:this.days?.days;this.day&&t&&!t.includes(this.day)&&(this.day=null),this.load(!1)}async load(e){let n=++this.seq;this.stopTimer(),this.loading=!0,this.renderStatus();try{if(e||!this.days){let e=await this.source.days(this.tz);if(n!==this.seq)return;this.days=e,this.sourcePref===`demo`&&!e.demoAvailable&&(this.sourcePref=void 0)}let t=this.day??this.days.today,r=await this.source.day(t,this.tz,this.sourcePref);if(n!==this.seq)return;this.data=r,this.day=r.stats.day,this.error=null,this.renderAll()}catch(e){if(n!==this.seq)return;this.error=e instanceof Error?e.message:String(e),this.ctx.announce(t(`Não foi possível carregar as estatísticas do dia.`)),this.data&&(this.day=this.data.stats.day,this.renderControls(this.data))}finally{n===this.seq&&(this.loading=!1,this.renderStatus(),We(this.el.open,this.day??``,this.data?.today??``)&&(this.timer=setTimeout(()=>void this.load(!0),Ke)))}}stopTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}renderStatus(){if(this.el.classList.toggle(`is-loading`,this.loading&&!!this.data),d(this.retry,!this.error),this.error)l(this.statusText,t(`Não foi possível carregar as estatísticas ({0}).`,[this.error]));else if(this.loading&&!this.data)l(this.statusText,t(`Carregando…`));else if(this.data){let e=this.data.stats.day===this.data.today?t(`Atualizado às {0} · atualiza a cada 30 s`,[h(this.data.serverTime)]):``;l(this.statusText,[e,f(this.data,this.ctx.store.snapshot?.machines)].filter(Boolean).join(` · `))}}renderAll(){let e=this.data;if(!e)return;this.renderControls(e);let t=document.activeElement?.closest(`[data-focus-key]`)?.dataset.focusKey;this.hideTip(),this.content.replaceChildren(...this.sections(e)),t&&this.content.querySelector(`[data-focus-key="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})}renderControls(e){let t=e.source===`demo`;d(this.badge,!t),d(this.seg.el,!e.demoAvailable),this.seg.value=t?`demo`:`real`;let n=(t?this.days?.demoDays:this.days?.days)??[e.today],r=n.includes(e.stats.day)?n:[e.stats.day,...n];this.select.setOptions(r.map(t=>({value:t,label:Ve(t,e.today)})),e.stats.day),this.select.value=e.stats.day,this.select.disabled=r.length<2}sections(e){let n=e.stats,r=e=>h(e,!1),i=je(n,r,n.accounts.some(e=>this.isCodexAccount(e.id)&&e.counts.tokensIn+e.counts.tokensOut>0),this.ctx.store.snapshot?.machines),a=[this.kpis(i)];if(Ge(n)){let r=n.day===e.today;return a.push(u(`p`,{class:`ui-day__empty`,text:t(r?`Ainda não há tempo registrado hoje. Os números aparecem assim que algum agente trabalhar com o Habblaud aberto.`:`Nada registrado neste dia.`)})),a}return a.push(this.legend()),a.push(this.hoursCard(e)),a.push(this.roomsCard(Me(n.rooms,this.visible))),a.push(this.waitsCard(Re(n.waits,r,this.ctx.store.snapshot?.machines),e)),a.push(this.accountsCard(e)),a}kpis(e){let n=u(`span`,{class:`ui-day__swatch is-waiting`,attrs:{"aria-hidden":`true`}}),r=u(`div`,{class:`ui-day__hero`},u(`p`,{class:`ui-day__kpi-label`},n,u(`span`,{text:t(`Esperando você`)})),u(`p`,{class:`ui-day__hero-value`,text:e.waiting}),u(`p`,{class:`ui-day__kpi-sub`,text:e.waits}),e.longest?u(`p`,{class:`ui-day__kpi-sub`},u(`span`,{class:`ui-day__muted`,text:t(`Maior espera: `)}),u(`strong`,{text:e.longest})):null,e.wall?u(`p`,{class:`ui-day__kpi-sub`,text:e.wall}):null),i=(e,t,n,r,i)=>u(`div`,{class:`ui-day__kpi`,title:r},u(`p`,{class:`ui-day__kpi-label`},i?u(`span`,{class:`ui-day__swatch is-${i}`,attrs:{"aria-hidden":`true`}}):null,u(`span`,{text:e})),u(`p`,{class:`ui-day__kpi-value`,text:t}),u(`p`,{class:`ui-day__kpi-sub`,text:n}));return u(`section`,{class:`ui-day__kpis`,attrs:{"aria-label":t(`Destaques do dia`)}},r,i(t(`Trabalhando`),e.working,t(`soma do tempo de todos os agentes`),void 0,`working`),i(t(`Sessões`),e.sessions,e.subagents),i(t(`Pedidos`),e.prompts,e.activity),i(`Tokens`,e.tokens,e.tokensDetail),i(t(`Custo`),e.cost,e.costHint,e.costHint))}legend(){let e=O.map(e=>{let n=this.visible.has(e);return u(`button`,{class:`ui-day__key${n?``:` is-off`}`,type:`button`,title:t(n?`Esconder “{0}” dos gráficos`:`Mostrar “{0}” nos gráficos`,[Z[e]]),attrs:{"aria-pressed":String(n),"data-focus-key":`key:${e}`},on:{click:()=>this.toggleStatus(e)}},u(`span`,{class:`ui-day__swatch is-${e}`,attrs:{"aria-hidden":`true`}}),u(`span`,{text:Z[e]}))});return u(`div`,{class:`ui-day__legend`,role:`group`,attrs:{"aria-label":t(`Status nos gráficos (clique para mostrar ou esconder)`)}},...e)}toggleStatus(e){if(this.visible.has(e)){if(this.visible.size===1)return;this.visible.delete(e)}else this.visible.add(e);this.renderAll()}card(e,n,r,i){let a=!!i&&this.tables.has(i),o=i?u(`button`,{class:`ui-link-btn ui-day__table-btn`,type:`button`,text:t(a?`Ver gráfico`:`Ver tabela`),attrs:{"aria-pressed":String(a),"data-focus-key":`table:${i}`},on:{click:()=>{this.tables.has(i)?this.tables.delete(i):this.tables.add(i),this.renderAll()}}}):null,s=u(`div`,{class:`ui-day__card-body`});return{el:u(`section`,{class:`ui-day__card ui-day__card--${e}`,attrs:{"aria-labelledby":`ui-day-${e}`}},u(`div`,{class:`ui-day__card-head`},u(`div`,{},u(`h3`,{text:n,attrs:{id:`ui-day-${e}`}}),u(`p`,{class:`ui-day__card-sub`,text:r})),o),s),body:s,showTable:a}}table(e,t,n){return u(`div`,{class:`ui-day__table-wrap`},u(`table`,{class:`ui-day__table`},u(`caption`,{class:`ui-sr`,text:n}),u(`thead`,{},u(`tr`,{},...e.map((e,t)=>u(`th`,{text:e,attrs:{scope:`col`,class:t?`is-num`:void 0}})))),u(`tbody`,{},...t.map(e=>u(`tr`,{},...e.map((e,t)=>t?u(`td`,{class:`is-num`,text:e}):u(`th`,{text:e,attrs:{scope:`row`}})))))))}hoursCard(e){let n=this.ctx.isNarrow(),{columns:r,axis:i}=Ie(e.stats.hours,this.visible,e.serverTime,n?6:3),a=this.card(`hours`,t(`Por hora`),t(`Tempo de agentes em cada hora do dia`),`hours`);if(a.showTable){let e=ze(r,e=>e.range,this.visible);return a.body.append(this.table([t(`Hora`),...e.head],e.rows,t(`Tempo de agentes por hora`))),a.el}let o=u(`div`,{class:`ui-day__grid`,attrs:{"aria-hidden":`true`}},...i.ticks.map(e=>u(`span`,{class:`ui-day__gridline`,style:`bottom:${e/i.max*100}%`},u(`span`,{class:`ui-day__tick`,text:Fe(e)})))),s=u(`div`,{class:`ui-day__cols`,role:`list`,attrs:{"aria-label":t(`Tempo de agentes por hora (setas para navegar)`)}}),c=r.findIndex(e=>e.now);c<0&&(c=0),r.forEach((e,t)=>s.append(this.column(e,t===c))),s.addEventListener(`keydown`,e=>this.moveFocus(e,s));let l=u(`div`,{class:`ui-day__xaxis`,attrs:{"aria-hidden":`true`}},...r.map(e=>u(`span`,{class:`ui-day__xlabel${e.now?` is-now`:``}`,text:e.tick||e.now&&!n?`${e.hour}h`:``})));return a.body.append(u(`div`,{class:`ui-day__plot`},o,s),l),a.el}column(e,n){let r=u(`span`,{class:`ui-day__stack`},...e.segments.map(e=>u(`span`,{class:`ui-day__seg is-${e.status}`,style:`height:${e.pct}%`,attrs:{"data-status":e.status}}))),i=u(`div`,{class:`ui-day__col${e.now?` is-now`:``}`,role:`listitem`,tabIndex:n?0:-1,attrs:{"aria-label":`${e.label}${e.now?t(` (agora)`):``}`,"data-focus-key":`hour:${e.t}`}},r);return this.bindTip(i,()=>`${e.range}${e.now?t(` · agora`):e.future?t(` · ainda não chegou`):``}`,()=>e.future?[]:[...O.filter(t=>this.visible.has(t)&&e.ms[t]>0).map(t=>({status:t,label:Z[t],value:Q(e.ms[t])})),{label:`Total`,value:Q(e.total)}],()=>r.lastElementChild??r),i}moveFocus(e,t){let n=[...t.children],r=n.indexOf(document.activeElement);if(r<0)return;let i=e.key===`ArrowRight`?r+1:e.key===`ArrowLeft`?r-1:e.key===`Home`?0:e.key===`End`?n.length-1:-2;if(i===-2)return;e.preventDefault();let a=n[Math.max(0,Math.min(n.length-1,i))];n.forEach(e=>e.tabIndex=e===a?0:-1),a.focus()}roomsCard(e){let n=this.card(`rooms`,t(`Por projeto`),t(`Ordenado pelo tempo esperando você`),`rooms`);if(!e.length)return n.body.append(u(`p`,{class:`ui-day__muted`,text:t(`Nenhum projeto com tempo neste dia.`)})),n.el;if(n.showTable){let r=ze(e,e=>e.name,this.visible);return n.body.append(this.table([t(`Projeto`),...r.head],r.rows,t(`Tempo de agentes por projeto`))),n.el}let r=u(`ul`,{class:`ui-day__bars`});for(let t of e){let e=u(`span`,{class:`ui-day__track`},...t.segments.map(e=>u(`span`,{class:`ui-day__seg is-${e.status}`,style:`width:${e.pct}%`,attrs:{"data-status":e.status}}))),n=u(`li`,{class:`ui-day__bar`,tabIndex:0,attrs:{"aria-label":t.label,"data-focus-key":`room:${t.id}`}},u(`span`,{class:`ui-day__bar-head`},u(`span`,{class:`ui-day__bar-name`,text:t.name,title:t.id}),u(`span`,{class:`ui-day__bar-value`},this.visible.has(`waiting`)?u(`strong`,{text:t.waiting}):null,u(`span`,{class:`ui-day__muted`,text:t.totalText}))),e);this.bindTip(n,()=>t.name,()=>[...O.filter(e=>this.visible.has(e)&&t.ms[e]>0).map(e=>({status:e,label:Z[e],value:Q(t.ms[e])})),{label:`Total`,value:Q($(t.ms,this.visible))}]),r.append(n)}return n.body.append(r),n.el}waitsCard(e,n){let r=this.card(`waits`,t(`Maiores esperas`),t(`Quanto tempo cada agente ficou de mão levantada esperando você`));if(!e.length)return r.body.append(u(`p`,{class:`ui-day__muted`,text:t(`Nenhuma espera por você neste dia.`)})),r.el;let i=new Map(n.stats.accounts.map(e=>[e.id,e])),a=u(`ol`,{class:`ui-day__waits`});for(let n of e){let e=i.get(n.account),r=u(`span`,{class:`ui-acc-chip`,text:e?.short??`?`,title:e?.name??n.account});s(r,`--acc`,e?.color??`#8b98b3`),this.isCodexAccount(n.account)&&(r.dataset.provider=`codex`),a.append(u(`li`,{class:`ui-day__wait${n.ongoing?` is-ongoing`:``}`,attrs:{"aria-label":n.label}},u(`span`,{class:`ui-day__rank`,text:`${n.rank}`,attrs:{"aria-hidden":`true`}}),u(`span`,{class:`ui-day__wait-main`,attrs:{"aria-hidden":`true`}},u(`span`,{class:`ui-day__wait-top`},u(`strong`,{class:`ui-day__wait-dur`,text:n.duration}),u(`span`,{class:`ui-day__wait-bar`},u(`span`,{class:`ui-day__seg is-waiting`,style:`width:${n.pct}%`})),n.ongoing?u(`span`,{class:`ui-day__now`,text:t(`esperando agora`)}):null),u(`span`,{class:`ui-day__wait-who`},r,u(`span`,{class:`ui-day__wait-name`,text:n.agentName}),u(`span`,{class:`ui-day__muted`,text:`${t(`em {0}`,[n.roomName])} · ${n.when}${n.reason?` · ${n.reason}`:``}`})))))}return r.body.append(a),r.el}accountsCard(e){let n=Le(e.stats.accounts,e=>this.isCodexAccount(e)),r=this.card(`accounts`,t(`Por conta`),t(`Cada conta na cor dela, com a fatia do tempo de trabalho do dia`));if(!n.length)return r.body.append(u(`p`,{class:`ui-day__muted`,text:t(`Nenhuma conta com tempo neste dia.`)})),r.el;let i=u(`div`,{class:`ui-day__accounts`});for(let e of n){let n=u(`span`,{class:`ui-acc-chip ui-acc-chip--md`,text:e.short,attrs:{"aria-hidden":`true`,...e.codex?{"data-provider":`codex`}:{}}});s(n,`--acc`,e.color);let r=u(`span`,{class:`ui-day__meter`,role:`img`,attrs:{"aria-label":e.shareText}},u(`span`,{class:`ui-day__meter-fill`,style:`width:${e.share}%`})),a=(e,t)=>[u(`dt`,{text:e}),u(`dd`,{text:t})],o=u(`article`,{class:`ui-day__account`,attrs:{"aria-label":e.name}},u(`div`,{class:`ui-day__account-head`},n,u(`strong`,{class:`ui-day__account-name`,text:e.name}),u(`span`,{class:`ui-day__muted`,text:e.sessions})),r,u(`p`,{class:`ui-day__kpi-sub`,text:e.shareText}),u(`dl`,{class:`ui-day__account-stats`},...a(t(`Trabalhando`),e.working),...a(t(`Esperando você`),e.waiting),...a(`Tokens`,e.tokens),...e.cost===null?[u(`dt`,{text:t(`Custo`)}),u(`dd`,{text:t(`só tokens`),title:t(`O Codex não grava custo, só tokens`)})]:a(t(`Custo`),e.cost)));s(o,`--acc`,e.color),i.append(o)}return r.body.append(i),r.el}isCodexAccount(e){return b(this.ctx.account(e),e)===`codex`}bindTip(e,t,n,r=()=>e){let i=e=>this.showTip(r(),t(),n(),e);e.addEventListener(`pointerenter`,e=>i(Qe(e.target))),e.addEventListener(`pointermove`,e=>i(Qe(e.target))),e.addEventListener(`pointerleave`,()=>this.hideTip()),e.addEventListener(`focus`,()=>i()),e.addEventListener(`blur`,()=>this.hideTip())}showTip(e,t,n,r){this.tip.replaceChildren(u(`p`,{class:`ui-day__tip-title`,text:t}),...n.map(e=>u(`p`,{class:`ui-day__tip-row${e.status&&e.status===r?` is-hl`:``}${e.status?``:` is-total`}`},u(`span`,{class:`ui-day__tip-key${e.status?` is-${e.status}`:``}`,attrs:{"aria-hidden":`true`}}),u(`strong`,{text:e.value}),u(`span`,{text:e.label})))),this.tip.hidden=!1;let i=this.el.getBoundingClientRect(),a=e.getBoundingClientRect(),o=this.tip.getBoundingClientRect(),s=Math.min(Math.max(8,a.left-i.left+a.width/2-o.width/2),i.width-o.width-8),c=a.top-i.top-o.height-8;c<8&&(c=a.bottom-i.top+8),this.tip.style.left=`${Math.round(s)}px`,this.tip.style.top=`${Math.round(c)}px`}hideTip(){this.tip.hidden=!0}};function Qe(e){let t=e instanceof HTMLElement?e.dataset.status:void 0;return t&&O.includes(t)?t:void 0}export{Ze as DayPanel};
1
+ import{a as e,s as t}from"./main-CJZNyhMz.js";import{c as n,l as r,r as i,t as a}from"./simulator-DSTKHVKF.js";import{_ as o,c as s,i as c,l,r as u,s as d,v as f}from"./dom-BZgsJMv9.js";import{c as p,d as m,i as h,l as g}from"./format-DrvIRA6J.js";import{_,g as v,h as y,m as b}from"./app-D5bRv3Io.js";var x=36e5;24*x;var S=12e4,C=2e4,w=9e4;6*x;var T=1e4,E={toolCalls:60,tokensIn:5e6,tokensOut:5e5,costUSD:50},D=1500,O=[`waiting`,`working`,`idle`,`shell`],ee=[`prompts`,`toolCalls`,`tasksDone`,`tokensIn`,`tokensOut`,`costUSD`];function k(){return{waiting:0,working:0,idle:0,shell:0}}function A(){return{prompts:0,toolCalls:0,tasksDone:0,tokensIn:0,tokensOut:0,costUSD:0}}function j(e){return e.waiting+e.working+e.idle+e.shell}function te(e){return e===`waiting`||e===`working`||e===`idle`||e===`shell`}function M(e){return{waiting:Math.round(e.waiting),working:Math.round(e.working),idle:Math.round(e.idle),shell:Math.round(e.shell)}}function N(e,t){for(let n of O)e[n]+=t[n]}function P(e,t){for(let n of ee)e[n]+=t[n]}function F(e){return Math.floor(e/x)*x}function I(e,t,n){let r=e;for(;r<t;){let e=F(r),i=Math.min(t,e+x);n(e,i-r),r=i}}function ne(e){let t=e.filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n[n.length-1];t&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}var re=/^(\d{4})-(\d{2})-(\d{2})$/,ie=/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){0,2}$/,L=new Map,ae=64;function oe(e){let t=L.get(e);return t||(L.size>=ae&&L.clear(),t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),L.set(e,t)),t}function R(e,t){let n={y:1970,mo:1,d:1,h:0,mi:0,s:0};for(let r of oe(t).formatToParts(e)){let e=Number(r.value);r.type===`year`?n.y=e:r.type===`month`?n.mo=e:r.type===`day`?n.d=e:r.type===`hour`?n.h=e%24:r.type===`minute`?n.mi=e:r.type===`second`&&(n.s=e)}return n}function se(e){if(e.length>64||!ie.test(e))return null;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).resolvedOptions().timeZone}catch{return null}}function ce(e){return se(e)!==null}function le(){try{let e=Intl.DateTimeFormat().resolvedOptions().timeZone;return e&&ce(e)?e:`UTC`}catch{return`UTC`}}var z=e=>String(e).padStart(2,`0`);function B(e,t){let n=R(e,t);return`${n.y}-${z(n.mo)}-${z(n.d)}`}function V(e,t){return R(e,t).h}function H(e){let t=re.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);if(n<1970||r<1||r>12||i<1||i>31)return null;let a=new Date(Date.UTC(n,r-1,i));return a.getUTCFullYear()!==n||a.getUTCMonth()!==r-1||a.getUTCDate()!==i?null:{y:n,m:r,d:i}}function U(e,t){let n=H(e);if(!n)return e;let r=new Date(Date.UTC(n.y,n.m-1,n.d+t));return`${r.getUTCFullYear()}-${z(r.getUTCMonth()+1)}-${z(r.getUTCDate())}`}function W(e,t){let n=R(e,t);return Date.UTC(n.y,n.mo-1,n.d,n.h,n.mi,n.s)-Math.floor(e/1e3)*1e3}function G(e,n){let r=H(e);if(!r)throw RangeError(t(`dia inválido: {0}`,[e]));let i=Date.UTC(r.y,r.m-1,r.d),a=i-W(i,n);a=i-W(a,n);let o=9e5;for(let t=0;t<16&&B(a,n)<e;t++)a+=o;for(let t=0;t<16&&B(a-o,n)===e;t++)a-=o;return a}function ue(e,t){return{start:G(e,t),end:G(U(e,1),t)}}function K(e,t,n){let r=e+x/2;return r>=t&&r<n}function de(e){return{t:e,ms:k(),waitWallMs:0,counts:A(),rooms:new Map,accounts:new Map,agents:new Map}}function q(e,t){let n=e.get(t);return n||e.set(t,n={ms:k(),counts:A()}),n}function fe(e){return j(e.ms)>0||e.counts.prompts>0||e.counts.toolCalls>0||e.counts.tokensIn>0||e.counts.tokensOut>0}var pe=class{key;hours=new Map;rooms=new Map;accounts=new Map;waits=[];dirty=!1;updatedAt=0;constructor(e){this.key=e}hour(e){let t=this.hours.get(e);return t||this.hours.set(e,t=de(e)),t}hoursWithData(){return[...this.hours.values()].filter(fe).map(e=>e.t)}toFile(){let e=e=>[...e].map(([e,t])=>[e,{ms:{...t.ms},counts:{...t.counts}}]);return{version:1,day:this.key,updatedAt:this.updatedAt,hours:[...this.hours.values()].sort((e,t)=>e.t-t.t).map(t=>({t:t.t,ms:{...t.ms},waitWallMs:t.waitWallMs,counts:{...t.counts},rooms:e(t.rooms),accounts:e(t.accounts),agents:[...t.agents].map(([e,[t,n]])=>[e,t,n])})),rooms:[...this.rooms],accounts:[...this.accounts].map(([e,t])=>[e,{...t}]),waits:this.waits.map(e=>({...e}))}}};function J(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}var me=class{fileDayOf;loader;days=new Map;idx=new Map;constructor(e,t){this.fileDayOf=e,this.loader=t}day(e){let t=this.days.get(e);if(!t){t=this.loader?.(e)??new pe(e),this.days.set(e,t);for(let e of t.hours.values())this.idx.set(e.t,{day:t,b:e})}return t}peek(e){return this.days.get(e)}list(){return[...this.days.values()]}evictBefore(e){for(let[t,n]of this.days)if(!(t>=e||n.dirty)){this.days.delete(t);for(let e of n.hours.keys())this.idx.delete(e)}}slot(e){let t=F(e),n=this.idx.get(t);if(!n){let e=this.day(this.fileDayOf(t));n={day:e,b:e.hour(t)},this.idx.set(t,n)}return n}touch(e,t){e.dirty=!0,t>e.updatedAt&&(e.updatedAt=t)}note(e,t){t.roomName&&e.rooms.get(t.room)!==t.roomName&&e.rooms.set(t.room,t.roomName);let n=t.accountMeta,r=e.accounts.get(t.account);n&&(!r||r.name!==n.name||r.short!==n.short||r.color!==n.color)&&e.accounts.set(t.account,{...n})}addMsAt(e,t,n,r,i=n){if(!(r>0))return;let{day:a,b:o}=this.slot(n);o.ms[t]+=r,q(o.rooms,e.room).ms[t]+=r,q(o.accounts,e.account).ms[t]+=r,o.agents.has(e.key)||o.agents.set(e.key,[e.room,e.account]),this.note(a,e),this.touch(a,i)}markPresent(e,t){let{day:n,b:r}=this.slot(t);r.agents.has(e.key)||(r.agents.set(e.key,[e.room,e.account]),this.note(n,e),this.touch(n,t))}addTime(e,t,n,r){I(n,r,(n,i)=>this.addMsAt(e,t,n,i,r))}addCount(e,t,n,r){if(!(n>0))return;let{day:i,b:a}=this.slot(r);a.counts[t]+=n,q(a.rooms,e.room).counts[t]+=n,q(a.accounts,e.account).counts[t]+=n,this.note(i,e),this.touch(i,r)}addWaitWallAt(e,t,n=e){if(!(t>0))return;let{day:r,b:i}=this.slot(e);i.waitWallMs+=t,this.touch(r,n)}addWaitWall(e,t){I(e,t,(e,n)=>this.addWaitWallAt(e,n,t))}addWait(e){let{day:t}=this.slot(e.start);if(t.waits.push(e),t.waits.length>1e3){let n=e=>t.waits[e].end-t.waits[e].start,r=-1;if(t.waits.forEach((t,i)=>{t.open||t===e||(r<0||n(i)<n(r))&&(r=i)}),r<0)for(let e=0;e<t.waits.length;e++)(r<0||n(e)<n(r))&&(r=e);t.waits.splice(r,1)}this.touch(t,e.end)}touchWait(e){this.touch(this.slot(e.start).day,e.end)}removeWait(e){let{day:t}=this.slot(e.start),n=t.waits.indexOf(e);n>=0&&(t.waits.splice(n,1),this.touch(t,e.end))}findOpenWait(e,t){for(let n of this.days.values())for(let r=n.waits.length-1;r>=0;r--){let i=n.waits[r];if(i.open&&i.agentId===e&&i.end>=t)return i}}};function he(){return{ms:k(),counts:A(),sessions:0,subagents:0,waits:0,longestWaitMs:0,agents:new Set}}function Y(e){let t=0,n=0;for(let r of e.agents)r.startsWith(`m:`)?t++:r.startsWith(`s:`)&&n++;let r={...e.counts,costUSD:Math.round(e.counts.costUSD*1e4)/1e4};return{ms:M(e.ms),counts:r,sessions:t,subagents:n,waits:e.waits,longestWaitMs:Math.round(e.longestWaitMs)}}function X(e,t){let n=e.get(t);return n||e.set(t,n=he()),n}function ge(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function _e(e,t,n,r,i={}){let{start:a,end:o}=ue(t,n),s=[...e].sort((e,t)=>e.key.localeCompare(t.key)),c=new Map,l=new Map,u=new Map,d=0;for(let e of s){for(let[t,n]of e.rooms)c.set(t,n);for(let[t,n]of e.accounts)l.set(t,n);for(let[t,n]of e.hours)K(t,a,o)&&u.set(t,n)}let f=he(),p=0,m=new Map,h=new Map;for(let e of u.values()){N(f.ms,e.ms),P(f.counts,e.counts),p+=e.waitWallMs;for(let[t,n]of e.rooms){let e=X(m,t);N(e.ms,n.ms),P(e.counts,n.counts)}for(let[t,n]of e.accounts){let e=X(h,t);N(e.ms,n.ms),P(e.counts,n.counts)}for(let[t,[n,r]]of e.agents)f.agents.add(t),X(m,n).agents.add(t),X(h,r).agents.add(t);for(let t of s)t.hours.get(e.t)===e&&t.updatedAt>d&&(d=t.updatedAt)}let g=new Set,_=[];for(let e of s)for(let t of e.waits){if(t.end<=a||t.start>=o||t.end-t.start<3e3)continue;let e=`${t.agentId}|${t.start}`;g.has(e)||(g.add(e),_.push(t))}for(let e of _){let t=e.end-e.start;for(let n of[f,X(m,e.roomId),X(h,e.account)])n.waits++,t>n.longestWaitMs&&(n.longestWaitMs=t)}let v=[..._].sort((e,t)=>t.end-t.start-(e.end-e.start)||e.start-t.start).slice(0,i.top??10),y=[];for(let e=F(a);e<o;e+=x)K(e,a,o)&&y.push({t:e,hour:V(Math.max(e,a),n),ms:M(u.get(e)?.ms??k())});let b=e=>c.get(e)??ge(e),S=[...m].map(([e,t])=>({id:e,name:b(e),...Y(t)})).sort((e,t)=>t.ms.waiting-e.ms.waiting||j(t.ms)-j(e.ms)||e.name.localeCompare(t.name)),C=[...h].map(([e,t])=>{let n=l.get(e);return{id:e,name:n?.name??e,short:n?.short??`?`,color:n?.color??`#8b98b3`,...Y(t)}}).sort((e,t)=>t.ms.working-e.ms.working||j(t.ms)-j(e.ms)||e.name.localeCompare(t.name)),w={day:t,tz:n,start:a,end:o,totals:{...Y(f),waitWallMs:Math.round(p)},rooms:S,accounts:C,hours:y,waits:v.map(e=>{let t={agentId:e.agentId,agentName:e.agentName,roomId:e.roomId,roomName:b(e.roomId),account:e.account,start:e.start,end:e.end,ms:e.end-e.start};return e.reason&&(t.reason=e.reason),e.open&&r-e.end<1e4&&(t.ongoing=!0),t})};return d&&(w.updatedAt=d),w}function ve(e,t){let n=new Set;for(let r of e)n.add(B(r+x/2,t));return n}function ye(e){let t=e.stats;return{toolCalls:J(t.toolCalls),tokensIn:J(t.tokensIn),tokensOut:J(t.tokensOut),costUSD:J(t.costUSD)}}function be(e,t){return{toolCalls:Math.max(e.toolCalls,t.toolCalls),tokensIn:Math.max(e.tokensIn,t.tokensIn),tokensOut:Math.max(e.tokensOut,t.tokensOut),costUSD:Math.max(e.costUSD,t.costUSD)}}var xe={toolCalls:0,tokensIn:0,tokensOut:0,costUSD:0};function Se(e){return e.toolCalls===0&&e.tokensIn===0&&e.tokensOut===0}function Ce(e){return e.tasks.reduce((e,t)=>e+ +(t.status===`completed`),0)}var we=class{book;tracks=new Map;lastSample;startedAt;constructor(e,t){this.book=e,this.startedAt=t.startedAt}get size(){return this.tracks.size}observe(e,t){let n=this.lastSample===void 0?1/0:t-this.lastSample;this.lastSample=t;let r=new Map(e.rooms.map(e=>[e.id,e.name])),i=new Map(e.accounts.map(e=>[e.id,{name:e.name,short:e.short,color:e.color}])),a=[],o=new Set;for(let s of e.agents){o.add(s.id);let e={key:s.kind===`main`?`m:${s.sessionId}`:`s:${s.id}`,room:s.roomId,roomName:r.get(s.roomId)??ge(s.roomId),account:s.account},c=i.get(s.account);c&&(e.accountMeta=c);let l=this.tracks.get(s.id),u=n;l?this.integrate(l,s,e,t,a):(l=this.begin(s,t),this.tracks.set(s.id,l),u=0,(te(s.status)||l.fresh)&&this.book.markPresent(e,t)),l.seenAt=t,l.status=s.status,this.countPrompts(l,s,e,t),this.countDeltas(l,s,e,t,u)}for(let[e,n]of this.tracks)o.has(e)||(t-n.seenAt>12e4&&this.closeWait(n),t-n.seenAt>216e5&&this.tracks.delete(e));for(let[e,t]of ne(a))this.book.addWaitWall(e,t)}begin(e,t){let n=ye(e),r=e.startedAt>=this.startedAt&&(e.kind===`sub`||Se(n));return{sessionId:e.sessionId,status:e.status,lastAt:t,seenAt:t,hw:r?{...xe}:n,costKnown:r||e.stats.costUSD!==void 0,fresh:r,tasksDone:r?0:Ce(e),settleUntil:r?0:t+Math.max(C,this.startedAt+w-t),prompts:[]}}integrate(e,t,n,r,i){let a=e.lastAt;if(e.lastAt=r,r<=a)return;if(r-a>12e4){this.closeWait(e);return}let o=t.statusSince>a&&t.statusSince<r?t.statusSince:void 0;o!==void 0&&e.status!==t.status?(this.segment(e,t,n,e.status,a,o,i),this.segment(e,t,n,t.status,o,r,i)):this.segment(e,t,n,t.status,a,r,i)}segment(e,t,n,r,i,a,o){if(a<=i)return;if(!te(r)){this.closeWait(e);return}if(this.book.addTime(n,r,i,a),r!==`waiting`){this.closeWait(e);return}if(o.push([i,a]),e.wait&&i-e.wait.end<=D){e.wait.end=a,this.book.touchWait(e.wait);return}this.closeWait(e);let s=this.book.findOpenWait(t.id,i-S);if(s){s.end=a,this.book.touchWait(s),e.wait=s;return}let c={agentId:t.id,agentName:t.name,roomId:t.roomId,account:t.account,start:i,end:a,open:!0};t.waitingFor&&(c.reason=t.waitingFor),this.book.addWait(c),e.wait=c}closeWait(e){let t=e.wait;t&&(e.wait=void 0,delete t.open,t.end-t.start<3e3?this.book.removeWait(t):this.book.touchWait(t))}countPrompts(e,t,n,r){for(let i of t.recent)i.kind!==`prompt`||i.at<this.startedAt||e.prompts.includes(i.id)||(e.prompts.push(i.id),e.prompts.length>64&&e.prompts.shift(),this.book.addCount(n,`prompts`,1,Math.min(i.at,r)))}countDeltas(e,t,n,r,i){let a=ye(t),o=Ce(t);if(t.sessionId!==e.sessionId){e.sessionId=t.sessionId,e.fresh=Se(a),e.hw=e.fresh?{...xe}:a,e.costKnown=e.fresh||t.stats.costUSD!==void 0,e.tasksDone=e.fresh?0:o,e.settleUntil=e.fresh?0:r+C,e.prompts=[];return}if(t.stats.costUSD!==void 0&&!e.costKnown&&(e.costKnown=!0,e.fresh||(e.hw.costUSD=Math.max(e.hw.costUSD,a.costUSD))),r<e.settleUntil){e.hw=be(e.hw,a),e.tasksDone=o;return}let s={toolCalls:Math.max(0,a.toolCalls-e.hw.toolCalls),tokensIn:Math.max(0,a.tokensIn-e.hw.tokensIn),tokensOut:Math.max(0,a.tokensOut-e.hw.tokensOut),costUSD:Math.max(0,a.costUSD-e.hw.costUSD)};e.hw=be(e.hw,a);let c=s.toolCalls>E.toolCalls||s.tokensIn>E.tokensIn||s.tokensOut>E.tokensOut||s.costUSD>E.costUSD;if(i<=T&&c){e.tasksDone=o;return}this.book.addCount(n,`toolCalls`,s.toolCalls,r),this.book.addCount(n,`tokensIn`,s.tokensIn,r),this.book.addCount(n,`tokensOut`,s.tokensOut,r),this.book.addCount(n,`costUSD`,s.costUSD,r),o>e.tasksDone&&this.book.addCount(n,`tasksDone`,o-e.tasksDone,r),e.tasksDone=o}},Te=[.03,.01,0,0,0,0,.02,.1,.4,.75,.95,.85,.4,.55,.9,1,.95,.8,.55,.35,.3,.25,.15,.06],Ee=[t(`aprovar uma permissão`),t(`responder uma pergunta`),t(`escolher uma opção`),t(`aprovar o plano`)];function De(e,o,s,c,l=n(`meu-dia:${F(s)}`)){let u=r(l),d=(e,t)=>e+u()*(t-e),f=o.accounts.map(e=>({id:e.id,codex:`provider`in e&&e.provider===`codex`,meta:{name:e.name,short:e.short,color:e.color}})),p=f.filter(e=>!e.codex),m=f.find(e=>e.codex),h=e=>m&&p.length?e<.5?p[0]:e<.8?p[p.length-1]:m:f[e<.6?0:f.length-1],g=new Map(o.rooms.map(e=>[e.id,e.name])),_=new Set(o.agents.map(e=>e.name)),v=new Map;for(let e of o.agents){let t=v.get(e.roomId)??new Map;t.set(e.account,(t.get(e.account)??0)+1),v.set(e.roomId,t)}let y=[...v.keys()][0];if(!y||!f.length)return;let b=y.slice(0,y.lastIndexOf(`/`)),S=[];for(let e of a){let t=`${b}/${e}`;v.has(t)||(v.set(t,new Map([[h(u()).id,1]])),S.push(t))}let C=S.some(e=>v.get(e).has(m?.id??``));m&&S.length&&!C&&v.set(S[S.length-1],new Map([[m.id,1]]));let w=[...v].map(([e,t])=>{let n=[...t].sort((e,t)=>t[1]-e[1])[0]?.[0]??f[0].id,r=[0,1,2].map(t=>{let n=i(`${e}:${t}:${l}`,_);return _.add(n.name),n.name}),a={id:e,name:g.get(e)??e.split(`/`).pop()??e,account:n,codex:!!f.find(e=>e.id===n)?.codex,weight:d(.35,1.1),waitiness:d(.05,.3),people:r},o=f.find(e=>e.id===n)?.meta;return o&&(a.accountMeta=o),a}),T=F(s),E=F(G(U(B(s,c),-1),c));for(let n=E;n<=T;n+=x){let r=Math.min(x,s-n);if(r<=0)continue;let i=r/x,a=Te[V(n,c)]??0,o=0;w.forEach((c,l)=>{let f=a*c.weight*d(.7,1.3);if(f<.04)return;let p=f>.6?2:1,m=e=>{let t={key:e,room:c.id,roomName:c.name,account:c.account};return c.accountMeta&&(t.accountMeta=c.accountMeta),t},h=Array.from({length:p},(e,t)=>m(`m:demo-dia-${l}-${t}`)),g=Math.min(.92,f*d(.55,.85))*x*i,_=g*c.waitiness*d(.5,1.4),v=g*d(0,.12),y=Math.max(0,p*x*i*.9-g-_-v)*d(.3,.7),b=[[`working`,g],[`waiting`,_],[`shell`,v],[`idle`,y]];for(let[t,i]of b)for(let a of h)e.addMsAt(a,t,n,i/p,Math.min(s,n+r));let S=Math.round(f*d(0,2.2));for(let t=0;t<S;t++)e.addMsAt(m(`s:demo-dia-${l}-${n}-${t}`),`working`,n,g*d(.15,.45),Math.min(s,n+r));let C=g/6e4,w=n+r/2,T=h[0];e.addCount(T,`prompts`,Math.round(C/7*d(.6,1.4)),w),e.addCount(T,`toolCalls`,Math.round(C*d(1.5,3)),w),e.addCount(T,`tasksDone`,Math.round(C/12*d(.4,1.2)),w);let E=Math.round(C*d(9e4,16e4)),D=Math.round(C*d(1e3,2200));if(e.addCount(T,`tokensIn`,E,w),e.addCount(T,`tokensOut`,D,w),c.codex||e.addCount(T,`costUSD`,Math.round((E*3e-7+D*15e-6)*1e4)/1e4,w),_>=3e4){let i=1+Math.floor(u()*Math.min(3,_/6e4)),a=_;for(let o=0;o<i&&a>=5e3;o++){let s=o===i-1?a:a*d(.3,.7);a-=s;let f=n+u()*Math.max(0,r-s),p=c.people[Math.floor(u()*c.people.length)],m=Ee[Math.floor(u()*Ee.length)];e.addWait({agentId:`demo-dia:${l}:${p}`,agentName:p,roomId:c.id,account:c.account,start:Math.round(f),end:Math.round(f+s),reason:c.codex?t(`aprovar um comando`):m})}o+=_*d(.75,.95)}}),e.addWaitWallAt(n,Math.min(o,r),Math.min(s,n+r))}}var Z={waiting:t(`Esperando você`),working:t(`Trabalhando`),idle:t(`Ocioso`),shell:t(`Esperando o shell`)};function Q(e){let t=Number.isFinite(e)?Math.max(0,e):0;if(t<6e4)return`${Math.floor(t/1e3)} s`;if(t<36e5)return`${Math.floor(t/6e4)} min`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return r?`${n} h ${r} min`:`${n} h`}var Oe=new Set(O);function $(e,t){return O.reduce((n,r)=>n+(t.has(r)?e[r]:0),0)}function ke(e,t,n){return n>0?O.filter(n=>t.has(n)&&e[n]>0).map(t=>({status:t,ms:e[t],pct:e[t]/n*100})):[]}function Ae(e,n=Oe){let r=O.filter(t=>n.has(t)&&e[t]>0).map(t=>`${Z[t].toLowerCase()} ${Q(e[t])}`);return r.length?r.join(`, `):t(`sem tempo registrado`)}function je(e,n,r=!1,i){let a=e.totals,s=a.counts,c=e.waits[0],l=(e,t,n)=>`${p(e)} ${e===1?t:n}`;return{waiting:Q(a.ms.waiting),waitingMs:a.ms.waiting,longest:c?t(`{0} · {1} em {2}, às {3}{4}`,[Q(c.ms),o(c.agentId,c.agentName,i),c.roomName,n(c.start),c.ongoing?t(` (ainda esperando)`):``]):``,wall:a.waitWallMs>0?t(`Alguém esperou por você durante {0} do dia`,[Q(a.waitWallMs)]):``,waits:a.waits?l(a.waits,t(`espera`),t(`esperas`)):a.ms.waiting>0?t(`só esperas de poucos segundos`):t(`nenhuma espera`),working:Q(a.ms.working),sessions:p(a.sessions),subagents:l(a.subagents,t(`subagente`),t(`subagentes`)),tokens:g(s.tokensIn+s.tokensOut),tokensDetail:t(`{0} entrada · {1} saída`,[g(s.tokensIn),g(s.tokensOut)]),cost:s.costUSD>0?m(s.costUSD):`—`,costHint:s.costUSD>0?t(r?`Só do Claude Code: o Codex não grava custo, só tokens`:`Custo calculado pelo próprio Claude Code`):s.tokensIn+s.tokensOut>0?t(r?`O Codex não grava custo, só tokens`:`Os transcripts não trouxeram o custo`):t(`Nenhum gasto registrado`),prompts:p(s.prompts),activity:`${l(s.toolCalls,t(`ferramenta`),t(`ferramentas`))} · ${l(s.tasksDone,t(`tarefa concluída`),t(`tarefas concluídas`))}`}}function Me(e,n){let r=Math.max(0,...e.map(e=>$(e.ms,n)));return e.filter(e=>j(e.ms)>0).map(e=>{let i=$(e.ms,n);return{id:e.id,name:e.name,ms:e.ms,total:i,segments:ke(e.ms,n,r),waiting:t(`{0} esperando você`,[Q(e.ms.waiting)]),totalText:t(`{0} no total`,[Q(i)]),label:`${e.name}: ${Ae(e.ms,n)}`}})}var Ne=[5,10,15,20,30,45,60,90,120,180,240,300,360,480,600,720,960,1200,1440];function Pe(e){let t=Math.max(1,e/6e4),n=Ne.find(e=>e>=t)??Math.ceil(t/1440)*1440,r=n>=120?[60,30]:[5],i=1;for(let e of r){let t=[4,3,2].find(t=>Number.isInteger(n/t)&&n/t%e===0);if(t){i=t;break}}let a=n/i;return{max:n*6e4,ticks:Array.from({length:i},(e,t)=>(t+1)*a*6e4)}}function Fe(e){let t=Math.round(e/6e4);if(t<60)return`${t} min`;let n=Math.floor(t/60),r=t%60;return r?`${n} h ${String(r).padStart(2,`0`)}`:`${n} h`}function Ie(e,t,n,r=3){let i=Pe(Math.max(0,...e.map(e=>$(e.ms,t))));return{columns:e.map((a,o)=>{let s=$(a.ms,t),c=(a.hour+1)%24,l=`${a.hour}h–${c}h`;return{t:a.t,hour:a.hour,ms:a.ms,total:s,segments:ke(a.ms,t,i.max),range:l,label:`${l}: ${Ae(a.ms,t)}`,now:n>=a.t&&n<(e[o+1]?.t??a.t+36e5),future:a.t>n,tick:a.hour%r===0}}),axis:i}}function Le(e,n=()=>!1){let r=e.reduce((e,t)=>e+t.ms.working,0);return e.filter(e=>j(e.ms)>0||e.counts.tokensIn>0).map(e=>{let i=r>0?Math.round(e.ms.working/r*100):0,a=n(e.id);return{id:e.id,name:e.name,short:e.short,color:e.color,share:i,shareText:t(`{0}% do trabalho do dia`,[i]),working:Q(e.ms.working),waiting:Q(e.ms.waiting),sessions:`${p(e.sessions)} ${e.sessions===1?t(`sessão`):t(`sessões`)}${e.subagents?` · ${p(e.subagents)} sub`:``}`,tokens:g(e.counts.tokensIn+e.counts.tokensOut),cost:a?null:e.counts.costUSD>0?m(e.counts.costUSD):`—`,codex:a}})}function Re(e,n,r){let i=Math.max(1,...e.map(e=>e.ms));return e.map((e,a)=>{let s=e.ongoing?t(`desde {0}`,[n(e.start)]):`${n(e.start)}–${n(e.end)}`,c=o(e.agentId,e.agentName,r),l={key:`${e.agentId}|${e.start}`,rank:a+1,duration:Q(e.ms),pct:Math.max(2,e.ms/i*100),agentName:c,roomName:e.roomName,account:e.account,when:s,ongoing:!!e.ongoing,label:`${a+1}º: ${Q(e.ms)}, ${c} em ${e.roomName}, ${s}${e.reason?t(`, para {0}`,[e.reason]):``}${e.ongoing?t(`, ainda esperando`):``}`};return e.reason&&(l.reason=e.reason),l})}function ze(e,t,n){let r=O.filter(e=>n.has(e));return{head:[...r.map(e=>Z[e]),`Total`],rows:e.map(e=>[t(e),...r.map(t=>e.ms[t]>0?Q(e.ms[t]):`—`),Q($(e.ms,n))])}}var Be=new Intl.DateTimeFormat(e(),{weekday:`short`,day:`2-digit`,month:`2-digit`,timeZone:`UTC`});function Ve(e,n){if(e===n)return t(`Hoje`);let[r,i,a]=e.split(`-`).map(Number),o=Date.UTC(r,i-1,a),[s,c,l]=n.split(`-`).map(Number);return Date.UTC(s,c-1,l)-o===864e5?t(`Ontem`):Be.format(o)}function He(e,t,n){let r=new URLSearchParams({day:e,tz:t});return n&&r.set(`source`,n),`/api/stats?${r}`}function Ue(e){return`/api/stats/days?${new URLSearchParams({tz:e})}`}function We(e,t,n){return e&&t===n}function Ge(e){return j(e.totals.ms)===0&&e.totals.counts.tokensIn===0&&e.waits.length===0}var Ke=3e4,qe=t(`Tempo de agentes é a soma de todos eles: dois agentes trabalhando por 1 hora contam 2 horas. `)+t(`“Esperando você” é o tempo de mão levantada no escritório (permissão, pergunta ou escolha). `)+t(`O Habblaud só conta o que acontece enquanto ele está rodando.`);async function Je(e){let n=await fetch(e,{cache:`no-store`}),r=await n.json().catch(()=>null);if(!n.ok||!r)throw Error(r?.error??t(`erro {0}`,[n.status]));return r}var Ye={days:e=>Je(Ue(e)),day:(e,t,n)=>Je(He(e,t,n))},Xe=class{tz=le();book=new me(e=>B(e,this.tz));tracker=new we(this.book,{startedAt:Date.now()});seeded=!1;last=0;constructor(e){e.on(`snapshot`,e=>{let t=Date.now();t-this.last<1e3||(this.last=t,this.seeded||=(De(this.book,e,t,this.tz),!0),this.tracker.observe(e,t))})}async days(e){let t=B(Date.now(),e),n=new Set([t]);for(let t of this.book.list())for(let r of ve(t.hoursWithData(),e))n.add(r);return{tz:e,today:t,days:[...n].sort().reverse(),demoAvailable:!1}}async day(e,t){let n=Date.now();return{source:`demo`,demoAvailable:!1,today:B(n,t),serverTime:n,stats:_e(this.book.list(),e,t,n)}}},Ze=class{ctx;button;el;source;tz=le();days=null;data=null;day=null;sourcePref;visible=new Set(Oe);tables=new Set;loading=!1;error=null;seq=0;timer=null;demoSeen;opener=null;select;seg;badge;status;statusText;retry;content;tip;constructor(e,n){this.ctx=e,this.button=n,this.source=e.store.mock?new Xe(e.store):Ye,this.select=new v({label:t(`Dia`),className:`ui-day__select`,onChange:e=>this.pickDay(e)}),this.seg=new y({label:t(`Dados exibidos`),options:[{value:`demo`,label:t(`Demonstração`),className:`ui-seg__opt`},{value:`real`,label:t(`Dados reais`),className:`ui-seg__opt`}],indicator:!1,className:`ui-seg ui-day__source`,onChange:e=>this.pickSource(e)}),this.seg.el.hidden=!0,this.badge=u(`span`,{class:`ui-day__badge`,text:t(`demonstração`),title:t(`Números fictícios do modo demonstração`),hidden:!0});let r=c(_.close,t(`Fechar (Esc)`),()=>this.close(),`ui-icon-btn--sm`);this.statusText=u(`span`,{}),this.retry=u(`button`,{class:`ui-link-btn`,type:`button`,text:t(`Tentar de novo`),hidden:!0,on:{click:()=>void this.load(!0)}}),this.status=u(`p`,{class:`ui-day__status`},this.statusText,this.retry),this.content=u(`div`,{class:`ui-day__content`}),this.tip=u(`div`,{class:`ui-day__tip`,role:`tooltip`,hidden:!0,attrs:{"aria-hidden":`true`}}),this.el=u(`dialog`,{class:`ui-dialog ui-day`,attrs:{"aria-labelledby":`ui-day-title`}},u(`div`,{class:`ui-dialog__head ui-day__head`},u(`div`,{class:`ui-day__title`},u(`h2`,{text:t(`Meu dia`),attrs:{id:`ui-day-title`}}),this.badge),u(`div`,{class:`ui-day__controls`},this.select.el,this.seg.el),r),u(`div`,{class:`ui-day__body`},this.status,this.content,u(`p`,{class:`ui-day__note`,text:qe})),this.tip),this.el.addEventListener(`click`,e=>{e.target===this.el&&this.close()}),this.el.addEventListener(`keydown`,e=>e.stopPropagation()),this.el.addEventListener(`close`,()=>this.onClosed()),this.el.addEventListener(`scroll`,()=>this.hideTip(),!0)}get isOpen(){return this.el.open}open(){this.el.open||(this.opener=document.activeElement instanceof HTMLElement?document.activeElement:null,this.day=null,this.el.showModal(),this.button.setAttribute(`aria-expanded`,`true`),this.load(!0))}close(){this.el.open&&this.el.close()}toggle(){this.el.open?this.close():this.open()}render(){let e=this.ctx.store.snapshot?.meta.demo;if(e===this.demoSeen)return;let t=this.demoSeen!==void 0;this.demoSeen=e,t&&this.el.open&&!this.ctx.store.mock&&this.load(!0)}onClosed(){this.seq++,this.stopTimer(),this.hideTip(),this.button.setAttribute(`aria-expanded`,`false`),this.opener?.isConnected&&this.opener.focus({preventScroll:!0}),this.opener=null}pickDay(e){this.day=e,this.sourcePref??=this.data?.source,this.load(!1)}pickSource(e){if(this.data?.source===e)return;this.sourcePref=e;let t=e===`demo`?this.days?.demoDays:this.days?.days;this.day&&t&&!t.includes(this.day)&&(this.day=null),this.load(!1)}async load(e){let n=++this.seq;this.stopTimer(),this.loading=!0,this.renderStatus();try{if(e||!this.days){let e=await this.source.days(this.tz);if(n!==this.seq)return;this.days=e,this.sourcePref===`demo`&&!e.demoAvailable&&(this.sourcePref=void 0)}let t=this.day??this.days.today,r=await this.source.day(t,this.tz,this.sourcePref);if(n!==this.seq)return;this.data=r,this.day=r.stats.day,this.error=null,this.renderAll()}catch(e){if(n!==this.seq)return;this.error=e instanceof Error?e.message:String(e),this.ctx.announce(t(`Não foi possível carregar as estatísticas do dia.`)),this.data&&(this.day=this.data.stats.day,this.renderControls(this.data))}finally{n===this.seq&&(this.loading=!1,this.renderStatus(),We(this.el.open,this.day??``,this.data?.today??``)&&(this.timer=setTimeout(()=>void this.load(!0),Ke)))}}stopTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}renderStatus(){if(this.el.classList.toggle(`is-loading`,this.loading&&!!this.data),d(this.retry,!this.error),this.error)l(this.statusText,t(`Não foi possível carregar as estatísticas ({0}).`,[this.error]));else if(this.loading&&!this.data)l(this.statusText,t(`Carregando…`));else if(this.data){let e=this.data.stats.day===this.data.today?t(`Atualizado às {0} · atualiza a cada 30 s`,[h(this.data.serverTime)]):``;l(this.statusText,[e,f(this.data,this.ctx.store.snapshot?.machines)].filter(Boolean).join(` · `))}}renderAll(){let e=this.data;if(!e)return;this.renderControls(e);let t=document.activeElement?.closest(`[data-focus-key]`)?.dataset.focusKey;this.hideTip(),this.content.replaceChildren(...this.sections(e)),t&&this.content.querySelector(`[data-focus-key="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})}renderControls(e){let t=e.source===`demo`;d(this.badge,!t),d(this.seg.el,!e.demoAvailable),this.seg.value=t?`demo`:`real`;let n=(t?this.days?.demoDays:this.days?.days)??[e.today],r=n.includes(e.stats.day)?n:[e.stats.day,...n];this.select.setOptions(r.map(t=>({value:t,label:Ve(t,e.today)})),e.stats.day),this.select.value=e.stats.day,this.select.disabled=r.length<2}sections(e){let n=e.stats,r=e=>h(e,!1),i=je(n,r,n.accounts.some(e=>this.isCodexAccount(e.id)&&e.counts.tokensIn+e.counts.tokensOut>0),this.ctx.store.snapshot?.machines),a=[this.kpis(i)];if(Ge(n)){let r=n.day===e.today;return a.push(u(`p`,{class:`ui-day__empty`,text:t(r?`Ainda não há tempo registrado hoje. Os números aparecem assim que algum agente trabalhar com o Habblaud aberto.`:`Nada registrado neste dia.`)})),a}return a.push(this.legend()),a.push(this.hoursCard(e)),a.push(this.roomsCard(Me(n.rooms,this.visible))),a.push(this.waitsCard(Re(n.waits,r,this.ctx.store.snapshot?.machines),e)),a.push(this.accountsCard(e)),a}kpis(e){let n=u(`span`,{class:`ui-day__swatch is-waiting`,attrs:{"aria-hidden":`true`}}),r=u(`div`,{class:`ui-day__hero`},u(`p`,{class:`ui-day__kpi-label`},n,u(`span`,{text:t(`Esperando você`)})),u(`p`,{class:`ui-day__hero-value`,text:e.waiting}),u(`p`,{class:`ui-day__kpi-sub`,text:e.waits}),e.longest?u(`p`,{class:`ui-day__kpi-sub`},u(`span`,{class:`ui-day__muted`,text:t(`Maior espera: `)}),u(`strong`,{text:e.longest})):null,e.wall?u(`p`,{class:`ui-day__kpi-sub`,text:e.wall}):null),i=(e,t,n,r,i)=>u(`div`,{class:`ui-day__kpi`,title:r},u(`p`,{class:`ui-day__kpi-label`},i?u(`span`,{class:`ui-day__swatch is-${i}`,attrs:{"aria-hidden":`true`}}):null,u(`span`,{text:e})),u(`p`,{class:`ui-day__kpi-value`,text:t}),u(`p`,{class:`ui-day__kpi-sub`,text:n}));return u(`section`,{class:`ui-day__kpis`,attrs:{"aria-label":t(`Destaques do dia`)}},r,i(t(`Trabalhando`),e.working,t(`soma do tempo de todos os agentes`),void 0,`working`),i(t(`Sessões`),e.sessions,e.subagents),i(t(`Pedidos`),e.prompts,e.activity),i(`Tokens`,e.tokens,e.tokensDetail),i(t(`Custo`),e.cost,e.costHint,e.costHint))}legend(){let e=O.map(e=>{let n=this.visible.has(e);return u(`button`,{class:`ui-day__key${n?``:` is-off`}`,type:`button`,title:t(n?`Esconder “{0}” dos gráficos`:`Mostrar “{0}” nos gráficos`,[Z[e]]),attrs:{"aria-pressed":String(n),"data-focus-key":`key:${e}`},on:{click:()=>this.toggleStatus(e)}},u(`span`,{class:`ui-day__swatch is-${e}`,attrs:{"aria-hidden":`true`}}),u(`span`,{text:Z[e]}))});return u(`div`,{class:`ui-day__legend`,role:`group`,attrs:{"aria-label":t(`Status nos gráficos (clique para mostrar ou esconder)`)}},...e)}toggleStatus(e){if(this.visible.has(e)){if(this.visible.size===1)return;this.visible.delete(e)}else this.visible.add(e);this.renderAll()}card(e,n,r,i){let a=!!i&&this.tables.has(i),o=i?u(`button`,{class:`ui-link-btn ui-day__table-btn`,type:`button`,text:t(a?`Ver gráfico`:`Ver tabela`),attrs:{"aria-pressed":String(a),"data-focus-key":`table:${i}`},on:{click:()=>{this.tables.has(i)?this.tables.delete(i):this.tables.add(i),this.renderAll()}}}):null,s=u(`div`,{class:`ui-day__card-body`});return{el:u(`section`,{class:`ui-day__card ui-day__card--${e}`,attrs:{"aria-labelledby":`ui-day-${e}`}},u(`div`,{class:`ui-day__card-head`},u(`div`,{},u(`h3`,{text:n,attrs:{id:`ui-day-${e}`}}),u(`p`,{class:`ui-day__card-sub`,text:r})),o),s),body:s,showTable:a}}table(e,t,n){return u(`div`,{class:`ui-day__table-wrap`},u(`table`,{class:`ui-day__table`},u(`caption`,{class:`ui-sr`,text:n}),u(`thead`,{},u(`tr`,{},...e.map((e,t)=>u(`th`,{text:e,attrs:{scope:`col`,class:t?`is-num`:void 0}})))),u(`tbody`,{},...t.map(e=>u(`tr`,{},...e.map((e,t)=>t?u(`td`,{class:`is-num`,text:e}):u(`th`,{text:e,attrs:{scope:`row`}})))))))}hoursCard(e){let n=this.ctx.isNarrow(),{columns:r,axis:i}=Ie(e.stats.hours,this.visible,e.serverTime,n?6:3),a=this.card(`hours`,t(`Por hora`),t(`Tempo de agentes em cada hora do dia`),`hours`);if(a.showTable){let e=ze(r,e=>e.range,this.visible);return a.body.append(this.table([t(`Hora`),...e.head],e.rows,t(`Tempo de agentes por hora`))),a.el}let o=u(`div`,{class:`ui-day__grid`,attrs:{"aria-hidden":`true`}},...i.ticks.map(e=>u(`span`,{class:`ui-day__gridline`,style:`bottom:${e/i.max*100}%`},u(`span`,{class:`ui-day__tick`,text:Fe(e)})))),s=u(`div`,{class:`ui-day__cols`,role:`list`,attrs:{"aria-label":t(`Tempo de agentes por hora (setas para navegar)`)}}),c=r.findIndex(e=>e.now);c<0&&(c=0),r.forEach((e,t)=>s.append(this.column(e,t===c))),s.addEventListener(`keydown`,e=>this.moveFocus(e,s));let l=u(`div`,{class:`ui-day__xaxis`,attrs:{"aria-hidden":`true`}},...r.map(e=>u(`span`,{class:`ui-day__xlabel${e.now?` is-now`:``}`,text:e.tick||e.now&&!n?`${e.hour}h`:``})));return a.body.append(u(`div`,{class:`ui-day__plot`},o,s),l),a.el}column(e,n){let r=u(`span`,{class:`ui-day__stack`},...e.segments.map(e=>u(`span`,{class:`ui-day__seg is-${e.status}`,style:`height:${e.pct}%`,attrs:{"data-status":e.status}}))),i=u(`div`,{class:`ui-day__col${e.now?` is-now`:``}`,role:`listitem`,tabIndex:n?0:-1,attrs:{"aria-label":`${e.label}${e.now?t(` (agora)`):``}`,"data-focus-key":`hour:${e.t}`}},r);return this.bindTip(i,()=>`${e.range}${e.now?t(` · agora`):e.future?t(` · ainda não chegou`):``}`,()=>e.future?[]:[...O.filter(t=>this.visible.has(t)&&e.ms[t]>0).map(t=>({status:t,label:Z[t],value:Q(e.ms[t])})),{label:`Total`,value:Q(e.total)}],()=>r.lastElementChild??r),i}moveFocus(e,t){let n=[...t.children],r=n.indexOf(document.activeElement);if(r<0)return;let i=e.key===`ArrowRight`?r+1:e.key===`ArrowLeft`?r-1:e.key===`Home`?0:e.key===`End`?n.length-1:-2;if(i===-2)return;e.preventDefault();let a=n[Math.max(0,Math.min(n.length-1,i))];n.forEach(e=>e.tabIndex=e===a?0:-1),a.focus()}roomsCard(e){let n=this.card(`rooms`,t(`Por projeto`),t(`Ordenado pelo tempo esperando você`),`rooms`);if(!e.length)return n.body.append(u(`p`,{class:`ui-day__muted`,text:t(`Nenhum projeto com tempo neste dia.`)})),n.el;if(n.showTable){let r=ze(e,e=>e.name,this.visible);return n.body.append(this.table([t(`Projeto`),...r.head],r.rows,t(`Tempo de agentes por projeto`))),n.el}let r=u(`ul`,{class:`ui-day__bars`});for(let t of e){let e=u(`span`,{class:`ui-day__track`},...t.segments.map(e=>u(`span`,{class:`ui-day__seg is-${e.status}`,style:`width:${e.pct}%`,attrs:{"data-status":e.status}}))),n=u(`li`,{class:`ui-day__bar`,tabIndex:0,attrs:{"aria-label":t.label,"data-focus-key":`room:${t.id}`}},u(`span`,{class:`ui-day__bar-head`},u(`span`,{class:`ui-day__bar-name`,text:t.name,title:t.id}),u(`span`,{class:`ui-day__bar-value`},this.visible.has(`waiting`)?u(`strong`,{text:t.waiting}):null,u(`span`,{class:`ui-day__muted`,text:t.totalText}))),e);this.bindTip(n,()=>t.name,()=>[...O.filter(e=>this.visible.has(e)&&t.ms[e]>0).map(e=>({status:e,label:Z[e],value:Q(t.ms[e])})),{label:`Total`,value:Q($(t.ms,this.visible))}]),r.append(n)}return n.body.append(r),n.el}waitsCard(e,n){let r=this.card(`waits`,t(`Maiores esperas`),t(`Quanto tempo cada agente ficou de mão levantada esperando você`));if(!e.length)return r.body.append(u(`p`,{class:`ui-day__muted`,text:t(`Nenhuma espera por você neste dia.`)})),r.el;let i=new Map(n.stats.accounts.map(e=>[e.id,e])),a=u(`ol`,{class:`ui-day__waits`});for(let n of e){let e=i.get(n.account),r=u(`span`,{class:`ui-acc-chip`,text:e?.short??`?`,title:e?.name??n.account});s(r,`--acc`,e?.color??`#8b98b3`),this.isCodexAccount(n.account)&&(r.dataset.provider=`codex`),a.append(u(`li`,{class:`ui-day__wait${n.ongoing?` is-ongoing`:``}`,attrs:{"aria-label":n.label}},u(`span`,{class:`ui-day__rank`,text:`${n.rank}`,attrs:{"aria-hidden":`true`}}),u(`span`,{class:`ui-day__wait-main`,attrs:{"aria-hidden":`true`}},u(`span`,{class:`ui-day__wait-top`},u(`strong`,{class:`ui-day__wait-dur`,text:n.duration}),u(`span`,{class:`ui-day__wait-bar`},u(`span`,{class:`ui-day__seg is-waiting`,style:`width:${n.pct}%`})),n.ongoing?u(`span`,{class:`ui-day__now`,text:t(`esperando agora`)}):null),u(`span`,{class:`ui-day__wait-who`},r,u(`span`,{class:`ui-day__wait-name`,text:n.agentName}),u(`span`,{class:`ui-day__muted`,text:`${t(`em {0}`,[n.roomName])} · ${n.when}${n.reason?` · ${n.reason}`:``}`})))))}return r.body.append(a),r.el}accountsCard(e){let n=Le(e.stats.accounts,e=>this.isCodexAccount(e)),r=this.card(`accounts`,t(`Por conta`),t(`Cada conta na cor dela, com a fatia do tempo de trabalho do dia`));if(!n.length)return r.body.append(u(`p`,{class:`ui-day__muted`,text:t(`Nenhuma conta com tempo neste dia.`)})),r.el;let i=u(`div`,{class:`ui-day__accounts`});for(let e of n){let n=u(`span`,{class:`ui-acc-chip ui-acc-chip--md`,text:e.short,attrs:{"aria-hidden":`true`,...e.codex?{"data-provider":`codex`}:{}}});s(n,`--acc`,e.color);let r=u(`span`,{class:`ui-day__meter`,role:`img`,attrs:{"aria-label":e.shareText}},u(`span`,{class:`ui-day__meter-fill`,style:`width:${e.share}%`})),a=(e,t)=>[u(`dt`,{text:e}),u(`dd`,{text:t})],o=u(`article`,{class:`ui-day__account`,attrs:{"aria-label":e.name}},u(`div`,{class:`ui-day__account-head`},n,u(`strong`,{class:`ui-day__account-name`,text:e.name}),u(`span`,{class:`ui-day__muted`,text:e.sessions})),r,u(`p`,{class:`ui-day__kpi-sub`,text:e.shareText}),u(`dl`,{class:`ui-day__account-stats`},...a(t(`Trabalhando`),e.working),...a(t(`Esperando você`),e.waiting),...a(`Tokens`,e.tokens),...e.cost===null?[u(`dt`,{text:t(`Custo`)}),u(`dd`,{text:t(`só tokens`),title:t(`O Codex não grava custo, só tokens`)})]:a(t(`Custo`),e.cost)));s(o,`--acc`,e.color),i.append(o)}return r.body.append(i),r.el}isCodexAccount(e){return b(this.ctx.account(e),e)===`codex`}bindTip(e,t,n,r=()=>e){let i=e=>this.showTip(r(),t(),n(),e);e.addEventListener(`pointerenter`,e=>i(Qe(e.target))),e.addEventListener(`pointermove`,e=>i(Qe(e.target))),e.addEventListener(`pointerleave`,()=>this.hideTip()),e.addEventListener(`focus`,()=>i()),e.addEventListener(`blur`,()=>this.hideTip())}showTip(e,t,n,r){this.tip.replaceChildren(u(`p`,{class:`ui-day__tip-title`,text:t}),...n.map(e=>u(`p`,{class:`ui-day__tip-row${e.status&&e.status===r?` is-hl`:``}${e.status?``:` is-total`}`},u(`span`,{class:`ui-day__tip-key${e.status?` is-${e.status}`:``}`,attrs:{"aria-hidden":`true`}}),u(`strong`,{text:e.value}),u(`span`,{text:e.label})))),this.tip.hidden=!1;let i=this.el.getBoundingClientRect(),a=e.getBoundingClientRect(),o=this.tip.getBoundingClientRect(),s=Math.min(Math.max(8,a.left-i.left+a.width/2-o.width/2),i.width-o.width-8),c=a.top-i.top-o.height-8;c<8&&(c=a.bottom-i.top+8),this.tip.style.left=`${Math.round(s)}px`,this.tip.style.top=`${Math.round(c)}px`}hideTip(){this.tip.hidden=!0}};function Qe(e){let t=e instanceof HTMLElement?e.dataset.status:void 0;return t&&O.includes(t)?t:void 0}export{Ze as DayPanel};
@@ -1 +1 @@
1
- import{s as e}from"./main-CIX7XLHO.js";import{i as t,n,r}from"./room-name-DwJoEQRB.js";function i(e,t){if(!e||!t)return;let n=t.find(t=>t.id===e)?.label;return n===void 0?void 0:r(n)}function a(e,t){let n=i(e.machine,t);return n?`${n} · ${e.name}`:e.name}function o(e,n,r,i){let o=i?.machine??(e?t(e)?.machine:void 0);return a({name:i?.name??n,machine:o},r)}function s(e,t,n){return o(t,n,e.store.snapshot?.machines,t?e.agent(t):void 0)}function c(t,i){let a=t.custom&&t.id?n({...t,id:t.id}):t.name,o=t.machine?i?.find(e=>e.id===t.machine):void 0;if(!o)return{text:a,dim:!1};let s=`${r(o.label)} · ${a}`;return o.state===`offline`?{text:s,dim:!0,tag:e(`offline`)}:{text:s,dim:!1}}function l(t,n){let r=t;if(!r||r.partial!==!0)return``;let a=Array.isArray(r.unavailable)?r.unavailable.filter(e=>typeof e==`string`):[];if(!a.length)return e(`Algumas máquinas não responderam agora: a lista pode estar incompleta.`);let o=a.map(e=>i(e,n)??e).join(`, `);return e(`Algumas máquinas não responderam agora ({0}): a lista pode estar incompleta.`,[o])}function u(e,n){let r=t(e);if(!r||!n)return!0;let i=n.find(e=>e.id===r.machine);return!i||!(i.state===`offline`||i.pty&&!i.pty.enabled)}function d(n,r){let i=t(n);if(!i||!r)return{disabled:!1};let a=r.find(e=>e.id===i.machine);return a?a.state===`offline`?{disabled:!0,tooltip:e(`a máquina deste agente está offline`)}:a.pty&&!a.pty.enabled?{disabled:!0,tooltip:a.pty.reason??e(`desligado nesta máquina`)}:{disabled:!1}:{disabled:!1}}var f=(e,t)=>{e.textContent=t};function p(e){f=e}function m(e,t={},...n){let r=document.createElement(e);if(t.class&&(r.className=t.class),t.text!==void 0&&f(r,t.text),t.title&&(e===`iframe`||e===`option`?r.title=t.title:r.setAttribute(`data-tip`,t.title)),t.style&&r.setAttribute(`style`,t.style),t.role&&r.setAttribute(`role`,t.role),t.tabIndex!==void 0&&(r.tabIndex=t.tabIndex),t.hidden&&(r.hidden=!0),t.type&&r.setAttribute(`type`,t.type),t.attrs)for(let[n,i]of Object.entries(t.attrs))i!==void 0&&i!==!1&&(n===`title`&&e!==`iframe`&&e!==`option`?r.setAttribute(`data-tip`,i===!0?``:String(i)):r.setAttribute(n,i===!0?``:String(i)));if(t.on)for(let[e,n]of Object.entries(t.on))r.addEventListener(e,n);for(let e of n)e!=null&&e!==!1&&r.append(e);return r}function h(e,t,n,r=``){let i=m(`button`,{class:`ui-icon-btn ${r}`.trim(),type:`button`,title:t,attrs:{"aria-label":t},on:{click:n}});return i.innerHTML=e,i}function g(e,t){let n=typeof document<`u`&&document.documentElement?.clientWidth||(typeof window<`u`?window.innerWidth:0),r=typeof document<`u`&&document.documentElement?.clientHeight||(typeof window<`u`?window.innerHeight:0);e.style&&(e.style.left=`${Math.max(8,t.x)}px`,e.style.top=`${Math.max(8,t.y)}px`),e.showPopover?.();let i=e.getBoundingClientRect?.()??{width:0,height:0};e.style&&(e.style.left=`${Math.max(8,Math.min(t.x,n-i.width-8))}px`,e.style.top=`${Math.max(8,Math.min(t.y,r-i.height-8))}px`)}function _(e,t){e.textContent!==t&&f(e,t)}function v(e,t,n){n==null?e.hasAttribute(t)&&e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function y(e,t){if(e){if(e.tagName===`IFRAME`||e.tagName===`OPTION`){e.title!==t&&(e.title=t);return}typeof e.getAttribute==`function`&&(t?e.getAttribute(`data-tip`)!==t&&typeof e.setAttribute==`function`&&e.setAttribute(`data-tip`,t):e.getAttribute(`data-tip`)!==null&&typeof e.removeAttribute==`function`&&e.removeAttribute(`data-tip`),e.getAttribute(`title`)!==null&&typeof e.removeAttribute==`function`&&e.removeAttribute(`title`)),`title`in e&&e.title&&(e.title=``)}}function b(e,t,n){e.style.getPropertyValue(t)!==n&&e.style.setProperty(t,n)}function x(e,t){e.hidden!==t&&(e.hidden=t)}function S(e,t,n){let r=`__variant_${t}`,i=e,a=i[r];a!==n&&(a&&e.classList.remove(`${t}${a}`),e.classList.add(`${t}${n}`),i[r]=n)}function C(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function w(e,t,n=260){if(C()||typeof e.animate!=`function`||!e.isConnected){t();return}let r=e.offsetHeight;e.style.overflow=`hidden`,e.style.pointerEvents=`none`;let i=e.animate([{opacity:1,height:`${r}px`,transform:`translateX(0)`},{opacity:0,height:`${r}px`,transform:`translateX(-10px)`,offset:.55},{opacity:0,height:`0px`,marginTop:`0px`,marginBottom:`0px`,paddingTop:`0px`,paddingBottom:`0px`,transform:`translateX(-10px)`}],{duration:n,easing:`cubic-bezier(.4,0,.2,1)`,fill:`forwards`});i.onfinish=t,i.oncancel=t}function T(e){C()||(e.classList.add(`is-entering`),e.addEventListener(`animationend`,()=>e.classList.remove(`is-entering`),{once:!0}))}var E=class{container;opts;nodes=new Map;leaving=new Map;initialized=!1;constructor(e,t){this.container=e,this.opts=t}get size(){return this.nodes.size}get(e){return this.nodes.get(e)}keys(){return this.nodes.keys()}sync(e){let t=this.opts.animate!==!1&&this.initialized,n=new Set,r=new Set(e.map(e=>this.opts.key(e))),i=this.container.firstChild,a=()=>{for(;i&&(this.isLeaving(i)||!r.has(i.dataset?.key??``));)i=i.nextSibling};for(let r of e){let e=this.opts.key(r);if(n.has(e))continue;n.add(e);let o=this.nodes.get(e);if(!o){let n=this.leaving.get(e);n&&(n.getAnimations?.().forEach(e=>e.cancel()),n.remove(),this.leaving.delete(e)),o=this.opts.create(r),o.dataset.key=e,this.nodes.set(e,o),t&&T(o)}this.opts.update(o,r),a(),i===o?i=o.nextSibling:this.container.insertBefore(o,i)}for(let[e,r]of this.nodes)if(!n.has(e)){if(this.nodes.delete(e),!t){r.remove();continue}this.leaving.set(e,r),r.classList.add(`is-leaving`),w(r,()=>{this.leaving.get(e)===r&&this.leaving.delete(e),r.remove()})}this.initialized=!0}clear(){for(let e of this.nodes.values())e.remove();for(let e of this.leaving.values())e.remove();this.nodes.clear(),this.leaving.clear(),this.initialized=!1}isLeaving(e){return e instanceof HTMLElement&&e.classList.contains(`is-leaving`)}};function D(e){return typeof e?.clipboard?.writeText==`function`?`api-then-legacy`:`legacy`}async function O(e){if(D(typeof navigator>`u`?void 0:navigator)===`api-then-legacy`)try{return await navigator.clipboard.writeText(e),!0}catch{}let t=m(`textarea`,{style:`position:fixed;opacity:0;pointer-events:none`});t.value=e;let n=document.activeElement instanceof HTMLElement?document.activeElement:null;(n?.closest(`dialog[open]`)??document.body).append(t),t.select();let r=!1;try{r=document.execCommand(`copy`)}catch{r=!1}return t.remove(),n?.focus(),r}export{o as _,C as a,d as b,b as c,y as d,S as f,s as g,u as h,h as i,_ as l,a as m,O as n,v as o,g as p,m as r,x as s,E as t,p as u,l as v,c as y};
1
+ import{s as e}from"./main-CJZNyhMz.js";import{i as t,n,r}from"./room-name-CSxOS6Qg.js";function i(e,t){if(!e||!t)return;let n=t.find(t=>t.id===e)?.label;return n===void 0?void 0:r(n)}function a(e,t){let n=i(e.machine,t);return n?`${n} · ${e.name}`:e.name}function o(e,n,r,i){let o=i?.machine??(e?t(e)?.machine:void 0);return a({name:i?.name??n,machine:o},r)}function s(e,t,n){return o(t,n,e.store.snapshot?.machines,t?e.agent(t):void 0)}function c(t,i){let a=t.custom&&t.id?n({...t,id:t.id}):t.name,o=t.machine?i?.find(e=>e.id===t.machine):void 0;if(!o)return{text:a,dim:!1};let s=`${r(o.label)} · ${a}`;return o.state===`offline`?{text:s,dim:!0,tag:e(`offline`)}:{text:s,dim:!1}}function l(t,n){let r=t;if(!r||r.partial!==!0)return``;let a=Array.isArray(r.unavailable)?r.unavailable.filter(e=>typeof e==`string`):[];if(!a.length)return e(`Algumas máquinas não responderam agora: a lista pode estar incompleta.`);let o=a.map(e=>i(e,n)??e).join(`, `);return e(`Algumas máquinas não responderam agora ({0}): a lista pode estar incompleta.`,[o])}function u(e,n){let r=t(e);if(!r||!n)return!0;let i=n.find(e=>e.id===r.machine);return!i||!(i.state===`offline`||i.pty&&!i.pty.enabled)}function d(n,r){let i=t(n);if(!i||!r)return{disabled:!1};let a=r.find(e=>e.id===i.machine);return a?a.state===`offline`?{disabled:!0,tooltip:e(`a máquina deste agente está offline`)}:a.pty&&!a.pty.enabled?{disabled:!0,tooltip:a.pty.reason??e(`desligado nesta máquina`)}:{disabled:!1}:{disabled:!1}}var f=(e,t)=>{e.textContent=t};function p(e){f=e}function m(e,t={},...n){let r=document.createElement(e);if(t.class&&(r.className=t.class),t.text!==void 0&&f(r,t.text),t.title&&(e===`iframe`||e===`option`?r.title=t.title:r.setAttribute(`data-tip`,t.title)),t.style&&r.setAttribute(`style`,t.style),t.role&&r.setAttribute(`role`,t.role),t.tabIndex!==void 0&&(r.tabIndex=t.tabIndex),t.hidden&&(r.hidden=!0),t.type&&r.setAttribute(`type`,t.type),t.attrs)for(let[n,i]of Object.entries(t.attrs))i!==void 0&&i!==!1&&(n===`title`&&e!==`iframe`&&e!==`option`?r.setAttribute(`data-tip`,i===!0?``:String(i)):r.setAttribute(n,i===!0?``:String(i)));if(t.on)for(let[e,n]of Object.entries(t.on))r.addEventListener(e,n);for(let e of n)e!=null&&e!==!1&&r.append(e);return r}function h(e,t,n,r=``){let i=m(`button`,{class:`ui-icon-btn ${r}`.trim(),type:`button`,title:t,attrs:{"aria-label":t},on:{click:n}});return i.innerHTML=e,i}function g(e,t){let n=typeof document<`u`&&document.documentElement?.clientWidth||(typeof window<`u`?window.innerWidth:0),r=typeof document<`u`&&document.documentElement?.clientHeight||(typeof window<`u`?window.innerHeight:0);e.style&&(e.style.left=`${Math.max(8,t.x)}px`,e.style.top=`${Math.max(8,t.y)}px`),e.showPopover?.();let i=e.getBoundingClientRect?.()??{width:0,height:0};e.style&&(e.style.left=`${Math.max(8,Math.min(t.x,n-i.width-8))}px`,e.style.top=`${Math.max(8,Math.min(t.y,r-i.height-8))}px`)}function _(e,t){e.textContent!==t&&f(e,t)}function v(e,t,n){n==null?e.hasAttribute(t)&&e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function y(e,t){if(e){if(e.tagName===`IFRAME`||e.tagName===`OPTION`){e.title!==t&&(e.title=t);return}typeof e.getAttribute==`function`&&(t?e.getAttribute(`data-tip`)!==t&&typeof e.setAttribute==`function`&&e.setAttribute(`data-tip`,t):e.getAttribute(`data-tip`)!==null&&typeof e.removeAttribute==`function`&&e.removeAttribute(`data-tip`),e.getAttribute(`title`)!==null&&typeof e.removeAttribute==`function`&&e.removeAttribute(`title`)),`title`in e&&e.title&&(e.title=``)}}function b(e,t,n){e.style.getPropertyValue(t)!==n&&e.style.setProperty(t,n)}function x(e,t){e.hidden!==t&&(e.hidden=t)}function S(e,t,n){let r=`__variant_${t}`,i=e,a=i[r];a!==n&&(a&&e.classList.remove(`${t}${a}`),e.classList.add(`${t}${n}`),i[r]=n)}function C(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function w(e,t,n=260){if(C()||typeof e.animate!=`function`||!e.isConnected){t();return}let r=e.offsetHeight;e.style.overflow=`hidden`,e.style.pointerEvents=`none`;let i=e.animate([{opacity:1,height:`${r}px`,transform:`translateX(0)`},{opacity:0,height:`${r}px`,transform:`translateX(-10px)`,offset:.55},{opacity:0,height:`0px`,marginTop:`0px`,marginBottom:`0px`,paddingTop:`0px`,paddingBottom:`0px`,transform:`translateX(-10px)`}],{duration:n,easing:`cubic-bezier(.4,0,.2,1)`,fill:`forwards`});i.onfinish=t,i.oncancel=t}function T(e){C()||(e.classList.add(`is-entering`),e.addEventListener(`animationend`,()=>e.classList.remove(`is-entering`),{once:!0}))}var E=class{container;opts;nodes=new Map;leaving=new Map;initialized=!1;constructor(e,t){this.container=e,this.opts=t}get size(){return this.nodes.size}get(e){return this.nodes.get(e)}keys(){return this.nodes.keys()}sync(e){let t=this.opts.animate!==!1&&this.initialized,n=new Set,r=new Set(e.map(e=>this.opts.key(e))),i=this.container.firstChild,a=()=>{for(;i&&(this.isLeaving(i)||!r.has(i.dataset?.key??``));)i=i.nextSibling};for(let r of e){let e=this.opts.key(r);if(n.has(e))continue;n.add(e);let o=this.nodes.get(e);if(!o){let n=this.leaving.get(e);n&&(n.getAnimations?.().forEach(e=>e.cancel()),n.remove(),this.leaving.delete(e)),o=this.opts.create(r),o.dataset.key=e,this.nodes.set(e,o),t&&T(o)}this.opts.update(o,r),a(),i===o?i=o.nextSibling:this.container.insertBefore(o,i)}for(let[e,r]of this.nodes)if(!n.has(e)){if(this.nodes.delete(e),!t){r.remove();continue}this.leaving.set(e,r),r.classList.add(`is-leaving`),w(r,()=>{this.leaving.get(e)===r&&this.leaving.delete(e),r.remove()})}this.initialized=!0}clear(){for(let e of this.nodes.values())e.remove();for(let e of this.leaving.values())e.remove();this.nodes.clear(),this.leaving.clear(),this.initialized=!1}isLeaving(e){return e instanceof HTMLElement&&e.classList.contains(`is-leaving`)}};function D(e){return typeof e?.clipboard?.writeText==`function`?`api-then-legacy`:`legacy`}async function O(e){if(D(typeof navigator>`u`?void 0:navigator)===`api-then-legacy`)try{return await navigator.clipboard.writeText(e),!0}catch{}let t=m(`textarea`,{style:`position:fixed;opacity:0;pointer-events:none`});t.value=e;let n=document.activeElement instanceof HTMLElement?document.activeElement:null;(n?.closest(`dialog[open]`)??document.body).append(t),t.select();let r=!1;try{r=document.execCommand(`copy`)}catch{r=!1}return t.remove(),n?.focus(),r}export{o as _,C as a,d as b,b as c,y as d,S as f,s as g,u as h,h as i,_ as l,a as m,O as n,v as o,g as p,m as r,x as s,E as t,p as u,l as v,c as y};
@@ -1 +1 @@
1
- import{a as e,s as t}from"./main-CIX7XLHO.js";var n=1e3,r=60*n,i=60*r,a=24*i,o=e(),s=new Intl.NumberFormat(o,{maximumFractionDigits:1}),c=new Intl.NumberFormat(o,{maximumFractionDigits:0}),l=new Intl.NumberFormat(o,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),u=new Intl.DateTimeFormat(o,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),d=new Intl.DateTimeFormat(o,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),f=new Intl.DateTimeFormat(o,{weekday:`short`}),p=new Intl.DateTimeFormat(o,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function m(e,o){let s=o-e;return!Number.isFinite(s)||s<5*n?t(`agora`):s<r?t(`há {0} s`,[Math.floor(s/n)]):s<i?t(`há {0} min`,[Math.floor(s/r)]):s<a?t(`há {0} h`,[Math.floor(s/i)]):t(`há {0} d`,[Math.floor(s/a)])}function h(e){let t=Math.max(0,e);if(t<r)return`${Math.floor(t/n)} s`;if(t<i)return`${Math.floor(t/r)} min`;if(t<a){let e=Math.floor(t/i),n=Math.floor(t%i/r);return n?`${e} h ${n} min`:`${e} h`}let o=Math.floor(t/a),s=Math.floor(t%a/i);return s?`${o} d ${s} h`:`${o} d`}function g(e){let t=Number.isFinite(e)?Math.max(0,e):0;if(t>=a)return h(t);let r=Math.floor(t/n),i=Math.floor(r/3600),o=Math.floor(r%3600/60),s=String(r%60).padStart(2,`0`);return i>0?`${i}:${String(o).padStart(2,`0`)}:${s}`:`${o}:${s}`}function _(e,n){let i=e-n;return i<=0?t(`agora`):i<r?t(`em menos de 1 min`):`em ${h(i)}`}function v(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function y(e,t){return Math.round((v(e)-v(t))/a)}function b(e,n){if(!Number.isFinite(e)||e<=n)return``;let r=u.format(e),i=y(e,n);return i<=0?t(`às {0}`,[r]):i===1?t(`amanhã às {0}`,[r]):`${f.format(e)}, ${r}`}function x(e){let t=Math.max(0,e);if(t<r)return`${Math.floor(t/n)}s`;if(t<i)return`${Math.floor(t/r)}min`;if(t<a){let e=Math.floor(t/i),n=Math.floor(t%i/r);return n?`${e}h${String(n).padStart(2,`0`)}`:`${e}h`}let o=Math.floor(t/a),s=Math.floor(t%a/i);return s?`${o}d${s}h`:`${o}d`}var S=5*i,C=7*a;function w(e,n,r,i){if(!e)return null;let o=e.resetsAt!==void 0&&Number.isFinite(e.resetsAt)?e.resetsAt:void 0;if(o===void 0?r-n>=i:o<=r)return{pct:null,renewed:!0,reset:t(`renovada`),resetShort:t(`renovada`),summary:t(`renovada depois da última leitura (uso atual desconhecido)`)};let s=j(e.utilization);if(o===void 0)return{pct:s,renewed:!1,reset:``,resetShort:``,summary:t(`{0}% usado`,[s])};let c=o-r,l;if(c<a)l=_(o,r);else{let e=u.format(o);l=y(o,r)===1?t(`amanhã, {0}`,[e]):`${f.format(o)}, ${e}`}let d=b(o,r);return{pct:s,renewed:!1,reset:l,resetShort:x(c),summary:t(`{0}% usado · reinicia {1} ({2})`,[s,d,_(o,r)])}}function T(e,t,n=o){let r=new Intl.DateTimeFormat(n,{hour:`numeric`,minute:`2-digit`}).format(e),i=-y(e,t);return i<=0?r:i<=6?`${new Intl.DateTimeFormat(n,{weekday:`long`}).format(e)} ${r}`:`${new Intl.DateTimeFormat(n,{day:`numeric`,month:`short`}).format(e).replace(/\./g,``)} ${r}`}function E(e,t=!0){return(t?d:u).format(e)}function D(e){return p.format(e)}function O(e){let t=Math.max(0,e);return t<1e3?c.format(t):t<1e6?`${s.format(t/1e3)} k`:`${s.format(t/1e6)} M`}function k(e){return c.format(e)}function A(e){return l.format(e).replace(/ /g,` `)}function j(e){return e===void 0||!Number.isFinite(e)?0:Math.round(Math.min(100,Math.max(0,e)))}function M(e){return e>=80?`crit`:e>=50?`warn`:`ok`}function N(e,t,n){return`${k(e)} ${e===1?t:n}`}function P(e){return e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase().trim()}function F(e){if(!e)return`—`;let t=/^gpt-(\d+(?:\.\d+)?[a-z]?)((?:-[a-z][a-z0-9]*)*)$/i.exec(e);if(t){let e=t[2].split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());return[`GPT-${t[1]}`,...e].join(` `)}let n=/claude-(?:(\d{1,2}(?:-\d{1,2})?)-)?([a-z]+)(?:-(\d{1,2})(?!\d)(?:-(\d{1,2})(?!\d))?)?/i.exec(e);if(!n)return e;let r=n[2].charAt(0).toUpperCase()+n[2].slice(1).toLowerCase(),i=n[1]?n[1].replace(`-`,`.`):n[3]?n[4]?`${n[3]}.${n[4]}`:n[3]:``;return i?`${r} ${i}`:r}var I={default:t(`Padrão (pergunta)`),acceptEdits:t(`Aceita edições`),plan:t(`Modo plano`),bypassPermissions:t(`Sem confirmações`),dontAsk:t(`Não pergunta`),auto:t(`Automático`)};function L(e){return e?I[e]??e:`—`}function R(e){return e.replace(/^\/(?:Users|home)\/[^/]+(?=\/|$)/,`~`).replace(/^[A-Za-z]:\\Users\\[^\\]+(?=\\|$)/,`~`)}export{R as _,D as a,k as c,A as d,P as f,m as g,F as h,E as i,O as l,N as m,C as n,h as o,L as p,y as r,g as s,S as t,T as u,M as v,w as y};
1
+ import{a as e,s as t}from"./main-CJZNyhMz.js";var n=1e3,r=60*n,i=60*r,a=24*i,o=e(),s=new Intl.NumberFormat(o,{maximumFractionDigits:1}),c=new Intl.NumberFormat(o,{maximumFractionDigits:0}),l=new Intl.NumberFormat(o,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),u=new Intl.DateTimeFormat(o,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),d=new Intl.DateTimeFormat(o,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),f=new Intl.DateTimeFormat(o,{weekday:`short`}),p=new Intl.DateTimeFormat(o,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function m(e,o){let s=o-e;return!Number.isFinite(s)||s<5*n?t(`agora`):s<r?t(`há {0} s`,[Math.floor(s/n)]):s<i?t(`há {0} min`,[Math.floor(s/r)]):s<a?t(`há {0} h`,[Math.floor(s/i)]):t(`há {0} d`,[Math.floor(s/a)])}function h(e){let t=Math.max(0,e);if(t<r)return`${Math.floor(t/n)} s`;if(t<i)return`${Math.floor(t/r)} min`;if(t<a){let e=Math.floor(t/i),n=Math.floor(t%i/r);return n?`${e} h ${n} min`:`${e} h`}let o=Math.floor(t/a),s=Math.floor(t%a/i);return s?`${o} d ${s} h`:`${o} d`}function g(e){let t=Number.isFinite(e)?Math.max(0,e):0;if(t>=a)return h(t);let r=Math.floor(t/n),i=Math.floor(r/3600),o=Math.floor(r%3600/60),s=String(r%60).padStart(2,`0`);return i>0?`${i}:${String(o).padStart(2,`0`)}:${s}`:`${o}:${s}`}function _(e,n){let i=e-n;return i<=0?t(`agora`):i<r?t(`em menos de 1 min`):`em ${h(i)}`}function v(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function y(e,t){return Math.round((v(e)-v(t))/a)}function b(e,n){if(!Number.isFinite(e)||e<=n)return``;let r=u.format(e),i=y(e,n);return i<=0?t(`às {0}`,[r]):i===1?t(`amanhã às {0}`,[r]):`${f.format(e)}, ${r}`}function x(e){let t=Math.max(0,e);if(t<r)return`${Math.floor(t/n)}s`;if(t<i)return`${Math.floor(t/r)}min`;if(t<a){let e=Math.floor(t/i),n=Math.floor(t%i/r);return n?`${e}h${String(n).padStart(2,`0`)}`:`${e}h`}let o=Math.floor(t/a),s=Math.floor(t%a/i);return s?`${o}d${s}h`:`${o}d`}var S=5*i,C=7*a;function w(e,n,r,i){if(!e)return null;let o=e.resetsAt!==void 0&&Number.isFinite(e.resetsAt)?e.resetsAt:void 0;if(o===void 0?r-n>=i:o<=r)return{pct:null,renewed:!0,reset:t(`renovada`),resetShort:t(`renovada`),summary:t(`renovada depois da última leitura (uso atual desconhecido)`)};let s=j(e.utilization);if(o===void 0)return{pct:s,renewed:!1,reset:``,resetShort:``,summary:t(`{0}% usado`,[s])};let c=o-r,l;if(c<a)l=_(o,r);else{let e=u.format(o);l=y(o,r)===1?t(`amanhã, {0}`,[e]):`${f.format(o)}, ${e}`}let d=b(o,r);return{pct:s,renewed:!1,reset:l,resetShort:x(c),summary:t(`{0}% usado · reinicia {1} ({2})`,[s,d,_(o,r)])}}function T(e,t,n=o){let r=new Intl.DateTimeFormat(n,{hour:`numeric`,minute:`2-digit`}).format(e),i=-y(e,t);return i<=0?r:i<=6?`${new Intl.DateTimeFormat(n,{weekday:`long`}).format(e)} ${r}`:`${new Intl.DateTimeFormat(n,{day:`numeric`,month:`short`}).format(e).replace(/\./g,``)} ${r}`}function E(e,t=!0){return(t?d:u).format(e)}function D(e){return p.format(e)}function O(e){let t=Math.max(0,e);return t<1e3?c.format(t):t<1e6?`${s.format(t/1e3)} k`:`${s.format(t/1e6)} M`}function k(e){return c.format(e)}function A(e){return l.format(e).replace(/ /g,` `)}function j(e){return e===void 0||!Number.isFinite(e)?0:Math.round(Math.min(100,Math.max(0,e)))}function M(e){return e>=80?`crit`:e>=50?`warn`:`ok`}function N(e,t,n){return`${k(e)} ${e===1?t:n}`}function P(e){return e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase().trim()}function F(e){if(!e)return`—`;let t=/^gpt-(\d+(?:\.\d+)?[a-z]?)((?:-[a-z][a-z0-9]*)*)$/i.exec(e);if(t){let e=t[2].split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());return[`GPT-${t[1]}`,...e].join(` `)}let n=/claude-(?:(\d{1,2}(?:-\d{1,2})?)-)?([a-z]+)(?:-(\d{1,2})(?!\d)(?:-(\d{1,2})(?!\d))?)?/i.exec(e);if(!n)return e;let r=n[2].charAt(0).toUpperCase()+n[2].slice(1).toLowerCase(),i=n[1]?n[1].replace(`-`,`.`):n[3]?n[4]?`${n[3]}.${n[4]}`:n[3]:``;return i?`${r} ${i}`:r}var I={default:t(`Padrão (pergunta)`),acceptEdits:t(`Aceita edições`),plan:t(`Modo plano`),bypassPermissions:t(`Sem confirmações`),dontAsk:t(`Não pergunta`),auto:t(`Automático`)};function L(e){return e?I[e]??e:`—`}function R(e){return e.replace(/^\/(?:Users|home)\/[^/]+(?=\/|$)/,`~`).replace(/^[A-Za-z]:\\Users\\[^\\]+(?=\\|$)/,`~`)}export{R as _,D as a,k as c,A as d,P as f,m as g,F as h,E as i,O as l,N as m,C as n,h as o,L as p,y as r,g as s,S as t,T as u,M as v,w as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["bundle/app-9Vl0ffKz.js","bundle/simulator-mIkQohaY.js","bundle/world-model-BCuCi4WK.js","bundle/format-Cq9YWBaH.js","bundle/room-name-DwJoEQRB.js","bundle/dom-DTQ3fgr0.js","bundle/app-BvE-Y-Qm.css"])))=>i.map(i=>d[i]);
2
- (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={},t=[{id:`pt-BR`,name:`Português`},{id:`en`,name:`English`},{id:`es`,name:`Español`},{id:`fr`,name:`Français`}],n=`habblaud:locale`,r={...e};function i(e,t){r[e]=t}function a(e){let t=(e??``).trim().toLowerCase().replace(`_`,`-`);if(t){if(t===`fr`||t.startsWith(`fr-`))return`fr`;if(t===`pt`||t.startsWith(`pt-`))return`pt-BR`;if(t===`en`||t.startsWith(`en-`))return`en`;if(t===`es`||t.startsWith(`es-`))return`es`}}function o(e,t){let n=a(e.HABBLAUD_LANG);if(n)return n;for(let n of[e.LC_ALL,e.LC_MESSAGES,e.LANG,t]){let e=a(n);if(e)return e}return`en`}function s(e,t){let n=a(e);if(n)return n;for(let e of t){let t=a(e);if(t)return t}return`en`}function c(){let e=globalThis;if(e.window!==void 0){let t=null;try{t=e.localStorage?.getItem(`habblaud:locale`)??null}catch{}return s(t,e.navigator?.languages??[e.navigator?.language??``])}let t=e.process?.env??{};if(t.VITEST)return a(t.HABBLAUD_LANG_TEST)??`pt-BR`;let n;try{n=Intl.DateTimeFormat().resolvedOptions().locale}catch{n=void 0}return o(t,n)}var l=c();function u(){return l}var d=/\bHabblaud\b(?!\s*World)/g;function f(e,t){let n=r[l],i=n&&n[e]||e.replace(d,`Busybits`);return!t||t.length===0?i:i.replace(/\{(\d+)\}/g,(e,n)=>Number(n)<t.length?String(t[Number(n)]):e)}function p(){return l===`fr`?`fr-FR`:l===`en`?`en-US`:l===`es`?`es`:`pt-BR`}var m=`modulepreload`,h=function(e){return`/`+e},g={},_=function(e){return e.pathname.endsWith(`.css`)},v=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},y=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=h(t,n);let r=s(t),i=_(r);return v(g,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:m,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},b={en:()=>y(()=>import(`./en-ChmFNZf9.js`).then(e=>e.EN),[]),es:()=>y(()=>import(`./es-Dxz3P98Y.js`).then(e=>e.ES),[]),fr:()=>y(()=>import(`./fr-CINcBINu.js`).then(e=>e.FR),[])},x=u(),S=b[x];(S?S().then(e=>i(x,e)).catch(()=>void 0):Promise.resolve()).then(()=>y(()=>import(`./app-9Vl0ffKz.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6]))).then(e=>e.start());export{p as a,u as i,t as n,a as o,n as r,f as s,y as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["bundle/app-D5bRv3Io.js","bundle/simulator-DSTKHVKF.js","bundle/world-model-DIM3eqSC.js","bundle/format-DrvIRA6J.js","bundle/room-name-CSxOS6Qg.js","bundle/dom-BZgsJMv9.js","bundle/app-BODKiLC2.css"])))=>i.map(i=>d[i]);
2
+ (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={},t=[{id:`pt-BR`,name:`Português`},{id:`en`,name:`English`},{id:`es`,name:`Español`},{id:`fr`,name:`Français`}],n=`habblaud:locale`,r={...e};function i(e,t){r[e]=t}function a(e){let t=(e??``).trim().toLowerCase().replace(`_`,`-`);if(t){if(t===`fr`||t.startsWith(`fr-`))return`fr`;if(t===`pt`||t.startsWith(`pt-`))return`pt-BR`;if(t===`en`||t.startsWith(`en-`))return`en`;if(t===`es`||t.startsWith(`es-`))return`es`}}function o(e,t){let n=a(e.HABBLAUD_LANG);if(n)return n;for(let n of[e.LC_ALL,e.LC_MESSAGES,e.LANG,t]){let e=a(n);if(e)return e}return`en`}function s(e,t){let n=a(e);if(n)return n;for(let e of t){let t=a(e);if(t)return t}return`en`}function c(){let e=globalThis;if(e.window!==void 0){let t=null;try{t=e.localStorage?.getItem(`habblaud:locale`)??null}catch{}return s(t,e.navigator?.languages??[e.navigator?.language??``])}let t=e.process?.env??{};if(t.VITEST)return a(t.HABBLAUD_LANG_TEST)??`pt-BR`;let n;try{n=Intl.DateTimeFormat().resolvedOptions().locale}catch{n=void 0}return o(t,n)}var l=c();function u(){return l}var d=/\bHabblaud\b(?!\s*World)/g;function f(e,t){let n=r[l],i=n&&n[e]||e.replace(d,`Busybits`);return!t||t.length===0?i:i.replace(/\{(\d+)\}/g,(e,n)=>Number(n)<t.length?String(t[Number(n)]):e)}function p(){return l===`fr`?`fr-FR`:l===`en`?`en-US`:l===`es`?`es`:`pt-BR`}var m=`modulepreload`,h=function(e){return`/`+e},g={},_=function(e){return e.pathname.endsWith(`.css`)},v=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},y=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=h(t,n);let r=s(t),i=_(r);return v(g,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:m,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},b={en:()=>y(()=>import(`./en-ChmFNZf9.js`).then(e=>e.EN),[]),es:()=>y(()=>import(`./es-Dxz3P98Y.js`).then(e=>e.ES),[]),fr:()=>y(()=>import(`./fr-CINcBINu.js`).then(e=>e.FR),[])},x=u(),S=b[x];(S?S().then(e=>i(x,e)).catch(()=>void 0):Promise.resolve()).then(()=>y(()=>import(`./app-D5bRv3Io.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6]))).then(e=>e.start());export{p as a,u as i,t as n,a as o,n as r,f as s,y as t};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./main-CIX7XLHO.js";import{p as t}from"./app-9Vl0ffKz.js";var n=2,r=1,i=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(i.getPropertyValue(`height`)),o=Math.max(0,parseInt(i.getPropertyValue(`width`))),s=window.getComputedStyle(this._terminal.element),c={top:parseInt(s.getPropertyValue(`padding-top`)),bottom:parseInt(s.getPropertyValue(`padding-bottom`)),right:parseInt(s.getPropertyValue(`padding-right`)),left:parseInt(s.getPropertyValue(`padding-left`))},l=c.top+c.bottom,u=c.right+c.left,d=a-l,f=o-u-t;return{cols:Math.max(n,Math.floor(f/e.css.cell.width)),rows:Math.max(r,Math.floor(d/e.css.cell.height))}}},a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,r)=>{for(var i=r>1?void 0:r?o(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(r?c(t,n,i):c(i))||i);return r&&i&&a(t,n,i),i},l=(e,t)=>(n,r)=>t(n,r,e),u=`Terminal input`,d={get:()=>u,set:e=>u=e},f=`Too much output to announce, navigate to rows manually to read`,p={get:()=>f,set:e=>f=e};function m(e){return e.replace(/\r?\n/g,`\r`)}function h(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function g(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function _(e,t,n,r){e.stopPropagation(),e.clipboardData&&ee(e.clipboardData.getData(`text/plain`),t,n,r)}function ee(e,t,n,r){e=m(e),e=h(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function te(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ne(e,t,n,r,i){te(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function re(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ie(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ae=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},oe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},se=``,ce=` `,le=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ue}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ue=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},v=class e extends le{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ue,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?re(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},de=`di$target`,y=`di$dependencies`,fe=new Map;function pe(e){return e[y]||[]}function b(e){if(fe.has(e))return fe.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);x(t,e,r)};return t._id=e,fe.set(e,t),t}function x(e,t,n){t[de]===t?t[y].push({id:e,index:n}):(t[y]=[{id:e,index:n}],t[de]=t)}var S=b(`BufferService`),me=b(`CoreMouseService`),he=b(`CoreService`),ge=b(`CharsetService`),_e=b(`InstantiationService`),C=b(`LogService`),w=b(`OptionsService`),T=b(`OscLinkService`),ve=b(`UnicodeService`),ye=b(`DecorationService`),be=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new v,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):xe(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};be=c([l(0,S),l(1,w),l(2,T)],be);function xe(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{s as e}from"./main-CJZNyhMz.js";import{p as t}from"./app-D5bRv3Io.js";var n=2,r=1,i=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(i.getPropertyValue(`height`)),o=Math.max(0,parseInt(i.getPropertyValue(`width`))),s=window.getComputedStyle(this._terminal.element),c={top:parseInt(s.getPropertyValue(`padding-top`)),bottom:parseInt(s.getPropertyValue(`padding-bottom`)),right:parseInt(s.getPropertyValue(`padding-right`)),left:parseInt(s.getPropertyValue(`padding-left`))},l=c.top+c.bottom,u=c.right+c.left,d=a-l,f=o-u-t;return{cols:Math.max(n,Math.floor(f/e.css.cell.width)),rows:Math.max(r,Math.floor(d/e.css.cell.height))}}},a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,r)=>{for(var i=r>1?void 0:r?o(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(r?c(t,n,i):c(i))||i);return r&&i&&a(t,n,i),i},l=(e,t)=>(n,r)=>t(n,r,e),u=`Terminal input`,d={get:()=>u,set:e=>u=e},f=`Too much output to announce, navigate to rows manually to read`,p={get:()=>f,set:e=>f=e};function m(e){return e.replace(/\r?\n/g,`\r`)}function h(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function g(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function _(e,t,n,r){e.stopPropagation(),e.clipboardData&&ee(e.clipboardData.getData(`text/plain`),t,n,r)}function ee(e,t,n,r){e=m(e),e=h(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function te(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ne(e,t,n,r,i){te(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function re(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ie(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ae=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},oe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},se=``,ce=` `,le=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ue}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ue=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},v=class e extends le{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ue,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?re(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},de=`di$target`,y=`di$dependencies`,fe=new Map;function pe(e){return e[y]||[]}function b(e){if(fe.has(e))return fe.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);x(t,e,r)};return t._id=e,fe.set(e,t),t}function x(e,t,n){t[de]===t?t[y].push({id:e,index:n}):(t[y]=[{id:e,index:n}],t[de]=t)}var S=b(`BufferService`),me=b(`CoreMouseService`),he=b(`CoreService`),ge=b(`CharsetService`),_e=b(`InstantiationService`),C=b(`LogService`),w=b(`OptionsService`),T=b(`OscLinkService`),ve=b(`UnicodeService`),ye=b(`DecorationService`),be=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new v,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):xe(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};be=c([l(0,S),l(1,w),l(2,T)],be);function xe(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Se=b(`CharSizeService`),E=b(`CoreBrowserService`),Ce=b(`MouseService`),we=b(`RenderService`),Te=b(`SelectionService`),Ee=b(`CharacterJoinerService`),De=b(`ThemeService`),Oe=b(`LinkProviderService`),ke=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Fe.isErrorNoTelemetry(e)?new Fe(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{s as e}from"./main-CIX7XLHO.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=e=>e===`agent-hub`||e===`gentle-shell-delegated`;function a(t){return t.id===`agent-hub`?e(`Agent Hub`):t.id===`gentle-shell-delegated`?e(`Gentle Shell`):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};
1
+ import{s as e}from"./main-CJZNyhMz.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=e=>e===`agent-hub`||e===`gentle-shell-delegated`;function a(t){return t.id===`agent-hub`?e(`Agent Hub`):t.id===`gentle-shell-delegated`?e(`Gentle Shell`):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};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./main-CIX7XLHO.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(`
1
+ import{s as e}from"./main-CJZNyhMz.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
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
3
  `)).join(`
4
4