1const Ze="sfx.volume";const C=(n,e)=>n+Math.random()*(e-n);function bt(){return typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Tt(){try{const n=localStorage.getItem(Ze);if(n!==null){const e=Number(n);if(Number.isFinite(e))return Math.min(1,Math.max(0,e))}}catch{}return .7}function kt(){try{const n=localStorage.getItem("sfx");if(n==="on")return!1;if(n==="off")return!0}catch{}return bt()}class Et{ctx=null;bus=null;master=null;noiseBuffer=null;ambient=null;ambientTimer=null;ambientWanted=!1;lastTickAt=0;muted=kt();volume=Tt();listeners=new Set;getState(){return{muted:this.muted,volume:this.volume,ambient:!!this.ambient,ready:!!this.ctx}}isMuted(){return this.muted}getVolume(){return this.volume}onChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}init(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}const e=window.AudioContext||window.webkitAudioContext;if(!e)return;const t=new e;this.ctx=t;const r=t.createGain();r.gain.value=this.muted?0:this.volume,r.connect(t.destination),this.master=r;const a=t.createGain();a.connect(r),this.bus=a;const s=t.createConvolver();s.buffer=this.makeImpulse(.42,3.2);const o=t.createGain();o.gain.value=.13,a.connect(o),o.connect(s),s.connect(r),this.noiseBuffer=this.makeNoise(2),this.syncAmbient()}setMuted(e){this.muted=e;try{localStorage.setItem("sfx",e?"off":"on")}catch{}e||this.init(),this.applyGain(),this.notify()}toggle(){this.setMuted(!this.muted)}setVolume(e){this.volume=Math.min(1,Math.max(0,e));try{localStorage.setItem(Ze,String(this.volume))}catch{}this.applyGain(),this.notify()}setAmbient(e){this.ambientWanted=e,this.syncAmbient(),this.notify()}isAmbient(){return!!this.ambient}play(e){if(this.muted||!this.ctx||!this.bus)return;this.ctx.state==="suspended"&&this.ctx.resume();const t=this.ctx.currentTime+.001;if(e==="key"||e==="type"){const r=performance.now();if(r-this.lastTickAt<22)return;this.lastTickAt=r}switch(e){case"key":this.key(t);break;case"type":this.codeTick(t);break;case"enter":this.enter(t);break;case"done":this.done(t);break;case"error":this.error(t);break;case"boot":this.boot(t);break;case"surge":this.surge(t);break;case"whisper":this.whisper(t);break}}key(e){this.noise({t:e,dur:.012,filter:"highpass",freq:C(3600,5200),gain:.05}),this.noise({t:e+.002,dur:C(.04,.055),filter:"bandpass",freq:C(1050,1750),q:1.1,gain:C(.12,.17)}),this.tone({t:e,freq:C(96,148),dur:.055,gain:.12,to:62}),Math.random()<.22&&this.noise({t:e+.006,dur:.018,filter:"bandpass",freq:C(2400,3200),q:2,gain:.03})}codeTick(e){this.noise({t:e,dur:.011,filter:"highpass",freq:C(5200,7200),gain:.035}),this.tone({t:e,freq:C(1500,2700),dur:.02,gain:.016})}enter(e){this.tone({t:e,freq:88,to:58,dur:.16,gain:.2}),this.noise({t:e,dur:.09,filter:"lowpass",freq:620,gain:.13});const t=C(30,45);this.tone({t:e+.012,freq:1046.5,dur:.3,gain:.032}),this.tone({t:e+.012+t/1e3,freq:1569.8,dur:.26,gain:.022})}done(e){this.noise({t:e,dur:.17,filter:"bandpass",freq:2600,freqTo:620,q:3.2,gain:.05}),this.tone({t:e,freq:740,to:520,dur:.09,gain:.02})}whisper(e){const t=this.ctx;if(!t)return;const r=[{freq:65.41,gain:.05,dur:1.5,attack:.3},{freq:130.81,gain:.05,dur:1.9,attack:.4},{freq:196,gain:.03,dur:1.7,attack:.55},{freq:392,gain:.011,dur:1.15,attack:.7}];for(const a of r){const s=t.createOscillator();s.type="sine",s.frequency.setValueAtTime(a.freq,e);const o=t.createGain();o.gain.setValueAtTime(1e-4,e),o.gain.linearRampToValueAtTime(a.gain,e+a.attack),o.gain.exponentialRampToValueAtTime(1e-4,e+a.dur),s.connect(o),o.connect(this.bus),s.start(e),s.stop(e+a.dur+.05)}}error(e){const t=this.ctx.createOscillator();t.type="square",t.frequency.setValueAtTime(220,e),t.frequency.exponentialRampToValueAtTime(78,e+.22);const r=this.ctx.createGain(),a=7;for(let s=0;s<a;s++){const o=e+s*(.22/a);r.gain.setValueAtTime(s%2===0?.055:.008,o)}r.gain.setValueAtTime(1e-4,e+.23),t.connect(r),r.connect(this.bus),t.start(e),t.stop(e+.24),this.noise({t:e,dur:.05,filter:"highpass",freq:2200,gain:.05})}boot(e){this.tone({t:e,freq:42,to:68,dur:.34,gain:.2}),this.noise({t:e,dur:.4,filter:"lowpass",freq:C(700,1e3),gain:.07})}surge(e){this.noise({t:e,dur:.14,filter:"bandpass",freq:C(380,620),freqTo:C(2200,3e3),q:1.4,gain:.035})}noise(e){const t=this.ctx;if(!t||!this.noiseBuffer)return;const r=t.createBufferSource();r.buffer=this.noiseBuffer,r.loop=!0,r.playbackRate.value=C(.85,1.15);const a=t.createBiquadFilter();a.type=e.filter,a.frequency.setValueAtTime(e.freq,e.t),e.freqTo&&a.frequency.exponentialRampToValueAtTime(e.freqTo,e.t+e.dur),e.q&&(a.Q.value=e.q);const s=t.createGain();s.gain.setValueAtTime(1e-4,e.t),s.gain.exponentialRampToValueAtTime(Math.max(e.gain,2e-4),e.t+.0015),s.gain.exponentialRampToValueAtTime(1e-4,e.t+e.dur),r.connect(a),a.connect(s),s.connect(this.bus),r.start(e.t,C(0,1.5)),r.stop(e.t+e.dur+.02)}tone(e){const t=this.ctx;if(!t)return;const r=t.createOscillator();r.type=e.type??"sine",r.frequency.setValueAtTime(e.freq,e.t),e.to&&r.frequency.exponentialRampToValueAtTime(e.to,e.t+e.dur);const a=t.createGain();a.gain.setValueAtTime(1e-4,e.t),a.gain.exponentialRampToValueAtTime(Math.max(e.gain,2e-4),e.t+.002),a.gain.exponentialRampToValueAtTime(1e-4,e.t+e.dur),r.connect(a),a.connect(this.bus),r.start(e.t),r.stop(e.t+e.dur+.02)}syncAmbient(){const e=this.ambientWanted&&!this.muted&&this.volume>.02&&!!this.ctx;e&&!this.ambient?this.startAmbient():!e&&this.ambient&&this.stopAmbient()}startAmbient(){const e=this.ctx;if(!e||!this.noiseBuffer||!this.bus)return;const t=e.createBufferSource();t.buffer=this.noiseBuffer,t.loop=!0,t.playbackRate.value=.6;const r=e.createBiquadFilter();r.type="bandpass",r.frequency.value=880,r.Q.value=.7;const a=e.createOscillator();a.frequency.value=.07;const s=e.createGain();s.gain.value=420,a.connect(s),s.connect(r.frequency);const o=e.createGain();o.gain.value=1e-4,o.gain.exponentialRampToValueAtTime(.05,e.currentTime+.8),t.connect(r),r.connect(o),o.connect(this.bus),t.start(),a.start(),this.ambient={src:t,gain:o,lfo:a};const d=()=>
1{if(!(!this.ambient||!this.ctx)){if(!this.muted){const l=typeof this.ctx.createStereoPanner=="function"?this.ctx.createStereoPanner():null;l&&(l.pan.value=C(-.85,.85),l.connect(this.bus));const u=l??this.bus,m=this.ctx.createGain();m.gain.setValueAtTime(1e-4,this.ctx.currentTime),m.gain.exponentialRampToValueAtTime(C(.006,.03),this.ctx.currentTime+.004),m.gain.exponentialRampToValueAtTime(1e-4,this.ctx.currentTime+C(.02,.07));const f=this.ctx.createBiquadFilter();f.type="bandpass",f.frequency.value=C(1800,5200),f.Q.value=4;const g=this.ctx.createBufferSource();g.buffer=this.noiseBuffer,g.loop=!0,g.playbackRate.value=C(.9,1.4),g.connect(f),f.connect(m),m.connect(u),g.start(this.ctx.currentTime,C(0,1.5)),g.stop(this.ctx.currentTime+.09)}this.ambientTimer=window.setTimeout(d,C(140,520))}};this.ambientTimer=window.setTimeout(d,C(120,400))}stopAmbient(){this.ambientTimer!==null&&(window.clearTimeout(this.ambientTimer),this.ambientTimer=null);const e=this.ctx,t=this.ambient;if(this.ambient=null,!(!e||!t))try{t.gain.gain.cancelScheduledValues(e.currentTime),t.gain.gain.setTargetAtTime(1e-4,e.currentTime,.15),t.src.stop(e.currentTime+.6),t.lfo.stop(e.currentTime+.6)}catch{}}makeImpulse(e,t){const r=this.ctx,a=r.sampleRate,s=Math.max(1,Math.floor(a*e)),o=r.createBuffer(2,s,a);for(let d=0;d<2;d++){const l=o.getChannelData(d);for(let u=0;u<s;u++)l[u]=(Math.random()*2-1)*Math.pow(1-u/s,t)}return o}makeNoise(e){const t=this.ctx,r=t.sampleRate,a=Math.max(1,Math.floor(r*e)),s=t.createBuffer(2,a,r);for(let o=0;o<2;o++){const d=s.getChannelData(o);for(let l=0;l<a;l++)d[l]=Math.random()*2-1}return s}applyGain(){if(!this.ctx||!this.master)return;const e=this.muted?0:this.volume;this.master.gain.cancelScheduledValues(this.ctx.currentTime),this.master.gain.setTargetAtTime(e,this.ctx.currentTime,.02),this.syncAmbient()}notify(){const e=this.getState();this.listeners.forEach(t=>t(e))}}const A=new Et,et={A:1,NS:2,CNAME:5,SOA:6,PTR:12,MX:15,TXT:16,AAAA:28,SRV:33,DS:43,HTTPS:65,CAA:257},St=Object.fromEntries(Object.entries(et).map(([n,e])=>[e,n])),At={0:"NOERROR",1:"FORMERR",2:"SERVFAIL",3:"NXDOMAIN",4:"NOTIMP",5:"REFUSED"};function $t(n){return St[n]??`TYPE${n}`}function Ue(n){return At[n]??`RCODE${n}`}const Ct=Object.keys(et).join(" ");function tt(n,e){const t=new AbortController,r=setTimeout(()=>t.abort(new Error("query timed out")),n),a=()=>t.abort(e?.reason);return e&&(e.aborted?a():e.addEventListener("abort",a,{once:!0})),{signal:t.signal,release:()=>{clearTimeout(r),e?.removeEventListener("abort",a)}}}const Lt=[{url:"https://cloudflare-dns.com/dns-query",resolver:"cloudflare-dns.com (DoH)"},{url:"https://dns.google/resolve",resolver:"dns.google (DoH)"}];async function nt(n,e,t){let r=null;for(const a of Lt){const{signal:s,release:o}=tt(8e3,t),d=performance.now();try{const l=`${a.url}?name=${encodeURIComponent(n)}&type=${encodeURIComponent(e)}&cd=0`,u=await fetch(l,{headers:{accept:"application/dns-json"},signal:s});if(!u.ok)throw new Error(`HTTP ${u.status}`);const m=await u.json();return{status:m.Status??0,answers:m.Answer??[],authority:m.Authority??[],resolver:a.resolver,ms:Math.round(performance.now()-d)}}catch(l){r=l}finally{o()}}throw r instanceof Error?r:new Error("resolver unreachable")}async function Rt(n,e){try{const r=(await nt(n,"A",e)).answers.find(a=>a.type===1);return r?r.data:null}catch{return null}}function rt(n){return/^\d{1,3}(\.\d{1,3}){3}$/.test(n)||/^[0-9a-f:]{3,}$/i.test(n)&&n.includes(":")}const Mt={registration:"createdAt","last changed":"updatedAt",expiration:"expiresAt"};function Ot(n){const e=n?.vcardArray?.[1];if(!Array.isArray(e))return;const t=e.find(r=>Array.isArray(r)&&r[0]==="fn");return Array.isArray(t)&&typeof t[3]=="string"?t[3]:void 0}async function It(n,e){const t=rt(n),r=t?`ip/${encodeURIComponent(n)}`:`domain/${encodeURIComponent(n)}`,{signal:a,release:s}=tt(9e3,e),o=performance.now();try{const d=await fetch(`https://rdap.org/${r}`,{headers:{accept:"application/rdap+json"},signal:a});if(d.status===404)throw new Error("not found in any RDAP registry");if(!d.ok)throw new Error(`HTTP ${d.status}`);const l=await d.json(),u={kind:t?"ip":"domain",name:l.ldhName??l.unicode
1Name??l.handle??n,handle:l.handle,status:Array.isArray(l.status)?l.status:[],nameservers:Array.isArray(l.nameservers)?l.nameservers.map(m=>m.ldhName??m.unicodeName).filter(Boolean):[],dnssec:l.secureDNS?.delegationSigned?"signedDelegation":"unsigned",ms:Math.round(performance.now()-o)};for(const m of l.events??[]){const f=Mt[String(m.eventAction)];f&&!u[f]&&(u[f]=String(m.eventDate).slice(0,10))}for(const m of l.entities??[])(m.roles??[]).includes("registrar")&&(u.registrar=Ot(m)??m.handle);if(t){const m=l.cidr0_cidrs?.[0];u.network=m?`${m.v4prefix??m.v6prefix}/${m.length}`:l.handle,u.name=l.name??l.handle??n,u.country=l.country,u.registrar=l.entities?.length?"regional internet registry":void 0}return u}finally{s()}}function Ee(n,e){let t=2166136261;const r=`${n}:${e}`;for(let s=0;s<r.length;s++)t^=r.charCodeAt(s),t=Math.imul(t,16777619);const a=(t>>>0)%100;return a<14?"open":a<46?"filtered":"closed"}const ot="achievements.v1",Ce={first_contact:{id:"first_contact",name:"First Contact",hint:"Run your first command."},curious:{id:"curious",name:"Curious Operator",hint:"Discover 5 unique commands."},completionist:{id:"completionist",name:"Completionist",hint:"Discover every command."},go_dark:{id:"go_dark",name:"Go Dark",hint:"Toggle SFX off."},rainmaker:{id:"rainmaker",name:"Rainmaker",hint:"Activate matrix rain."},wardrobe:{id:"wardrobe",name:"Wardrobe Change",hint:"Switch to every theme."},recon:{id:"recon",name:"Recon Specialist",hint:"Run nmap."},packet_sniffer:{id:"packet_sniffer",name:"Packet Sniffer",hint:"Tail the live log feed."},process_killer:{id:"process_killer",name:"Process Killer",hint:"Run top."},reboot_loop:{id:"reboot_loop",name:"Reboot Loop",hint:"Replay the boot sequence."},oops:{id:"oops",name:"Permission Denied",hint:"Try sudo."},archivist:{id:"archivist",name:"Archivist",hint:"Open an archive with cat."},the_one:{id:"the_one",name:"The One",hint:"Type 'neo'."},redpill:{id:"redpill",name:"Red Pill",hint:"Take the red pill."},bluepill:{id:"bluepill",name:"Blue Pill",hint:"Take the blue pill."},dejavu:{id:"dejavu",name:"Déjà Vu",hint:"They changed something. Watch for the cat."}};function Nt(){try{const n=localStorage.getItem(ot);if(n)return JSON.parse(n)}catch{}return{unlocked:[],commandsSeen:[],themesSeen:[]}}function Le(n){try{localStorage.setItem(ot,JSON.stringify(n))}catch{}}let N=Nt();const Dt=()=>document.getElementById("achievement-stack");function _t(n){const e=Dt();if(!e)return;const t=document.createElement("div");t.className="achievement-toast",t.setAttribute("role","status"),t.innerHTML='<span class="label">ⶠAchievement Unlocked</span><span class="name"></span>',t.querySelector(".name").textContent=n.name,e.appendChild(t),window.setTimeout(()=>t.remove(),5500)}function O(n){if(N.unlocked.includes(n))return;const e=Ce[n];e&&(N.unlocked.push(n),Le(N),_t(e))}function Pt(n,e){N.commandsSeen.includes(n)||(N.commandsSeen.push(n),Le(N)),N.commandsSeen.length>=1&&O("first_contact"),N.commandsSeen.length>=5&&O("curious"),N.commandsSeen.length>=e&&O("completionist")}function Ve(n,e){N.themesSeen.includes(n)||(N.themesSeen.push(n),Le(N)),e.every(t=>N.themesSeen.includes(t))&&O("wardrobe")}function He(){return N.unlocked.map(n=>Ce[n]).filter(n=>!!n)}function je(){return Object.values(Ce)}function qt(n){return N.unlocked.includes(n)}const Ft=[{match:/^(am i|are we)( really)? alone$/,reply:"you are not alone."}];function Ye(n){const e=n.toLowerCase().replace(/[^a-z0-9\s]/g," ").replace(/\s+/g," ").trim();return Ft.find(t=>t.match.test(e))?.reply??null}function i(n,e={},...t){const r=document.createElement(n);for(const[a,s]of Object.entries(e))a==="class"?r.className=s:r.setAttribute(a,s);for(const a of t)r.append(typeof a=="string"?document.createTextNode(a):a);return r}function T(n,...e){return i("div",{class:`ml-4 mt-2 ${n}`},...e)}function j(n){return T("text-error",n)}function re(){window.dispatchEvent(new Event("firefly:scroll"))}function q(n,e="opacity-70"){return i("div",{class:e},n)}function We(n){const e=n.name.padEnd(30," "),t=String(n.TTL).padStart(6," "),r=$t(n.type).padEnd(7," ");return i("div",{class:"whitespace-pre-wrap break-words"},`${e}${t} IN ${r}`,i("span",{class:"text-white"},n.data))}const at=[["whoami","Display current operator info"],["pwd","Print working directory"],["date","Display system time"],["echo [text]","Print arguments"],["ls","List available archives"],["cat [file]","Open archive inline"],["status","Bu
1ild, runtime and progress report"],["dig [name]","Live DNS lookup (type: A/AAAA/MX/TXT/NS/ANY)"],["whois [domain]","Live RDAP registration record"],["nmap [host]","Resolve a host, then a simulated port scan"],["tour","Guided walkthrough of the terminal"],["share","Copy a link that replays your session"],["top","Live process list"],["neofetch","System information"],["matrix","Toggle matrix rain effect"],["theme [name]","Switch palette: matrix/amber/ice/dracula/mono"],["sfx","Sound: on/off, volume 0-100, test"],["tail","Toggle live log feed pane"],["reboot","Replay the boot sequence"],["palette","Open the command palette (Ctrl+K)"],["achievements","Show operator badges"],["contact","Show contact channels"],["history","Show recent commands"],["clear","Clear terminal output (Ctrl+L)"],["help","Show this command list"]],Q={help(n,e){const t=i("div",{class:"mt-2 grid grid-cols-[110px_1fr] gap-y-1 gap-x-2 sm:grid-cols-[140px_1fr] lg:grid-cols-[200px_1fr]"});for(const[o,d]of at)t.append(i("span",{class:"opacity-70"},o),i("span",{},d));const r=e.notionConnected?i("div",{class:"mt-3 opacity-70 text-[10px] text-primary-container"},"DATABASE UPLINK ACTIVE // CMS ENABLED"):i("div",{class:"mt-3 opacity-70 text-[10px] text-error"},"DATABASE UPLINK OFFLINE // LOCAL MODE"),a=i("div",{class:"mt-3 border-t border-outline-variant/40 pt-2 opacity-70 text-[10px]"},"SOCIAL_LINKS: ");a.append(i("a",{href:"https://github.com/TBLopez",target:"_blank",rel:"noopener noreferrer",class:"hover:text-white underline"},"github"),document.createTextNode(" | "),i("a",{href:"https://www.linkedin.com/in/techtony/",target:"_blank",rel:"noopener noreferrer",class:"hover:text-white underline"},"linkedin"));const s=i("div",{class:"text-primary-container ml-4 mt-2"});return s.append(i("div",{},"AVAILABLE COMMANDS:"),t,a,i("div",{class:"mt-1 opacity-70 text-[10px]"},"TIP: Ctrl+K opens the command palette. Tab completes, ââ recall history, and every command name here is clickable."),i("div",{class:"mt-1 opacity-50 text-[10px]"},"Unlisted commands exist. Operator badges know more."),r),{node:s,typewrite:!0}},pwd(){return{node:T("text-primary-container","/home/operator/firefly/tony"),typewrite:!0}},whoami(){const n=T("text-primary-container");return n.append(i("span",{class:"block"},"TONY LOPEZ // SECURITY_ANALYST"),i("span",{class:"block opacity-80 mt-1"},"Specializing in security, penetration testing, and tactical development."),i("span",{class:"block opacity-80 mt-1"},"Run 'ls' for archives, 'contact' for channels, or 'neofetch' for machine stats.")),{node:n,typewrite:!0}},sudo(){return O("oops"),{node:T("text-error font-bold select-none uppercase","[!] SECURITY ALERT [!] ACCESS DENIED: THIS INCIDENT WILL BE REPORTED."),typewrite:!0}},date(){return{node:T("text-primary-container",new Date().toString()),typewrite:!0}},echo(n){return{node:T("text-white whitespace-pre-wrap",n.join(" ")),typewrite:!0}},contact(){const n=T("text-primary-container"),e=(t,r,a)=>i("div",{class:"flex gap-3"},i("span",{class:"opacity-70 w-20 shrink-0"},t),i("a",{href:r,target:"_blank",rel:"noopener noreferrer",class:"hover:text-white underline text-secondary break-all"},a));return n.append(e("github","https://github.com/TBLopez","github.com/TBLopez"),e("linkedin","https://www.linkedin.com/in/techtony/","linkedin.com/in/techtony"),i("div",{class:"mt-2 opacity-60 text-[10px]"},"OPEN TO WORK // SECURITY ANALYST / SOC / PENTEST ROLES")),{node:n,typewrite:!0}},history(n,e){const t=T("text-primary-container");return e.history.length===0?t.append(i("div",{class:"opacity-70"}
1,"(history empty)")):e.history.forEach((r,a)=>{t.append(i("div",{class:"grid grid-cols-[48px_1fr]"},i("span",{class:"opacity-60"},String(a+1).padStart(3," ")),i("span",{},r)))}),{node:t,typewrite:!1}},clear(n,e){e.clear()},nmap(n,e){const t=n[0]||"127.0.0.1",r=T("text-primary-container"),a=i("div",{class:"opacity-70"}),s=i("div",{class:"mt-1"}),o=i("div",{class:"mt-2 hidden"}),d=i("div",{class:"mt-2 hidden"});r.append(a,s,o,d);const l=[],u=new AbortController;e.registerInterrupt(()=>{l.forEach(f=>window.clearTimeout(f)),u.abort(),s.textContent="nmap: scan aborted."});const m=[[22,"ssh"],[25,"smtp"],[53,"domain"],[80,"http"],[111,"rpcbind"],[443,"https"],[445,"microsoft-ds"],[3306,"mysql"],[3389,"ms-wbt-server"],[5432,"postgresql"],[6379,"redis"],[8080,"http-proxy"],[8443,"https-alt"],[27017,"mongodb"]];return(async()=>{let f=t;if(a.textContent=`Starting firefly-nmap at ${new Date().toLocaleTimeString()}`,s.textContent=`Resolving ${t} â¦`,rt(t))s.replaceChildren(i("div",{},`Nmap scan report for ${f}`),i("div",{class:"opacity-70 text-[10px]"},"[!] port table below is simulated â no packets leave the browser"));else{const h=await Rt(t,u.signal);if(!h){s.textContent=`nmap: failed to resolve "${t}" â no A record (try dig ${t}).`,re();return}f=h,s.replaceChildren(i("div",{},`Nmap scan report for ${t} (${f})`),i("div",{class:"opacity-70"},"DNS resolved live over DoH"),i("div",{class:"opacity-70 text-[10px]"},"[!] port table below is simulated â no packets leave the browser"))}o.classList.remove("hidden"),o.append(i("div",{class:"text-error"},"PORT STATE SERVICE"));const g=[];for(const[h,x]of m){const v=Ee(f,h);g.push(i("div",{class:"text-white"},`${`${h}/tcp`.padEnd(11," ")}`,i("span",{class:v==="open"?"text-primary-container":v==="filtered"?"text-error":"opacity-50"},v.padEnd(11," ")),x))}g.forEach((h,x)=>{const v=window.setTimeout(()=>{o.append(h),e.sfx.play("type"),re()},130*x);l.push(v)});const y=window.setTimeout(()=>{const h=m.filter(([v])=>Ee(f,v)==="open"),x=m.filter(([v])=>Ee(f,v)==="filtered");d.classList.remove("hidden"),d.replaceChildren(i("div",{class:"mt-2"},`${m.length} ports probed · ${h.length} open · ${x.length} filtered`),h.length>0?i("div",{class:"mt-1 text-error font-bold"},`[!] ${h.length} EXPOSED SERVICE${h.length===1?"":"S"} â harden these first.`):i("div",{class:"mt-1 text-primary-container"},"[ok] no open ports in the probe set."),i("div",{class:"mt-2 opacity-70 text-[10px]"},"For a real scan of a host you own: nmap -sV -p- <target>")),re()},130*g.length+220);l.push(y)})(),O("recon"),{node:r,typewrite:!1}},dig(n,e){const t=n[0],r=(n[1]||"A").toUpperCase();if(!t)return{node:j(`dig: usage: dig <name> [type] â types: ${Ct}, ANY`),typewrite:!1};const a=T("text-primary-container"),s=i("div",{class:"opacity-70"},`; <<>> firefly dig 1.0 <<>> ${t} ${r}`),o=i("div",{class:"mt-1 opacity-70"},`;; querying ${r} for ${t} over DoH â¦`);a.append(s,o);const d=new AbortController;return e.registerInterrupt(()=>d.abort()),(async()=>{const l=r==="ANY"?["A","AAAA","MX","TXT","NS"]:[r];try{const u=[];for(const y of l)u.push(await nt(t,y,d.signal));const m=u[0],f=u.flatMap(y=>y.answers),g=u.flatMap(y=>y.authority);if(o.replaceChildren(q(`;; ->>HEADER<<- opcode: QUERY, status: ${Ue(m.status)}, qdcount: ${l.length}`),q(";; flags: qr rd ra; QUERY: "+l.length+", ANSWER: "+f.length+", AUTHORITY: "+g.length),i("div",{class:"mt-2 opacity-70"},";; QUESTION SECTION:"),...l.map(y=>i("div",{},`;${t}.`.padEnd(32," "),`IN ${y}`))),f.length>0){o.append(i("div",{class:"mt-2 opacity-70"},";; ANSWER SECTION:"));for(const y of f)o.append(We(y))}else o.append(i("div",{class:"mt-2 text-error"},`;; no ${l.join("/")} records â status ${Ue(m.status)}`));if(g.length>0&&f.length===0){o.append(i("div",{class:"mt-2 opacity-70"},";; AUTHORITY SECTION:"));for(const y of g.slice(0,4))o.append(We(y))}o.append(q(`;; Query time: ${u.reduce((y,h)=>y+h.ms,0)} msec`,"mt-2 opacity-70"),q(`;; SERVER: ${m.resolver}`,"opacity-70"),q(`;; WHEN: ${new Date().toString()}`,"opacity-70"),q(";; NOTE: resolution happens in your browser; the query name is visible to the resolver.","mt-2 opacity-50 text-[10px]"))}catch(u){o.replaceChildren(i("div",{class:"text-error"},`;; connection to the resolvers failed: ${u instanceof Error?u.message:String(u)}`),q(";; check your network, or the resolver may be rate limiting.","mt-1 opacity-70"))}re()})(),{node:a,typewrite:!1}},whois(n,e){const t=n[0]?.trim();if(!t)return{node:j("whois: usage: whois <domain|ip> e.g. whois tonykl.com"),typewrite:!1};const r=T("text-primary-container"),a=i("div",{class:"mt-1 opacity-70"},`;; asking RDAP about ${t} â¦`);r.append(a);const s=new AbortController;return e.registerInterrupt(()=>s.abort()),(async()=>{try{const o=await It(t,s.signal),d=[];o.kind==="domain"?(d.push(["Domain Name",o.name]),o.registrar&&d.push(["Registrar",o.registrar]),o.createdAt&&d.push(["Created",o.createdAt]),o.updatedAt&&d.push(["Updated",o.updatedAt]),o.expiresAt&&d.push(["Expires",o.expiresAt]),o.status.length&&d.push(["Status",o.status.join(", ")
1]),o.nameservers.length&&d.push(["Name Servers",o.nameservers.join(` 2`)]),o.dnssec&&d.push(["DNSSEC",o.dnssec]),o.handle&&d.push(["Registry ID",o.handle])):(d.push(["Network",o.name]),o.network&&d.push(["CIDR",o.network]),o.country&&d.push(["Country",o.country]),o.handle&&d.push(["Handle",o.handle]),o.status.length&&d.push(["Status",o.status.join(", ")]));const l=i("div",{class:"mt-2 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1 text-[11px]"});for(const[u,m]of d)l.append(i("span",{class:"text-secondary opacity-80"},u),i("span",{class:"text-white/90 whitespace-pre-wrap break-words"},m));a.replaceChildren(i("div",{class:"text-secondary tracking-widest text-[11px]"},`RDAP RECORD â ${o.kind.toUpperCase()}`),l,q(`;; ${o.ms} msec via rdap.org bootstrap · source of truth: the responsible registry`,"mt-2 opacity-50 text-[10px]"))}catch(o){a.replaceChildren(i("div",{class:"text-error"},`whois: ${o instanceof Error?o.message:String(o)}`),q(";; RDAP covers registered domains and IP allocations. Check the spelling, or try the IP form.","mt-1 opacity-70"))}re()})(),{node:r,typewrite:!1}},tour(n,e){return e.startTour(),{node:T("text-primary-container","tour: starting guided walkthrough â Ctrl+C to abort."),typewrite:!1}},share(n,e){const t=e.history.filter(o=>!o.startsWith("share")&&o!=="clear"&&o!=="reboot"&&o!=="tour").slice(-12);if(t.length===0)return{node:j("share: nothing to replay yet â run a few commands first."),typewrite:!1};const r=`${window.location.origin}/?replay=${encodeURIComponent(t.join(","))}`,a=T("text-primary-container"),s=i("div",{class:"mt-1 break-all text-secondary select-all"},r);return a.append(i("div",{},`replay link for ${t.length} command${t.length===1?"":"s"}:`),s,q(";; anyone opening it watches this session type itself out.","mt-2 opacity-70 text-[10px]")),navigator.clipboard?.writeText(r).then(()=>{a.append(q(";; copied to clipboard.","mt-1 opacity-70 text-[10px]"))}).catch(()=>{a.append(q(";; clipboard blocked â copy the line above.","mt-1 opacity-70 text-[10px]"))}),{node:a,typewrite:!1}},dejavu(n,e){return e.dejavu(),{node:T("text-primary-container","there is no spoon."),typewrite:!1}},ls(n,e){const t=Object.entries(e.files),r=i("div",{class:"ml-4 mt-2"});if(t.length===0)return r.append(i("div",{class:"opacity-80"},"total 0 â no archives mounted."),i("div",{class:"mt-1 opacity-60 text-[11px]"},e.notionConnected?"Uplink is up but the database returned no entries. Check the data source.":"Uplink offline. Set NOTION_API_KEY + NOTION_DATA_SOURCE_ID to publish project entries."),i("div",{class:"mt-1 opacity-60 text-[11px]"},"Try 'contact' for channels or 'whoami' for the operator profile.")),{node:r,typewrite:!1};const a=t.filter(([,d])=>d.available).length;r.append(i("div",{class:"opacity-60 text-[10px] mb-2"},`${t.length} entr${t.length===1?"y":"ies"} · ${a} open · ${t.length-a} sealed · click a card to cat it`));const s=i("div",{class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3"}),o=[...t].sort((d,l)=>Number(l[1].available)-Number(d[1].available));for(const[d,l]of o){const u=i("button",{type:"button","data-command":`cat ${d}`,"aria-label":l.available?`Open ${d}: ${l.desc}`:`${d} is sealed: ${l.desc}`,class:"bento-card hover-lift text-left w-full cursor-pointer"},i("div",{class:`font-bold text-sm flex items-center gap-2 ${l.available?"text-primary-container":"text-primary-container/60"}`},i("span",{class:"truncate"},d),l.available?i("span",{class:"ml-auto text-[9px] text-secondary shrink-0"},"[OPEN]"):i("span",{class:"ml-auto text-[9px] text-error shrink-0"},"[SEALED]")),i("div",{class:"text-[10px] text-white/60 mt-1 line-clamp-2"},l.desc),l.tag?i("div",{class:"text-[9px] opacity-50 mt-2 tracking-widest"},l.tag):"");s.append(u)}return r.append(s),{node:r,typewrite:!1}},cat(n,e){const t=n[0];if(!t)return{node:T("text-error","cat: missing file operand â usage: cat <file> (run 'ls' for the list)"),typewrite:!1};const r=e.files[t];if(!r)return{node:j(`cat: ${t}: No such file or directory`),typewrite:!1};if(!r.available||!r.url||r.url==="#")return{node:T("text-error",`cat: ${t}: archive sealed â contact operator for access`),typewrite:!1};const a=i("div",{class:"ml-4 mt-4 w-full max-w-4xl bg-surface border border-outline-variant mb-8"}),s=i("div",{class:"bg-primary-container text-black text-[10px] font-bold px-2 py-1 flex justify-between items-center select-none uppercase tracking-widest"},i("span",{class:"truncate"},`VIEWER_MODULE // ${t}`)),o=i("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",class:"hover:bg-black hover:text-primary-container transition-colors mr-2 flex items-center gap-1 bg-black/15 px-2 py-0.5
2shrink-0 font-bold","aria-label":`Open ${t} in a new tab`},"[NEW_SYS_WINDOW]");if(s.append(o),a.append(s),r.embed){const d=i("div",{class:"w-full bg-black p-1"});d.append(i("iframe",{src:r.url,class:"w-full h-[60vh] border-none bg-white grayscale-[0.3] contrast-[1.1]",title:t,loading:"lazy"})),a.append(d)}else a.append(i("div",{class:"p-4 flex flex-col gap-3"},i("div",{class:"text-[11px] opacity-80"},r.desc),i("div",{class:"text-[10px] opacity-60 break-all"},r.url),i("div",{class:"text-[10px] opacity-60"},"EXTERNAL RESOURCE â browsers block inline embedding, so this opens in a new tab."),i("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",class:"self-start border border-primary-container text-primary-container px-3 py-1.5 text-[11px] uppercase tracking-widest hover:bg-primary-container hover:text-black transition-colors"},"Open externally")));return O("archivist"),{node:a,typewrite:!1}},matrix(n,e){const t=(n[0]||"").toLowerCase();let r;return t==="on"||t==="off"?r=e.setMatrix(t==="on"):r=e.toggleMatrix(),r&&O("rainmaker"),{node:T("text-primary-container",r?"matrix: rain enabled â wake up, neo.":"matrix: rain disabled."),typewrite:!1}},theme(n,e){const t=(n[0]||"").toLowerCase();if(!t){const a=T("text-primary-container");return a.append(i("div",{},`current theme: ${e.currentTheme()}`),i("div",{class:"opacity-80 mt-1"},`available: ${e.themes.join(", ")}`),i("div",{class:"opacity-60 text-[10px] mt-1"},"usage: theme <name> | theme next")),{node:a,typewrite:!1}}const r=t==="next"?e.themes[(e.themes.indexOf(e.currentTheme())+1)%e.themes.length]:t;return e.themes.includes(r)?(e.setTheme(r),{node:T("text-primary-container",`theme: switched to ${r}.`),typewrite:!1}):{node:j(`theme: unknown palette "${t}". try: ${e.themes.join(", ")}`),typewrite:!1}},tail(n,e){const t=e.toggleLogFeed();return t&&O("packet_sniffer"),{node:T("text-primary-container",t?"tail -f /var/log/firefly.log â feed engaged.":"tail: feed detached."),typewrite:!1}},reboot(n,e){return O("reboot_loop"),e.triggerReboot(),{node:T("text-primary-container","reboot: signaling kernel ..."),typewrite:!1}},neofetch(){const n=navigator.userAgent,e=navigator.language||"en-US",t=(navigator.hardwareConcurrency||1)+" threads",r=window.innerWidth,a=window.innerHeight,s=window.devicePixelRatio||1,o=/firefox/i.test(n)?"Firefox":/edg/i.test(n)?"Edge":/chrome/i.test(n)?"Chrome":/safari/i.test(n)?"Safari":"Unknown",d=document.documentElement.getAttribute("data-theme")||"matrix",l=["âââââââââââââ","â ââââââââ â","â ââââââââ â","â FIREFLY â","â v.1.0.0 â","âââââââââââââ"],u=[["operator","tony@firefly"],["os","FireflyOS x86_64"],["kernel","6.0.8-firefly"],["shell","/bin/firefly-sh"],["theme",d],["terminal",o],["language",e],["cpu",t],["viewport",`${r}x${a} @ ${s}x`],["uptime",`${Math.floor(performance.now()/1e3)}s`]],m=i("div",{class:"ml-4 mt-2 flex gap-4 flex-wrap"}),f=i("pre",{class:"text-primary-container text-[11px] leading-tight m-0"});f.textContent=l.join(` 3`);const g=i("div",{class:"text-[12px] flex flex-col gap-0.5"});for(const[y,h]of u)g.append(i("div",{class:"flex gap-2"},i("span",{class:"text-secondary w-24 shrink-0"},y),i("span",{class:"text-white"},h)));return m.append(f,g),{node:m,typewrite:!1}},top(n,e){const t=i("div",{class:"ml-4 mt-2 text-primary-container font-mono text-[12px]"}),r=i("div",{class:"opacity-80"}),a=i("div",{class:"mt-2 grid grid-cols-[44px_52px_52px_1fr] sm:grid-cols-[60px_60px_60px_1fr] gap-2 text-secondary border-b border-outline-variant/40 pb-1"},i("span",{},"PID"),i("span",{},"CPU%"),i("span",{},"MEM%"),i("span",{},"COMMAND")),s=i("div",{class:"space-y-0.5 mt-1"}),o=i("div",{class:"mt-2 opacity-70 text-[10px]"},"live â press Ctrl+C to stop (auto-stops in 8s)");t.append(r,a,s,o);const d=[{pid:1,cmd:"/sbin/firefly-init",cpu:.1,mem:.5},{pid:217,cmd:"sshd",cpu:0,mem:.4},{pid:411,cmd:"firefly-shell",cpu:.3,mem:.6},{pid:612,cmd:"notion-uplink",cpu:1.2,mem:1.4},{pid:808,cmd:"tail -f /var/log/firefly.log",cpu:.4,mem:.3},{pid:901,cmd:"matrix-rain --renderer=canvas",cpu:8.7,mem:2.1},{pid:1024,cmd:"audio-synth --triangle",cpu:.6,mem:.7},{pid:1337,cmd:"recon-daemon --target=lan",cpu:4.2,mem:1.9},{pid:2048,cmd:"opsec-monitor --strict",cpu:2.1,mem:1.2},{pid:4096,cmd:"gh-pages --watch",cpu:.2,mem:.5}];let l,u;const m=y=>{l&&window.clearInterval(l),u&&window.clearTimeout(u),l=void 0,u=void 0,f(),o.textContent=y,o.classList.add("opacity-50")},f=e.registerInterrupt(()=>m("â stopped â")),g=()=>{const y=new Date().toLocaleTimeString(),h=(Math.random()*1.5+.2).toFixed(2);r.textContent=`top - ${y} load avg: ${h}, ${(parseFloat(h)*1.1).toFixed(2)}, ${(parseFloat(h)*1.3).toFixed(2)} · ${d.length} tasks`;for(const v of d)v.cpu=Math.max(0,v.cpu+(Math.random()-.5)*1.5),v.mem=Math.max(0,v.mem+(Math.random()-.5)*.4);const x=[...d].sort((v,L)=>L.cpu-v.cpu);s.replaceChildren(...x.map(v=>i("div",{class:"grid grid-cols-[44px_52px_52px_1fr] sm:grid-cols-[60px_60px_60px_1fr] gap-2 text-white/90"},i("span",{},String(v.pid)),i("span",{class:v.cpu>5?"text-error":"text-primary-container"},v.cpu.toFixed(1)),i("span",{},v.mem.toFixed(1)),i("span",{class:"truncate opacity-90"},v.cmd))))};return g(),l=window.setInterval(g,900),u=window.setTimeout(()=>m("â stopped â"),8e3),O("process_killer"),{node:t,typewrite:!1}},status(n,e){const t=i("div",{class:"ml-4 mt-2 text-primary-container"}),r=navigator.userAgent,a=/android/i.test(r)?"Android":/iphone|ipad|ipod/i.test(r)?"iOS":/mac os x|macintosh/i.test(r)?"macOS":/windows/i.test(r)?"Windows":/linux/i.test(r)?"Linux":"unknown",s=/firefox/i.test(r)?"Firefox":/edg/i.test(r)?"Edge":/chrome/i.test(r)?"Chrome":/safari/i.test(r)?"S
3afari":"unknown",o=navigator.connection,d=performance.memory,l=e.sfx.state(),u=performance.now()/1e3,m=u>3600?`${Math.floor(u/3600)}h ${Math.floor(u%3600/60)}m`:u>60?`${Math.floor(u/60)}m ${Math.floor(u%60)}s`:`${u.toFixed(1)}s`,f=He().length,g=je().length,y=[["build",`${e.build.sha} · deployed ${new Date(e.build.builtAt).toISOString().replace("T"," ").slice(0,16)} UTC`],["runtime",`${s} · ${a} · ${navigator.hardwareConcurrency||"?"} threads`],["viewport",`${window.innerWidth}Ã${window.innerHeight} @${window.devicePixelRatio||1}x · ${navigator.language}`],["network",navigator.onLine?`online${o?.effectiveType?` (${o.effectiveType})`:""}`:"offline"],["audio",l.muted?"muted":`on · ${Math.round(l.volume*100)}% vol${l.ambient?" · rain bed live":""}`],["effects",`theme ${e.currentTheme()} · rain ${e.matrixActive()?"on":"off"} · log feed ${e.logVisible()?"on":"off"}`],["session",`${m} · ${e.history.length} commands issued`]];d&&y.push(["heap",`${(d.usedJSHeapSize/1048576).toFixed(1)} MB JS heap in use`]);const h=i("div",{class:"mt-2 grid grid-cols-[88px_1fr] gap-x-3 gap-y-1 text-[11px]"});for(const[L,w]of y)h.append(i("span",{class:"text-secondary opacity-80"},L),i("span",{class:"text-white/90 break-words"},w));const x=g===0?0:Math.round(f/g*100),v=i("div",{class:"mt-3 stat-bar",role:"progressbar","aria-valuenow":String(f),"aria-valuemin":"0","aria-valuemax":String(g),"aria-label":`Operator badges: ${f} of ${g}`});return v.append(i("span",{style:`width:${x}%`})),t.append(i("div",{class:"text-secondary tracking-widest text-[11px]"},"FIREFLY STATUS REPORT"),h,i("div",{class:"mt-3 text-[11px]"},`OPERATOR PROGRESS â ${f}/${g} badges (${x}%)`),v,i("div",{class:"mt-2 opacity-70 text-[10px]"},"Run 'achievements' for the full badge list.")),{node:t,typewrite:!1}},sfx(n,e){const t=(n[0]||"").toLowerCase(),r=e.sfx.state();if(t==="on")return e.sfx.setMuted(!1),e.sfx.play("done"),{node:T("text-primary-container","sfx: enabled."),typewrite:!1};if(t==="off")return e.sfx.setMuted(!0),O("go_dark"),{node:T("text-primary-container","sfx: muted. The room goes quiet."),typewrite:!1};if(t==="test"){const o=["key","type","enter","done","error","boot"],d=[];return o.forEach((l,u)=>{d.push(window.setTimeout(()=>e.sfx.play(l),120+u*420))}),e.registerInterrupt(()=>d.forEach(l=>window.clearTimeout(l))),{node:T("text-primary-container","sfx: playing the full voice set â key · type · enter · done · error · boot"),typewrite:!1}}const a=Number.parseInt(t,10);if(t&&Number.isFinite(a))return a<0||a>100?{node:j("sfx: volume must be 0-100"),typewrite:!1}:(e.sfx.setMuted(a===0),e.sfx.setVolume(a/100),a>0&&e.sfx.play("done"),{node:T("text-primary-container",`sfx: volume set to ${a}%.`),typewrite:!1});if(t&&!["status","volume"].includes(t))return{node:j(`sfx: unknown option "${t}". try: sfx on | sfx off | sfx 0-100 | sfx test`),typewrite:!1};const s=T("text-primary-container");return s.append(i("div",{},`state: ${r.muted?"MUTED":`ON at ${Math.round(r.volume*100)}%`}`),i("div",{class:"opacity-80 mt-1"},`engine: ${r.ready?"audio context live":"idle until first interaction"}`),i("div",{class:"opacity-80"},`rain bed: ${r.ambient?"playing":"off"}`),i("div",{class:"opacity-60 text-[10px] mt-1"},"the keyboard is a mechanical switch, the print head is a falling-code tick, and enter rings the carriage bell"),i("div",{class:"opacity-60 text-[10px]"},"usage: sfx on | sfx off | sfx 0-100 | sfx test")),{node:s,typewrite:!1}},palette(n,e){return e.openPalette(),{node:T("text-primary-container","palette: opened â type to filter, â to run, esc to close."),typewrite:!1}},neo(n,e){return O("the_one"),e.glitch(["WAKE UP, NEOâ¦","THE MATRIX HAS YOU","FOLLOW THE WHITE RABBIT"]),e.setMatrix(!0),e.sfx.play("boot"),{node:T("text-primary-container font-bold tracking-widest","neo: knock, knock."),typewrite:!1}},redpill(n,e){return O("redpill"),e.setTheme("matrix"),e.setMatrix(!0),e.sfx.play("surge"),{node:T("text-primary-container","you take the red pill â you stay in Wonderland, and I show you how deep the rabbit hole goes."),typewrite:!0}},bluepill(n,e){return O("bluepill"),e.setTheme("mono"),e.setMatr
3ix(!1),{node:T("text-primary-container","you take the blue pill â the story ends, you wake in your bed and believe whatever you want to believe."),typewrite:!0}},achievements(){const n=je(),e=i("div",{class:"ml-4 mt-2 text-primary-container"});return e.append(i("div",{class:"text-secondary"},`OPERATOR BADGES â ${He().length}/${n.length}`),i("div",{class:"mt-2 grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-1 text-[12px]"},...n.map(t=>{const r=qt(t.id);return i("div",{class:r?"text-primary-container":"text-white/55"},i("span",{class:"inline-block w-5 opacity-80"},r?"â":"â"),i("span",{class:"font-bold"},t.name),i("span",{class:"block opacity-80 ml-5 text-[10px]"},r?"UNLOCKED":t.hint))}))),{node:e,typewrite:!1}}},Ae=Object.keys(Q),Bt=new Set(["sudo","neo","redpill","bluepill","dejavu"]);function Ut(){const n=new Map,e=new Map;for(const[t,r]of at){const a=t.split(" ")[0];n.set(a,t),e.set(a,r)}return Ae.filter(t=>!Bt.has(t)).map(t=>({command:t,label:n.get(t)??t,desc:e.get(t)??"unlisted command",kind:"command"}))}const Ke={"firefly_src.url":{desc:"This terminal â Astro + Tailwind source on GitHub",url:"https://github.com/TBLopez/Portfolio",available:!0,embed:!1,tag:"CODE"},"operator_repos.url":{desc:"Public repositories & tooling",url:"https://github.com/TBLopez",available:!0,embed:!1,tag:"CODE"},"linkedin.url":{desc:"Professional profile & work history",url:"https://www.linkedin.com/in/techtony/",available:!0,embed:!1,tag:"CONTACT"}},ue="ã¢ã¤ã¦ã¨ãªã«ãã¯ã±ã³ãµã·ã¹ã»ã½ã¿ããããããããããããããããã ã¡ã¢ã¤ã¦ã¨ã©ãªã«ã¬ãã¯ã²ã³0123456789ABCDEF<>/\\:;|*+-=#@";let G=null;function Vt(){if(G)return G;let n=null,e=null,t=[],r=null,a=0,s=!1,o=0,d;const l=16,u=()=>{n||(n=document.getElementById("matrix-rain"),n&&(e=n.getContext("2d"),m(),window.addEventListener("resize",m)))},m=()=>{if(!n)return;const y=window.innerWidth<768?1:2,h=Math.min(window.devicePixelRatio||1,y);n.width=window.innerWidth*h,n.height=window.innerHeight*h,e?.scale(h,h);const x=Math.ceil(window.innerWidth/l);t=new Array(x).fill(0).map(()=>Math.floor(Math.random()*(window.innerHeight/l)))},f=y=>getComputedStyle(document.documentElement).getPropertyValue(y).trim()||"0 255 65",g=y=>{if(!s||!e||!n)return;const h=y<o;if(y-a<(h?32:55)){r=requestAnimationFrame(g);return}a=y,e.fillStyle="rgba(0, 0, 0, 0.07)",e.fillRect(0,0,n.width,n.height);const x=f("--c-primary-container"),v=f("--c-secondary");e.font=`bold ${l}px "JetBrains Mono", monospace`;for(let L=0;L<t.length;L++){const w=ue.charAt(Math.floor(Math.random()*ue.length)),M=L*l,R=t[L]*l;e.fillStyle=`rgb(${x} / 0.95)`,e.fillText(w,M,R),e.fillStyle=`rgb(${v} / 0.55)`,e.fillText(ue.charAt(Math.floor(Math.random()*ue.length)),M,R-l*2),R>window.innerHeight&&Math.random()>.965&&(t[L]=0),t[L]+=h?2:1}r=requestAnimationFrame(g)};return G={start:()=>{u(),n&&(s||(s=!0,n.classList.add("active"),a=0,r=requestAnimationFrame(g)))},stop:()=>{s=!1,r&&cancelAnimationFrame(r),r=null,n?.classList.remove("active"),e&&n&&e.clearRect(0,0,n.width,n.height)},toggle:()=>(s?G.stop():G.start(),s),isActive:()=>s,surge:()=>{if(!s||!n)return;o=performance.now()+280;const y=Math.max(2,Math.floor(t.length*.05));for(let h=0;h<y;h++)t[Math.floor(Math.random()*t.length)]=0;n.classList.add("surge"),d&&window.clearTimeout(d),d=window.setTimeout(()=>n?.classList.remove("surge"),280)}},G}const $e="logfeed.visible",Ht=60,X=()=>`${I(10,240)}.${I(0,255)}.${I(0,255)}.${I(1,254)}`,I=(n,e)=>Math.floor(n+Math.random()*(e-n+1)),pe=n=>n[Math.floor(Math.random()*n.length)],jt=["root","admin","guest","oracle","pi","tony","operator"],Ge=[22,80,443,3306,5432,8080,6379,25565,8443,8888],Yt=[()=>({text:`sshd[${I(1e3,9999)}]: Failed password for ${pe(jt)} from ${X()} port ${I(4e4,6e4)}`,severity:"warn"}),()=>({text:`sshd[${I(1e3,9999)}]: Accepted publickey for tony from ${X()} port ${I(4e4,6e4)}`,severity:"info"}),()=>({text:`kernel: nf_conntrack: DROP IN=eth0 SRC=${X()} DST=10.0.0.1 PROTO=TCP SPT=${I(1024,65e3)} DPT=${pe(Ge)}`,severity:"normal"}),()=>({text:`suricata: ET POLICY Outbound DNS lookup of suspicious.tld from ${X()}`,severity:"warn"}),()=>({text:`nginx: ${X()}
3 - "GET /admin HTTP/1.1" 401 - "curl/8.4.0"`,severity:"normal"}),()=>({text:`auditd: type=USER_LOGIN msg=audit(${Date.now()/1e3|0}.${I(100,999)}:${I(100,999)}): pid=${I(1e3,9999)} uid=0 res=success`,severity:"info"}),()=>({text:`cron[${I(1e3,9999)}]: (operator) CMD (run-parts --report /etc/cron.hourly)`,severity:"normal"}),()=>({text:`fail2ban: WARNING [sshd] Ban ${X()}`,severity:"warn"}),()=>({text:`dhclient: bound to 10.0.0.${I(2,250)} -- renewal in ${I(1200,3600)} seconds`,severity:"info"}),()=>({text:`kernel: TCP: request_sock_TCP: Possible SYN flooding on port ${pe(Ge)}`,severity:"warn"})];function Wt(){const n=new Date,e=t=>String(t).padStart(2,"0");return`${e(n.getHours())}:${e(n.getMinutes())}:${e(n.getSeconds())}`}let z=null;function it(){if(z)return z;let n=null,e=null,t=null,r=!1;const a=()=>{n=document.getElementById("log-pane"),e=document.getElementById("log-stream")},s=()=>{if(!e)return;const l=pe(Yt),{text:u,severity:m}=l(),f=document.createElement("div");f.className="log-line"+(m!=="normal"?" "+m:"");const g=document.createElement("span");for(g.className="ts",g.textContent=Wt(),f.appendChild(g),f.appendChild(document.createTextNode(u)),e.appendChild(f);e.children.length>Ht;)e.firstElementChild?.remove();e.scrollTop=e.scrollHeight},o=()=>{if(t!==null)return;const l=()=>{s(),t=window.setTimeout(l,I(450,1700))};l()},d=()=>{t!==null&&window.clearTimeout(t),t=null};return z={show:()=>{a(),n&&(n.removeAttribute("hidden"),r=!0,localStorage.setItem($e,"1"),o())},hide:()=>{a(),n&&(n.setAttribute("hidden",""),r=!1,localStorage.setItem($e,"0"),d())},toggle:()=>(r?z.hide():z.show(),r),isVisible:()=>r},z}function Kt(){const n=it();localStorage.getItem($e)==="1"&&n.show()}const me=["matrix","amber","ice","dracula","mono"],st="theme";function fe(){const n=localStorage.getItem(st);return n&&me.includes(n)?n:"matrix"}function ct(n){document.documentElement.setAttribute("data-theme",n),localStorage.setItem(st,n)}function Gt(){ct(fe())}const lt="boot.shown";let oe=null;function Xt(){return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}function zt(){const n=navigator.userAgent,e=navigator.hardwareConcurrency||8,t=/arm64|aarch64|apple/i.test(n)?"arm64":/x86_64|win64|x64/i.test(n)?"x86_64":"unknown",r=/android/i.test(n)?"Android":/iphone|ipad|ipod/i.test(n)?"iOS":/mac os x|macintosh/i.test(n)?"macOS":/windows/i.test(n)?"Windows":/linux/i.test(n)?"Linux":"FireflyOS",a=navigator.deviceMemory,s=Math.max(1,Math.round(performance.now()));return[{text:"FIREFLY-BIOS v6.0.8 (c) Tony Industries",delay:80},{text:`POST: CPU ......... cores: ${e} / arch: ${t}`,delay:70,tag:"ok"},{text:`POST: MEM ......... ${a?`${a} GB reported`:"capacity hidden by browser"}`,delay:70,tag:"ok"},{text:`POST: NIC ......... ${navigator.onLine?"link UP":"link DOWN"}`,delay:90,tag:navigator.onLine?"ok":"warn"},{text:`Mounting /dev/sda1 ................. (${s}ms)`,delay:110,tag:"ok"},{text:"Loading kernel modules: nf_conntrack, raw_sock, hidkbd, audio_synth",delay:120,tag:"ok"},{text:`Initializing terminal subsystem .... ${r} / ${navigator.language}`,delay:80,tag:"ok"},{text:"Decrypting /home/operator/firefly ....",delay:140,tag:"ok"},{text:"Validating notion uplink ............",delay:110},{text:"Spawning shell: /bin/firefly-sh",delay:90,tag:"ok"},{text:"",delay:40},{text:"> WELCOME, OPERATOR.",delay:60}]}function Jt(){return!sessionStorage.getItem(lt)}function Qt(){sessionStorage.setItem(lt,"1")}async function Xe(){oe?.cancel();const n=document.getElementById("boot-overlay");if(!n)return;let e=!1;const t={cancel:()=>{e=!0}};oe=t,n.innerHTML="",n.classList.add("active"),n.setAttribute("aria-hidden","false"),document.body.classList.add("booting"),A.play("boot");const r=document.createElement("button");r.className="boot-skip",r.type="button",r.textContent="[ SKIP â¶ ]",n.appendChild(r);const a=()=>{window.clearTimeout(d),document.removeEventListener("keydown",o),n.classList.remove("active"),n.setAttribute("aria-hidden","true"),document.body.classList.remove("booting"),oe===t&&(oe=null),Qt(),document.getElementById("cmd-input")?.focus()},s=()=>t.cancel();
3r.addEventListener("click",s);const o=m=>{(m.key==="Escape"||m.key==="Enter"||m.key===" ")&&s()},d=window.setTimeout(()=>document.addEventListener("keydown",o),0),l=m=>new Promise(f=>window.setTimeout(f,m)),u=Xt();for(const m of zt()){if(e)break;const f=document.createElement("div");f.className="boot-line"+(m.tag?" "+m.tag:""),f.textContent=m.text,n.appendChild(f),await l(u?5:m.delay)}if(e){oe===t?a():document.removeEventListener("keydown",o);return}await l(u?50:350),a()}function ze(n,e){if(!e)return 0;let t=0,r=0,a=0,s=0;for(;t<n.length&&r<e.length;)n[t]===e[r]?(s++,a+=s*2,(t===0||n[t-1]===" ")&&(a+=4),r++):s=0,t++;return r===e.length?a-n.length*.01:null}function Zt(n){let e=null,t=null,r=null,a=null,s=[],o=0,d=null;const l=()=>{if(e)return;e=document.createElement("div"),e.id="palette-root",e.hidden=!0,e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-label","Command palette");const x=document.createElement("div");x.className="palette";const v=document.createElement("div");v.className="palette-input-row";const L=document.createElement("span");L.className="prompt",L.textContent=">",t=document.createElement("input"),t.id="palette-input",t.type="text",t.placeholder="run a command or search archivesâ¦",t.autocomplete="off",t.spellcheck=!1,t.setAttribute("aria-label","Search commands and archives"),t.setAttribute("aria-controls","palette-list"),t.setAttribute("role","combobox"),t.setAttribute("aria-expanded","true"),v.append(L,t),r=document.createElement("div"),r.className="palette-list",r.id="palette-list",r.setAttribute("role","listbox"),r.setAttribute("aria-label","Results"),a=document.createElement("div"),a.className="palette-foot",a.innerHTML="<span>ââ move · â run · esc close</span><span>ctrl+k</span>",x.append(v,r,a),e.append(x),document.body.append(e),e.addEventListener("mousedown",w=>{w.target===e&&h()}),t.addEventListener("input",()=>{o=0,u()}),t.addEventListener("keydown",w=>{w.key==="ArrowDown"?(w.preventDefault(),f(1)):w.key==="ArrowUp"?(w.preventDefault(),f(-1)):w.key==="Enter"?(w.preventDefault(),g()):w.key==="Escape"?(w.preventDefault(),h()):w.key==="Tab"&&(w.preventDefault(),f(w.shiftKey?-1:1))})},u=()=>{if(!r||!t)return;const x=t.value.trim().toLowerCase();if(s=n.entries().map(w=>{const M=ze(w.label.toLowerCase(),x),R=ze(w.desc.toLowerCase(),x),_=M===null?R:R===null?M:Math.max(M,R);return{entry:w,s:_}}).filter(w=>w.s!==null).sort((w,M)=>M.s-w.s).slice(0,12).map(w=>w.entry),o>=s.length&&(o=Math.max(0,s.length-1)),r.replaceChildren(),s.length===0){const w=document.createElement("div");w.className="palette-empty",w.textContent=`no matches for â${t.value.trim()}â â try 'help'`,r.append(w);return}s.forEach((w,M)=>{const R=document.createElement("button");R.type="button",R.className="palette-item",R.setAttribute("role","option"),R.setAttribute("aria-selected",String(M===o)),R.id=`palette-item-${M}`;const _=document.createElement("span"),U=document.createElement("span");U.className="name",U.textContent=w.label;const Y=document.createElement("span");Y.className="desc",Y.textContent=w.desc,_.append(U,Y);const B=document.createElement("span");B.className="kind",B.textContent=w.kind,R.append(_,B),R.addEventListener("mousemove",()=>{o!==M&&(o=M,m())}),R.addEventListener("click",()=>{o=M,g()}),r.append(R)}),m()},m=()=>{if(!r||!t)return;[...r.querySelectorAll(".palette-item")].forEach((v,L)=>{v.setAttribute("aria-selected",String(L===o))});const x=r.querySelector(`#palette-item-${o}`);x&&(x.scrollIntoView({block:"nearest"}),t.setAttribute("aria-activedescendant",x.id))},f=x=>{s.length!==0&&(o=(o+x+s.length)%s.length,m())},g=()=>{const x=s[o];x&&(h(),n.onRun(x.command))},y=()=>{l(),!(!e||!t)&&(d=document.activeElement,e.hidden=!1,t.value="",o=0,u(),t.focus())},h=()=>{!e||e.hidden||(e.hidden=!0,d?.focus?.(),d=null)};return{open:y,close:h,isOpen:()=>!!e&&!e.hidden,refresh:()=>{e&&!e.hidden&&u()}}}function J(){return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1}function en(n){if(!n||n==="#")return!1;try{const e=new URL(n,window.location.href);return e.origin===window.location.origin?!0:/\.(pdf|png|jpe?g|webp|gif|svg|txt|md)$/i.test(e.pathname)}catch{return!1}}const Se=n=>(n??"").replace(/\/+$/,"").toLowerCase();function tn(n){const e={...Ke},t=new Set(Object.values(Ke).map(r=>Se(r.url)));for(const r of n){if(!r.url||r.url==="#"||t.has(Se(r.url)))continue;t.add(Se(r.url));const a=r.title.toLowerCase().replace(/\s+/g,"_")+(r.ext??".md");e[a]={desc:r.description,url:r.url,available:!!r.url&&r.url!=="#",embed:en(r.url),tag:r.tag??"NOTION"}}return e}const dt="terminal.history",Je="terminal.lastVisit",nn=100;function rn(){try{const n=sessionStorage.getItem(dt);return n?JSON.parse(n):[]}catch{return[]}}function on(n){try{sessionStorage.setItem(dt,JSON.stringify(n.slice(-nn)))}catch{}}function an(n){return n.toUTCString().replace("GMT","UTC").toUpperCase()}function sn(n){const e=document.getElementById("cmd-input"),t=document.getElementById("cmd-form"),r=document.getElementById("history-container"),a=document.getElementById("terminal-output"),s=document.getElementById("terminal-footer");if(!e||!t||!r||!a||!s)return;const o=e,d=t,l=r,u=a,m=s,f=tn(n.notionProjects),g=rn();let y=g.length,h=null;const x=new Set,v=c=>(x.add(c),()=>x.delete(c)),L=()=>{for(const c of[...x])try{c()}catch{}x.clear()};
3Gt(),Kt(),Qe(fe());const w=Vt(),M=it(),R=c=>{c?w.start():w.stop();const p=w.isActive();return A.setAmbient(p),p},_=document.getElementById("glitch-overlay");let U;const Y=c=>{if(!_||J())return;let p=0;const b=()=>{_&&(_.textContent=c[p]??"",_.classList.remove("active"),_.offsetWidth,_.classList.add("active"),p++,p<c.length?U=window.setTimeout(b,820):U=window.setTimeout(()=>{_.classList.remove("active")},2400))};U&&window.clearTimeout(U),b()},B=document.getElementById("dejavu-cat");let Re=0;const Me=(c=!1)=>{const p=performance.now();return!c&&p-Re<9e4||J()?!1:(Re=p,document.body.classList.add("dejavu"),window.setTimeout(()=>document.body.classList.remove("dejavu"),1200),B&&(B.classList.remove("walking"),B.offsetWidth,B.classList.add("walking"),window.setTimeout(()=>B.classList.remove("walking"),5600)),A.play("surge"),O("dejavu"),W("> deja vu detected in sector 7 â they changed something.","opacity-70 text-[11px]"),Y(["DÃJÃ VU"]),!0)},ut=()=>{Math.random()<.045&&Me()};function W(c,p="opacity-70 text-[11px]"){const b=i("div",{class:`ml-4 mt-2 ${p}`},c);return l.appendChild(b),u.scrollTo({top:u.scrollHeight+1e3,behavior:"smooth"}),b}const ae={files:f,notionConnected:n.notionConnected,history:g,clear:()=>{h?.skip(),L(),l.innerHTML=""},interruptAll:L,registerInterrupt:v,toggleMatrix:()=>R(!w.isActive()),setMatrix:c=>R(c),matrixActive:()=>w.isActive(),toggleLogFeed:()=>M.toggle(),logVisible:()=>M.isVisible(),setTheme:c=>{ct(c),Ve(c,me),Qe(c)},themes:me,currentTheme:()=>fe(),triggerReboot:async()=>{await Xe()},setLastLogin:c=>{const p=document.getElementById("last-login-value");p&&(p.textContent=c)},sfx:{state:()=>A.getState(),setMuted:c=>A.setMuted(c),setVolume:c=>A.setVolume(c),play:c=>A.play(c)},openPalette:()=>H.open(),glitch:Y,startTour:()=>{yt()},dejavu:()=>{Me(!0)},build:{sha:n.buildSha||"dev",builtAt:n.builtAt||new Date().toISOString()}};Ve(fe(),me),Jt()&&Xe();const Oe=()=>setTimeout(()=>o.focus(),0),he=window.matchMedia?.("(hover: hover) and (pointer: fine)").matches??!1;m.addEventListener("click",Oe),he&&document.addEventListener("click",c=>{const p=c.target;window.getSelection()?.toString()||p.closest("a, button, input, iframe, [data-no-focus]")||Oe()});const ge=()=>A.init();document.addEventListener("keydown",ge,{once:!0}),document.addEventListener("click",ge,{once:!0}),document.addEventListener("pointerdown",ge,{once:!0});const K=document.getElementById("sfx-toggle"),Ie=c=>{if(!K)return;const p=Math.round(c.volume*100);K.textContent=c.muted?"[SFX:OFF]":`[SFX:ON ${p}%]`,K.setAttribute("aria-pressed",String(!c.muted)),K.setAttribute("aria-label",c.muted?"Sound effects muted â activate to enable":`Sound effects at ${p} percent â activate to mute`),K.title=c.muted?"SFX muted (type: sfx on)":`SFX ${p}% (type: sfx 0-100)`};Ie(A.getState()),A.onChange(Ie),K?.addEventListener("click",()=>{A.toggle(),A.isMuted()&&O("go_dark"),A.isMuted()||(A.init(),A.play("done"))});const Z=document.getElementById("sidebar"),ye=document.getElementById("sidebar-toggle"),ie=document.getElementById("sidebar-scrim"),se=window.matchMedia("(min-width: 768px)"),ce=c=>{if(!Z)return;const p=se.matches,b=p||c;Z.classList.toggle("-translate-x-full",!b),Z.setAttribute("aria-hidden",b?"false":"true"),ye?.setAttribute("aria-expanded",String(!p&&c)),ie&&(b&&!p?ie.removeAttribute("hidden"):ie.setAttribute("hidden",""))},pt=()=>ce(!0),we=(c=!1)=>{ce(!1),c&&ye?.focus()};ce(!1),se.addEventListener("change",()=>ce(!1)),ye?.addEventListener("click",()=>{pt(),Z?.querySelector("button, [href], input")?.focus()}),ie?.addEventListener("click",()=>we(!0)),document.addEventListener("keydown",c=>{c.key==="Escape"&&Z?.getAttribute("aria-hidden")==="false"&&!se.matches&&we(!0)});async function mt(c){const p=J();p||await new Promise(E=>window.setTimeout(E,1300));const b=i("div",{class:"ml-4 mt-3 pl-3 border-l-2 border-primary-container/40 text-primary-container tracking-wide"},c);l.appendChild(b),A.play("whisper"),p||await Ne(b,{pace:82,quiet:!0}),u.scrollTo({top:u.scrollHeight+1e3,behavior:"smooth"})}function Ne(c,{speed:p=6,pace:b,quiet:E=!1}={}){return J()?Promise.resolve():new Promise(S=>{const P=document.createTreeWalker(c,NodeFilter.SHOW_TEXT,null),k=[];let $;for(;$=P.nextNode();)($.nodeValue??"").trim()!==""&&k.push($);if(k.length===0){S();return}const D=k.map(F=>F.nodeValue??""),xt=D.reduce((F,ke)=>F+ke.length,0),Fe=b??Math.max(2,Math.min(p,Math.round(1200/Math.max(1,xt))));
3k.forEach(F=>F.nodeValue="");let te=0,ne=0,be=!1,de;l.setAttribute("aria-busy","true");const Be=()=>{k.forEach((F,ke)=>F.nodeValue=D[ke]),de&&window.clearTimeout(de),h=null,l.removeAttribute("aria-busy"),E||A.play("done"),S()},Te=()=>{if(be)return;if(te>=k.length){Be();return}const F=D[te];ne<F.length?(k[te].nodeValue=(k[te].nodeValue??"")+F.charAt(ne),ne++,!E&&ne%3===0&&A.play("type"),u.scrollTop=u.scrollHeight+1e3,de=window.setTimeout(Te,Fe)):(te++,ne=0,de=window.setTimeout(Te,Fe))};h={skip:()=>{be||(be=!0,Be())}},Te()})}function De(c){const p=document.createElement("div");p.className="flex items-center gap-2 mt-4";const b=document.createElement("span");b.textContent="tony@firefly:~$",b.className="text-primary-container font-bold glow-text";const E=document.createElement("span");E.className="text-white",E.textContent=c,p.append(b,E),l.appendChild(p)}function ft(c){const p=document.createElement("div");return p.className="ml-4 mt-2 text-error",p.textContent=`bash: ${c}: command not found. Type 'help' for available commands.`,p}async function V(c,p={}){const b=c.trim();if(b)h?.skip();else{De(""),u.scrollTo({top:u.scrollHeight+1e3,behavior:"smooth"});return}g.push(b),on(g),y=g.length;const[E,...S]=b.split(/\s+/),P=E.toLowerCase();if(Q[P]&&Pt(P,Ae.length),P==="clear"){Q.clear([],ae);return}De(b),A.play("enter");const k=Ye(b);if(k){await mt(k),!H.isOpen()&&!(p.fromClick&&!he)&&o.focus();return}const $=Q[P];let D=null;$?D=$(S,ae)??null:(D={node:ft(b),typewrite:!1},A.play("error")),D&&(D.node.classList.add("animate-fade-in-up"),l.appendChild(D.node),u.scrollTo({top:u.scrollHeight+1e3,behavior:"smooth"}),D.typewrite&&await Ne(D.node,{speed:p.fast?2:6}),!H.isOpen()&&!(p.fromClick&&!he)&&o.focus(),ut())}const H=Zt({entries:()=>[...Ut(),{command:"theme next",label:"theme next",desc:"Cycle to the next palette",kind:"action"},{command:"matrix on",label:"matrix on",desc:"Start the rain",kind:"action"},{command:"matrix off",label:"matrix off",desc:"Stop the rain",kind:"action"},...Object.entries(f).map(([c,p])=>({command:`cat ${c}`,label:c,desc:`${p.desc}${p.available?"":" â sealed"}`,kind:"archive"}))],onRun:c=>{V(c)}});document.addEventListener("keydown",c=>{(c.ctrlKey||c.metaKey)&&["k","p"].includes(c.key.toLowerCase())&&(c.preventDefault(),H.isOpen()?H.close():H.open())}),document.addEventListener("click",c=>{const p=c.target;if(p?.closest("[data-action]")?.dataset.action==="fullscreen"){c.preventDefault(),document.fullscreenElement?document.exitFullscreen().catch(()=>{}):document.documentElement.requestFullscreen?.().catch(()=>{});return}const E=p?.closest("[data-command]");if(!E)return;c.preventDefault();const S=E.dataset.command??"";se.matches||we(),V(S,{fromClick:!0})});let le=null;function ht(){const c=o.value,p=c.split(" "),b=(E,S)=>{if(E.length===0)return;const P=c.trim().toLowerCase(),k=le&&le.key===P?(le.index+1)%E.length:0,$=E[k];le={key:$.toLowerCase(),index:k},o.value=S($)};if(p.length===1){const E=p[0].toLowerCase();b(Ae.filter(S=>S.startsWith(E)),S=>S+" ")}else if(p.length===2&&p[0].toLowerCase()==="cat"){const E=p[1].toLowerCase();b(Object.keys(f).filter(S=>S.startsWith(E)),S=>"cat "+S)}}let _e=0;const gt=()=>{if(!w.isActive())return;const c=performance.now();c-_e<110||(_e=c,w.surge(),Math.random()<.14&&A.play("surge"))};o.addEventListener("keydown",c=>{if(document.body.classList.contains("booting")){c.preventDefault();return}if(A.init(),c.ctrlKey&&c.key.toLowerCase()==="l"){c.preventDefault(),Q.clear([],ae);return}if(c.ctrlKey&&c.key.toLowerCase()==="c"){c.preventDefault(),h?.skip(),L();return}if(c.key==="Tab"){c.preventDefault(),ht();return}if(c.key==="ArrowUp"){c.preventDefault(),y>0&&(y--,o.value=g[y]??"");return}if(c.key==="ArrowDown"){c.preventDefault(),y<g.length-1?(y++,o.value=g[y]??""):(y=g.length,o.value="");return}if(c.key==="Enter"){c.preventDefault();const p=o.value;o.value="",V(p);return}h&&h.skip(),A.play("key"),gt()}),d.addEventListener("submit",c=>{c.preventDefault();const p=o.value;o.value="",V(p)});let ee=!1,ve=!1;async function yt(){if(ve)return;ve=!0,ee=!1;const c=J(),p=k=>new Promise($=>window.setTimeout($,c?40:k)),b=[v(()=>{ee=!0})],E=()=>{b.forEach(k=>k()),ve=!1},S=Object.entries(f).find(([,k])=>k.available)?.[0],P=[{note:"STEP 1/8 â who runs this machine",command:"whoami"},{note:"STEP 2/8 â the hardware",command:"neofetch"},{note:"STEP 3/8 â what is mounted",command:"ls"},...S?[{note:"STEP 4/8 â the viewer module",command:`cat ${S}`}]:[],{note:"STEP 5/8 â live DNS, straight from your browser",command:"dig tonykl.com"},{note:"STEP 6/8 â telemetry from the machine",command:"tail"},{note:"STEP 7/8 â repaint the room",command:"theme ice"},{note:"STEP 8/8 â and the rain",command:"matrix on"},{note:"that is the tour. contact details, then your prompt:",command:"contact"}];await p(200);for(const k of P){if(ee)break;W(`tour: ${k.note}`,"opacity-60 text-[11px]"),await p(180),k.command&&!ee&&await V(k.command,{fast:!0}),await p(260)}ee?W("tour: aborted. Restore the prompt with `clear` whenever you like.","text-error text-[11px]"):(await p(200),V("theme matrix",{fast:!0}),W("tour: complete â Ctrl+K opens the command palette, `help` lists everything, and five commands are unlisted.","opacity-70 text-[11px]")),E()}async function Pe(){const c=new URLSearchParams(window.location.search),p=window.location.hash.replace(/^#/,""),b=c.get("replay")??(p.startsWith("replay=")?decode
3URIComponent(p.slice(7)):"");if(!b)return;const E=wt(),S=b.split(/[,\n]/).map($=>$.trim().slice(0,120)).filter($=>$.length>0).slice(0,20).filter($=>Q[$.split(/\s+/)[0].toLowerCase()]!==void 0||Ye($)!==null);if(S.length===0)return;const P=J(),k=$=>new Promise(D=>window.setTimeout(D,P?30:$));W(`> replaying shared session â ${S.length} command${S.length===1?"":"s"}${E?" (link cleaned up)":""}.`,"opacity-70 text-[11px]"),await k(500);for(const $ of S)await V($,{fast:!0}),await k(240);W("> replay complete. Your own prompt is ready.","opacity-60 text-[11px]")}function wt(){const c=new URL(window.location.href);let p=!1;return c.searchParams.has("replay")&&(c.searchParams.delete("replay"),p=!0),c.hash.replace(/^#/,"").startsWith("replay=")&&(c.hash="",p=!0),p&&window.history.replaceState(null,"",c.pathname+c.search+c.hash),p}H.refresh(),window.addEventListener("firefly:scroll",()=>{u.scrollTo({top:u.scrollHeight+1e3,behavior:"smooth"})}),sessionStorage.getItem("boot.shown")?Pe():window.setTimeout(()=>{Pe()},2200);const xe=n.builtAt?new Date(n.builtAt):null;let qe=null;try{const c=localStorage.getItem(Je);if(c){const p=new Date(c);Number.isNaN(p.getTime())||(qe=p)}localStorage.setItem(Je,new Date().toISOString())}catch{}const vt=qe??(xe&&!Number.isNaN(xe.getTime())?xe:new Date);ae.setLastLogin(an(vt))}function Qe(n){const e=document.querySelector('meta[name="theme-color"]');if(!e)return;const t={matrix:"#000000",amber:"#0c0700",ice:"#000c16",dracula:"#111219",mono:"#000000"};e.setAttribute("content",t[n]??"#000000")}const cn=document.getElementById("cmd-input");if(cn){const n=document.getElementById("terminal-data"),e=n?.textContent?JSON.parse(n.textContent):{notionProjects:[],notionConnected:!1};sn(e)}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.