From d2a99b8b0943460e27e90cfe3e67be9e639e9c96 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 26 Apr 2026 12:36:47 +0000 Subject: [PATCH 1/4] feat: add growing rate + floating token pop animation - Add getDynamicRate() to death-clock-core.js with 30% annual growth after BASE_DATE - Add RATE_GROWTH_PER_YEAR constant (0.30) - Update getCurrentTokens() to integrate the exponential rate for accuracy - Use getDynamicRate() in 02-counter.js for rate display and session tokens - Update rate subtitle to show "and growing" beyond BASE_DATE - Add spawnTokenPop(): spawns a "+N" floating element on the total counter every second - Add .token-pop CSS with @keyframes tokenPopFloat (float up 56px, fade out over 1.5s) - Change .counter-box overflow to visible so pops can float above the box - Add 9 unit tests for getDynamicRate and RATE_GROWTH_PER_YEAR - All 262 unit tests pass at 100% coverage; all 68 E2E tests pass Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/1579b618-82e8-4125-b282-8ddddafa27eb Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- death-clock-core.js | 26 +++++++++++++++ script.js | 60 ++++++++++++++++----------------- src/js/00-state.js | 10 ++++-- src/js/02-counter.js | 40 ++++++++++++++++++---- styles.css | 2 +- styles/counter-milestones.css | 24 +++++++++++++- tests/death-clock.test.js | 62 +++++++++++++++++++++++++++++++++++ 7 files changed, 184 insertions(+), 40 deletions(-) diff --git a/death-clock-core.js b/death-clock-core.js index c31d0f3..1986de4 100644 --- a/death-clock-core.js +++ b/death-clock-core.js @@ -362,6 +362,30 @@ function getRateAtDate(date) { return RATE_SCHEDULE[0].ratePerSec; } +// Fractional annual growth applied to the token rate beyond BASE_DATE_ISO. +// Matches the observed ~30 % year-over-year acceleration in global AI inference. +const RATE_GROWTH_PER_YEAR = 0.30; + +/** + * Return the dynamic (ever-growing) global AI inference rate for a given date. + * For historical dates at or before BASE_DATE_ISO the result is identical to + * getRateAtDate(). For future dates beyond BASE_DATE_ISO the rate is projected + * forward using continuous exponential growth at RATE_GROWTH_PER_YEAR. + * + * @param {Date} [date] - defaults to now + * @returns {number} tokens per second (always a positive integer) + */ +function getDynamicRate(date) { + const d = (date instanceof Date && !isNaN(date.getTime())) ? date : new Date(); + const baseMs = new Date(BASE_DATE_ISO).getTime(); + if (d.getTime() <= baseMs) { + return getRateAtDate(d); + } + const SECS_PER_YEAR = 365.25 * 24 * 3600; + const elapsedYears = (d.getTime() - baseMs) / 1000 / SECS_PER_YEAR; + return Math.round(TOKENS_PER_SECOND * Math.pow(1 + RATE_GROWTH_PER_YEAR, elapsedYears)); +} + /** * Calculate the collective daily environmental impact if a fraction of global users * consistently applies a token-saving tip. @@ -733,6 +757,8 @@ const DeathClockCore = { getTimeDelta, milestoneProgress, getRateAtDate, + RATE_GROWTH_PER_YEAR, + getDynamicRate, calculateTipImpact, generateEquivalences, calculatePersonalFootprint, diff --git a/script.js b/script.js index f499b73..bf15e0e 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,5 @@ /* AI DEATH CLOCK — browser/DOM layer (minified) */ -"use strict";(function(){const{BASE_TOKENS:Kt,TOKENS_PER_SECOND:O,BASE_DATE_ISO:Gt,HISTORICAL_DATA:Yt,MILESTONES:I,RATE_SCHEDULE:Vt,SESSION_CHALLENGE_DEFS:$o,TOKEN_TIPS:jt,COMPANY_ROLES:ge,AI_AGENTS:pe,formatTokenCount:S,formatTokenCountShort:_,getTriggeredMilestones:Jt,getNextMilestone:zt,predictMilestoneDate:Re,calculateEnvironmentalImpact:A,generateProjectionData:Qt,formatDate:Pe,getTimeDelta:Oe,milestoneProgress:he,getRateAtDate:L,calculateTipImpact:Xt,generateEquivalences:Ne,calculatePersonalFootprint:He,sessionEquivalences:Zt,getNextMilestoneForPlayer:We,computeComboMultiplier:en,getSessionChallenges:tn,formatDoomPoints:X,computePassiveRate:fe,getCompanyStage:nn,getSimulatedViewerCount:on}=window.DeathClockCore,{SITE_VERSION:ye="",CHANGELOG_RELEASES:Ee=[]}=typeof window!="undefined"&&window.ChangelogData||{},{PROJECT_PR_COUNT:Ue=0,PROJECT_TOTAL_TOKENS:qe=0}=typeof window!="undefined"&&window.ProjectStatsData||{},sn=new Date(Gt).getTime(),x=Date.now();let be="dark",B=null;const Ke="tokenDeathclockFirstArrival",Ge="tokenDeathclockTheme";let Z=x;try{const e=parseInt(localStorage.getItem(Ke)||"0",10);e>0&&e<=x?Z=e:localStorage.setItem(Ke,String(x))}catch(e){}function $(){const e=(Date.now()-sn)/1e3;return Kt+O*e}function an(e){return e>=1e15?(e/1e15).toFixed(3)+" Quadrillion":e>=1e12?(e/1e12).toFixed(3)+" Trillion":S(e)}function Ye(e){document.documentElement.setAttribute("data-theme",e);const t=document.getElementById("themeToggle");t&&(t.textContent=e==="dark"?"\u2600\uFE0F":"\u{1F319}"),be=e,B&&mn()}function rn(){const e=be==="dark"?"light":"dark";Ye(e);try{localStorage.setItem(Ge,e)}catch(t){}e==="light"&&k("optimist")}function Ve(){const e=Date.now(),t=$(),n=L(new Date(e)),o=Math.round((e-Z)/1e3*n),s=Math.floor((e-Z)/1e3),i=document.getElementById("totalCounter"),r=document.getElementById("sessionCounter"),c=document.getElementById("sessionTime"),d=document.getElementById("rateCounter"),m=document.getElementById("rateEvent");if(i&&(i.textContent=an(t)),r&&(r.textContent=S(o)),c){const g=Math.floor(s/60),f=s%60,p=Z!==x?"since first visit":"on page";c.textContent=g>0?`${g}m ${f}s ${p}`:`${f}s ${p}`}if(d&&(d.textContent=S(n)),m){const g=[...Vt].reverse().find(f=>e>=new Date(f.date).getTime());g&&(m.textContent=g.event+" \xB7 tokens/sec")}const h=A(t);ee("statKwh",_(h.kWh)),ee("statCo2",_(h.co2Kg)),ee("statWater",_(h.waterL)),ee("statTrees",_(h.treesEquivalent)),Ft(t);const b=Jt(t,I);I.forEach((g,f)=>{const p=document.getElementById("milestone-"+g.id);if(!p)return;const T=p.classList.contains("triggered");t>=g.tokens&&!T&&(p.classList.add("triggered"),$t.has(g.id)||($t.add(g.id),yo(g)));const D=p.querySelector(".progress-fill");if(D){const y=f===0?0:I[f-1].tokens,v=he(t,y,g.tokens);D.style.width=v+"%";const C=p.querySelector(".progress-pct");C&&(C.textContent=v.toFixed(1)+"%")}}),requestAnimationFrame(Ve)}function ee(e,t){const n=document.getElementById(e);n&&(n.textContent=t)}function cn(){const e=document.getElementById("milestonesGrid");if(!e)return;const t=$();e.innerHTML="",I.forEach((n,o)=>{const s=t>=n.tokens,i=o===0?0:I[o-1].tokens,r=he(t,i,n.tokens),c=Re(t,O,n.tokens),d=document.createElement("div");d.className="milestone-card"+(s?" triggered":""),d.id="milestone-"+n.id,d.innerHTML=` +"use strict";(function(){const{BASE_TOKENS:Yt,TOKENS_PER_SECOND:O,BASE_DATE_ISO:Fe,HISTORICAL_DATA:Vt,MILESTONES:I,RATE_SCHEDULE:jt,SESSION_CHALLENGE_DEFS:Po,TOKEN_TIPS:Jt,COMPANY_ROLES:ge,AI_AGENTS:pe,formatTokenCount:S,formatTokenCountShort:A,getTriggeredMilestones:zt,getNextMilestone:Qt,predictMilestoneDate:Pe,calculateEnvironmentalImpact:L,generateProjectionData:Xt,formatDate:Oe,getTimeDelta:Ne,milestoneProgress:he,getRateAtDate:_,RATE_GROWTH_PER_YEAR:Zt,getDynamicRate:en,calculateTipImpact:tn,generateEquivalences:He,calculatePersonalFootprint:We,sessionEquivalences:nn,getNextMilestoneForPlayer:Ue,computeComboMultiplier:on,getSessionChallenges:sn,formatDoomPoints:X,computePassiveRate:fe,getCompanyStage:an,getSimulatedViewerCount:rn}=window.DeathClockCore,{SITE_VERSION:ye="",CHANGELOG_RELEASES:Ee=[]}=typeof window!="undefined"&&window.ChangelogData||{},{PROJECT_PR_COUNT:qe=0,PROJECT_TOTAL_TOKENS:Ke=0}=typeof window!="undefined"&&window.ProjectStatsData||{},cn=new Date(Fe).getTime(),x=Date.now();let be="dark",M=null;const Ge="tokenDeathclockFirstArrival",Ye="tokenDeathclockTheme";let Z=x;try{const e=parseInt(localStorage.getItem(Ge)||"0",10);e>0&&e<=x?Z=e:localStorage.setItem(Ge,String(x))}catch(e){}function $(){const e=(Date.now()-cn)/1e3,t=365.25*24*3600,n=Math.log(1+Zt)/t;return Yt+O/n*(Math.exp(n*e)-1)}function ln(e){return e>=1e15?(e/1e15).toFixed(3)+" Quadrillion":e>=1e12?(e/1e12).toFixed(3)+" Trillion":S(e)}function Ve(e){document.documentElement.setAttribute("data-theme",e);const t=document.getElementById("themeToggle");t&&(t.textContent=e==="dark"?"\u2600\uFE0F":"\u{1F319}"),be=e,M&&fn()}function dn(){const e=be==="dark"?"light":"dark";Ve(e);try{localStorage.setItem(Ye,e)}catch(t){}e==="light"&&k("optimist")}let je=0;function un(e){const t=document.getElementById("totalCounter");if(!t)return;const n=t.closest(".counter-box");if(!n)return;const o=document.createElement("div");o.className="token-pop",o.setAttribute("aria-hidden","true"),o.style.left=42+Math.random()*16+"%",o.textContent="+"+A(e),n.appendChild(o),o.addEventListener("animationend",()=>o.remove(),{once:!0})}function Je(){const e=Date.now(),t=$(),n=en(new Date(e)),o=Math.round((e-Z)/1e3*n),s=Math.floor((e-Z)/1e3),i=document.getElementById("totalCounter"),r=document.getElementById("sessionCounter"),c=document.getElementById("sessionTime"),d=document.getElementById("rateCounter"),m=document.getElementById("rateEvent");if(i&&(i.textContent=ln(t)),r&&(r.textContent=S(o)),c){const g=Math.floor(s/60),h=s%60,p=Z!==x?"since first visit":"on page";c.textContent=g>0?`${g}m ${h}s ${p}`:`${h}s ${p}`}if(d&&(d.textContent=S(n)),m){const g=new Date(Fe).getTime();if(e>g)m.textContent="and growing \xB7 tokens/sec";else{const h=[...jt].reverse().find(p=>e>=new Date(p.date).getTime());h&&(m.textContent=h.event+" \xB7 tokens/sec")}}e-je>=1e3&&(je=e,un(n));const f=L(t);ee("statKwh",A(f.kWh)),ee("statCo2",A(f.co2Kg)),ee("statWater",A(f.waterL)),ee("statTrees",A(f.treesEquivalent)),Pt(t);const b=zt(t,I);I.forEach((g,h)=>{const p=document.getElementById("milestone-"+g.id);if(!p)return;const T=p.classList.contains("triggered");t>=g.tokens&&!T&&(p.classList.add("triggered"),Rt.has(g.id)||(Rt.add(g.id),ko(g)));const D=p.querySelector(".progress-fill");if(D){const y=h===0?0:I[h-1].tokens,v=he(t,y,g.tokens);D.style.width=v+"%";const C=p.querySelector(".progress-pct");C&&(C.textContent=v.toFixed(1)+"%")}}),requestAnimationFrame(Je)}function ee(e,t){const n=document.getElementById(e);n&&(n.textContent=t)}function mn(){const e=document.getElementById("milestonesGrid");if(!e)return;const t=$();e.innerHTML="",I.forEach((n,o)=>{const s=t>=n.tokens,i=o===0?0:I[o-1].tokens,r=he(t,i,n.tokens),c=Pe(t,O,n.tokens),d=document.createElement("div");d.className="milestone-card"+(s?" triggered":""),d.id="milestone-"+n.id,d.innerHTML=`
@@ -19,26 +19,26 @@
- ${c?`
\u23F1 Predicted: ${u(Pe(c))} (${u(Oe(c))})
`:""} + ${c?`
\u23F1 Predicted: ${u(Oe(c))} (${u(Ne(c))})
`:""} ${n.reference?`\u{1F4CE} Source`:""} - `,e.appendChild(d)})}function ln(){const e=document.getElementById("predictionsBody");if(!e)return;const t=$();e.innerHTML="",I.forEach(n=>{const o=t>=n.tokens,s=o?null:Re(t,O,n.tokens),i=document.createElement("tr");i.innerHTML=` + `,e.appendChild(d)})}function gn(){const e=document.getElementById("predictionsBody");if(!e)return;const t=$();e.innerHTML="",I.forEach(n=>{const o=t>=n.tokens,s=o?null:Pe(t,O,n.tokens),i=document.createElement("tr");i.innerHTML=` ${u(n.icon)} ${u(n.name)} ${u(n.shortDesc)} ${o?'PASSED':"\u23F3 Pending"} - ${o?"\u2014":u(Pe(s))} - ${o?'Already triggered':u(Oe(s))} - `,e.appendChild(i)})}function dn(){const e=$(),t=Yt.map(o=>({x:o.date,y:o.tokensT})),n=Qt(e,O,60,void 0,.5).map(o=>({x:o.date,y:+o.tokensT.toFixed(2)}));return{historical:t,projection:n}}function je(){const e=be==="dark";return{histLine:e?"#ff3333":"#cc0000",projLine:e?"#ff8800":"#cc6600",gridColor:e?"rgba(255,255,255,0.07)":"rgba(0,0,0,0.08)",tickColor:e?"#888":"#555",bg:e?"#161616":"#ffffff"}}function un(){const e=document.getElementById("tokenChart");if(!e||typeof Chart=="undefined")return;const{historical:t,projection:n}=dn(),o=je(),s={};I.forEach((i,r)=>{s["milestone_"+r]={type:"line",yMin:i.tokens/1e12,yMax:i.tokens/1e12,borderColor:"rgba(0,204,119,0.4)",borderWidth:1,borderDash:[4,4],label:{content:i.icon+" "+i.shortDesc,display:!1}}}),B=new Chart(e,{type:"line",data:{datasets:[{label:"Historical (estimated)",data:t,borderColor:o.histLine,backgroundColor:"transparent",borderWidth:2,pointRadius:3,pointHoverRadius:5,tension:.35,fill:!1},{label:"Projected",data:n,borderColor:o.projLine,backgroundColor:"transparent",borderWidth:2,borderDash:[6,4],pointRadius:0,tension:.35,fill:!1}]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},scales:{x:{type:"time",time:{tooltipFormat:"MMM yyyy",displayFormats:{month:"MMM yy",year:"yyyy",quarter:"MMM yy"}},grid:{color:o.gridColor},ticks:{color:o.tickColor,maxRotation:45}},y:{type:"logarithmic",title:{display:!0,text:"Cumulative Tokens (Trillions, log scale)",color:o.tickColor,font:{size:11}},grid:{color:o.gridColor},ticks:{color:o.tickColor,callback:i=>_(i*1e12)}}},plugins:{legend:{labels:{color:o.tickColor,boxWidth:20,padding:16,font:{size:12}}},tooltip:{callbacks:{label:i=>" "+S(i.parsed.y*1e12)+" tokens"}}}}})}function mn(){if(!B)return;const e=je();B.data.datasets[0].borderColor=e.histLine,B.data.datasets[1].borderColor=e.projLine,B.options.scales.x.grid.color=e.gridColor,B.options.scales.y.grid.color=e.gridColor,B.options.scales.x.ticks.color=e.tickColor,B.options.scales.y.ticks.color=e.tickColor,B.options.scales.y.title.color=e.tickColor,B.options.plugins.legend.labels.color=e.tickColor,B.update("none")}function u(e){return typeof e!="string"?"":e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const Je=I.find(e=>e.extinctionMarker)||I[I.length-1],l={level:"days",day:null,hour:null,minute:null,rafId:null,lastSec:-1,lastMin:-1,lastHr:-1,lastDayMs:0,exploding:!1};function ve(){const e=$();if(e>=Je.tokens)return Date.now();const t=(Je.tokens-e)/O;return Date.now()+t*1e3}function gn(){const e=ve()-Date.now();return Math.max(0,Math.ceil(e/864e5))}function F(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function ke(e,t,n){const o=e+t;return n>=o?"dead":n>=e?"dying":"future"}function N(e,t){return F(t)+e*864e5}function te(e,t,n,o){return`
${o?"\u2014":u(Oe(s))} + ${o?'Already triggered':u(Ne(s))} + `,e.appendChild(i)})}function pn(){const e=$(),t=Vt.map(o=>({x:o.date,y:o.tokensT})),n=Xt(e,O,60,void 0,.5).map(o=>({x:o.date,y:+o.tokensT.toFixed(2)}));return{historical:t,projection:n}}function ze(){const e=be==="dark";return{histLine:e?"#ff3333":"#cc0000",projLine:e?"#ff8800":"#cc6600",gridColor:e?"rgba(255,255,255,0.07)":"rgba(0,0,0,0.08)",tickColor:e?"#888":"#555",bg:e?"#161616":"#ffffff"}}function hn(){const e=document.getElementById("tokenChart");if(!e||typeof Chart=="undefined")return;const{historical:t,projection:n}=pn(),o=ze(),s={};I.forEach((i,r)=>{s["milestone_"+r]={type:"line",yMin:i.tokens/1e12,yMax:i.tokens/1e12,borderColor:"rgba(0,204,119,0.4)",borderWidth:1,borderDash:[4,4],label:{content:i.icon+" "+i.shortDesc,display:!1}}}),M=new Chart(e,{type:"line",data:{datasets:[{label:"Historical (estimated)",data:t,borderColor:o.histLine,backgroundColor:"transparent",borderWidth:2,pointRadius:3,pointHoverRadius:5,tension:.35,fill:!1},{label:"Projected",data:n,borderColor:o.projLine,backgroundColor:"transparent",borderWidth:2,borderDash:[6,4],pointRadius:0,tension:.35,fill:!1}]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},scales:{x:{type:"time",time:{tooltipFormat:"MMM yyyy",displayFormats:{month:"MMM yy",year:"yyyy",quarter:"MMM yy"}},grid:{color:o.gridColor},ticks:{color:o.tickColor,maxRotation:45}},y:{type:"logarithmic",title:{display:!0,text:"Cumulative Tokens (Trillions, log scale)",color:o.tickColor,font:{size:11}},grid:{color:o.gridColor},ticks:{color:o.tickColor,callback:i=>A(i*1e12)}}},plugins:{legend:{labels:{color:o.tickColor,boxWidth:20,padding:16,font:{size:12}}},tooltip:{callbacks:{label:i=>" "+S(i.parsed.y*1e12)+" tokens"}}}}})}function fn(){if(!M)return;const e=ze();M.data.datasets[0].borderColor=e.histLine,M.data.datasets[1].borderColor=e.projLine,M.options.scales.x.grid.color=e.gridColor,M.options.scales.y.grid.color=e.gridColor,M.options.scales.x.ticks.color=e.tickColor,M.options.scales.y.ticks.color=e.tickColor,M.options.scales.y.title.color=e.tickColor,M.options.plugins.legend.labels.color=e.tickColor,M.update("none")}function u(e){return typeof e!="string"?"":e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const Qe=I.find(e=>e.extinctionMarker)||I[I.length-1],l={level:"days",day:null,hour:null,minute:null,rafId:null,lastSec:-1,lastMin:-1,lastHr:-1,lastDayMs:0,exploding:!1};function ve(){const e=$();if(e>=Qe.tokens)return Date.now();const t=(Qe.tokens-e)/O;return Date.now()+t*1e3}function yn(){const e=ve()-Date.now();return Math.max(0,Math.ceil(e/864e5))}function R(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function ke(e,t,n){const o=e+t;return n>=o?"dead":n>=e?"dying":"future"}function N(e,t){return R(t)+e*864e5}function te(e,t,n,o){return`
${o}
`}function ne(e,t,n,o){return`
${o}
`}const q=3650;function pn(e,t){const n=gn(),o=Math.min(n,q),s=F(t),i=(t-s)/864e5*100,c=new Date(ve()).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});let d=`
`;d+=te('data-day="0"',i,"Today \u2014 burning away","");for(let m=1;m<=o;m++)d+=ne("future",`data-day="${m}"`,`Day ${m} from now`,"");n>q&&(d+=`
${o}
`}const q=3650;function En(e,t){const n=yn(),o=Math.min(n,q),s=R(t),i=(t-s)/864e5*100,c=new Date(ve()).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});let d=`
`;d+=te('data-day="0"',i,"Today \u2014 burning away","");for(let m=1;m<=o;m++)d+=ne("future",`data-day="${m}"`,`Day ${m} from now`,"");n>q&&(d+=`
- +${Math.round((n-q)/365)}y
`),d+="
",e.innerHTML=d,document.getElementById("lb-info").textContent=`${n.toLocaleString()} days until extinction \xB7 predicted ${c}`}function hn(e,t,n){const o=N(t,n),s=t===0;let i='
';for(let c=0;c<24;c++){const d=o+c*36e5,m=s?ke(d,36e5,n):"future",h=`${String(c).padStart(2,"0")}:00`,b=`${String(c).padStart(2,"0")}`;if(m==="dying"){const g=(n-d)/36e5*100;i+=te(`data-hour="${c}"`,g,h,b)}else i+=ne(m,`data-hour="${c}"`,h,b)}i+="
",e.innerHTML=i;const r=t===0?"Today":`Day +${t}`;document.getElementById("lb-info").textContent=`${r} \u2014 select an hour`}function fn(e,t,n,o){const i=N(t,o)+n*36e5,r=t===0&&o>=i&&o${String(d).padStart(2,"0")}`;if(h==="dying"){const f=(o-m)/6e4*100;c+=te(`data-minute="${d}"`,f,b,g)}else c+=ne(h,`data-minute="${d}"`,b,g)}c+="
",e.innerHTML=c,document.getElementById("lb-info").textContent=`${String(n).padStart(2,"0")}:xx \u2014 select a minute`}function yn(e,t,n,o,s){const r=N(t,s)+n*36e5+o*6e4,c=t===0&&s>=r&&s${String(m).padStart(2,"0")}`;if(b==="dying"){const p=(s-h)/1e3*100;d+=te(`data-second="${m}"`,p,g,f)}else d+=ne(b,`data-second="${m}"`,g,f)}d+="
",e.innerHTML=d,document.getElementById("lb-info").textContent=`${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}:xx`}function En(){const e=document.getElementById("lb-breadcrumb");if(!e)return;const t=[{label:"\u{1F480} Days",level:"days"}];l.level!=="days"&&t.push({label:`Day ${l.day===0?"Today":"+"+l.day}`,level:"hours"}),(l.level==="minutes"||l.level==="seconds")&&t.push({label:`Hour ${String(l.hour).padStart(2,"0")}`,level:"minutes"}),l.level==="seconds"&&t.push({label:`Min ${String(l.minute).padStart(2,"0")}`,level:"seconds"}),e.innerHTML=t.map((n,o)=>o===t.length-1?`${u(n.label)}`:``),d+="",e.innerHTML=d,document.getElementById("lb-info").textContent=`${n.toLocaleString()} days until extinction \xB7 predicted ${c}`}function bn(e,t,n){const o=N(t,n),s=t===0;let i='
';for(let c=0;c<24;c++){const d=o+c*36e5,m=s?ke(d,36e5,n):"future",f=`${String(c).padStart(2,"0")}:00`,b=`${String(c).padStart(2,"0")}`;if(m==="dying"){const g=(n-d)/36e5*100;i+=te(`data-hour="${c}"`,g,f,b)}else i+=ne(m,`data-hour="${c}"`,f,b)}i+="
",e.innerHTML=i;const r=t===0?"Today":`Day +${t}`;document.getElementById("lb-info").textContent=`${r} \u2014 select an hour`}function vn(e,t,n,o){const i=N(t,o)+n*36e5,r=t===0&&o>=i&&o${String(d).padStart(2,"0")}
`;if(f==="dying"){const h=(o-m)/6e4*100;c+=te(`data-minute="${d}"`,h,b,g)}else c+=ne(f,`data-minute="${d}"`,b,g)}c+="",e.innerHTML=c,document.getElementById("lb-info").textContent=`${String(n).padStart(2,"0")}:xx \u2014 select a minute`}function kn(e,t,n,o,s){const r=N(t,s)+n*36e5+o*6e4,c=t===0&&s>=r&&s${String(m).padStart(2,"0")}`;if(b==="dying"){const p=(s-f)/1e3*100;d+=te(`data-second="${m}"`,p,g,h)}else d+=ne(b,`data-second="${m}"`,g,h)}d+="",e.innerHTML=d,document.getElementById("lb-info").textContent=`${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}:xx`}function Sn(){const e=document.getElementById("lb-breadcrumb");if(!e)return;const t=[{label:"\u{1F480} Days",level:"days"}];l.level!=="days"&&t.push({label:`Day ${l.day===0?"Today":"+"+l.day}`,level:"hours"}),(l.level==="minutes"||l.level==="seconds")&&t.push({label:`Hour ${String(l.hour).padStart(2,"0")}`,level:"minutes"}),l.level==="seconds"&&t.push({label:`Min ${String(l.minute).padStart(2,"0")}`,level:"seconds"}),e.innerHTML=t.map((n,o)=>o===t.length-1?`${u(n.label)}`:`${u(n.label)} - `).join(""),e.querySelectorAll("[data-nav]").forEach(n=>{const o=n.getAttribute("data-nav");n.addEventListener("click",()=>ze(o)),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&ze(o)})})}function ze(e){l.level=e,e==="days"?(l.day=null,l.hour=null,l.minute=null):e==="hours"?(l.hour=null,l.minute=null):e==="minutes"&&(l.minute=null),K()}function K(){const e=document.getElementById("lb-container");if(!e)return;const t=Date.now(),n=new Date(t);l.lastSec=n.getSeconds(),l.lastMin=n.getMinutes(),l.lastHr=n.getHours(),l.lastDayMs=F(n),l.exploding=!1,l.level==="days"?pn(e,t):l.level==="hours"?hn(e,l.day,t):l.level==="minutes"?fn(e,l.day,l.hour,t):l.level==="seconds"&&yn(e,l.day,l.hour,l.minute,t),En(),bn(e)}function bn(e){e.querySelectorAll(".lb-block:not(.lb-dead)").forEach(t=>{t.addEventListener("click",Qe),t.addEventListener("keydown",n=>{(n.key==="Enter"||n.key===" ")&&Qe.call(t,n)})})}function Qe(e){const t=e.currentTarget||this;if(l.level==="days")l.day=parseInt(t.getAttribute("data-day"),10),l.level="hours";else if(l.level==="hours")l.hour=parseInt(t.getAttribute("data-hour"),10),l.level="minutes";else if(l.level==="minutes")l.minute=parseInt(t.getAttribute("data-minute"),10),l.level="seconds";else return;K()}function vn(e){if(l.exploding){e();return}const t=document.querySelector("#lb-container .lb-dying");if(!t){e();return}l.exploding=!0,t.classList.add("lb-exploding"),setTimeout(e,560)}function Xe(){const e=Date.now(),t=new Date(e);if(!l.exploding){const h=document.querySelector("#lb-container .lb-dying");if(h){let b,g;if(l.level==="days")b=F(t),g=864e5;else if(l.level==="hours"){const p=t.getHours();b=N(l.day,e)+p*36e5,g=36e5}else if(l.level==="minutes"){const p=t.getMinutes();b=N(l.day,e)+l.hour*36e5+p*6e4,g=6e4}else{const p=t.getSeconds();b=N(l.day,e)+l.hour*36e5+l.minute*6e4+p*1e3,g=1e3}const f=Math.min(100,(e-b)/g*100);h.style.setProperty("--progress",f.toFixed(2)+"%")}}const n=t.getSeconds(),o=t.getMinutes(),s=t.getHours(),i=F(t),r=l.level==="seconds"&&n!==l.lastSec,c=l.level==="minutes"&&o!==l.lastMin,d=l.level==="hours"&&s!==l.lastHr,m=l.level==="days"&&i!==l.lastDayMs;(r||c||d||m)&&!l.exploding&&(l.lastSec=n,l.lastMin=o,l.lastHr=s,l.lastDayMs=i,vn(()=>K())),l.rafId=requestAnimationFrame(Xe)}function kn(){K(),l.rafId=requestAnimationFrame(Xe),wn()}const Sn={seconds:"sec",minutes:"min",hours:"hr",days:"day",months:"month",years:"year"},E={rafId:null,active:!1,initialized:!1,lastSec:-1,lastMin:-1,lastHr:-1,lastDay:-1,lastMonth:-1,lastYear:-1,pendingCascade:!1,exploding:{sec:!1,min:!1,hr:!1,day:!1,month:!1,year:!1}};function Ze(e,t,n){const o=new Date(n),s=o.getFullYear(),i=o.getMonth(),r=o.getDate(),c=o.getHours(),d=o.getMinutes(),m=o.getSeconds(),h={years:"YEARS",months:"MONTHS",days:"DAYS",hours:"HOURS",minutes:"MINS",seconds:"SECS"},b=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];let g,f,p,T=null,w;switch(t){case"seconds":g=60,f=m,p=(n-Math.floor(n/1e3)*1e3)/1e3*100,w=y=>yy{const v=String(y).padStart(2,"0")+":00";return y{const C=v+1;return v{const me=b[C];return C30&&(T=`+${C-30}y`),w=Lo=>{const Q=v+Lo;return Q