Back to Bubbles
SOURCE / PINNED RELEASE

Made of little things.

Bubbles

Release
8517f8a68eb4…
Author-recorded commit
Not provided
License
Check the original source

The hash-verified playable HTML, which may contain bundled or minified code. This view does not execute it.

index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="color-scheme" content="dark" />
    <meta name="description" content="A follows feed as a constellation: notes as bubbles, read through the host's outbox." />
    <meta name="napplet-requires" content="identity,outbox,resource,storage" />
    <title>Bubbles</title>
    <script type="module" crossorigin>function er(){const e=window;if(!e.napplet)throw new Error("window.napplet is unavailable -- runtime did not inject the napplet namespace");return e.napplet}function U(e){const n=er()[e];if(!n)throw new Error(`window.napplet.${String(e)} is unavailable -- runtime did not inject this domain`);return n}var Pt={getItem(e){return U("storage").getItem(e)},setItem(e,t){return U("storage").setItem(e,t)},removeItem(e){return U("storage").removeItem(e)},keys(){return U("storage").keys()},instance:{getItem(e){return U("storage").instance.getItem(e)},setItem(e,t){return U("storage").instance.setItem(e,t)},removeItem(e){return U("storage").instance.removeItem(e)},keys(){return U("storage").instance.keys()}}},Mn={getPublicKey(){return U("identity").getPublicKey()},onChanged(e){return U("identity").onChanged(e)},getRelays(){return U("identity").getRelays()},getProfile(){return U("identity").getProfile()},getFollows(){return U("identity").getFollows()},getList(e){return U("identity").getList(e)},getZaps(){return U("identity").getZaps()},getMutes(){return U("identity").getMutes()},getBlocked(){return U("identity").getBlocked()},getBadges(){return U("identity").getBadges()}},tr={info(){return U("resource").info()},bytes(e,t){return U("resource").bytes(e,t)},bytesMany(e,t){return U("resource").bytesMany(e,t)},bytesAsObjectURL(e){return U("resource").bytesAsObjectURL(e)}},nr={getEvent(e,t){return U("outbox").getEvent(e,t)},query(e,t){return U("outbox").query(e,t)},subscribe(e,t){return U("outbox").subscribe(e,t)},publish(e,t){return U("outbox").publish(e,t)},resolveRelays(e){return U("outbox").resolveRelays(e)}};const T={profile:0,note:1,repost:6,reaction:7,judgement:30078},or=100,rr=1440*60*1e3,sr=30,ir=50,Jn=300,Vn=1e4,ar=50,lr="325d6744f52fcdfa368d6da687240adc0cccdfa26316a734abdb2e9fe444eca5",cr="bubbles:judgements",Kn="I work on a decentralized AI marketplace, so my work is a lot about LLMs and AI agents. We also do Bitcoin payments using Lightning and Cashu. I want the posts that are relevant to that work at the top, and the ones that are not at the bottom.";/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function dr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ur(e,t,n=""){const o=dr(e),r=e?.length;if(!o||t!==void 0){const a=n&&`"${n}" `,d="",c=o?`length=${r}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+d+", got "+c)}return e}const Qn=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",fr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function be(e){if(ur(e),Qn)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=fr[e[n]];return t}const ie={_0:48,_9:57,A:65,F:70,a:97,f:102};function $n(e){if(e>=ie._0&&e<=ie._9)return e-ie._0;if(e>=ie.A&&e<=ie.F)return e-(ie.A-10);if(e>=ie.a&&e<=ie.f)return e-(ie.a-10)}function Zn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Qn)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const o=new Uint8Array(n);for(let r=0,s=0;r<n;r++,s+=2){const a=$n(e.charCodeAt(s)),d=$n(e.charCodeAt(s+1));if(a===void 0||d===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}o[r]=a*16+d}return o}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function eo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function to(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function hr(e){if(typeof e!="function")throw new Error("function expected");return!0}function Oe(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function no(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Rt(e){if(!Array.isArray(e))throw new Error("array expected")}function oo(e,t){if(!to(!0,t))throw new Error(`${e}: array of strings expected`)}function ro(e,t){if(!to(!1,t))throw new Error(`${e}: array of numbers expected`)}function pr(...e){const t=s=>s,n=(s,a)=>d=>s(a(d)),o=e.map(s=>s.encode).reduceRight(n,t),r=e.map(s=>s.decode).reduce(n,t);return{encode:o,decode:r}}function mr(e){const t=typeof e=="string"?e.split(""):e,n=t.length;oo("alphabet",t);const o=new Map(t.map((r,s)=>[r,s]));return{encode:r=>(Rt(r),r.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${e}`);return t[s]})),decode:r=>(Rt(r),r.map(s=>{Oe("alphabet.decode",s);const a=o.get(s);if(a===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${e}`);return a}))}}function gr(e=""){return Oe("join",e),{encode:t=>(oo("join.decode",t),t.join(e)),decode:t=>(Oe("join.decode",t),t.split(e))}}const so=(e,t)=>t===0?e:so(t,e%t),Ke=(e,t)=>e+(t-so(e,t)),qe=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function xt(e,t,n,o){if(Rt(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Ke(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Ke(t,n)}`);let r=0,s=0;const a=qe[t],d=qe[n]-1,c=[];for(const u of e){if(no(u),u>=a)throw new Error(`convertRadix2: invalid data word=${u} from=${t}`);if(r=r<<t|u,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=n;s-=n)c.push((r>>s-n&d)>>>0);const f=qe[s];if(f===void 0)throw new Error("invalid carry");r&=f-1}if(r=r<<n-s&d,!o&&s>=t)throw new Error("Excess padding");if(!o&&r>0)throw new Error(`Non-zero padding: ${r}`);return o&&s>0&&c.push(r>>>0),c}function br(e,t=!1){if(no(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Ke(8,e)>32||Ke(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!eo(n))throw new Error("radix2.encode input should be Uint8Array");return xt(Array.from(n),8,e,!t)},decode:n=>(ro("radix2.decode",n),Uint8Array.from(xt(n,e,8,t)))}}function An(e){return hr(e),function(...t){try{return e.apply(null,t)}catch{}}}const _t=pr(mr("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),gr("")),Pn=[996825010,642813549,513874426,1027748829,705979059];function _e(e){const t=e>>25;let n=(e&33554431)<<5;for(let o=0;o<Pn.length;o++)(t>>o&1)===1&&(n^=Pn[o]);return n}function Rn(e,t,n=1){const o=e.length;let r=1;for(let s=0;s<o;s++){const a=e.charCodeAt(s);if(a<33||a>126)throw new Error(`Invalid prefix (${e})`);r=_e(r)^a>>5}r=_e(r);for(let s=0;s<o;s++)r=_e(r)^e.charCodeAt(s)&31;for(let s of t)r=_e(r)^s;for(let s=0;s<6;s++)r=_e(r);return r^=n,_t.encode(xt([r%qe[30]],30,5,!1))}function yr(e){const t=e==="bech32"?1:734539939,n=br(5),o=n.decode,r=n.encode,s=An(o);function a(l,m,b=90){Oe("bech32.encode prefix",l),eo(m)&&(m=Array.from(m)),ro("bech32.encode",m);const v=l.length;if(v===0)throw new TypeError(`Invalid prefix length ${v}`);const g=v+7+m.length;if(b!==!1&&g>b)throw new TypeError(`Length ${g} exceeds limit ${b}`);const y=l.toLowerCase(),k=Rn(y,m,t);return`${y}1${_t.encode(m)}${k}`}function d(l,m=90){Oe("bech32.decode input",l);const b=l.length;if(b<8||m!==!1&&b>m)throw new TypeError(`invalid string length: ${b} (${l}). Expected (8..${m})`);const v=l.toLowerCase();if(l!==v&&l!==l.toUpperCase())throw new Error("String must be lowercase or uppercase");const g=v.lastIndexOf("1");if(g===0||g===-1)throw new Error('Letter "1" must be present between prefix and data only');const y=v.slice(0,g),k=v.slice(g+1);if(k.length<6)throw new Error("Data must be at least 6 characters long");const $=_t.decode(k).slice(0,-6),M=Rn(y,$,t);if(!k.endsWith(M))throw new Error(`Invalid checksum in ${l}: expected "${M}"`);return{prefix:y,words:$}}const c=An(d);function u(l){const{prefix:m,words:b}=d(l,!1);return{prefix:m,words:b,bytes:o(b)}}function f(l,m){return a(l,r(m))}return{encode:a,decode:d,encodeFromBytes:f,decodeToBytes:u,decodeUnsafe:c,fromWords:o,fromWordsUnsafe:s,toWords:r}}const Qe=yr("bech32");var Ge=new TextDecoder("utf-8");new TextEncoder;var io=5e3;function Dt(e){let{prefix:t,words:n}=Qe.decode(e,io),o=new Uint8Array(Qe.fromWords(n));switch(t){case"nprofile":{let r=vt(o);if(!r[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(r[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:be(r[0][0]),relays:r[1]?r[1].map(s=>Ge.decode(s)):[]}}}case"nevent":{let r=vt(o);if(!r[0]?.[0])throw new Error("missing TLV 0 for nevent");if(r[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(r[2]&&r[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(r[3]&&r[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:be(r[0][0]),relays:r[1]?r[1].map(s=>Ge.decode(s)):[],author:r[2]?.[0]?be(r[2][0]):void 0,kind:r[3]?.[0]?parseInt(be(r[3][0]),16):void 0}}}case"naddr":{let r=vt(o);if(!r[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!r[2]?.[0])throw new Error("missing TLV 2 for naddr");if(r[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!r[3]?.[0])throw new Error("missing TLV 3 for naddr");if(r[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Ge.decode(r[0][0]),pubkey:be(r[2][0]),kind:parseInt(be(r[3][0]),16),relays:r[1]?r[1].map(s=>Ge.decode(s)):[]}}}case"nsec":return{type:t,data:o};case"npub":case"note":return{type:t,data:be(o)};default:throw new Error(`unknown prefix ${t}`)}}function vt(e){let t={},n=e;for(;n.length>0;){if(n.length<2)throw new Error("not enough data to read TLV");let o=n[0],r=n[1],s=n.slice(2,2+r);if(n=n.slice(2+r),s.length<r)throw new Error(`not enough data to read on TLV ${o}`);t[o]=t[o]||[],t[o].push(s)}return t}function wr(e){return lo("npub",Zn(e))}function ao(e){return lo("note",Zn(e))}function vr(e,t){let n=Qe.toWords(t);return Qe.encode(e,n,io)}function lo(e,t){return vr(e,t)}function Er(e){const t=Dt(e);if(!t)throw new Error(`not a NIP-19 pointer: ${e}`);return t}function Bt(e){return wr(e)}function kr(e){return ao(e)}function Sr(e){const t=Er(e.trim());if(t.type!=="note")throw new Error(`not a note id: ${e}`);return t.data}function tt(e){try{return JSON.parse(e.content)}catch{return}}function Mr(e){const t=[],n=/nostr:(npub1[a-z0-9]+|nprofile1[a-z0-9]+|note1[a-z0-9]+)/gi;for(const o of e.matchAll(n)){const r=o[1];if(r)try{t.push(Dt(r))}catch{}}return t}function co(e){if(e.type==="npub")return e.data;if(e.type==="nprofile")return e.data.pubkey}function $r(e){try{return ao(e)}catch{return e}}function Ar(e){try{const t=Dt(e),n=co(t);return n?{pubkey:n}:void 0}catch{return}}const Pr={nostrLink:/nostr:(npub1[a-z0-9]+|nprofile1[a-z0-9]+|note1[a-z0-9]+)/gi};function Se(e,t){const n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}function uo(e,t,n){const o=new Set(t.map(a=>a.id)),r=new Map;for(const a of e){if(a.kind!==n)continue;let d;for(const u of a.tags)u[0]==="e"&&u[1]&&o.has(u[1])&&(d=u[1]);if(!d)continue;let c=r.get(d);c||r.set(d,c=new Map),c.set(a.id,a)}const s=new Map;for(const[a,d]of r){const c=[...d.values()].sort((u,f)=>u.created_at-f.created_at);c.length>0&&s.set(a,c)}return s}function Rr(e,t){const n=uo(e,t,T.reaction),o={};for(const[r,s]of n)o[r]=s.map(a=>({id:a.id,pubkey:a.pubkey,content:a.content}));return o}function Je(e){let t,n;for(const o of e.tags){if(o[0]!=="e"||!o[1])continue;const r=o[3];r!=="mention"&&(r==="reply"&&(t=o[1]),n=o[1])}return t??n}const fo=32;function xr(e,t){const n=e.known.get(t);return n?Je(n):void 0}function _r(e,t){const n=[t],o=new Set([t]);for(;n.length<=fo;){const r=xr(e,n[n.length-1]);if(!r||o.has(r)||!e.known.has(r))break;n.push(r),o.add(r)}return n}async function Nr(e,t){const{known:n,runQuery:o,idsPerRequest:r,replyLimit:s,log:a}=e;let d=new Set;for(const y of t){const k=Je(y);k&&!n.has(k)&&d.add(k)}for(let y=0;d.size>0&&y<fo;y++){const k=[...d];d=new Set;for(const $ of Se(k,r))for(const M of await o({kinds:[T.note],ids:$})){const x=Je(M);x&&!n.has(x)&&d.add(x)}}const c=new Map,u=new Map,f=new Map,l=(y,k)=>{const $=n.get(y);if(!$||(c.set(y,k),!k.parent))return;const M=u.get(k.parent)??[];M.push({id:y,pubkey:$.pubkey,parent:k.parent,created_at:$.created_at}),u.set(k.parent,M),f.set(k.root,(f.get(k.root)??0)+1)};for(const y of t){const k=_r(e,y.id),$=k[k.length-1];for(const[M,x]of k.entries())c.has(x)||l(x,{parent:k[M+1],root:$})}const m=[...c.keys()];for(let y=0;y<m.length;y+=r){const k=m.slice(y,y+r),$=await o({kinds:[T.note],"#e":k,limit:s});for(const M of $){if(c.has(M.id))continue;const x=Je(M);if(!x)continue;const A=c.get(x);A&&((f.get(A.root)??0)>=s||(l(M.id,{parent:x,root:A.root}),m.push(M.id)))}}const b={},v=[];for(const[y,k]of c){if(k.parent)continue;v.push(y);const $=[],M=new Set([y]),x=A=>{for(const N of u.get(A)??[])M.has(N.id)||(M.add(N.id),$.push(N),x(N.id))};x(y),$.length>0&&($.sort((A,N)=>A.created_at-N.created_at),b[y]=$)}const g=Object.values(b).reduce((y,k)=>y+k.length,0);return a(`threads: ${Object.keys(b).length} roots with ${g} replies (from ${v.length} roots)`),{threads:b,roots:v}}function ho(e){const t=[];for(const n of Mr(e)){const o=co(n);o&&t.push(o)}return t}function Ir(e){let t;for(const n of e.tags)n[0]==="e"&&n[1]&&(t=n[1]);return t}function Cr(e,t){const n={};for(const[o,r]of uo(e,t,T.repost))n[o]=r.map(s=>({id:s.id,pubkey:s.pubkey}));return n}async function Tr(e){const{known:t,follows:n,noteLimit:o,repostLimit:r,idsPerRequest:s,runQuery:a,log:d}=e,c=[...t.values()].filter(b=>b.kind===T.note&&n.has(b.pubkey)).sort((b,v)=>v.created_at-b.created_at).slice(0,o),u=new Map;for(const b of t.values()){if(b.kind!==T.repost||!n.has(b.pubkey))continue;const v=Ir(b);if(!v||t.has(v))continue;const g=u.get(v);(!g||g.created_at<b.created_at)&&u.set(v,b)}const f=[...u.entries()].sort((b,v)=>v[1].created_at-b[1].created_at).slice(0,r).map(([b])=>b);if(f.length>0){d(`fetching ${f.length} notes the follows reposted`);for(const b of Se(f,s))await a({kinds:[T.note],ids:b})}const l=f.map(b=>t.get(b)).filter(b=>!!b),m=[...c,...l].sort((b,v)=>v.created_at-b.created_at);return{notes:c,repostNotes:l,kept:m}}const xn=e=>Math.min(1,Math.max(0,e));async function Lr(e,t,n){if(e.length===0)return null;const r=(await t({kinds:[T.judgement],authors:[lr],"#d":[cr],limit:1})).filter(u=>u.kind===T.judgement).sort((u,f)=>f.created_at-u.created_at)[0];if(!r)return n("no judgements published yet — every note will sit in the middle of both axes"),null;let s;try{s=JSON.parse(r.content)}catch{return n(`judgement event ${r.id.slice(0,8)}… has a body that is not JSON — ignoring it`),null}const a=new Set(e),d={};for(const[u,f]of Object.entries(s.judgements??{})){if(!a.has(u))continue;const l=f?.build,m=f?.relevant;!Number.isFinite(l)||!Number.isFinite(m)||(d[u]={build:xn(l),relevant:xn(m)})}const c=Object.keys(d).length;return c===0?(n(`the judgements published ${new Date(r.created_at*1e3).toISOString()} cover none of this feed's roots`),null):(n(`read ${c}/${e.length} judgements (published ${new Date(r.created_at*1e3).toISOString()})`),{judgements:d,jev:{baseUrl:"",model:s.model??"jev-latest",prompt:s.prompt??Kn}})}async function Nt(e,t,n){const[o]=e;try{const r=await nr.query(e,{authors:o?.authors,limit:o?.limit,timeoutMs:t});return r.error&&n(`outbox query error: ${r.error}`),r.incomplete&&n("outbox query came back incomplete"),r.events.map(s=>s.event).filter(Boolean)}catch(r){return n(`outbox query failed: ${r instanceof Error?r.message:String(r)}`),[]}}async function Or(e={}){const{pubkey:t=await Mn.getPublicKey(),noteLimit:n=or,since:o=Math.floor((Date.now()-rr)/1e3),authorsPerRequest:r=ir,replyLimit:s=ar,repostLimit:a=sr,timeoutMs:d=Vn,log:c=()=>{},onProgress:u=()=>{}}=e,f=new Map,l={follows:0,profiles:0,batches:0,batchesTotal:0,notes:0,threads:0,replies:0},m=()=>{let P=0;for(const W of f.values())W.kind===T.note&&(P+=1);return P},b=()=>{u({...l})},v=async(P,W)=>{const le=await Nt([P],d,c);for(const L of le)f.set(L.id,L);return le},g=async P=>{const W=await Nt(P,d,c);for(const le of W)f.set(le.id,le);return W},y=await Mn.getFollows();if(y.length===0)throw new Error("the account follows nobody yet — follow someone to give the field something to draw");c(`reading ${y.length} follows through the outbox`);const k=Se(y,r),$=Math.max(r,150),M=Math.ceil(n/k.length)+r,x=o===null?{}:{since:o};l.follows=y.length,l.batchesTotal=k.length,b();for(const P of Se(y,Jn))await v({kinds:[T.profile],authors:P,limit:P.length});const A=[...f.values()].filter(P=>P.kind===T.profile).length;l.profiles=A,b(),c(`${A} profiles (${y.length} follows)`);for(const P of k)await g([{kinds:[T.note],authors:P,limit:M,...x},{kinds:[T.repost],authors:P,limit:M,...x}]),l.batches+=1,l.notes=m(),b();const{repostNotes:N,kept:H}=await Tr({known:f,follows:new Set(y),noteLimit:n,repostLimit:a,idsPerRequest:r,runQuery:v,log:c});l.notes=H.length,b();const{threads:_,roots:j}=await Nr({known:f,runQuery:v,idsPerRequest:$,replyLimit:s,log:c},H);l.threads=Object.keys(_).length,l.replies=Object.values(_).reduce((P,W)=>P+W.length,0),b();const[F,G]=j.length>0?await Promise.all([v({kinds:[T.reaction],"#e":j,limit:500}),v({kinds:[T.repost],"#e":j,limit:500})]):[[],[]],q=j.map(P=>f.get(P)).filter(P=>!!P),K=Rr(F,q),V=Cr(G,q),S=await Lr(j,v,c),D=new Set([...H.map(P=>P.id),...j,...Object.values(_).flatMap(P=>P.map(W=>W.id))]),R=[...D].map(P=>f.get(P)).filter(P=>!!P),J=[...new Set([...q.map(P=>P.pubkey),...Object.values(_).flatMap(P=>P.map(W=>W.pubkey))])],Y=[...new Set(Object.values(V).flatMap(P=>P.map(W=>W.pubkey)))],Q=[...new Set(R.flatMap(P=>ho(P.content)))],z=new Set([...f.values()].filter(P=>P.kind===T.profile).map(P=>P.pubkey)),B=[...new Set([...J,...Y,...Q])].filter(P=>!z.has(P));for(const P of Se(B,r))await v({kinds:[T.profile],authors:P,limit:P.length});const re=[...f.values()].filter(P=>P.kind===T.note&&D.has(P.id)).sort((P,W)=>W.created_at-P.created_at),ee=[...f.values()].filter(P=>P.kind===T.profile),C=[...ee,...re],$e=Object.values(_).reduce((P,W)=>P+W.length,0);return c(`built ${re.length} notes (${N.length} reposted by a follow) in ${j.length} roots, ${Object.keys(_).length} threads with ${$e} replies and ${ee.length} profiles`),{version:2,generatedAt:Date.now(),relays:[],profileRelays:[],npub:Bt(t),pubkey:t,contacts:{id:"",created_at:0,follows:y},since:o,events:C,...S?{judgements:S.judgements,jev:S.jev}:{},reactions:K,reposts:V,threads:_,stats:{follows:y.length,notes:H.length,repostNotes:N.length,profiles:ee.length,events:C.length,threads:Object.keys(_).length,replies:$e}}}function _n(e){const t=new Set(e.events.filter(o=>o.kind===T.profile).map(o=>o.pubkey)),n=new Set([e.pubkey]);for(const o of e.events)if(o.kind===T.note){n.add(o.pubkey);for(const r of ho(o.content))n.add(r)}for(const o of Object.values(e.threads??{}))for(const r of o)n.add(r.pubkey);for(const o of Object.values(e.reposts??{}))for(const r of o)n.add(r.pubkey);return[...n].filter(o=>!t.has(o))}async function Dr(e,t={}){const{timeoutMs:n=Vn,log:o=()=>{}}=t;if(e.length===0)return[];const r=[];for(const s of Se(e,Jn)){const a=await Nt([{kinds:[T.profile],authors:s,limit:s.length}],n,o);for(const d of a)d.kind===T.profile&&r.push(d)}return o(`asked for ${e.length} profiles, got ${r.length}`),r}function Br(e,t){const n=new Map;for(const r of e.events)r.kind===T.profile&&n.set(r.pubkey,r);let o=0;for(const r of t){if(r.kind!==T.profile)continue;const s=n.get(r.pubkey);if(s&&s.created_at>=r.created_at)continue;const a=e.events.findIndex(d=>d.kind===T.profile&&d.pubkey===r.pubkey);a>=0?e.events[a]=r:e.events.push(r),n.set(r.pubkey,r),o+=1}return o}function jr(){const e=new Map;return{add(t){e.set(t.id,t)},getEvent(t){return e.get(t)},getReplaceable(t,n){let o;for(const r of e.values())r.kind!==t||r.pubkey!==n||(!o||r.created_at>o.created_at)&&(o=r);return o}}}const po=["build","fun","relevant","irrelevant"];function mo(e){const t=Math.max(0,Math.floor((Date.now()-e.getTime())/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const o=Math.floor(n/60);if(o<24)return`${o}h ago`;const r=Math.floor(o/24);return r<30?`${r}d ago`:e.toLocaleDateString()}function go(e){return`${e.slice(0,8)}…${e.slice(-6)}`}function Ur(e,t=Date.now()){if(e===null)return"all time";const n=Math.max(0,t-e*1e3)/864e5;if(n>=1.5)return`last ${Math.round(n)}d`;if(n>=1)return"last 24h";const o=n*24;return o>=1?`last ${Math.round(o)}h`:`last ${Math.max(1,Math.round(o*60))}m`}function Hr(e){const{judged:t,total:n,prompt:o}=e,r=o??Kn,s=document.createElement("div");s.className="hud-prompt-row";const a=document.createElement("span");a.className="hud-prompt-label",a.textContent=t>0?"judged against":"not judged yet";const d=document.createElement("span");d.className="hud-prompt-text",d.textContent=r,d.title=r,s.append(a,d);const c=document.createElement("span");return c.className="hud-status",c.textContent=t>0?`${t}/${n} notes`:"run pnpm judge:publish to give the axes readings",s.append(c),{element:s,dispose:()=>s.remove()}}const jt=new Map;async function Fr(){try{const e=await Pt.keys(),t=await Promise.all(e.map(async n=>[n,await Pt.getItem(n)]));for(const[n,o]of t)o!==null&&jt.set(n,o)}catch{}}function nt(e){return jt.get(e)??null}function ot(e,t){jt.set(e,t);try{Pt.setItem(e,t).catch(()=>{})}catch{}}function Nn(e){const t=document.createElement("button");t.type="button",t.className="hud-toggle",t.textContent=e.label,t.title=e.title,t.addEventListener("click",()=>{e.onChange(t.getAttribute("aria-pressed")!=="true")});function n(o){t.setAttribute("aria-pressed",String(o))}return n(e.pressed),{element:t,set:n}}const bo="bubbles.seen",yo="bubbles.hideSeen",wo=1,Ye=5e3;function Wr(e){const t=new Set(e),n=new Set(Xr().filter(a=>t.has(a))),o=[];function r(){const a=[...n].filter(d=>t.has(d)).slice(-4e3);ot(bo,JSON.stringify({v:wo,ids:a}))}function s(){r();for(const a of o)a()}return{has:a=>n.has(a),mark(a){!t.has(a)||n.has(a)||(n.add(a),s())},forget(a){n.delete(a)&&s()},reset(){n.size!==0&&(n.clear(),s())},onChange(a){o.push(a)}}}function Gr(){return nt(yo)!=="false"}function Yr(e){ot(yo,String(e))}function zr(e){const t=document.createElement("p");t.className="hud-seen-row";const n=document.createElement("button");n.type="button",n.className="hud-seen",n.textContent="hide seen",n.title="read a note and it dims; hide the ones you have read so the rest get the room (h)",n.addEventListener("click",()=>e.onToggle(!e.isHiding()));const o=document.createElement("span");o.className="hud-seen-count",o.setAttribute("aria-live","polite");const r=document.createElement("button");r.type="button",r.className="hud-seen-reset",r.textContent="reset",r.title="forget every note you have read",r.addEventListener("click",()=>e.onReset()),t.append(n,o,r);function s(){const{seen:a,total:d}=e.counts(),c=e.isHiding();n.setAttribute("aria-pressed",String(c)),o.textContent=a===0?d>0?`nothing read yet · ${d} in the field`:"nothing read yet":a>=d?`all ${d} notes read`:`${a} of ${d} notes read`,r.hidden=a===0}return s(),{element:t,refresh:s}}function Xr(){const e=nt(bo);if(!e)return[];try{const t=JSON.parse(e);return t.v!==wo||!Array.isArray(t.ids)?[]:t.ids.filter(n=>typeof n=="string")}catch{return[]}}const qr={follow:22,repel:5e3,repelRange:120,stiffness:1400,damping:14,holdDamping:12,hold:26,bond:4e3,maxSpeed:900,wall:40},Jr=2;class Ze{bubbles=[];poles=[];centroid={x:0,y:0};bounds={minX:0,minY:0,maxX:0,maxY:0};tuning={...qr};fixedStep=1/120;constructor(t=[]){this.bubbles.push(...t)}static pole(t,n=0,o=0){return{id:t,x:n,y:o}}static bubble(t,n,o,r,s,a=1){return{id:t,x:n,y:o,vx:0,vy:0,r,weights:s,hidden:!1,tailDepth:0,hold:0,holdX:n,holdY:o,scale:a,scaleTarget:a,ax:0,ay:0}}targetFor(t){const n=this.middle();if(this.poles.length<2)return{x:n.x,y:n.y};let o=n.x,r=n.y;const s=Math.min(t.length,this.poles.length);for(let a=0;a+1<s;a+=2){const d=this.poles[a],c=this.poles[a+1],u=Math.max(0,t[a]??0),f=Math.max(0,t[a+1]??0),l=u+f;if(l<=1e-9)continue;const m=(f-u)/l;o+=(c.x-d.x)/2*m,r+=(c.y-d.y)/2*m}return{x:o,y:r}}middle(){if(this.poles.length===0)return{x:this.centroid.x,y:this.centroid.y};let t=0,n=0;for(const o of this.poles)t+=o.x,n+=o.y;return{x:t/this.poles.length,y:n/this.poles.length}}bubbleAt(t,n){let o,r=1/0;for(const s of this.bubbles){if(s.hidden)continue;const a=t-s.x,d=n-s.y,c=s.r*Math.max(s.scale,1)+4;a*a+d*d>c*c||s.r<r&&(o=s,r=s.r)}return o}maxSpeed(){let t=0;for(const n of this.bubbles){const o=Math.sqrt(n.vx*n.vx+n.vy*n.vy);o>t&&(t=o)}return t}isSettled(t=Jr){if(this.maxSpeed()>t)return!1;for(const n of this.bubbles)if(n.hold>0||Math.abs(n.scale-n.scaleTarget)>.002)return!1;return!0}step(t){const n=Math.min(6,Math.max(1,Math.ceil(t/this.fixedStep))),o=t/n;for(let r=0;r<n;r++)this.integrate(o);this.easeScale(t)}easeScale(t){const n=1-Math.exp(-16*t);for(const o of this.bubbles)o.scale+=(o.scaleTarget-o.scale)*n}freeze(){for(const t of this.bubbles)t.vx=0,t.vy=0,t.ax=0,t.ay=0;this.measure()}measure(){const{bubbles:t,centroid:n}=this;let o=0,r=0;for(const a of t)o+=a.x,r+=a.y;const s=Math.max(1,t.length);n.x=o/s,n.y=r/s}integrate(t){const{bubbles:n,bounds:o,tuning:r}=this;if(n.length===0)return;this.measure();const s=n.filter(l=>!l.hidden);if(s.length===0)return;const a=s.filter(l=>l.bond),d=s.filter(l=>!l.bond),c=new Map(s.map(l=>[l.id,l]));for(const l of s){if(l.bond){l.ax=0,l.ay=0;continue}const m=this.targetFor(l.weights);l.ax=(m.x-l.x)*r.follow,l.ay=(m.y-l.y)*r.follow}const u=r.repelRange,f=d.length;for(let l=0;l<f;l++){const m=d[l];for(let b=l+1;b<f;b++){const v=d[b],g=m.r+v.r;let y=v.x-m.x,k=v.y-m.y;const $=g+u,M=y*y+k*k;if(M>$*$)continue;let x=Math.sqrt(M);if(x<1e-4){const V=(l*7+b*13)%360*(Math.PI/180);y=Math.cos(V),k=Math.sin(V),x=1}const A=y/x,N=k/x,H=m.r*m.r,_=v.r*v.r,j=_/(H+_),F=H/(H+_),G=Math.max(0,g-x),q=1-Math.max(0,x-g)/r.repelRange,K=r.repel*q*q+G*r.stiffness;m.ax-=A*K*j,m.ay-=N*K*j,v.ax+=A*K*F,v.ay+=N*K*F}}if(a.length>0)for(const l of a){const m=l.bond,b=c.get(m.id);b&&(l.hold>0||(l.ax+=(b.x+m.dx-l.x)*r.bond,l.ay+=(b.y+m.dy-l.y)*r.bond))}for(const l of s){l.hold>0&&(l.ax+=(l.holdX-l.x)*r.hold*l.hold,l.ay+=(l.holdY-l.y)*r.hold*l.hold);const m=o.minX+l.r,b=o.maxX-l.r,v=o.minY+l.r,g=o.maxY-l.r-l.tailDepth;l.x<m&&(l.ax+=(m-l.x)*r.wall),l.x>b&&(l.ax-=(l.x-b)*r.wall),l.y<v&&(l.ay+=(v-l.y)*r.wall),l.y>g&&(l.ay-=(l.y-g)*r.wall),l.vx+=l.ax*t,l.vy+=l.ay*t;const y=l.hold>0?r.holdDamping:r.damping,k=Math.exp(-y*t);l.vx*=k,l.vy*=k;const $=Math.sqrt(l.vx*l.vx+l.vy*l.vy);if($>r.maxSpeed){const M=r.maxSpeed/$;l.vx*=M,l.vy*=M}l.x+=l.vx*t,l.y+=l.vy*t,l.x<m?(l.x=m,l.vx<0&&(l.vx=0)):l.x>b&&(l.x=b,l.vx>0&&(l.vx=0)),l.y<v?(l.y=v,l.vy<0&&(l.vy=0)):l.y>g&&(l.y=g,l.vy>0&&(l.vy=0))}}}const Me=44,rt=1.6,fe=1/4,Vr=fe*.8,ae=Me*Vr,Kr=1.06,Qr=1.1,vo=3,Zr={build:"Build",fun:"Fun",relevant:"Relevance",irrelevant:"Irrelevant"},es={build:"Useful",fun:"Fun"};function Ut(e,t=1/0){const n=new Map;for(const[o,r]of e.entries()){const s=ts(r.content),a=n.get(s);a?a.count++:n.set(s,{count:1,first:o})}return[...n].sort((o,r)=>r[1].count-o[1].count||o[1].first-r[1].first).slice(0,t===1/0?void 0:Math.max(0,t)).map(([o,r])=>({glyph:o,count:r.count}))}function ts(e){const t=e.trim();if(t===""||t==="+")return"♥";if(t==="-")return"▼";if(t.startsWith(":")&&t.endsWith(":")||/^https?:\/\//i.test(t))return"♥";const n=Array.from(t);let o=1;for(;o<n.length;){const r=n[o].codePointAt(0),a=n[o-1].codePointAt(0)===8205||r===65039||r===65038||r===8205,d=r>=127995&&r<=127999;if(!a&&!d)break;o++}return n.slice(0,o).join("")}function ns(e){const t=e.filter(s=>s.judgement),n=[...t].sort((s,a)=>Et(a.judgement??null)-Et(s.judgement??null));let o=0,r=null;for(const[s,a]of n.entries()){const d=Et(a.judgement??null);(r===null||d!==r)&&(o=s+1,r=d),a.rank={place:o,of:t.length}}}function os(e){const t=new Map,n=[];for(const g of e.events)if(g.kind===T.profile){const y=t.get(g.pubkey);(!y||g.created_at>y.created_at)&&t.set(g.pubkey,g)}else g.kind===T.note&&n.push(g);n.sort((g,y)=>y.created_at-g.created_at);const o=e.reactions??{},r=e.reposts??{},s=e.threads??{},a=new Set(e.contacts?.follows??[]);a.add(e.pubkey);const d=new Map(n.map(g=>[g.id,g])),c=g=>{const y=t.get(g);return y?tt(y):void 0},u=g=>ye(c(g),g),f=new Map,l=new Set;for(const g of Object.values(e.threads??{}))for(const y of g){l.add(y.id);const k=f.get(y.parent)??[];k.push(y),f.set(y.parent,k)}const m=n.reduce((g,y)=>{if(l.has(y.id))return g;const k=(o[y.id]?.length??0)+(s[y.id]?.length??0);return Math.max(g,k)},0),b=(g,y)=>{const k=d.get(g.id);if(!k||y.has(g.id))return null;y.add(g.id);const $=(f.get(g.id)??[]).map(x=>b(x,y)).filter(x=>x!==null),M=c(k.pubkey);return{root:!1,placement:a.has(k.pubkey)?"face":"hidden",count:1,id:k.id,pubkey:k.pubkey,name:ye(M,k.pubkey),picture:M?.picture??M?.image,hue:Te(k.pubkey),radius:ae,parent:g.parent,parentName:u(g.parent),event:k,children:$}},v=n.filter(g=>!l.has(g.id)).map(g=>{const y=c(g.pubkey),k=e.judgements?.[g.id]??null,$=o[g.id]??[],M=(r[g.id]??[]).map(_=>{const j=c(_.pubkey);return{pubkey:_.pubkey,name:ye(j,_.pubkey),picture:j?.picture??j?.image,hue:Te(_.pubkey)}}),x=M.filter(_=>a.has(_.pubkey)),A=new Set([g.id]),N=(f.get(g.id)??[]).map(_=>b(_,A)).filter(_=>_!==null);rs(N);const H=ss($.length+st({children:N}),m);return{root:!0,id:g.id,pubkey:g.pubkey,name:ye(y,g.pubkey),picture:y?.picture??y?.image,hue:Te(g.pubkey),baseRadius:H,radius:H,reactions:$,reposts:x,repostsHidden:M.length-x.length,event:g,judgement:k,weights:Ft(k),children:N,tail:Eo(N,H)}});return ns(v),v}function Be(e,t,n){const o=t*2,r=Math.max(2,Math.floor(e*2/o)),s=[];for(let a=0;a<n;a++){const d=Math.floor(a/r),c=Math.min(r,n-d*r);s.push({dx:(a%r-(c-1)/2)*o,dy:e+t+d*o})}return s}function Eo(e,t){const n=Ht(e),o=n.filter(d=>d.placement==="face").length,r=n.filter(d=>d.placement==="hidden").length,a=Be(t,ae,o).at(-1);return{shown:o,chip:r>0?{dx:a?a.dx+ae+vo:0,dy:a?a.dy:t+ae,align:a?"left":"center",count:r}:void 0,depth:a?a.dy+ae:0}}function rs(e){const t=Ht(e).filter(r=>r.placement==="face"),n=new Map,o=new Map;for(const r of t){const s=n.get(r.pubkey);(!s||r.event.created_at>=s.event.created_at)&&n.set(r.pubkey,r),o.set(r.pubkey,(o.get(r.pubkey)??0)+1)}for(const r of t){const s=n.get(r.pubkey);!s||s===r?r.count=o.get(r.pubkey)??1:r.placement="repeat"}}function Ht(e){const t=[],n=[...e];for(;n.length>0;){const o=n.shift();t.push(o),n.push(...o.children)}return t}function ss(e,t){const n=t>0?Math.min(1,Math.max(0,e)/t):0,o=fe+(rt-fe)*n;return Me*o}function Et(e){const t=It(e?.build),n=It(e?.relevant);return t+(n-.5)}const is=.7;function as(e){return Ft({build:Math.min(1,Math.max(0,e)),relevant:.5})}const ls=.09,cs=4;function ds(e,t,n){const o=Math.PI*ae*ae;let r=0;for(const a of e)r+=Math.PI*a.radius*a.radius+a.tail.shown*o;const s=r/(ls*Math.max(1,t));return Math.round(Math.min(Math.max(s,n),n*cs))}function kt(e,t,n=new Set){const o=Me*fe,r=Me*rt,s=t?us(e,n):null;for(const a of e)a.radius=Math.min(r,Math.max(o,a.baseRadius)),a.weights=t?as((a.root?s.get(a.id):void 0)??.5):Ft(a.judgement),a.tail=Eo(a.children,a.radius)}function us(e,t=new Set){const n=e.filter(c=>c.root&&c.rank&&!t.has(c.id));n.sort((c,u)=>(c.rank.place??0)-(u.rank.place??0));const o=new Map,r=n.length;let s=0,a=0,d=null;for(const c of n){(d===null||c.rank.place!==d)&&(a=s,d=c.rank.place);const u=r<=1?1:1-a/(r-1);o.set(c.id,1-Math.pow(1-u,is)),s++}return o}function ye(e,t){for(const n of[e?.display_name,e?.displayName,e?.name])if(n&&n.trim())return n;return go(t)}function It(e,t=.5){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):t}function Ft(e){const t=It,n=t(e?.build),o=t(e?.relevant),r=[n,1-n,o,1-o],s=r.reduce((a,d)=>a+d,0);return s<=1e-9?r.map(()=>1/r.length):r.map(a=>a/s)}function Te(e){let t=0;for(let n=0;n<e.length;n++)t=(t*31+e.charCodeAt(n))%1e5;return 190+t%141}function fs(e){const t=[],n=o=>{t.push(o);for(const r of o.children)n(r)};for(const o of e)n(o);return t}function st(e){let t=0;for(const n of e.children)t+=1+st(n);return t}function hs(e,t,n=.6){const o=Math.PI*(3-Math.sqrt(5)),r=[],s=new Map;for(const[a,d]of e.entries()){const c=t(d.weights),u=a*o,f=n*d.radius,l=Ze.bubble(d.id,c.x+Math.cos(u)*f,c.y+Math.sin(u)*f,d.radius,d.weights);l.tailDepth=d.tail.depth,s.set(d.id,l),r.push(l)}for(const a of e){const d=s.get(a.id);if(!d)continue;const c=Ht(a.children).filter(f=>f.placement==="face"),u=Be(d.r,ae,a.tail.shown);for(const[f,l]of c.entries()){const{dx:m,dy:b}=u[f],v=Ze.bubble(l.id,d.x+m,d.y+b,l.radius,[]);v.bond={id:d.id,dx:m,dy:b},s.set(l.id,v),r.push(v)}}return r}function ps(e,t){const n=new Map;for(const c of t.events){if(c.kind!==T.profile)continue;const u=n.get(c.pubkey);(!u||c.created_at>u.created_at)&&n.set(c.pubkey,c)}const o=c=>{const u=n.get(c),f=u?tt(u):void 0;return{name:ye(f,c),picture:f?.picture??f?.image}};let r=0;const s=new Map,a=[],d=c=>{a.push(c);for(const u of c.children)d(u)};for(const c of e)d(c);for(const c of a){const u=o(c.pubkey);s.set(c.id,u.name),(c.name!==u.name||c.picture!==u.picture)&&(r+=1),c.name=u.name,c.picture=u.picture}for(const c of a){if(c.root)continue;const u=s.get(c.parent);u&&u!==c.parentName&&(c.parentName=u,r+=1)}for(const c of e)for(const u of c.reposts){const f=o(u.pubkey);(u.name!==f.name||u.picture!==f.picture)&&(r+=1),u.name=f.name,u.picture=f.picture}return r}const Ct=new Map,Tt=new Set;function je(e){const t=Ct.get(e);if(t)return t;const n=tr.bytes(e).then(o=>{const r=URL.createObjectURL(o);return Tt.add(r),r});return Ct.set(e,n),n}function Wt(){for(const e of Tt)URL.revokeObjectURL(e);Tt.clear(),Ct.clear()}class ms{constructor(t){this.onReady=t}entries=new Map;get(t){if(!t)return{url:"",element:null,state:"empty"};const n=this.entries.get(t);if(n)return n;const o={url:t,element:null,state:"loading"};return this.entries.set(t,o),this.load(t,o),o}async load(t,n){try{const o=await je(t);if(n.state!=="loading")return;const r=new Image;r.decoding="async",r.addEventListener("load",()=>{n.state=r.naturalWidth>0?"ready":"failed",this.onReady()}),r.addEventListener("error",()=>{n.state="failed",this.onReady()}),n.element=r,r.src=o}catch{n.state="failed",this.onReady()}}dispose(){for(const t of this.entries.values())t.element&&(t.element.src="");this.entries.clear()}}const gs=/\.(mp4|webm|mov|m4v|mp3|m4a|ogg|wav|pdf|zip|epub|apk)(\?|#|$)/i,bs=["nostr.build","nostrcheck.me","void.cat","blossom","nostr.download","imgur.com","catbox.moe","media.tenor.com","pbs.twimg.com"],ys=/\bhttps?:\/\/[^\s<>()"']+/gi;function ws(e){if(gs.test(e))return!1;const t=e.split(/[?#]/)[0]??e;if(/\.(png|jpe?g|gif|webp|avif|bmp)$/i.test(t))return!0;const n=vs(e);return n!==null&&bs.some(o=>n.endsWith(o))}function vs(e){try{return new URL(e).host.toLowerCase()}catch{return null}}function Es(e,t=3){const n=[];let o=e;for(const s of e.matchAll(ys)){const a=s[0];ws(a)&&(n.includes(a)||n.push(a),o=o.replace(new RegExp(`\\s*${ks(a)}\\s*`)," "))}const r=n.slice(0,t);return{text:o.replace(/[ \t]+/g," ").replace(/\n{3,}/g,`

`).trim(),images:r,extra:n.length-r.length}}function ks(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ss(e){const t=[];let n=0;for(const o of e.matchAll(Pr.nostrLink)){const r=Ar(o[1]);if(!r)continue;const s=o.index??0;s>n&&t.push({kind:"text",text:e.slice(n,s)}),t.push({kind:"mention",pubkey:r.pubkey,raw:o[0]}),n=s+o[0].length}return n<e.length&&t.push({kind:"text",text:e.slice(n)}),t}const Ms=60,St=8;function $s(e,t){const n=document.createElement("aside");n.className="panel",n.tabIndex=-1,n.setAttribute("role","region"),n.setAttribute("aria-label","selected note");const o=document.createElement("button");o.className="panel-close",o.type="button",o.title="close (esc)",o.setAttribute("aria-label","close"),o.textContent="×",o.addEventListener("click",()=>t.onClose());const r=document.createElement("button");r.className="panel-expand",r.type="button",r.title="expand (e)",r.setAttribute("aria-label","expand the note"),r.setAttribute("aria-pressed","false"),r.addEventListener("click",()=>N(!$));const s=document.createElement("header");s.className="panel-head";const a=document.createElement("div");a.className="panel-dwell",a.setAttribute("aria-hidden","true");const d=document.createElement("span");d.className="panel-avatar";const c=document.createElement("h2");c.className="panel-name";const u=document.createElement("button");u.type="button",u.className="panel-author",u.title="open their profile",u.append(d,c);const f=document.createElement("p");f.className="panel-meta";const l=document.createElement("button");l.type="button",l.className="panel-seen",l.textContent="seen",l.title="mark this thread unread",l.hidden=!0,l.addEventListener("click",()=>t.onUnsee?.()),s.append(o,r,u,f,l);const m=document.createElement("div");m.className="panel-notes",n.append(a,s,m);let b=null,v=null,g=null,y=null,k=0,$=!1;u.addEventListener("click",()=>{y&&t.onProfile?.(y)});const M=new ResizeObserver(()=>{b=null,t.onResize?.()});M.observe(n);function x(S){g!==S.id&&(g=S.id,b=null,v=null,H(0),n.classList.remove("open"),n.offsetWidth),n.classList.add("open"),y=S,n.style.setProperty("--hue",String(S.hue)),n.setAttribute("aria-label",`${S.root?"note":"reply"} by ${S.name}`),c.textContent=S.name,u.setAttribute("aria-label",`open the profile of ${S.name}`),Tn(d,S.picture,S.name);const D=S.root?[Ps(S),xs(S),Cn(S)]:[`replying to ${S.parentName}`,Cn(S)];f.textContent=D.filter(Boolean).join(" · ");const R=[],J=G(t.ancestors?.(S)??[]);J&&R.push(J),R.push(Ns(S,e,"reactions"in S?S.reactions:[]));const Y=K(S);Y&&R.push(Y),m.replaceChildren(...R)}function A(){n.classList.remove("open"),g=null,y=null,v=null}function N(S){$!==S&&($=S,n.dataset.expanded=S?"true":"false",r.title=S?"collapse (e)":"expand (e)",r.setAttribute("aria-label",S?"collapse the note":"expand the note"),r.setAttribute("aria-pressed",S?"true":"false"),b=null,v=null,t.onExpand?.(S),n.classList.contains("open")&&(n.classList.remove("open"),n.offsetWidth,n.classList.add("open")))}function H(S){const D=Math.max(0,Math.min(1,S));D!==k&&(k=D,a.style.transform=`scaleX(${D})`)}function _(S){l.hidden=!S}function j(){return b??={width:n.offsetWidth,height:n.offsetHeight}}function F(S){v&&v.left===S.left&&v.top===S.top&&v.side===S.side||(v=S,n.style.left=`${S.left}px`,n.style.top=`${S.top}px`,n.dataset.side=S.side,n.style.transformOrigin=As[S.side])}function G(S){if(S.length===0)return null;const D=document.createElement("div");D.className="panel-context",D.setAttribute("aria-label","the thread this answers");const R=S[0],J=S.slice(-2),Y=S.length-1-J.length,Q=Y>0?[R,null,...J]:S;for(const z of Q){if(!z){const B=document.createElement("p");B.className="panel-context-gap",B.textContent=`… ${Y} more repl${Y===1?"y":"ies"} above`,D.append(B);continue}D.append(q(z,z.root))}return D}function q(S,D){const R=document.createElement("button");R.type="button",R.className="panel-context-row",R.style.setProperty("--hue",String(S.hue));const J=D?"root event":"reply event",Y=In(S.event.content);R.setAttribute("aria-label",`${J} by ${S.name}: ${Y}`);const Q=document.createElement("span");Q.className="panel-context-role",Q.textContent=J;const z=document.createElement("span");z.className="panel-context-name",z.textContent=S.name;const B=document.createElement("span");return B.className="panel-context-text",B.textContent=Y||"(empty note)",R.append(Q,z,B),R.addEventListener("click",()=>t.onSelect?.(S.id)),R}function K(S){if(S.children.length===0)return null;const D=st(S),R=document.createElement("div");R.className="panel-replies";const J=document.createElement("p");J.className="panel-replies-head",J.textContent=`${D} repl${D===1?"y":"ies"}`,R.append(J);let Y=0;const Q=(z,B)=>{for(const re of z){if(Y>=Ms)return;Y++,R.append(V(re,B)),Q(re.children,B+1)}};if(Q(S.children,0),D>Y){const z=document.createElement("p");z.className="panel-replies-more",z.textContent=`+${D-Y} more replies`,R.append(z)}return R}function V(S,D){const R=document.createElement("button");R.type="button",R.className="panel-reply",R.style.setProperty("--hue",String(S.hue)),R.style.setProperty("--indent",`${D*12}px`);const J=In(S.event.content);R.setAttribute("aria-label",`reply by ${S.name}: ${J}`);const Y=document.createElement("span");Y.className="panel-reply-avatar",Tn(Y,S.picture,S.name);const Q=document.createElement("span");Q.className="panel-reply-body";const z=document.createElement("span");z.className="panel-reply-name",z.textContent=S.name;const B=document.createElement("span");return B.className="panel-reply-text",B.textContent=J||"(empty note)",Q.append(z,B),R.append(Y,Q),R.addEventListener("click",()=>t.onSelect?.(S.id)),R}return{element:n,get open(){return n.classList.contains("open")},get expanded(){return $},setExpanded:N,size:j,show:x,place:F,setDwell:H,setSeen:_,hide:A,dispose:()=>{M.disconnect(),n.remove()}}}const As={left:"right center",right:"left center",above:"bottom center",below:"top center",center:"center"};function In(e){return e.replace(/\s+/g," ").trim().slice(0,90)}function Ps(e){const t=e.judgement;if(!t)return"not judged";const n=s=>`${Math.round(s*100)}%`,o=e.rank;return`${o?`${Rs(o.place)} · `:""}${n(t.build)} build · ${n(t.relevant)} relevant`}function Rs(e){const t=Math.abs(e)%100,n=t>=11&&t<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`}function xs(e){const t=e.reactions.length,n=e.reposts.length+e.repostsHidden,o=[];return t>0&&o.push(`${t} reaction${t===1?"":"s"}`),n>0&&o.push(`${n} repost${n===1?"":"s"}`),o.join(" · ")}function Cn(e){const t=st(e);return t===0?"":`${t} repl${t===1?"y":"ies"}`}function Mt(e){return(Array.from(e.trim())[0]??"?").toUpperCase()}function Tn(e,t,n){if(e.textContent=Mt(n),!t)return;const o=new Image;o.alt="",o.decoding="async",o.addEventListener("error",()=>{o.remove(),e.textContent=Mt(n)}),e.textContent="",e.append(o),je(t).then(r=>{o.src=r}).catch(()=>{o.remove(),e.textContent=Mt(n)})}function _s(e){const t=Ut(e);if(t.length===0)return null;const n=document.createElement("div");n.className="panel-reactions",n.setAttribute("aria-label",`${e.length} reaction${e.length===1?"":"s"}`);for(const{glyph:o,count:r}of t.slice(0,St)){const s=document.createElement("span");s.className="panel-reaction",s.title=`${o} ×${r}`,s.setAttribute("aria-label",`${r} with ${o}`);const a=document.createElement("span");a.className="panel-reaction-glyph",a.textContent=o,a.setAttribute("aria-hidden","true");const d=document.createElement("span");d.className="panel-reaction-count",d.textContent=String(r),d.setAttribute("aria-hidden","true"),s.append(a,d),n.append(s)}if(t.length>St){const o=document.createElement("span");o.className="panel-reaction-more",o.textContent=`+${t.length-St} more`,n.append(o)}return n}function Ns(e,t,n=[]){const o=document.createElement("article");o.className="panel-note";const r=document.createElement("div");if(r.className="panel-note-head",!e.root){const f=document.createElement("span");f.className="panel-note-reply",f.textContent="reply",r.append(f)}const s=document.createElement("a");s.className="panel-note-time",s.href=`https://njump.me/${$r(e.event.id)}`,s.target="_blank",s.rel="noreferrer",s.title=new Date(e.event.created_at*1e3).toISOString(),s.textContent=mo(new Date(e.event.created_at*1e3)),r.append(s),o.append(r);const{text:a,images:d,extra:c}=Es(e.event.content);if(a){const f=document.createElement("p");f.className="panel-note-text",Cs(f,a,t),o.append(f)}else if(d.length===0){const f=document.createElement("p");f.className="panel-note-text muted",f.textContent=e.event.content.trim()||"(empty note)",o.append(f)}for(const f of d){const l=new Image;l.className="panel-note-image",l.loading="lazy",l.decoding="async",l.alt="";const m=()=>l.replaceWith(Ls(f));l.addEventListener("error",m),o.append(l),je(f).then(b=>{l.src=b}).catch(m)}if(c>0){const f=document.createElement("p");f.className="panel-note-more",f.textContent=`+${c} more media`,o.append(f)}const u=_s(n);return u&&o.append(u),o}function Is(e,t){const n=t.getReplaceable(T.profile,e);return ye(n?tt(n):void 0,e)}function Cs(e,t,n){for(const o of Ss(t)){if(o.kind==="text"){e.append(o.text);continue}e.append(Ts(o.pubkey,n))}}function Ts(e,t){const n=Bt(e),o=document.createElement("a");return o.className="panel-mention",o.href=`https://njump.me/${n}`,o.target="_blank",o.rel="noreferrer",o.title=n,o.style.setProperty("--hue",String(Te(e))),o.textContent=Is(e,t),o}function Ls(e){const t=document.createElement("a");t.className="panel-note-link",t.href=e,t.target="_blank",t.rel="noreferrer";try{t.textContent=new URL(e).host}catch{t.textContent=e}return t}function Os(e,t){const n=document.createElement("aside");n.className="profile-card",n.tabIndex=-1,n.setAttribute("role","region"),n.setAttribute("aria-label","profile");const o=document.createElement("button");o.className="profile-close",o.type="button",o.title="close (esc)",o.setAttribute("aria-label","close"),o.textContent="×",o.addEventListener("click",()=>t.onClose());const r=document.createElement("div");r.className="profile-banner",r.setAttribute("aria-hidden","true");const s=document.createElement("div");s.className="profile-body";const a=document.createElement("span");a.className="profile-avatar";const d=document.createElement("h2");d.className="profile-name";const c=document.createElement("p");c.className="profile-handle";const u=document.createElement("p");u.className="profile-about";const f=document.createElement("div");f.className="profile-links",s.append(a,d,c,u,f),n.append(r,o,s);let l=null,m=null,b=null;const v=new ResizeObserver(()=>{l=null,t.onResize?.()});v.observe(n);function g(M){b!==M&&(b=M,l=null,m=null,n.classList.remove("open"),n.offsetWidth),n.classList.add("open");const x=Te(M);n.style.setProperty("--hue",String(x));const A=e.getReplaceable(T.profile,M),N=A?tt(A):void 0,H=Bt(M),_=ye(N,M);n.setAttribute("aria-label",`profile of ${_}`);const j=N?.picture??N?.image;Ws(a,j,_),d.textContent=_;const F=Bs(N,_);c.textContent=F,c.hidden=F==="";const G=N?.about?.trim();if(u.textContent=G??"",u.hidden=!G,js(r,N?.banner),f.replaceChildren(...Hs(M,N,H)),!N){const q=document.createElement("p");q.className="profile-missing",q.textContent="no profile published — this is what the snapshot has",f.append(q)}}function y(){n.classList.remove("open"),b=null,m=null}function k(){return l??={width:n.offsetWidth,height:n.offsetHeight}}function $(M){m&&m.left===M.left&&m.top===M.top&&m.side===M.side||(m=M,n.style.left=`${M.left}px`,n.style.top=`${M.top}px`,n.dataset.side=M.side,n.style.transformOrigin=Ds[M.side])}return{element:n,get open(){return n.classList.contains("open")},show:g,place:$,size:k,hide:y,dispose:()=>{v.disconnect(),n.remove()}}}const Ds={left:"right center",right:"left center",above:"bottom center",below:"top center",center:"center"};function Bs(e,t){const n=[],o=e?.name?.trim();o&&o!==t&&n.push(`@${o}`);const r=e?.nip05?.trim();return r&&n.push(r),n.join(" · ")}function js(e,t){if(e.classList.toggle("has-image",!!t),!t){e.style.backgroundImage="";return}je(t).then(n=>{e.style.backgroundImage=`url("${Us(n)}")`}).catch(()=>{e.classList.remove("has-image"),e.style.backgroundImage=""})}function Us(e){return e.replace(/["\\]/g,"\\$&")}function Hs(e,t,n){const o=[],r=t?.website?.trim();r&&o.push($t(r,Fs(r),"their link"));const s=t?.lud16?.trim()||t?.lud06?.trim();return s&&o.push($t(`lightning:${s}`,`⚡ ${s}`,"send sats")),o.push($t(`https://njump.me/${n}`,go(e),"their profile on njump")),o}function $t(e,t,n){const o=document.createElement("a");return o.className="profile-link",o.href=e,o.target="_blank",o.rel="noreferrer",o.title=n,o.textContent=t,o}function Fs(e){try{return new URL(e).host}catch{return e}}function At(e){return(Array.from(e.trim())[0]??"?").toUpperCase()}function Ws(e,t,n){if(e.textContent=At(n),!t)return;const o=new Image;o.alt="",o.decoding="async",o.addEventListener("error",()=>{o.remove(),e.textContent=At(n)}),e.textContent="",e.append(o),je(t).then(r=>{o.src=r}).catch(()=>{o.remove(),e.textContent=At(n)})}const he='ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif',Gs='"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif',Le="169, 112, 255",Ys=58,Ne=200,zs={build:{rgb:"255, 138, 61",alpha:.95},fun:{rgb:"72, 158, 255",alpha:.95},relevant:{rgb:"236, 240, 255",alpha:.9},irrelevant:{rgb:"150, 152, 172",alpha:.4}},Xs=.062,qs=28,Js=58;function Ve(e,t){return Math.max(qs,Math.min(Js,Math.min(e,t)*Xs))}function ko(e){return Math.round(e*.95)}const it=ae,Vs=264,So=1.14,Ks=.42,Qs=0,Ln=.94,Ce=1.1,Zs=.65,ze=6,ei=.36,ti=.55,ni=.42,Gt=it*So+Ce/2,Mo=3,et=.6,$o=.82,On=`700 11px ${he}`,at=.4,oi=.55,ri=`700 8px ${he}`,si=.92,ii=1.16,Dn=Math.PI/4,Bn="hsl(38 96% 60%)",ai="hsl(26 62% 10%)",li=4.8,ci=9.4,di=.16;function ui(e,t){const{field:n,width:o,height:r}=t;e.clearRect(0,0,o,r),fi(e,t),hi(e,t),pi(e,t);const s=t.selected,a=t.hovered,d=[...n.bubbles].filter(u=>!u.hidden).sort((u,f)=>f.r-u.r),c=[];for(const u of d){const f=t.bubbles.get(u.id);if(!f)continue;const l=u.id===a,m=u.id===s;if(l||m){c.push(u);continue}jn(e,t,u,f,"rest")}for(const u of c){const f=t.bubbles.get(u.id);f&&jn(e,t,u,f,u.id===s?"selected":"hovered")}for(const u of d){const f=t.bubbles.get(u.id);if(!t.reactionBadges)break;f&&"reactions"in f&&f.reactions.length>0&&vi(e,u,f,De(t,u.id))}for(const u of d){if(!t.strangerCounts)break;const f=t.bubbles.get(u.id);if(!f?.root)continue;const l=De(t,u.id);f.tail.chip&&Hn(e,u,{...f.tail.chip},l);const m=f.repostsHidden;if(m>0){const b=bi(u.r,f.reposts.length,m);b&&Hn(e,u,b,l)}}Si(e,t,c),ki(e,t),Mi(e,t)}function De(e,t){return e.dimmed.has(t)&&t!==e.selected&&t!==e.hovered}function fi(e,t){const{field:n}=t;if(n.poles.length===0)return;const o=t.phone?n.poles.slice(0,2):n.poles;for(const r of o){const s=e.createRadialGradient(r.x,r.y,0,r.x,r.y,Ne);s.addColorStop(0,`rgba(${Le}, 0.10)`),s.addColorStop(.45,`rgba(${Le}, 0.035)`),s.addColorStop(1,`rgba(${Le}, 0)`),e.fillStyle=s,e.fillRect(r.x-Ne,r.y-Ne,Ne*2,Ne*2)}}function hi(e,t){const{width:n,height:o}=t,r=Ve(n,o),s=ko(r),a=n/2,d=o/2,c=t.phone?{build:{x:a,y:s,angle:0},fun:{x:a,y:o-s,angle:0},relevant:{x:a,y:d,angle:0},irrelevant:{x:a,y:d,angle:0}}:{build:{x:s,y:d,angle:-Math.PI/2},fun:{x:n-s,y:d,angle:Math.PI/2},relevant:{x:a,y:s,angle:0},irrelevant:{x:a,y:o-s,angle:0}},u=t.phone?["build","fun"]:po;e.save(),e.textAlign="center",e.textBaseline="middle",e.font=`700 ${r}px ${he}`,e.letterSpacing=`${r*.14}px`;for(const f of u){const l=c[f],m=zs[f],v=((t.phone?es[f]:void 0)??Zr[f]).toUpperCase();e.save(),e.translate(l.x,l.y),e.rotate(l.angle);for(const[g,y]of[[r*.9,.5],[r*.35,.75]])e.shadowColor=`rgba(${m.rgb}, ${m.alpha*y})`,e.shadowBlur=g,e.fillStyle=`rgba(${m.rgb}, ${m.alpha*y})`,e.fillText(v,0,0);e.shadowBlur=0,e.shadowColor="transparent",e.fillStyle=`rgba(248, 248, 255, ${m.alpha})`,e.fillText(v,0,0),e.restore()}e.restore(),e.letterSpacing="0px"}function pi(e,t){const{field:n,held:o,anchorDrag:r}=t,s=n.bubbles.filter(c=>!c.bond&&!c.hidden);if(s.length<2)return;const a=o!==null||r,d=n.tuning.repelRange+(a?Ys:0);e.lineCap="round";for(let c=0;c<s.length;c++){const u=s[c];for(let f=c+1;f<s.length;f++){const l=s[f],m=u.r+l.r,b=m+d,v=l.x-u.x,g=l.y-u.y,y=v*v+g*g;if(y>b*b)continue;const k=Math.sqrt(y)||1,$=Yt(1-(k-m)/Math.max(1,d)),M=De(t,u.id)||De(t,l.id)?.35:1,x=(.04+.28*$*(a?1:.3))*M;e.strokeStyle=`rgba(${Le}, ${x.toFixed(3)})`,e.lineWidth=.7+$*1.3,e.beginPath(),e.moveTo(u.x,u.y),e.lineTo(l.x,l.y),e.stroke()}}}function jn(e,t,n,o,r){const s=n.r,a=r==="selected",d=r==="hovered",c=De(t,n.id);e.save(),e.translate(n.x,n.y),e.scale(n.scale,n.scale),c&&(e.globalAlpha=at),e.beginPath(),e.arc(0,0,s,0,Math.PI*2),e.shadowColor=a?`hsla(${o.hue}, 90%, 62%, 0.55)`:"rgba(0, 0, 0, 0.5)",e.shadowBlur=a?34:d?20:14,e.shadowOffsetY=a||d?0:4,e.fillStyle=`hsl(${o.hue} 30% 10%)`,e.fill(),e.shadowColor="transparent",e.shadowBlur=0,e.shadowOffsetY=0;const u=t.images.get(o.picture),f=u.state==="ready"&&u.element;if(e.save(),e.beginPath(),e.arc(0,0,s,0,Math.PI*2),e.clip(),f){const m=u.element,b=Math.max(s*2/m.naturalWidth,s*2/m.naturalHeight),v=m.naturalWidth*b,g=m.naturalHeight*b;e.drawImage(m,-v/2,-g/2,v,g)}else Ei(e,o,s);if(c&&(e.beginPath(),e.arc(0,0,s,0,Math.PI*2),e.fillStyle=`rgba(8, 8, 12, ${oi})`,e.fill()),e.restore(),e.beginPath(),e.arc(0,0,s-.5,0,Math.PI*2),e.lineWidth=1,e.strokeStyle="rgba(255, 255, 255, 0.10)",e.stroke(),!o.root&&o.count>1){e.textAlign="right",e.textBaseline="alphabetic",e.font=ri,e.shadowColor="rgba(0, 0, 0, 0.95)",e.shadowBlur=4,e.lineJoin="round",e.strokeStyle="rgba(8, 8, 12, 0.75)",e.lineWidth=2;const m=`×${o.count}`,b=s*si,v=s*ii;e.strokeText(m,b,v),e.fillStyle="rgba(255, 255, 255, 0.96)",e.fillText(m,b,v),e.shadowColor="transparent",e.shadowBlur=0}const l="reposts"in o?o.reposts:[];if(gi(e,t,s,l,"repostsHidden"in o?o.repostsHidden:0),a||d){const m=a?.72+.28*Math.sin(t.time*2.4):1;e.beginPath(),e.arc(0,0,s+1.5,0,Math.PI*2),e.lineWidth=a?3:2,e.strokeStyle=`hsla(${o.hue}, 92%, 70%, ${(a?.95:.8)*m})`,e.stroke(),a&&(e.beginPath(),e.arc(0,0,s+6,0,Math.PI*2),e.lineWidth=1,e.strokeStyle=`hsla(${o.hue}, 92%, 70%, ${.3*m})`,e.stroke())}else e.beginPath(),e.arc(0,0,s+.5,0,Math.PI*2),e.lineWidth=1.5,e.strokeStyle=c?"rgba(255, 255, 255, 0.05)":"rgba(255, 255, 255, 0.13)",e.stroke();"judgement"in o&&o.judgement===null&&mi(e,s,c),e.restore()}function mi(e,t,n){const o=Math.min(ci,Math.max(li,t*di)),r=o*1.72;e.save(),n&&(e.globalAlpha=at*.8),e.translate(Math.cos(Dn)*t,Math.sin(Dn)*t),e.beginPath(),e.moveTo(0,-r*.62),e.lineTo(-o,r*.38),e.lineTo(o,r*.38),e.closePath(),e.lineJoin="round",e.lineWidth=Math.max(1.2,o*.34),e.strokeStyle="rgba(8, 8, 12, 0.88)",e.stroke(),e.fillStyle=Bn,e.fill(),e.strokeStyle=Bn,e.stroke();const s=Math.max(1.15,o*.26);e.fillStyle=ai,e.beginPath(),e.roundRect(-s/2,-r*.2,s,r*.3,s/2),e.fill(),e.beginPath(),e.arc(0,r*.26,s*.55,0,Math.PI*2),e.fill(),e.restore()}function gi(e,t,n,o,r){if(o.length===0&&r===0)return;const s=it,a=Be(n,Gt,Math.max(1,o.length));for(const[d,c]of a.entries()){const u=o[d];if(!u)break;yi(e,t,c.dx,-c.dy,s,u)}}function Lt(e,t){const n=[],o=e.scale,r=Be(e.r,Gt,Math.max(1,t.reposts.length));for(const[s,a]of t.reposts.entries()){const d=r[s];if(!d)break;n.push({repost:a,x:e.x+d.dx*o,y:e.y-d.dy*o,r:it*o})}return n}function bi(e,t,n){const o=Gt;if(t===0)return{dx:0,dy:-(e+o),align:"center",count:n};const r=Be(e,o,t).at(-1);return{dx:r.dx+o+vo,dy:-r.dy,align:"left",count:n}}function Un(e,t){const n=Vs,o=Math.PI/2,r=it,s=r*So,a=s*Ks,d=r*Qs,c=t==="near";e.lineCap="round",e.lineJoin="round";const u=(K,V)=>{e.beginPath(),e.ellipse(0,d,s,a,0,K,V)};if(!c){e.strokeStyle=`hsla(${n}, 85%, 62%, 0.5)`,e.lineWidth=Zs,e.shadowColor=`hsla(${n}, 100%, 62%, 0.5)`,e.shadowBlur=ze*.4,e.beginPath(),e.ellipse(0,d,s*Ln,a*Ln,0,Math.PI,Math.PI*2),e.stroke(),e.shadowBlur=0,e.shadowColor="transparent";return}const f=e.createLinearGradient(0,d,0,d+a);f.addColorStop(0,`hsl(${n} 92% 58%)`),f.addColorStop(.55,`hsl(${n} 98% 72%)`),f.addColorStop(1,`hsl(${n} 100% 90%)`),e.strokeStyle=f,e.shadowColor=`hsla(${n}, 100%, 62%, 0.9)`;for(const[K,V]of[[Ce,ze],[Ce,ze*.35]])e.lineWidth=K,e.shadowBlur=V,u(0,o),e.stroke(),u(o+ni,Math.PI),e.stroke();e.shadowBlur=0,e.shadowColor="transparent";const l=s*ei,m=ti,b=Math.cos(o),v=Math.sin(o),g=-s*v,y=a*b,k=Math.hypot(g,y)||1,$=g/k,M=y/k,x=s*b,A=d+a*v,N=-$*l,H=-M*l,_=N*Math.cos(m)-H*Math.sin(m),j=N*Math.sin(m)+H*Math.cos(m),F=N*Math.cos(m)+H*Math.sin(m),G=-N*Math.sin(m)+H*Math.cos(m),q=(K,V,S)=>{e.strokeStyle=K,e.lineWidth=V,e.shadowColor=`hsla(${n}, 100%, 65%, 0.95)`,e.shadowBlur=S,e.lineJoin="miter",e.miterLimit=4,e.beginPath(),e.moveTo(x+_,A+j),e.lineTo(x,A),e.lineTo(x+F,A+G),e.stroke()};q("rgba(8, 9, 14, 0.75)",Ce+1.1,0),q(`hsl(${n} 100% 88%)`,Ce,ze*.8),e.shadowBlur=0,e.shadowColor="transparent"}function yi(e,t,n,o,r,s){e.save(),e.translate(n,o),Un(e,"far"),e.beginPath(),e.arc(0,0,r,0,Math.PI*2),e.fillStyle="rgba(10, 10, 15, 0.94)",e.fill();const a=t.images.get(s.picture),d=a.state==="ready"?a.element:null;if(e.save(),e.beginPath(),e.arc(0,0,r-.5,0,Math.PI*2),e.clip(),d){const c=Math.max(r*2/d.naturalWidth,r*2/d.naturalHeight),u=d.naturalWidth*c,f=d.naturalHeight*c;e.drawImage(d,-u/2,-f/2,u,f)}else e.fillStyle=`hsl(${s.hue} 40% 16%)`,e.fillRect(-r,-r,r*2,r*2),e.fillStyle=`hsl(${s.hue} 92% 78%)`,e.font=`700 ${Math.round(r*1.1)}px ${he}`,e.textAlign="center",e.textBaseline="middle",e.fillText("↻",0,.5);e.restore(),Un(e,"near"),e.restore()}const Ao=`14px ${Gs}`,Po=`700 12px ${he}`,Ro=6,xo=2,_o=5,No=24;function wi(e,t,n){if(t.reactions.length===0)return null;const o=Ut(t.reactions,Mo).map(f=>f.glyph),r=Ro*2+o.reduce((f,l)=>f+n(l,Ao),0)+Math.max(0,o.length-1)*xo+_o+n(String(t.reactions.length),Po),s=(e.r/Me-fe)/(rt-fe),a=et+($o-et)*Yt(s),d=e.x+e.r*e.scale,c=r*a,u=No*a;return{left:d-c/2,top:e.y-u/2,width:c,height:u}}function vi(e,t,n,o){if(n.reactions.length===0)return;const r=Ut(n.reactions,Mo).map($=>$.glyph),s=String(n.reactions.length),a=Ao,d=Po,c=Ro,u=xo,f=_o,l=No;e.save(),o&&(e.globalAlpha=at*.6),e.font=a;const m=r.map($=>e.measureText($).width),b=m.reduce(($,M)=>$+M,0)+(r.length-1)*u;e.font=d;const v=c*2+b+f+e.measureText(s).width,g=(t.r/Me-fe)/(rt-fe),y=et+($o-et)*Yt(g);e.translate(t.x+t.r*t.scale,t.y),e.scale(y,y),e.beginPath(),e.roundRect(-v/2,-l/2,v,l,l/2),e.fillStyle="rgba(12, 12, 18, 0.94)",e.shadowColor="rgba(0, 0, 0, 0.55)",e.shadowBlur=6,e.fill(),e.shadowColor="transparent",e.shadowBlur=0,e.lineWidth=1,e.strokeStyle=`hsla(${n.hue}, 85%, 72%, 0.6)`,e.stroke(),e.textAlign="left",e.textBaseline="middle",e.font=a,e.fillStyle="rgba(244, 244, 250, 0.96)";let k=-v/2+c;for(const[$,M]of r.entries())e.fillText(M,k,1),k+=m[$]+u;e.font=d,e.fillStyle=`hsl(${n.hue} 92% 80%)`,e.fillText(s,k-u+f,1),e.restore()}function Hn(e,t,n,o){const r=`+${n.count}`,s=20,a=7;e.save(),o&&(e.globalAlpha=at*.6),e.font=On;const d=Math.max(s,a*2+e.measureText(r).width),c=n.align==="left"?0:-d/2;e.translate(t.x+n.dx,t.y+n.dy),e.beginPath(),e.roundRect(c,-s/2,d,s,s/2),e.fillStyle="rgba(12, 12, 18, 0.9)",e.shadowColor="rgba(0, 0, 0, 0.45)",e.shadowBlur=5,e.fill(),e.shadowColor="transparent",e.shadowBlur=0,e.lineWidth=1,e.strokeStyle=`rgba(${Le}, 0.5)`,e.stroke(),e.textAlign="center",e.textBaseline="middle",e.font=On,e.fillStyle="rgba(228, 224, 240, 0.92)",e.fillText(r,c+d/2,1),e.restore()}function Ei(e,t,n){const o=e.createRadialGradient(-n*.3,-n*.45,n*.1,0,0,n);o.addColorStop(0,`hsl(${t.hue} 48% 38%)`),o.addColorStop(1,`hsl(${t.hue} 34% 14%)`),e.fillStyle=o,e.fillRect(-n,-n,n*2,n*2);const r=(Array.from(t.name.trim())[0]??"?").toUpperCase();e.fillStyle="rgba(255, 255, 255, 0.82)",e.font=`600 ${Math.round(n*.8)}px ${he}`,e.textAlign="center",e.textBaseline="middle",e.fillText(r,0,n*.04)}function ki(e,t){const n=t.hoveredRepost;if(!n)return;const o=t.field.bubbles.find(l=>l.id===n.bubbleId);if(!o||o.hidden)return;const r=t.bubbles.get(n.bubbleId);if(!r?.root)return;const s=Lt(o,r).find(l=>l.repost.pubkey===n.pubkey);if(!s)return;e.beginPath(),e.arc(s.x,s.y,s.r+2,0,Math.PI*2),e.lineWidth=2,e.strokeStyle=`hsla(${s.repost.hue}, 92%, 70%, 0.95)`,e.stroke();const a=s.repost.name;e.font=`600 13px ${he}`;const d=e.measureText(a).width+20,c=23;let u=s.y-s.r-9-c/2;u-c/2<6&&(u=s.y+s.r+9+c/2);const f=Math.min(Math.max(s.x,d/2+6),Math.max(d/2+6,t.width-d/2-6));e.beginPath(),e.roundRect(f-d/2,u-c/2,d,c,c/2),e.fillStyle="rgba(10, 10, 15, 0.9)",e.fill(),e.strokeStyle=`hsla(${s.repost.hue}, 92%, 70%, 0.7)`,e.lineWidth=1,e.stroke(),e.fillStyle="rgba(238, 238, 246, 0.97)",e.textAlign="center",e.textBaseline="middle",e.fillText(a,f,u+.5)}function Si(e,t,n){for(const o of n){const r=t.bubbles.get(o.id);if(!r)continue;const s=o.id===t.selected;e.font=`600 13px ${he}`;const a=r.name,d=e.measureText(a).width+20,c=23,u=o.r*o.scale;let f=o.y+u+9+c/2;f+c/2>t.height-6&&(f=o.y-u-9-c/2);const l=Math.min(Math.max(o.x,d/2+6),Math.max(d/2+6,t.width-d/2-6));e.beginPath(),e.roundRect(l-d/2,f-c/2,d,c,c/2),e.fillStyle="rgba(10, 10, 15, 0.9)",e.fill(),e.strokeStyle=s?`hsla(${r.hue}, 92%, 70%, 0.7)`:"rgba(255, 255, 255, 0.14)",e.lineWidth=1,e.stroke(),e.fillStyle="rgba(238, 238, 246, 0.97)",e.textAlign="center",e.textBaseline="middle",e.fillText(a,l,f+.5)}}function Mi(e,t){const{pointer:n,held:o,field:r}=t;if(!n)return;const s=o?r.bubbles.find(a=>a.id===o):void 0;s&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(n.x,n.y),e.strokeStyle="rgba(255, 255, 255, 0.28)",e.lineWidth=1,e.setLineDash([3,4]),e.stroke(),e.beginPath(),e.arc(n.x,n.y,12,0,Math.PI*2),e.strokeStyle="rgba(255, 255, 255, 0.22)",e.stroke(),e.setLineDash([]))}function Yt(e){return e<0?0:e>1?1:e}const $i=15,Fn=24,Xe=6,Io="bubbles.reactionBadges",Co="bubbles.strangerCounts",Ai=660,ue=18,se=12,Pi=7200,Ri=1e7,xi=2,_i=.3,Ni=3,Wn=40,Gn=14;function Ii(e,t){const n=os(t),o=fs(n),r=new Map(o.map(i=>[i.id,i])),s=Wr(o.map(i=>i.id));let a=Gr(),d=new Set,c=!1,u=!1,f=Li(),l=Ci();const m=jr();for(const i of t.events)m.add(i);let b=null,v=null,g=null,y=null,k=null,$=null,M=!1,x=null;const A={x:0,y:0,vx:0,vy:0};let N=null,H=!1,_=null,j=!1,F=0,G=0,q=0,K=!1,V=!1,S=0,D=0,R=!0,J=0,Y=performance.now(),Q=0,z=0;const B={id:null,elapsed:0};let re=!1;const ee=document.createElement("div");ee.className="space-scroll";const C=document.createElement("canvas");C.className="space-canvas",C.tabIndex=0,C.setAttribute("role","img");function $e(){const i=me().size,h=i===0?"":`, ${i} read and hidden`;return`${o.length} notes floating between ${c?"two":"four"} poles${h}`}C.setAttribute("aria-label",$e());const P=C.getContext("2d");if(!P)throw new Error("this browser has no 2d canvas context");const W=P,le=new ms(()=>{R=!0}),L=new Ze;L.poles.push(...po.map(i=>Ze.pole(i)));function Do(i){const h=[];let p="parent"in i?i.parent:void 0;for(;p&&h.length<64;){const w=r.get(p);if(!w)break;h.push(w),p="parent"in w?w.parent:void 0}return h.reverse()}const X=$s(m,{ancestors:i=>Do(i),onClose:()=>ne(null),onSelect:i=>ne(i,"click"),onProfile:i=>sn(i.pubkey,gt(i.id)?.id??i.id),onResize:()=>de(),onExpand:()=>{de(),R=!0},onUnsee:()=>Jo()}),ce=Os(m,{onClose:()=>xe(),onResize:()=>de()}),Ue=document.createElement("header");Ue.className="hud";const we=document.createElement("a");we.className="hud-account",we.href=`https://njump.me/${t.npub}`,we.target="_blank",we.rel="noreferrer",we.textContent=t.npub;const lt=document.createElement("p");lt.className="hud-stats";const Bo=Object.keys(t.threads??{}).length,zt=Object.values(t.threads??{}).reduce((i,h)=>i+h.length,0),Xt=t.stats?.repostNotes??0,jo=Xt>0?`, ${Xt} reposted`:"";lt.textContent=`${o.length} notes (${Ur(t.since)}${jo}) · `+(zt>0?`${Bo} threads, ${zt} replies · `:"")+`fetched ${mo(new Date(t.generatedAt))}`;const qt=Hr({judged:Object.keys(t.judgements??{}).length,total:n.filter(i=>i.root).length,prompt:t.jev?.prompt}),Jt=zr({counts:()=>({seen:n.filter(i=>s.has(i.id)).length,total:n.length}),isHiding:()=>a,onToggle:i=>dn(i),onReset:()=>s.reset()}),Vt=Nn({label:"emoji reactions",title:"the emoji and the count on each bubble — a note you open still lists them all",pressed:f,onChange:i=>Xo(i)}),Kt=Nn({label:"non-follow counts",title:"the +N beside the replies and reposts from people you don't follow — a note you open still lists them all",pressed:l,onChange:i=>qo(i)}),ve=document.createElement("button");ve.type="button",ve.className="hud-profiles";const He=document.createElement("span");He.className="hud-profiles-status",He.setAttribute("aria-live","polite");const ct=document.createElement("div");ct.className="hud-profiles-row",ct.append(ve,He);let Ee=!1;function dt(){const i=_n(t).length;ve.disabled=Ee||i===0,ve.textContent=Ee?"fetching profiles…":"fetch missing profiles",!Ee&&(He.textContent=i===0?"all faces present":`${i} missing`)}dt();async function Uo(){if(Ee)return;const i=_n(t);if(i.length!==0){Ee=!0,dt();try{const h=await Dr(i,{log:E=>console.info(E)}),p=Br(t,h);for(const E of h)m.add(E);const w=ps(n,t);console.info(`profiles: ${p} stored, ${w} faces filled in of ${i.length} asked for`),Re()}catch(h){console.warn("Bubbles could not fetch profiles",{error:h})}finally{Ee=!1,dt()}}}ve.addEventListener("click",()=>{Uo()});const pe=document.createElement("div");pe.className="hud-menu",pe.id="feed-menu",pe.hidden=!0,pe.append(lt,we,qt.element,Qt(),Jt.element,Vt.element,Kt.element,Qt(),ct);const oe=document.createElement("button");oe.type="button",oe.className="hud-burger",oe.title="settings",oe.setAttribute("aria-label","settings and account"),oe.setAttribute("aria-controls","feed-menu"),oe.setAttribute("aria-expanded","false"),oe.addEventListener("click",()=>ut(!u));function Qt(){const i=document.createElement("span");return i.className="hud-menu-rule",i.setAttribute("aria-hidden","true"),i}function ut(i,h=!1){u!==i&&(u=i,pe.hidden=!i,oe.setAttribute("aria-expanded",i?"true":"false"),!i&&h&&oe.focus())}function Zt(i){if(!u)return;const h=i.target;h&&(pe.contains(h)||oe.contains(h)||ut(!1))}document.addEventListener("pointerdown",Zt),Ue.append(oe,pe);const Ae=document.createElement("p");Ae.className="hint",Ae.textContent="drag a face to pull it · click to read · click a repost face for their profile · h hides the ones you have read · ↑↓ roots, ←→ thread";const Pe=document.createElement("div");Pe.className="sr-only",Pe.setAttribute("role","list");const ft=new Map;for(const i of o){const h=document.createElement("button");h.type="button",h.textContent=i.name;const p=i.event.content.split(`
`)[0]?.slice(0,100)??"",w=i.root?"note":"reply";h.setAttribute("aria-label",`${w} by ${i.name}: ${p}`),h.addEventListener("focus",()=>ne(i.id,"click")),h.addEventListener("click",()=>ne(i.id,"click")),ft.set(i.id,h),Pe.append(h)}ee.append(C,X.element,ce.element),e.classList.add("space"),e.append(ee,Ue,Ae,Pe);function en(){return{x:0,y:0,w:F,h:G}}function ht(){return{top:ee.scrollTop,height:q}}function pt(i){return ko(i)+i*.8}function tn(i){const h=Ve(i.w,i.h),p=pt(h),w=i.x+i.w/2,E=i.y+i.h/2,I=c?i.h/2-p:Math.min(i.w/2-p,i.h/2-p);return{cx:w,cy:E,rx:Math.max(60,i.w/2-p),arm:Ho(i,Math.max(60,I),E)}}function nn(i){return c?[{x:i.cx,y:i.cy-i.arm},{x:i.cx,y:i.cy+i.arm},{x:i.cx,y:i.cy},{x:i.cx,y:i.cy}]:[{x:i.cx-i.rx,y:i.cy},{x:i.cx+i.rx,y:i.cy},{x:i.cx,y:i.cy-i.arm},{x:i.cx,y:i.cy+i.arm}]}function Ho(i,h,p){const w=c?pt(Ve(i.w,i.h)):0,E=i.y+i.h-8-w;let I=h;const O=me();for(const Z of n){if(O.has(Z.id))continue;const ke=Z.tail.depth,te=Fo(Z);ke===0||te<=.01||(I=Math.min(I,(E-p-ke)/te))}return Math.max(60,I)}function Fo(i){const[h,p]=c?[0,1]:[2,3],w=i.weights[h]??0,E=i.weights[p]??0,I=w+E;return I<=1e-9?0:(E-w)/I}function on(){const i=tn(en()),h=nn(i);let p=!1;for(const[w,E]of L.poles.entries()){const I=h[w]??{x:i.cx,y:i.cy},O=I.x+A.x,Z=I.y+A.y;(Math.abs(E.x-O)>.01||Math.abs(E.y-Z)>.01)&&(p=!0),E.x=O,E.y=Z}return p}function Wo(i,h){const p=en(),w=8,E=nn(tn(p)),I=Math.min(...E.map(te=>te.x)),O=Math.max(...E.map(te=>te.x)),Z=Math.min(...E.map(te=>te.y)),ke=Math.max(...E.map(te=>te.y));return{x:Math.min(Math.max(i,w-I),p.x+p.w-w-O),y:Math.min(Math.max(h,w-Z),p.y+p.h-w-ke)}}function Go(){L.bubbles.length=0,y=null,b=null,kt(n,c,me()),L.bubbles.push(...hs(n,p=>L.targetFor(p)));for(const p of L.bubbles)p.scaleTarget=yt(p.id);ln();const i=L.bubbles.length,h=Math.min(Pi,Math.max(1,Math.floor(Ri/Math.max(1,i*(i-1)))));for(let p=0;p<h;p++)L.step(1/60);L.freeze(),K=!0}function Re(){V=!0,S=0,D=0}function mt(){const i=e.getBoundingClientRect(),h=Math.max(320,Math.round(i.width)),p=Math.max(320,Math.round(i.height)),w=Math.min(2,window.devicePixelRatio||1),E=h<Ai,I=E!==c;c=E,I&&kt(n,c,me());const O=me(),Z=c?ds(n.filter(Zo=>!O.has(Zo.id)),h,p):p,ke=F!==h||G!==Z||q!==p;F=h,G=Z,q=p,ee.classList.toggle("scrolls",G>q),C.width=Math.round(F*w),C.height=Math.round(G*w),C.style.width=`${F}px`,C.style.height=`${G}px`,W.setTransform(w,0,0,w,0,0);const te=c?pt(Ve(F,G)):0;L.bounds={minX:8,minY:8+te,maxX:F-8,maxY:G-8-te},c&&X.setExpanded(!1),I&&C.setAttribute("aria-label",$e());const Qo=on();!K||I?Go():(ke||Qo)&&Re(),de(),R=!0}function gt(i){const h=new Set;let p=r.get(i);for(;p&&!h.has(p.id);){h.add(p.id);const w=L.bubbles.find(E=>E.id===p.id);if(w)return w;p="parent"in p?r.get(p.parent):void 0}return null}function Yo(){if(!X.open||!g)return;if(X.expanded){X.place({left:F-X.size().width-se,top:se,side:"right"});return}const i=gt(g);if(!i)return;const h=Yn({x:i.x,y:i.y,r:i.r*i.scale},X.size(),{width:F,...ht()});X.place(h)}function de(){Yo(),rn()}function rn(){if(!ce.open||!$)return;const i=L.bubbles.find(p=>p.id===$.anchorId);if(!i||i.hidden){xe();return}let h={x:i.x,y:i.y,r:i.r*i.scale};if($.bead){const p=r.get($.anchorId),w=p?.root&&Lt(i,p).find(E=>E.repost.pubkey===$.bead.pubkey);w&&(h={x:w.x,y:w.y,r:w.r})}ce.place(Yn(h,ce.size(),{width:F,...ht()}))}function sn(i,h,p){$={pubkey:i,anchorId:h,bead:p},ne(null),ce.show(i),rn(),R=!0}function xe(){!$&&!ce.open||($=null,ce.hide(),Fe(),R=!0)}function zo(i){if(!c||q>=G)return;const h=ht(),p=40;if(i.y>=h.top+p&&i.y<=h.top+h.height-p)return;const w=i.r+i.tailDepth,E=i.y-w/2+i.r,I=Math.max(0,Math.min(Math.round(E-h.height/2),G-h.height)),O=window.matchMedia("(prefers-reduced-motion: reduce)").matches;ee.scrollTo({top:I,behavior:O?"auto":"smooth"})}function an(){return new Set(n.filter(i=>s.has(i.id)).map(i=>i.id))}function me(){const i=new Set;if(!a)return i;const h=g??$?.anchorId??null,p=h?ge(h)?.id??null:null;for(const w of an())w!==p&&i.add(w);return i}function ln(){const i=an(),h=me();let p=!1;for(const E of L.bubbles){const I=E.bond?.id??E.id,O=h.has(I);E.hidden!==O&&(E.hidden=O,E.vx=0,E.vy=0,E.ax=0,E.ay=0,p=!0)}d=new Set;const w=new Set;for(const E of L.bubbles){if(E.hidden){w.add(E.id);continue}const I=E.bond?.id??E.id;i.has(I)&&d.add(E.id)}for(const[E,I]of ft)I.hidden=w.has(E);return p}function Fe(){const i=ln();c?(kt(n,!0,me()),mt()):i&&Re(),g&&X.setSeen(cn(g)),Jt.refresh(),de(),R=!0}function cn(i){const h=ge(i);return h?s.has(h.id):!1}function dn(i){a!==i&&(a=i,Yr(i),Fe())}function Xo(i){f!==i&&(f=i,Oi(i),Vt.set(i),R=!0)}function qo(i){l!==i&&(l=i,Ti(i),Kt.set(i),R=!0)}function Jo(){const i=g?ge(g):null;i&&(re=!1,B.id=null,B.elapsed=0,X.setDwell(0),s.forget(i.id))}s.onChange(Fe);function ne(i,h="link"){if(i!==null&&xe(),g!==i){g=i;for(const w of L.bubbles)w.scaleTarget=yt(w.id);for(const[w,E]of ft)w===i?E.setAttribute("aria-current","true"):E.removeAttribute("aria-current");if(i){const w=r.get(i);if(w){X.show(w),X.setSeen(cn(i));const E=gt(i);E&&zo(E),de()}Ae.classList.add("spent")}else X.hide();const p=i?`#${kr(i)}`:location.pathname;try{history.replaceState(null,"",p)}catch{}if(B.id=null,B.elapsed=0,re=i!==null&&h==="keys",re)X.setDwell(0);else if(i){const w=ge(i);w&&s.mark(w.id),X.setDwell(1)}else X.setDwell(0);Fe()}R=!0}function bt(){const i=location.hash.replace(/^#/,"").trim();if(!i){ne(null);return}let h;try{h=Sr(i)}catch{return}r.has(h)&&ne(h,"link")}function yt(i){return i===g?Qr:i===b?Kr:1}function un(i){if(b!==i){b=i;for(const h of L.bubbles)h.scaleTarget=yt(h.id);C.style.cursor=i?"grab":M?"grabbing":"default",R=!0}}function fn(i){const h=L.bubbles.filter(O=>!O.bond&&!O.hidden).sort((O,Z)=>O.y-Z.y||O.x-Z.x);if(h.length===0)return;const p=g?ge(g):null,w=p?h.findIndex(O=>O.id===p.id):-1,E=w<0?i>0?0:h.length-1:w+i,I=h[(E+h.length)%h.length];I&&ne(I.id,"keys")}function hn(i){if(!g)return;const h=ge(g);if(!h)return;const p=O=>!L.bubbles.find(Z=>Z.id===O)?.hidden,w=[h.id,...Vo(h)].filter(p);if(w.length===0)return;const E=Math.max(0,w.indexOf(g)),I=w[(E+i+w.length)%w.length];I&&ne(I,"keys")}function ge(i){const h=new Set;let p=r.get(i);for(;p&&"parent"in p&&!h.has(p.id);)h.add(p.id),p=r.get(p.parent);return p&&p.root?p:null}function Vo(i){const h=[],p=w=>{for(const E of w)E.placement==="face"&&h.push(E.id),p(E.children)};return p(i.children),h}function Ko(i,h){W.save(),W.font=h;const p=W.measureText(i).width;return W.restore(),p}function pn(i,h){if(f)for(const p of L.bubbles){if(p.hidden)continue;const w=r.get(p.id);if(!w?.root||w.reactions.length===0||Math.abs(h-p.y)>Fn||i<p.x||i>p.x+p.r+Fn*2)continue;const E=wi(p,w,Ko);if(E&&i>=E.left-Xe&&i<=E.left+E.width+Xe&&h>=E.top-Xe&&h<=E.top+E.height+Xe)return p}return L.bubbleAt(i,h)}function mn(i,h){for(const p of L.bubbles){if(p.hidden)continue;const w=r.get(p.id);if(!(!w?.root||w.reposts.length===0)&&!(h>p.y)&&!(i<p.x-p.r*6||i>p.x+p.r*6)){for(const E of Lt(p,w))if(Math.hypot(i-E.x,h-E.y)<=E.r+2)return{bubble:p,repost:E.repost}}}}function wt(i){const h=C.getBoundingClientRect();return{x:i.clientX-h.left,y:i.clientY-h.top}}function gn(i){if(i.button!==0)return;const h=wt(i);N=h,_={x:h.x,y:h.y,time:i.timeStamp},j=!1,C.setPointerCapture(i.pointerId);const p=mn(h.x,h.y);if(p)y=p.bubble,k=p.repost,p.bubble.hold=1,p.bubble.holdX=p.bubble.x,p.bubble.holdY=p.bubble.y,C.style.cursor="pointer";else{const w=pn(h.x,h.y);w?(y=w,w.hold=1,w.holdX=w.x,w.holdY=w.y,C.style.cursor="grabbing"):(M=!0,x={x:h.x-A.x,y:h.y-A.y},A.vx=0,A.vy=0,C.style.cursor="grabbing")}R=!0}function bn(i){const h=wt(i);N=h;const p=_?Math.hypot(h.x-_.x,h.y-_.y):0;if(y)(j||p>=7)&&(j=!0,y.holdX=zn(h.x,F),y.holdY=zn(h.y,G),Re());else if(M&&x){if(j||p>=7){j=!0;const w=Wo(h.x-x.x,h.y-x.y);A.x=w.x,A.y=w.y}}else{const w=mn(h.x,h.y);v=w?{bubbleId:w.bubble.id,pubkey:w.repost.pubkey}:null,un(w?null:pn(h.x,h.y)?.id??null),C.style.cursor=w?"pointer":b?"grab":M?"grabbing":"default"}R=!0}function We(i){C.hasPointerCapture(i.pointerId)&&C.releasePointerCapture(i.pointerId);const h=wt(i),p=_?Math.hypot(h.x-_.x,h.y-_.y):0,w=_?i.timeStamp-_.time<450:!1,E=p<7&&w,I=y,O=k;k=null,_=null,j=!1,I?(I.hold=0,y=null,E&&(O?sn(O.pubkey,I.id,O):ne(I.id,"click"))):M&&(M=!1,x=null,E&&(ne(null),xe())),C.style.cursor=b?"grab":"default",R=!0}function yn(i){if(i.key==="Escape"){u?ut(!1,!0):$?xe():X.expanded?X.setExpanded(!1):g&&ne(null);return}if(i.key==="ArrowDown")fn(1);else if(i.key==="ArrowUp")fn(-1);else if(i.key==="ArrowRight")hn(1);else if(i.key==="ArrowLeft")hn(-1);else if(i.key==="h"||i.key==="H")dn(!a);else if((i.key==="e"||i.key==="E")&&!c)X.setExpanded(!X.expanded);else return;i.preventDefault()}function wn(){H=!0}function vn(){H=!1,!(y||M)&&(N=null,v=null,un(null),R=!0)}function En(i){z=requestAnimationFrame(En);const h=Math.min(.05,(i-Y)/1e3);Y=i,J+=h,re&&g&&!document.hidden&&(B.id!==g&&(B.id=g,B.elapsed=0),B.elapsed<Ye&&(B.elapsed=Math.min(Ye,B.elapsed+h*1e3),B.elapsed>=Ye&&s.mark(ge(g)?.id??g)),X.setDwell(B.elapsed/Ye)),!M&&(A.x!==0||A.y!==0)&&(A.vx+=(-A.x*Wn-A.vx*Gn)*h,A.vy+=(-A.y*Wn-A.vy*Gn)*h,A.x+=A.vx*h,A.y+=A.vy*h,Math.hypot(A.x,A.y)<.2&&Math.hypot(A.vx,A.vy)<2&&(A.x=0,A.y=0,A.vx=0,A.vy=0));const p=on();p&&Re(),V?(L.step(h),j||p||A.x!==0||A.y!==0?(S=0,D=0):(S+=h,D=L.maxSpeed()<xi?D+h:0,(D>=_i||S>=Ni)&&(L.freeze(),V=!1))):L.easeScale(h);const w=L.bubbles.some(O=>Math.abs(O.scale-O.scaleTarget)>.002),E=V&&!L.isSettled(12);!(y!==null||M||A.x!==0||A.y!==0||H||w||E)&&!R&&i-Q<1e3/$i||(R=!1,Q=i,de(),ui(W,{field:L,bubbles:r,images:le,width:F,height:G,hovered:b,hoveredRepost:v,selected:g,held:y?.id??null,anchorDrag:M,pointer:N,time:J,dimmed:d,phone:c,reactionBadges:f,strangerCounts:l}))}const kn=new ResizeObserver(()=>mt());kn.observe(e),mt();const Sn=()=>de();return ee.addEventListener("scroll",Sn,{passive:!0}),C.addEventListener("pointerdown",gn),C.addEventListener("pointermove",bn),C.addEventListener("pointerup",We),C.addEventListener("pointercancel",We),C.addEventListener("pointerenter",wn),C.addEventListener("pointerleave",vn),window.addEventListener("keydown",yn),window.addEventListener("hashchange",bt),bt(),z=requestAnimationFrame(En),()=>{cancelAnimationFrame(z),kn.disconnect(),C.removeEventListener("pointerdown",gn),C.removeEventListener("pointermove",bn),C.removeEventListener("pointerup",We),C.removeEventListener("pointercancel",We),C.removeEventListener("pointerenter",wn),C.removeEventListener("pointerleave",vn),window.removeEventListener("keydown",yn),window.removeEventListener("hashchange",bt),document.removeEventListener("pointerdown",Zt),X.dispose(),ce.dispose(),qt.dispose(),le.dispose(),Wt(),ee.removeEventListener("scroll",Sn),Ue.remove(),Ae.remove(),Pe.remove(),ee.remove()}}function Yn(e,t,n){const o=n.top+n.height,r={left:e.x-e.r-ue-se-t.width,right:n.width-se-(e.x+e.r+ue)-t.width,below:o-se-(e.y+e.r+ue)-t.height,above:e.y-e.r-ue-se-n.top-t.height,center:0},s=e.x>=n.width/2?["right","left"]:["left","right"],a=e.y>=n.top+n.height/2?["above","below"]:["below","above"],d=(m,b)=>r[b]-r[m],u=[...s.sort(d),...a.sort(d)].find(m=>r[m]>=0)??s[0],f=r[u]>=0,l={left:u==="left"?e.x-e.r-ue-t.width:u==="right"?e.x+e.r+ue:e.x-t.width/2,top:u==="above"?e.y-e.r-ue-t.height:u==="below"?e.y+e.r+ue:e.y-t.height/2};return{left:Xn(l.left,se,n.width-se-t.width),top:Xn(l.top,n.top+se,o-se-t.height),side:f?u:"center"}}function Ci(){return nt(Co)==="true"}function Ti(e){ot(Co,String(e))}function Li(){return nt(Io)==="true"}function Oi(e){ot(Io,String(e))}function zn(e,t){const n=Math.min(48,t*.15);return Math.min(Math.max(e,n),t-n)}function Xn(e,t,n){return Math.min(Math.max(e,t),Math.max(t,n))}const To=document.querySelector("#app");if(!To)throw new Error("#app is missing from index.html");const Lo=To;function Ie(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function Di(e){const t=[Ie(e.follows,"follow")];return e.profiles>0&&t.push(Ie(e.profiles,"profile")),e.batches<e.batchesTotal&&t.push(`${e.batches}/${e.batchesTotal} batches`),e.notes>0&&t.push(Ie(e.notes,"note")),e.threads>0&&t.push(Ie(e.threads,"thread")),e.replies>0&&t.push(Ie(e.replies,"reply","replies")),t.join(" · ")}function qn(e,t){const n=document.createElement("div");n.className="error";const o=document.createElement("p");if(o.textContent=e,n.append(o),t){const s=document.createElement("p");s.className="error-detail",s.textContent=t,n.append(s)}const r=document.createElement("p");return r.className="boot-status",r.setAttribute("aria-live","polite"),t||n.append(r),Lo.replaceChildren(n),s=>{r.textContent=s}}let Ot=null;function Oo(){Ot?.(),Ot=null,Wt()}window.addEventListener("pagehide",Oo);window.addEventListener("beforeunload",Oo);try{const e=qn("reading the feed…");await Fr();const t=await Or({log:o=>console.info(o),onProgress:o=>e(Di(o))}),n=Ii(Lo,t);Ot=()=>{n(),Wt()}}catch(e){console.warn("Bubbles could not read the feed",{error:e});const t=e instanceof Error?e.message:String(e);qn("could not read the feed",`${t} — this napplet reads its feed through the host's outbox. Reload to try again.`)}
</script>
    <style>:root{--bg: #0a0a0d;--panel: #16161c;--border: rgba(255, 255, 255, .075);--text: #e8e8ee;--muted: #86869a;--accent: #a970ff;--hue: 270;--font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;--mono: ui-monospace, SFMono-Regular, Menlo, monospace;color-scheme:dark}*{box-sizing:border-box}html,body{height:100%}body{margin:0;overflow:hidden;background:radial-gradient(130% 110% at 50% -10%,#17171f,#0d0d12 52%,#08080a);color:var(--text);font:15px/1.5 var(--font);-webkit-font-smoothing:antialiased}:focus-visible{outline:2px solid hsl(var(--hue) 90% 66% / .85);outline-offset:2px}#app.space{position:fixed;inset:0;overflow:hidden}.space-scroll{position:absolute;inset:0;overflow:hidden}.space-scroll.scrolls{overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.14) transparent}.space-canvas{position:absolute;top:0;left:0;display:block;touch-action:none;cursor:default}.hud{position:absolute;top:0;left:0;right:0;padding:22px 26px;pointer-events:none}.hud-account{display:inline-block;max-width:min(46vw,420px);margin-top:3px;overflow:hidden;color:var(--muted);font:11px/1.6 var(--mono);text-decoration:none;text-overflow:ellipsis;white-space:nowrap;pointer-events:auto}.hud-account:hover{color:var(--accent)}.hud-stats{margin:6px 0 0;color:var(--muted);font-size:11px;letter-spacing:.01em}.hud-burger{position:absolute;top:20px;right:24px;width:34px;height:34px;padding:0;border:1px solid rgba(255,255,255,.12);border-radius:50%;background:#0c0c118c;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);color:var(--muted);cursor:pointer;pointer-events:auto;transition:color .15s ease,border-color .15s ease,background .15s ease}.hud-burger:before{content:"";position:absolute;top:50%;left:50%;width:15px;height:1.5px;margin:-.75px 0 0 -7.5px;border-radius:2px;background:currentColor;box-shadow:0 -5px 0 currentColor,0 5px 0 currentColor}.hud-burger:hover{border-color:#ffffff47;background:#ffffff14;color:var(--text)}.hud-burger[aria-expanded=true]{border-color:#a970ff8c;background:#a970ff24;color:var(--text)}.hud-menu{position:absolute;top:64px;right:24px;z-index:4;display:flex;flex-direction:column;align-items:flex-start;gap:13px;max-width:min(86vw,340px);padding:16px 18px;border:1px solid rgba(255,255,255,.085);border-radius:14px;background:#0f0f15e6;-webkit-backdrop-filter:blur(22px) saturate(1.35);backdrop-filter:blur(22px) saturate(1.35);box-shadow:0 26px 55px -22px #000000e6,0 2px 10px #00000059;pointer-events:auto}.hud-menu[hidden]{display:none}.hud-menu .hud-account{display:block;max-width:100%;margin-top:0}.hud-menu .hud-prompt-row,.hud-menu .hud-seen-row{flex-wrap:wrap;gap:8px 10px;margin:0;max-width:100%}.hud-menu .hud-stats{margin:0;max-width:100%;line-height:1.6}.hud-menu .hud-status,.hud-menu .hud-seen-count{max-width:100%}.hud-menu-rule{width:100%;height:1px;background:#ffffff13}.hud-prompt-row{display:flex;align-items:baseline;gap:8px;margin:10px 0 0;pointer-events:auto}.hud-prompt-label{flex:none;color:var(--muted);font-size:10px;letter-spacing:.08em;text-transform:uppercase}.hud-prompt-text{flex:1;min-width:0;overflow:hidden;color:var(--text);font-size:11px;text-overflow:ellipsis;white-space:nowrap}.hud-status{flex:none;max-width:min(38vw,340px);overflow:hidden;color:var(--muted);font-size:11px;text-overflow:ellipsis;white-space:nowrap}.hud-seen-row{display:flex;align-items:center;gap:10px;margin:8px 0 0;pointer-events:auto}.hud-toggle,.hud-seen{display:inline-flex;align-items:center;gap:7px;padding:4px 11px;border:1px solid var(--border);border-radius:999px;background:#0c0c1199;color:var(--text);font:11px var(--font);letter-spacing:.01em;cursor:pointer;transition:border-color .2s ease,color .2s ease}.hud-toggle:before,.hud-seen:before{content:"";width:7px;height:7px;border:1px solid var(--muted);border-radius:50%;transition:background .2s ease,border-color .2s ease,box-shadow .2s ease}.hud-toggle:hover,.hud-seen:hover{border-color:#a970ff80;color:#fff}.hud-toggle[aria-pressed=true],.hud-seen[aria-pressed=true]{border-color:#a970ff8c;color:#fff}.hud-toggle[aria-pressed=true]:before,.hud-seen[aria-pressed=true]:before{border-color:var(--accent);background:var(--accent);box-shadow:0 0 9px #a970ffd9}.hud-seen-count{max-width:min(30vw,260px);overflow:hidden;color:var(--muted);font-size:11px;letter-spacing:.01em;text-overflow:ellipsis;white-space:nowrap}.hud-seen-reset{padding:0;border:0;border-bottom:1px dotted rgba(134,134,154,.6);background:none;color:var(--muted);font:11px var(--font);cursor:pointer}.hud-profiles-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px 10px;margin:0;max-width:100%;pointer-events:auto}.hud-profiles{display:inline-flex;align-items:center;gap:7px;padding:4px 11px;border:1px solid var(--border);border-radius:999px;background:#0c0c1199;color:var(--text);font:11px var(--font);letter-spacing:.01em;cursor:pointer;transition:border-color .2s ease,color .2s ease}.hud-profiles:before{content:"";width:7px;height:7px;border:1px solid var(--muted);border-radius:50%}.hud-profiles:hover:not(:disabled){border-color:#a970ff80;color:#fff}.hud-profiles:disabled{color:var(--muted);cursor:default}.hud-profiles:disabled:before{border-color:#a970ff8c;background:#a970ff8c;box-shadow:0 0 9px #a970ff8c}.hud-profiles-status{color:var(--muted);font-size:11px;letter-spacing:.01em}.hud-seen-reset[hidden]{display:none}.hud-seen-reset:hover{color:var(--text)}.hint{position:absolute;bottom:22px;left:50%;transform:translate(-50%);margin:0;padding:7px 15px;border:1px solid var(--border);border-radius:999px;background:#0c0c118c;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);color:var(--muted);font-size:12px;white-space:nowrap;pointer-events:none;transition:opacity .6s ease,transform .6s ease}.hint.spent{opacity:0;transform:translate(-50%) translateY(8px)}.panel{position:absolute;left:0;top:0;display:flex;flex-direction:column;width:min(430px,92vw);max-height:min(560px,80vh);overflow:hidden;border:1px solid rgba(255,255,255,.085);border-radius:18px;background:#0f0f15db;-webkit-backdrop-filter:blur(22px) saturate(1.35);backdrop-filter:blur(22px) saturate(1.35);box-shadow:0 30px 60px -24px #000000e6,0 2px 10px #00000059;opacity:0;visibility:hidden;transform:scale(.97);transition:opacity .16s ease,transform .18s cubic-bezier(.22,.8,.24,1),visibility 0s linear .18s}.panel[data-side=right]{transform:translate(-8px) scale(.98)}.panel[data-side=left]{transform:translate(8px) scale(.98)}.panel[data-side=below]{transform:translateY(-8px) scale(.98)}.panel[data-side=above]{transform:translateY(8px) scale(.98)}.panel.open{opacity:1;visibility:visible;transform:none;transition:opacity .16s ease,transform .18s cubic-bezier(.22,.8,.24,1),visibility 0s}.panel-dwell{position:absolute;top:0;left:0;right:0;height:2px;border-radius:18px 18px 0 0;background:#a970ffcc;transform:scaleX(0);transform-origin:left center;pointer-events:none}.panel-seen{grid-column:1 / -1;justify-self:start;padding:3px 9px;border:1px solid rgba(169,112,255,.45);border-radius:999px;background:#a970ff1f;color:#d6c4fff2;font:600 9px var(--font);letter-spacing:.14em;text-transform:uppercase;cursor:pointer;transition:background .15s ease,border-color .15s ease}.panel-seen[hidden]{display:none}.panel-seen:hover{border-color:#a970ffcc;background:#a970ff3d}.panel:before{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(130% 42% at 78% -12%,hsl(var(--hue) 90% 62% / .2),transparent 68%)}.panel-head{position:relative;flex:none;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px 12px;padding:20px 26px 16px;border-bottom:1px solid var(--border)}.panel-close{position:absolute;top:16px;right:16px;width:30px;height:30px;padding:0;border:1px solid rgba(255,255,255,.12);border-radius:50%;background:#ffffff0a;color:var(--muted);font:400 18px/1 var(--font);cursor:pointer;transition:color .15s ease,border-color .15s ease,background .15s ease}.panel-close:hover{border-color:#ffffff47;background:#ffffff17;color:var(--text)}.panel-expand{position:absolute;top:16px;right:52px;width:30px;height:30px;padding:0;border:1px solid rgba(255,255,255,.12);border-radius:50%;background:#ffffff0a;cursor:pointer;transition:border-color .15s ease,background .15s ease}.panel-expand:before{content:"";position:absolute;inset:8px 7px;border:1.5px solid var(--muted);border-radius:3px;transition:border-color .15s ease}.panel-expand:after{content:"";position:absolute;top:9.5px;bottom:9.5px;left:17.5px;width:1.5px;border-radius:1px;background:var(--muted);transition:left .2s cubic-bezier(.22,.8,.24,1),background .15s ease}.panel-expand:hover{border-color:#ffffff47;background:#ffffff17}.panel-expand:hover:before{border-color:var(--text)}.panel-expand:hover:after,.panel[data-expanded=true] .panel-expand:after{left:11.5px;background:var(--text)}.panel[data-expanded=true]{width:min(50vw,780px);height:calc(100vh - 24px);max-height:none}.panel[data-expanded=true] .panel-note-text,.panel[data-expanded=true] .panel-empty,.panel[data-expanded=true] .panel-reply-text{max-width:62ch}.panel[data-expanded=true] .panel-note-image{max-height:68vh}.panel-avatar{grid-column:1;display:grid;width:42px;height:42px;place-items:center;overflow:hidden;border:2px solid hsl(var(--hue) 90% 66% / .65);border-radius:50%;background:hsl(var(--hue) 30% 16%);box-shadow:0 0 26px hsl(var(--hue) 90% 60% / .28);color:hsl(var(--hue) 90% 80%);font-size:16px;font-weight:600}.panel-avatar img,.panel-reply-avatar img{display:block;width:100%;height:100%;object-fit:cover}.panel-name{grid-column:2;margin:0;padding-right:78px;font-size:16px;font-weight:600;letter-spacing:-.01em;overflow-wrap:anywhere}.panel-author{grid-column:1 / -1;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px 12px;width:100%;padding:0;border:0;border-radius:12px;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.panel-author:hover .panel-name,.panel-author:focus-visible .panel-name{color:hsl(var(--hue) 85% 82%)}.panel-author:focus-visible{outline:1px solid hsla(var(--hue),85%,70%,.6);outline-offset:4px}.panel-meta{grid-column:1 / -1;margin:0;padding-right:78px;color:var(--muted);font-size:10px;letter-spacing:.1em;text-transform:uppercase}.panel-notes{position:relative;flex:1;min-height:0;padding:2px 26px 30px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.14) transparent}.panel-notes::-webkit-scrollbar{width:10px}.panel-notes::-webkit-scrollbar-thumb{border:3px solid transparent;border-radius:999px;background:#ffffff29;background-clip:content-box}.panel-note{padding:18px 0;border-bottom:1px solid rgba(255,255,255,.055)}.panel-note:last-child{border-bottom:0}.panel-note-head{display:flex;align-items:center;gap:8px;margin-bottom:7px}.panel-note-reply{padding:1px 8px;border:1px solid rgba(255,255,255,.13);border-radius:999px;color:var(--muted);font-size:9px;letter-spacing:.09em;text-transform:uppercase}.panel-note-time{color:var(--muted);font:11px/1.5 var(--mono);text-decoration:none}.panel-note-time:hover{color:var(--text)}.panel-note-text{margin:0;font-size:14px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.panel-note-text.muted{color:var(--muted)}.panel-mention{padding:1px 6px;border:1px solid hsl(var(--hue) 80% 70% / .3);border-radius:999px;background:hsl(var(--hue) 60% 60% / .13);color:hsl(var(--hue) 90% 82%);font-size:13px;white-space:nowrap;text-decoration:none}.panel-mention:hover{border-color:hsl(var(--hue) 90% 72% / .6);background:hsl(var(--hue) 60% 60% / .22)}.panel-note-image{display:block;width:100%;max-height:58vh;margin-top:11px;border:1px solid rgba(255,255,255,.08);border-radius:12px;background:#00000059;object-fit:contain}.panel-reactions{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:14px}.panel-reaction{display:inline-flex;align-items:center;gap:5px;padding:3px 9px 3px 8px;border:1px solid rgba(255,255,255,.09);border-radius:999px;background:#ffffff09}.panel-reaction-glyph{font-size:13px;line-height:1.3}.panel-reaction-count{color:var(--muted);font:600 11px/1.3 var(--mono)}.panel-reaction-more{color:var(--muted);font-size:11px}.panel-note-link,.panel-note-more{display:inline-block;margin-top:8px;color:var(--muted);font:11px/1.6 var(--mono)}.panel-note-link:hover{color:var(--accent)}.panel-empty{margin:26px 0 0;color:var(--muted);font-size:13px}.panel-context{display:flex;flex-direction:column;gap:1px;margin:2px 0 14px;padding:2px 0 2px 9px;border-left:2px solid var(--border)}.panel-context-row{display:grid;grid-template-columns:auto auto minmax(0,1fr);gap:8px;align-items:baseline;width:100%;padding:5px 8px;border:1px solid transparent;border-radius:8px;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.panel-context-row:hover,.panel-context-row:focus-visible{border-color:hsla(var(--hue),80%,70%,.3);background:hsla(var(--hue),70%,60%,.06);outline:none}.panel-context-role{color:var(--accent);font-size:9.5px;letter-spacing:.09em;text-transform:uppercase;white-space:nowrap}.panel-context-name{max-width:14ch;overflow:hidden;color:#e8e8eea8;font-size:12px;white-space:nowrap;text-overflow:ellipsis}.panel-context-text{overflow:hidden;color:#e8e8ee70;font-size:12.5px;white-space:nowrap;text-overflow:ellipsis}.panel-context-gap{margin:3px 8px;color:var(--muted);font-size:10px;letter-spacing:.09em;text-transform:uppercase}.panel-replies{padding:14px 0 4px}.panel-replies-head,.panel-replies-more{margin:0 0 8px;color:var(--muted);font-size:10px;letter-spacing:.1em;text-transform:uppercase}.panel-replies-more{margin:10px 0 0}.panel-reply{display:flex;gap:9px;align-items:flex-start;width:100%;padding:7px 8px 7px calc(8px + var(--indent, 0px));border:1px solid transparent;border-radius:10px;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.panel-reply:hover,.panel-reply:focus-visible{border-color:hsla(var(--hue),80%,70%,.35);background:hsla(var(--hue),70%,60%,.07);outline:none}.panel-reply-avatar{flex:none;display:grid;width:22px;height:22px;margin-top:1px;place-items:center;overflow:hidden;border-radius:50%;background:hsl(var(--hue) 34% 18%);color:hsl(var(--hue) 92% 80%);font-size:11px;font-weight:600}.panel-reply-body{display:flex;min-width:0;flex-direction:column;gap:2px}.panel-reply-name{color:hsl(var(--hue) 80% 82%);font-size:12px;font-weight:600}.panel-reply-text{color:#e8e8f0b8;font-size:12px;line-height:1.45;overflow-wrap:anywhere}.profile-card{position:absolute;left:0;top:0;display:flex;flex-direction:column;width:min(340px,92vw);max-height:min(520px,80vh);overflow:hidden;border:1px solid rgba(255,255,255,.085);border-radius:18px;background:#0f0f15e6;-webkit-backdrop-filter:blur(22px) saturate(1.35);backdrop-filter:blur(22px) saturate(1.35);box-shadow:0 30px 60px -24px #000000e6,0 2px 10px #00000059;opacity:0;visibility:hidden;transform:scale(.97);transition:opacity .16s ease,transform .18s cubic-bezier(.22,.8,.24,1),visibility 0s linear .18s}.profile-card[data-side=right]{transform:translate(-8px) scale(.98)}.profile-card[data-side=left]{transform:translate(8px) scale(.98)}.profile-card[data-side=below]{transform:translateY(-8px) scale(.98)}.profile-card[data-side=above]{transform:translateY(8px) scale(.98)}.profile-card.open{opacity:1;visibility:visible;transform:none;transition:opacity .16s ease,transform .18s cubic-bezier(.22,.8,.24,1),visibility 0s}.profile-banner{position:absolute;top:0;left:0;right:0;height:86px;background-image:linear-gradient(hsl(var(--hue) 58% 30%),hsl(var(--hue) 42% 14%));background-size:cover;background-position:center}.profile-banner.has-image:after{content:"";position:absolute;inset:0;background:linear-gradient(to bottom,#0f0f1500 40%,#0f0f15eb)}.profile-close{position:absolute;top:12px;right:12px;z-index:2;width:28px;height:28px;padding:0;border:1px solid rgba(255,255,255,.16);border-radius:50%;background:#00000059;color:var(--text);font:400 17px/1 var(--font);cursor:pointer;transition:border-color .15s ease,background .15s ease}.profile-close:hover{border-color:#ffffff52;background:#0000008c}.profile-body{position:relative;display:flex;flex:1 1 auto;min-height:0;flex-direction:column;gap:7px;padding:56px 22px 22px;overflow-y:auto;overscroll-behavior:contain}.profile-avatar{display:grid;width:64px;height:64px;place-items:center;overflow:hidden;border:2px solid hsl(var(--hue) 90% 66% / .75);border-radius:50%;background:hsl(var(--hue) 30% 16%);box-shadow:0 0 34px hsl(var(--hue) 90% 60% / .3);color:hsl(var(--hue) 92% 82%);font-size:24px;font-weight:600}.profile-avatar img{display:block;width:100%;height:100%;object-fit:cover}.profile-name{margin:3px 0 0;font-size:20px;font-weight:650;letter-spacing:-.01em;overflow-wrap:anywhere}.profile-handle{margin:0;color:hsl(var(--hue) 70% 78%);font:11px/1.5 var(--mono);overflow-wrap:anywhere}.profile-handle[hidden],.profile-about[hidden]{display:none}.profile-about{margin:4px 0 0;color:#e8e8f0d1;font-size:13px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.profile-links{display:flex;flex-direction:column;gap:6px;margin-top:8px}.profile-link{display:inline-block;max-width:100%;padding:5px 10px;border:1px solid hsla(var(--hue),70%,70%,.24);border-radius:9px;background:hsla(var(--hue),60%,60%,.08);color:hsl(var(--hue) 88% 82%);font:11px/1.4 var(--mono);text-decoration:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;transition:border-color .15s ease,background .15s ease}.profile-link:hover{border-color:hsla(var(--hue),85%,72%,.55);background:hsla(var(--hue),60%,60%,.16)}.profile-missing{margin:6px 0 0;color:var(--muted);font-size:11px;letter-spacing:.04em}.boot,.error{position:absolute;inset:0;display:grid;place-content:center;gap:6px;padding:24px;text-align:center;color:var(--muted);font-size:14px}.boot{letter-spacing:.04em}.boot-status{min-height:1.5em;font:12px/1.6 var(--mono);font-variant-numeric:tabular-nums}.error p{margin:0}.error p:first-child{color:var(--text)}.error-detail{font:12px/1.6 var(--mono);overflow-wrap:anywhere}.error code{color:var(--accent);font-family:var(--mono)}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;border:0;clip-path:inset(50%);white-space:nowrap}@media(prefers-reduced-motion:reduce){.panel,.profile-card,.hint,.panel-close,.panel-expand,.panel-expand:before,.panel-expand:after{transition:none}.hud-burger{transition:none}}@media(max-width:659px){.panel-expand{display:none}.hud-burger{top:14px;right:16px}.hud-menu{top:56px;right:16px}.space-canvas{touch-action:pan-y}.panel-name,.panel-meta{padding-right:40px}}@media(max-width:560px){.hud{padding:16px 18px}.hud-account{max-width:60vw}.hint{max-width:92vw;overflow:hidden;text-overflow:ellipsis}.panel-head{padding:20px 20px 16px}.panel-notes{padding:0 20px 40px}}
</style>
  </head>
  <body>
    <main id="app" class="space">
      <p class="boot">loading the room…</p>
    </main>
  </body>
</html>