pipeup 0.4.0-beta.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/pipeup.core.js +1 -1
- package/dist/pipeup.esm.js +1 -1
- package/dist/pipeup.min.js +1 -1
- package/dist/types/core.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Comments and feedback right on any HTML page: documents, slide decks and whole sites.
|
|
4
4
|
|
|
5
|
-
> **Alpha (0.4.0
|
|
5
|
+
> **Alpha (0.4.0).** The API and the stored comment format may change before 1.0; pin an exact version.
|
|
6
6
|
> Website and Try pages: https://pipeup-ai.github.io/pipeup/ · Source: https://github.com/pipeup-ai/pipeup
|
|
7
7
|
|
|
8
8
|
Pipeup: signed comment operations, threads with one-level replies, anchors that survive page changes,
|
|
@@ -21,7 +21,7 @@ As a classic script (also works from `file://`), it mounts itself on pages that
|
|
|
21
21
|
```html
|
|
22
22
|
<html data-pipeup-doc="<id>:<key>">
|
|
23
23
|
...
|
|
24
|
-
<script src="https://cdn.jsdelivr.net/npm/pipeup@0.4.0
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/pipeup@0.4.0/dist/pipeup.min.js" integrity="sha384-…" crossorigin="anonymous" defer></script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Each release's notes on GitHub give the `integrity` value
|
package/dist/pipeup.core.js
CHANGED
|
@@ -6,4 +6,4 @@ function f(t){let e="";for(let n of t)e+=String.fromCharCode(n);return btoa(e).r
|
|
|
6
6
|
`}function Se(t){let{thread:e,location:n}=t,r=[u(n.where)+(n.quote?`, on the text "${u(n.quote)}"`:""),`${u(E(e.root))}: ${R(e.root," ")}`];for(let o of e.root.replies)r.push(` ${u(E(o))}: ${R(o," ")}`);return r.join(`
|
|
7
7
|
`)+`
|
|
8
8
|
`}function R(t,e){return t.deleted?"(deleted)":t.text.replace(/\r\n|\r|\n/g,`
|
|
9
|
-
`+e)+(t.edited?" (edited)":"")}var rr="0.4.0
|
|
9
|
+
`+e)+(t.edited?" (edited)":"")}var rr="0.4.0";export{N as ANIMALS,G as COLOURS,ue as DEFAULT_PROFILE_NAME,j as IndexedDbStore,q as MemoryStore,U as PipeupDocument,v as UnsavedChangeError,rr as VERSION,ve as animalName,mt as copyAll,ft as copyThread,F as createIdentity,ze as describeElement,He as describeRange,$ as formatAgo,Ee as labelOf,Be as loadOrCreateProfile,at as locate,E as nameOf,Re as newDocumentAttribute,Fe as parseDocumentAttribute,Ye as resolveAnchor};
|
package/dist/pipeup.esm.js
CHANGED
|
@@ -6,4 +6,4 @@ function ge(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).
|
|
|
6
6
|
`}function no(e){let{thread:t,location:o}=e,n=[ie(o.where)+(o.quote?`, on the text "${ie(o.quote)}"`:""),`${ie(ue(t.root))}: ${Mt(t.root," ")}`];for(let r of t.root.replies)n.push(` ${ie(ue(r))}: ${Mt(r," ")}`);return n.join(`
|
|
7
7
|
`)+`
|
|
8
8
|
`}function Mt(e,t){return e.deleted?"(deleted)":e.text.replace(/\r\n|\r|\n/g,`
|
|
9
|
-
`+t)+(e.edited?" (edited)":"")}var ji="0.4.0-beta.3";function g(e,t={},...o){let n=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?n.className=String(i):n.setAttribute(r,i===!0?"":i));for(let r of o)r!=null&&r!==!1&&n.append(r);return n}function ne(e,t){let o=e.getRootNode().activeElement;t&&o instanceof HTMLElement&&e.contains(o)&&o.blur(),e.inert=t}function Ct(e,t,o=null){let n=e.getRootNode().activeElement,r=!1;for(let i=t.length;i--;o=t[i])t[i].nextSibling!==o&&(r=!!e.insertBefore(t[i],o));return r&&n&&t.some(i=>i.contains(n))&&n.focus({preventScroll:!0}),r}function ve(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function Ve(e,t,o=4){e.style.left=`${t.left-o}px`,e.style.top=`${t.top-o}px`,e.style.width=`${t.width+o*2}px`,e.style.height=`${t.height+o*2}px`}var mr=/\bhttps?:\/\/[^\s<>"'`]+/gi,hr=`.,;:!?'"]}`,gr=2048,vr=/[\u202A-\u202E\u2066-\u2069]/;function wr(e){let t=0,o=0;for(let r of e)r==="("?t++:r===")"&&o++;let n=e.length;for(;n>0;){let r=e[n-1];if(r===")"&&o>t)o--;else if(!hr.includes(r))break;n--}return e.slice(0,n)}function Pt(e){let t=[],o=0;for(let n of e.matchAll(mr)){if(n[0].length>gr||vr.test(n[0]))continue;let r=wr(n[0]),i=n.index??0,c;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;c=p.href}catch{continue}i>o&&t.push(e.slice(o,i));let l=g("a",{href:c,target:"_blank",rel:"noopener noreferrer"},r);l.addEventListener("click",p=>p.stopPropagation()),t.push(l),o=i+r.length}return o<e.length&&t.push(e.slice(o)),t}var Oe={code:"KeyC",mods:{shift:!0,alt:!0,meta:!1,ctrl:!1},mac:{label:"\u21E7\u2325C",aria:"Shift+Alt+C"},other:{label:"Shift+Alt+C",aria:"Shift+Alt+C"}},oo=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),je=(oo?Oe.mac:Oe.other).label,fn=(oo?Oe.mac:Oe.other).aria;function ro(e){return e.code===Oe.code&&e.shiftKey===Oe.mods.shift&&e.altKey===Oe.mods.alt&&e.metaKey===Oe.mods.meta&&e.ctrlKey===Oe.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var io="http://www.w3.org/2000/svg",yr={comment:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z","M12.3 8.2v6.6M9 11.5h6.6"],send:["M21 12L3.5 4.5 6.2 12l-2.7 7.5zM6.2 12H13"],copy:["M10 8h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2z","M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"],resolve:["M5 12.5l4.5 4.5L19 7.5"],reopen:["M3 12a9 9 0 1 0 3-6.7","M3 4v5h5"],lines:["M4 7h16M4 12h10M4 17h7"],list:["M3 6.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 12a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 17.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M9 6.5h11M9 12h11M9 17.5h7"],expand:["M14 4h6v6M20 4l-6 6M10 20H4v-6M4 20l6-6M20 14v6h-6M20 20l-6-6M4 10V4h6M4 4l6 6"],pin:["M6 18v-6a6 6 0 1 1 6 6z"],shrink:["M20 10h-6V4M14 10l6-6M4 14h6v6M10 14l-6 6M14 20v-6h6M14 14l6 6M10 4v6H4M10 10L4 4"],bubble:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z"],close:["M6 6l12 12M18 6L6 18"],edit:["M4 20h4L19 9l-4-4L4 16z"]};function oe(e,t=15,o){let n=mn(yr[e],t);return o&&n.setAttribute("stroke-width",String(o)),n}function mn(e,t){let o=document.createElementNS(io,"svg"),n={width:String(t),height:String(t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};for(let[r,i]of Object.entries(n))o.setAttribute(r,i);for(let r of e){let i=document.createElementNS(io,"path");i.setAttribute("d",r),o.append(i)}return o}var Ot=(e,t,o)=>`M${e} ${t}a${o} ${o} 0 1 0 ${2*o} 0a${o} ${o} 0 1 0 -${2*o} 0`,br={Otter:"M4 13.2C4 9.2 7.6 6.5 12 6.5s8 2.7 8 6.7-3.6 6.3-8 6.3-8-2.3-8-6.3zM5.6 9.6a1.8 1.8 0 1 1 2.7-2.3M18.4 9.6a1.8 1.8 0 1 0-2.7-2.3M9.2 11.6h.01M14.8 11.6h.01M11 14h2l-1 1zM9.8 15.8l-3.2.4M9.9 17l-2.7 1.1M14.2 15.8l3.2.4M14.1 17l2.7 1.1",Fox:"M3.5 4l5 3.5h7l5-3.5-1.5 8.5L12 20l-7-7.5zM9 12h.01M15 12h.01M12 17h.01",Owl:`M5 4.5l3 2.5h8l3-2.5V14a7 7 0 0 1-14 0z${Ot(7.4,11.5,1.9)}${Ot(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${Ot(5,13.5,7)}M8.9 7.22A2.8 2.8 0 1 0 5.89 10.09M18.11 10.09A2.8 2.8 0 1 0 15.1 7.22M9.4 12.6h.01M14.6 12.6h.01M10.3 16.4c0-1 .8-1.6 1.7-1.6s1.7.6 1.7 1.6-.8 1.6-1.7 1.6-1.7-.6-1.7-1.6z`,Rabbit:`${Ot(6.5,15.5,5.5)}M9.6 10.5C8.2 6.5 8.4 2.5 9.8 2.5s2.4 3.5 1.6 7.5M14.4 10.5c1.4-4 1.2-8-.2-8s-2.4 3.5-1.6 7.5M10 15h.01M14 15h.01M11.3 17.3l.7.5.7-.5`};function so(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let o=t[0].toUpperCase();return[...o].length===1?o:t[0]}var dt=(e,t)=>so(t)||Pe(e);function Ye(e,t){return g("span",{class:`av c${dn(e)}`,"aria-hidden":"true","data-animal":Pe(e)},so(t)||mn([br[et[cn(e)]]],24))}var xr=320;function Rt(e,t){setTimeout(()=>{e.remove(),t?.()},xr)}function It(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function $t(e){let t=g("textarea",{class:"input",rows:"1","aria-label":e.label}),o=g("button",{class:"send",type:"button","aria-label":"Send",title:"Send",inert:!0},oe("send")),n=g("div",{class:"row"},e.before,t,o),r=!1,i=()=>{let l=t.value.trim()!=="";o.classList.toggle("show",l),o.inert=!l,t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},c=async()=>{let l=t.value.trim();if(!(!l||r)){r=!0;try{await e.$(l),o.matches(":focus")&&t.focus(),t.value="",i()}catch{}finally{r=!1}}};return n.addEventListener("mousedown",l=>{l.target===t||o.contains(l.target)||(l.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",l=>{l.stopPropagation(),l.key==="Enter"&&!l.shiftKey&&!l.isComposing?(l.preventDefault(),c()):l.key==="Escape"&&(l.preventDefault(),t.value="",i(),t.blur(),e.N?.())}),o.addEventListener("click",l=>{l.stopPropagation(),c()}),{element:n,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Er(e){let t=g("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",y=>y.preventDefault());let o=$t({label:"Comment",before:t,$:e.$,N:e.N}),n=g("div",{class:"say"}),r=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=g("div",{class:"nf"},r),c=g("div",{class:"you"},n,i),l="",p=!1,d=()=>{let y=e.name(),E=y?"change":"add your name";if(t.title=y?"Change your name":"Add your name",!t.lastChild||l!==y){let T=Ye(e.me,y),x=t.lastChild;x?(It(T),Rt(x)):T.classList.add("in"),t.append(T),l=y}let L=g("button",{type:"button"},E);L.addEventListener("click",M),n.replaceChildren(g("span",{class:"nm"},y||`You're ${Pe(e.me)}`)," \xB7 ",L)},m=y=>{c.classList.toggle("naming",y),ne(n,y),ne(i,!y)};function M(y){y.stopPropagation(),r.value=e.name(),m(!0),r.focus({preventScroll:!0}),r.select()}let C=()=>{m(!1),o.focus()};t.addEventListener("click",M),r.addEventListener("keydown",y=>{if(y.stopPropagation(),y.key==="Escape")y.preventDefault(),C();else if(y.key==="Enter"){y.preventDefault();let E=r.value.trim();if(!E||E===e.name())return C();if(p)return;p=!0,e.rename(E).finally(()=>{p=!1,d(),C()})}}),d(),m(!1);let u=g("div",{class:"ctx"},e.label);return{element:g("div",{class:"draft"},u,o.element,c),G:()=>{let{selectionStart:y,selectionEnd:E}=o.input;return()=>{o.focus(),o.input.setSelectionRange(y,E)}},H:y=>{u.hidden=y},V:y=>{u.textContent=y},focus:()=>o.focus(),se:()=>o.input.value.trim()===""}}function Nt(e,t){let o=Er({label:t.label,me:e.doc.me,name:()=>e.c.name(),rename:n=>e.c.rename(n),$:n=>e.ae(n),N:()=>e.le()});return e.R(o),o}function Ht(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let o=t.element.getBoundingClientRect();if(!o.width&&!o.height)return null;if(e.point)return{x:o.left+e.point.x*o.width,y:o.top+e.point.y*o.height};let n=t.element.ownerDocument.createRange();n.selectNodeContents(t.element);let r=n.getBoundingClientRect();return{x:r.width?Math.min(o.right-8,r.right+6):o.right-8,y:(r.height?r.top:o.top)+8}}function ut(e){return e.range?[...e.range.getClientRects()]:[]}function hn(e,t){let o=ut(t)[0];if(o)return o.top;if(t.state==="orphaned"||!t.element)return null;let n=t.element.getBoundingClientRect();return e.point?n.top+e.point.y*n.height:n.top}function pt(e,t){let o=ut(t).at(-1);if(o)return{x:o.left,y:o.bottom,below:!0};let n=Ht(e,t);return n?{...n,below:!1}:null}function ao(e,t,o){for(let n of o)if(e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom)return!0;return!1}function lo(e,t,o=10){let n=[...e].sort((l,p)=>l.m-p.m),r=new Array(n.length).fill(0),i=n.findIndex(l=>l.id===t),c=l=>n[l];if(i<0)n.forEach((l,p)=>{r[p]=p===0?l.m:Math.max(l.m,(r[p-1]??0)+c(p-1).height+o)});else{r[i]=c(i).m;for(let l=i+1;l<n.length;l++)r[l]=Math.max(c(l).m,(r[l-1]??0)+c(l-1).height+o);for(let l=i-1;l>=0;l--)r[l]=Math.min(c(l).m,(r[l+1]??0)-c(l).height-o)}return new Map(n.map((l,p)=>[l.id,r[p]??0]))}var ft=320,Ge=300,kr=480,Xe=()=>window.innerWidth<=kr;function Bt(e){let t=window.innerWidth;return{width:e&&!Xe()?t-ft:t,height:window.innerHeight}}function Dt(e,t,o,n=12){let r,i;return e.below?(r=Math.min(e.x,o.width-t.width-n),i=e.y+8,i+t.height>o.height-n&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>o.width-n&&(r=e.x-t.width-28),i=Math.min(e.y-12,o.height-t.height-n)),{left:Math.max(n,r),top:Math.max(n,i)}}function co(e,t,o,n=12,r=44){let i=e.top-r>=8,c=e.top+e.height+8+(i?0:r),l=e.top-8-(i?r:0)-t.height,p=c+t.height<=o.height-n||l<n,d=p?c:l;return{above:!p,left:Math.max(n,Math.min(e.left,o.width-t.width-n)),top:Math.max(n,d)}}function Ft(e,t,o){let n=e.top-t.height-10;return n<8&&(n=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,o.width-t.width-8)),top:n}}function Vt(e,t){let o=e.resolved.get(t.id);return o?.range?.startContainer??o?.element??null}var qe=e=>(t,o)=>{let n=Vt(e,t),r=Vt(e,o),i=c=>c.anchor.point??{x:0,y:-1};return n!==r?!r||n&&n.compareDocumentPosition(r)&4?-1:1:i(t).y-i(o).y||i(t).x-i(o).x};var qt=e=>`${e} ${e===1?"reply":"replies"}`;function nt(e,t,o){let n={...o},r=e.id,i=g("div",{class:"rbox always"},g("div",{},$t({label:"Reply",$:E=>t.reply(r,E),N:t.close}).element)),c=g("div",{}),l=g("div",{}),p=null,d=g("div",{},l,g("div",{class:"more"},c)),m=new Map,M=new Map,C=new Map,u=E=>{let L=dt(E.author,E.name),T=m.get(E.id),x=T?.e;if((!x||T.key!==L)&&(x=It(Ye(E.author,E.name)),T)){let k=T.e;C.set(E.id,k),Rt(k,()=>C.get(E.id)===k&&C.delete(E.id))}x.title=ue(E),M.set(E.id,{key:L,e:x});let O=C.get(E.id);return O?[O,x]:[x]},h=(E,L,T)=>{let x=g("button",{class:"ib",type:"button","aria-label":L,title:L},oe(E));return x.addEventListener("click",O=>{O.stopPropagation(),T()}),x};function y(E,L={}){Object.assign(n,L),r=E.id;let T=(n.now??Date.now)(),x=E.root.replies.length,O=j=>g("span",{class:"who"},`${ue(j)} \xB7 ${tt(j.at,T)}`),k=j=>g("div",{class:j.deleted?"tx del":"tx"},...j.deleted?["Deleted"]:[...Pt(j.text),j.edited?" (edited)":""]),z=E.resolved?"Resolved"+(x?` \xB7 ${qt(x)}`:""):x?qt(x):"",G=g("div",{class:n.B==="column"&&z?"ft has-rest":"ft"},n.B==="column"&&z?g("span",{class:"rest"},z):null,g("span",{class:"hover"},O(E.root),g("span",{class:"acts"},h("copy","Copy thread",()=>t.copy(E.id)),E.resolved?h("reopen","Reopen",()=>void t.reopen(E.id)):h("resolve","Resolve",()=>void t.resolve(E.id))))),q=n.lost?g("div",{class:"ctx"},`${n.place||"No longer on the page"} \u2014 it read \u201C${ve(n.lost,120)}\u201D`):n.quote?g("div",{class:"ctx"},`\u201C${ve(n.quote,80)}\u201D`):null;M=new Map;let X=g("div",{class:"root"},...u(E.root),q,k(E.root),G);l.replaceWith(X),l=X,p?.remove(),p=x?g("div",{class:"rps"},...E.root.replies.map(j=>g("div",{class:"it"},...u(j),k(j),g("div",{class:"rft"},O(j))))):null,p&&c.prepend(p),m=M,E.resolved?i.remove():i.parentNode!==c&&c.append(i),d.className=E.resolved?"thread resolved":"thread",d.setAttribute("data-thread",E.id)}return y(e),{element:d,update:y}}var Sr="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",Tr=400;function gn(e,t){let o=new Map,n=g("div",{class:"tip",role:"tooltip"}),r=g("div",{class:"mark"}),i=g("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});n.inert=i.inert=!0,e.n.append(r,n,i);let c=g("div",{class:"bub pin ghost","aria-hidden":"true"}),l=[],p=null,d=null,m=null,M=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,C=0,u=null,h=null,y=null,E=0,L=w=>l.find(P=>P.id===w)??null,T=()=>t.q||e.state.l,x=!1,O=w=>{let P=e.resolved.get(w.id);return P?pt(w.anchor,P):null};function k(w,P,N){let{left:K,top:Y}=Dt(P,{width:w.offsetWidth||N,height:w.offsetHeight},Bt(e.state.l));w.style.left=`${K}px`,w.style.top=`${Y}px`}function z(w){let P=w&&T()&&e.state.o!==w?L(w):null,N=P?O(P):null;if(!P||!N){y=null,n.classList.remove("show"),ne(n,!0);return}if(y!==P.id){let K=P.root.replies.length;n.replaceChildren(g("div",{class:"tx clamp"},...P.root.deleted?["Deleted"]:Pt(P.root.text)),g("div",{class:"who"},`${ue(P.root)}${K?` \xB7 ${K} ${K===1?"reply":"replies"}`:""}`)),y=P.id}k(n,N,260),n.classList.contains("show")||n.offsetWidth,n.classList.add("show"),n.inert=!1}function G(w){u=w,z(w),e.w(w)}function q(w){if(window.clearTimeout(E),w!==null){G(w);return}E=window.setTimeout(()=>G(null),T()?Tr:0)}n.addEventListener("mouseenter",()=>window.clearTimeout(E)),n.addEventListener("mouseleave",()=>q(null)),n.addEventListener("click",w=>{w.stopPropagation();let P=y;P&&(window.clearTimeout(E),G(null),e.open(P))});function X(w){let P=o.get(w.id);if(P)return P;let N=g("button",{class:"bub",type:"button","data-thread":w.id});return N.addEventListener("mouseenter",()=>q(w.id)),N.addEventListener("mouseleave",()=>q(null)),N.addEventListener("click",K=>{K.stopPropagation(),z(null),e.open(w.id)}),e.n.insertBefore(N,r),o.set(w.id,N),N}let j=!1;function H(){let w=e.state.t,P=m&&w&&!w.anchor.quote&&!w.anchor.point?w.resolved.element:null;if(P){let{left:K,top:Y,above:D}=co(P.getBoundingClientRect(),{width:i.offsetWidth||Ge,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),U=m?.above!==null&&m?.above!==D;if(m&&(m.above=D),U&&be())return;i.style.left=`${K}px`,i.style.top=`${Y}px`;return}let N=m&&w?pt(w.anchor,w.resolved):p?O(p):null;N&&k(i,N,Ge)}let te=w=>e.state.s&&!w.anchor.quote&&!w.anchor.point;function be(){return window.clearTimeout(C),M?(i.classList.remove("show"),C=window.setTimeout(()=>{H(),i.classList.add("show")},220),!0):(i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function se(w){if(window.clearTimeout(C),M){i.classList.remove("show"),C=window.setTimeout(()=>{m?.i.V(w),H(),i.classList.add("show")},220);return}m?.i.V(w),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)}function ae(){if(!T())return null;let w=e.state.t;return w?w.anchor.quote||w.anchor.point||e.state.s?null:w.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function le(w){l=w;let P=new Set;for(let D of w){if(!e.I(D)||D.anchor.quote)continue;let U=e.resolved.get(D.id);if(!U||U.state==="orphaned")continue;P.add(D.id);let Q=X(D);Q.classList.toggle("done",D.resolved),Q.classList.toggle("on",e.state.o===D.id),Q.classList.toggle("pin",D.anchor.point!==void 0);let fe=`Comment on ${Fe(U.element)}: ${ve(D.root.text,60)}`;Q.getAttribute("aria-label")!==fe&&Q.setAttribute("aria-label",fe)}Ct(e.n,w.filter(D=>P.has(D.id)).sort(qe(e)).map(D=>o.get(D.id)),r);for(let[D,U]of o)P.has(D)||(U.classList.remove("in"),o.delete(D),window.setTimeout(()=>U.remove(),300));z(u),x!==e.state.l&&i.classList.contains("show")&&!M&&(window.clearTimeout(C),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)),x=e.state.l;let N=t.q?e.state.t:null;if(N){let D=N.anchor.point??N.resolved.element;m?.of!==N?(window.clearTimeout(C),i.classList.remove("glide"),m={i:Nt(e,N),of:N,at:D,above:null},m.i.H(te(N)),i.replaceChildren(m.i.element),i.inert=!1,m.i.focus(),p=null,d=null,H(),i.classList.add("show")):m&&(m.at!==D&&(m.at=D,m.above=null,se(N.label)),m.i.H(te(N)));let U=!e.d.u(N.anchor.view);U!==j&&(j=U,i.classList.toggle("show",!U),i.inert=U,U||H());return}m&&(window.clearTimeout(C),i.classList.remove("glide"),m=null,j=!1,e.R(null));let K=T()&&e.state.o?L(e.state.o):null;if(!K||!e.I(K)){p=null,d=null,i.classList.remove("show"),ne(i,!0);return}let Y=K.anchor.quote?.exact??null;!p||!d||p.id!==K.id?(d=nt(K,e.D,{B:"popover",quote:Y}),i.replaceChildren(d.element),p=K,H(),i.classList.add("show"),i.inert=!1):p!==K&&(d.update(K,{quote:Y}),p=K)}function xe(){for(let[K,Y]of o){let D=L(K),U=e.resolved.get(K),Q=D&&U?Ht(D.anchor,U):null;if(!Q||Q.y<-40||Q.y>window.innerHeight+40){Y.style.visibility="hidden";continue}Y.style.visibility="",Y.style.left=`${Q.x}px`,Y.style.top=`${Q.y}px`,Y.classList.contains("in")||(Y.offsetWidth,Y.classList.add("in"))}let w=e.state.t,P=w?.anchor.point&&e.d.u(w.anchor.view)?Ht(w.anchor,w.resolved):null;P?(c.style.left=`${P.x}px`,c.style.top=`${P.y}px`,c.classList.contains("in")||(e.n.insertBefore(c,r),c.offsetWidth,c.classList.add("in"))):c.classList.contains("in")&&(c.classList.remove("in"),window.setTimeout(()=>c.classList.contains("in")||c.remove(),300)),i.classList.contains("show")&&H();let N=ae();r.classList.toggle("show",N!==null),N&&Ve(r,N.getBoundingClientRect(),4)}let Ee=w=>{if(e.f(w)){let N=w.composedPath()[0];h!==null&&!(N instanceof Element&&N.closest(".tip,.bub"))&&q(null),h=null;return}let P=e._(w.clientX,w.clientY)?.id??null;P!==h&&(h=P,q(P))},pe=w=>{if(e.f(w))return;let P=window.getSelection();if(P&&!P.isCollapsed||(e.state.s?w.altKey:w.target instanceof Element&&w.target.closest(Sr)))return;let N=e._(w.clientX,w.clientY);N&&(e.X(w),z(null),e.open(N.id))};return window.addEventListener("pointermove",Ee,{capture:!0,passive:!0}),window.addEventListener("click",pe,!0),{p:le,M:xe,destroy(){window.clearTimeout(E),window.clearTimeout(C),window.removeEventListener("pointermove",Ee,!0),window.removeEventListener("click",pe,!0),e.R(null);for(let w of o.values())w.remove();c.remove(),n.remove(),r.remove(),i.remove()}}}var Lr="button link img figure region list listitem tab tabpanel article navigation complementary banner contentinfo form search group dialog menu menuitem checkbox switch radio slider textbox combobox option row cell heading table".split(" ").map(e=>`[role=${e}]`),Ar=["button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,figcaption,table,th,td","li,ul,ol,dl,dt,dd,p,h1,h2,h3,h4,h5,h6,blockquote,pre","section,article,aside,nav,header,footer,main,form,fieldset",...Lr].join(","),Mr="a,button,label,summary,[role=button],[role=link],[role=tab],[role=option],[role=menuitem]",Cr=.6,_t=2,vn=(e,t)=>Math.abs(e.left-t.left)<=_t&&Math.abs(e.top-t.top)<=_t&&Math.abs(e.width-t.width)<=_t&&Math.abs(e.height-t.height)<=_t;function uo(e,t){let o=t.i(e);if(o.width<2||o.height<2)return!1;if(e.hasAttribute("data-pipeup-id"))return!0;let n=t.K();return o.width*o.height<=Cr*n.width*n.height&&(e.matches(Ar)||t.ce(e)||e.childElementCount>1&&!e.parentElement?.closest(Mr)&&t.de(e))}function mt(e,t,o){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let n=null;for(let i=e;i&&i!==t&&!n;i=i.parentElement)uo(i,o)&&(n=i);if(!n||n.hasAttribute("data-pipeup-id"))return n;let r=o.i(n);for(let i=n.parentElement;i&&i!==t&&vn(o.i(i),r);i=i.parentElement)if(i.hasAttribute("data-pipeup-id"))return i;return n}function wn(e,t,o){let n=o.i(e);for(let r=e.parentElement;r&&r!==t;){let i=mt(r,t,o);if(!i)return null;if(!vn(o.i(i),n))return i;r=i.parentElement}return null}function po(e=window){return{i:t=>t.getBoundingClientRect(),ce:t=>{let o=e.getComputedStyle(t),n=o.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(o.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(o.getPropertyValue(`border-${i}-width`))>0);return n||r||o.backgroundImage!=="none"||o.boxShadow!=="none"},de:t=>/^(inline-)?(flex|grid)$/.test(e.getComputedStyle(t).display),K:()=>({width:e.innerWidth,height:e.innerHeight})}}function yn(e,t,o=()=>!0){let n=[],r=(i,c)=>{for(let l of i.children){if(l.hasAttribute("data-pipeup-ignore")||!o(l))continue;let p=c;uo(l,t)&&(c&&vn(t.i(c.e),t.i(l))?(l.hasAttribute("data-pipeup-id")||!c.e.hasAttribute("data-pipeup-id"))&&(c.e=l):n.push(p={e:l,C:c,k:0})),r(l,p)}};r(e,null);for(let i=n.length-1;i>=0;i--){let c=n[i];c.C&&(c.C.k=Math.max(c.C.k,c.k+1))}return n}var ht=(e,t)=>e.filter(o=>o.k<=t&&(!o.C||o.C.k>t)),fo=(e,t)=>e.filter(o=>o.C===t);var Kt="a,button,summary,[role=button],[role=link],[role=switch],[role=tab],[role=checkbox],input[type=checkbox],input[type=radio],input[type=submit],input[type=button],input[type=reset]",Pr=`${Kt},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,mo=["click","dblclick","auxclick","submit","contextmenu","dragstart"],ho=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],Or=400,bn="Tab moves between blocks \xB7 \u2191 \u2193 change level \xB7 Enter comments \xB7 Esc to finish \xB7 F7 selects text",Rr=150;function go(e,t=po()){let o=g("span",{hidden:!0},bn),n=g("div",{class:"pick"},o),r=[0,1].map(()=>{let s=g("div",{class:"km",tabindex:"-1",role:"button"},g("span",{hidden:!0}),g("span",{hidden:!0}));return s.inert=!0,s.addEventListener("keydown",de),s.addEventListener("click",b=>{b.stopPropagation(),_()}),s.addEventListener("focus",()=>n.classList.add("kf")),s.addEventListener("blur",()=>n.classList.remove("kf")),s}),i=g("span",{class:"lbl"}),c=(s,b,a,v)=>{let A=g("button",{class:"nb",type:"button","aria-label":s,title:b},oe(a,16));return A.addEventListener("click",$=>{$.stopPropagation(),v()}),A},l=c("Around it","Select the block around it","expand",F),p=c("Inside it","Select a block inside it","shrink",B),d=c("Pin","Pin its centre","pin",()=>e.J(()=>D(h??k,{x:.5,y:.5}))),m=g("div",{class:"namebar",role:"group","aria-label":"Chosen block"},i,l,p,d);m.inert=!0;let M=e.n.querySelector(".launch");for(let s of[n,...r,m])e.n.insertBefore(s,M);m.addEventListener("mousedown",s=>s.preventDefault());let C=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,u=null,h=null,y=null,E=null,L=0,T=()=>{},x=null,O=()=>{},k=null,z=0,G=0,q=!1,X=null,j=null,H=null,te=-1,be=!0,se=null,ae=null,le=s=>!e.f(s)&&!(s.target instanceof Element&&s.target.closest("[data-pipeup-ignore]"));function xe(){E&&(n.classList.toggle("glide",performance.now()<L),Ve(n,E.getBoundingClientRect(),4))}function Ee(){if(!x)return;m.classList.toggle("glide",performance.now()<L&&m.classList.contains("show"));let s=x.getBoundingClientRect(),{left:b,top:a}=Ft({left:s.left,top:s.top,width:s.width,height:s.height},{width:m.offsetWidth||200,height:m.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});m.style.left=`${b}px`,m.style.top=`${a}px`}function pe(s,b){E=s,L=b?performance.now()+Or:0,xe(),n.classList.add("show")}function w(s,b){let a=getComputedStyle(s);if(a.opacity==="0")return b(),()=>{};let v=0,A=()=>{window.clearTimeout(v),s.removeEventListener("transitionend",V)},$=()=>{A(),b()},V=he=>{he.target===s&&he.propertyName==="opacity"&&$()},J=Math.max(...a.transitionDuration.split(",").map(he=>parseFloat(he)*1e3||0));return v=window.setTimeout($,J+100),s.addEventListener("transitionend",V),A}function P(s){if(s!==u){if(u=s,T(),!s){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?pe(s,!1):C?(n.classList.remove("show"),T=w(n,()=>pe(s,!1))):pe(s,!0)}}function N(s){h=s,n.classList.toggle("on",s!==null),P(s),K(s)}function K(s){O(),m.inert=!s,s?C?(m.classList.remove("show"),O=w(m,()=>Y(s))):Y(s):(m.classList.remove("show"),x=null)}function Y(s){i.textContent=i.title=Fe(s),l.hidden=wn(s,e.root,t)===null,p.hidden=(k?I(s).length:yn(s,t,Ie).length)===0;let b=m.classList.contains("show");x=s,Ee(),b||(m.offsetWidth,m.classList.add("show"))}function D(s,b){let a;try{a=on(s,e.root,b,e.d.view(s))}catch($){e.Z($);return}let v={anchor:a,label:b?`Pin on ${Fe(s).replace(/^[A-Z](?=[a-z])/,$=>$.toLowerCase())}`:Fe(s),ranges:[],resolved:{state:"attached",element:s,range:null}},A=e.state.t;k&&(k=s,te=-1),N(b?null:s),y=A??{...v,ranges:[]},A?e.ue({...v,ranges:[]}):e.Q(y),e.S(b?v.label:`Commenting on ${v.label}`)}function U(s){e.J(()=>D(s))}function Q(s){let b=(s.target instanceof Element?mt(s.target,e.root,t):null)??e.root,a=b.getBoundingClientRect();a.width&&a.height&&D(b,{x:(s.clientX-a.left)/a.width,y:(s.clientY-a.top)/a.height})}function fe(s){let b=window.getSelection();if(b&&!b.isCollapsed)return;if(e.state.t&&(s.altKey||!e.T())){e.F();return}if(!s.altKey&&e._(s.clientX,s.clientY))return;if(e.state.o&&e.open(null),k&&s.detail&&f(),s.altKey){Q(s);return}let a=s.target instanceof Element?mt(s.target,e.root,t):null;a?D(a):(e.F(),N(null))}let ke=s=>{if(!e.f(s)){if(!le(s)){h||P(null);return}s.stopPropagation(),!(h||e.state.t||k)&&P(!_e()&&s.target instanceof Element?mt(s.target,e.root,t):null)}},_e=()=>{let s=window.getSelection();return!!s&&!s.isCollapsed&&s.toString().trim()!==""},W=()=>{_e()&&(k&&f(),h||P(null))},we=s=>{le(s)&&(s.stopPropagation(),(s.type==="pointerdown"||s.type==="mousedown")&&s.target instanceof Element&&s.target.closest(Pr)&&s.preventDefault())},Se=s=>{if(!le(s))return;let b=s.target;if((b===ae||b.form&&b.form===ae?.form)&&(s.type==="submit"||s.type==="click"&&!s.detail)){ae=s.type==="click"&&b.type==="submit"?b.form:null;return}s.preventDefault(),s.stopPropagation(),s.type==="click"&&!e.state.c&&!e.pe(s)&&fe(s)},Re=s=>{if(ae=null,Ae="",!(!le(s)||!(s.target instanceof Element)))if((s.key==="Enter"||s.key===" ")&&s.target.closest(Kt)){if(!k){ae=s.target;return}s.preventDefault(),s.stopPropagation()}else s.key==="Enter"&&!k&&s.target.form&&(ae=s.target)},me=()=>e.n.getRootNode().activeElement,ce=()=>r.some(s=>s===me()),Ie=s=>(s.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1||getComputedStyle(s).display==="contents")&&e.d.u(e.d.view(s)),ee=()=>(se?.some(s=>!s.e.isConnected)&&(se=null),se??=yn(e.root,t,Ie)),Qe=s=>ee().find(b=>b.e===s),$e=(s,b=!1)=>{let a=s.getBoundingClientRect();return a.bottom>0&&a.top<window.innerHeight&&(!b||a.top>=0)},Ke=()=>{let s=ht(ee(),0);return s.find(b=>$e(b.e,!0))??s.find(b=>$e(b.e))??s[0]},Te=s=>e.doc.threads().filter(b=>e.I(b)&&s.contains(Vt(e,b))).sort(qe(e));function Ne(s,b){let[a,v]=s.children,A=ht(ee(),z),$=Te(b).length;a.textContent=`${Lt(b)}, ${A.findIndex(he=>he.e===b)+1} of ${A.length}${$?`, has ${$} comment${$===1?"":"s"}`:""}`;let V=(b.innerText??b.textContent??"").length<=Rr;v.textContent=sn(b);let J=be?[o]:[];be=!1,s.ariaLabelledByElements!==void 0?(s.ariaLabelledByElements=V?[a,b]:[a,v],s.ariaDescribedByElements=V?J:[...J,b]):s.setAttribute("aria-label",`${a.textContent}, ${v.textContent}`)}function re(s,b=!0){let a=ee(),v=a.find($=>$.e===s);if(v&&!ht(a,z).includes(v)&&(z=v.k),s!==k&&(te=-1),s!==h&&(h=null),k=s,P(s),K(s),s.scrollIntoView({block:"nearest",inline:"nearest",behavior:C?"auto":"smooth"}),!b)return;e.fe();let A=r[G^=1];Ne(A,s),Ve(A,s.getBoundingClientRect(),4),A.inert=!1,A.focus({preventScroll:!0}),r[G^1].inert=!0}function Ue(){se=null;let s=document.activeElement;j=me()??s;let b=Qe(X),a=b??(s&&s!==document.body&&e.root.contains(s)&&!s.closest("[data-pipeup-ignore]")?ee().filter(v=>v.e.contains(s)).pop():void 0)??Ke();return a?(b||(z=a.k),q=!0,re(a.e),!0):!1}function f(){let s=ce();X=k,k=null,P(null),K(null);for(let b of r)ne(b,!0);return s}function S(){let s=j;s?.focus?.({preventScroll:!0}),s&&e.n.contains(s)&&me()!==s&&e.n.querySelector(".launch .mode")?.focus({preventScroll:!0})}function I(s){let b=Qe(s);return b?fo(ee(),b):[]}function R(s){let b=ht(ee(),z),a=b.findIndex(A=>A.e===k),v=b[a<0?s>0?0:b.length-1:(a+s+b.length)%b.length];v&&re(v.e)}function F(){let s=h??k,b=s&&wn(s,e.root,t);if(!b)return e.S("Nothing around it");if((!H||!s.contains(H))&&(H=s),h)return U(b);re(b)}function B(){let s=h??k,b=s?I(s):[],a=b.find(v=>H&&v.e.contains(H))??b.find(v=>$e(v.e))??b[0];if(!a)return e.S("Nothing inside it");h?U(a.e):re(a.e)}function _(s=!1){if(!k)return;if(e.state.t&&!e.T())return e.he();if(!s)return D(k);let b=Te(k);if(!b.length)return e.S("No comments on this block");te=(te+1)%b.length,e.open(b[te].id),b.length>1&&e.S(`Comment ${te+1} of ${b.length} on this block`)}function de(s){if(["Tab","ArrowUp","ArrowDown","Enter"," ","Escape"].includes(s.key)&&!(s.key.startsWith("Arrow")&&(s.metaKey||s.ctrlKey||s.altKey))){if(s.preventDefault(),s.stopPropagation(),Ae=s.key,s.key==="Escape")return void e.U();if(s.key==="Enter"||s.key===" ")return _(s.shiftKey&&s.key==="Enter");e.state.o&&e.open(null),s.key==="Tab"?R(s.shiftKey?-1:1):s.key==="ArrowUp"?F():B()}}let Le=()=>{let s=me();return s?!!s.closest("[inert]"):!document.activeElement||document.activeElement===document.body},Ae="",ot=s=>{s.key===Ae&&(Ae="",s.preventDefault(),s.stopPropagation())};window.addEventListener("keyup",ot,!0),window.addEventListener("pointermove",ke,!0),document.addEventListener("selectionchange",W);for(let s of ho)window.addEventListener(s,we,!0);for(let s of mo)window.addEventListener(s,Se,!0);return window.addEventListener("keydown",Re,!0),{U(){if(h)N(null);else if(k)f()&&S(),e.S(`Cursor put away \xB7 ${je} brings it back`);else return!1;return!0},z:()=>k!==null,ge:()=>q&&!k,ee:Ue,W(){k&&!ce()&&re(k)},p(){if(se=null,k&&!(k.isConnected&&Ie(k))){let a=Ke();a?re(a.e,ce()||Le()):f()}let s=e.n.querySelector(".launch");if(s&&m.nextElementSibling!==s&&!ce()&&!m.contains(me()))for(let a of[n,...r,m])e.n.insertBefore(a,s);let b=e.state.t;y&&b!==y?(y=null,N(null),k&&re(k,Le())):b&&!y&&(u||h)&&N(null)},M(){xe(),Ee(),k&&Ve(r[G],k.getBoundingClientRect(),4)},destroy(){f()&&S();for(let s of r)s.remove();T(),O(),window.removeEventListener("keyup",ot,!0),window.removeEventListener("pointermove",ke,!0),document.removeEventListener("selectionchange",W);for(let s of ho)window.removeEventListener(s,we,!0);for(let s of mo)window.removeEventListener(s,Se,!0);window.removeEventListener("keydown",Re,!0),n.classList.remove("show"),m.classList.remove("show"),ne(m,!0),w(n,()=>n.remove()),w(m,()=>m.remove())}}}var Ir=300,$r=32,xn=220,gt=320,Nr=24,vo=24;function En(e,t=!1){let o=e.ownerDocument.documentElement,n=o.getAttribute("data-pipeup-layout");if(n==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(n==="column"?e:null);if(!r)return null;if(o.hasAttribute("data-pipeup-reserve")){let l=o.clientWidth,d=getComputedStyle(r).maxWidth,m;return d.endsWith("px")?m=parseFloat(d):d.endsWith("%")?m=parseFloat(d)/100*l:m=r.getBoundingClientRect().width,n!=="column"&&l<m+gt-(t?Nr:0)?null:{x:l-gt+vo,width:gt-2*vo}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<Ir&&n!=="column")return null;let c=i+$r;return{x:c,width:Math.max(220,Math.min(300,window.innerWidth-c-16))}}function kn(e,t){let o=e.resolved.get(t.id);return!o||o.state==="orphaned"&&!e.te.has(t.id)}function wo(e){let t=g("div",{class:"col"});e.n.append(t);let o=new Map,n=null,r=new ResizeObserver(()=>l()),i=u=>kn(e,u);function c(u){let h=e.resolved.get(u.id),y=h?hn(u.anchor,h):null;return y===null?Number.POSITIVE_INFINITY:y+window.scrollY-4}function l(){let u=[],h=[];for(let[x,O]of o){let k=c(O.thread);if(Number.isFinite(k))O.placed=k;else if(e.te.has(x)){if(O.placed===null){O.e.classList.add("wait");continue}k=O.placed}Number.isFinite(k)?u.push({id:x,m:k,height:O.e.offsetHeight}):h.push({id:x,height:O.e.offsetHeight})}let y=e.state.t,E=y?hn(y.anchor,y.resolved):null;n&&E!==null&&u.push({id:"draft",m:E+window.scrollY-4,height:n.e.offsetHeight});let L=lo(u,n?"draft":e.state.o),T=Math.max(0,...u.map(x=>(L.get(x.id)??0)+x.height))+24;for(let x of h)L.set(x.id,T),T+=x.height+10;for(let[x,O]of o){if(O.e.classList.contains("wait")){if(!L.has(x))continue;O.e.style.transition="none",O.e.style.transform=`translateY(${Math.round(L.get(x))}px)`,O.e.offsetWidth,O.e.style.transition="",O.e.classList.remove("wait");continue}O.e.style.transform=`translateY(${Math.round(L.get(x)??0)}px)`}n&&(n.e.style.transform=`translateY(${Math.round(L.get("draft")??0)}px)`)}function p(u,h){u.thread=h,u.lost=i(h),u.view.update(h,{lost:u.lost?h.anchor.snapshot:null})}function d(u){let h=i(u),y=nt(u,e.D,{B:"column",lost:h?u.anchor.snapshot:null}),E=g("div",{class:"th","data-thread":u.id},g("button",{class:"opn sr",type:"button","data-thread":u.id}),y.element);return E.style.transition="none",E.addEventListener("mouseenter",()=>e.w(u.id)),E.addEventListener("mouseleave",()=>e.w(null)),E.addEventListener("click",()=>e.open(u.id)),t.append(E),r.observe(E),{e:E,thread:u,lost:h,placed:null,view:y}}function m(){let u=e.state.t;if(n&&u&&n.of!==u){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),xn),n=null}if(u&&n&&(n.i.V(u.label),n.i.H(e.state.s&&!u.anchor.quote&&!u.anchor.point)),u&&!n){let h=Nt(e,u),y=g("div",{class:"th on"},h.element);y.style.transition="none",t.append(y),r.observe(y),n={e:y,i:h,of:u},h.H(e.state.s&&!u.anchor.quote&&!u.anchor.point),h.focus()}else if(!u&&n){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),xn),n=null,e.R(null)}}function M(u){ne(t,e.state.l);let h=new Set,y=[],E=e.state.o!==null||e.state.t!==null;for(let L of u){if(!e.I(L))continue;h.add(L.id);let T=o.get(L.id);T?(T.thread!==L||T.lost!==i(L))&&p(T,L):(T=d(L),o.set(L.id,T),y.push(T.e));let x=T.e,O=e.state.o===L.id;x.classList.toggle("on",O);let k=x.firstElementChild,z=L.root.replies.length;k.setAttribute("aria-label",`Open thread: ${ve(L.root.text,60)}, ${qt(z)}`),k.setAttribute("aria-expanded",String(O)),ne(k,O);let G=x.querySelector(".more");G&&ne(G,!O),x.classList.toggle("dim",E&&!O),x.classList.toggle("hot",e.state.w===L.id&&!O),x.classList.toggle("resolved",L.resolved),x.classList.toggle("lost",T.lost)}for(let[L,T]of o)h.has(L)||(o.delete(L),r.unobserve(T.e),T.e.classList.add("out"),window.setTimeout(()=>T.e.remove(),xn));m(),Ct(t,u.filter(L=>h.has(L.id)).sort(qe(e)).map(L=>o.get(L.id).e),n?.e??null)&&t.offsetWidth,l(),n&&y.push(n.e);for(let L of y)L.offsetWidth,L.style.transition=""}function C(){let u=En(e.root,!0);u&&(t.style.width=`${u.width}px`,t.style.transform=`translate(${u.x}px, ${-window.scrollY}px)`)}return{p:M,M:C,destroy(){r.disconnect(),e.R(null),t.remove()}}}var yo="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function bo(e){let t=g("button",{type:"button","aria-label":"Comment",title:"Comment"},oe("comment",17)),o=g("div",{class:"selbar"},t);o.inert=!0,e.n.append(o);let n=null,r=0,i=!1,c=u=>{let h=u&&(u.nodeType===Node.ELEMENT_NODE?u:u.parentElement);return!!h&&e.root.contains(h)&&!h.closest(yo)};function l(){if(!n)return;let u=n.getBoundingClientRect(),{left:h,top:y}=Ft({left:u.left,top:u.top,width:u.width,height:u.height},{width:o.offsetWidth||36,height:o.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});o.style.left=`${h}px`,o.style.top=`${y}px`}function p(){n=null,o.inert=!0,o.classList.remove("show")}function d(u=!1){let h=window.getSelection();if(!e.state.s||!h||h.isCollapsed||h.rangeCount===0||!h.toString().trim()||!c(h.anchorNode)||!c(h.focusNode)){p();return}!n&&!u&&e.S("Enter comments on the selected words"),n=h.getRangeAt(0).cloneRange(),l(),o.inert=!1,o.classList.add("show")}t.addEventListener("mousedown",u=>u.preventDefault()),t.addEventListener("click",u=>{if(u.stopPropagation(),e.state.t&&!e.T())return e.F();let h=n;if(!h)return;let y;try{y=nn(h,e.root,e.d.view(h.commonAncestorContainer))}catch(L){e.Z(L),p();return}let E=ve(h.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),p(),e.Q({anchor:y,label:`\u201C${E}\u201D`,ranges:[h],resolved:{state:"attached",element:null,range:h}})});let m=()=>{if(window.clearTimeout(r),r=window.setTimeout(()=>i||d(),250),!n)return;let u=window.getSelection();(!u||u.isCollapsed||!u.toString().trim())&&p()};document.addEventListener("selectionchange",m);let M=u=>{u.type!=="keyup"&&(i=u.type==="mousedown"),!(i||e.f(u))&&window.setTimeout(()=>d(u.type==="mouseup"),0)};window.addEventListener("mousedown",M,!0),window.addEventListener("mouseup",M,!0),window.addEventListener("keyup",M,!0);let C=u=>{u.key!=="Enter"||!n||e.f(u)||u.target instanceof Element&&u.target.closest(`${yo},${Kt}`)||(u.preventDefault(),u.stopPropagation(),t.click())};return window.addEventListener("keydown",C,!0),{p(){!e.state.s&&n&&p()},M(){n&&l()},destroy(){window.removeEventListener("mousedown",M,!0),window.removeEventListener("mouseup",M,!0),window.removeEventListener("keyup",M,!0),window.removeEventListener("keydown",C,!0),window.clearTimeout(r),document.removeEventListener("selectionchange",m),o.remove()}}}async function Sn(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(o),o.select();let n=document.execCommand("copy");if(o.remove(),!n)throw new Error("pipeup: your browser blocked copying")}var Hr=3e3,xo="Hidden on the page";function Eo(e){let t=[g("span",{class:"n"}),g("span",{class:"n"})],o=oe("comment",20,1.4);o.lastElementChild.setAttribute("stroke-width","1.6");let n=g("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":fn,"aria-haspopup":"menu","aria-expanded":"false"},g("span",{class:"plus"},o),g("span",{class:"cnt"},oe("bubble",34,1.4),...t),g("span",{class:"dot"})),r=document.createTextNode("Comment"),i=g("span",{class:"ttip","aria-hidden":"true"},r,g("small",{},je)),c=g("div",{class:"launch"},n,i),l=g("div",{class:"menu",role:"menu","aria-label":"Comments"}),p=g("div",{class:"list",role:"menu","aria-label":"All comments"}),d=g("span",{class:"pn"}),m=g("button",{class:"ib",type:"button","aria-label":"Close"},oe("close")),M=g("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",g("span",{class:"sw","aria-hidden":"true"}));M.addEventListener("click",f=>{f.stopPropagation(),e.c.ve()});let C=g("div",{class:"all",role:"dialog","aria-label":"All comments"},g("div",{class:"hd"},g("span",{},"All comments"),d,M,m),p),u=g("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});l.inert=C.inert=u.inert=!0,e.n.append(l,c,C);let h=!1,y=null,E=0,L=[],T=0,x=null,O=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,k=f=>{h=e.state.c=f,window.clearTimeout(E),E=0,f||y?.(!0),l.classList.toggle("show",f),ne(l,!f),n.setAttribute("aria-expanded",String(f))},z=(f,S=!1)=>{e.state.l!==f&&(e.state.l=f,e.p(),f?(G(p)[0]??m).focus({preventScroll:!0}):S&&n.focus({preventScroll:!0}))},G=(f=l)=>[...f.querySelectorAll(".mi")],q=()=>l.getRootNode().activeElement,X=()=>{k(!1),n.focus({preventScroll:!0})},j=f=>{let S=G(f.currentTarget);if(S.length===0)return;let I=q(),R=S.indexOf(I),F=B=>{f.preventDefault(),S[(B+S.length)%S.length]?.focus({preventScroll:!0})};f.key==="ArrowDown"?F(R+1):f.key==="ArrowUp"?F(R<0?S.length-1:R-1):f.key==="Home"?F(0):f.key==="End"&&F(S.length-1)};l.addEventListener("keydown",j),p.addEventListener("keydown",j),m.addEventListener("click",f=>{f.stopPropagation(),z(!1,!0)});let H=f=>kn(e,f),te=()=>L.filter(f=>!f.resolved&&!e.O(f)).length,be=()=>L.filter(f=>!f.resolved&&e.O(f)).length,se=()=>L.filter(f=>!f.resolved).length,ae=f=>{let S=f.anchor.view?.slide,I=e.d.u(f.anchor.view)?"":At(f.anchor.view);return S&&e.d.slide()!==null?`On slide ${S}`:I?`In ${I}`:xo},le=(f,S,I="")=>g("div",{role:"group","aria-label":I?`${f} \xB7 ${I}`:f},g("div",{class:"sec","aria-hidden":"true"},f,I&&g("b",{},I)),...S);function xe(f,S){let I=e.d.slide(),R=new Map;for(let F of f){let B=F.thread,_=I!==null?B.anchor.view?.slide??I:e.O(B)?e.d.u(B.anchor.view)?"":At(B.anchor.view):null;R.set(_,[...R.get(_)??[],F])}if(I===null){let F=R.get(null)??[];return R.delete(null),[...F.map(S),...[...R].map(([B,_])=>le(B||xo,_.map(S)))]}return[...R].sort(([F],[B])=>Number(F)-Number(B)||0).map(([F,B])=>le(`Slide ${F} \xB7 ${B.filter(_=>!_.thread.resolved).length} open`,B.map(S),F===I?"This slide":""))}function Ee(){let f=q()?.dataset.thread,S=e.c.all().filter(B=>!B.thread.resolved||e.state.E),I=B=>{let _=B.thread,de=Ye(_.root.author,_.root.name);de.classList.add("in");let Le=g("button",{class:_.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":_.id},de,g("span",{},g("span",{class:"clamp"},_.root.deleted?"Deleted":_.root.text),g("small",{},H(_)?`\u201C${ve(_.anchor.snapshot,80)}\u201D`:B.location.where)));return Le.addEventListener("click",Ae=>{Ae.stopPropagation(),pe(_.id,Le.getBoundingClientRect().top)}),Le},R=S.filter(B=>H(B.thread));d.textContent=String(se()),M.setAttribute("aria-checked",String(e.state.E)),p.replaceChildren(S.length?"":g("div",{class:"sec",role:"presentation"},"No open comments"),...xe(S.filter(B=>!H(B.thread)),I),R.length?le("No longer on the page",R.map(I)):"");let F=G(p);f&&F.find(B=>B.dataset.thread===f)?.focus({preventScroll:!0})}function pe(f,S){Xe()&&(e.state.L=!0,z(!1)),P(f,S)}let w="";function P(f,S){let I=L.find(R=>R.id===f);if(I){if(w=f,!e.O(I))return N(I,S);if(e.state.t&&!e.T())return e.F();e.d.j(I.anchor.view??{}).then(()=>{e.ne();let R=L.find(F=>F.id===f);R&&w===f&&(e.state.l||e.state.L)&&N(R,S)})}}function N(f,S){let I=f.id,R=e.resolved.get(I),F=R&&!H(f)&&!e.O(f)?R.element??R.range?.startContainer.parentElement??null:null;if(F?.scrollIntoView({block:"center",inline:"nearest",behavior:O?"auto":"smooth"}),F&&R&&pt(f.anchor,R)&&F.checkVisibility?.({visibilityProperty:!0})!==!1){Y(),e.open(I);return}e.open(null),Xe()&&(e.state.L=!0,e.p()),K(f,S)}function K(f,S){let I=!H(f)&&e.O(f),R={quote:f.anchor.quote?.exact??null,lost:H(f)||I?f.anchor.snapshot:null,place:I?ae(f):null};if(x?.id===f.id?x.view.update(f,R):(x={id:f.id,view:nt(f,e.D,{B:"popover",...R})},u.replaceChildren(x.view.element)),S===void 0)return;u.isConnected||(e.n.insertBefore(u,C),u.offsetWidth);let F=Bt(e.state.l),{left:B,top:_}=Dt({x:F.width,y:S,below:!1},{width:Ge,height:u.offsetHeight},F);u.style.left=`${B}px`,u.style.top=`${_}px`,u.classList.add("show"),u.inert=!1,e.we(f.id)}function Y(f=!1){x&&(x=null,u.classList.remove("show"),ne(u,!0),f&&e.state.L&&(e.state.L=!1,e.p()))}function D(f,S,I,R=!1,...F){let B=g("button",{class:"mi",type:"button",role:R?"menuitemcheckbox":"menuitem"},f,g("span",{class:"lb"},S),...F,R&&g("span",{class:"sw","aria-hidden":"true"}),g("span",{class:"tt","aria-hidden":"true"}));return B.addEventListener("click",_=>{_.stopPropagation(),I(_)}),B}let U=(f,S,I,R)=>{let F=f.querySelector(".lb");F.textContent!==S&&(F.textContent=S),f.querySelector(".tt").textContent=I,f.setAttribute("aria-description",I),R!==void 0&&f.setAttribute("aria-checked",String(R))},Q=()=>g("div",{class:"sep",role:"separator"}),fe=g("span",{class:"ma"}),ke=g("span",{class:"kc"}),_e="",W=D(fe,"",$e,!1,ke);W.dataset.item="name";let we=D(oe("copy"),"Copy as Markdown",()=>{X(),e.c.copyAll("ai")}),Se=D(oe("lines"),"Copy as Text",()=>{X(),e.c.copyAll("text")}),Re=g("span",{class:"kc"}),me=D(oe("list"),"All comments",()=>{k(!1),z(!0)},!1,Re),ce=D(oe("comment"),"Start commenting",f=>{let S=!e.state.s&&f.detail===0;e.ye(!e.state.s,S),S&&k(!1)},!0,g("span",{class:"kc","aria-hidden":"true"},je));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",fn);let Ie=[W,Q(),we,Se,me,Q(),ce];function ee(){let f=se(),S=e.c.name(),I=S||Pe(e.doc.me);if(U(W,I,S?"The name on your comments":"Add a name to show on your comments"),W.setAttribute("aria-label",`${I}, ${S?"edit":"add"} your name`),ke.replaceChildren(S?oe("edit",13):"Add name"),dt(e.doc.me,S)!==_e){_e=dt(e.doc.me,S);let R=Ye(e.doc.me,S);R.classList.add("in"),fe.replaceChildren(R)}U(we,"Copy as Markdown","Markdown, with where each thread is"),U(Se,"Copy as Text","Just the words"),U(me,"All comments","Every thread, and where it is"),Re.textContent=f?String(f):"",U(ce,"Start commenting",e.state.s?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.s)}function Qe(){ee(),l.firstChild!==W&&l.replaceChildren(...Ie)}function $e(){let f=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"});f.value=e.c.name();let S=g("div",{class:"ed"},fe.cloneNode(!0),f),I=(R,F=!1)=>{if(y!==I)return;y=null;let B=f.value.trim();R&&B&&B!==e.c.name()&&e.c.rename(B).then(ee),S.replaceWith(W),F&&W.focus({preventScroll:!0})};y=I,f.addEventListener("keydown",R=>{R.stopPropagation(),(R.key==="Enter"||R.key==="Escape")&&(R.preventDefault(),I(R.key==="Enter",!0))}),f.addEventListener("blur",()=>I(!0)),W.replaceWith(S),f.focus({preventScroll:!0})}n.addEventListener("click",f=>{if(f.stopPropagation(),h){k(!1);return}Qe(),k(!0),f.detail===0&&G().at(-1)?.focus({preventScroll:!0})});let Ke=!1,Te=()=>{Ke=C.contains(q())},Ne=f=>{let S=f.composedPath();h&&!S.includes(l)&&!S.includes(n)&&(k(!1),e.state.s&&!e.f(f)&&(e.X(f),f.preventDefault(),f.stopPropagation())),e.state.l&&!e.f(f)&&z(!1,Ke&&(!document.activeElement||document.activeElement===document.body)),!S.includes(u)&&!S.includes(C)&&Y(!0)},re=f=>{if(!h||f.pointerType==="touch"||f.type==="pointerout"&&f.relatedTarget)return;let S=f.composedPath();f.type==="pointerover"&&(S.includes(l)||S.includes(n))?(window.clearTimeout(E),E=0):E||(E=window.setTimeout(()=>{E=0,y||k(!1)},Hr))};window.addEventListener("pointerdown",Te,!0),window.addEventListener("click",Ne,!0),window.addEventListener("pointerover",re,!0),window.addEventListener("pointerout",re,!0);let Ue=f=>{if(f.key!=="Escape"||y)return;let S=f.composedPath()[0];if(h)X();else if(e.state.l&&!(S instanceof HTMLTextAreaElement&&!C.contains(S)))z(!1,!0);else if(x)Y(!0),e.D.close();else return;f.stopPropagation()};return window.addEventListener("keydown",Ue,!0),{p(f){L=f;let S=te();if(S!==T){if(S){let[_,de]=t[0].classList.contains("on")?t:[t[1],t[0]];de.textContent=S>99?"99+":String(S),de.classList.toggle("s",S>99),_.classList.remove("on"),de.classList.add("on")}n.classList.toggle("has",S>0),T=S}let I=be(),R=I?`${S} here \xB7 ${I} ${e.d.slide()!==null?"on other slides":"in other views"}`:"";n.classList.toggle("else",I>0);let F=`Comment${e.state.s?", comment mode on":""}${R?`, ${R}`:S?`, ${S} open`:""}`;n.getAttribute("aria-label")!==F&&n.setAttribute("aria-label",F),r.data!==(R||"Comment")&&(r.data=R||"Comment"),n.classList.toggle("on",e.state.s),h&&ee();let B=e.state.l;if(C.classList.toggle("full",Xe()),C.classList.contains("show")!==B&&(C.classList.toggle("show",B),ne(C,!B)),B&&Ee(),x){let _=f.find(de=>de.id===x?.id);!_||e.state.o||_.resolved&&!e.state.E?Y():K(_)}},M(){},destroy(){window.removeEventListener("pointerdown",Te,!0),window.removeEventListener("click",Ne,!0),window.removeEventListener("pointerover",re,!0),window.removeEventListener("pointerout",re,!0),window.clearTimeout(E),window.removeEventListener("keydown",Ue,!0),l.remove(),C.remove(),u.remove(),c.remove()}}}var vt="[data-pipeup-slide]",ko=1e3,So=["scroll","resize","keyup","click","transitionend","slidechanged"],Tn=null,yt=null,Ut=new Set,Ln=new Set,wt=e=>{try{e()}catch(t){globalThis.reportError?.(t)}};function Br(e){let t=null;if(e){t={};let o=0;for(let[n,r]of Object.entries(e))if(!(typeof r!="string"||n==="slide"||n.length>Z.viewKey||r.length>Z.viewValue)){if(++o>=Z.viewEntries)break;t[n]=r}}Tn=t;for(let o of Ln)o()}function Dr(e){return Ut.add(e),()=>void Ut.delete(e)}function zt(e){yt=typeof e?.current=="function"&&typeof e.go=="function"?e:null}function Fr(e,t,o){let n=t.K(),r=null,i=0,c=0;for(let l of e){if(!t.shown(l))continue;let p=t.i(l),d=Math.min(p.left+p.width,n.width)-Math.max(p.left,0),m=Math.min(p.top+p.height,n.height)-Math.max(p.top,0);if(d<=0||m<=0)continue;let M=Math.round(d*m),C=t.opacity(l);(M>i||M===i&&(C>c||C===c&&l===o))&&(r=l,i=M,c=C)}return r}function Vr(e,t,o){return t!==null?e?.slide===void 0||e.slide===t:!e||!o?!0:Object.entries(e).every(([n,r])=>n==="label"||n==="slide"||o[n]===r)}function qr(){return{i:e=>e.getBoundingClientRect(),shown:e=>e.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1,opacity:e=>parseFloat(getComputedStyle(e).opacity)||0,K:()=>({width:window.innerWidth,height:window.innerHeight})}}var To=()=>{let e=window.Reveal;return typeof e?.getIndices=="function"&&typeof e.slide=="function"?e:null};function Lo(e,t,o=qr()){let n=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,r=null,i=null,c=0,l=!1,p=()=>[...e.querySelectorAll(vt)],d=()=>[...e.querySelectorAll(".slides > section")],m=T=>typeof T=="string"&&T.length>0&&T.length<=Z.viewValue?T:null,M=T=>m(T?.getAttribute("data-pipeup-slide"));function C(){if(yt){let x=null;if(wt(()=>{let O=yt.current();Number.isInteger(O)&&O>0&&(x=String(O))}),x!==null)return x}let T=To();if(T){let x=null;if(wt(()=>{let O=T.getIndices().h,k=d()[O];x=M(k?.matches(vt)?k:k?.querySelector(vt))??m(String(O+1))}),x!==null)return x}return r&&!r.isConnected&&(r=null),r=Fr(p(),o,r)??r,M(r)}function u(){c=0,i=C(),t()}let h=()=>{!c&&!l&&(c=requestAnimationFrame(u))},y=T=>Vr(T,i,Tn);function E(T){if(y(T))return Promise.resolve(!0);let x=T.slide,O=To(),k=p().find(q=>M(q)===x),z=/^[1-9]\d{0,5}$/.test(x??"");if(z&&yt)wt(()=>yt.go(Number(x)));else if(z&&O){let q=k?d().findIndex(X=>X===k||X.contains(k)):-1;wt(()=>O.slide(q>=0?q:Number(x)-1))}else if(Ut.size)for(let q of Ut)wt(()=>q({...T}));else if(k)k.scrollIntoView({block:"start",behavior:n?"auto":"smooth"});else return Promise.resolve(!1);let G=performance.now();return new Promise(q=>{let X=te=>{clearTimeout(j),q(te)},j=setTimeout(()=>X(!1),ko),H=()=>{if(l)return X(!1);if(i=C(),y(T))return X(!0);if(performance.now()-G>=ko)return X(!1);requestAnimationFrame(H)};requestAnimationFrame(H)})}let L=new MutationObserver(T=>{T.some(x=>x.target instanceof Element&&x.target.matches(vt))&&h()});L.observe(e,{subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]});for(let T of So)window.addEventListener(T,h,{capture:!0,passive:!0});return Ln.add(h),i=C(),{slide:()=>i,view(T){let x=T instanceof Element?T:T?.parentElement,O=M(x?.closest(vt))??i,k={...O!==null?{slide:O}:{},...Tn};return Object.keys(k).length?k:void 0},u:y,j:E,destroy(){l=!0,cancelAnimationFrame(c),L.disconnect();for(let T of So)window.removeEventListener(T,h,!0);Ln.delete(h)}}}var Mo=["pipeup-quote","pipeup-on","pipeup-done"],_r={"pipeup-quote":[[250,227,188,.75],[250,200,100,.28]],"pipeup-on":[[247,212,154,.95],[250,200,100,.42]],"pipeup-done":[[180,178,169,.22],[180,178,169,.2]]},Kr=(e,t)=>Mo.map(o=>{let[n,r,i,c]=_r[o][e?1:0];return`::highlight(${o}){background-color:rgba(${n},${r},${i},${+(c*t).toFixed(3)})}`}).join("");function Co(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var Ur="<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><rect x='7' y='7' width='23' height='23' rx='4' fill='none' stroke='#534AB7' stroke-width='2' stroke-dasharray='4 3'/><path d='M3 2v15l4-3.5 3 6.5 2.5-1.2-3-6.3H15z' fill='#fff' stroke='#2C2C2A' stroke-width='1.2' stroke-linejoin='round'/></svg>",zr=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(Ur)}") 3 2,crosshair!important}`;function Po(e=document,t=!1){let o=e.defaultView?.CSSStyleSheet;if(!o||!("replaceSync"in o.prototype)||!("adoptedStyleSheets"in e))return{oe(){},re(){},Y(){},ie(){},remove:()=>Ao()};let n=new o,r=null,i=!1,c=1,l=0,p="",d=0,m=()=>n.replaceSync(Kr(t,c)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?zr:"")+(l||p?`html{--pipeup-panel:${l}px;${l?`margin-right:${l}px!important;`:""}${p}}`:""));return m(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],{oe(M){M!==r&&(r=M,m())},re(M){M!==i&&(i=M,m())},Y(M){c=M,m()},ie(M,C){M!==l&&(l=M,p=C?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(d),!M&&p&&(d=window.setTimeout(()=>{p="",m()},400)),m())},remove(){clearTimeout(d),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(M=>M!==n),Ao()}}}function Oo(e){Co()&&(CSS.highlights.set("pipeup-quote",new Highlight(...e.quote)),CSS.highlights.set("pipeup-on",new Highlight(...e.on)),CSS.highlights.set("pipeup-done",new Highlight(...e.done)))}function Ao(){if(Co())for(let e of Mo)CSS.highlights.delete(e)}var An=':host{all:initial}*{box-sizing:border-box}button{-webkit-appearance:none;appearance:none;font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}svg{display:block}.layer{all:initial;display:block;position:fixed;inset:0;pointer-events:none;font:13px/1.5 var(--pu-font,system-ui,sans-serif);color:var(--k);--k:#2C2C2A;--mu:#5F5E5A;--fa:#888780;--ln:#E5E3DA;--ru:#ECEAE2;--so:#FAFAF7;--su:#FFFFFF;--ho:#F1EFE8;--as:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--sh:0 8px 28px rgba(44,44,42,.1);--in:.26s;--mv:.34s;--out:.2s;--pl:1.2s;--eo:cubic-bezier(.22,.61,.36,1);--eio:cubic-bezier(.4,0,.2,1);--ei:cubic-bezier(.4,0,1,1)}.layer.dark{--k:#ECEBE6;--mu:#B4B2A9;--fa:#8D8B84;--ln:#3A3936;--ru:#34332F;--so:#22221F;--su:#1B1B19;--ho:#2C2C29;--sh:0 8px 28px rgba(0,0,0,.45)}.layer.hidden .bub,.layer.hidden .col,.layer.hidden .pop,.layer.hidden .tip,.layer.hidden .mark,.layer.hidden .selbar{opacity:0!important;pointer-events:none!important}.tx{font-size:14px;line-height:1.5;color:var(--k);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--fa)}.who,.rest{font-size:12px}.who{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rft>.who{display:block}.ctx[hidden]{display:none}.ctx{font-size:12px;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.tx a{color:var(--pu-accent);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.ft,.rft{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows var(--in) var(--eo),opacity var(--in) var(--eo)}.ft>*,.rft>*{overflow:hidden;min-height:0;display:flex;align-items:center}.root:hover>.ft,.root:focus-within>.ft,.it:hover>.rft,.it:focus-within>.rft{grid-template-rows:1fr;opacity:1}.ft.has-rest{grid-template-rows:1fr;opacity:1}.ft.has-rest>*{grid-area:1/1}.ft .hover{opacity:0;transition:opacity var(--in) var(--eo)}.ft .rest{transition:opacity var(--in) var(--eo)}.root:hover>.ft .hover,.root:focus-within>.ft .hover,.ft:not(.has-rest) .hover{opacity:1}.root:hover>.ft .rest,.root:focus-within>.ft .rest{opacity:0}.acts{margin-left:6px;display:flex;flex:none}.ib{width:24px;height:22px;display:grid;place-items:center;border-radius:6px;color:var(--mu);transition:background-color .2s var(--eo),color .2s var(--eo)}.ib:hover,.ib:focus-visible{background:var(--ho);color:var(--k);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--mv) var(--eio)}.more>div{overflow:hidden;min-height:0}.th:not(.on) .more{grid-template-rows:0fr}.row{display:flex;align-items:center;gap:8px;padding:8px 0 2px;cursor:text}.input{flex:1;min-width:0;height:27px;display:block;border:0;border-bottom:1px solid var(--ln);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--k);background:transparent;transition:border-color var(--in) var(--eo)}.row:hover .input,.input:hover{border-bottom-color:var(--mu)}.input:focus{border-bottom-color:var(--pu-accent)}.ed{display:flex;gap:10px;align-items:center;min-height:34px;padding:6px 10px}.ed .input{font-size:13px;height:22px}.root,.it{position:relative;padding-right:30px}.av{display:grid;place-items:center;width:22px;height:22px;border-radius:32%;font-size:12px;font-weight:600;line-height:1;opacity:0;transform:scale(.85);transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.av.in{opacity:1;transform:none}.av svg{width:80%;height:80%}.root>.av,.it>.av{position:absolute;top:0;right:0}.it>.av{top:6px}.av{--av-l:92%;--av-d:30%;--s:60%;background:hsl(var(--h) var(--s) var(--av-l));color:hsl(var(--h) var(--s) var(--av-d))}.dark .av{--av-l:20%;--av-d:78%}.c0{--h:0}.c1{--h:25}.c2{--h:50}.c3{--h:130}.c4{--h:175}.c5{--h:215}.c6{--h:270}.c7{--h:330}.c8{--h:28;--s:35%}.c9{--h:220;--s:8%}.me{flex:none;display:grid}.me>.av{grid-area:1/1;width:26px;height:26px;font-size:13px}.you{display:grid;padding:0 34px;min-height:24px;font-size:12px;color:var(--fa)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.say{white-space:pre;overflow:hidden}.nm{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.say button{flex:none}.say button{color:var(--mu);text-decoration:underline;text-decoration-color:var(--ln);text-underline-offset:2px;transition:color .2s var(--eo)}.say button:hover,.say button:focus-visible{color:var(--pu-accent);outline:none}.nf{opacity:0;transform:translateY(-4px);pointer-events:none}.nf .input{font-size:13px;height:24px}.you.naming .nf{opacity:1;transform:none;pointer-events:auto}.you.naming .say{opacity:0;pointer-events:none}.send{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;color:var(--pu-accent);flex:none;opacity:0;pointer-events:none;transition:opacity var(--in) var(--eo),background-color .2s var(--eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--as)}.bub{position:fixed;left:0;top:0;width:20px;height:20px;margin:-20px 0 0 -2px;border-radius:50% 50% 50% 0;background:var(--pu-accent);border:2px solid var(--su);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--fa)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--eo),transform .26s var(--eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--eo),transform .26s var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.pop{position:fixed;width:var(--pu-pop);border-radius:12px;padding:10px 12px 8px;pointer-events:none;opacity:0;transform:translateY(6px) scale(.98);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.pop.show.glide{transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--as);border-radius:8px;opacity:0;transition:opacity .3s var(--eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--as);animation:pu-pulse var(--pl) var(--eio) forwards}@keyframes pu-pulse{0%{opacity:0;transform:scale(.985)}35%{opacity:.85;transform:scale(1)}to{opacity:0;transform:scale(1.02)}}.col{position:fixed;left:0;top:0;pointer-events:none;transition:opacity var(--in) var(--eo)}.th{position:absolute;left:0;right:0;top:0;padding:4px 4px 4px 12px;pointer-events:auto;cursor:pointer;box-shadow:inset 2px 0 0 transparent;transition:transform var(--mv) var(--eio),box-shadow var(--in) var(--eo),opacity var(--in) var(--eo)}.th.hot{box-shadow:inset 2px 0 0 var(--ln)}.th.on{box-shadow:inset 2px 0 0 var(--pu-accent);cursor:default}.th.dim{opacity:.45}.th.resolved:not(.on):not(.hot){opacity:.6}.th.lost .ctx{white-space:normal}.th.wait{opacity:0!important;pointer-events:none}.th.out{opacity:0!important;pointer-events:none;transition:opacity var(--out) var(--ei)}.th:has(.opn:focus-visible){box-shadow:inset 2px 0 0 var(--ln);outline:2px solid var(--pu-accent);outline-offset:2px;border-radius:4px}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.selbar.show{opacity:1;transform:none;pointer-events:auto}.selbar button{width:32px;height:30px;display:grid;place-items:center;border-radius:8px;color:var(--pu-accent);transition:background-color .2s var(--eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--as);outline:none}.pick{position:fixed;left:0;top:0;border:2px solid color-mix(in srgb,var(--pu-accent) 70%,transparent);background:color-mix(in srgb,var(--pu-accent) 6%,transparent);border-radius:8px;pointer-events:none;opacity:0;transition:opacity var(--out) var(--ei),border-color var(--out) var(--ei),border-width var(--out) var(--ei),box-shadow var(--out) var(--ei)}.pick.show{opacity:1;transition-duration:var(--in);transition-timing-function:var(--eo)}.pick.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.pick.on{border-color:var(--pu-accent)}.pick.kf{border:3px solid var(--pu-accent);box-shadow:0 0 0 2px var(--su)}.km{position:fixed;left:0;top:0;pointer-events:none;outline:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.namebar{position:fixed;left:0;top:0;display:flex;align-items:center;gap:2px;padding:2px 2px 2px 10px;border-radius:10px;font-size:12px;color:var(--mu);white-space:nowrap;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.namebar .lbl{margin-right:6px;max-width:260px;overflow:hidden;text-overflow:ellipsis}.namebar .nb{padding:4px;display:grid;place-items:center;border-radius:7px;transition:background-color .2s var(--eo),color .2s var(--eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--ho);color:var(--k);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{position:relative;display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);transition:background-color .3s var(--eo),color .3s var(--eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--in) var(--eo)}.cnt,.has>.plus{opacity:0}.has>.cnt{opacity:1}.n{font-size:12px;font-weight:500;line-height:1;margin:-1.4px 0 0 1.4px;font-variant-numeric:tabular-nums;opacity:0;transition:opacity var(--in) var(--eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--ho)}.launch .mode.on{background:var(--pu-accent);color:#fff}.mode>.dot{position:absolute;top:3px;right:3px;width:9px;height:9px;border-radius:50%;background:var(--pu-accent);border:2px solid var(--su);opacity:0}.mode.else>.dot{opacity:1}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--fa)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--out) var(--ei)}@media(hover:none){.ttip,.tt{display:none}}.menu{position:fixed;right:20px;bottom:76px;width:290px;border-radius:12px;padding:4px;pointer-events:none;opacity:0;transform:translateY(6px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.mi{position:relative;display:flex;gap:10px;align-items:center;width:100%;min-height:34px;text-align:left;padding:6px 10px;border-radius:8px;transition:background-color .2s var(--eo)}.mi:hover,.mi:focus-visible{background:var(--so);outline:none}.mi svg{color:var(--mu);flex:none}.mi small{display:block;color:var(--fa);font-size:12px}.lb{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ma{flex:none;display:grid;margin:-2px 0}.ma .av{width:20px;height:20px;font-size:11px}.mi .av svg{color:inherit}.sep{height:1px;margin:4px 10px;background:var(--ru)}.tt{position:absolute;right:calc(100% + 14px);top:50%;translate:0 -50%;width:max-content;max-width:220px;padding:4px 9px;border-radius:8px;font-size:12px;line-height:1.4;color:var(--mu);background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}@media(max-width:600px){.tt{right:8px;top:auto;bottom:100%;translate:none;transform:translateY(3px)}}.sw{position:relative;flex:none;width:26px;height:16px;border-radius:8px;background:var(--ln);transition:background-color var(--mv) var(--eio)}.sw:before,.sw:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 2px #00000040;transition:transform var(--mv) var(--eio),opacity var(--mv) var(--eio)}.sw:before{opacity:0;transform:translate(10px)}[aria-checked=true]>.sw{background:var(--pu-accent)}[aria-checked=true]>.sw:after{transform:translate(10px)}.all{position:fixed;top:0;right:0;bottom:0;width:var(--pu-panel);display:flex;flex-direction:column;border-width:0 0 0 1px;opacity:0;transform:translate(100%);transition:transform var(--out) var(--ei),opacity var(--out) var(--ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--mv) var(--eo),opacity var(--in) var(--eo)}.all.full{width:100%}.hd{display:flex;align-items:center;gap:8px;padding:12px 10px 8px 16px;font-weight:600}.pn{font-weight:400;color:var(--fa)}.hs{margin-left:auto;display:flex;align-items:center;gap:6px;padding:3px 4px 3px 6px;border-radius:6px;font-size:12px;font-weight:400;color:var(--mu);transition:background-color .2s var(--eo)}.hs:hover,.hs:focus-visible{background:var(--ho);outline:none}.list{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:4px}.all .mi{align-items:flex-start}.all .mi>.av{flex:none}.all .mi>span:last-child{flex:1;min-width:0}.all .mi small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.all .mi .av svg{margin:0}.all .mi.done{opacity:.6}.layer.listing .col{opacity:0;transition:opacity var(--out) var(--ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--fa)}.sec b{margin-left:6px;font-weight:500;color:var(--pu-accent)}.toast{position:fixed;left:50%;bottom:28px;border-radius:10px;padding:8px 14px;font-size:13px;opacity:0;transform:translate(-50%,6px);transition:opacity .3s var(--eo),transform .36s var(--eo)}.toast.show{opacity:1;transform:translate(-50%)}@media(forced-colors:active){.pick.kf{border:3px solid Highlight}.layer :is(.ib,.mi,.nb,.hs,.selbar button,.say button):focus-visible{outline:2px solid Highlight}}@media(prefers-reduced-motion:reduce){.bub,.bub.in,.bub.in:hover,.bub.on,.tip,.pop,.selbar,.menu,.all,.ttip,.tt,.toast{transform:none!important}.sw:after{transform:none!important;transition-property:opacity}[aria-checked=true]>.sw:after{opacity:0}[aria-checked=true]>.sw:before{opacity:1}.th{transition-property:opacity,box-shadow}.tip.show{transition-property:opacity}.pick,.pick.show{transition:opacity .16s ease-in-out}.all,.all.show{transition-property:opacity}.namebar,.namebar.show{transform:none!important;transition:opacity .16s ease-in-out}.av,.nf{transform:none!important}@keyframes pu-pulse{0%{opacity:0}35%{opacity:.85}to{opacity:0}}}';var Ro="#534AB7",Wr="rgb(0, 0, 238)";function Io(e){let t=/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)/.exec(e);if(!t||t[1]===void 0||t[2]===void 0||t[3]===void 0)return null;let o=t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]);return{r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:o}}function jr(e){let t=o=>{let n=o/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function $o(e){let t=e.ownerDocument,o=t.defaultView;if(!o)return{font:"system-ui, sans-serif",accent:Ro,dark:!1};let n=t.documentElement,r=o.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(o.getComputedStyle(n).getPropertyValue("--pipeup-accent")||n.style.getPropertyValue("--pipeup-accent")).trim(),c=e.querySelector("a[href]"),l=c?o.getComputedStyle(c).color:"",p=i||(l&&l!==Wr?l:Ro),d=Io(o.getComputedStyle(t.body).backgroundColor);(!d||d.a===0)&&(d=Io(o.getComputedStyle(n).backgroundColor));let m=d&&d.a>0?jr(d)<.2:o.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(o.getComputedStyle(n).colorScheme||"");return{font:r,accent:p,dark:!!m}}function No(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function Ho(e,t=document){let o=t.createElement("pipeup-root");o.setAttribute("data-pipeup-ignore",""),o.style.cssText="position:fixed!important;inset:0!important;pointer-events:none!important;z-index:2147483000!important;display:block!important;margin:0!important;visibility:visible!important;opacity:1!important;transform:none!important;filter:none!important;";let n=o.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in n){let c=new r;c.replaceSync(An),n.adoptedStyleSheets=[c]}else{let c=t.createElement("style");c.textContent=An,n.append(c)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${ft}px`),i.style.setProperty("--pu-pop",`${Ge}px`),No(i,e),n.append(i),t.documentElement.append(o),{element:o,shadow:n,n:i,destroy:()=>o.remove()}}var Yr=40,Gr=250,Xr=120,Jr=2400,Zr=4e3,Qr=1e4;function Bo(e,t=!1){return En(e,t)?"column":"bubbles"}function ei(e){return[...e.state.mode==="column"?[wo(e),gn(e,{q:!1})]:[gn(e,{q:!0})],bo(e),Eo(e)]}var ti=1e3,Wt="Shown here, but not saved yet \u2014 it will be saved with your next change",Je=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function Do(e){let t=$o(e.root),o=Ho(t),n=Po(document,t.dark);n.Y(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),c=new Map,l=new Set,p=new WeakSet,d={o:null,w:null,E:!1,hidden:!0,mode:Bo(e.root),t:null,s:!1,l:!1,L:!1,c:!1},m=g("div",{class:"toast",role:"status","aria-live":"polite"}),M=g("div",{class:"sr","aria-live":"polite"});o.n.append(m,M);let C=null,u=[],h=null,y=!1,E=0,L=0,T=0,x=0,O=0,k=new Set,z="",G=new Map,q=Lo(e.root,()=>{!y&&N()&&W()}),X=!1,j=0;function H(a,v=Jr,A=!1,$=!1){y||(X=A,m.textContent=a,$?m.setAttribute("aria-hidden","true"):m.removeAttribute("aria-hidden"),m.classList.add("show"),window.clearTimeout(E),E=window.setTimeout(()=>m.classList.remove("show"),v))}function te(){X&&(X=!1,window.clearTimeout(E),m.classList.remove("show"))}function be(a){M.textContent="",cancelAnimationFrame(j),j=requestAnimationFrame(()=>M.textContent=a)}function se(a){H(Je(a))}function ae(a){throw se(a),a}let le=a=>({thread:a,location:an(a.anchor,c.get(a.id)??Tt(a.anchor,e.root),e.root)}),xe=a=>d.o!==a||d.E?!1:(h?.z()?h.W():o.n.querySelector(".launch .mode")?.focus({preventScroll:!0}),!0),Ee={reply:async(a,v)=>{try{await e.doc.reply(a,v)}catch(A){A instanceof ye?H(Wt):ae(A)}},resolve:async a=>{try{await e.doc.resolve(a),xe(a)&&(d.o=null),H("Resolved \xB7 Show resolved brings it back")}catch(v){v instanceof ye?(xe(a)&&(d.o=null),H(`Resolved \xB7 ${Wt}`)):H(Je(v))}},reopen:async a=>{try{await e.doc.reopen(a),H("Reopened")}catch(v){H(v instanceof ye?`Reopened \xB7 ${Wt}`:Je(v))}},close:()=>{ee(null);let a=we&&o.n.querySelector(we);a?a.focus({preventScroll:!0}):h?.W(),we=""},copy:a=>{try{let v=e.doc.threads().find($=>$.id===a);if(!v)return;let A=un(le(v),"ai",location.href,Date.now());Sn(A,o.n).then(()=>H("Thread copied as Markdown for AI"),$=>H(Je($)))}catch(v){H(Je(v))}}},pe={copyAll:async a=>{let v=pe.all(),A=pn(v,a,{title:document.title,url:location.href,exportedAt:new Date});try{await Sn(A,o.n);let $=v.filter(V=>!V.thread.resolved).length;H(`Copied ${$} thread${$===1?"":"s"}${a==="ai"?" as Markdown for AI":""}`)}catch($){H(Je($))}},ve:()=>{d.E=!d.E,W()},rename:async a=>{let v=a.replace(/\s+/g," ").trim();try{await f(v)?H(`New comments will say ${v}, but this browser couldn't remember it`):H(`New comments will say ${v}`)}catch(A){H(Je(A))}},name:()=>e.doc.name,all:()=>[...e.doc.threads()].sort(qe(w)).map(le)},w={doc:e.doc,root:e.root,n:o.n,host:o.element,state:d,resolved:c,te:l,D:Ee,c:pe,d:q,O:a=>k.has(a.id),ne:()=>{N()&&W()},I:a=>!d.hidden&&(!a.resolved||d.E)&&!k.has(a.id),be:(a,v)=>{for(let A of e.doc.threads()){let $=c.get(A.id);if(A.anchor.quote&&w.I(A)&&$?.range&&ao(a,v,ut($)))return A}return null},_:(a,v)=>w.T()?w.be(a,v):null,f:a=>a.composedPath().includes(o.element),X:a=>void p.add(a),pe:a=>p.has(a),open:ee,we:a=>ce(a),w:Qe,Q:$e,ue:Ke,T:()=>!C||C.se(),J:a=>{let v=C?.G();a(),v?.()},he:()=>{let a=d.t?.anchor.view,v=C?.G();Promise.resolve(q.u(a)||q.j(a??{}).then(()=>w.ne())).then(v)},ae:S,le:Te,ye:Ne,F:Ue,R:a=>{C=a},xe:H,S:be,fe:te,Z:se,Ee:I,p:W,U:re};function P(a){let v=performance.now(),A=e.doc.threads();for(let $ of A){if(a&&!a.has($.id))continue;let V=performance.now()-v<Yr,J=Tt($.anchor,e.root,{fuzzy:V});c.set($.id,J),!V&&J.state==="orphaned"?l.add($.id):l.delete($.id)}for(let $ of[...c.keys()])A.some(V=>V.id===$)||c.delete($);l.size===0?(window.clearTimeout(x),x=0):x===0&&(x=window.setTimeout(()=>{x=0,!y&&(P(new Set(l)),W())},Gr))}function N(){let a=new Set,v=q.slide()!==null,A=new Set;for(let V of e.doc.threads()){A.add(V.id);let J=c.get(V.id)?.element;(!q.u(V.anchor.view)||!v&&J?.checkVisibility?.({visibilityProperty:!0})===!1)&&a.add(V.id)}k=a;for(let V of G.keys())A.has(V)||G.delete(V);let $=`${q.slide()}|${[...a].join()}`;return $===z?!1:(z=$,!0)}function K(a){let v=[],A=[],$=[];for(let V of a){let J=c.get(V.id);V.resolved&&!d.E||!J?.range||k.has(V.id)||(V.id===d.o||V.id===d.w?A.push(J.range):V.resolved?$.push(J.range):v.push(J.range))}d.t&&q.u(d.t.anchor.view)&&A.push(...d.t.ranges),Oo({quote:v,on:A,done:$})}let Y=0,D=0,U=0;function Q(a){if(a===D)return;D=a,cancelAnimationFrame(U);let v=Y,A=performance.now(),$=a?260:200,V=J=>{let he=Math.min(1,(J-A)/$);Y=v+(a-v)*(a?1-(1-he)**3:he*he),n.Y(Y),he<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let fe=0,ke=0;function _e(a){a!==fe&&(fe=a,n.ie(a,r),window.clearTimeout(ke),ke=window.setTimeout(()=>{P(),W()},r?0:400))}function W(){if(y)return;let a=e.doc.threads();if(N(),d.o&&k.has(d.o)){let A=o.n.querySelector(`[data-thread="${d.o}"] .rbox textarea`)?.value;A&&G.set(d.o,A),d.o=null}d.hidden=!d.s&&!d.l&&!d.L&&!d.t,d.hidden&&(d.o=null),Q(d.hidden?0:1),o.n.classList.toggle("hidden",d.hidden),o.n.classList.toggle("listing",d.l);let v=d.l&&!Xe();_e(v?ft:0),n.oe(i?d.mode==="column"&&!d.hidden&&!v?gt:0:null),K(a);for(let A of u)A.p(a);h?.p(a)}let we="",Se=()=>o.n.getRootNode().activeElement,Re="input,textarea,select,[contenteditable]:not([contenteditable=false])",me=()=>{let a=Se();return a instanceof HTMLTextAreaElement&&a.value!==""||!!document.activeElement?.matches(Re)};function ce(a,v=me(),A=Se()){let $=[...o.n.querySelectorAll(`[data-thread="${a}"] .rbox textarea`)].find(J=>!J.closest("[inert]")),V=A?.getAttribute("data-thread");we=V?`.${A.classList[0]}[data-thread="${V}"]`:"",!(v||!$)&&$.focus({preventScroll:!0})}function Ie(){let a=d.t;return!a||w.T()?!1:(q.u(a.anchor.view)||q.j(a.anchor.view??{}),!0)}function ee(a,v=!1){if(a&&Ie())return;if(d.o===a&&!d.t)return a?ce(a):void 0;let A=!v&&me(),$=Se();if(a||(d.L=!1),d.o=a,a&&(d.t=null,I(a)),W(),a){let V=G.get(a),J=V&&o.n.querySelector(`[data-thread="${a}"] .rbox textarea`);J&&!J.value&&(J.value=V,J.dispatchEvent(new Event("input",{bubbles:!0}))),G.delete(a),v&&h?.z()?h.W():ce(a,A,$)}}function Qe(a){d.w!==a&&(d.w=a,a&&a!==d.o&&I(a),W())}function $e(a){te(),d.l=!1,d.t=a,d.o=null,W()}function Ke(a){if(!d.t)return $e(a);Object.assign(d.t,a),W()}function Te(){d.t&&(d.t=null,W())}function Ne(a,v=!1){d.s!==a&&(d.s=a,n.re(a),a?(d.o=null,d.l=!1,h=go(w)):(te(),h?.destroy(),h=null,be("Comment mode off")),W(),h&&(v&&h.ee(),v?h.z()?H(bn,Qr,!0,!0):H("Nothing here to comment on"):H(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${je} or Esc to finish`,Zr,!0)))}function re(){d.t&&(q.u(d.t.anchor.view)||w.T())?Te():d.o?ee(null):h&&!h.U()&&Ne(!1)}function Ue(){if(d.t){Ie()||Te();return}d.o&&ee(null)}async function f(a){try{return await e.onName(a),!1}catch(v){if(e.doc.name!==a)throw v;return!0}}async function S(a){let v=d.t;if(v)try{let A=await e.doc.comment(v.anchor,a);d.t=null,P(new Set([A])),ee(A,!0)}catch(A){if(A instanceof ye){d.t=null,P(new Set([A.id])),ee(A.id,!0),H(Wt);return}ae(A)}}function I(a){let v=c.get(a);if(!v||v.state==="orphaned")return;let A=v.range?ut(v):v.element?[v.element.getBoundingClientRect()]:[];for(let $ of A.slice(0,6)){let V=g("div",{class:"pulse"});Ve(V,$,4),o.n.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function R(){for(let a of u)a.destroy();u=ei(w),W()}let F=()=>{if(!y){for(let a of u)a.M();h?.M(),O=requestAnimationFrame(F)}},B=a=>{let v=a.composedPath()[0];return v instanceof Element&&v.closest(Re)!==null},_=a=>{if(a.key==="Escape")return re();if(ro(a)&&!a.isComposing&&!a.defaultPrevented&&!B(a)){if(a.preventDefault(),h?.ge()&&h.ee())return;Ne(!d.s,!0)}},de=a=>{if(w.f(a)||p.has(a))return;let v=window.getSelection();v&&!v.isCollapsed||Ue()},Le=()=>{let a=Bo(e.root,d.mode==="column");a!==d.mode?(d.mode=a,R()):W()};function Ae(){let a=performance.now();L===0&&(T=a),window.clearTimeout(L);let v=Math.min(Xr,Math.max(0,T+ti-a));L=window.setTimeout(()=>{L=0,P(),W()},v)}let ot=new MutationObserver(a=>{a.every(v=>o.element.contains(v.target))||Ae()});window.addEventListener("keydown",_),window.addEventListener("click",de),window.addEventListener("resize",Le),ot.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let s=typeof ResizeObserver>"u"?null:new ResizeObserver(Ae);s?.observe(e.root);let b=e.doc.onChange(()=>{P(),W()});return P(),R(),O=requestAnimationFrame(F),{ctx:w,destroy(){y=!0,cancelAnimationFrame(O),cancelAnimationFrame(U),cancelAnimationFrame(j),q.destroy(),window.clearTimeout(ke),window.clearTimeout(E),window.clearTimeout(L),window.clearTimeout(x),ot.disconnect(),s?.disconnect(),b(),window.removeEventListener("keydown",_),window.removeEventListener("click",de),window.removeEventListener("resize",Le),h?.destroy();for(let a of u)a.destroy();n.remove(),o.destroy()}}}var Ze=null,ni=4e3;function oi(e={}){if(Ze)return Ze;let t=ii(e,()=>t).catch(o=>{throw Ze===t&&(Ze=null),o});return Ze=t,t}function ri(e,t){return new Promise((o,n)=>{let r=setTimeout(()=>n(new Error("timed out")),t);e.then(o,n).finally(()=>clearTimeout(r))})}async function ii(e,t){let o=document.documentElement.getAttribute("data-pipeup-doc"),{id:n,key:r}=o?await Zt(o):{id:`page-${De(location.origin+location.pathname)}`,key:null},i,c=!1,l;if(e.store)i=e.store,l=await st(i);else try{let u=at.open();i=await ri(u,ni).catch(h=>{throw u.then(y=>y.close(),()=>{}),h}),l=await st(i)}catch{i=new it,c=!0,l=await st(i)}let p=e.name?.trim();p&&p!==l.name&&(l={...l,name:p},await i.saveProfile(l));let d=await rt.open({doc:n,key:r,store:i,identity:l.identity,name:l.name});zt(e.slides??null);let m;try{m=Do({doc:d,root:e.root??document.body,onName:async u=>{d.name=u,l={...l,name:u},await i.saveProfile(l)}})}catch(u){throw zt(null),u}c&&m.ctx.xe("This browser can't keep comments for this page \u2014 copy the comments (Copy as Markdown) to keep them");let M=()=>void d.flush().catch(u=>globalThis.reportError?.(u)),C=!1;return window.addEventListener("pagehide",M),{document:d,flush:()=>d.flush(),unmount:()=>{C||(C=!0,window.removeEventListener("pagehide",M),m.destroy(),zt(null),Ze===t()&&(Ze=null))}}}export{et as ANIMALS,ln as COLOURS,zn as DEFAULT_PROFILE_NAME,at as IndexedDbStore,it as MemoryStore,rt as PipeupDocument,ye as UnsavedChangeError,ji as VERSION,Pe as animalName,pn as copyAll,un as copyThread,jt as createIdentity,on as describeElement,nn as describeRange,tt as formatAgo,Fe as labelOf,st as loadOrCreateProfile,an as locate,oi as mount,ue as nameOf,zo as newDocumentAttribute,Dr as onReveal,Zt as parseDocumentAttribute,Tt as resolveAnchor,Br as setViewState};
|
|
9
|
+
`+t)+(e.edited?" (edited)":"")}var ji="0.4.0";function g(e,t={},...o){let n=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?n.className=String(i):n.setAttribute(r,i===!0?"":i));for(let r of o)r!=null&&r!==!1&&n.append(r);return n}function ne(e,t){let o=e.getRootNode().activeElement;t&&o instanceof HTMLElement&&e.contains(o)&&o.blur(),e.inert=t}function Ct(e,t,o=null){let n=e.getRootNode().activeElement,r=!1;for(let i=t.length;i--;o=t[i])t[i].nextSibling!==o&&(r=!!e.insertBefore(t[i],o));return r&&n&&t.some(i=>i.contains(n))&&n.focus({preventScroll:!0}),r}function ve(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function Ve(e,t,o=4){e.style.left=`${t.left-o}px`,e.style.top=`${t.top-o}px`,e.style.width=`${t.width+o*2}px`,e.style.height=`${t.height+o*2}px`}var mr=/\bhttps?:\/\/[^\s<>"'`]+/gi,hr=`.,;:!?'"]}`,gr=2048,vr=/[\u202A-\u202E\u2066-\u2069]/;function wr(e){let t=0,o=0;for(let r of e)r==="("?t++:r===")"&&o++;let n=e.length;for(;n>0;){let r=e[n-1];if(r===")"&&o>t)o--;else if(!hr.includes(r))break;n--}return e.slice(0,n)}function Pt(e){let t=[],o=0;for(let n of e.matchAll(mr)){if(n[0].length>gr||vr.test(n[0]))continue;let r=wr(n[0]),i=n.index??0,c;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;c=p.href}catch{continue}i>o&&t.push(e.slice(o,i));let l=g("a",{href:c,target:"_blank",rel:"noopener noreferrer"},r);l.addEventListener("click",p=>p.stopPropagation()),t.push(l),o=i+r.length}return o<e.length&&t.push(e.slice(o)),t}var Oe={code:"KeyC",mods:{shift:!0,alt:!0,meta:!1,ctrl:!1},mac:{label:"\u21E7\u2325C",aria:"Shift+Alt+C"},other:{label:"Shift+Alt+C",aria:"Shift+Alt+C"}},oo=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),je=(oo?Oe.mac:Oe.other).label,fn=(oo?Oe.mac:Oe.other).aria;function ro(e){return e.code===Oe.code&&e.shiftKey===Oe.mods.shift&&e.altKey===Oe.mods.alt&&e.metaKey===Oe.mods.meta&&e.ctrlKey===Oe.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var io="http://www.w3.org/2000/svg",yr={comment:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z","M12.3 8.2v6.6M9 11.5h6.6"],send:["M21 12L3.5 4.5 6.2 12l-2.7 7.5zM6.2 12H13"],copy:["M10 8h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2z","M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"],resolve:["M5 12.5l4.5 4.5L19 7.5"],reopen:["M3 12a9 9 0 1 0 3-6.7","M3 4v5h5"],lines:["M4 7h16M4 12h10M4 17h7"],list:["M3 6.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 12a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 17.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M9 6.5h11M9 12h11M9 17.5h7"],expand:["M14 4h6v6M20 4l-6 6M10 20H4v-6M4 20l6-6M20 14v6h-6M20 20l-6-6M4 10V4h6M4 4l6 6"],pin:["M6 18v-6a6 6 0 1 1 6 6z"],shrink:["M20 10h-6V4M14 10l6-6M4 14h6v6M10 14l-6 6M14 20v-6h6M14 14l6 6M10 4v6H4M10 10L4 4"],bubble:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z"],close:["M6 6l12 12M18 6L6 18"],edit:["M4 20h4L19 9l-4-4L4 16z"]};function oe(e,t=15,o){let n=mn(yr[e],t);return o&&n.setAttribute("stroke-width",String(o)),n}function mn(e,t){let o=document.createElementNS(io,"svg"),n={width:String(t),height:String(t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};for(let[r,i]of Object.entries(n))o.setAttribute(r,i);for(let r of e){let i=document.createElementNS(io,"path");i.setAttribute("d",r),o.append(i)}return o}var Ot=(e,t,o)=>`M${e} ${t}a${o} ${o} 0 1 0 ${2*o} 0a${o} ${o} 0 1 0 -${2*o} 0`,br={Otter:"M4 13.2C4 9.2 7.6 6.5 12 6.5s8 2.7 8 6.7-3.6 6.3-8 6.3-8-2.3-8-6.3zM5.6 9.6a1.8 1.8 0 1 1 2.7-2.3M18.4 9.6a1.8 1.8 0 1 0-2.7-2.3M9.2 11.6h.01M14.8 11.6h.01M11 14h2l-1 1zM9.8 15.8l-3.2.4M9.9 17l-2.7 1.1M14.2 15.8l3.2.4M14.1 17l2.7 1.1",Fox:"M3.5 4l5 3.5h7l5-3.5-1.5 8.5L12 20l-7-7.5zM9 12h.01M15 12h.01M12 17h.01",Owl:`M5 4.5l3 2.5h8l3-2.5V14a7 7 0 0 1-14 0z${Ot(7.4,11.5,1.9)}${Ot(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${Ot(5,13.5,7)}M8.9 7.22A2.8 2.8 0 1 0 5.89 10.09M18.11 10.09A2.8 2.8 0 1 0 15.1 7.22M9.4 12.6h.01M14.6 12.6h.01M10.3 16.4c0-1 .8-1.6 1.7-1.6s1.7.6 1.7 1.6-.8 1.6-1.7 1.6-1.7-.6-1.7-1.6z`,Rabbit:`${Ot(6.5,15.5,5.5)}M9.6 10.5C8.2 6.5 8.4 2.5 9.8 2.5s2.4 3.5 1.6 7.5M14.4 10.5c1.4-4 1.2-8-.2-8s-2.4 3.5-1.6 7.5M10 15h.01M14 15h.01M11.3 17.3l.7.5.7-.5`};function so(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let o=t[0].toUpperCase();return[...o].length===1?o:t[0]}var dt=(e,t)=>so(t)||Pe(e);function Ye(e,t){return g("span",{class:`av c${dn(e)}`,"aria-hidden":"true","data-animal":Pe(e)},so(t)||mn([br[et[cn(e)]]],24))}var xr=320;function Rt(e,t){setTimeout(()=>{e.remove(),t?.()},xr)}function It(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function $t(e){let t=g("textarea",{class:"input",rows:"1","aria-label":e.label}),o=g("button",{class:"send",type:"button","aria-label":"Send",title:"Send",inert:!0},oe("send")),n=g("div",{class:"row"},e.before,t,o),r=!1,i=()=>{let l=t.value.trim()!=="";o.classList.toggle("show",l),o.inert=!l,t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},c=async()=>{let l=t.value.trim();if(!(!l||r)){r=!0;try{await e.$(l),o.matches(":focus")&&t.focus(),t.value="",i()}catch{}finally{r=!1}}};return n.addEventListener("mousedown",l=>{l.target===t||o.contains(l.target)||(l.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",l=>{l.stopPropagation(),l.key==="Enter"&&!l.shiftKey&&!l.isComposing?(l.preventDefault(),c()):l.key==="Escape"&&(l.preventDefault(),t.value="",i(),t.blur(),e.N?.())}),o.addEventListener("click",l=>{l.stopPropagation(),c()}),{element:n,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Er(e){let t=g("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",y=>y.preventDefault());let o=$t({label:"Comment",before:t,$:e.$,N:e.N}),n=g("div",{class:"say"}),r=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=g("div",{class:"nf"},r),c=g("div",{class:"you"},n,i),l="",p=!1,d=()=>{let y=e.name(),E=y?"change":"add your name";if(t.title=y?"Change your name":"Add your name",!t.lastChild||l!==y){let T=Ye(e.me,y),x=t.lastChild;x?(It(T),Rt(x)):T.classList.add("in"),t.append(T),l=y}let L=g("button",{type:"button"},E);L.addEventListener("click",M),n.replaceChildren(g("span",{class:"nm"},y||`You're ${Pe(e.me)}`)," \xB7 ",L)},m=y=>{c.classList.toggle("naming",y),ne(n,y),ne(i,!y)};function M(y){y.stopPropagation(),r.value=e.name(),m(!0),r.focus({preventScroll:!0}),r.select()}let C=()=>{m(!1),o.focus()};t.addEventListener("click",M),r.addEventListener("keydown",y=>{if(y.stopPropagation(),y.key==="Escape")y.preventDefault(),C();else if(y.key==="Enter"){y.preventDefault();let E=r.value.trim();if(!E||E===e.name())return C();if(p)return;p=!0,e.rename(E).finally(()=>{p=!1,d(),C()})}}),d(),m(!1);let u=g("div",{class:"ctx"},e.label);return{element:g("div",{class:"draft"},u,o.element,c),G:()=>{let{selectionStart:y,selectionEnd:E}=o.input;return()=>{o.focus(),o.input.setSelectionRange(y,E)}},H:y=>{u.hidden=y},V:y=>{u.textContent=y},focus:()=>o.focus(),se:()=>o.input.value.trim()===""}}function Nt(e,t){let o=Er({label:t.label,me:e.doc.me,name:()=>e.c.name(),rename:n=>e.c.rename(n),$:n=>e.ae(n),N:()=>e.le()});return e.R(o),o}function Ht(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let o=t.element.getBoundingClientRect();if(!o.width&&!o.height)return null;if(e.point)return{x:o.left+e.point.x*o.width,y:o.top+e.point.y*o.height};let n=t.element.ownerDocument.createRange();n.selectNodeContents(t.element);let r=n.getBoundingClientRect();return{x:r.width?Math.min(o.right-8,r.right+6):o.right-8,y:(r.height?r.top:o.top)+8}}function ut(e){return e.range?[...e.range.getClientRects()]:[]}function hn(e,t){let o=ut(t)[0];if(o)return o.top;if(t.state==="orphaned"||!t.element)return null;let n=t.element.getBoundingClientRect();return e.point?n.top+e.point.y*n.height:n.top}function pt(e,t){let o=ut(t).at(-1);if(o)return{x:o.left,y:o.bottom,below:!0};let n=Ht(e,t);return n?{...n,below:!1}:null}function ao(e,t,o){for(let n of o)if(e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom)return!0;return!1}function lo(e,t,o=10){let n=[...e].sort((l,p)=>l.m-p.m),r=new Array(n.length).fill(0),i=n.findIndex(l=>l.id===t),c=l=>n[l];if(i<0)n.forEach((l,p)=>{r[p]=p===0?l.m:Math.max(l.m,(r[p-1]??0)+c(p-1).height+o)});else{r[i]=c(i).m;for(let l=i+1;l<n.length;l++)r[l]=Math.max(c(l).m,(r[l-1]??0)+c(l-1).height+o);for(let l=i-1;l>=0;l--)r[l]=Math.min(c(l).m,(r[l+1]??0)-c(l).height-o)}return new Map(n.map((l,p)=>[l.id,r[p]??0]))}var ft=320,Ge=300,kr=480,Xe=()=>window.innerWidth<=kr;function Bt(e){let t=window.innerWidth;return{width:e&&!Xe()?t-ft:t,height:window.innerHeight}}function Dt(e,t,o,n=12){let r,i;return e.below?(r=Math.min(e.x,o.width-t.width-n),i=e.y+8,i+t.height>o.height-n&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>o.width-n&&(r=e.x-t.width-28),i=Math.min(e.y-12,o.height-t.height-n)),{left:Math.max(n,r),top:Math.max(n,i)}}function co(e,t,o,n=12,r=44){let i=e.top-r>=8,c=e.top+e.height+8+(i?0:r),l=e.top-8-(i?r:0)-t.height,p=c+t.height<=o.height-n||l<n,d=p?c:l;return{above:!p,left:Math.max(n,Math.min(e.left,o.width-t.width-n)),top:Math.max(n,d)}}function Ft(e,t,o){let n=e.top-t.height-10;return n<8&&(n=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,o.width-t.width-8)),top:n}}function Vt(e,t){let o=e.resolved.get(t.id);return o?.range?.startContainer??o?.element??null}var qe=e=>(t,o)=>{let n=Vt(e,t),r=Vt(e,o),i=c=>c.anchor.point??{x:0,y:-1};return n!==r?!r||n&&n.compareDocumentPosition(r)&4?-1:1:i(t).y-i(o).y||i(t).x-i(o).x};var qt=e=>`${e} ${e===1?"reply":"replies"}`;function nt(e,t,o){let n={...o},r=e.id,i=g("div",{class:"rbox always"},g("div",{},$t({label:"Reply",$:E=>t.reply(r,E),N:t.close}).element)),c=g("div",{}),l=g("div",{}),p=null,d=g("div",{},l,g("div",{class:"more"},c)),m=new Map,M=new Map,C=new Map,u=E=>{let L=dt(E.author,E.name),T=m.get(E.id),x=T?.e;if((!x||T.key!==L)&&(x=It(Ye(E.author,E.name)),T)){let k=T.e;C.set(E.id,k),Rt(k,()=>C.get(E.id)===k&&C.delete(E.id))}x.title=ue(E),M.set(E.id,{key:L,e:x});let O=C.get(E.id);return O?[O,x]:[x]},h=(E,L,T)=>{let x=g("button",{class:"ib",type:"button","aria-label":L,title:L},oe(E));return x.addEventListener("click",O=>{O.stopPropagation(),T()}),x};function y(E,L={}){Object.assign(n,L),r=E.id;let T=(n.now??Date.now)(),x=E.root.replies.length,O=j=>g("span",{class:"who"},`${ue(j)} \xB7 ${tt(j.at,T)}`),k=j=>g("div",{class:j.deleted?"tx del":"tx"},...j.deleted?["Deleted"]:[...Pt(j.text),j.edited?" (edited)":""]),z=E.resolved?"Resolved"+(x?` \xB7 ${qt(x)}`:""):x?qt(x):"",G=g("div",{class:n.B==="column"&&z?"ft has-rest":"ft"},n.B==="column"&&z?g("span",{class:"rest"},z):null,g("span",{class:"hover"},O(E.root),g("span",{class:"acts"},h("copy","Copy thread",()=>t.copy(E.id)),E.resolved?h("reopen","Reopen",()=>void t.reopen(E.id)):h("resolve","Resolve",()=>void t.resolve(E.id))))),q=n.lost?g("div",{class:"ctx"},`${n.place||"No longer on the page"} \u2014 it read \u201C${ve(n.lost,120)}\u201D`):n.quote?g("div",{class:"ctx"},`\u201C${ve(n.quote,80)}\u201D`):null;M=new Map;let X=g("div",{class:"root"},...u(E.root),q,k(E.root),G);l.replaceWith(X),l=X,p?.remove(),p=x?g("div",{class:"rps"},...E.root.replies.map(j=>g("div",{class:"it"},...u(j),k(j),g("div",{class:"rft"},O(j))))):null,p&&c.prepend(p),m=M,E.resolved?i.remove():i.parentNode!==c&&c.append(i),d.className=E.resolved?"thread resolved":"thread",d.setAttribute("data-thread",E.id)}return y(e),{element:d,update:y}}var Sr="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",Tr=400;function gn(e,t){let o=new Map,n=g("div",{class:"tip",role:"tooltip"}),r=g("div",{class:"mark"}),i=g("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});n.inert=i.inert=!0,e.n.append(r,n,i);let c=g("div",{class:"bub pin ghost","aria-hidden":"true"}),l=[],p=null,d=null,m=null,M=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,C=0,u=null,h=null,y=null,E=0,L=w=>l.find(P=>P.id===w)??null,T=()=>t.q||e.state.l,x=!1,O=w=>{let P=e.resolved.get(w.id);return P?pt(w.anchor,P):null};function k(w,P,N){let{left:K,top:Y}=Dt(P,{width:w.offsetWidth||N,height:w.offsetHeight},Bt(e.state.l));w.style.left=`${K}px`,w.style.top=`${Y}px`}function z(w){let P=w&&T()&&e.state.o!==w?L(w):null,N=P?O(P):null;if(!P||!N){y=null,n.classList.remove("show"),ne(n,!0);return}if(y!==P.id){let K=P.root.replies.length;n.replaceChildren(g("div",{class:"tx clamp"},...P.root.deleted?["Deleted"]:Pt(P.root.text)),g("div",{class:"who"},`${ue(P.root)}${K?` \xB7 ${K} ${K===1?"reply":"replies"}`:""}`)),y=P.id}k(n,N,260),n.classList.contains("show")||n.offsetWidth,n.classList.add("show"),n.inert=!1}function G(w){u=w,z(w),e.w(w)}function q(w){if(window.clearTimeout(E),w!==null){G(w);return}E=window.setTimeout(()=>G(null),T()?Tr:0)}n.addEventListener("mouseenter",()=>window.clearTimeout(E)),n.addEventListener("mouseleave",()=>q(null)),n.addEventListener("click",w=>{w.stopPropagation();let P=y;P&&(window.clearTimeout(E),G(null),e.open(P))});function X(w){let P=o.get(w.id);if(P)return P;let N=g("button",{class:"bub",type:"button","data-thread":w.id});return N.addEventListener("mouseenter",()=>q(w.id)),N.addEventListener("mouseleave",()=>q(null)),N.addEventListener("click",K=>{K.stopPropagation(),z(null),e.open(w.id)}),e.n.insertBefore(N,r),o.set(w.id,N),N}let j=!1;function H(){let w=e.state.t,P=m&&w&&!w.anchor.quote&&!w.anchor.point?w.resolved.element:null;if(P){let{left:K,top:Y,above:D}=co(P.getBoundingClientRect(),{width:i.offsetWidth||Ge,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),U=m?.above!==null&&m?.above!==D;if(m&&(m.above=D),U&&be())return;i.style.left=`${K}px`,i.style.top=`${Y}px`;return}let N=m&&w?pt(w.anchor,w.resolved):p?O(p):null;N&&k(i,N,Ge)}let te=w=>e.state.s&&!w.anchor.quote&&!w.anchor.point;function be(){return window.clearTimeout(C),M?(i.classList.remove("show"),C=window.setTimeout(()=>{H(),i.classList.add("show")},220),!0):(i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function se(w){if(window.clearTimeout(C),M){i.classList.remove("show"),C=window.setTimeout(()=>{m?.i.V(w),H(),i.classList.add("show")},220);return}m?.i.V(w),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)}function ae(){if(!T())return null;let w=e.state.t;return w?w.anchor.quote||w.anchor.point||e.state.s?null:w.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function le(w){l=w;let P=new Set;for(let D of w){if(!e.I(D)||D.anchor.quote)continue;let U=e.resolved.get(D.id);if(!U||U.state==="orphaned")continue;P.add(D.id);let Q=X(D);Q.classList.toggle("done",D.resolved),Q.classList.toggle("on",e.state.o===D.id),Q.classList.toggle("pin",D.anchor.point!==void 0);let fe=`Comment on ${Fe(U.element)}: ${ve(D.root.text,60)}`;Q.getAttribute("aria-label")!==fe&&Q.setAttribute("aria-label",fe)}Ct(e.n,w.filter(D=>P.has(D.id)).sort(qe(e)).map(D=>o.get(D.id)),r);for(let[D,U]of o)P.has(D)||(U.classList.remove("in"),o.delete(D),window.setTimeout(()=>U.remove(),300));z(u),x!==e.state.l&&i.classList.contains("show")&&!M&&(window.clearTimeout(C),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)),x=e.state.l;let N=t.q?e.state.t:null;if(N){let D=N.anchor.point??N.resolved.element;m?.of!==N?(window.clearTimeout(C),i.classList.remove("glide"),m={i:Nt(e,N),of:N,at:D,above:null},m.i.H(te(N)),i.replaceChildren(m.i.element),i.inert=!1,m.i.focus(),p=null,d=null,H(),i.classList.add("show")):m&&(m.at!==D&&(m.at=D,m.above=null,se(N.label)),m.i.H(te(N)));let U=!e.d.u(N.anchor.view);U!==j&&(j=U,i.classList.toggle("show",!U),i.inert=U,U||H());return}m&&(window.clearTimeout(C),i.classList.remove("glide"),m=null,j=!1,e.R(null));let K=T()&&e.state.o?L(e.state.o):null;if(!K||!e.I(K)){p=null,d=null,i.classList.remove("show"),ne(i,!0);return}let Y=K.anchor.quote?.exact??null;!p||!d||p.id!==K.id?(d=nt(K,e.D,{B:"popover",quote:Y}),i.replaceChildren(d.element),p=K,H(),i.classList.add("show"),i.inert=!1):p!==K&&(d.update(K,{quote:Y}),p=K)}function xe(){for(let[K,Y]of o){let D=L(K),U=e.resolved.get(K),Q=D&&U?Ht(D.anchor,U):null;if(!Q||Q.y<-40||Q.y>window.innerHeight+40){Y.style.visibility="hidden";continue}Y.style.visibility="",Y.style.left=`${Q.x}px`,Y.style.top=`${Q.y}px`,Y.classList.contains("in")||(Y.offsetWidth,Y.classList.add("in"))}let w=e.state.t,P=w?.anchor.point&&e.d.u(w.anchor.view)?Ht(w.anchor,w.resolved):null;P?(c.style.left=`${P.x}px`,c.style.top=`${P.y}px`,c.classList.contains("in")||(e.n.insertBefore(c,r),c.offsetWidth,c.classList.add("in"))):c.classList.contains("in")&&(c.classList.remove("in"),window.setTimeout(()=>c.classList.contains("in")||c.remove(),300)),i.classList.contains("show")&&H();let N=ae();r.classList.toggle("show",N!==null),N&&Ve(r,N.getBoundingClientRect(),4)}let Ee=w=>{if(e.f(w)){let N=w.composedPath()[0];h!==null&&!(N instanceof Element&&N.closest(".tip,.bub"))&&q(null),h=null;return}let P=e._(w.clientX,w.clientY)?.id??null;P!==h&&(h=P,q(P))},pe=w=>{if(e.f(w))return;let P=window.getSelection();if(P&&!P.isCollapsed||(e.state.s?w.altKey:w.target instanceof Element&&w.target.closest(Sr)))return;let N=e._(w.clientX,w.clientY);N&&(e.X(w),z(null),e.open(N.id))};return window.addEventListener("pointermove",Ee,{capture:!0,passive:!0}),window.addEventListener("click",pe,!0),{p:le,M:xe,destroy(){window.clearTimeout(E),window.clearTimeout(C),window.removeEventListener("pointermove",Ee,!0),window.removeEventListener("click",pe,!0),e.R(null);for(let w of o.values())w.remove();c.remove(),n.remove(),r.remove(),i.remove()}}}var Lr="button link img figure region list listitem tab tabpanel article navigation complementary banner contentinfo form search group dialog menu menuitem checkbox switch radio slider textbox combobox option row cell heading table".split(" ").map(e=>`[role=${e}]`),Ar=["button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,figcaption,table,th,td","li,ul,ol,dl,dt,dd,p,h1,h2,h3,h4,h5,h6,blockquote,pre","section,article,aside,nav,header,footer,main,form,fieldset",...Lr].join(","),Mr="a,button,label,summary,[role=button],[role=link],[role=tab],[role=option],[role=menuitem]",Cr=.6,_t=2,vn=(e,t)=>Math.abs(e.left-t.left)<=_t&&Math.abs(e.top-t.top)<=_t&&Math.abs(e.width-t.width)<=_t&&Math.abs(e.height-t.height)<=_t;function uo(e,t){let o=t.i(e);if(o.width<2||o.height<2)return!1;if(e.hasAttribute("data-pipeup-id"))return!0;let n=t.K();return o.width*o.height<=Cr*n.width*n.height&&(e.matches(Ar)||t.ce(e)||e.childElementCount>1&&!e.parentElement?.closest(Mr)&&t.de(e))}function mt(e,t,o){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let n=null;for(let i=e;i&&i!==t&&!n;i=i.parentElement)uo(i,o)&&(n=i);if(!n||n.hasAttribute("data-pipeup-id"))return n;let r=o.i(n);for(let i=n.parentElement;i&&i!==t&&vn(o.i(i),r);i=i.parentElement)if(i.hasAttribute("data-pipeup-id"))return i;return n}function wn(e,t,o){let n=o.i(e);for(let r=e.parentElement;r&&r!==t;){let i=mt(r,t,o);if(!i)return null;if(!vn(o.i(i),n))return i;r=i.parentElement}return null}function po(e=window){return{i:t=>t.getBoundingClientRect(),ce:t=>{let o=e.getComputedStyle(t),n=o.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(o.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(o.getPropertyValue(`border-${i}-width`))>0);return n||r||o.backgroundImage!=="none"||o.boxShadow!=="none"},de:t=>/^(inline-)?(flex|grid)$/.test(e.getComputedStyle(t).display),K:()=>({width:e.innerWidth,height:e.innerHeight})}}function yn(e,t,o=()=>!0){let n=[],r=(i,c)=>{for(let l of i.children){if(l.hasAttribute("data-pipeup-ignore")||!o(l))continue;let p=c;uo(l,t)&&(c&&vn(t.i(c.e),t.i(l))?(l.hasAttribute("data-pipeup-id")||!c.e.hasAttribute("data-pipeup-id"))&&(c.e=l):n.push(p={e:l,C:c,k:0})),r(l,p)}};r(e,null);for(let i=n.length-1;i>=0;i--){let c=n[i];c.C&&(c.C.k=Math.max(c.C.k,c.k+1))}return n}var ht=(e,t)=>e.filter(o=>o.k<=t&&(!o.C||o.C.k>t)),fo=(e,t)=>e.filter(o=>o.C===t);var Kt="a,button,summary,[role=button],[role=link],[role=switch],[role=tab],[role=checkbox],input[type=checkbox],input[type=radio],input[type=submit],input[type=button],input[type=reset]",Pr=`${Kt},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,mo=["click","dblclick","auxclick","submit","contextmenu","dragstart"],ho=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],Or=400,bn="Tab moves between blocks \xB7 \u2191 \u2193 change level \xB7 Enter comments \xB7 Esc to finish \xB7 F7 selects text",Rr=150;function go(e,t=po()){let o=g("span",{hidden:!0},bn),n=g("div",{class:"pick"},o),r=[0,1].map(()=>{let s=g("div",{class:"km",tabindex:"-1",role:"button"},g("span",{hidden:!0}),g("span",{hidden:!0}));return s.inert=!0,s.addEventListener("keydown",de),s.addEventListener("click",b=>{b.stopPropagation(),_()}),s.addEventListener("focus",()=>n.classList.add("kf")),s.addEventListener("blur",()=>n.classList.remove("kf")),s}),i=g("span",{class:"lbl"}),c=(s,b,a,v)=>{let A=g("button",{class:"nb",type:"button","aria-label":s,title:b},oe(a,16));return A.addEventListener("click",$=>{$.stopPropagation(),v()}),A},l=c("Around it","Select the block around it","expand",F),p=c("Inside it","Select a block inside it","shrink",B),d=c("Pin","Pin its centre","pin",()=>e.J(()=>D(h??k,{x:.5,y:.5}))),m=g("div",{class:"namebar",role:"group","aria-label":"Chosen block"},i,l,p,d);m.inert=!0;let M=e.n.querySelector(".launch");for(let s of[n,...r,m])e.n.insertBefore(s,M);m.addEventListener("mousedown",s=>s.preventDefault());let C=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,u=null,h=null,y=null,E=null,L=0,T=()=>{},x=null,O=()=>{},k=null,z=0,G=0,q=!1,X=null,j=null,H=null,te=-1,be=!0,se=null,ae=null,le=s=>!e.f(s)&&!(s.target instanceof Element&&s.target.closest("[data-pipeup-ignore]"));function xe(){E&&(n.classList.toggle("glide",performance.now()<L),Ve(n,E.getBoundingClientRect(),4))}function Ee(){if(!x)return;m.classList.toggle("glide",performance.now()<L&&m.classList.contains("show"));let s=x.getBoundingClientRect(),{left:b,top:a}=Ft({left:s.left,top:s.top,width:s.width,height:s.height},{width:m.offsetWidth||200,height:m.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});m.style.left=`${b}px`,m.style.top=`${a}px`}function pe(s,b){E=s,L=b?performance.now()+Or:0,xe(),n.classList.add("show")}function w(s,b){let a=getComputedStyle(s);if(a.opacity==="0")return b(),()=>{};let v=0,A=()=>{window.clearTimeout(v),s.removeEventListener("transitionend",V)},$=()=>{A(),b()},V=he=>{he.target===s&&he.propertyName==="opacity"&&$()},J=Math.max(...a.transitionDuration.split(",").map(he=>parseFloat(he)*1e3||0));return v=window.setTimeout($,J+100),s.addEventListener("transitionend",V),A}function P(s){if(s!==u){if(u=s,T(),!s){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?pe(s,!1):C?(n.classList.remove("show"),T=w(n,()=>pe(s,!1))):pe(s,!0)}}function N(s){h=s,n.classList.toggle("on",s!==null),P(s),K(s)}function K(s){O(),m.inert=!s,s?C?(m.classList.remove("show"),O=w(m,()=>Y(s))):Y(s):(m.classList.remove("show"),x=null)}function Y(s){i.textContent=i.title=Fe(s),l.hidden=wn(s,e.root,t)===null,p.hidden=(k?I(s).length:yn(s,t,Ie).length)===0;let b=m.classList.contains("show");x=s,Ee(),b||(m.offsetWidth,m.classList.add("show"))}function D(s,b){let a;try{a=on(s,e.root,b,e.d.view(s))}catch($){e.Z($);return}let v={anchor:a,label:b?`Pin on ${Fe(s).replace(/^[A-Z](?=[a-z])/,$=>$.toLowerCase())}`:Fe(s),ranges:[],resolved:{state:"attached",element:s,range:null}},A=e.state.t;k&&(k=s,te=-1),N(b?null:s),y=A??{...v,ranges:[]},A?e.ue({...v,ranges:[]}):e.Q(y),e.S(b?v.label:`Commenting on ${v.label}`)}function U(s){e.J(()=>D(s))}function Q(s){let b=(s.target instanceof Element?mt(s.target,e.root,t):null)??e.root,a=b.getBoundingClientRect();a.width&&a.height&&D(b,{x:(s.clientX-a.left)/a.width,y:(s.clientY-a.top)/a.height})}function fe(s){let b=window.getSelection();if(b&&!b.isCollapsed)return;if(e.state.t&&(s.altKey||!e.T())){e.F();return}if(!s.altKey&&e._(s.clientX,s.clientY))return;if(e.state.o&&e.open(null),k&&s.detail&&f(),s.altKey){Q(s);return}let a=s.target instanceof Element?mt(s.target,e.root,t):null;a?D(a):(e.F(),N(null))}let ke=s=>{if(!e.f(s)){if(!le(s)){h||P(null);return}s.stopPropagation(),!(h||e.state.t||k)&&P(!_e()&&s.target instanceof Element?mt(s.target,e.root,t):null)}},_e=()=>{let s=window.getSelection();return!!s&&!s.isCollapsed&&s.toString().trim()!==""},W=()=>{_e()&&(k&&f(),h||P(null))},we=s=>{le(s)&&(s.stopPropagation(),(s.type==="pointerdown"||s.type==="mousedown")&&s.target instanceof Element&&s.target.closest(Pr)&&s.preventDefault())},Se=s=>{if(!le(s))return;let b=s.target;if((b===ae||b.form&&b.form===ae?.form)&&(s.type==="submit"||s.type==="click"&&!s.detail)){ae=s.type==="click"&&b.type==="submit"?b.form:null;return}s.preventDefault(),s.stopPropagation(),s.type==="click"&&!e.state.c&&!e.pe(s)&&fe(s)},Re=s=>{if(ae=null,Ae="",!(!le(s)||!(s.target instanceof Element)))if((s.key==="Enter"||s.key===" ")&&s.target.closest(Kt)){if(!k){ae=s.target;return}s.preventDefault(),s.stopPropagation()}else s.key==="Enter"&&!k&&s.target.form&&(ae=s.target)},me=()=>e.n.getRootNode().activeElement,ce=()=>r.some(s=>s===me()),Ie=s=>(s.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1||getComputedStyle(s).display==="contents")&&e.d.u(e.d.view(s)),ee=()=>(se?.some(s=>!s.e.isConnected)&&(se=null),se??=yn(e.root,t,Ie)),Qe=s=>ee().find(b=>b.e===s),$e=(s,b=!1)=>{let a=s.getBoundingClientRect();return a.bottom>0&&a.top<window.innerHeight&&(!b||a.top>=0)},Ke=()=>{let s=ht(ee(),0);return s.find(b=>$e(b.e,!0))??s.find(b=>$e(b.e))??s[0]},Te=s=>e.doc.threads().filter(b=>e.I(b)&&s.contains(Vt(e,b))).sort(qe(e));function Ne(s,b){let[a,v]=s.children,A=ht(ee(),z),$=Te(b).length;a.textContent=`${Lt(b)}, ${A.findIndex(he=>he.e===b)+1} of ${A.length}${$?`, has ${$} comment${$===1?"":"s"}`:""}`;let V=(b.innerText??b.textContent??"").length<=Rr;v.textContent=sn(b);let J=be?[o]:[];be=!1,s.ariaLabelledByElements!==void 0?(s.ariaLabelledByElements=V?[a,b]:[a,v],s.ariaDescribedByElements=V?J:[...J,b]):s.setAttribute("aria-label",`${a.textContent}, ${v.textContent}`)}function re(s,b=!0){let a=ee(),v=a.find($=>$.e===s);if(v&&!ht(a,z).includes(v)&&(z=v.k),s!==k&&(te=-1),s!==h&&(h=null),k=s,P(s),K(s),s.scrollIntoView({block:"nearest",inline:"nearest",behavior:C?"auto":"smooth"}),!b)return;e.fe();let A=r[G^=1];Ne(A,s),Ve(A,s.getBoundingClientRect(),4),A.inert=!1,A.focus({preventScroll:!0}),r[G^1].inert=!0}function Ue(){se=null;let s=document.activeElement;j=me()??s;let b=Qe(X),a=b??(s&&s!==document.body&&e.root.contains(s)&&!s.closest("[data-pipeup-ignore]")?ee().filter(v=>v.e.contains(s)).pop():void 0)??Ke();return a?(b||(z=a.k),q=!0,re(a.e),!0):!1}function f(){let s=ce();X=k,k=null,P(null),K(null);for(let b of r)ne(b,!0);return s}function S(){let s=j;s?.focus?.({preventScroll:!0}),s&&e.n.contains(s)&&me()!==s&&e.n.querySelector(".launch .mode")?.focus({preventScroll:!0})}function I(s){let b=Qe(s);return b?fo(ee(),b):[]}function R(s){let b=ht(ee(),z),a=b.findIndex(A=>A.e===k),v=b[a<0?s>0?0:b.length-1:(a+s+b.length)%b.length];v&&re(v.e)}function F(){let s=h??k,b=s&&wn(s,e.root,t);if(!b)return e.S("Nothing around it");if((!H||!s.contains(H))&&(H=s),h)return U(b);re(b)}function B(){let s=h??k,b=s?I(s):[],a=b.find(v=>H&&v.e.contains(H))??b.find(v=>$e(v.e))??b[0];if(!a)return e.S("Nothing inside it");h?U(a.e):re(a.e)}function _(s=!1){if(!k)return;if(e.state.t&&!e.T())return e.he();if(!s)return D(k);let b=Te(k);if(!b.length)return e.S("No comments on this block");te=(te+1)%b.length,e.open(b[te].id),b.length>1&&e.S(`Comment ${te+1} of ${b.length} on this block`)}function de(s){if(["Tab","ArrowUp","ArrowDown","Enter"," ","Escape"].includes(s.key)&&!(s.key.startsWith("Arrow")&&(s.metaKey||s.ctrlKey||s.altKey))){if(s.preventDefault(),s.stopPropagation(),Ae=s.key,s.key==="Escape")return void e.U();if(s.key==="Enter"||s.key===" ")return _(s.shiftKey&&s.key==="Enter");e.state.o&&e.open(null),s.key==="Tab"?R(s.shiftKey?-1:1):s.key==="ArrowUp"?F():B()}}let Le=()=>{let s=me();return s?!!s.closest("[inert]"):!document.activeElement||document.activeElement===document.body},Ae="",ot=s=>{s.key===Ae&&(Ae="",s.preventDefault(),s.stopPropagation())};window.addEventListener("keyup",ot,!0),window.addEventListener("pointermove",ke,!0),document.addEventListener("selectionchange",W);for(let s of ho)window.addEventListener(s,we,!0);for(let s of mo)window.addEventListener(s,Se,!0);return window.addEventListener("keydown",Re,!0),{U(){if(h)N(null);else if(k)f()&&S(),e.S(`Cursor put away \xB7 ${je} brings it back`);else return!1;return!0},z:()=>k!==null,ge:()=>q&&!k,ee:Ue,W(){k&&!ce()&&re(k)},p(){if(se=null,k&&!(k.isConnected&&Ie(k))){let a=Ke();a?re(a.e,ce()||Le()):f()}let s=e.n.querySelector(".launch");if(s&&m.nextElementSibling!==s&&!ce()&&!m.contains(me()))for(let a of[n,...r,m])e.n.insertBefore(a,s);let b=e.state.t;y&&b!==y?(y=null,N(null),k&&re(k,Le())):b&&!y&&(u||h)&&N(null)},M(){xe(),Ee(),k&&Ve(r[G],k.getBoundingClientRect(),4)},destroy(){f()&&S();for(let s of r)s.remove();T(),O(),window.removeEventListener("keyup",ot,!0),window.removeEventListener("pointermove",ke,!0),document.removeEventListener("selectionchange",W);for(let s of ho)window.removeEventListener(s,we,!0);for(let s of mo)window.removeEventListener(s,Se,!0);window.removeEventListener("keydown",Re,!0),n.classList.remove("show"),m.classList.remove("show"),ne(m,!0),w(n,()=>n.remove()),w(m,()=>m.remove())}}}var Ir=300,$r=32,xn=220,gt=320,Nr=24,vo=24;function En(e,t=!1){let o=e.ownerDocument.documentElement,n=o.getAttribute("data-pipeup-layout");if(n==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(n==="column"?e:null);if(!r)return null;if(o.hasAttribute("data-pipeup-reserve")){let l=o.clientWidth,d=getComputedStyle(r).maxWidth,m;return d.endsWith("px")?m=parseFloat(d):d.endsWith("%")?m=parseFloat(d)/100*l:m=r.getBoundingClientRect().width,n!=="column"&&l<m+gt-(t?Nr:0)?null:{x:l-gt+vo,width:gt-2*vo}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<Ir&&n!=="column")return null;let c=i+$r;return{x:c,width:Math.max(220,Math.min(300,window.innerWidth-c-16))}}function kn(e,t){let o=e.resolved.get(t.id);return!o||o.state==="orphaned"&&!e.te.has(t.id)}function wo(e){let t=g("div",{class:"col"});e.n.append(t);let o=new Map,n=null,r=new ResizeObserver(()=>l()),i=u=>kn(e,u);function c(u){let h=e.resolved.get(u.id),y=h?hn(u.anchor,h):null;return y===null?Number.POSITIVE_INFINITY:y+window.scrollY-4}function l(){let u=[],h=[];for(let[x,O]of o){let k=c(O.thread);if(Number.isFinite(k))O.placed=k;else if(e.te.has(x)){if(O.placed===null){O.e.classList.add("wait");continue}k=O.placed}Number.isFinite(k)?u.push({id:x,m:k,height:O.e.offsetHeight}):h.push({id:x,height:O.e.offsetHeight})}let y=e.state.t,E=y?hn(y.anchor,y.resolved):null;n&&E!==null&&u.push({id:"draft",m:E+window.scrollY-4,height:n.e.offsetHeight});let L=lo(u,n?"draft":e.state.o),T=Math.max(0,...u.map(x=>(L.get(x.id)??0)+x.height))+24;for(let x of h)L.set(x.id,T),T+=x.height+10;for(let[x,O]of o){if(O.e.classList.contains("wait")){if(!L.has(x))continue;O.e.style.transition="none",O.e.style.transform=`translateY(${Math.round(L.get(x))}px)`,O.e.offsetWidth,O.e.style.transition="",O.e.classList.remove("wait");continue}O.e.style.transform=`translateY(${Math.round(L.get(x)??0)}px)`}n&&(n.e.style.transform=`translateY(${Math.round(L.get("draft")??0)}px)`)}function p(u,h){u.thread=h,u.lost=i(h),u.view.update(h,{lost:u.lost?h.anchor.snapshot:null})}function d(u){let h=i(u),y=nt(u,e.D,{B:"column",lost:h?u.anchor.snapshot:null}),E=g("div",{class:"th","data-thread":u.id},g("button",{class:"opn sr",type:"button","data-thread":u.id}),y.element);return E.style.transition="none",E.addEventListener("mouseenter",()=>e.w(u.id)),E.addEventListener("mouseleave",()=>e.w(null)),E.addEventListener("click",()=>e.open(u.id)),t.append(E),r.observe(E),{e:E,thread:u,lost:h,placed:null,view:y}}function m(){let u=e.state.t;if(n&&u&&n.of!==u){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),xn),n=null}if(u&&n&&(n.i.V(u.label),n.i.H(e.state.s&&!u.anchor.quote&&!u.anchor.point)),u&&!n){let h=Nt(e,u),y=g("div",{class:"th on"},h.element);y.style.transition="none",t.append(y),r.observe(y),n={e:y,i:h,of:u},h.H(e.state.s&&!u.anchor.quote&&!u.anchor.point),h.focus()}else if(!u&&n){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),xn),n=null,e.R(null)}}function M(u){ne(t,e.state.l);let h=new Set,y=[],E=e.state.o!==null||e.state.t!==null;for(let L of u){if(!e.I(L))continue;h.add(L.id);let T=o.get(L.id);T?(T.thread!==L||T.lost!==i(L))&&p(T,L):(T=d(L),o.set(L.id,T),y.push(T.e));let x=T.e,O=e.state.o===L.id;x.classList.toggle("on",O);let k=x.firstElementChild,z=L.root.replies.length;k.setAttribute("aria-label",`Open thread: ${ve(L.root.text,60)}, ${qt(z)}`),k.setAttribute("aria-expanded",String(O)),ne(k,O);let G=x.querySelector(".more");G&&ne(G,!O),x.classList.toggle("dim",E&&!O),x.classList.toggle("hot",e.state.w===L.id&&!O),x.classList.toggle("resolved",L.resolved),x.classList.toggle("lost",T.lost)}for(let[L,T]of o)h.has(L)||(o.delete(L),r.unobserve(T.e),T.e.classList.add("out"),window.setTimeout(()=>T.e.remove(),xn));m(),Ct(t,u.filter(L=>h.has(L.id)).sort(qe(e)).map(L=>o.get(L.id).e),n?.e??null)&&t.offsetWidth,l(),n&&y.push(n.e);for(let L of y)L.offsetWidth,L.style.transition=""}function C(){let u=En(e.root,!0);u&&(t.style.width=`${u.width}px`,t.style.transform=`translate(${u.x}px, ${-window.scrollY}px)`)}return{p:M,M:C,destroy(){r.disconnect(),e.R(null),t.remove()}}}var yo="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function bo(e){let t=g("button",{type:"button","aria-label":"Comment",title:"Comment"},oe("comment",17)),o=g("div",{class:"selbar"},t);o.inert=!0,e.n.append(o);let n=null,r=0,i=!1,c=u=>{let h=u&&(u.nodeType===Node.ELEMENT_NODE?u:u.parentElement);return!!h&&e.root.contains(h)&&!h.closest(yo)};function l(){if(!n)return;let u=n.getBoundingClientRect(),{left:h,top:y}=Ft({left:u.left,top:u.top,width:u.width,height:u.height},{width:o.offsetWidth||36,height:o.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});o.style.left=`${h}px`,o.style.top=`${y}px`}function p(){n=null,o.inert=!0,o.classList.remove("show")}function d(u=!1){let h=window.getSelection();if(!e.state.s||!h||h.isCollapsed||h.rangeCount===0||!h.toString().trim()||!c(h.anchorNode)||!c(h.focusNode)){p();return}!n&&!u&&e.S("Enter comments on the selected words"),n=h.getRangeAt(0).cloneRange(),l(),o.inert=!1,o.classList.add("show")}t.addEventListener("mousedown",u=>u.preventDefault()),t.addEventListener("click",u=>{if(u.stopPropagation(),e.state.t&&!e.T())return e.F();let h=n;if(!h)return;let y;try{y=nn(h,e.root,e.d.view(h.commonAncestorContainer))}catch(L){e.Z(L),p();return}let E=ve(h.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),p(),e.Q({anchor:y,label:`\u201C${E}\u201D`,ranges:[h],resolved:{state:"attached",element:null,range:h}})});let m=()=>{if(window.clearTimeout(r),r=window.setTimeout(()=>i||d(),250),!n)return;let u=window.getSelection();(!u||u.isCollapsed||!u.toString().trim())&&p()};document.addEventListener("selectionchange",m);let M=u=>{u.type!=="keyup"&&(i=u.type==="mousedown"),!(i||e.f(u))&&window.setTimeout(()=>d(u.type==="mouseup"),0)};window.addEventListener("mousedown",M,!0),window.addEventListener("mouseup",M,!0),window.addEventListener("keyup",M,!0);let C=u=>{u.key!=="Enter"||!n||e.f(u)||u.target instanceof Element&&u.target.closest(`${yo},${Kt}`)||(u.preventDefault(),u.stopPropagation(),t.click())};return window.addEventListener("keydown",C,!0),{p(){!e.state.s&&n&&p()},M(){n&&l()},destroy(){window.removeEventListener("mousedown",M,!0),window.removeEventListener("mouseup",M,!0),window.removeEventListener("keyup",M,!0),window.removeEventListener("keydown",C,!0),window.clearTimeout(r),document.removeEventListener("selectionchange",m),o.remove()}}}async function Sn(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(o),o.select();let n=document.execCommand("copy");if(o.remove(),!n)throw new Error("pipeup: your browser blocked copying")}var Hr=3e3,xo="Hidden on the page";function Eo(e){let t=[g("span",{class:"n"}),g("span",{class:"n"})],o=oe("comment",20,1.4);o.lastElementChild.setAttribute("stroke-width","1.6");let n=g("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":fn,"aria-haspopup":"menu","aria-expanded":"false"},g("span",{class:"plus"},o),g("span",{class:"cnt"},oe("bubble",34,1.4),...t),g("span",{class:"dot"})),r=document.createTextNode("Comment"),i=g("span",{class:"ttip","aria-hidden":"true"},r,g("small",{},je)),c=g("div",{class:"launch"},n,i),l=g("div",{class:"menu",role:"menu","aria-label":"Comments"}),p=g("div",{class:"list",role:"menu","aria-label":"All comments"}),d=g("span",{class:"pn"}),m=g("button",{class:"ib",type:"button","aria-label":"Close"},oe("close")),M=g("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",g("span",{class:"sw","aria-hidden":"true"}));M.addEventListener("click",f=>{f.stopPropagation(),e.c.ve()});let C=g("div",{class:"all",role:"dialog","aria-label":"All comments"},g("div",{class:"hd"},g("span",{},"All comments"),d,M,m),p),u=g("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});l.inert=C.inert=u.inert=!0,e.n.append(l,c,C);let h=!1,y=null,E=0,L=[],T=0,x=null,O=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,k=f=>{h=e.state.c=f,window.clearTimeout(E),E=0,f||y?.(!0),l.classList.toggle("show",f),ne(l,!f),n.setAttribute("aria-expanded",String(f))},z=(f,S=!1)=>{e.state.l!==f&&(e.state.l=f,e.p(),f?(G(p)[0]??m).focus({preventScroll:!0}):S&&n.focus({preventScroll:!0}))},G=(f=l)=>[...f.querySelectorAll(".mi")],q=()=>l.getRootNode().activeElement,X=()=>{k(!1),n.focus({preventScroll:!0})},j=f=>{let S=G(f.currentTarget);if(S.length===0)return;let I=q(),R=S.indexOf(I),F=B=>{f.preventDefault(),S[(B+S.length)%S.length]?.focus({preventScroll:!0})};f.key==="ArrowDown"?F(R+1):f.key==="ArrowUp"?F(R<0?S.length-1:R-1):f.key==="Home"?F(0):f.key==="End"&&F(S.length-1)};l.addEventListener("keydown",j),p.addEventListener("keydown",j),m.addEventListener("click",f=>{f.stopPropagation(),z(!1,!0)});let H=f=>kn(e,f),te=()=>L.filter(f=>!f.resolved&&!e.O(f)).length,be=()=>L.filter(f=>!f.resolved&&e.O(f)).length,se=()=>L.filter(f=>!f.resolved).length,ae=f=>{let S=f.anchor.view?.slide,I=e.d.u(f.anchor.view)?"":At(f.anchor.view);return S&&e.d.slide()!==null?`On slide ${S}`:I?`In ${I}`:xo},le=(f,S,I="")=>g("div",{role:"group","aria-label":I?`${f} \xB7 ${I}`:f},g("div",{class:"sec","aria-hidden":"true"},f,I&&g("b",{},I)),...S);function xe(f,S){let I=e.d.slide(),R=new Map;for(let F of f){let B=F.thread,_=I!==null?B.anchor.view?.slide??I:e.O(B)?e.d.u(B.anchor.view)?"":At(B.anchor.view):null;R.set(_,[...R.get(_)??[],F])}if(I===null){let F=R.get(null)??[];return R.delete(null),[...F.map(S),...[...R].map(([B,_])=>le(B||xo,_.map(S)))]}return[...R].sort(([F],[B])=>Number(F)-Number(B)||0).map(([F,B])=>le(`Slide ${F} \xB7 ${B.filter(_=>!_.thread.resolved).length} open`,B.map(S),F===I?"This slide":""))}function Ee(){let f=q()?.dataset.thread,S=e.c.all().filter(B=>!B.thread.resolved||e.state.E),I=B=>{let _=B.thread,de=Ye(_.root.author,_.root.name);de.classList.add("in");let Le=g("button",{class:_.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":_.id},de,g("span",{},g("span",{class:"clamp"},_.root.deleted?"Deleted":_.root.text),g("small",{},H(_)?`\u201C${ve(_.anchor.snapshot,80)}\u201D`:B.location.where)));return Le.addEventListener("click",Ae=>{Ae.stopPropagation(),pe(_.id,Le.getBoundingClientRect().top)}),Le},R=S.filter(B=>H(B.thread));d.textContent=String(se()),M.setAttribute("aria-checked",String(e.state.E)),p.replaceChildren(S.length?"":g("div",{class:"sec",role:"presentation"},"No open comments"),...xe(S.filter(B=>!H(B.thread)),I),R.length?le("No longer on the page",R.map(I)):"");let F=G(p);f&&F.find(B=>B.dataset.thread===f)?.focus({preventScroll:!0})}function pe(f,S){Xe()&&(e.state.L=!0,z(!1)),P(f,S)}let w="";function P(f,S){let I=L.find(R=>R.id===f);if(I){if(w=f,!e.O(I))return N(I,S);if(e.state.t&&!e.T())return e.F();e.d.j(I.anchor.view??{}).then(()=>{e.ne();let R=L.find(F=>F.id===f);R&&w===f&&(e.state.l||e.state.L)&&N(R,S)})}}function N(f,S){let I=f.id,R=e.resolved.get(I),F=R&&!H(f)&&!e.O(f)?R.element??R.range?.startContainer.parentElement??null:null;if(F?.scrollIntoView({block:"center",inline:"nearest",behavior:O?"auto":"smooth"}),F&&R&&pt(f.anchor,R)&&F.checkVisibility?.({visibilityProperty:!0})!==!1){Y(),e.open(I);return}e.open(null),Xe()&&(e.state.L=!0,e.p()),K(f,S)}function K(f,S){let I=!H(f)&&e.O(f),R={quote:f.anchor.quote?.exact??null,lost:H(f)||I?f.anchor.snapshot:null,place:I?ae(f):null};if(x?.id===f.id?x.view.update(f,R):(x={id:f.id,view:nt(f,e.D,{B:"popover",...R})},u.replaceChildren(x.view.element)),S===void 0)return;u.isConnected||(e.n.insertBefore(u,C),u.offsetWidth);let F=Bt(e.state.l),{left:B,top:_}=Dt({x:F.width,y:S,below:!1},{width:Ge,height:u.offsetHeight},F);u.style.left=`${B}px`,u.style.top=`${_}px`,u.classList.add("show"),u.inert=!1,e.we(f.id)}function Y(f=!1){x&&(x=null,u.classList.remove("show"),ne(u,!0),f&&e.state.L&&(e.state.L=!1,e.p()))}function D(f,S,I,R=!1,...F){let B=g("button",{class:"mi",type:"button",role:R?"menuitemcheckbox":"menuitem"},f,g("span",{class:"lb"},S),...F,R&&g("span",{class:"sw","aria-hidden":"true"}),g("span",{class:"tt","aria-hidden":"true"}));return B.addEventListener("click",_=>{_.stopPropagation(),I(_)}),B}let U=(f,S,I,R)=>{let F=f.querySelector(".lb");F.textContent!==S&&(F.textContent=S),f.querySelector(".tt").textContent=I,f.setAttribute("aria-description",I),R!==void 0&&f.setAttribute("aria-checked",String(R))},Q=()=>g("div",{class:"sep",role:"separator"}),fe=g("span",{class:"ma"}),ke=g("span",{class:"kc"}),_e="",W=D(fe,"",$e,!1,ke);W.dataset.item="name";let we=D(oe("copy"),"Copy as Markdown",()=>{X(),e.c.copyAll("ai")}),Se=D(oe("lines"),"Copy as Text",()=>{X(),e.c.copyAll("text")}),Re=g("span",{class:"kc"}),me=D(oe("list"),"All comments",()=>{k(!1),z(!0)},!1,Re),ce=D(oe("comment"),"Start commenting",f=>{let S=!e.state.s&&f.detail===0;e.ye(!e.state.s,S),S&&k(!1)},!0,g("span",{class:"kc","aria-hidden":"true"},je));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",fn);let Ie=[W,Q(),we,Se,me,Q(),ce];function ee(){let f=se(),S=e.c.name(),I=S||Pe(e.doc.me);if(U(W,I,S?"The name on your comments":"Add a name to show on your comments"),W.setAttribute("aria-label",`${I}, ${S?"edit":"add"} your name`),ke.replaceChildren(S?oe("edit",13):"Add name"),dt(e.doc.me,S)!==_e){_e=dt(e.doc.me,S);let R=Ye(e.doc.me,S);R.classList.add("in"),fe.replaceChildren(R)}U(we,"Copy as Markdown","Markdown, with where each thread is"),U(Se,"Copy as Text","Just the words"),U(me,"All comments","Every thread, and where it is"),Re.textContent=f?String(f):"",U(ce,"Start commenting",e.state.s?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.s)}function Qe(){ee(),l.firstChild!==W&&l.replaceChildren(...Ie)}function $e(){let f=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"});f.value=e.c.name();let S=g("div",{class:"ed"},fe.cloneNode(!0),f),I=(R,F=!1)=>{if(y!==I)return;y=null;let B=f.value.trim();R&&B&&B!==e.c.name()&&e.c.rename(B).then(ee),S.replaceWith(W),F&&W.focus({preventScroll:!0})};y=I,f.addEventListener("keydown",R=>{R.stopPropagation(),(R.key==="Enter"||R.key==="Escape")&&(R.preventDefault(),I(R.key==="Enter",!0))}),f.addEventListener("blur",()=>I(!0)),W.replaceWith(S),f.focus({preventScroll:!0})}n.addEventListener("click",f=>{if(f.stopPropagation(),h){k(!1);return}Qe(),k(!0),f.detail===0&&G().at(-1)?.focus({preventScroll:!0})});let Ke=!1,Te=()=>{Ke=C.contains(q())},Ne=f=>{let S=f.composedPath();h&&!S.includes(l)&&!S.includes(n)&&(k(!1),e.state.s&&!e.f(f)&&(e.X(f),f.preventDefault(),f.stopPropagation())),e.state.l&&!e.f(f)&&z(!1,Ke&&(!document.activeElement||document.activeElement===document.body)),!S.includes(u)&&!S.includes(C)&&Y(!0)},re=f=>{if(!h||f.pointerType==="touch"||f.type==="pointerout"&&f.relatedTarget)return;let S=f.composedPath();f.type==="pointerover"&&(S.includes(l)||S.includes(n))?(window.clearTimeout(E),E=0):E||(E=window.setTimeout(()=>{E=0,y||k(!1)},Hr))};window.addEventListener("pointerdown",Te,!0),window.addEventListener("click",Ne,!0),window.addEventListener("pointerover",re,!0),window.addEventListener("pointerout",re,!0);let Ue=f=>{if(f.key!=="Escape"||y)return;let S=f.composedPath()[0];if(h)X();else if(e.state.l&&!(S instanceof HTMLTextAreaElement&&!C.contains(S)))z(!1,!0);else if(x)Y(!0),e.D.close();else return;f.stopPropagation()};return window.addEventListener("keydown",Ue,!0),{p(f){L=f;let S=te();if(S!==T){if(S){let[_,de]=t[0].classList.contains("on")?t:[t[1],t[0]];de.textContent=S>99?"99+":String(S),de.classList.toggle("s",S>99),_.classList.remove("on"),de.classList.add("on")}n.classList.toggle("has",S>0),T=S}let I=be(),R=I?`${S} here \xB7 ${I} ${e.d.slide()!==null?"on other slides":"in other views"}`:"";n.classList.toggle("else",I>0);let F=`Comment${e.state.s?", comment mode on":""}${R?`, ${R}`:S?`, ${S} open`:""}`;n.getAttribute("aria-label")!==F&&n.setAttribute("aria-label",F),r.data!==(R||"Comment")&&(r.data=R||"Comment"),n.classList.toggle("on",e.state.s),h&&ee();let B=e.state.l;if(C.classList.toggle("full",Xe()),C.classList.contains("show")!==B&&(C.classList.toggle("show",B),ne(C,!B)),B&&Ee(),x){let _=f.find(de=>de.id===x?.id);!_||e.state.o||_.resolved&&!e.state.E?Y():K(_)}},M(){},destroy(){window.removeEventListener("pointerdown",Te,!0),window.removeEventListener("click",Ne,!0),window.removeEventListener("pointerover",re,!0),window.removeEventListener("pointerout",re,!0),window.clearTimeout(E),window.removeEventListener("keydown",Ue,!0),l.remove(),C.remove(),u.remove(),c.remove()}}}var vt="[data-pipeup-slide]",ko=1e3,So=["scroll","resize","keyup","click","transitionend","slidechanged"],Tn=null,yt=null,Ut=new Set,Ln=new Set,wt=e=>{try{e()}catch(t){globalThis.reportError?.(t)}};function Br(e){let t=null;if(e){t={};let o=0;for(let[n,r]of Object.entries(e))if(!(typeof r!="string"||n==="slide"||n.length>Z.viewKey||r.length>Z.viewValue)){if(++o>=Z.viewEntries)break;t[n]=r}}Tn=t;for(let o of Ln)o()}function Dr(e){return Ut.add(e),()=>void Ut.delete(e)}function zt(e){yt=typeof e?.current=="function"&&typeof e.go=="function"?e:null}function Fr(e,t,o){let n=t.K(),r=null,i=0,c=0;for(let l of e){if(!t.shown(l))continue;let p=t.i(l),d=Math.min(p.left+p.width,n.width)-Math.max(p.left,0),m=Math.min(p.top+p.height,n.height)-Math.max(p.top,0);if(d<=0||m<=0)continue;let M=Math.round(d*m),C=t.opacity(l);(M>i||M===i&&(C>c||C===c&&l===o))&&(r=l,i=M,c=C)}return r}function Vr(e,t,o){return t!==null?e?.slide===void 0||e.slide===t:!e||!o?!0:Object.entries(e).every(([n,r])=>n==="label"||n==="slide"||o[n]===r)}function qr(){return{i:e=>e.getBoundingClientRect(),shown:e=>e.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1,opacity:e=>parseFloat(getComputedStyle(e).opacity)||0,K:()=>({width:window.innerWidth,height:window.innerHeight})}}var To=()=>{let e=window.Reveal;return typeof e?.getIndices=="function"&&typeof e.slide=="function"?e:null};function Lo(e,t,o=qr()){let n=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,r=null,i=null,c=0,l=!1,p=()=>[...e.querySelectorAll(vt)],d=()=>[...e.querySelectorAll(".slides > section")],m=T=>typeof T=="string"&&T.length>0&&T.length<=Z.viewValue?T:null,M=T=>m(T?.getAttribute("data-pipeup-slide"));function C(){if(yt){let x=null;if(wt(()=>{let O=yt.current();Number.isInteger(O)&&O>0&&(x=String(O))}),x!==null)return x}let T=To();if(T){let x=null;if(wt(()=>{let O=T.getIndices().h,k=d()[O];x=M(k?.matches(vt)?k:k?.querySelector(vt))??m(String(O+1))}),x!==null)return x}return r&&!r.isConnected&&(r=null),r=Fr(p(),o,r)??r,M(r)}function u(){c=0,i=C(),t()}let h=()=>{!c&&!l&&(c=requestAnimationFrame(u))},y=T=>Vr(T,i,Tn);function E(T){if(y(T))return Promise.resolve(!0);let x=T.slide,O=To(),k=p().find(q=>M(q)===x),z=/^[1-9]\d{0,5}$/.test(x??"");if(z&&yt)wt(()=>yt.go(Number(x)));else if(z&&O){let q=k?d().findIndex(X=>X===k||X.contains(k)):-1;wt(()=>O.slide(q>=0?q:Number(x)-1))}else if(Ut.size)for(let q of Ut)wt(()=>q({...T}));else if(k)k.scrollIntoView({block:"start",behavior:n?"auto":"smooth"});else return Promise.resolve(!1);let G=performance.now();return new Promise(q=>{let X=te=>{clearTimeout(j),q(te)},j=setTimeout(()=>X(!1),ko),H=()=>{if(l)return X(!1);if(i=C(),y(T))return X(!0);if(performance.now()-G>=ko)return X(!1);requestAnimationFrame(H)};requestAnimationFrame(H)})}let L=new MutationObserver(T=>{T.some(x=>x.target instanceof Element&&x.target.matches(vt))&&h()});L.observe(e,{subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]});for(let T of So)window.addEventListener(T,h,{capture:!0,passive:!0});return Ln.add(h),i=C(),{slide:()=>i,view(T){let x=T instanceof Element?T:T?.parentElement,O=M(x?.closest(vt))??i,k={...O!==null?{slide:O}:{},...Tn};return Object.keys(k).length?k:void 0},u:y,j:E,destroy(){l=!0,cancelAnimationFrame(c),L.disconnect();for(let T of So)window.removeEventListener(T,h,!0);Ln.delete(h)}}}var Mo=["pipeup-quote","pipeup-on","pipeup-done"],_r={"pipeup-quote":[[250,227,188,.75],[250,200,100,.28]],"pipeup-on":[[247,212,154,.95],[250,200,100,.42]],"pipeup-done":[[180,178,169,.22],[180,178,169,.2]]},Kr=(e,t)=>Mo.map(o=>{let[n,r,i,c]=_r[o][e?1:0];return`::highlight(${o}){background-color:rgba(${n},${r},${i},${+(c*t).toFixed(3)})}`}).join("");function Co(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var Ur="<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><rect x='7' y='7' width='23' height='23' rx='4' fill='none' stroke='#534AB7' stroke-width='2' stroke-dasharray='4 3'/><path d='M3 2v15l4-3.5 3 6.5 2.5-1.2-3-6.3H15z' fill='#fff' stroke='#2C2C2A' stroke-width='1.2' stroke-linejoin='round'/></svg>",zr=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(Ur)}") 3 2,crosshair!important}`;function Po(e=document,t=!1){let o=e.defaultView?.CSSStyleSheet;if(!o||!("replaceSync"in o.prototype)||!("adoptedStyleSheets"in e))return{oe(){},re(){},Y(){},ie(){},remove:()=>Ao()};let n=new o,r=null,i=!1,c=1,l=0,p="",d=0,m=()=>n.replaceSync(Kr(t,c)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?zr:"")+(l||p?`html{--pipeup-panel:${l}px;${l?`margin-right:${l}px!important;`:""}${p}}`:""));return m(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],{oe(M){M!==r&&(r=M,m())},re(M){M!==i&&(i=M,m())},Y(M){c=M,m()},ie(M,C){M!==l&&(l=M,p=C?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(d),!M&&p&&(d=window.setTimeout(()=>{p="",m()},400)),m())},remove(){clearTimeout(d),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(M=>M!==n),Ao()}}}function Oo(e){Co()&&(CSS.highlights.set("pipeup-quote",new Highlight(...e.quote)),CSS.highlights.set("pipeup-on",new Highlight(...e.on)),CSS.highlights.set("pipeup-done",new Highlight(...e.done)))}function Ao(){if(Co())for(let e of Mo)CSS.highlights.delete(e)}var An=':host{all:initial}*{box-sizing:border-box}button{-webkit-appearance:none;appearance:none;font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}svg{display:block}.layer{all:initial;display:block;position:fixed;inset:0;pointer-events:none;font:13px/1.5 var(--pu-font,system-ui,sans-serif);color:var(--k);--k:#2C2C2A;--mu:#5F5E5A;--fa:#888780;--ln:#E5E3DA;--ru:#ECEAE2;--so:#FAFAF7;--su:#FFFFFF;--ho:#F1EFE8;--as:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--sh:0 8px 28px rgba(44,44,42,.1);--in:.26s;--mv:.34s;--out:.2s;--pl:1.2s;--eo:cubic-bezier(.22,.61,.36,1);--eio:cubic-bezier(.4,0,.2,1);--ei:cubic-bezier(.4,0,1,1)}.layer.dark{--k:#ECEBE6;--mu:#B4B2A9;--fa:#8D8B84;--ln:#3A3936;--ru:#34332F;--so:#22221F;--su:#1B1B19;--ho:#2C2C29;--sh:0 8px 28px rgba(0,0,0,.45)}.layer.hidden .bub,.layer.hidden .col,.layer.hidden .pop,.layer.hidden .tip,.layer.hidden .mark,.layer.hidden .selbar{opacity:0!important;pointer-events:none!important}.tx{font-size:14px;line-height:1.5;color:var(--k);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--fa)}.who,.rest{font-size:12px}.who{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rft>.who{display:block}.ctx[hidden]{display:none}.ctx{font-size:12px;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.tx a{color:var(--pu-accent);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.ft,.rft{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows var(--in) var(--eo),opacity var(--in) var(--eo)}.ft>*,.rft>*{overflow:hidden;min-height:0;display:flex;align-items:center}.root:hover>.ft,.root:focus-within>.ft,.it:hover>.rft,.it:focus-within>.rft{grid-template-rows:1fr;opacity:1}.ft.has-rest{grid-template-rows:1fr;opacity:1}.ft.has-rest>*{grid-area:1/1}.ft .hover{opacity:0;transition:opacity var(--in) var(--eo)}.ft .rest{transition:opacity var(--in) var(--eo)}.root:hover>.ft .hover,.root:focus-within>.ft .hover,.ft:not(.has-rest) .hover{opacity:1}.root:hover>.ft .rest,.root:focus-within>.ft .rest{opacity:0}.acts{margin-left:6px;display:flex;flex:none}.ib{width:24px;height:22px;display:grid;place-items:center;border-radius:6px;color:var(--mu);transition:background-color .2s var(--eo),color .2s var(--eo)}.ib:hover,.ib:focus-visible{background:var(--ho);color:var(--k);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--mv) var(--eio)}.more>div{overflow:hidden;min-height:0}.th:not(.on) .more{grid-template-rows:0fr}.row{display:flex;align-items:center;gap:8px;padding:8px 0 2px;cursor:text}.input{flex:1;min-width:0;height:27px;display:block;border:0;border-bottom:1px solid var(--ln);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--k);background:transparent;transition:border-color var(--in) var(--eo)}.row:hover .input,.input:hover{border-bottom-color:var(--mu)}.input:focus{border-bottom-color:var(--pu-accent)}.ed{display:flex;gap:10px;align-items:center;min-height:34px;padding:6px 10px}.ed .input{font-size:13px;height:22px}.root,.it{position:relative;padding-right:30px}.av{display:grid;place-items:center;width:22px;height:22px;border-radius:32%;font-size:12px;font-weight:600;line-height:1;opacity:0;transform:scale(.85);transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.av.in{opacity:1;transform:none}.av svg{width:80%;height:80%}.root>.av,.it>.av{position:absolute;top:0;right:0}.it>.av{top:6px}.av{--av-l:92%;--av-d:30%;--s:60%;background:hsl(var(--h) var(--s) var(--av-l));color:hsl(var(--h) var(--s) var(--av-d))}.dark .av{--av-l:20%;--av-d:78%}.c0{--h:0}.c1{--h:25}.c2{--h:50}.c3{--h:130}.c4{--h:175}.c5{--h:215}.c6{--h:270}.c7{--h:330}.c8{--h:28;--s:35%}.c9{--h:220;--s:8%}.me{flex:none;display:grid}.me>.av{grid-area:1/1;width:26px;height:26px;font-size:13px}.you{display:grid;padding:0 34px;min-height:24px;font-size:12px;color:var(--fa)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.say{white-space:pre;overflow:hidden}.nm{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.say button{flex:none}.say button{color:var(--mu);text-decoration:underline;text-decoration-color:var(--ln);text-underline-offset:2px;transition:color .2s var(--eo)}.say button:hover,.say button:focus-visible{color:var(--pu-accent);outline:none}.nf{opacity:0;transform:translateY(-4px);pointer-events:none}.nf .input{font-size:13px;height:24px}.you.naming .nf{opacity:1;transform:none;pointer-events:auto}.you.naming .say{opacity:0;pointer-events:none}.send{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;color:var(--pu-accent);flex:none;opacity:0;pointer-events:none;transition:opacity var(--in) var(--eo),background-color .2s var(--eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--as)}.bub{position:fixed;left:0;top:0;width:20px;height:20px;margin:-20px 0 0 -2px;border-radius:50% 50% 50% 0;background:var(--pu-accent);border:2px solid var(--su);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--fa)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--eo),transform .26s var(--eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--eo),transform .26s var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.pop{position:fixed;width:var(--pu-pop);border-radius:12px;padding:10px 12px 8px;pointer-events:none;opacity:0;transform:translateY(6px) scale(.98);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.pop.show.glide{transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--as);border-radius:8px;opacity:0;transition:opacity .3s var(--eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--as);animation:pu-pulse var(--pl) var(--eio) forwards}@keyframes pu-pulse{0%{opacity:0;transform:scale(.985)}35%{opacity:.85;transform:scale(1)}to{opacity:0;transform:scale(1.02)}}.col{position:fixed;left:0;top:0;pointer-events:none;transition:opacity var(--in) var(--eo)}.th{position:absolute;left:0;right:0;top:0;padding:4px 4px 4px 12px;pointer-events:auto;cursor:pointer;box-shadow:inset 2px 0 0 transparent;transition:transform var(--mv) var(--eio),box-shadow var(--in) var(--eo),opacity var(--in) var(--eo)}.th.hot{box-shadow:inset 2px 0 0 var(--ln)}.th.on{box-shadow:inset 2px 0 0 var(--pu-accent);cursor:default}.th.dim{opacity:.45}.th.resolved:not(.on):not(.hot){opacity:.6}.th.lost .ctx{white-space:normal}.th.wait{opacity:0!important;pointer-events:none}.th.out{opacity:0!important;pointer-events:none;transition:opacity var(--out) var(--ei)}.th:has(.opn:focus-visible){box-shadow:inset 2px 0 0 var(--ln);outline:2px solid var(--pu-accent);outline-offset:2px;border-radius:4px}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.selbar.show{opacity:1;transform:none;pointer-events:auto}.selbar button{width:32px;height:30px;display:grid;place-items:center;border-radius:8px;color:var(--pu-accent);transition:background-color .2s var(--eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--as);outline:none}.pick{position:fixed;left:0;top:0;border:2px solid color-mix(in srgb,var(--pu-accent) 70%,transparent);background:color-mix(in srgb,var(--pu-accent) 6%,transparent);border-radius:8px;pointer-events:none;opacity:0;transition:opacity var(--out) var(--ei),border-color var(--out) var(--ei),border-width var(--out) var(--ei),box-shadow var(--out) var(--ei)}.pick.show{opacity:1;transition-duration:var(--in);transition-timing-function:var(--eo)}.pick.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.pick.on{border-color:var(--pu-accent)}.pick.kf{border:3px solid var(--pu-accent);box-shadow:0 0 0 2px var(--su)}.km{position:fixed;left:0;top:0;pointer-events:none;outline:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.namebar{position:fixed;left:0;top:0;display:flex;align-items:center;gap:2px;padding:2px 2px 2px 10px;border-radius:10px;font-size:12px;color:var(--mu);white-space:nowrap;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.namebar .lbl{margin-right:6px;max-width:260px;overflow:hidden;text-overflow:ellipsis}.namebar .nb{padding:4px;display:grid;place-items:center;border-radius:7px;transition:background-color .2s var(--eo),color .2s var(--eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--ho);color:var(--k);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{position:relative;display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);transition:background-color .3s var(--eo),color .3s var(--eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--in) var(--eo)}.cnt,.has>.plus{opacity:0}.has>.cnt{opacity:1}.n{font-size:12px;font-weight:500;line-height:1;margin:-1.4px 0 0 1.4px;font-variant-numeric:tabular-nums;opacity:0;transition:opacity var(--in) var(--eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--ho)}.launch .mode.on{background:var(--pu-accent);color:#fff}.mode>.dot{position:absolute;top:3px;right:3px;width:9px;height:9px;border-radius:50%;background:var(--pu-accent);border:2px solid var(--su);opacity:0}.mode.else>.dot{opacity:1}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--fa)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--out) var(--ei)}@media(hover:none){.ttip,.tt{display:none}}.menu{position:fixed;right:20px;bottom:76px;width:290px;border-radius:12px;padding:4px;pointer-events:none;opacity:0;transform:translateY(6px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.mi{position:relative;display:flex;gap:10px;align-items:center;width:100%;min-height:34px;text-align:left;padding:6px 10px;border-radius:8px;transition:background-color .2s var(--eo)}.mi:hover,.mi:focus-visible{background:var(--so);outline:none}.mi svg{color:var(--mu);flex:none}.mi small{display:block;color:var(--fa);font-size:12px}.lb{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ma{flex:none;display:grid;margin:-2px 0}.ma .av{width:20px;height:20px;font-size:11px}.mi .av svg{color:inherit}.sep{height:1px;margin:4px 10px;background:var(--ru)}.tt{position:absolute;right:calc(100% + 14px);top:50%;translate:0 -50%;width:max-content;max-width:220px;padding:4px 9px;border-radius:8px;font-size:12px;line-height:1.4;color:var(--mu);background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}@media(max-width:600px){.tt{right:8px;top:auto;bottom:100%;translate:none;transform:translateY(3px)}}.sw{position:relative;flex:none;width:26px;height:16px;border-radius:8px;background:var(--ln);transition:background-color var(--mv) var(--eio)}.sw:before,.sw:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 2px #00000040;transition:transform var(--mv) var(--eio),opacity var(--mv) var(--eio)}.sw:before{opacity:0;transform:translate(10px)}[aria-checked=true]>.sw{background:var(--pu-accent)}[aria-checked=true]>.sw:after{transform:translate(10px)}.all{position:fixed;top:0;right:0;bottom:0;width:var(--pu-panel);display:flex;flex-direction:column;border-width:0 0 0 1px;opacity:0;transform:translate(100%);transition:transform var(--out) var(--ei),opacity var(--out) var(--ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--mv) var(--eo),opacity var(--in) var(--eo)}.all.full{width:100%}.hd{display:flex;align-items:center;gap:8px;padding:12px 10px 8px 16px;font-weight:600}.pn{font-weight:400;color:var(--fa)}.hs{margin-left:auto;display:flex;align-items:center;gap:6px;padding:3px 4px 3px 6px;border-radius:6px;font-size:12px;font-weight:400;color:var(--mu);transition:background-color .2s var(--eo)}.hs:hover,.hs:focus-visible{background:var(--ho);outline:none}.list{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:4px}.all .mi{align-items:flex-start}.all .mi>.av{flex:none}.all .mi>span:last-child{flex:1;min-width:0}.all .mi small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.all .mi .av svg{margin:0}.all .mi.done{opacity:.6}.layer.listing .col{opacity:0;transition:opacity var(--out) var(--ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--fa)}.sec b{margin-left:6px;font-weight:500;color:var(--pu-accent)}.toast{position:fixed;left:50%;bottom:28px;border-radius:10px;padding:8px 14px;font-size:13px;opacity:0;transform:translate(-50%,6px);transition:opacity .3s var(--eo),transform .36s var(--eo)}.toast.show{opacity:1;transform:translate(-50%)}@media(forced-colors:active){.pick.kf{border:3px solid Highlight}.layer :is(.ib,.mi,.nb,.hs,.selbar button,.say button):focus-visible{outline:2px solid Highlight}}@media(prefers-reduced-motion:reduce){.bub,.bub.in,.bub.in:hover,.bub.on,.tip,.pop,.selbar,.menu,.all,.ttip,.tt,.toast{transform:none!important}.sw:after{transform:none!important;transition-property:opacity}[aria-checked=true]>.sw:after{opacity:0}[aria-checked=true]>.sw:before{opacity:1}.th{transition-property:opacity,box-shadow}.tip.show{transition-property:opacity}.pick,.pick.show{transition:opacity .16s ease-in-out}.all,.all.show{transition-property:opacity}.namebar,.namebar.show{transform:none!important;transition:opacity .16s ease-in-out}.av,.nf{transform:none!important}@keyframes pu-pulse{0%{opacity:0}35%{opacity:.85}to{opacity:0}}}';var Ro="#534AB7",Wr="rgb(0, 0, 238)";function Io(e){let t=/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)/.exec(e);if(!t||t[1]===void 0||t[2]===void 0||t[3]===void 0)return null;let o=t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]);return{r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:o}}function jr(e){let t=o=>{let n=o/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function $o(e){let t=e.ownerDocument,o=t.defaultView;if(!o)return{font:"system-ui, sans-serif",accent:Ro,dark:!1};let n=t.documentElement,r=o.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(o.getComputedStyle(n).getPropertyValue("--pipeup-accent")||n.style.getPropertyValue("--pipeup-accent")).trim(),c=e.querySelector("a[href]"),l=c?o.getComputedStyle(c).color:"",p=i||(l&&l!==Wr?l:Ro),d=Io(o.getComputedStyle(t.body).backgroundColor);(!d||d.a===0)&&(d=Io(o.getComputedStyle(n).backgroundColor));let m=d&&d.a>0?jr(d)<.2:o.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(o.getComputedStyle(n).colorScheme||"");return{font:r,accent:p,dark:!!m}}function No(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function Ho(e,t=document){let o=t.createElement("pipeup-root");o.setAttribute("data-pipeup-ignore",""),o.style.cssText="position:fixed!important;inset:0!important;pointer-events:none!important;z-index:2147483000!important;display:block!important;margin:0!important;visibility:visible!important;opacity:1!important;transform:none!important;filter:none!important;";let n=o.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in n){let c=new r;c.replaceSync(An),n.adoptedStyleSheets=[c]}else{let c=t.createElement("style");c.textContent=An,n.append(c)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${ft}px`),i.style.setProperty("--pu-pop",`${Ge}px`),No(i,e),n.append(i),t.documentElement.append(o),{element:o,shadow:n,n:i,destroy:()=>o.remove()}}var Yr=40,Gr=250,Xr=120,Jr=2400,Zr=4e3,Qr=1e4;function Bo(e,t=!1){return En(e,t)?"column":"bubbles"}function ei(e){return[...e.state.mode==="column"?[wo(e),gn(e,{q:!1})]:[gn(e,{q:!0})],bo(e),Eo(e)]}var ti=1e3,Wt="Shown here, but not saved yet \u2014 it will be saved with your next change",Je=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function Do(e){let t=$o(e.root),o=Ho(t),n=Po(document,t.dark);n.Y(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),c=new Map,l=new Set,p=new WeakSet,d={o:null,w:null,E:!1,hidden:!0,mode:Bo(e.root),t:null,s:!1,l:!1,L:!1,c:!1},m=g("div",{class:"toast",role:"status","aria-live":"polite"}),M=g("div",{class:"sr","aria-live":"polite"});o.n.append(m,M);let C=null,u=[],h=null,y=!1,E=0,L=0,T=0,x=0,O=0,k=new Set,z="",G=new Map,q=Lo(e.root,()=>{!y&&N()&&W()}),X=!1,j=0;function H(a,v=Jr,A=!1,$=!1){y||(X=A,m.textContent=a,$?m.setAttribute("aria-hidden","true"):m.removeAttribute("aria-hidden"),m.classList.add("show"),window.clearTimeout(E),E=window.setTimeout(()=>m.classList.remove("show"),v))}function te(){X&&(X=!1,window.clearTimeout(E),m.classList.remove("show"))}function be(a){M.textContent="",cancelAnimationFrame(j),j=requestAnimationFrame(()=>M.textContent=a)}function se(a){H(Je(a))}function ae(a){throw se(a),a}let le=a=>({thread:a,location:an(a.anchor,c.get(a.id)??Tt(a.anchor,e.root),e.root)}),xe=a=>d.o!==a||d.E?!1:(h?.z()?h.W():o.n.querySelector(".launch .mode")?.focus({preventScroll:!0}),!0),Ee={reply:async(a,v)=>{try{await e.doc.reply(a,v)}catch(A){A instanceof ye?H(Wt):ae(A)}},resolve:async a=>{try{await e.doc.resolve(a),xe(a)&&(d.o=null),H("Resolved \xB7 Show resolved brings it back")}catch(v){v instanceof ye?(xe(a)&&(d.o=null),H(`Resolved \xB7 ${Wt}`)):H(Je(v))}},reopen:async a=>{try{await e.doc.reopen(a),H("Reopened")}catch(v){H(v instanceof ye?`Reopened \xB7 ${Wt}`:Je(v))}},close:()=>{ee(null);let a=we&&o.n.querySelector(we);a?a.focus({preventScroll:!0}):h?.W(),we=""},copy:a=>{try{let v=e.doc.threads().find($=>$.id===a);if(!v)return;let A=un(le(v),"ai",location.href,Date.now());Sn(A,o.n).then(()=>H("Thread copied as Markdown for AI"),$=>H(Je($)))}catch(v){H(Je(v))}}},pe={copyAll:async a=>{let v=pe.all(),A=pn(v,a,{title:document.title,url:location.href,exportedAt:new Date});try{await Sn(A,o.n);let $=v.filter(V=>!V.thread.resolved).length;H(`Copied ${$} thread${$===1?"":"s"}${a==="ai"?" as Markdown for AI":""}`)}catch($){H(Je($))}},ve:()=>{d.E=!d.E,W()},rename:async a=>{let v=a.replace(/\s+/g," ").trim();try{await f(v)?H(`New comments will say ${v}, but this browser couldn't remember it`):H(`New comments will say ${v}`)}catch(A){H(Je(A))}},name:()=>e.doc.name,all:()=>[...e.doc.threads()].sort(qe(w)).map(le)},w={doc:e.doc,root:e.root,n:o.n,host:o.element,state:d,resolved:c,te:l,D:Ee,c:pe,d:q,O:a=>k.has(a.id),ne:()=>{N()&&W()},I:a=>!d.hidden&&(!a.resolved||d.E)&&!k.has(a.id),be:(a,v)=>{for(let A of e.doc.threads()){let $=c.get(A.id);if(A.anchor.quote&&w.I(A)&&$?.range&&ao(a,v,ut($)))return A}return null},_:(a,v)=>w.T()?w.be(a,v):null,f:a=>a.composedPath().includes(o.element),X:a=>void p.add(a),pe:a=>p.has(a),open:ee,we:a=>ce(a),w:Qe,Q:$e,ue:Ke,T:()=>!C||C.se(),J:a=>{let v=C?.G();a(),v?.()},he:()=>{let a=d.t?.anchor.view,v=C?.G();Promise.resolve(q.u(a)||q.j(a??{}).then(()=>w.ne())).then(v)},ae:S,le:Te,ye:Ne,F:Ue,R:a=>{C=a},xe:H,S:be,fe:te,Z:se,Ee:I,p:W,U:re};function P(a){let v=performance.now(),A=e.doc.threads();for(let $ of A){if(a&&!a.has($.id))continue;let V=performance.now()-v<Yr,J=Tt($.anchor,e.root,{fuzzy:V});c.set($.id,J),!V&&J.state==="orphaned"?l.add($.id):l.delete($.id)}for(let $ of[...c.keys()])A.some(V=>V.id===$)||c.delete($);l.size===0?(window.clearTimeout(x),x=0):x===0&&(x=window.setTimeout(()=>{x=0,!y&&(P(new Set(l)),W())},Gr))}function N(){let a=new Set,v=q.slide()!==null,A=new Set;for(let V of e.doc.threads()){A.add(V.id);let J=c.get(V.id)?.element;(!q.u(V.anchor.view)||!v&&J?.checkVisibility?.({visibilityProperty:!0})===!1)&&a.add(V.id)}k=a;for(let V of G.keys())A.has(V)||G.delete(V);let $=`${q.slide()}|${[...a].join()}`;return $===z?!1:(z=$,!0)}function K(a){let v=[],A=[],$=[];for(let V of a){let J=c.get(V.id);V.resolved&&!d.E||!J?.range||k.has(V.id)||(V.id===d.o||V.id===d.w?A.push(J.range):V.resolved?$.push(J.range):v.push(J.range))}d.t&&q.u(d.t.anchor.view)&&A.push(...d.t.ranges),Oo({quote:v,on:A,done:$})}let Y=0,D=0,U=0;function Q(a){if(a===D)return;D=a,cancelAnimationFrame(U);let v=Y,A=performance.now(),$=a?260:200,V=J=>{let he=Math.min(1,(J-A)/$);Y=v+(a-v)*(a?1-(1-he)**3:he*he),n.Y(Y),he<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let fe=0,ke=0;function _e(a){a!==fe&&(fe=a,n.ie(a,r),window.clearTimeout(ke),ke=window.setTimeout(()=>{P(),W()},r?0:400))}function W(){if(y)return;let a=e.doc.threads();if(N(),d.o&&k.has(d.o)){let A=o.n.querySelector(`[data-thread="${d.o}"] .rbox textarea`)?.value;A&&G.set(d.o,A),d.o=null}d.hidden=!d.s&&!d.l&&!d.L&&!d.t,d.hidden&&(d.o=null),Q(d.hidden?0:1),o.n.classList.toggle("hidden",d.hidden),o.n.classList.toggle("listing",d.l);let v=d.l&&!Xe();_e(v?ft:0),n.oe(i?d.mode==="column"&&!d.hidden&&!v?gt:0:null),K(a);for(let A of u)A.p(a);h?.p(a)}let we="",Se=()=>o.n.getRootNode().activeElement,Re="input,textarea,select,[contenteditable]:not([contenteditable=false])",me=()=>{let a=Se();return a instanceof HTMLTextAreaElement&&a.value!==""||!!document.activeElement?.matches(Re)};function ce(a,v=me(),A=Se()){let $=[...o.n.querySelectorAll(`[data-thread="${a}"] .rbox textarea`)].find(J=>!J.closest("[inert]")),V=A?.getAttribute("data-thread");we=V?`.${A.classList[0]}[data-thread="${V}"]`:"",!(v||!$)&&$.focus({preventScroll:!0})}function Ie(){let a=d.t;return!a||w.T()?!1:(q.u(a.anchor.view)||q.j(a.anchor.view??{}),!0)}function ee(a,v=!1){if(a&&Ie())return;if(d.o===a&&!d.t)return a?ce(a):void 0;let A=!v&&me(),$=Se();if(a||(d.L=!1),d.o=a,a&&(d.t=null,I(a)),W(),a){let V=G.get(a),J=V&&o.n.querySelector(`[data-thread="${a}"] .rbox textarea`);J&&!J.value&&(J.value=V,J.dispatchEvent(new Event("input",{bubbles:!0}))),G.delete(a),v&&h?.z()?h.W():ce(a,A,$)}}function Qe(a){d.w!==a&&(d.w=a,a&&a!==d.o&&I(a),W())}function $e(a){te(),d.l=!1,d.t=a,d.o=null,W()}function Ke(a){if(!d.t)return $e(a);Object.assign(d.t,a),W()}function Te(){d.t&&(d.t=null,W())}function Ne(a,v=!1){d.s!==a&&(d.s=a,n.re(a),a?(d.o=null,d.l=!1,h=go(w)):(te(),h?.destroy(),h=null,be("Comment mode off")),W(),h&&(v&&h.ee(),v?h.z()?H(bn,Qr,!0,!0):H("Nothing here to comment on"):H(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${je} or Esc to finish`,Zr,!0)))}function re(){d.t&&(q.u(d.t.anchor.view)||w.T())?Te():d.o?ee(null):h&&!h.U()&&Ne(!1)}function Ue(){if(d.t){Ie()||Te();return}d.o&&ee(null)}async function f(a){try{return await e.onName(a),!1}catch(v){if(e.doc.name!==a)throw v;return!0}}async function S(a){let v=d.t;if(v)try{let A=await e.doc.comment(v.anchor,a);d.t=null,P(new Set([A])),ee(A,!0)}catch(A){if(A instanceof ye){d.t=null,P(new Set([A.id])),ee(A.id,!0),H(Wt);return}ae(A)}}function I(a){let v=c.get(a);if(!v||v.state==="orphaned")return;let A=v.range?ut(v):v.element?[v.element.getBoundingClientRect()]:[];for(let $ of A.slice(0,6)){let V=g("div",{class:"pulse"});Ve(V,$,4),o.n.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function R(){for(let a of u)a.destroy();u=ei(w),W()}let F=()=>{if(!y){for(let a of u)a.M();h?.M(),O=requestAnimationFrame(F)}},B=a=>{let v=a.composedPath()[0];return v instanceof Element&&v.closest(Re)!==null},_=a=>{if(a.key==="Escape")return re();if(ro(a)&&!a.isComposing&&!a.defaultPrevented&&!B(a)){if(a.preventDefault(),h?.ge()&&h.ee())return;Ne(!d.s,!0)}},de=a=>{if(w.f(a)||p.has(a))return;let v=window.getSelection();v&&!v.isCollapsed||Ue()},Le=()=>{let a=Bo(e.root,d.mode==="column");a!==d.mode?(d.mode=a,R()):W()};function Ae(){let a=performance.now();L===0&&(T=a),window.clearTimeout(L);let v=Math.min(Xr,Math.max(0,T+ti-a));L=window.setTimeout(()=>{L=0,P(),W()},v)}let ot=new MutationObserver(a=>{a.every(v=>o.element.contains(v.target))||Ae()});window.addEventListener("keydown",_),window.addEventListener("click",de),window.addEventListener("resize",Le),ot.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let s=typeof ResizeObserver>"u"?null:new ResizeObserver(Ae);s?.observe(e.root);let b=e.doc.onChange(()=>{P(),W()});return P(),R(),O=requestAnimationFrame(F),{ctx:w,destroy(){y=!0,cancelAnimationFrame(O),cancelAnimationFrame(U),cancelAnimationFrame(j),q.destroy(),window.clearTimeout(ke),window.clearTimeout(E),window.clearTimeout(L),window.clearTimeout(x),ot.disconnect(),s?.disconnect(),b(),window.removeEventListener("keydown",_),window.removeEventListener("click",de),window.removeEventListener("resize",Le),h?.destroy();for(let a of u)a.destroy();n.remove(),o.destroy()}}}var Ze=null,ni=4e3;function oi(e={}){if(Ze)return Ze;let t=ii(e,()=>t).catch(o=>{throw Ze===t&&(Ze=null),o});return Ze=t,t}function ri(e,t){return new Promise((o,n)=>{let r=setTimeout(()=>n(new Error("timed out")),t);e.then(o,n).finally(()=>clearTimeout(r))})}async function ii(e,t){let o=document.documentElement.getAttribute("data-pipeup-doc"),{id:n,key:r}=o?await Zt(o):{id:`page-${De(location.origin+location.pathname)}`,key:null},i,c=!1,l;if(e.store)i=e.store,l=await st(i);else try{let u=at.open();i=await ri(u,ni).catch(h=>{throw u.then(y=>y.close(),()=>{}),h}),l=await st(i)}catch{i=new it,c=!0,l=await st(i)}let p=e.name?.trim();p&&p!==l.name&&(l={...l,name:p},await i.saveProfile(l));let d=await rt.open({doc:n,key:r,store:i,identity:l.identity,name:l.name});zt(e.slides??null);let m;try{m=Do({doc:d,root:e.root??document.body,onName:async u=>{d.name=u,l={...l,name:u},await i.saveProfile(l)}})}catch(u){throw zt(null),u}c&&m.ctx.xe("This browser can't keep comments for this page \u2014 copy the comments (Copy as Markdown) to keep them");let M=()=>void d.flush().catch(u=>globalThis.reportError?.(u)),C=!1;return window.addEventListener("pagehide",M),{document:d,flush:()=>d.flush(),unmount:()=>{C||(C=!0,window.removeEventListener("pagehide",M),m.destroy(),zt(null),Ze===t()&&(Ze=null))}}}export{et as ANIMALS,ln as COLOURS,zn as DEFAULT_PROFILE_NAME,at as IndexedDbStore,it as MemoryStore,rt as PipeupDocument,ye as UnsavedChangeError,ji as VERSION,Pe as animalName,pn as copyAll,un as copyThread,jt as createIdentity,on as describeElement,nn as describeRange,tt as formatAgo,Fe as labelOf,st as loadOrCreateProfile,an as locate,oi as mount,ue as nameOf,zo as newDocumentAttribute,Dr as onReveal,Zt as parseDocumentAttribute,Tt as resolveAnchor,Br as setViewState};
|
package/dist/pipeup.min.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
`}function io(e){let{thread:t,location:o}=e,n=[ie(o.where)+(o.quote?`, on the text "${ie(o.quote)}"`:""),`${ie(ue(t.root))}: ${$t(t.root," ")}`];for(let r of t.root.replies)n.push(` ${ie(ue(r))}: ${$t(r," ")}`);return n.join(`
|
|
7
7
|
`)+`
|
|
8
8
|
`}function $t(e,t){return e.deleted?"(deleted)":e.text.replace(/\r\n|\r|\n/g,`
|
|
9
|
-
`+t)+(e.edited?" (edited)":"")}function g(e,t={},...o){let n=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?n.className=String(i):n.setAttribute(r,i===!0?"":i));for(let r of o)r!=null&&r!==!1&&n.append(r);return n}function ne(e,t){let o=e.getRootNode().activeElement;t&&o instanceof HTMLElement&&e.contains(o)&&o.blur(),e.inert=t}function Bt(e,t,o=null){let n=e.getRootNode().activeElement,r=!1;for(let i=t.length;i--;o=t[i])t[i].nextSibling!==o&&(r=!!e.insertBefore(t[i],o));return r&&n&&t.some(i=>i.contains(n))&&n.focus({preventScroll:!0}),r}function we(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function Ve(e,t,o=4){e.style.left=`${t.left-o}px`,e.style.top=`${t.top-o}px`,e.style.width=`${t.width+o*2}px`,e.style.height=`${t.height+o*2}px`}var Tr=/\bhttps?:\/\/[^\s<>"'`]+/gi,Lr=`.,;:!?'"]}`,Ar=2048,Mr=/[\u202A-\u202E\u2066-\u2069]/;function Cr(e){let t=0,o=0;for(let r of e)r==="("?t++:r===")"&&o++;let n=e.length;for(;n>0;){let r=e[n-1];if(r===")"&&o>t)o--;else if(!Lr.includes(r))break;n--}return e.slice(0,n)}function Dt(e){let t=[],o=0;for(let n of e.matchAll(Tr)){if(n[0].length>Ar||Mr.test(n[0]))continue;let r=Cr(n[0]),i=n.index??0,c;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;c=p.href}catch{continue}i>o&&t.push(e.slice(o,i));let l=g("a",{href:c,target:"_blank",rel:"noopener noreferrer"},r);l.addEventListener("click",p=>p.stopPropagation()),t.push(l),o=i+r.length}return o<e.length&&t.push(e.slice(o)),t}var Re={code:"KeyC",mods:{shift:!0,alt:!0,meta:!1,ctrl:!1},mac:{label:"\u21E7\u2325C",aria:"Shift+Alt+C"},other:{label:"Shift+Alt+C",aria:"Shift+Alt+C"}},so=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),Ge=(so?Re.mac:Re.other).label,hn=(so?Re.mac:Re.other).aria;function ao(e){return e.code===Re.code&&e.shiftKey===Re.mods.shift&&e.altKey===Re.mods.alt&&e.metaKey===Re.mods.meta&&e.ctrlKey===Re.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var lo="http://www.w3.org/2000/svg",Pr={comment:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z","M12.3 8.2v6.6M9 11.5h6.6"],send:["M21 12L3.5 4.5 6.2 12l-2.7 7.5zM6.2 12H13"],copy:["M10 8h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2z","M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"],resolve:["M5 12.5l4.5 4.5L19 7.5"],reopen:["M3 12a9 9 0 1 0 3-6.7","M3 4v5h5"],lines:["M4 7h16M4 12h10M4 17h7"],list:["M3 6.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 12a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 17.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M9 6.5h11M9 12h11M9 17.5h7"],expand:["M14 4h6v6M20 4l-6 6M10 20H4v-6M4 20l6-6M20 14v6h-6M20 20l-6-6M4 10V4h6M4 4l6 6"],pin:["M6 18v-6a6 6 0 1 1 6 6z"],shrink:["M20 10h-6V4M14 10l6-6M4 14h6v6M10 14l-6 6M14 20v-6h6M14 14l6 6M10 4v6H4M10 10L4 4"],bubble:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z"],close:["M6 6l12 12M18 6L6 18"],edit:["M4 20h4L19 9l-4-4L4 16z"]};function oe(e,t=15,o){let n=gn(Pr[e],t);return o&&n.setAttribute("stroke-width",String(o)),n}function gn(e,t){let o=document.createElementNS(lo,"svg"),n={width:String(t),height:String(t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};for(let[r,i]of Object.entries(n))o.setAttribute(r,i);for(let r of e){let i=document.createElementNS(lo,"path");i.setAttribute("d",r),o.append(i)}return o}var Ft=(e,t,o)=>`M${e} ${t}a${o} ${o} 0 1 0 ${2*o} 0a${o} ${o} 0 1 0 -${2*o} 0`,Or={Otter:"M4 13.2C4 9.2 7.6 6.5 12 6.5s8 2.7 8 6.7-3.6 6.3-8 6.3-8-2.3-8-6.3zM5.6 9.6a1.8 1.8 0 1 1 2.7-2.3M18.4 9.6a1.8 1.8 0 1 0-2.7-2.3M9.2 11.6h.01M14.8 11.6h.01M11 14h2l-1 1zM9.8 15.8l-3.2.4M9.9 17l-2.7 1.1M14.2 15.8l3.2.4M14.1 17l2.7 1.1",Fox:"M3.5 4l5 3.5h7l5-3.5-1.5 8.5L12 20l-7-7.5zM9 12h.01M15 12h.01M12 17h.01",Owl:`M5 4.5l3 2.5h8l3-2.5V14a7 7 0 0 1-14 0z${Ft(7.4,11.5,1.9)}${Ft(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${Ft(5,13.5,7)}M8.9 7.22A2.8 2.8 0 1 0 5.89 10.09M18.11 10.09A2.8 2.8 0 1 0 15.1 7.22M9.4 12.6h.01M14.6 12.6h.01M10.3 16.4c0-1 .8-1.6 1.7-1.6s1.7.6 1.7 1.6-.8 1.6-1.7 1.6-1.7-.6-1.7-1.6z`,Rabbit:`${Ft(6.5,15.5,5.5)}M9.6 10.5C8.2 6.5 8.4 2.5 9.8 2.5s2.4 3.5 1.6 7.5M14.4 10.5c1.4-4 1.2-8-.2-8s-2.4 3.5-1.6 7.5M10 15h.01M14 15h.01M11.3 17.3l.7.5.7-.5`};function co(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let o=t[0].toUpperCase();return[...o].length===1?o:t[0]}var ut=(e,t)=>co(t)||be(e);function Xe(e,t){return g("span",{class:`av c${mn(e)}`,"aria-hidden":"true","data-animal":be(e)},co(t)||gn([Or[je[fn(e)]]],24))}var Rr=320;function Vt(e,t){setTimeout(()=>{e.remove(),t?.()},Rr)}function qt(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function _t(e){let t=g("textarea",{class:"input",rows:"1","aria-label":e.label}),o=g("button",{class:"send",type:"button","aria-label":"Send",title:"Send",inert:!0},oe("send")),n=g("div",{class:"row"},e.before,t,o),r=!1,i=()=>{let l=t.value.trim()!=="";o.classList.toggle("show",l),o.inert=!l,t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},c=async()=>{let l=t.value.trim();if(!(!l||r)){r=!0;try{await e.$(l),o.matches(":focus")&&t.focus(),t.value="",i()}catch{}finally{r=!1}}};return n.addEventListener("mousedown",l=>{l.target===t||o.contains(l.target)||(l.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",l=>{l.stopPropagation(),l.key==="Enter"&&!l.shiftKey&&!l.isComposing?(l.preventDefault(),c()):l.key==="Escape"&&(l.preventDefault(),t.value="",i(),t.blur(),e.N?.())}),o.addEventListener("click",l=>{l.stopPropagation(),c()}),{element:n,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Ir(e){let t=g("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",y=>y.preventDefault());let o=_t({label:"Comment",before:t,$:e.$,N:e.N}),n=g("div",{class:"say"}),r=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=g("div",{class:"nf"},r),c=g("div",{class:"you"},n,i),l="",p=!1,d=()=>{let y=e.name(),E=y?"change":"add your name";if(t.title=y?"Change your name":"Add your name",!t.lastChild||l!==y){let T=Xe(e.me,y),x=t.lastChild;x?(qt(T),Vt(x)):T.classList.add("in"),t.append(T),l=y}let L=g("button",{type:"button"},E);L.addEventListener("click",M),n.replaceChildren(g("span",{class:"nm"},y||`You're ${be(e.me)}`)," \xB7 ",L)},m=y=>{c.classList.toggle("naming",y),ne(n,y),ne(i,!y)};function M(y){y.stopPropagation(),r.value=e.name(),m(!0),r.focus({preventScroll:!0}),r.select()}let C=()=>{m(!1),o.focus()};t.addEventListener("click",M),r.addEventListener("keydown",y=>{if(y.stopPropagation(),y.key==="Escape")y.preventDefault(),C();else if(y.key==="Enter"){y.preventDefault();let E=r.value.trim();if(!E||E===e.name())return C();if(p)return;p=!0,e.rename(E).finally(()=>{p=!1,d(),C()})}}),d(),m(!1);let u=g("div",{class:"ctx"},e.label);return{element:g("div",{class:"draft"},u,o.element,c),G:()=>{let{selectionStart:y,selectionEnd:E}=o.input;return()=>{o.focus(),o.input.setSelectionRange(y,E)}},H:y=>{u.hidden=y},V:y=>{u.textContent=y},focus:()=>o.focus(),se:()=>o.input.value.trim()===""}}function Kt(e,t){let o=Ir({label:t.label,me:e.doc.me,name:()=>e.c.name(),rename:n=>e.c.rename(n),$:n=>e.ae(n),N:()=>e.le()});return e.R(o),o}function Ut(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let o=t.element.getBoundingClientRect();if(!o.width&&!o.height)return null;if(e.point)return{x:o.left+e.point.x*o.width,y:o.top+e.point.y*o.height};let n=t.element.ownerDocument.createRange();n.selectNodeContents(t.element);let r=n.getBoundingClientRect();return{x:r.width?Math.min(o.right-8,r.right+6):o.right-8,y:(r.height?r.top:o.top)+8}}function pt(e){return e.range?[...e.range.getClientRects()]:[]}function vn(e,t){let o=pt(t)[0];if(o)return o.top;if(t.state==="orphaned"||!t.element)return null;let n=t.element.getBoundingClientRect();return e.point?n.top+e.point.y*n.height:n.top}function ft(e,t){let o=pt(t).at(-1);if(o)return{x:o.left,y:o.bottom,below:!0};let n=Ut(e,t);return n?{...n,below:!1}:null}function uo(e,t,o){for(let n of o)if(e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom)return!0;return!1}function po(e,t,o=10){let n=[...e].sort((l,p)=>l.m-p.m),r=new Array(n.length).fill(0),i=n.findIndex(l=>l.id===t),c=l=>n[l];if(i<0)n.forEach((l,p)=>{r[p]=p===0?l.m:Math.max(l.m,(r[p-1]??0)+c(p-1).height+o)});else{r[i]=c(i).m;for(let l=i+1;l<n.length;l++)r[l]=Math.max(c(l).m,(r[l-1]??0)+c(l-1).height+o);for(let l=i-1;l>=0;l--)r[l]=Math.min(c(l).m,(r[l+1]??0)-c(l).height-o)}return new Map(n.map((l,p)=>[l.id,r[p]??0]))}var mt=320,Je=300,$r=480,Ze=()=>window.innerWidth<=$r;function zt(e){let t=window.innerWidth;return{width:e&&!Ze()?t-mt:t,height:window.innerHeight}}function Wt(e,t,o,n=12){let r,i;return e.below?(r=Math.min(e.x,o.width-t.width-n),i=e.y+8,i+t.height>o.height-n&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>o.width-n&&(r=e.x-t.width-28),i=Math.min(e.y-12,o.height-t.height-n)),{left:Math.max(n,r),top:Math.max(n,i)}}function fo(e,t,o,n=12,r=44){let i=e.top-r>=8,c=e.top+e.height+8+(i?0:r),l=e.top-8-(i?r:0)-t.height,p=c+t.height<=o.height-n||l<n,d=p?c:l;return{above:!p,left:Math.max(n,Math.min(e.left,o.width-t.width-n)),top:Math.max(n,d)}}function jt(e,t,o){let n=e.top-t.height-10;return n<8&&(n=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,o.width-t.width-8)),top:n}}function Yt(e,t){let o=e.resolved.get(t.id);return o?.range?.startContainer??o?.element??null}var qe=e=>(t,o)=>{let n=Yt(e,t),r=Yt(e,o),i=c=>c.anchor.point??{x:0,y:-1};return n!==r?!r||n&&n.compareDocumentPosition(r)&4?-1:1:i(t).y-i(o).y||i(t).x-i(o).x};var Gt=e=>`${e} ${e===1?"reply":"replies"}`;function st(e,t,o){let n={...o},r=e.id,i=g("div",{class:"rbox always"},g("div",{},_t({label:"Reply",$:E=>t.reply(r,E),N:t.close}).element)),c=g("div",{}),l=g("div",{}),p=null,d=g("div",{},l,g("div",{class:"more"},c)),m=new Map,M=new Map,C=new Map,u=E=>{let L=ut(E.author,E.name),T=m.get(E.id),x=T?.e;if((!x||T.key!==L)&&(x=qt(Xe(E.author,E.name)),T)){let k=T.e;C.set(E.id,k),Vt(k,()=>C.get(E.id)===k&&C.delete(E.id))}x.title=ue(E),M.set(E.id,{key:L,e:x});let O=C.get(E.id);return O?[O,x]:[x]},h=(E,L,T)=>{let x=g("button",{class:"ib",type:"button","aria-label":L,title:L},oe(E));return x.addEventListener("click",O=>{O.stopPropagation(),T()}),x};function y(E,L={}){Object.assign(n,L),r=E.id;let T=(n.now??Date.now)(),x=E.root.replies.length,O=j=>g("span",{class:"who"},`${ue(j)} \xB7 ${Ye(j.at,T)}`),k=j=>g("div",{class:j.deleted?"tx del":"tx"},...j.deleted?["Deleted"]:[...Dt(j.text),j.edited?" (edited)":""]),z=E.resolved?"Resolved"+(x?` \xB7 ${Gt(x)}`:""):x?Gt(x):"",G=g("div",{class:n.B==="column"&&z?"ft has-rest":"ft"},n.B==="column"&&z?g("span",{class:"rest"},z):null,g("span",{class:"hover"},O(E.root),g("span",{class:"acts"},h("copy","Copy thread",()=>t.copy(E.id)),E.resolved?h("reopen","Reopen",()=>void t.reopen(E.id)):h("resolve","Resolve",()=>void t.resolve(E.id))))),q=n.lost?g("div",{class:"ctx"},`${n.place||"No longer on the page"} \u2014 it read \u201C${we(n.lost,120)}\u201D`):n.quote?g("div",{class:"ctx"},`\u201C${we(n.quote,80)}\u201D`):null;M=new Map;let X=g("div",{class:"root"},...u(E.root),q,k(E.root),G);l.replaceWith(X),l=X,p?.remove(),p=x?g("div",{class:"rps"},...E.root.replies.map(j=>g("div",{class:"it"},...u(j),k(j),g("div",{class:"rft"},O(j))))):null,p&&c.prepend(p),m=M,E.resolved?i.remove():i.parentNode!==c&&c.append(i),d.className=E.resolved?"thread resolved":"thread",d.setAttribute("data-thread",E.id)}return y(e),{element:d,update:y}}var Nr="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",Hr=400;function wn(e,t){let o=new Map,n=g("div",{class:"tip",role:"tooltip"}),r=g("div",{class:"mark"}),i=g("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});n.inert=i.inert=!0,e.n.append(r,n,i);let c=g("div",{class:"bub pin ghost","aria-hidden":"true"}),l=[],p=null,d=null,m=null,M=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,C=0,u=null,h=null,y=null,E=0,L=w=>l.find(P=>P.id===w)??null,T=()=>t.q||e.state.l,x=!1,O=w=>{let P=e.resolved.get(w.id);return P?ft(w.anchor,P):null};function k(w,P,N){let{left:K,top:Y}=Wt(P,{width:w.offsetWidth||N,height:w.offsetHeight},zt(e.state.l));w.style.left=`${K}px`,w.style.top=`${Y}px`}function z(w){let P=w&&T()&&e.state.o!==w?L(w):null,N=P?O(P):null;if(!P||!N){y=null,n.classList.remove("show"),ne(n,!0);return}if(y!==P.id){let K=P.root.replies.length;n.replaceChildren(g("div",{class:"tx clamp"},...P.root.deleted?["Deleted"]:Dt(P.root.text)),g("div",{class:"who"},`${ue(P.root)}${K?` \xB7 ${K} ${K===1?"reply":"replies"}`:""}`)),y=P.id}k(n,N,260),n.classList.contains("show")||n.offsetWidth,n.classList.add("show"),n.inert=!1}function G(w){u=w,z(w),e.w(w)}function q(w){if(window.clearTimeout(E),w!==null){G(w);return}E=window.setTimeout(()=>G(null),T()?Hr:0)}n.addEventListener("mouseenter",()=>window.clearTimeout(E)),n.addEventListener("mouseleave",()=>q(null)),n.addEventListener("click",w=>{w.stopPropagation();let P=y;P&&(window.clearTimeout(E),G(null),e.open(P))});function X(w){let P=o.get(w.id);if(P)return P;let N=g("button",{class:"bub",type:"button","data-thread":w.id});return N.addEventListener("mouseenter",()=>q(w.id)),N.addEventListener("mouseleave",()=>q(null)),N.addEventListener("click",K=>{K.stopPropagation(),z(null),e.open(w.id)}),e.n.insertBefore(N,r),o.set(w.id,N),N}let j=!1;function H(){let w=e.state.t,P=m&&w&&!w.anchor.quote&&!w.anchor.point?w.resolved.element:null;if(P){let{left:K,top:Y,above:D}=fo(P.getBoundingClientRect(),{width:i.offsetWidth||Je,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),U=m?.above!==null&&m?.above!==D;if(m&&(m.above=D),U&&xe())return;i.style.left=`${K}px`,i.style.top=`${Y}px`;return}let N=m&&w?ft(w.anchor,w.resolved):p?O(p):null;N&&k(i,N,Je)}let te=w=>e.state.s&&!w.anchor.quote&&!w.anchor.point;function xe(){return window.clearTimeout(C),M?(i.classList.remove("show"),C=window.setTimeout(()=>{H(),i.classList.add("show")},220),!0):(i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function se(w){if(window.clearTimeout(C),M){i.classList.remove("show"),C=window.setTimeout(()=>{m?.i.V(w),H(),i.classList.add("show")},220);return}m?.i.V(w),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)}function ae(){if(!T())return null;let w=e.state.t;return w?w.anchor.quote||w.anchor.point||e.state.s?null:w.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function le(w){l=w;let P=new Set;for(let D of w){if(!e.I(D)||D.anchor.quote)continue;let U=e.resolved.get(D.id);if(!U||U.state==="orphaned")continue;P.add(D.id);let Q=X(D);Q.classList.toggle("done",D.resolved),Q.classList.toggle("on",e.state.o===D.id),Q.classList.toggle("pin",D.anchor.point!==void 0);let fe=`Comment on ${Oe(U.element)}: ${we(D.root.text,60)}`;Q.getAttribute("aria-label")!==fe&&Q.setAttribute("aria-label",fe)}Bt(e.n,w.filter(D=>P.has(D.id)).sort(qe(e)).map(D=>o.get(D.id)),r);for(let[D,U]of o)P.has(D)||(U.classList.remove("in"),o.delete(D),window.setTimeout(()=>U.remove(),300));z(u),x!==e.state.l&&i.classList.contains("show")&&!M&&(window.clearTimeout(C),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)),x=e.state.l;let N=t.q?e.state.t:null;if(N){let D=N.anchor.point??N.resolved.element;m?.of!==N?(window.clearTimeout(C),i.classList.remove("glide"),m={i:Kt(e,N),of:N,at:D,above:null},m.i.H(te(N)),i.replaceChildren(m.i.element),i.inert=!1,m.i.focus(),p=null,d=null,H(),i.classList.add("show")):m&&(m.at!==D&&(m.at=D,m.above=null,se(N.label)),m.i.H(te(N)));let U=!e.d.u(N.anchor.view);U!==j&&(j=U,i.classList.toggle("show",!U),i.inert=U,U||H());return}m&&(window.clearTimeout(C),i.classList.remove("glide"),m=null,j=!1,e.R(null));let K=T()&&e.state.o?L(e.state.o):null;if(!K||!e.I(K)){p=null,d=null,i.classList.remove("show"),ne(i,!0);return}let Y=K.anchor.quote?.exact??null;!p||!d||p.id!==K.id?(d=st(K,e.D,{B:"popover",quote:Y}),i.replaceChildren(d.element),p=K,H(),i.classList.add("show"),i.inert=!1):p!==K&&(d.update(K,{quote:Y}),p=K)}function Ee(){for(let[K,Y]of o){let D=L(K),U=e.resolved.get(K),Q=D&&U?Ut(D.anchor,U):null;if(!Q||Q.y<-40||Q.y>window.innerHeight+40){Y.style.visibility="hidden";continue}Y.style.visibility="",Y.style.left=`${Q.x}px`,Y.style.top=`${Q.y}px`,Y.classList.contains("in")||(Y.offsetWidth,Y.classList.add("in"))}let w=e.state.t,P=w?.anchor.point&&e.d.u(w.anchor.view)?Ut(w.anchor,w.resolved):null;P?(c.style.left=`${P.x}px`,c.style.top=`${P.y}px`,c.classList.contains("in")||(e.n.insertBefore(c,r),c.offsetWidth,c.classList.add("in"))):c.classList.contains("in")&&(c.classList.remove("in"),window.setTimeout(()=>c.classList.contains("in")||c.remove(),300)),i.classList.contains("show")&&H();let N=ae();r.classList.toggle("show",N!==null),N&&Ve(r,N.getBoundingClientRect(),4)}let ke=w=>{if(e.f(w)){let N=w.composedPath()[0];h!==null&&!(N instanceof Element&&N.closest(".tip,.bub"))&&q(null),h=null;return}let P=e._(w.clientX,w.clientY)?.id??null;P!==h&&(h=P,q(P))},pe=w=>{if(e.f(w))return;let P=window.getSelection();if(P&&!P.isCollapsed||(e.state.s?w.altKey:w.target instanceof Element&&w.target.closest(Nr)))return;let N=e._(w.clientX,w.clientY);N&&(e.X(w),z(null),e.open(N.id))};return window.addEventListener("pointermove",ke,{capture:!0,passive:!0}),window.addEventListener("click",pe,!0),{p:le,M:Ee,destroy(){window.clearTimeout(E),window.clearTimeout(C),window.removeEventListener("pointermove",ke,!0),window.removeEventListener("click",pe,!0),e.R(null);for(let w of o.values())w.remove();c.remove(),n.remove(),r.remove(),i.remove()}}}var Br="button link img figure region list listitem tab tabpanel article navigation complementary banner contentinfo form search group dialog menu menuitem checkbox switch radio slider textbox combobox option row cell heading table".split(" ").map(e=>`[role=${e}]`),Dr=["button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,figcaption,table,th,td","li,ul,ol,dl,dt,dd,p,h1,h2,h3,h4,h5,h6,blockquote,pre","section,article,aside,nav,header,footer,main,form,fieldset",...Br].join(","),Fr="a,button,label,summary,[role=button],[role=link],[role=tab],[role=option],[role=menuitem]",Vr=.6,Xt=2,yn=(e,t)=>Math.abs(e.left-t.left)<=Xt&&Math.abs(e.top-t.top)<=Xt&&Math.abs(e.width-t.width)<=Xt&&Math.abs(e.height-t.height)<=Xt;function mo(e,t){let o=t.i(e);if(o.width<2||o.height<2)return!1;if(e.hasAttribute("data-pipeup-id"))return!0;let n=t.K();return o.width*o.height<=Vr*n.width*n.height&&(e.matches(Dr)||t.ce(e)||e.childElementCount>1&&!e.parentElement?.closest(Fr)&&t.de(e))}function ht(e,t,o){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let n=null;for(let i=e;i&&i!==t&&!n;i=i.parentElement)mo(i,o)&&(n=i);if(!n||n.hasAttribute("data-pipeup-id"))return n;let r=o.i(n);for(let i=n.parentElement;i&&i!==t&&yn(o.i(i),r);i=i.parentElement)if(i.hasAttribute("data-pipeup-id"))return i;return n}function bn(e,t,o){let n=o.i(e);for(let r=e.parentElement;r&&r!==t;){let i=ht(r,t,o);if(!i)return null;if(!yn(o.i(i),n))return i;r=i.parentElement}return null}function ho(e=window){return{i:t=>t.getBoundingClientRect(),ce:t=>{let o=e.getComputedStyle(t),n=o.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(o.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(o.getPropertyValue(`border-${i}-width`))>0);return n||r||o.backgroundImage!=="none"||o.boxShadow!=="none"},de:t=>/^(inline-)?(flex|grid)$/.test(e.getComputedStyle(t).display),K:()=>({width:e.innerWidth,height:e.innerHeight})}}function xn(e,t,o=()=>!0){let n=[],r=(i,c)=>{for(let l of i.children){if(l.hasAttribute("data-pipeup-ignore")||!o(l))continue;let p=c;mo(l,t)&&(c&&yn(t.i(c.e),t.i(l))?(l.hasAttribute("data-pipeup-id")||!c.e.hasAttribute("data-pipeup-id"))&&(c.e=l):n.push(p={e:l,C:c,k:0})),r(l,p)}};r(e,null);for(let i=n.length-1;i>=0;i--){let c=n[i];c.C&&(c.C.k=Math.max(c.C.k,c.k+1))}return n}var gt=(e,t)=>e.filter(o=>o.k<=t&&(!o.C||o.C.k>t)),go=(e,t)=>e.filter(o=>o.C===t);var Jt="a,button,summary,[role=button],[role=link],[role=switch],[role=tab],[role=checkbox],input[type=checkbox],input[type=radio],input[type=submit],input[type=button],input[type=reset]",qr=`${Jt},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,vo=["click","dblclick","auxclick","submit","contextmenu","dragstart"],wo=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],_r=400,En="Tab moves between blocks \xB7 \u2191 \u2193 change level \xB7 Enter comments \xB7 Esc to finish \xB7 F7 selects text",Kr=150;function yo(e,t=ho()){let o=g("span",{hidden:!0},En),n=g("div",{class:"pick"},o),r=[0,1].map(()=>{let s=g("div",{class:"km",tabindex:"-1",role:"button"},g("span",{hidden:!0}),g("span",{hidden:!0}));return s.inert=!0,s.addEventListener("keydown",de),s.addEventListener("click",b=>{b.stopPropagation(),_()}),s.addEventListener("focus",()=>n.classList.add("kf")),s.addEventListener("blur",()=>n.classList.remove("kf")),s}),i=g("span",{class:"lbl"}),c=(s,b,a,v)=>{let A=g("button",{class:"nb",type:"button","aria-label":s,title:b},oe(a,16));return A.addEventListener("click",$=>{$.stopPropagation(),v()}),A},l=c("Around it","Select the block around it","expand",F),p=c("Inside it","Select a block inside it","shrink",B),d=c("Pin","Pin its centre","pin",()=>e.J(()=>D(h??k,{x:.5,y:.5}))),m=g("div",{class:"namebar",role:"group","aria-label":"Chosen block"},i,l,p,d);m.inert=!0;let M=e.n.querySelector(".launch");for(let s of[n,...r,m])e.n.insertBefore(s,M);m.addEventListener("mousedown",s=>s.preventDefault());let C=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,u=null,h=null,y=null,E=null,L=0,T=()=>{},x=null,O=()=>{},k=null,z=0,G=0,q=!1,X=null,j=null,H=null,te=-1,xe=!0,se=null,ae=null,le=s=>!e.f(s)&&!(s.target instanceof Element&&s.target.closest("[data-pipeup-ignore]"));function Ee(){E&&(n.classList.toggle("glide",performance.now()<L),Ve(n,E.getBoundingClientRect(),4))}function ke(){if(!x)return;m.classList.toggle("glide",performance.now()<L&&m.classList.contains("show"));let s=x.getBoundingClientRect(),{left:b,top:a}=jt({left:s.left,top:s.top,width:s.width,height:s.height},{width:m.offsetWidth||200,height:m.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});m.style.left=`${b}px`,m.style.top=`${a}px`}function pe(s,b){E=s,L=b?performance.now()+_r:0,Ee(),n.classList.add("show")}function w(s,b){let a=getComputedStyle(s);if(a.opacity==="0")return b(),()=>{};let v=0,A=()=>{window.clearTimeout(v),s.removeEventListener("transitionend",V)},$=()=>{A(),b()},V=he=>{he.target===s&&he.propertyName==="opacity"&&$()},J=Math.max(...a.transitionDuration.split(",").map(he=>parseFloat(he)*1e3||0));return v=window.setTimeout($,J+100),s.addEventListener("transitionend",V),A}function P(s){if(s!==u){if(u=s,T(),!s){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?pe(s,!1):C?(n.classList.remove("show"),T=w(n,()=>pe(s,!1))):pe(s,!0)}}function N(s){h=s,n.classList.toggle("on",s!==null),P(s),K(s)}function K(s){O(),m.inert=!s,s?C?(m.classList.remove("show"),O=w(m,()=>Y(s))):Y(s):(m.classList.remove("show"),x=null)}function Y(s){i.textContent=i.title=Oe(s),l.hidden=bn(s,e.root,t)===null,p.hidden=(k?I(s).length:xn(s,t,$e).length)===0;let b=m.classList.contains("show");x=s,ke(),b||(m.offsetWidth,m.classList.add("show"))}function D(s,b){let a;try{a=Rt(s,e.root,b,e.d.view(s))}catch($){e.Z($);return}let v={anchor:a,label:b?`Pin on ${Oe(s).replace(/^[A-Z](?=[a-z])/,$=>$.toLowerCase())}`:Oe(s),ranges:[],resolved:{state:"attached",element:s,range:null}},A=e.state.t;k&&(k=s,te=-1),N(b?null:s),y=A??{...v,ranges:[]},A?e.ue({...v,ranges:[]}):e.Q(y),e.S(b?v.label:`Commenting on ${v.label}`)}function U(s){e.J(()=>D(s))}function Q(s){let b=(s.target instanceof Element?ht(s.target,e.root,t):null)??e.root,a=b.getBoundingClientRect();a.width&&a.height&&D(b,{x:(s.clientX-a.left)/a.width,y:(s.clientY-a.top)/a.height})}function fe(s){let b=window.getSelection();if(b&&!b.isCollapsed)return;if(e.state.t&&(s.altKey||!e.T())){e.F();return}if(!s.altKey&&e._(s.clientX,s.clientY))return;if(e.state.o&&e.open(null),k&&s.detail&&f(),s.altKey){Q(s);return}let a=s.target instanceof Element?ht(s.target,e.root,t):null;a?D(a):(e.F(),N(null))}let Se=s=>{if(!e.f(s)){if(!le(s)){h||P(null);return}s.stopPropagation(),!(h||e.state.t||k)&&P(!_e()&&s.target instanceof Element?ht(s.target,e.root,t):null)}},_e=()=>{let s=window.getSelection();return!!s&&!s.isCollapsed&&s.toString().trim()!==""},W=()=>{_e()&&(k&&f(),h||P(null))},ye=s=>{le(s)&&(s.stopPropagation(),(s.type==="pointerdown"||s.type==="mousedown")&&s.target instanceof Element&&s.target.closest(qr)&&s.preventDefault())},Te=s=>{if(!le(s))return;let b=s.target;if((b===ae||b.form&&b.form===ae?.form)&&(s.type==="submit"||s.type==="click"&&!s.detail)){ae=s.type==="click"&&b.type==="submit"?b.form:null;return}s.preventDefault(),s.stopPropagation(),s.type==="click"&&!e.state.c&&!e.pe(s)&&fe(s)},Ie=s=>{if(ae=null,Me="",!(!le(s)||!(s.target instanceof Element)))if((s.key==="Enter"||s.key===" ")&&s.target.closest(Jt)){if(!k){ae=s.target;return}s.preventDefault(),s.stopPropagation()}else s.key==="Enter"&&!k&&s.target.form&&(ae=s.target)},me=()=>e.n.getRootNode().activeElement,ce=()=>r.some(s=>s===me()),$e=s=>(s.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1||getComputedStyle(s).display==="contents")&&e.d.u(e.d.view(s)),ee=()=>(se?.some(s=>!s.e.isConnected)&&(se=null),se??=xn(e.root,t,$e)),tt=s=>ee().find(b=>b.e===s),Ne=(s,b=!1)=>{let a=s.getBoundingClientRect();return a.bottom>0&&a.top<window.innerHeight&&(!b||a.top>=0)},Ke=()=>{let s=gt(ee(),0);return s.find(b=>Ne(b.e,!0))??s.find(b=>Ne(b.e))??s[0]},Le=s=>e.doc.threads().filter(b=>e.I(b)&&s.contains(Yt(e,b))).sort(qe(e));function He(s,b){let[a,v]=s.children,A=gt(ee(),z),$=Le(b).length;a.textContent=`${Lt(b)}, ${A.findIndex(he=>he.e===b)+1} of ${A.length}${$?`, has ${$} comment${$===1?"":"s"}`:""}`;let V=(b.innerText??b.textContent??"").length<=Kr;v.textContent=dn(b);let J=xe?[o]:[];xe=!1,s.ariaLabelledByElements!==void 0?(s.ariaLabelledByElements=V?[a,b]:[a,v],s.ariaDescribedByElements=V?J:[...J,b]):s.setAttribute("aria-label",`${a.textContent}, ${v.textContent}`)}function re(s,b=!0){let a=ee(),v=a.find($=>$.e===s);if(v&&!gt(a,z).includes(v)&&(z=v.k),s!==k&&(te=-1),s!==h&&(h=null),k=s,P(s),K(s),s.scrollIntoView({block:"nearest",inline:"nearest",behavior:C?"auto":"smooth"}),!b)return;e.fe();let A=r[G^=1];He(A,s),Ve(A,s.getBoundingClientRect(),4),A.inert=!1,A.focus({preventScroll:!0}),r[G^1].inert=!0}function Ue(){se=null;let s=document.activeElement;j=me()??s;let b=tt(X),a=b??(s&&s!==document.body&&e.root.contains(s)&&!s.closest("[data-pipeup-ignore]")?ee().filter(v=>v.e.contains(s)).pop():void 0)??Ke();return a?(b||(z=a.k),q=!0,re(a.e),!0):!1}function f(){let s=ce();X=k,k=null,P(null),K(null);for(let b of r)ne(b,!0);return s}function S(){let s=j;s?.focus?.({preventScroll:!0}),s&&e.n.contains(s)&&me()!==s&&e.n.querySelector(".launch .mode")?.focus({preventScroll:!0})}function I(s){let b=tt(s);return b?go(ee(),b):[]}function R(s){let b=gt(ee(),z),a=b.findIndex(A=>A.e===k),v=b[a<0?s>0?0:b.length-1:(a+s+b.length)%b.length];v&&re(v.e)}function F(){let s=h??k,b=s&&bn(s,e.root,t);if(!b)return e.S("Nothing around it");if((!H||!s.contains(H))&&(H=s),h)return U(b);re(b)}function B(){let s=h??k,b=s?I(s):[],a=b.find(v=>H&&v.e.contains(H))??b.find(v=>Ne(v.e))??b[0];if(!a)return e.S("Nothing inside it");h?U(a.e):re(a.e)}function _(s=!1){if(!k)return;if(e.state.t&&!e.T())return e.he();if(!s)return D(k);let b=Le(k);if(!b.length)return e.S("No comments on this block");te=(te+1)%b.length,e.open(b[te].id),b.length>1&&e.S(`Comment ${te+1} of ${b.length} on this block`)}function de(s){if(["Tab","ArrowUp","ArrowDown","Enter"," ","Escape"].includes(s.key)&&!(s.key.startsWith("Arrow")&&(s.metaKey||s.ctrlKey||s.altKey))){if(s.preventDefault(),s.stopPropagation(),Me=s.key,s.key==="Escape")return void e.U();if(s.key==="Enter"||s.key===" ")return _(s.shiftKey&&s.key==="Enter");e.state.o&&e.open(null),s.key==="Tab"?R(s.shiftKey?-1:1):s.key==="ArrowUp"?F():B()}}let Ae=()=>{let s=me();return s?!!s.closest("[inert]"):!document.activeElement||document.activeElement===document.body},Me="",at=s=>{s.key===Me&&(Me="",s.preventDefault(),s.stopPropagation())};window.addEventListener("keyup",at,!0),window.addEventListener("pointermove",Se,!0),document.addEventListener("selectionchange",W);for(let s of wo)window.addEventListener(s,ye,!0);for(let s of vo)window.addEventListener(s,Te,!0);return window.addEventListener("keydown",Ie,!0),{U(){if(h)N(null);else if(k)f()&&S(),e.S(`Cursor put away \xB7 ${Ge} brings it back`);else return!1;return!0},z:()=>k!==null,ge:()=>q&&!k,ee:Ue,W(){k&&!ce()&&re(k)},p(){if(se=null,k&&!(k.isConnected&&$e(k))){let a=Ke();a?re(a.e,ce()||Ae()):f()}let s=e.n.querySelector(".launch");if(s&&m.nextElementSibling!==s&&!ce()&&!m.contains(me()))for(let a of[n,...r,m])e.n.insertBefore(a,s);let b=e.state.t;y&&b!==y?(y=null,N(null),k&&re(k,Ae())):b&&!y&&(u||h)&&N(null)},M(){Ee(),ke(),k&&Ve(r[G],k.getBoundingClientRect(),4)},destroy(){f()&&S();for(let s of r)s.remove();T(),O(),window.removeEventListener("keyup",at,!0),window.removeEventListener("pointermove",Se,!0),document.removeEventListener("selectionchange",W);for(let s of wo)window.removeEventListener(s,ye,!0);for(let s of vo)window.removeEventListener(s,Te,!0);window.removeEventListener("keydown",Ie,!0),n.classList.remove("show"),m.classList.remove("show"),ne(m,!0),w(n,()=>n.remove()),w(m,()=>m.remove())}}}var Ur=300,zr=32,kn=220,vt=320,Wr=24,bo=24;function Sn(e,t=!1){let o=e.ownerDocument.documentElement,n=o.getAttribute("data-pipeup-layout");if(n==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(n==="column"?e:null);if(!r)return null;if(o.hasAttribute("data-pipeup-reserve")){let l=o.clientWidth,d=getComputedStyle(r).maxWidth,m;return d.endsWith("px")?m=parseFloat(d):d.endsWith("%")?m=parseFloat(d)/100*l:m=r.getBoundingClientRect().width,n!=="column"&&l<m+vt-(t?Wr:0)?null:{x:l-vt+bo,width:vt-2*bo}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<Ur&&n!=="column")return null;let c=i+zr;return{x:c,width:Math.max(220,Math.min(300,window.innerWidth-c-16))}}function Tn(e,t){let o=e.resolved.get(t.id);return!o||o.state==="orphaned"&&!e.te.has(t.id)}function xo(e){let t=g("div",{class:"col"});e.n.append(t);let o=new Map,n=null,r=new ResizeObserver(()=>l()),i=u=>Tn(e,u);function c(u){let h=e.resolved.get(u.id),y=h?vn(u.anchor,h):null;return y===null?Number.POSITIVE_INFINITY:y+window.scrollY-4}function l(){let u=[],h=[];for(let[x,O]of o){let k=c(O.thread);if(Number.isFinite(k))O.placed=k;else if(e.te.has(x)){if(O.placed===null){O.e.classList.add("wait");continue}k=O.placed}Number.isFinite(k)?u.push({id:x,m:k,height:O.e.offsetHeight}):h.push({id:x,height:O.e.offsetHeight})}let y=e.state.t,E=y?vn(y.anchor,y.resolved):null;n&&E!==null&&u.push({id:"draft",m:E+window.scrollY-4,height:n.e.offsetHeight});let L=po(u,n?"draft":e.state.o),T=Math.max(0,...u.map(x=>(L.get(x.id)??0)+x.height))+24;for(let x of h)L.set(x.id,T),T+=x.height+10;for(let[x,O]of o){if(O.e.classList.contains("wait")){if(!L.has(x))continue;O.e.style.transition="none",O.e.style.transform=`translateY(${Math.round(L.get(x))}px)`,O.e.offsetWidth,O.e.style.transition="",O.e.classList.remove("wait");continue}O.e.style.transform=`translateY(${Math.round(L.get(x)??0)}px)`}n&&(n.e.style.transform=`translateY(${Math.round(L.get("draft")??0)}px)`)}function p(u,h){u.thread=h,u.lost=i(h),u.view.update(h,{lost:u.lost?h.anchor.snapshot:null})}function d(u){let h=i(u),y=st(u,e.D,{B:"column",lost:h?u.anchor.snapshot:null}),E=g("div",{class:"th","data-thread":u.id},g("button",{class:"opn sr",type:"button","data-thread":u.id}),y.element);return E.style.transition="none",E.addEventListener("mouseenter",()=>e.w(u.id)),E.addEventListener("mouseleave",()=>e.w(null)),E.addEventListener("click",()=>e.open(u.id)),t.append(E),r.observe(E),{e:E,thread:u,lost:h,placed:null,view:y}}function m(){let u=e.state.t;if(n&&u&&n.of!==u){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),kn),n=null}if(u&&n&&(n.i.V(u.label),n.i.H(e.state.s&&!u.anchor.quote&&!u.anchor.point)),u&&!n){let h=Kt(e,u),y=g("div",{class:"th on"},h.element);y.style.transition="none",t.append(y),r.observe(y),n={e:y,i:h,of:u},h.H(e.state.s&&!u.anchor.quote&&!u.anchor.point),h.focus()}else if(!u&&n){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),kn),n=null,e.R(null)}}function M(u){ne(t,e.state.l);let h=new Set,y=[],E=e.state.o!==null||e.state.t!==null;for(let L of u){if(!e.I(L))continue;h.add(L.id);let T=o.get(L.id);T?(T.thread!==L||T.lost!==i(L))&&p(T,L):(T=d(L),o.set(L.id,T),y.push(T.e));let x=T.e,O=e.state.o===L.id;x.classList.toggle("on",O);let k=x.firstElementChild,z=L.root.replies.length;k.setAttribute("aria-label",`Open thread: ${we(L.root.text,60)}, ${Gt(z)}`),k.setAttribute("aria-expanded",String(O)),ne(k,O);let G=x.querySelector(".more");G&&ne(G,!O),x.classList.toggle("dim",E&&!O),x.classList.toggle("hot",e.state.w===L.id&&!O),x.classList.toggle("resolved",L.resolved),x.classList.toggle("lost",T.lost)}for(let[L,T]of o)h.has(L)||(o.delete(L),r.unobserve(T.e),T.e.classList.add("out"),window.setTimeout(()=>T.e.remove(),kn));m(),Bt(t,u.filter(L=>h.has(L.id)).sort(qe(e)).map(L=>o.get(L.id).e),n?.e??null)&&t.offsetWidth,l(),n&&y.push(n.e);for(let L of y)L.offsetWidth,L.style.transition=""}function C(){let u=Sn(e.root,!0);u&&(t.style.width=`${u.width}px`,t.style.transform=`translate(${u.x}px, ${-window.scrollY}px)`)}return{p:M,M:C,destroy(){r.disconnect(),e.R(null),t.remove()}}}var Eo="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function ko(e){let t=g("button",{type:"button","aria-label":"Comment",title:"Comment"},oe("comment",17)),o=g("div",{class:"selbar"},t);o.inert=!0,e.n.append(o);let n=null,r=0,i=!1,c=u=>{let h=u&&(u.nodeType===Node.ELEMENT_NODE?u:u.parentElement);return!!h&&e.root.contains(h)&&!h.closest(Eo)};function l(){if(!n)return;let u=n.getBoundingClientRect(),{left:h,top:y}=jt({left:u.left,top:u.top,width:u.width,height:u.height},{width:o.offsetWidth||36,height:o.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});o.style.left=`${h}px`,o.style.top=`${y}px`}function p(){n=null,o.inert=!0,o.classList.remove("show")}function d(u=!1){let h=window.getSelection();if(!e.state.s||!h||h.isCollapsed||h.rangeCount===0||!h.toString().trim()||!c(h.anchorNode)||!c(h.focusNode)){p();return}!n&&!u&&e.S("Enter comments on the selected words"),n=h.getRangeAt(0).cloneRange(),l(),o.inert=!1,o.classList.add("show")}t.addEventListener("mousedown",u=>u.preventDefault()),t.addEventListener("click",u=>{if(u.stopPropagation(),e.state.t&&!e.T())return e.F();let h=n;if(!h)return;let y;try{y=Ot(h,e.root,e.d.view(h.commonAncestorContainer))}catch(L){e.Z(L),p();return}let E=we(h.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),p(),e.Q({anchor:y,label:`\u201C${E}\u201D`,ranges:[h],resolved:{state:"attached",element:null,range:h}})});let m=()=>{if(window.clearTimeout(r),r=window.setTimeout(()=>i||d(),250),!n)return;let u=window.getSelection();(!u||u.isCollapsed||!u.toString().trim())&&p()};document.addEventListener("selectionchange",m);let M=u=>{u.type!=="keyup"&&(i=u.type==="mousedown"),!(i||e.f(u))&&window.setTimeout(()=>d(u.type==="mouseup"),0)};window.addEventListener("mousedown",M,!0),window.addEventListener("mouseup",M,!0),window.addEventListener("keyup",M,!0);let C=u=>{u.key!=="Enter"||!n||e.f(u)||u.target instanceof Element&&u.target.closest(`${Eo},${Jt}`)||(u.preventDefault(),u.stopPropagation(),t.click())};return window.addEventListener("keydown",C,!0),{p(){!e.state.s&&n&&p()},M(){n&&l()},destroy(){window.removeEventListener("mousedown",M,!0),window.removeEventListener("mouseup",M,!0),window.removeEventListener("keyup",M,!0),window.removeEventListener("keydown",C,!0),window.clearTimeout(r),document.removeEventListener("selectionchange",m),o.remove()}}}async function Ln(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(o),o.select();let n=document.execCommand("copy");if(o.remove(),!n)throw new Error("pipeup: your browser blocked copying")}var jr=3e3,So="Hidden on the page";function To(e){let t=[g("span",{class:"n"}),g("span",{class:"n"})],o=oe("comment",20,1.4);o.lastElementChild.setAttribute("stroke-width","1.6");let n=g("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":hn,"aria-haspopup":"menu","aria-expanded":"false"},g("span",{class:"plus"},o),g("span",{class:"cnt"},oe("bubble",34,1.4),...t),g("span",{class:"dot"})),r=document.createTextNode("Comment"),i=g("span",{class:"ttip","aria-hidden":"true"},r,g("small",{},Ge)),c=g("div",{class:"launch"},n,i),l=g("div",{class:"menu",role:"menu","aria-label":"Comments"}),p=g("div",{class:"list",role:"menu","aria-label":"All comments"}),d=g("span",{class:"pn"}),m=g("button",{class:"ib",type:"button","aria-label":"Close"},oe("close")),M=g("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",g("span",{class:"sw","aria-hidden":"true"}));M.addEventListener("click",f=>{f.stopPropagation(),e.c.ve()});let C=g("div",{class:"all",role:"dialog","aria-label":"All comments"},g("div",{class:"hd"},g("span",{},"All comments"),d,M,m),p),u=g("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});l.inert=C.inert=u.inert=!0,e.n.append(l,c,C);let h=!1,y=null,E=0,L=[],T=0,x=null,O=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,k=f=>{h=e.state.c=f,window.clearTimeout(E),E=0,f||y?.(!0),l.classList.toggle("show",f),ne(l,!f),n.setAttribute("aria-expanded",String(f))},z=(f,S=!1)=>{e.state.l!==f&&(e.state.l=f,e.p(),f?(G(p)[0]??m).focus({preventScroll:!0}):S&&n.focus({preventScroll:!0}))},G=(f=l)=>[...f.querySelectorAll(".mi")],q=()=>l.getRootNode().activeElement,X=()=>{k(!1),n.focus({preventScroll:!0})},j=f=>{let S=G(f.currentTarget);if(S.length===0)return;let I=q(),R=S.indexOf(I),F=B=>{f.preventDefault(),S[(B+S.length)%S.length]?.focus({preventScroll:!0})};f.key==="ArrowDown"?F(R+1):f.key==="ArrowUp"?F(R<0?S.length-1:R-1):f.key==="Home"?F(0):f.key==="End"&&F(S.length-1)};l.addEventListener("keydown",j),p.addEventListener("keydown",j),m.addEventListener("click",f=>{f.stopPropagation(),z(!1,!0)});let H=f=>Tn(e,f),te=()=>L.filter(f=>!f.resolved&&!e.O(f)).length,xe=()=>L.filter(f=>!f.resolved&&e.O(f)).length,se=()=>L.filter(f=>!f.resolved).length,ae=f=>{let S=f.anchor.view?.slide,I=e.d.u(f.anchor.view)?"":Mt(f.anchor.view);return S&&e.d.slide()!==null?`On slide ${S}`:I?`In ${I}`:So},le=(f,S,I="")=>g("div",{role:"group","aria-label":I?`${f} \xB7 ${I}`:f},g("div",{class:"sec","aria-hidden":"true"},f,I&&g("b",{},I)),...S);function Ee(f,S){let I=e.d.slide(),R=new Map;for(let F of f){let B=F.thread,_=I!==null?B.anchor.view?.slide??I:e.O(B)?e.d.u(B.anchor.view)?"":Mt(B.anchor.view):null;R.set(_,[...R.get(_)??[],F])}if(I===null){let F=R.get(null)??[];return R.delete(null),[...F.map(S),...[...R].map(([B,_])=>le(B||So,_.map(S)))]}return[...R].sort(([F],[B])=>Number(F)-Number(B)||0).map(([F,B])=>le(`Slide ${F} \xB7 ${B.filter(_=>!_.thread.resolved).length} open`,B.map(S),F===I?"This slide":""))}function ke(){let f=q()?.dataset.thread,S=e.c.all().filter(B=>!B.thread.resolved||e.state.E),I=B=>{let _=B.thread,de=Xe(_.root.author,_.root.name);de.classList.add("in");let Ae=g("button",{class:_.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":_.id},de,g("span",{},g("span",{class:"clamp"},_.root.deleted?"Deleted":_.root.text),g("small",{},H(_)?`\u201C${we(_.anchor.snapshot,80)}\u201D`:B.location.where)));return Ae.addEventListener("click",Me=>{Me.stopPropagation(),pe(_.id,Ae.getBoundingClientRect().top)}),Ae},R=S.filter(B=>H(B.thread));d.textContent=String(se()),M.setAttribute("aria-checked",String(e.state.E)),p.replaceChildren(S.length?"":g("div",{class:"sec",role:"presentation"},"No open comments"),...Ee(S.filter(B=>!H(B.thread)),I),R.length?le("No longer on the page",R.map(I)):"");let F=G(p);f&&F.find(B=>B.dataset.thread===f)?.focus({preventScroll:!0})}function pe(f,S){Ze()&&(e.state.L=!0,z(!1)),P(f,S)}let w="";function P(f,S){let I=L.find(R=>R.id===f);if(I){if(w=f,!e.O(I))return N(I,S);if(e.state.t&&!e.T())return e.F();e.d.j(I.anchor.view??{}).then(()=>{e.ne();let R=L.find(F=>F.id===f);R&&w===f&&(e.state.l||e.state.L)&&N(R,S)})}}function N(f,S){let I=f.id,R=e.resolved.get(I),F=R&&!H(f)&&!e.O(f)?R.element??R.range?.startContainer.parentElement??null:null;if(F?.scrollIntoView({block:"center",inline:"nearest",behavior:O?"auto":"smooth"}),F&&R&&ft(f.anchor,R)&&F.checkVisibility?.({visibilityProperty:!0})!==!1){Y(),e.open(I);return}e.open(null),Ze()&&(e.state.L=!0,e.p()),K(f,S)}function K(f,S){let I=!H(f)&&e.O(f),R={quote:f.anchor.quote?.exact??null,lost:H(f)||I?f.anchor.snapshot:null,place:I?ae(f):null};if(x?.id===f.id?x.view.update(f,R):(x={id:f.id,view:st(f,e.D,{B:"popover",...R})},u.replaceChildren(x.view.element)),S===void 0)return;u.isConnected||(e.n.insertBefore(u,C),u.offsetWidth);let F=zt(e.state.l),{left:B,top:_}=Wt({x:F.width,y:S,below:!1},{width:Je,height:u.offsetHeight},F);u.style.left=`${B}px`,u.style.top=`${_}px`,u.classList.add("show"),u.inert=!1,e.we(f.id)}function Y(f=!1){x&&(x=null,u.classList.remove("show"),ne(u,!0),f&&e.state.L&&(e.state.L=!1,e.p()))}function D(f,S,I,R=!1,...F){let B=g("button",{class:"mi",type:"button",role:R?"menuitemcheckbox":"menuitem"},f,g("span",{class:"lb"},S),...F,R&&g("span",{class:"sw","aria-hidden":"true"}),g("span",{class:"tt","aria-hidden":"true"}));return B.addEventListener("click",_=>{_.stopPropagation(),I(_)}),B}let U=(f,S,I,R)=>{let F=f.querySelector(".lb");F.textContent!==S&&(F.textContent=S),f.querySelector(".tt").textContent=I,f.setAttribute("aria-description",I),R!==void 0&&f.setAttribute("aria-checked",String(R))},Q=()=>g("div",{class:"sep",role:"separator"}),fe=g("span",{class:"ma"}),Se=g("span",{class:"kc"}),_e="",W=D(fe,"",Ne,!1,Se);W.dataset.item="name";let ye=D(oe("copy"),"Copy as Markdown",()=>{X(),e.c.copyAll("ai")}),Te=D(oe("lines"),"Copy as Text",()=>{X(),e.c.copyAll("text")}),Ie=g("span",{class:"kc"}),me=D(oe("list"),"All comments",()=>{k(!1),z(!0)},!1,Ie),ce=D(oe("comment"),"Start commenting",f=>{let S=!e.state.s&&f.detail===0;e.ye(!e.state.s,S),S&&k(!1)},!0,g("span",{class:"kc","aria-hidden":"true"},Ge));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",hn);let $e=[W,Q(),ye,Te,me,Q(),ce];function ee(){let f=se(),S=e.c.name(),I=S||be(e.doc.me);if(U(W,I,S?"The name on your comments":"Add a name to show on your comments"),W.setAttribute("aria-label",`${I}, ${S?"edit":"add"} your name`),Se.replaceChildren(S?oe("edit",13):"Add name"),ut(e.doc.me,S)!==_e){_e=ut(e.doc.me,S);let R=Xe(e.doc.me,S);R.classList.add("in"),fe.replaceChildren(R)}U(ye,"Copy as Markdown","Markdown, with where each thread is"),U(Te,"Copy as Text","Just the words"),U(me,"All comments","Every thread, and where it is"),Ie.textContent=f?String(f):"",U(ce,"Start commenting",e.state.s?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.s)}function tt(){ee(),l.firstChild!==W&&l.replaceChildren(...$e)}function Ne(){let f=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"});f.value=e.c.name();let S=g("div",{class:"ed"},fe.cloneNode(!0),f),I=(R,F=!1)=>{if(y!==I)return;y=null;let B=f.value.trim();R&&B&&B!==e.c.name()&&e.c.rename(B).then(ee),S.replaceWith(W),F&&W.focus({preventScroll:!0})};y=I,f.addEventListener("keydown",R=>{R.stopPropagation(),(R.key==="Enter"||R.key==="Escape")&&(R.preventDefault(),I(R.key==="Enter",!0))}),f.addEventListener("blur",()=>I(!0)),W.replaceWith(S),f.focus({preventScroll:!0})}n.addEventListener("click",f=>{if(f.stopPropagation(),h){k(!1);return}tt(),k(!0),f.detail===0&&G().at(-1)?.focus({preventScroll:!0})});let Ke=!1,Le=()=>{Ke=C.contains(q())},He=f=>{let S=f.composedPath();h&&!S.includes(l)&&!S.includes(n)&&(k(!1),e.state.s&&!e.f(f)&&(e.X(f),f.preventDefault(),f.stopPropagation())),e.state.l&&!e.f(f)&&z(!1,Ke&&(!document.activeElement||document.activeElement===document.body)),!S.includes(u)&&!S.includes(C)&&Y(!0)},re=f=>{if(!h||f.pointerType==="touch"||f.type==="pointerout"&&f.relatedTarget)return;let S=f.composedPath();f.type==="pointerover"&&(S.includes(l)||S.includes(n))?(window.clearTimeout(E),E=0):E||(E=window.setTimeout(()=>{E=0,y||k(!1)},jr))};window.addEventListener("pointerdown",Le,!0),window.addEventListener("click",He,!0),window.addEventListener("pointerover",re,!0),window.addEventListener("pointerout",re,!0);let Ue=f=>{if(f.key!=="Escape"||y)return;let S=f.composedPath()[0];if(h)X();else if(e.state.l&&!(S instanceof HTMLTextAreaElement&&!C.contains(S)))z(!1,!0);else if(x)Y(!0),e.D.close();else return;f.stopPropagation()};return window.addEventListener("keydown",Ue,!0),{p(f){L=f;let S=te();if(S!==T){if(S){let[_,de]=t[0].classList.contains("on")?t:[t[1],t[0]];de.textContent=S>99?"99+":String(S),de.classList.toggle("s",S>99),_.classList.remove("on"),de.classList.add("on")}n.classList.toggle("has",S>0),T=S}let I=xe(),R=I?`${S} here \xB7 ${I} ${e.d.slide()!==null?"on other slides":"in other views"}`:"";n.classList.toggle("else",I>0);let F=`Comment${e.state.s?", comment mode on":""}${R?`, ${R}`:S?`, ${S} open`:""}`;n.getAttribute("aria-label")!==F&&n.setAttribute("aria-label",F),r.data!==(R||"Comment")&&(r.data=R||"Comment"),n.classList.toggle("on",e.state.s),h&&ee();let B=e.state.l;if(C.classList.toggle("full",Ze()),C.classList.contains("show")!==B&&(C.classList.toggle("show",B),ne(C,!B)),B&&ke(),x){let _=f.find(de=>de.id===x?.id);!_||e.state.o||_.resolved&&!e.state.E?Y():K(_)}},M(){},destroy(){window.removeEventListener("pointerdown",Le,!0),window.removeEventListener("click",He,!0),window.removeEventListener("pointerover",re,!0),window.removeEventListener("pointerout",re,!0),window.clearTimeout(E),window.removeEventListener("keydown",Ue,!0),l.remove(),C.remove(),u.remove(),c.remove()}}}var wt="[data-pipeup-slide]",Lo=1e3,Ao=["scroll","resize","keyup","click","transitionend","slidechanged"],An=null,bt=null,Zt=new Set,Mn=new Set,yt=e=>{try{e()}catch(t){globalThis.reportError?.(t)}};function Co(e){let t=null;if(e){t={};let o=0;for(let[n,r]of Object.entries(e))if(!(typeof r!="string"||n==="slide"||n.length>Z.viewKey||r.length>Z.viewValue)){if(++o>=Z.viewEntries)break;t[n]=r}}An=t;for(let o of Mn)o()}function Po(e){return Zt.add(e),()=>void Zt.delete(e)}function Qt(e){bt=typeof e?.current=="function"&&typeof e.go=="function"?e:null}function Yr(e,t,o){let n=t.K(),r=null,i=0,c=0;for(let l of e){if(!t.shown(l))continue;let p=t.i(l),d=Math.min(p.left+p.width,n.width)-Math.max(p.left,0),m=Math.min(p.top+p.height,n.height)-Math.max(p.top,0);if(d<=0||m<=0)continue;let M=Math.round(d*m),C=t.opacity(l);(M>i||M===i&&(C>c||C===c&&l===o))&&(r=l,i=M,c=C)}return r}function Gr(e,t,o){return t!==null?e?.slide===void 0||e.slide===t:!e||!o?!0:Object.entries(e).every(([n,r])=>n==="label"||n==="slide"||o[n]===r)}function Xr(){return{i:e=>e.getBoundingClientRect(),shown:e=>e.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1,opacity:e=>parseFloat(getComputedStyle(e).opacity)||0,K:()=>({width:window.innerWidth,height:window.innerHeight})}}var Mo=()=>{let e=window.Reveal;return typeof e?.getIndices=="function"&&typeof e.slide=="function"?e:null};function Oo(e,t,o=Xr()){let n=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,r=null,i=null,c=0,l=!1,p=()=>[...e.querySelectorAll(wt)],d=()=>[...e.querySelectorAll(".slides > section")],m=T=>typeof T=="string"&&T.length>0&&T.length<=Z.viewValue?T:null,M=T=>m(T?.getAttribute("data-pipeup-slide"));function C(){if(bt){let x=null;if(yt(()=>{let O=bt.current();Number.isInteger(O)&&O>0&&(x=String(O))}),x!==null)return x}let T=Mo();if(T){let x=null;if(yt(()=>{let O=T.getIndices().h,k=d()[O];x=M(k?.matches(wt)?k:k?.querySelector(wt))??m(String(O+1))}),x!==null)return x}return r&&!r.isConnected&&(r=null),r=Yr(p(),o,r)??r,M(r)}function u(){c=0,i=C(),t()}let h=()=>{!c&&!l&&(c=requestAnimationFrame(u))},y=T=>Gr(T,i,An);function E(T){if(y(T))return Promise.resolve(!0);let x=T.slide,O=Mo(),k=p().find(q=>M(q)===x),z=/^[1-9]\d{0,5}$/.test(x??"");if(z&&bt)yt(()=>bt.go(Number(x)));else if(z&&O){let q=k?d().findIndex(X=>X===k||X.contains(k)):-1;yt(()=>O.slide(q>=0?q:Number(x)-1))}else if(Zt.size)for(let q of Zt)yt(()=>q({...T}));else if(k)k.scrollIntoView({block:"start",behavior:n?"auto":"smooth"});else return Promise.resolve(!1);let G=performance.now();return new Promise(q=>{let X=te=>{clearTimeout(j),q(te)},j=setTimeout(()=>X(!1),Lo),H=()=>{if(l)return X(!1);if(i=C(),y(T))return X(!0);if(performance.now()-G>=Lo)return X(!1);requestAnimationFrame(H)};requestAnimationFrame(H)})}let L=new MutationObserver(T=>{T.some(x=>x.target instanceof Element&&x.target.matches(wt))&&h()});L.observe(e,{subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]});for(let T of Ao)window.addEventListener(T,h,{capture:!0,passive:!0});return Mn.add(h),i=C(),{slide:()=>i,view(T){let x=T instanceof Element?T:T?.parentElement,O=M(x?.closest(wt))??i,k={...O!==null?{slide:O}:{},...An};return Object.keys(k).length?k:void 0},u:y,j:E,destroy(){l=!0,cancelAnimationFrame(c),L.disconnect();for(let T of Ao)window.removeEventListener(T,h,!0);Mn.delete(h)}}}var Io=["pipeup-quote","pipeup-on","pipeup-done"],Jr={"pipeup-quote":[[250,227,188,.75],[250,200,100,.28]],"pipeup-on":[[247,212,154,.95],[250,200,100,.42]],"pipeup-done":[[180,178,169,.22],[180,178,169,.2]]},Zr=(e,t)=>Io.map(o=>{let[n,r,i,c]=Jr[o][e?1:0];return`::highlight(${o}){background-color:rgba(${n},${r},${i},${+(c*t).toFixed(3)})}`}).join("");function $o(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var Qr="<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><rect x='7' y='7' width='23' height='23' rx='4' fill='none' stroke='#534AB7' stroke-width='2' stroke-dasharray='4 3'/><path d='M3 2v15l4-3.5 3 6.5 2.5-1.2-3-6.3H15z' fill='#fff' stroke='#2C2C2A' stroke-width='1.2' stroke-linejoin='round'/></svg>",ei=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(Qr)}") 3 2,crosshair!important}`;function No(e=document,t=!1){let o=e.defaultView?.CSSStyleSheet;if(!o||!("replaceSync"in o.prototype)||!("adoptedStyleSheets"in e))return{oe(){},re(){},Y(){},ie(){},remove:()=>Ro()};let n=new o,r=null,i=!1,c=1,l=0,p="",d=0,m=()=>n.replaceSync(Zr(t,c)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?ei:"")+(l||p?`html{--pipeup-panel:${l}px;${l?`margin-right:${l}px!important;`:""}${p}}`:""));return m(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],{oe(M){M!==r&&(r=M,m())},re(M){M!==i&&(i=M,m())},Y(M){c=M,m()},ie(M,C){M!==l&&(l=M,p=C?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(d),!M&&p&&(d=window.setTimeout(()=>{p="",m()},400)),m())},remove(){clearTimeout(d),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(M=>M!==n),Ro()}}}function Ho(e){$o()&&(CSS.highlights.set("pipeup-quote",new Highlight(...e.quote)),CSS.highlights.set("pipeup-on",new Highlight(...e.on)),CSS.highlights.set("pipeup-done",new Highlight(...e.done)))}function Ro(){if($o())for(let e of Io)CSS.highlights.delete(e)}var Cn=':host{all:initial}*{box-sizing:border-box}button{-webkit-appearance:none;appearance:none;font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}svg{display:block}.layer{all:initial;display:block;position:fixed;inset:0;pointer-events:none;font:13px/1.5 var(--pu-font,system-ui,sans-serif);color:var(--k);--k:#2C2C2A;--mu:#5F5E5A;--fa:#888780;--ln:#E5E3DA;--ru:#ECEAE2;--so:#FAFAF7;--su:#FFFFFF;--ho:#F1EFE8;--as:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--sh:0 8px 28px rgba(44,44,42,.1);--in:.26s;--mv:.34s;--out:.2s;--pl:1.2s;--eo:cubic-bezier(.22,.61,.36,1);--eio:cubic-bezier(.4,0,.2,1);--ei:cubic-bezier(.4,0,1,1)}.layer.dark{--k:#ECEBE6;--mu:#B4B2A9;--fa:#8D8B84;--ln:#3A3936;--ru:#34332F;--so:#22221F;--su:#1B1B19;--ho:#2C2C29;--sh:0 8px 28px rgba(0,0,0,.45)}.layer.hidden .bub,.layer.hidden .col,.layer.hidden .pop,.layer.hidden .tip,.layer.hidden .mark,.layer.hidden .selbar{opacity:0!important;pointer-events:none!important}.tx{font-size:14px;line-height:1.5;color:var(--k);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--fa)}.who,.rest{font-size:12px}.who{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rft>.who{display:block}.ctx[hidden]{display:none}.ctx{font-size:12px;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.tx a{color:var(--pu-accent);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.ft,.rft{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows var(--in) var(--eo),opacity var(--in) var(--eo)}.ft>*,.rft>*{overflow:hidden;min-height:0;display:flex;align-items:center}.root:hover>.ft,.root:focus-within>.ft,.it:hover>.rft,.it:focus-within>.rft{grid-template-rows:1fr;opacity:1}.ft.has-rest{grid-template-rows:1fr;opacity:1}.ft.has-rest>*{grid-area:1/1}.ft .hover{opacity:0;transition:opacity var(--in) var(--eo)}.ft .rest{transition:opacity var(--in) var(--eo)}.root:hover>.ft .hover,.root:focus-within>.ft .hover,.ft:not(.has-rest) .hover{opacity:1}.root:hover>.ft .rest,.root:focus-within>.ft .rest{opacity:0}.acts{margin-left:6px;display:flex;flex:none}.ib{width:24px;height:22px;display:grid;place-items:center;border-radius:6px;color:var(--mu);transition:background-color .2s var(--eo),color .2s var(--eo)}.ib:hover,.ib:focus-visible{background:var(--ho);color:var(--k);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--mv) var(--eio)}.more>div{overflow:hidden;min-height:0}.th:not(.on) .more{grid-template-rows:0fr}.row{display:flex;align-items:center;gap:8px;padding:8px 0 2px;cursor:text}.input{flex:1;min-width:0;height:27px;display:block;border:0;border-bottom:1px solid var(--ln);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--k);background:transparent;transition:border-color var(--in) var(--eo)}.row:hover .input,.input:hover{border-bottom-color:var(--mu)}.input:focus{border-bottom-color:var(--pu-accent)}.ed{display:flex;gap:10px;align-items:center;min-height:34px;padding:6px 10px}.ed .input{font-size:13px;height:22px}.root,.it{position:relative;padding-right:30px}.av{display:grid;place-items:center;width:22px;height:22px;border-radius:32%;font-size:12px;font-weight:600;line-height:1;opacity:0;transform:scale(.85);transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.av.in{opacity:1;transform:none}.av svg{width:80%;height:80%}.root>.av,.it>.av{position:absolute;top:0;right:0}.it>.av{top:6px}.av{--av-l:92%;--av-d:30%;--s:60%;background:hsl(var(--h) var(--s) var(--av-l));color:hsl(var(--h) var(--s) var(--av-d))}.dark .av{--av-l:20%;--av-d:78%}.c0{--h:0}.c1{--h:25}.c2{--h:50}.c3{--h:130}.c4{--h:175}.c5{--h:215}.c6{--h:270}.c7{--h:330}.c8{--h:28;--s:35%}.c9{--h:220;--s:8%}.me{flex:none;display:grid}.me>.av{grid-area:1/1;width:26px;height:26px;font-size:13px}.you{display:grid;padding:0 34px;min-height:24px;font-size:12px;color:var(--fa)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.say{white-space:pre;overflow:hidden}.nm{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.say button{flex:none}.say button{color:var(--mu);text-decoration:underline;text-decoration-color:var(--ln);text-underline-offset:2px;transition:color .2s var(--eo)}.say button:hover,.say button:focus-visible{color:var(--pu-accent);outline:none}.nf{opacity:0;transform:translateY(-4px);pointer-events:none}.nf .input{font-size:13px;height:24px}.you.naming .nf{opacity:1;transform:none;pointer-events:auto}.you.naming .say{opacity:0;pointer-events:none}.send{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;color:var(--pu-accent);flex:none;opacity:0;pointer-events:none;transition:opacity var(--in) var(--eo),background-color .2s var(--eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--as)}.bub{position:fixed;left:0;top:0;width:20px;height:20px;margin:-20px 0 0 -2px;border-radius:50% 50% 50% 0;background:var(--pu-accent);border:2px solid var(--su);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--fa)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--eo),transform .26s var(--eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--eo),transform .26s var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.pop{position:fixed;width:var(--pu-pop);border-radius:12px;padding:10px 12px 8px;pointer-events:none;opacity:0;transform:translateY(6px) scale(.98);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.pop.show.glide{transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--as);border-radius:8px;opacity:0;transition:opacity .3s var(--eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--as);animation:pu-pulse var(--pl) var(--eio) forwards}@keyframes pu-pulse{0%{opacity:0;transform:scale(.985)}35%{opacity:.85;transform:scale(1)}to{opacity:0;transform:scale(1.02)}}.col{position:fixed;left:0;top:0;pointer-events:none;transition:opacity var(--in) var(--eo)}.th{position:absolute;left:0;right:0;top:0;padding:4px 4px 4px 12px;pointer-events:auto;cursor:pointer;box-shadow:inset 2px 0 0 transparent;transition:transform var(--mv) var(--eio),box-shadow var(--in) var(--eo),opacity var(--in) var(--eo)}.th.hot{box-shadow:inset 2px 0 0 var(--ln)}.th.on{box-shadow:inset 2px 0 0 var(--pu-accent);cursor:default}.th.dim{opacity:.45}.th.resolved:not(.on):not(.hot){opacity:.6}.th.lost .ctx{white-space:normal}.th.wait{opacity:0!important;pointer-events:none}.th.out{opacity:0!important;pointer-events:none;transition:opacity var(--out) var(--ei)}.th:has(.opn:focus-visible){box-shadow:inset 2px 0 0 var(--ln);outline:2px solid var(--pu-accent);outline-offset:2px;border-radius:4px}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.selbar.show{opacity:1;transform:none;pointer-events:auto}.selbar button{width:32px;height:30px;display:grid;place-items:center;border-radius:8px;color:var(--pu-accent);transition:background-color .2s var(--eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--as);outline:none}.pick{position:fixed;left:0;top:0;border:2px solid color-mix(in srgb,var(--pu-accent) 70%,transparent);background:color-mix(in srgb,var(--pu-accent) 6%,transparent);border-radius:8px;pointer-events:none;opacity:0;transition:opacity var(--out) var(--ei),border-color var(--out) var(--ei),border-width var(--out) var(--ei),box-shadow var(--out) var(--ei)}.pick.show{opacity:1;transition-duration:var(--in);transition-timing-function:var(--eo)}.pick.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.pick.on{border-color:var(--pu-accent)}.pick.kf{border:3px solid var(--pu-accent);box-shadow:0 0 0 2px var(--su)}.km{position:fixed;left:0;top:0;pointer-events:none;outline:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.namebar{position:fixed;left:0;top:0;display:flex;align-items:center;gap:2px;padding:2px 2px 2px 10px;border-radius:10px;font-size:12px;color:var(--mu);white-space:nowrap;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.namebar .lbl{margin-right:6px;max-width:260px;overflow:hidden;text-overflow:ellipsis}.namebar .nb{padding:4px;display:grid;place-items:center;border-radius:7px;transition:background-color .2s var(--eo),color .2s var(--eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--ho);color:var(--k);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{position:relative;display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);transition:background-color .3s var(--eo),color .3s var(--eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--in) var(--eo)}.cnt,.has>.plus{opacity:0}.has>.cnt{opacity:1}.n{font-size:12px;font-weight:500;line-height:1;margin:-1.4px 0 0 1.4px;font-variant-numeric:tabular-nums;opacity:0;transition:opacity var(--in) var(--eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--ho)}.launch .mode.on{background:var(--pu-accent);color:#fff}.mode>.dot{position:absolute;top:3px;right:3px;width:9px;height:9px;border-radius:50%;background:var(--pu-accent);border:2px solid var(--su);opacity:0}.mode.else>.dot{opacity:1}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--fa)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--out) var(--ei)}@media(hover:none){.ttip,.tt{display:none}}.menu{position:fixed;right:20px;bottom:76px;width:290px;border-radius:12px;padding:4px;pointer-events:none;opacity:0;transform:translateY(6px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.mi{position:relative;display:flex;gap:10px;align-items:center;width:100%;min-height:34px;text-align:left;padding:6px 10px;border-radius:8px;transition:background-color .2s var(--eo)}.mi:hover,.mi:focus-visible{background:var(--so);outline:none}.mi svg{color:var(--mu);flex:none}.mi small{display:block;color:var(--fa);font-size:12px}.lb{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ma{flex:none;display:grid;margin:-2px 0}.ma .av{width:20px;height:20px;font-size:11px}.mi .av svg{color:inherit}.sep{height:1px;margin:4px 10px;background:var(--ru)}.tt{position:absolute;right:calc(100% + 14px);top:50%;translate:0 -50%;width:max-content;max-width:220px;padding:4px 9px;border-radius:8px;font-size:12px;line-height:1.4;color:var(--mu);background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}@media(max-width:600px){.tt{right:8px;top:auto;bottom:100%;translate:none;transform:translateY(3px)}}.sw{position:relative;flex:none;width:26px;height:16px;border-radius:8px;background:var(--ln);transition:background-color var(--mv) var(--eio)}.sw:before,.sw:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 2px #00000040;transition:transform var(--mv) var(--eio),opacity var(--mv) var(--eio)}.sw:before{opacity:0;transform:translate(10px)}[aria-checked=true]>.sw{background:var(--pu-accent)}[aria-checked=true]>.sw:after{transform:translate(10px)}.all{position:fixed;top:0;right:0;bottom:0;width:var(--pu-panel);display:flex;flex-direction:column;border-width:0 0 0 1px;opacity:0;transform:translate(100%);transition:transform var(--out) var(--ei),opacity var(--out) var(--ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--mv) var(--eo),opacity var(--in) var(--eo)}.all.full{width:100%}.hd{display:flex;align-items:center;gap:8px;padding:12px 10px 8px 16px;font-weight:600}.pn{font-weight:400;color:var(--fa)}.hs{margin-left:auto;display:flex;align-items:center;gap:6px;padding:3px 4px 3px 6px;border-radius:6px;font-size:12px;font-weight:400;color:var(--mu);transition:background-color .2s var(--eo)}.hs:hover,.hs:focus-visible{background:var(--ho);outline:none}.list{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:4px}.all .mi{align-items:flex-start}.all .mi>.av{flex:none}.all .mi>span:last-child{flex:1;min-width:0}.all .mi small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.all .mi .av svg{margin:0}.all .mi.done{opacity:.6}.layer.listing .col{opacity:0;transition:opacity var(--out) var(--ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--fa)}.sec b{margin-left:6px;font-weight:500;color:var(--pu-accent)}.toast{position:fixed;left:50%;bottom:28px;border-radius:10px;padding:8px 14px;font-size:13px;opacity:0;transform:translate(-50%,6px);transition:opacity .3s var(--eo),transform .36s var(--eo)}.toast.show{opacity:1;transform:translate(-50%)}@media(forced-colors:active){.pick.kf{border:3px solid Highlight}.layer :is(.ib,.mi,.nb,.hs,.selbar button,.say button):focus-visible{outline:2px solid Highlight}}@media(prefers-reduced-motion:reduce){.bub,.bub.in,.bub.in:hover,.bub.on,.tip,.pop,.selbar,.menu,.all,.ttip,.tt,.toast{transform:none!important}.sw:after{transform:none!important;transition-property:opacity}[aria-checked=true]>.sw:after{opacity:0}[aria-checked=true]>.sw:before{opacity:1}.th{transition-property:opacity,box-shadow}.tip.show{transition-property:opacity}.pick,.pick.show{transition:opacity .16s ease-in-out}.all,.all.show{transition-property:opacity}.namebar,.namebar.show{transform:none!important;transition:opacity .16s ease-in-out}.av,.nf{transform:none!important}@keyframes pu-pulse{0%{opacity:0}35%{opacity:.85}to{opacity:0}}}';var Bo="#534AB7",ti="rgb(0, 0, 238)";function Do(e){let t=/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)/.exec(e);if(!t||t[1]===void 0||t[2]===void 0||t[3]===void 0)return null;let o=t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]);return{r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:o}}function ni(e){let t=o=>{let n=o/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Fo(e){let t=e.ownerDocument,o=t.defaultView;if(!o)return{font:"system-ui, sans-serif",accent:Bo,dark:!1};let n=t.documentElement,r=o.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(o.getComputedStyle(n).getPropertyValue("--pipeup-accent")||n.style.getPropertyValue("--pipeup-accent")).trim(),c=e.querySelector("a[href]"),l=c?o.getComputedStyle(c).color:"",p=i||(l&&l!==ti?l:Bo),d=Do(o.getComputedStyle(t.body).backgroundColor);(!d||d.a===0)&&(d=Do(o.getComputedStyle(n).backgroundColor));let m=d&&d.a>0?ni(d)<.2:o.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(o.getComputedStyle(n).colorScheme||"");return{font:r,accent:p,dark:!!m}}function Vo(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function qo(e,t=document){let o=t.createElement("pipeup-root");o.setAttribute("data-pipeup-ignore",""),o.style.cssText="position:fixed!important;inset:0!important;pointer-events:none!important;z-index:2147483000!important;display:block!important;margin:0!important;visibility:visible!important;opacity:1!important;transform:none!important;filter:none!important;";let n=o.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in n){let c=new r;c.replaceSync(Cn),n.adoptedStyleSheets=[c]}else{let c=t.createElement("style");c.textContent=Cn,n.append(c)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${mt}px`),i.style.setProperty("--pu-pop",`${Je}px`),Vo(i,e),n.append(i),t.documentElement.append(o),{element:o,shadow:n,n:i,destroy:()=>o.remove()}}var oi=40,ri=250,ii=120,si=2400,ai=4e3,li=1e4;function _o(e,t=!1){return Sn(e,t)?"column":"bubbles"}function ci(e){return[...e.state.mode==="column"?[xo(e),wn(e,{q:!1})]:[wn(e,{q:!0})],ko(e),To(e)]}var di=1e3,en="Shown here, but not saved yet \u2014 it will be saved with your next change",Qe=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function Ko(e){let t=Fo(e.root),o=qo(t),n=No(document,t.dark);n.Y(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),c=new Map,l=new Set,p=new WeakSet,d={o:null,w:null,E:!1,hidden:!0,mode:_o(e.root),t:null,s:!1,l:!1,L:!1,c:!1},m=g("div",{class:"toast",role:"status","aria-live":"polite"}),M=g("div",{class:"sr","aria-live":"polite"});o.n.append(m,M);let C=null,u=[],h=null,y=!1,E=0,L=0,T=0,x=0,O=0,k=new Set,z="",G=new Map,q=Oo(e.root,()=>{!y&&N()&&W()}),X=!1,j=0;function H(a,v=si,A=!1,$=!1){y||(X=A,m.textContent=a,$?m.setAttribute("aria-hidden","true"):m.removeAttribute("aria-hidden"),m.classList.add("show"),window.clearTimeout(E),E=window.setTimeout(()=>m.classList.remove("show"),v))}function te(){X&&(X=!1,window.clearTimeout(E),m.classList.remove("show"))}function xe(a){M.textContent="",cancelAnimationFrame(j),j=requestAnimationFrame(()=>M.textContent=a)}function se(a){H(Qe(a))}function ae(a){throw se(a),a}let le=a=>({thread:a,location:At(a.anchor,c.get(a.id)??dt(a.anchor,e.root),e.root)}),Ee=a=>d.o!==a||d.E?!1:(h?.z()?h.W():o.n.querySelector(".launch .mode")?.focus({preventScroll:!0}),!0),ke={reply:async(a,v)=>{try{await e.doc.reply(a,v)}catch(A){A instanceof ve?H(en):ae(A)}},resolve:async a=>{try{await e.doc.resolve(a),Ee(a)&&(d.o=null),H("Resolved \xB7 Show resolved brings it back")}catch(v){v instanceof ve?(Ee(a)&&(d.o=null),H(`Resolved \xB7 ${en}`)):H(Qe(v))}},reopen:async a=>{try{await e.doc.reopen(a),H("Reopened")}catch(v){H(v instanceof ve?`Reopened \xB7 ${en}`:Qe(v))}},close:()=>{ee(null);let a=ye&&o.n.querySelector(ye);a?a.focus({preventScroll:!0}):h?.W(),ye=""},copy:a=>{try{let v=e.doc.threads().find($=>$.id===a);if(!v)return;let A=Nt(le(v),"ai",location.href,Date.now());Ln(A,o.n).then(()=>H("Thread copied as Markdown for AI"),$=>H(Qe($)))}catch(v){H(Qe(v))}}},pe={copyAll:async a=>{let v=pe.all(),A=Ht(v,a,{title:document.title,url:location.href,exportedAt:new Date});try{await Ln(A,o.n);let $=v.filter(V=>!V.thread.resolved).length;H(`Copied ${$} thread${$===1?"":"s"}${a==="ai"?" as Markdown for AI":""}`)}catch($){H(Qe($))}},ve:()=>{d.E=!d.E,W()},rename:async a=>{let v=a.replace(/\s+/g," ").trim();try{await f(v)?H(`New comments will say ${v}, but this browser couldn't remember it`):H(`New comments will say ${v}`)}catch(A){H(Qe(A))}},name:()=>e.doc.name,all:()=>[...e.doc.threads()].sort(qe(w)).map(le)},w={doc:e.doc,root:e.root,n:o.n,host:o.element,state:d,resolved:c,te:l,D:ke,c:pe,d:q,O:a=>k.has(a.id),ne:()=>{N()&&W()},I:a=>!d.hidden&&(!a.resolved||d.E)&&!k.has(a.id),be:(a,v)=>{for(let A of e.doc.threads()){let $=c.get(A.id);if(A.anchor.quote&&w.I(A)&&$?.range&&uo(a,v,pt($)))return A}return null},_:(a,v)=>w.T()?w.be(a,v):null,f:a=>a.composedPath().includes(o.element),X:a=>void p.add(a),pe:a=>p.has(a),open:ee,we:a=>ce(a),w:tt,Q:Ne,ue:Ke,T:()=>!C||C.se(),J:a=>{let v=C?.G();a(),v?.()},he:()=>{let a=d.t?.anchor.view,v=C?.G();Promise.resolve(q.u(a)||q.j(a??{}).then(()=>w.ne())).then(v)},ae:S,le:Le,ye:He,F:Ue,R:a=>{C=a},xe:H,S:xe,fe:te,Z:se,Ee:I,p:W,U:re};function P(a){let v=performance.now(),A=e.doc.threads();for(let $ of A){if(a&&!a.has($.id))continue;let V=performance.now()-v<oi,J=dt($.anchor,e.root,{fuzzy:V});c.set($.id,J),!V&&J.state==="orphaned"?l.add($.id):l.delete($.id)}for(let $ of[...c.keys()])A.some(V=>V.id===$)||c.delete($);l.size===0?(window.clearTimeout(x),x=0):x===0&&(x=window.setTimeout(()=>{x=0,!y&&(P(new Set(l)),W())},ri))}function N(){let a=new Set,v=q.slide()!==null,A=new Set;for(let V of e.doc.threads()){A.add(V.id);let J=c.get(V.id)?.element;(!q.u(V.anchor.view)||!v&&J?.checkVisibility?.({visibilityProperty:!0})===!1)&&a.add(V.id)}k=a;for(let V of G.keys())A.has(V)||G.delete(V);let $=`${q.slide()}|${[...a].join()}`;return $===z?!1:(z=$,!0)}function K(a){let v=[],A=[],$=[];for(let V of a){let J=c.get(V.id);V.resolved&&!d.E||!J?.range||k.has(V.id)||(V.id===d.o||V.id===d.w?A.push(J.range):V.resolved?$.push(J.range):v.push(J.range))}d.t&&q.u(d.t.anchor.view)&&A.push(...d.t.ranges),Ho({quote:v,on:A,done:$})}let Y=0,D=0,U=0;function Q(a){if(a===D)return;D=a,cancelAnimationFrame(U);let v=Y,A=performance.now(),$=a?260:200,V=J=>{let he=Math.min(1,(J-A)/$);Y=v+(a-v)*(a?1-(1-he)**3:he*he),n.Y(Y),he<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let fe=0,Se=0;function _e(a){a!==fe&&(fe=a,n.ie(a,r),window.clearTimeout(Se),Se=window.setTimeout(()=>{P(),W()},r?0:400))}function W(){if(y)return;let a=e.doc.threads();if(N(),d.o&&k.has(d.o)){let A=o.n.querySelector(`[data-thread="${d.o}"] .rbox textarea`)?.value;A&&G.set(d.o,A),d.o=null}d.hidden=!d.s&&!d.l&&!d.L&&!d.t,d.hidden&&(d.o=null),Q(d.hidden?0:1),o.n.classList.toggle("hidden",d.hidden),o.n.classList.toggle("listing",d.l);let v=d.l&&!Ze();_e(v?mt:0),n.oe(i?d.mode==="column"&&!d.hidden&&!v?vt:0:null),K(a);for(let A of u)A.p(a);h?.p(a)}let ye="",Te=()=>o.n.getRootNode().activeElement,Ie="input,textarea,select,[contenteditable]:not([contenteditable=false])",me=()=>{let a=Te();return a instanceof HTMLTextAreaElement&&a.value!==""||!!document.activeElement?.matches(Ie)};function ce(a,v=me(),A=Te()){let $=[...o.n.querySelectorAll(`[data-thread="${a}"] .rbox textarea`)].find(J=>!J.closest("[inert]")),V=A?.getAttribute("data-thread");ye=V?`.${A.classList[0]}[data-thread="${V}"]`:"",!(v||!$)&&$.focus({preventScroll:!0})}function $e(){let a=d.t;return!a||w.T()?!1:(q.u(a.anchor.view)||q.j(a.anchor.view??{}),!0)}function ee(a,v=!1){if(a&&$e())return;if(d.o===a&&!d.t)return a?ce(a):void 0;let A=!v&&me(),$=Te();if(a||(d.L=!1),d.o=a,a&&(d.t=null,I(a)),W(),a){let V=G.get(a),J=V&&o.n.querySelector(`[data-thread="${a}"] .rbox textarea`);J&&!J.value&&(J.value=V,J.dispatchEvent(new Event("input",{bubbles:!0}))),G.delete(a),v&&h?.z()?h.W():ce(a,A,$)}}function tt(a){d.w!==a&&(d.w=a,a&&a!==d.o&&I(a),W())}function Ne(a){te(),d.l=!1,d.t=a,d.o=null,W()}function Ke(a){if(!d.t)return Ne(a);Object.assign(d.t,a),W()}function Le(){d.t&&(d.t=null,W())}function He(a,v=!1){d.s!==a&&(d.s=a,n.re(a),a?(d.o=null,d.l=!1,h=yo(w)):(te(),h?.destroy(),h=null,xe("Comment mode off")),W(),h&&(v&&h.ee(),v?h.z()?H(En,li,!0,!0):H("Nothing here to comment on"):H(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${Ge} or Esc to finish`,ai,!0)))}function re(){d.t&&(q.u(d.t.anchor.view)||w.T())?Le():d.o?ee(null):h&&!h.U()&&He(!1)}function Ue(){if(d.t){$e()||Le();return}d.o&&ee(null)}async function f(a){try{return await e.onName(a),!1}catch(v){if(e.doc.name!==a)throw v;return!0}}async function S(a){let v=d.t;if(v)try{let A=await e.doc.comment(v.anchor,a);d.t=null,P(new Set([A])),ee(A,!0)}catch(A){if(A instanceof ve){d.t=null,P(new Set([A.id])),ee(A.id,!0),H(en);return}ae(A)}}function I(a){let v=c.get(a);if(!v||v.state==="orphaned")return;let A=v.range?pt(v):v.element?[v.element.getBoundingClientRect()]:[];for(let $ of A.slice(0,6)){let V=g("div",{class:"pulse"});Ve(V,$,4),o.n.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function R(){for(let a of u)a.destroy();u=ci(w),W()}let F=()=>{if(!y){for(let a of u)a.M();h?.M(),O=requestAnimationFrame(F)}},B=a=>{let v=a.composedPath()[0];return v instanceof Element&&v.closest(Ie)!==null},_=a=>{if(a.key==="Escape")return re();if(ao(a)&&!a.isComposing&&!a.defaultPrevented&&!B(a)){if(a.preventDefault(),h?.ge()&&h.ee())return;He(!d.s,!0)}},de=a=>{if(w.f(a)||p.has(a))return;let v=window.getSelection();v&&!v.isCollapsed||Ue()},Ae=()=>{let a=_o(e.root,d.mode==="column");a!==d.mode?(d.mode=a,R()):W()};function Me(){let a=performance.now();L===0&&(T=a),window.clearTimeout(L);let v=Math.min(ii,Math.max(0,T+di-a));L=window.setTimeout(()=>{L=0,P(),W()},v)}let at=new MutationObserver(a=>{a.every(v=>o.element.contains(v.target))||Me()});window.addEventListener("keydown",_),window.addEventListener("click",de),window.addEventListener("resize",Ae),at.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let s=typeof ResizeObserver>"u"?null:new ResizeObserver(Me);s?.observe(e.root);let b=e.doc.onChange(()=>{P(),W()});return P(),R(),O=requestAnimationFrame(F),{ctx:w,destroy(){y=!0,cancelAnimationFrame(O),cancelAnimationFrame(U),cancelAnimationFrame(j),q.destroy(),window.clearTimeout(Se),window.clearTimeout(E),window.clearTimeout(L),window.clearTimeout(x),at.disconnect(),s?.disconnect(),b(),window.removeEventListener("keydown",_),window.removeEventListener("click",de),window.removeEventListener("resize",Ae),h?.destroy();for(let a of u)a.destroy();n.remove(),o.destroy()}}}var et=null,ui=4e3;function Pn(e={}){if(et)return et;let t=fi(e,()=>t).catch(o=>{throw et===t&&(et=null),o});return et=t,t}function pi(e,t){return new Promise((o,n)=>{let r=setTimeout(()=>n(new Error("timed out")),t);e.then(o,n).finally(()=>clearTimeout(r))})}async function fi(e,t){let o=document.documentElement.getAttribute("data-pipeup-doc"),{id:n,key:r}=o?await xt(o):{id:`page-${Fe(location.origin+location.pathname)}`,key:null},i,c=!1,l;if(e.store)i=e.store,l=await it(i);else try{let u=ot.open();i=await pi(u,ui).catch(h=>{throw u.then(y=>y.close(),()=>{}),h}),l=await it(i)}catch{i=new rt,c=!0,l=await it(i)}let p=e.name?.trim();p&&p!==l.name&&(l={...l,name:p},await i.saveProfile(l));let d=await nt.open({doc:n,key:r,store:i,identity:l.identity,name:l.name});Qt(e.slides??null);let m;try{m=Ko({doc:d,root:e.root??document.body,onName:async u=>{d.name=u,l={...l,name:u},await i.saveProfile(l)}})}catch(u){throw Qt(null),u}c&&m.ctx.xe("This browser can't keep comments for this page \u2014 copy the comments (Copy as Markdown) to keep them");let M=()=>void d.flush().catch(u=>globalThis.reportError?.(u)),C=!1;return window.addEventListener("pagehide",M),{document:d,flush:()=>d.flush(),unmount:()=>{C||(C=!0,window.removeEventListener("pagehide",M),m.destroy(),Qt(null),et===t()&&(et=null))}}}function Uo(){let e=document.documentElement;if(!e.hasAttribute("data-pipeup-doc")||e.getAttribute("data-pipeup-auto")==="off")return;let t=()=>void Pn().catch(o=>console.error(o));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}var mi="0.4.0-beta.3";typeof document<"u"&&Uo();return Xo(hi);})();
|
|
9
|
+
`+t)+(e.edited?" (edited)":"")}function g(e,t={},...o){let n=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?n.className=String(i):n.setAttribute(r,i===!0?"":i));for(let r of o)r!=null&&r!==!1&&n.append(r);return n}function ne(e,t){let o=e.getRootNode().activeElement;t&&o instanceof HTMLElement&&e.contains(o)&&o.blur(),e.inert=t}function Bt(e,t,o=null){let n=e.getRootNode().activeElement,r=!1;for(let i=t.length;i--;o=t[i])t[i].nextSibling!==o&&(r=!!e.insertBefore(t[i],o));return r&&n&&t.some(i=>i.contains(n))&&n.focus({preventScroll:!0}),r}function we(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function Ve(e,t,o=4){e.style.left=`${t.left-o}px`,e.style.top=`${t.top-o}px`,e.style.width=`${t.width+o*2}px`,e.style.height=`${t.height+o*2}px`}var Tr=/\bhttps?:\/\/[^\s<>"'`]+/gi,Lr=`.,;:!?'"]}`,Ar=2048,Mr=/[\u202A-\u202E\u2066-\u2069]/;function Cr(e){let t=0,o=0;for(let r of e)r==="("?t++:r===")"&&o++;let n=e.length;for(;n>0;){let r=e[n-1];if(r===")"&&o>t)o--;else if(!Lr.includes(r))break;n--}return e.slice(0,n)}function Dt(e){let t=[],o=0;for(let n of e.matchAll(Tr)){if(n[0].length>Ar||Mr.test(n[0]))continue;let r=Cr(n[0]),i=n.index??0,c;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;c=p.href}catch{continue}i>o&&t.push(e.slice(o,i));let l=g("a",{href:c,target:"_blank",rel:"noopener noreferrer"},r);l.addEventListener("click",p=>p.stopPropagation()),t.push(l),o=i+r.length}return o<e.length&&t.push(e.slice(o)),t}var Re={code:"KeyC",mods:{shift:!0,alt:!0,meta:!1,ctrl:!1},mac:{label:"\u21E7\u2325C",aria:"Shift+Alt+C"},other:{label:"Shift+Alt+C",aria:"Shift+Alt+C"}},so=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),Ge=(so?Re.mac:Re.other).label,hn=(so?Re.mac:Re.other).aria;function ao(e){return e.code===Re.code&&e.shiftKey===Re.mods.shift&&e.altKey===Re.mods.alt&&e.metaKey===Re.mods.meta&&e.ctrlKey===Re.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var lo="http://www.w3.org/2000/svg",Pr={comment:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z","M12.3 8.2v6.6M9 11.5h6.6"],send:["M21 12L3.5 4.5 6.2 12l-2.7 7.5zM6.2 12H13"],copy:["M10 8h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2z","M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"],resolve:["M5 12.5l4.5 4.5L19 7.5"],reopen:["M3 12a9 9 0 1 0 3-6.7","M3 4v5h5"],lines:["M4 7h16M4 12h10M4 17h7"],list:["M3 6.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 12a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M3 17.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0M9 6.5h11M9 12h11M9 17.5h7"],expand:["M14 4h6v6M20 4l-6 6M10 20H4v-6M4 20l6-6M20 14v6h-6M20 20l-6-6M4 10V4h6M4 4l6 6"],pin:["M6 18v-6a6 6 0 1 1 6 6z"],shrink:["M20 10h-6V4M14 10l6-6M4 14h6v6M10 14l-6 6M14 20v-6h6M14 14l6 6M10 4v6H4M10 10L4 4"],bubble:["M20.5 11.5a8 8 0 0 1-11.7 7.1L4 19.8l1.2-4.4A8 8 0 1 1 20.5 11.5z"],close:["M6 6l12 12M18 6L6 18"],edit:["M4 20h4L19 9l-4-4L4 16z"]};function oe(e,t=15,o){let n=gn(Pr[e],t);return o&&n.setAttribute("stroke-width",String(o)),n}function gn(e,t){let o=document.createElementNS(lo,"svg"),n={width:String(t),height:String(t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};for(let[r,i]of Object.entries(n))o.setAttribute(r,i);for(let r of e){let i=document.createElementNS(lo,"path");i.setAttribute("d",r),o.append(i)}return o}var Ft=(e,t,o)=>`M${e} ${t}a${o} ${o} 0 1 0 ${2*o} 0a${o} ${o} 0 1 0 -${2*o} 0`,Or={Otter:"M4 13.2C4 9.2 7.6 6.5 12 6.5s8 2.7 8 6.7-3.6 6.3-8 6.3-8-2.3-8-6.3zM5.6 9.6a1.8 1.8 0 1 1 2.7-2.3M18.4 9.6a1.8 1.8 0 1 0-2.7-2.3M9.2 11.6h.01M14.8 11.6h.01M11 14h2l-1 1zM9.8 15.8l-3.2.4M9.9 17l-2.7 1.1M14.2 15.8l3.2.4M14.1 17l2.7 1.1",Fox:"M3.5 4l5 3.5h7l5-3.5-1.5 8.5L12 20l-7-7.5zM9 12h.01M15 12h.01M12 17h.01",Owl:`M5 4.5l3 2.5h8l3-2.5V14a7 7 0 0 1-14 0z${Ft(7.4,11.5,1.9)}${Ft(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${Ft(5,13.5,7)}M8.9 7.22A2.8 2.8 0 1 0 5.89 10.09M18.11 10.09A2.8 2.8 0 1 0 15.1 7.22M9.4 12.6h.01M14.6 12.6h.01M10.3 16.4c0-1 .8-1.6 1.7-1.6s1.7.6 1.7 1.6-.8 1.6-1.7 1.6-1.7-.6-1.7-1.6z`,Rabbit:`${Ft(6.5,15.5,5.5)}M9.6 10.5C8.2 6.5 8.4 2.5 9.8 2.5s2.4 3.5 1.6 7.5M14.4 10.5c1.4-4 1.2-8-.2-8s-2.4 3.5-1.6 7.5M10 15h.01M14 15h.01M11.3 17.3l.7.5.7-.5`};function co(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let o=t[0].toUpperCase();return[...o].length===1?o:t[0]}var ut=(e,t)=>co(t)||be(e);function Xe(e,t){return g("span",{class:`av c${mn(e)}`,"aria-hidden":"true","data-animal":be(e)},co(t)||gn([Or[je[fn(e)]]],24))}var Rr=320;function Vt(e,t){setTimeout(()=>{e.remove(),t?.()},Rr)}function qt(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function _t(e){let t=g("textarea",{class:"input",rows:"1","aria-label":e.label}),o=g("button",{class:"send",type:"button","aria-label":"Send",title:"Send",inert:!0},oe("send")),n=g("div",{class:"row"},e.before,t,o),r=!1,i=()=>{let l=t.value.trim()!=="";o.classList.toggle("show",l),o.inert=!l,t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},c=async()=>{let l=t.value.trim();if(!(!l||r)){r=!0;try{await e.$(l),o.matches(":focus")&&t.focus(),t.value="",i()}catch{}finally{r=!1}}};return n.addEventListener("mousedown",l=>{l.target===t||o.contains(l.target)||(l.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",l=>{l.stopPropagation(),l.key==="Enter"&&!l.shiftKey&&!l.isComposing?(l.preventDefault(),c()):l.key==="Escape"&&(l.preventDefault(),t.value="",i(),t.blur(),e.N?.())}),o.addEventListener("click",l=>{l.stopPropagation(),c()}),{element:n,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Ir(e){let t=g("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",y=>y.preventDefault());let o=_t({label:"Comment",before:t,$:e.$,N:e.N}),n=g("div",{class:"say"}),r=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=g("div",{class:"nf"},r),c=g("div",{class:"you"},n,i),l="",p=!1,d=()=>{let y=e.name(),E=y?"change":"add your name";if(t.title=y?"Change your name":"Add your name",!t.lastChild||l!==y){let T=Xe(e.me,y),x=t.lastChild;x?(qt(T),Vt(x)):T.classList.add("in"),t.append(T),l=y}let L=g("button",{type:"button"},E);L.addEventListener("click",M),n.replaceChildren(g("span",{class:"nm"},y||`You're ${be(e.me)}`)," \xB7 ",L)},m=y=>{c.classList.toggle("naming",y),ne(n,y),ne(i,!y)};function M(y){y.stopPropagation(),r.value=e.name(),m(!0),r.focus({preventScroll:!0}),r.select()}let C=()=>{m(!1),o.focus()};t.addEventListener("click",M),r.addEventListener("keydown",y=>{if(y.stopPropagation(),y.key==="Escape")y.preventDefault(),C();else if(y.key==="Enter"){y.preventDefault();let E=r.value.trim();if(!E||E===e.name())return C();if(p)return;p=!0,e.rename(E).finally(()=>{p=!1,d(),C()})}}),d(),m(!1);let u=g("div",{class:"ctx"},e.label);return{element:g("div",{class:"draft"},u,o.element,c),G:()=>{let{selectionStart:y,selectionEnd:E}=o.input;return()=>{o.focus(),o.input.setSelectionRange(y,E)}},H:y=>{u.hidden=y},V:y=>{u.textContent=y},focus:()=>o.focus(),se:()=>o.input.value.trim()===""}}function Kt(e,t){let o=Ir({label:t.label,me:e.doc.me,name:()=>e.c.name(),rename:n=>e.c.rename(n),$:n=>e.ae(n),N:()=>e.le()});return e.R(o),o}function Ut(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let o=t.element.getBoundingClientRect();if(!o.width&&!o.height)return null;if(e.point)return{x:o.left+e.point.x*o.width,y:o.top+e.point.y*o.height};let n=t.element.ownerDocument.createRange();n.selectNodeContents(t.element);let r=n.getBoundingClientRect();return{x:r.width?Math.min(o.right-8,r.right+6):o.right-8,y:(r.height?r.top:o.top)+8}}function pt(e){return e.range?[...e.range.getClientRects()]:[]}function vn(e,t){let o=pt(t)[0];if(o)return o.top;if(t.state==="orphaned"||!t.element)return null;let n=t.element.getBoundingClientRect();return e.point?n.top+e.point.y*n.height:n.top}function ft(e,t){let o=pt(t).at(-1);if(o)return{x:o.left,y:o.bottom,below:!0};let n=Ut(e,t);return n?{...n,below:!1}:null}function uo(e,t,o){for(let n of o)if(e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom)return!0;return!1}function po(e,t,o=10){let n=[...e].sort((l,p)=>l.m-p.m),r=new Array(n.length).fill(0),i=n.findIndex(l=>l.id===t),c=l=>n[l];if(i<0)n.forEach((l,p)=>{r[p]=p===0?l.m:Math.max(l.m,(r[p-1]??0)+c(p-1).height+o)});else{r[i]=c(i).m;for(let l=i+1;l<n.length;l++)r[l]=Math.max(c(l).m,(r[l-1]??0)+c(l-1).height+o);for(let l=i-1;l>=0;l--)r[l]=Math.min(c(l).m,(r[l+1]??0)-c(l).height-o)}return new Map(n.map((l,p)=>[l.id,r[p]??0]))}var mt=320,Je=300,$r=480,Ze=()=>window.innerWidth<=$r;function zt(e){let t=window.innerWidth;return{width:e&&!Ze()?t-mt:t,height:window.innerHeight}}function Wt(e,t,o,n=12){let r,i;return e.below?(r=Math.min(e.x,o.width-t.width-n),i=e.y+8,i+t.height>o.height-n&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>o.width-n&&(r=e.x-t.width-28),i=Math.min(e.y-12,o.height-t.height-n)),{left:Math.max(n,r),top:Math.max(n,i)}}function fo(e,t,o,n=12,r=44){let i=e.top-r>=8,c=e.top+e.height+8+(i?0:r),l=e.top-8-(i?r:0)-t.height,p=c+t.height<=o.height-n||l<n,d=p?c:l;return{above:!p,left:Math.max(n,Math.min(e.left,o.width-t.width-n)),top:Math.max(n,d)}}function jt(e,t,o){let n=e.top-t.height-10;return n<8&&(n=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,o.width-t.width-8)),top:n}}function Yt(e,t){let o=e.resolved.get(t.id);return o?.range?.startContainer??o?.element??null}var qe=e=>(t,o)=>{let n=Yt(e,t),r=Yt(e,o),i=c=>c.anchor.point??{x:0,y:-1};return n!==r?!r||n&&n.compareDocumentPosition(r)&4?-1:1:i(t).y-i(o).y||i(t).x-i(o).x};var Gt=e=>`${e} ${e===1?"reply":"replies"}`;function st(e,t,o){let n={...o},r=e.id,i=g("div",{class:"rbox always"},g("div",{},_t({label:"Reply",$:E=>t.reply(r,E),N:t.close}).element)),c=g("div",{}),l=g("div",{}),p=null,d=g("div",{},l,g("div",{class:"more"},c)),m=new Map,M=new Map,C=new Map,u=E=>{let L=ut(E.author,E.name),T=m.get(E.id),x=T?.e;if((!x||T.key!==L)&&(x=qt(Xe(E.author,E.name)),T)){let k=T.e;C.set(E.id,k),Vt(k,()=>C.get(E.id)===k&&C.delete(E.id))}x.title=ue(E),M.set(E.id,{key:L,e:x});let O=C.get(E.id);return O?[O,x]:[x]},h=(E,L,T)=>{let x=g("button",{class:"ib",type:"button","aria-label":L,title:L},oe(E));return x.addEventListener("click",O=>{O.stopPropagation(),T()}),x};function y(E,L={}){Object.assign(n,L),r=E.id;let T=(n.now??Date.now)(),x=E.root.replies.length,O=j=>g("span",{class:"who"},`${ue(j)} \xB7 ${Ye(j.at,T)}`),k=j=>g("div",{class:j.deleted?"tx del":"tx"},...j.deleted?["Deleted"]:[...Dt(j.text),j.edited?" (edited)":""]),z=E.resolved?"Resolved"+(x?` \xB7 ${Gt(x)}`:""):x?Gt(x):"",G=g("div",{class:n.B==="column"&&z?"ft has-rest":"ft"},n.B==="column"&&z?g("span",{class:"rest"},z):null,g("span",{class:"hover"},O(E.root),g("span",{class:"acts"},h("copy","Copy thread",()=>t.copy(E.id)),E.resolved?h("reopen","Reopen",()=>void t.reopen(E.id)):h("resolve","Resolve",()=>void t.resolve(E.id))))),q=n.lost?g("div",{class:"ctx"},`${n.place||"No longer on the page"} \u2014 it read \u201C${we(n.lost,120)}\u201D`):n.quote?g("div",{class:"ctx"},`\u201C${we(n.quote,80)}\u201D`):null;M=new Map;let X=g("div",{class:"root"},...u(E.root),q,k(E.root),G);l.replaceWith(X),l=X,p?.remove(),p=x?g("div",{class:"rps"},...E.root.replies.map(j=>g("div",{class:"it"},...u(j),k(j),g("div",{class:"rft"},O(j))))):null,p&&c.prepend(p),m=M,E.resolved?i.remove():i.parentNode!==c&&c.append(i),d.className=E.resolved?"thread resolved":"thread",d.setAttribute("data-thread",E.id)}return y(e),{element:d,update:y}}var Nr="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",Hr=400;function wn(e,t){let o=new Map,n=g("div",{class:"tip",role:"tooltip"}),r=g("div",{class:"mark"}),i=g("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});n.inert=i.inert=!0,e.n.append(r,n,i);let c=g("div",{class:"bub pin ghost","aria-hidden":"true"}),l=[],p=null,d=null,m=null,M=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,C=0,u=null,h=null,y=null,E=0,L=w=>l.find(P=>P.id===w)??null,T=()=>t.q||e.state.l,x=!1,O=w=>{let P=e.resolved.get(w.id);return P?ft(w.anchor,P):null};function k(w,P,N){let{left:K,top:Y}=Wt(P,{width:w.offsetWidth||N,height:w.offsetHeight},zt(e.state.l));w.style.left=`${K}px`,w.style.top=`${Y}px`}function z(w){let P=w&&T()&&e.state.o!==w?L(w):null,N=P?O(P):null;if(!P||!N){y=null,n.classList.remove("show"),ne(n,!0);return}if(y!==P.id){let K=P.root.replies.length;n.replaceChildren(g("div",{class:"tx clamp"},...P.root.deleted?["Deleted"]:Dt(P.root.text)),g("div",{class:"who"},`${ue(P.root)}${K?` \xB7 ${K} ${K===1?"reply":"replies"}`:""}`)),y=P.id}k(n,N,260),n.classList.contains("show")||n.offsetWidth,n.classList.add("show"),n.inert=!1}function G(w){u=w,z(w),e.w(w)}function q(w){if(window.clearTimeout(E),w!==null){G(w);return}E=window.setTimeout(()=>G(null),T()?Hr:0)}n.addEventListener("mouseenter",()=>window.clearTimeout(E)),n.addEventListener("mouseleave",()=>q(null)),n.addEventListener("click",w=>{w.stopPropagation();let P=y;P&&(window.clearTimeout(E),G(null),e.open(P))});function X(w){let P=o.get(w.id);if(P)return P;let N=g("button",{class:"bub",type:"button","data-thread":w.id});return N.addEventListener("mouseenter",()=>q(w.id)),N.addEventListener("mouseleave",()=>q(null)),N.addEventListener("click",K=>{K.stopPropagation(),z(null),e.open(w.id)}),e.n.insertBefore(N,r),o.set(w.id,N),N}let j=!1;function H(){let w=e.state.t,P=m&&w&&!w.anchor.quote&&!w.anchor.point?w.resolved.element:null;if(P){let{left:K,top:Y,above:D}=fo(P.getBoundingClientRect(),{width:i.offsetWidth||Je,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),U=m?.above!==null&&m?.above!==D;if(m&&(m.above=D),U&&xe())return;i.style.left=`${K}px`,i.style.top=`${Y}px`;return}let N=m&&w?ft(w.anchor,w.resolved):p?O(p):null;N&&k(i,N,Je)}let te=w=>e.state.s&&!w.anchor.quote&&!w.anchor.point;function xe(){return window.clearTimeout(C),M?(i.classList.remove("show"),C=window.setTimeout(()=>{H(),i.classList.add("show")},220),!0):(i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function se(w){if(window.clearTimeout(C),M){i.classList.remove("show"),C=window.setTimeout(()=>{m?.i.V(w),H(),i.classList.add("show")},220);return}m?.i.V(w),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)}function ae(){if(!T())return null;let w=e.state.t;return w?w.anchor.quote||w.anchor.point||e.state.s?null:w.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function le(w){l=w;let P=new Set;for(let D of w){if(!e.I(D)||D.anchor.quote)continue;let U=e.resolved.get(D.id);if(!U||U.state==="orphaned")continue;P.add(D.id);let Q=X(D);Q.classList.toggle("done",D.resolved),Q.classList.toggle("on",e.state.o===D.id),Q.classList.toggle("pin",D.anchor.point!==void 0);let fe=`Comment on ${Oe(U.element)}: ${we(D.root.text,60)}`;Q.getAttribute("aria-label")!==fe&&Q.setAttribute("aria-label",fe)}Bt(e.n,w.filter(D=>P.has(D.id)).sort(qe(e)).map(D=>o.get(D.id)),r);for(let[D,U]of o)P.has(D)||(U.classList.remove("in"),o.delete(D),window.setTimeout(()=>U.remove(),300));z(u),x!==e.state.l&&i.classList.contains("show")&&!M&&(window.clearTimeout(C),i.classList.add("glide"),C=window.setTimeout(()=>i.classList.remove("glide"),450)),x=e.state.l;let N=t.q?e.state.t:null;if(N){let D=N.anchor.point??N.resolved.element;m?.of!==N?(window.clearTimeout(C),i.classList.remove("glide"),m={i:Kt(e,N),of:N,at:D,above:null},m.i.H(te(N)),i.replaceChildren(m.i.element),i.inert=!1,m.i.focus(),p=null,d=null,H(),i.classList.add("show")):m&&(m.at!==D&&(m.at=D,m.above=null,se(N.label)),m.i.H(te(N)));let U=!e.d.u(N.anchor.view);U!==j&&(j=U,i.classList.toggle("show",!U),i.inert=U,U||H());return}m&&(window.clearTimeout(C),i.classList.remove("glide"),m=null,j=!1,e.R(null));let K=T()&&e.state.o?L(e.state.o):null;if(!K||!e.I(K)){p=null,d=null,i.classList.remove("show"),ne(i,!0);return}let Y=K.anchor.quote?.exact??null;!p||!d||p.id!==K.id?(d=st(K,e.D,{B:"popover",quote:Y}),i.replaceChildren(d.element),p=K,H(),i.classList.add("show"),i.inert=!1):p!==K&&(d.update(K,{quote:Y}),p=K)}function Ee(){for(let[K,Y]of o){let D=L(K),U=e.resolved.get(K),Q=D&&U?Ut(D.anchor,U):null;if(!Q||Q.y<-40||Q.y>window.innerHeight+40){Y.style.visibility="hidden";continue}Y.style.visibility="",Y.style.left=`${Q.x}px`,Y.style.top=`${Q.y}px`,Y.classList.contains("in")||(Y.offsetWidth,Y.classList.add("in"))}let w=e.state.t,P=w?.anchor.point&&e.d.u(w.anchor.view)?Ut(w.anchor,w.resolved):null;P?(c.style.left=`${P.x}px`,c.style.top=`${P.y}px`,c.classList.contains("in")||(e.n.insertBefore(c,r),c.offsetWidth,c.classList.add("in"))):c.classList.contains("in")&&(c.classList.remove("in"),window.setTimeout(()=>c.classList.contains("in")||c.remove(),300)),i.classList.contains("show")&&H();let N=ae();r.classList.toggle("show",N!==null),N&&Ve(r,N.getBoundingClientRect(),4)}let ke=w=>{if(e.f(w)){let N=w.composedPath()[0];h!==null&&!(N instanceof Element&&N.closest(".tip,.bub"))&&q(null),h=null;return}let P=e._(w.clientX,w.clientY)?.id??null;P!==h&&(h=P,q(P))},pe=w=>{if(e.f(w))return;let P=window.getSelection();if(P&&!P.isCollapsed||(e.state.s?w.altKey:w.target instanceof Element&&w.target.closest(Nr)))return;let N=e._(w.clientX,w.clientY);N&&(e.X(w),z(null),e.open(N.id))};return window.addEventListener("pointermove",ke,{capture:!0,passive:!0}),window.addEventListener("click",pe,!0),{p:le,M:Ee,destroy(){window.clearTimeout(E),window.clearTimeout(C),window.removeEventListener("pointermove",ke,!0),window.removeEventListener("click",pe,!0),e.R(null);for(let w of o.values())w.remove();c.remove(),n.remove(),r.remove(),i.remove()}}}var Br="button link img figure region list listitem tab tabpanel article navigation complementary banner contentinfo form search group dialog menu menuitem checkbox switch radio slider textbox combobox option row cell heading table".split(" ").map(e=>`[role=${e}]`),Dr=["button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,figcaption,table,th,td","li,ul,ol,dl,dt,dd,p,h1,h2,h3,h4,h5,h6,blockquote,pre","section,article,aside,nav,header,footer,main,form,fieldset",...Br].join(","),Fr="a,button,label,summary,[role=button],[role=link],[role=tab],[role=option],[role=menuitem]",Vr=.6,Xt=2,yn=(e,t)=>Math.abs(e.left-t.left)<=Xt&&Math.abs(e.top-t.top)<=Xt&&Math.abs(e.width-t.width)<=Xt&&Math.abs(e.height-t.height)<=Xt;function mo(e,t){let o=t.i(e);if(o.width<2||o.height<2)return!1;if(e.hasAttribute("data-pipeup-id"))return!0;let n=t.K();return o.width*o.height<=Vr*n.width*n.height&&(e.matches(Dr)||t.ce(e)||e.childElementCount>1&&!e.parentElement?.closest(Fr)&&t.de(e))}function ht(e,t,o){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let n=null;for(let i=e;i&&i!==t&&!n;i=i.parentElement)mo(i,o)&&(n=i);if(!n||n.hasAttribute("data-pipeup-id"))return n;let r=o.i(n);for(let i=n.parentElement;i&&i!==t&&yn(o.i(i),r);i=i.parentElement)if(i.hasAttribute("data-pipeup-id"))return i;return n}function bn(e,t,o){let n=o.i(e);for(let r=e.parentElement;r&&r!==t;){let i=ht(r,t,o);if(!i)return null;if(!yn(o.i(i),n))return i;r=i.parentElement}return null}function ho(e=window){return{i:t=>t.getBoundingClientRect(),ce:t=>{let o=e.getComputedStyle(t),n=o.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(o.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(o.getPropertyValue(`border-${i}-width`))>0);return n||r||o.backgroundImage!=="none"||o.boxShadow!=="none"},de:t=>/^(inline-)?(flex|grid)$/.test(e.getComputedStyle(t).display),K:()=>({width:e.innerWidth,height:e.innerHeight})}}function xn(e,t,o=()=>!0){let n=[],r=(i,c)=>{for(let l of i.children){if(l.hasAttribute("data-pipeup-ignore")||!o(l))continue;let p=c;mo(l,t)&&(c&&yn(t.i(c.e),t.i(l))?(l.hasAttribute("data-pipeup-id")||!c.e.hasAttribute("data-pipeup-id"))&&(c.e=l):n.push(p={e:l,C:c,k:0})),r(l,p)}};r(e,null);for(let i=n.length-1;i>=0;i--){let c=n[i];c.C&&(c.C.k=Math.max(c.C.k,c.k+1))}return n}var gt=(e,t)=>e.filter(o=>o.k<=t&&(!o.C||o.C.k>t)),go=(e,t)=>e.filter(o=>o.C===t);var Jt="a,button,summary,[role=button],[role=link],[role=switch],[role=tab],[role=checkbox],input[type=checkbox],input[type=radio],input[type=submit],input[type=button],input[type=reset]",qr=`${Jt},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,vo=["click","dblclick","auxclick","submit","contextmenu","dragstart"],wo=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],_r=400,En="Tab moves between blocks \xB7 \u2191 \u2193 change level \xB7 Enter comments \xB7 Esc to finish \xB7 F7 selects text",Kr=150;function yo(e,t=ho()){let o=g("span",{hidden:!0},En),n=g("div",{class:"pick"},o),r=[0,1].map(()=>{let s=g("div",{class:"km",tabindex:"-1",role:"button"},g("span",{hidden:!0}),g("span",{hidden:!0}));return s.inert=!0,s.addEventListener("keydown",de),s.addEventListener("click",b=>{b.stopPropagation(),_()}),s.addEventListener("focus",()=>n.classList.add("kf")),s.addEventListener("blur",()=>n.classList.remove("kf")),s}),i=g("span",{class:"lbl"}),c=(s,b,a,v)=>{let A=g("button",{class:"nb",type:"button","aria-label":s,title:b},oe(a,16));return A.addEventListener("click",$=>{$.stopPropagation(),v()}),A},l=c("Around it","Select the block around it","expand",F),p=c("Inside it","Select a block inside it","shrink",B),d=c("Pin","Pin its centre","pin",()=>e.J(()=>D(h??k,{x:.5,y:.5}))),m=g("div",{class:"namebar",role:"group","aria-label":"Chosen block"},i,l,p,d);m.inert=!0;let M=e.n.querySelector(".launch");for(let s of[n,...r,m])e.n.insertBefore(s,M);m.addEventListener("mousedown",s=>s.preventDefault());let C=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,u=null,h=null,y=null,E=null,L=0,T=()=>{},x=null,O=()=>{},k=null,z=0,G=0,q=!1,X=null,j=null,H=null,te=-1,xe=!0,se=null,ae=null,le=s=>!e.f(s)&&!(s.target instanceof Element&&s.target.closest("[data-pipeup-ignore]"));function Ee(){E&&(n.classList.toggle("glide",performance.now()<L),Ve(n,E.getBoundingClientRect(),4))}function ke(){if(!x)return;m.classList.toggle("glide",performance.now()<L&&m.classList.contains("show"));let s=x.getBoundingClientRect(),{left:b,top:a}=jt({left:s.left,top:s.top,width:s.width,height:s.height},{width:m.offsetWidth||200,height:m.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});m.style.left=`${b}px`,m.style.top=`${a}px`}function pe(s,b){E=s,L=b?performance.now()+_r:0,Ee(),n.classList.add("show")}function w(s,b){let a=getComputedStyle(s);if(a.opacity==="0")return b(),()=>{};let v=0,A=()=>{window.clearTimeout(v),s.removeEventListener("transitionend",V)},$=()=>{A(),b()},V=he=>{he.target===s&&he.propertyName==="opacity"&&$()},J=Math.max(...a.transitionDuration.split(",").map(he=>parseFloat(he)*1e3||0));return v=window.setTimeout($,J+100),s.addEventListener("transitionend",V),A}function P(s){if(s!==u){if(u=s,T(),!s){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?pe(s,!1):C?(n.classList.remove("show"),T=w(n,()=>pe(s,!1))):pe(s,!0)}}function N(s){h=s,n.classList.toggle("on",s!==null),P(s),K(s)}function K(s){O(),m.inert=!s,s?C?(m.classList.remove("show"),O=w(m,()=>Y(s))):Y(s):(m.classList.remove("show"),x=null)}function Y(s){i.textContent=i.title=Oe(s),l.hidden=bn(s,e.root,t)===null,p.hidden=(k?I(s).length:xn(s,t,$e).length)===0;let b=m.classList.contains("show");x=s,ke(),b||(m.offsetWidth,m.classList.add("show"))}function D(s,b){let a;try{a=Rt(s,e.root,b,e.d.view(s))}catch($){e.Z($);return}let v={anchor:a,label:b?`Pin on ${Oe(s).replace(/^[A-Z](?=[a-z])/,$=>$.toLowerCase())}`:Oe(s),ranges:[],resolved:{state:"attached",element:s,range:null}},A=e.state.t;k&&(k=s,te=-1),N(b?null:s),y=A??{...v,ranges:[]},A?e.ue({...v,ranges:[]}):e.Q(y),e.S(b?v.label:`Commenting on ${v.label}`)}function U(s){e.J(()=>D(s))}function Q(s){let b=(s.target instanceof Element?ht(s.target,e.root,t):null)??e.root,a=b.getBoundingClientRect();a.width&&a.height&&D(b,{x:(s.clientX-a.left)/a.width,y:(s.clientY-a.top)/a.height})}function fe(s){let b=window.getSelection();if(b&&!b.isCollapsed)return;if(e.state.t&&(s.altKey||!e.T())){e.F();return}if(!s.altKey&&e._(s.clientX,s.clientY))return;if(e.state.o&&e.open(null),k&&s.detail&&f(),s.altKey){Q(s);return}let a=s.target instanceof Element?ht(s.target,e.root,t):null;a?D(a):(e.F(),N(null))}let Se=s=>{if(!e.f(s)){if(!le(s)){h||P(null);return}s.stopPropagation(),!(h||e.state.t||k)&&P(!_e()&&s.target instanceof Element?ht(s.target,e.root,t):null)}},_e=()=>{let s=window.getSelection();return!!s&&!s.isCollapsed&&s.toString().trim()!==""},W=()=>{_e()&&(k&&f(),h||P(null))},ye=s=>{le(s)&&(s.stopPropagation(),(s.type==="pointerdown"||s.type==="mousedown")&&s.target instanceof Element&&s.target.closest(qr)&&s.preventDefault())},Te=s=>{if(!le(s))return;let b=s.target;if((b===ae||b.form&&b.form===ae?.form)&&(s.type==="submit"||s.type==="click"&&!s.detail)){ae=s.type==="click"&&b.type==="submit"?b.form:null;return}s.preventDefault(),s.stopPropagation(),s.type==="click"&&!e.state.c&&!e.pe(s)&&fe(s)},Ie=s=>{if(ae=null,Me="",!(!le(s)||!(s.target instanceof Element)))if((s.key==="Enter"||s.key===" ")&&s.target.closest(Jt)){if(!k){ae=s.target;return}s.preventDefault(),s.stopPropagation()}else s.key==="Enter"&&!k&&s.target.form&&(ae=s.target)},me=()=>e.n.getRootNode().activeElement,ce=()=>r.some(s=>s===me()),$e=s=>(s.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1||getComputedStyle(s).display==="contents")&&e.d.u(e.d.view(s)),ee=()=>(se?.some(s=>!s.e.isConnected)&&(se=null),se??=xn(e.root,t,$e)),tt=s=>ee().find(b=>b.e===s),Ne=(s,b=!1)=>{let a=s.getBoundingClientRect();return a.bottom>0&&a.top<window.innerHeight&&(!b||a.top>=0)},Ke=()=>{let s=gt(ee(),0);return s.find(b=>Ne(b.e,!0))??s.find(b=>Ne(b.e))??s[0]},Le=s=>e.doc.threads().filter(b=>e.I(b)&&s.contains(Yt(e,b))).sort(qe(e));function He(s,b){let[a,v]=s.children,A=gt(ee(),z),$=Le(b).length;a.textContent=`${Lt(b)}, ${A.findIndex(he=>he.e===b)+1} of ${A.length}${$?`, has ${$} comment${$===1?"":"s"}`:""}`;let V=(b.innerText??b.textContent??"").length<=Kr;v.textContent=dn(b);let J=xe?[o]:[];xe=!1,s.ariaLabelledByElements!==void 0?(s.ariaLabelledByElements=V?[a,b]:[a,v],s.ariaDescribedByElements=V?J:[...J,b]):s.setAttribute("aria-label",`${a.textContent}, ${v.textContent}`)}function re(s,b=!0){let a=ee(),v=a.find($=>$.e===s);if(v&&!gt(a,z).includes(v)&&(z=v.k),s!==k&&(te=-1),s!==h&&(h=null),k=s,P(s),K(s),s.scrollIntoView({block:"nearest",inline:"nearest",behavior:C?"auto":"smooth"}),!b)return;e.fe();let A=r[G^=1];He(A,s),Ve(A,s.getBoundingClientRect(),4),A.inert=!1,A.focus({preventScroll:!0}),r[G^1].inert=!0}function Ue(){se=null;let s=document.activeElement;j=me()??s;let b=tt(X),a=b??(s&&s!==document.body&&e.root.contains(s)&&!s.closest("[data-pipeup-ignore]")?ee().filter(v=>v.e.contains(s)).pop():void 0)??Ke();return a?(b||(z=a.k),q=!0,re(a.e),!0):!1}function f(){let s=ce();X=k,k=null,P(null),K(null);for(let b of r)ne(b,!0);return s}function S(){let s=j;s?.focus?.({preventScroll:!0}),s&&e.n.contains(s)&&me()!==s&&e.n.querySelector(".launch .mode")?.focus({preventScroll:!0})}function I(s){let b=tt(s);return b?go(ee(),b):[]}function R(s){let b=gt(ee(),z),a=b.findIndex(A=>A.e===k),v=b[a<0?s>0?0:b.length-1:(a+s+b.length)%b.length];v&&re(v.e)}function F(){let s=h??k,b=s&&bn(s,e.root,t);if(!b)return e.S("Nothing around it");if((!H||!s.contains(H))&&(H=s),h)return U(b);re(b)}function B(){let s=h??k,b=s?I(s):[],a=b.find(v=>H&&v.e.contains(H))??b.find(v=>Ne(v.e))??b[0];if(!a)return e.S("Nothing inside it");h?U(a.e):re(a.e)}function _(s=!1){if(!k)return;if(e.state.t&&!e.T())return e.he();if(!s)return D(k);let b=Le(k);if(!b.length)return e.S("No comments on this block");te=(te+1)%b.length,e.open(b[te].id),b.length>1&&e.S(`Comment ${te+1} of ${b.length} on this block`)}function de(s){if(["Tab","ArrowUp","ArrowDown","Enter"," ","Escape"].includes(s.key)&&!(s.key.startsWith("Arrow")&&(s.metaKey||s.ctrlKey||s.altKey))){if(s.preventDefault(),s.stopPropagation(),Me=s.key,s.key==="Escape")return void e.U();if(s.key==="Enter"||s.key===" ")return _(s.shiftKey&&s.key==="Enter");e.state.o&&e.open(null),s.key==="Tab"?R(s.shiftKey?-1:1):s.key==="ArrowUp"?F():B()}}let Ae=()=>{let s=me();return s?!!s.closest("[inert]"):!document.activeElement||document.activeElement===document.body},Me="",at=s=>{s.key===Me&&(Me="",s.preventDefault(),s.stopPropagation())};window.addEventListener("keyup",at,!0),window.addEventListener("pointermove",Se,!0),document.addEventListener("selectionchange",W);for(let s of wo)window.addEventListener(s,ye,!0);for(let s of vo)window.addEventListener(s,Te,!0);return window.addEventListener("keydown",Ie,!0),{U(){if(h)N(null);else if(k)f()&&S(),e.S(`Cursor put away \xB7 ${Ge} brings it back`);else return!1;return!0},z:()=>k!==null,ge:()=>q&&!k,ee:Ue,W(){k&&!ce()&&re(k)},p(){if(se=null,k&&!(k.isConnected&&$e(k))){let a=Ke();a?re(a.e,ce()||Ae()):f()}let s=e.n.querySelector(".launch");if(s&&m.nextElementSibling!==s&&!ce()&&!m.contains(me()))for(let a of[n,...r,m])e.n.insertBefore(a,s);let b=e.state.t;y&&b!==y?(y=null,N(null),k&&re(k,Ae())):b&&!y&&(u||h)&&N(null)},M(){Ee(),ke(),k&&Ve(r[G],k.getBoundingClientRect(),4)},destroy(){f()&&S();for(let s of r)s.remove();T(),O(),window.removeEventListener("keyup",at,!0),window.removeEventListener("pointermove",Se,!0),document.removeEventListener("selectionchange",W);for(let s of wo)window.removeEventListener(s,ye,!0);for(let s of vo)window.removeEventListener(s,Te,!0);window.removeEventListener("keydown",Ie,!0),n.classList.remove("show"),m.classList.remove("show"),ne(m,!0),w(n,()=>n.remove()),w(m,()=>m.remove())}}}var Ur=300,zr=32,kn=220,vt=320,Wr=24,bo=24;function Sn(e,t=!1){let o=e.ownerDocument.documentElement,n=o.getAttribute("data-pipeup-layout");if(n==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(n==="column"?e:null);if(!r)return null;if(o.hasAttribute("data-pipeup-reserve")){let l=o.clientWidth,d=getComputedStyle(r).maxWidth,m;return d.endsWith("px")?m=parseFloat(d):d.endsWith("%")?m=parseFloat(d)/100*l:m=r.getBoundingClientRect().width,n!=="column"&&l<m+vt-(t?Wr:0)?null:{x:l-vt+bo,width:vt-2*bo}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<Ur&&n!=="column")return null;let c=i+zr;return{x:c,width:Math.max(220,Math.min(300,window.innerWidth-c-16))}}function Tn(e,t){let o=e.resolved.get(t.id);return!o||o.state==="orphaned"&&!e.te.has(t.id)}function xo(e){let t=g("div",{class:"col"});e.n.append(t);let o=new Map,n=null,r=new ResizeObserver(()=>l()),i=u=>Tn(e,u);function c(u){let h=e.resolved.get(u.id),y=h?vn(u.anchor,h):null;return y===null?Number.POSITIVE_INFINITY:y+window.scrollY-4}function l(){let u=[],h=[];for(let[x,O]of o){let k=c(O.thread);if(Number.isFinite(k))O.placed=k;else if(e.te.has(x)){if(O.placed===null){O.e.classList.add("wait");continue}k=O.placed}Number.isFinite(k)?u.push({id:x,m:k,height:O.e.offsetHeight}):h.push({id:x,height:O.e.offsetHeight})}let y=e.state.t,E=y?vn(y.anchor,y.resolved):null;n&&E!==null&&u.push({id:"draft",m:E+window.scrollY-4,height:n.e.offsetHeight});let L=po(u,n?"draft":e.state.o),T=Math.max(0,...u.map(x=>(L.get(x.id)??0)+x.height))+24;for(let x of h)L.set(x.id,T),T+=x.height+10;for(let[x,O]of o){if(O.e.classList.contains("wait")){if(!L.has(x))continue;O.e.style.transition="none",O.e.style.transform=`translateY(${Math.round(L.get(x))}px)`,O.e.offsetWidth,O.e.style.transition="",O.e.classList.remove("wait");continue}O.e.style.transform=`translateY(${Math.round(L.get(x)??0)}px)`}n&&(n.e.style.transform=`translateY(${Math.round(L.get("draft")??0)}px)`)}function p(u,h){u.thread=h,u.lost=i(h),u.view.update(h,{lost:u.lost?h.anchor.snapshot:null})}function d(u){let h=i(u),y=st(u,e.D,{B:"column",lost:h?u.anchor.snapshot:null}),E=g("div",{class:"th","data-thread":u.id},g("button",{class:"opn sr",type:"button","data-thread":u.id}),y.element);return E.style.transition="none",E.addEventListener("mouseenter",()=>e.w(u.id)),E.addEventListener("mouseleave",()=>e.w(null)),E.addEventListener("click",()=>e.open(u.id)),t.append(E),r.observe(E),{e:E,thread:u,lost:h,placed:null,view:y}}function m(){let u=e.state.t;if(n&&u&&n.of!==u){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),kn),n=null}if(u&&n&&(n.i.V(u.label),n.i.H(e.state.s&&!u.anchor.quote&&!u.anchor.point)),u&&!n){let h=Kt(e,u),y=g("div",{class:"th on"},h.element);y.style.transition="none",t.append(y),r.observe(y),n={e:y,i:h,of:u},h.H(e.state.s&&!u.anchor.quote&&!u.anchor.point),h.focus()}else if(!u&&n){let h=n.e;r.unobserve(h),h.classList.add("out"),window.setTimeout(()=>h.remove(),kn),n=null,e.R(null)}}function M(u){ne(t,e.state.l);let h=new Set,y=[],E=e.state.o!==null||e.state.t!==null;for(let L of u){if(!e.I(L))continue;h.add(L.id);let T=o.get(L.id);T?(T.thread!==L||T.lost!==i(L))&&p(T,L):(T=d(L),o.set(L.id,T),y.push(T.e));let x=T.e,O=e.state.o===L.id;x.classList.toggle("on",O);let k=x.firstElementChild,z=L.root.replies.length;k.setAttribute("aria-label",`Open thread: ${we(L.root.text,60)}, ${Gt(z)}`),k.setAttribute("aria-expanded",String(O)),ne(k,O);let G=x.querySelector(".more");G&&ne(G,!O),x.classList.toggle("dim",E&&!O),x.classList.toggle("hot",e.state.w===L.id&&!O),x.classList.toggle("resolved",L.resolved),x.classList.toggle("lost",T.lost)}for(let[L,T]of o)h.has(L)||(o.delete(L),r.unobserve(T.e),T.e.classList.add("out"),window.setTimeout(()=>T.e.remove(),kn));m(),Bt(t,u.filter(L=>h.has(L.id)).sort(qe(e)).map(L=>o.get(L.id).e),n?.e??null)&&t.offsetWidth,l(),n&&y.push(n.e);for(let L of y)L.offsetWidth,L.style.transition=""}function C(){let u=Sn(e.root,!0);u&&(t.style.width=`${u.width}px`,t.style.transform=`translate(${u.x}px, ${-window.scrollY}px)`)}return{p:M,M:C,destroy(){r.disconnect(),e.R(null),t.remove()}}}var Eo="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function ko(e){let t=g("button",{type:"button","aria-label":"Comment",title:"Comment"},oe("comment",17)),o=g("div",{class:"selbar"},t);o.inert=!0,e.n.append(o);let n=null,r=0,i=!1,c=u=>{let h=u&&(u.nodeType===Node.ELEMENT_NODE?u:u.parentElement);return!!h&&e.root.contains(h)&&!h.closest(Eo)};function l(){if(!n)return;let u=n.getBoundingClientRect(),{left:h,top:y}=jt({left:u.left,top:u.top,width:u.width,height:u.height},{width:o.offsetWidth||36,height:o.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});o.style.left=`${h}px`,o.style.top=`${y}px`}function p(){n=null,o.inert=!0,o.classList.remove("show")}function d(u=!1){let h=window.getSelection();if(!e.state.s||!h||h.isCollapsed||h.rangeCount===0||!h.toString().trim()||!c(h.anchorNode)||!c(h.focusNode)){p();return}!n&&!u&&e.S("Enter comments on the selected words"),n=h.getRangeAt(0).cloneRange(),l(),o.inert=!1,o.classList.add("show")}t.addEventListener("mousedown",u=>u.preventDefault()),t.addEventListener("click",u=>{if(u.stopPropagation(),e.state.t&&!e.T())return e.F();let h=n;if(!h)return;let y;try{y=Ot(h,e.root,e.d.view(h.commonAncestorContainer))}catch(L){e.Z(L),p();return}let E=we(h.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),p(),e.Q({anchor:y,label:`\u201C${E}\u201D`,ranges:[h],resolved:{state:"attached",element:null,range:h}})});let m=()=>{if(window.clearTimeout(r),r=window.setTimeout(()=>i||d(),250),!n)return;let u=window.getSelection();(!u||u.isCollapsed||!u.toString().trim())&&p()};document.addEventListener("selectionchange",m);let M=u=>{u.type!=="keyup"&&(i=u.type==="mousedown"),!(i||e.f(u))&&window.setTimeout(()=>d(u.type==="mouseup"),0)};window.addEventListener("mousedown",M,!0),window.addEventListener("mouseup",M,!0),window.addEventListener("keyup",M,!0);let C=u=>{u.key!=="Enter"||!n||e.f(u)||u.target instanceof Element&&u.target.closest(`${Eo},${Jt}`)||(u.preventDefault(),u.stopPropagation(),t.click())};return window.addEventListener("keydown",C,!0),{p(){!e.state.s&&n&&p()},M(){n&&l()},destroy(){window.removeEventListener("mousedown",M,!0),window.removeEventListener("mouseup",M,!0),window.removeEventListener("keyup",M,!0),window.removeEventListener("keydown",C,!0),window.clearTimeout(r),document.removeEventListener("selectionchange",m),o.remove()}}}async function Ln(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(o),o.select();let n=document.execCommand("copy");if(o.remove(),!n)throw new Error("pipeup: your browser blocked copying")}var jr=3e3,So="Hidden on the page";function To(e){let t=[g("span",{class:"n"}),g("span",{class:"n"})],o=oe("comment",20,1.4);o.lastElementChild.setAttribute("stroke-width","1.6");let n=g("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":hn,"aria-haspopup":"menu","aria-expanded":"false"},g("span",{class:"plus"},o),g("span",{class:"cnt"},oe("bubble",34,1.4),...t),g("span",{class:"dot"})),r=document.createTextNode("Comment"),i=g("span",{class:"ttip","aria-hidden":"true"},r,g("small",{},Ge)),c=g("div",{class:"launch"},n,i),l=g("div",{class:"menu",role:"menu","aria-label":"Comments"}),p=g("div",{class:"list",role:"menu","aria-label":"All comments"}),d=g("span",{class:"pn"}),m=g("button",{class:"ib",type:"button","aria-label":"Close"},oe("close")),M=g("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",g("span",{class:"sw","aria-hidden":"true"}));M.addEventListener("click",f=>{f.stopPropagation(),e.c.ve()});let C=g("div",{class:"all",role:"dialog","aria-label":"All comments"},g("div",{class:"hd"},g("span",{},"All comments"),d,M,m),p),u=g("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});l.inert=C.inert=u.inert=!0,e.n.append(l,c,C);let h=!1,y=null,E=0,L=[],T=0,x=null,O=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,k=f=>{h=e.state.c=f,window.clearTimeout(E),E=0,f||y?.(!0),l.classList.toggle("show",f),ne(l,!f),n.setAttribute("aria-expanded",String(f))},z=(f,S=!1)=>{e.state.l!==f&&(e.state.l=f,e.p(),f?(G(p)[0]??m).focus({preventScroll:!0}):S&&n.focus({preventScroll:!0}))},G=(f=l)=>[...f.querySelectorAll(".mi")],q=()=>l.getRootNode().activeElement,X=()=>{k(!1),n.focus({preventScroll:!0})},j=f=>{let S=G(f.currentTarget);if(S.length===0)return;let I=q(),R=S.indexOf(I),F=B=>{f.preventDefault(),S[(B+S.length)%S.length]?.focus({preventScroll:!0})};f.key==="ArrowDown"?F(R+1):f.key==="ArrowUp"?F(R<0?S.length-1:R-1):f.key==="Home"?F(0):f.key==="End"&&F(S.length-1)};l.addEventListener("keydown",j),p.addEventListener("keydown",j),m.addEventListener("click",f=>{f.stopPropagation(),z(!1,!0)});let H=f=>Tn(e,f),te=()=>L.filter(f=>!f.resolved&&!e.O(f)).length,xe=()=>L.filter(f=>!f.resolved&&e.O(f)).length,se=()=>L.filter(f=>!f.resolved).length,ae=f=>{let S=f.anchor.view?.slide,I=e.d.u(f.anchor.view)?"":Mt(f.anchor.view);return S&&e.d.slide()!==null?`On slide ${S}`:I?`In ${I}`:So},le=(f,S,I="")=>g("div",{role:"group","aria-label":I?`${f} \xB7 ${I}`:f},g("div",{class:"sec","aria-hidden":"true"},f,I&&g("b",{},I)),...S);function Ee(f,S){let I=e.d.slide(),R=new Map;for(let F of f){let B=F.thread,_=I!==null?B.anchor.view?.slide??I:e.O(B)?e.d.u(B.anchor.view)?"":Mt(B.anchor.view):null;R.set(_,[...R.get(_)??[],F])}if(I===null){let F=R.get(null)??[];return R.delete(null),[...F.map(S),...[...R].map(([B,_])=>le(B||So,_.map(S)))]}return[...R].sort(([F],[B])=>Number(F)-Number(B)||0).map(([F,B])=>le(`Slide ${F} \xB7 ${B.filter(_=>!_.thread.resolved).length} open`,B.map(S),F===I?"This slide":""))}function ke(){let f=q()?.dataset.thread,S=e.c.all().filter(B=>!B.thread.resolved||e.state.E),I=B=>{let _=B.thread,de=Xe(_.root.author,_.root.name);de.classList.add("in");let Ae=g("button",{class:_.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":_.id},de,g("span",{},g("span",{class:"clamp"},_.root.deleted?"Deleted":_.root.text),g("small",{},H(_)?`\u201C${we(_.anchor.snapshot,80)}\u201D`:B.location.where)));return Ae.addEventListener("click",Me=>{Me.stopPropagation(),pe(_.id,Ae.getBoundingClientRect().top)}),Ae},R=S.filter(B=>H(B.thread));d.textContent=String(se()),M.setAttribute("aria-checked",String(e.state.E)),p.replaceChildren(S.length?"":g("div",{class:"sec",role:"presentation"},"No open comments"),...Ee(S.filter(B=>!H(B.thread)),I),R.length?le("No longer on the page",R.map(I)):"");let F=G(p);f&&F.find(B=>B.dataset.thread===f)?.focus({preventScroll:!0})}function pe(f,S){Ze()&&(e.state.L=!0,z(!1)),P(f,S)}let w="";function P(f,S){let I=L.find(R=>R.id===f);if(I){if(w=f,!e.O(I))return N(I,S);if(e.state.t&&!e.T())return e.F();e.d.j(I.anchor.view??{}).then(()=>{e.ne();let R=L.find(F=>F.id===f);R&&w===f&&(e.state.l||e.state.L)&&N(R,S)})}}function N(f,S){let I=f.id,R=e.resolved.get(I),F=R&&!H(f)&&!e.O(f)?R.element??R.range?.startContainer.parentElement??null:null;if(F?.scrollIntoView({block:"center",inline:"nearest",behavior:O?"auto":"smooth"}),F&&R&&ft(f.anchor,R)&&F.checkVisibility?.({visibilityProperty:!0})!==!1){Y(),e.open(I);return}e.open(null),Ze()&&(e.state.L=!0,e.p()),K(f,S)}function K(f,S){let I=!H(f)&&e.O(f),R={quote:f.anchor.quote?.exact??null,lost:H(f)||I?f.anchor.snapshot:null,place:I?ae(f):null};if(x?.id===f.id?x.view.update(f,R):(x={id:f.id,view:st(f,e.D,{B:"popover",...R})},u.replaceChildren(x.view.element)),S===void 0)return;u.isConnected||(e.n.insertBefore(u,C),u.offsetWidth);let F=zt(e.state.l),{left:B,top:_}=Wt({x:F.width,y:S,below:!1},{width:Je,height:u.offsetHeight},F);u.style.left=`${B}px`,u.style.top=`${_}px`,u.classList.add("show"),u.inert=!1,e.we(f.id)}function Y(f=!1){x&&(x=null,u.classList.remove("show"),ne(u,!0),f&&e.state.L&&(e.state.L=!1,e.p()))}function D(f,S,I,R=!1,...F){let B=g("button",{class:"mi",type:"button",role:R?"menuitemcheckbox":"menuitem"},f,g("span",{class:"lb"},S),...F,R&&g("span",{class:"sw","aria-hidden":"true"}),g("span",{class:"tt","aria-hidden":"true"}));return B.addEventListener("click",_=>{_.stopPropagation(),I(_)}),B}let U=(f,S,I,R)=>{let F=f.querySelector(".lb");F.textContent!==S&&(F.textContent=S),f.querySelector(".tt").textContent=I,f.setAttribute("aria-description",I),R!==void 0&&f.setAttribute("aria-checked",String(R))},Q=()=>g("div",{class:"sep",role:"separator"}),fe=g("span",{class:"ma"}),Se=g("span",{class:"kc"}),_e="",W=D(fe,"",Ne,!1,Se);W.dataset.item="name";let ye=D(oe("copy"),"Copy as Markdown",()=>{X(),e.c.copyAll("ai")}),Te=D(oe("lines"),"Copy as Text",()=>{X(),e.c.copyAll("text")}),Ie=g("span",{class:"kc"}),me=D(oe("list"),"All comments",()=>{k(!1),z(!0)},!1,Ie),ce=D(oe("comment"),"Start commenting",f=>{let S=!e.state.s&&f.detail===0;e.ye(!e.state.s,S),S&&k(!1)},!0,g("span",{class:"kc","aria-hidden":"true"},Ge));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",hn);let $e=[W,Q(),ye,Te,me,Q(),ce];function ee(){let f=se(),S=e.c.name(),I=S||be(e.doc.me);if(U(W,I,S?"The name on your comments":"Add a name to show on your comments"),W.setAttribute("aria-label",`${I}, ${S?"edit":"add"} your name`),Se.replaceChildren(S?oe("edit",13):"Add name"),ut(e.doc.me,S)!==_e){_e=ut(e.doc.me,S);let R=Xe(e.doc.me,S);R.classList.add("in"),fe.replaceChildren(R)}U(ye,"Copy as Markdown","Markdown, with where each thread is"),U(Te,"Copy as Text","Just the words"),U(me,"All comments","Every thread, and where it is"),Ie.textContent=f?String(f):"",U(ce,"Start commenting",e.state.s?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.s)}function tt(){ee(),l.firstChild!==W&&l.replaceChildren(...$e)}function Ne(){let f=g("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"});f.value=e.c.name();let S=g("div",{class:"ed"},fe.cloneNode(!0),f),I=(R,F=!1)=>{if(y!==I)return;y=null;let B=f.value.trim();R&&B&&B!==e.c.name()&&e.c.rename(B).then(ee),S.replaceWith(W),F&&W.focus({preventScroll:!0})};y=I,f.addEventListener("keydown",R=>{R.stopPropagation(),(R.key==="Enter"||R.key==="Escape")&&(R.preventDefault(),I(R.key==="Enter",!0))}),f.addEventListener("blur",()=>I(!0)),W.replaceWith(S),f.focus({preventScroll:!0})}n.addEventListener("click",f=>{if(f.stopPropagation(),h){k(!1);return}tt(),k(!0),f.detail===0&&G().at(-1)?.focus({preventScroll:!0})});let Ke=!1,Le=()=>{Ke=C.contains(q())},He=f=>{let S=f.composedPath();h&&!S.includes(l)&&!S.includes(n)&&(k(!1),e.state.s&&!e.f(f)&&(e.X(f),f.preventDefault(),f.stopPropagation())),e.state.l&&!e.f(f)&&z(!1,Ke&&(!document.activeElement||document.activeElement===document.body)),!S.includes(u)&&!S.includes(C)&&Y(!0)},re=f=>{if(!h||f.pointerType==="touch"||f.type==="pointerout"&&f.relatedTarget)return;let S=f.composedPath();f.type==="pointerover"&&(S.includes(l)||S.includes(n))?(window.clearTimeout(E),E=0):E||(E=window.setTimeout(()=>{E=0,y||k(!1)},jr))};window.addEventListener("pointerdown",Le,!0),window.addEventListener("click",He,!0),window.addEventListener("pointerover",re,!0),window.addEventListener("pointerout",re,!0);let Ue=f=>{if(f.key!=="Escape"||y)return;let S=f.composedPath()[0];if(h)X();else if(e.state.l&&!(S instanceof HTMLTextAreaElement&&!C.contains(S)))z(!1,!0);else if(x)Y(!0),e.D.close();else return;f.stopPropagation()};return window.addEventListener("keydown",Ue,!0),{p(f){L=f;let S=te();if(S!==T){if(S){let[_,de]=t[0].classList.contains("on")?t:[t[1],t[0]];de.textContent=S>99?"99+":String(S),de.classList.toggle("s",S>99),_.classList.remove("on"),de.classList.add("on")}n.classList.toggle("has",S>0),T=S}let I=xe(),R=I?`${S} here \xB7 ${I} ${e.d.slide()!==null?"on other slides":"in other views"}`:"";n.classList.toggle("else",I>0);let F=`Comment${e.state.s?", comment mode on":""}${R?`, ${R}`:S?`, ${S} open`:""}`;n.getAttribute("aria-label")!==F&&n.setAttribute("aria-label",F),r.data!==(R||"Comment")&&(r.data=R||"Comment"),n.classList.toggle("on",e.state.s),h&&ee();let B=e.state.l;if(C.classList.toggle("full",Ze()),C.classList.contains("show")!==B&&(C.classList.toggle("show",B),ne(C,!B)),B&&ke(),x){let _=f.find(de=>de.id===x?.id);!_||e.state.o||_.resolved&&!e.state.E?Y():K(_)}},M(){},destroy(){window.removeEventListener("pointerdown",Le,!0),window.removeEventListener("click",He,!0),window.removeEventListener("pointerover",re,!0),window.removeEventListener("pointerout",re,!0),window.clearTimeout(E),window.removeEventListener("keydown",Ue,!0),l.remove(),C.remove(),u.remove(),c.remove()}}}var wt="[data-pipeup-slide]",Lo=1e3,Ao=["scroll","resize","keyup","click","transitionend","slidechanged"],An=null,bt=null,Zt=new Set,Mn=new Set,yt=e=>{try{e()}catch(t){globalThis.reportError?.(t)}};function Co(e){let t=null;if(e){t={};let o=0;for(let[n,r]of Object.entries(e))if(!(typeof r!="string"||n==="slide"||n.length>Z.viewKey||r.length>Z.viewValue)){if(++o>=Z.viewEntries)break;t[n]=r}}An=t;for(let o of Mn)o()}function Po(e){return Zt.add(e),()=>void Zt.delete(e)}function Qt(e){bt=typeof e?.current=="function"&&typeof e.go=="function"?e:null}function Yr(e,t,o){let n=t.K(),r=null,i=0,c=0;for(let l of e){if(!t.shown(l))continue;let p=t.i(l),d=Math.min(p.left+p.width,n.width)-Math.max(p.left,0),m=Math.min(p.top+p.height,n.height)-Math.max(p.top,0);if(d<=0||m<=0)continue;let M=Math.round(d*m),C=t.opacity(l);(M>i||M===i&&(C>c||C===c&&l===o))&&(r=l,i=M,c=C)}return r}function Gr(e,t,o){return t!==null?e?.slide===void 0||e.slide===t:!e||!o?!0:Object.entries(e).every(([n,r])=>n==="label"||n==="slide"||o[n]===r)}function Xr(){return{i:e=>e.getBoundingClientRect(),shown:e=>e.checkVisibility?.({opacityProperty:!0,visibilityProperty:!0})!==!1,opacity:e=>parseFloat(getComputedStyle(e).opacity)||0,K:()=>({width:window.innerWidth,height:window.innerHeight})}}var Mo=()=>{let e=window.Reveal;return typeof e?.getIndices=="function"&&typeof e.slide=="function"?e:null};function Oo(e,t,o=Xr()){let n=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,r=null,i=null,c=0,l=!1,p=()=>[...e.querySelectorAll(wt)],d=()=>[...e.querySelectorAll(".slides > section")],m=T=>typeof T=="string"&&T.length>0&&T.length<=Z.viewValue?T:null,M=T=>m(T?.getAttribute("data-pipeup-slide"));function C(){if(bt){let x=null;if(yt(()=>{let O=bt.current();Number.isInteger(O)&&O>0&&(x=String(O))}),x!==null)return x}let T=Mo();if(T){let x=null;if(yt(()=>{let O=T.getIndices().h,k=d()[O];x=M(k?.matches(wt)?k:k?.querySelector(wt))??m(String(O+1))}),x!==null)return x}return r&&!r.isConnected&&(r=null),r=Yr(p(),o,r)??r,M(r)}function u(){c=0,i=C(),t()}let h=()=>{!c&&!l&&(c=requestAnimationFrame(u))},y=T=>Gr(T,i,An);function E(T){if(y(T))return Promise.resolve(!0);let x=T.slide,O=Mo(),k=p().find(q=>M(q)===x),z=/^[1-9]\d{0,5}$/.test(x??"");if(z&&bt)yt(()=>bt.go(Number(x)));else if(z&&O){let q=k?d().findIndex(X=>X===k||X.contains(k)):-1;yt(()=>O.slide(q>=0?q:Number(x)-1))}else if(Zt.size)for(let q of Zt)yt(()=>q({...T}));else if(k)k.scrollIntoView({block:"start",behavior:n?"auto":"smooth"});else return Promise.resolve(!1);let G=performance.now();return new Promise(q=>{let X=te=>{clearTimeout(j),q(te)},j=setTimeout(()=>X(!1),Lo),H=()=>{if(l)return X(!1);if(i=C(),y(T))return X(!0);if(performance.now()-G>=Lo)return X(!1);requestAnimationFrame(H)};requestAnimationFrame(H)})}let L=new MutationObserver(T=>{T.some(x=>x.target instanceof Element&&x.target.matches(wt))&&h()});L.observe(e,{subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]});for(let T of Ao)window.addEventListener(T,h,{capture:!0,passive:!0});return Mn.add(h),i=C(),{slide:()=>i,view(T){let x=T instanceof Element?T:T?.parentElement,O=M(x?.closest(wt))??i,k={...O!==null?{slide:O}:{},...An};return Object.keys(k).length?k:void 0},u:y,j:E,destroy(){l=!0,cancelAnimationFrame(c),L.disconnect();for(let T of Ao)window.removeEventListener(T,h,!0);Mn.delete(h)}}}var Io=["pipeup-quote","pipeup-on","pipeup-done"],Jr={"pipeup-quote":[[250,227,188,.75],[250,200,100,.28]],"pipeup-on":[[247,212,154,.95],[250,200,100,.42]],"pipeup-done":[[180,178,169,.22],[180,178,169,.2]]},Zr=(e,t)=>Io.map(o=>{let[n,r,i,c]=Jr[o][e?1:0];return`::highlight(${o}){background-color:rgba(${n},${r},${i},${+(c*t).toFixed(3)})}`}).join("");function $o(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var Qr="<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><rect x='7' y='7' width='23' height='23' rx='4' fill='none' stroke='#534AB7' stroke-width='2' stroke-dasharray='4 3'/><path d='M3 2v15l4-3.5 3 6.5 2.5-1.2-3-6.3H15z' fill='#fff' stroke='#2C2C2A' stroke-width='1.2' stroke-linejoin='round'/></svg>",ei=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(Qr)}") 3 2,crosshair!important}`;function No(e=document,t=!1){let o=e.defaultView?.CSSStyleSheet;if(!o||!("replaceSync"in o.prototype)||!("adoptedStyleSheets"in e))return{oe(){},re(){},Y(){},ie(){},remove:()=>Ro()};let n=new o,r=null,i=!1,c=1,l=0,p="",d=0,m=()=>n.replaceSync(Zr(t,c)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?ei:"")+(l||p?`html{--pipeup-panel:${l}px;${l?`margin-right:${l}px!important;`:""}${p}}`:""));return m(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],{oe(M){M!==r&&(r=M,m())},re(M){M!==i&&(i=M,m())},Y(M){c=M,m()},ie(M,C){M!==l&&(l=M,p=C?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(d),!M&&p&&(d=window.setTimeout(()=>{p="",m()},400)),m())},remove(){clearTimeout(d),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(M=>M!==n),Ro()}}}function Ho(e){$o()&&(CSS.highlights.set("pipeup-quote",new Highlight(...e.quote)),CSS.highlights.set("pipeup-on",new Highlight(...e.on)),CSS.highlights.set("pipeup-done",new Highlight(...e.done)))}function Ro(){if($o())for(let e of Io)CSS.highlights.delete(e)}var Cn=':host{all:initial}*{box-sizing:border-box}button{-webkit-appearance:none;appearance:none;font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}svg{display:block}.layer{all:initial;display:block;position:fixed;inset:0;pointer-events:none;font:13px/1.5 var(--pu-font,system-ui,sans-serif);color:var(--k);--k:#2C2C2A;--mu:#5F5E5A;--fa:#888780;--ln:#E5E3DA;--ru:#ECEAE2;--so:#FAFAF7;--su:#FFFFFF;--ho:#F1EFE8;--as:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--sh:0 8px 28px rgba(44,44,42,.1);--in:.26s;--mv:.34s;--out:.2s;--pl:1.2s;--eo:cubic-bezier(.22,.61,.36,1);--eio:cubic-bezier(.4,0,.2,1);--ei:cubic-bezier(.4,0,1,1)}.layer.dark{--k:#ECEBE6;--mu:#B4B2A9;--fa:#8D8B84;--ln:#3A3936;--ru:#34332F;--so:#22221F;--su:#1B1B19;--ho:#2C2C29;--sh:0 8px 28px rgba(0,0,0,.45)}.layer.hidden .bub,.layer.hidden .col,.layer.hidden .pop,.layer.hidden .tip,.layer.hidden .mark,.layer.hidden .selbar{opacity:0!important;pointer-events:none!important}.tx{font-size:14px;line-height:1.5;color:var(--k);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--fa)}.who,.rest{font-size:12px}.who{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rft>.who{display:block}.ctx[hidden]{display:none}.ctx{font-size:12px;margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.tx a{color:var(--pu-accent);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.ft,.rft{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows var(--in) var(--eo),opacity var(--in) var(--eo)}.ft>*,.rft>*{overflow:hidden;min-height:0;display:flex;align-items:center}.root:hover>.ft,.root:focus-within>.ft,.it:hover>.rft,.it:focus-within>.rft{grid-template-rows:1fr;opacity:1}.ft.has-rest{grid-template-rows:1fr;opacity:1}.ft.has-rest>*{grid-area:1/1}.ft .hover{opacity:0;transition:opacity var(--in) var(--eo)}.ft .rest{transition:opacity var(--in) var(--eo)}.root:hover>.ft .hover,.root:focus-within>.ft .hover,.ft:not(.has-rest) .hover{opacity:1}.root:hover>.ft .rest,.root:focus-within>.ft .rest{opacity:0}.acts{margin-left:6px;display:flex;flex:none}.ib{width:24px;height:22px;display:grid;place-items:center;border-radius:6px;color:var(--mu);transition:background-color .2s var(--eo),color .2s var(--eo)}.ib:hover,.ib:focus-visible{background:var(--ho);color:var(--k);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--mv) var(--eio)}.more>div{overflow:hidden;min-height:0}.th:not(.on) .more{grid-template-rows:0fr}.row{display:flex;align-items:center;gap:8px;padding:8px 0 2px;cursor:text}.input{flex:1;min-width:0;height:27px;display:block;border:0;border-bottom:1px solid var(--ln);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--k);background:transparent;transition:border-color var(--in) var(--eo)}.row:hover .input,.input:hover{border-bottom-color:var(--mu)}.input:focus{border-bottom-color:var(--pu-accent)}.ed{display:flex;gap:10px;align-items:center;min-height:34px;padding:6px 10px}.ed .input{font-size:13px;height:22px}.root,.it{position:relative;padding-right:30px}.av{display:grid;place-items:center;width:22px;height:22px;border-radius:32%;font-size:12px;font-weight:600;line-height:1;opacity:0;transform:scale(.85);transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.av.in{opacity:1;transform:none}.av svg{width:80%;height:80%}.root>.av,.it>.av{position:absolute;top:0;right:0}.it>.av{top:6px}.av{--av-l:92%;--av-d:30%;--s:60%;background:hsl(var(--h) var(--s) var(--av-l));color:hsl(var(--h) var(--s) var(--av-d))}.dark .av{--av-l:20%;--av-d:78%}.c0{--h:0}.c1{--h:25}.c2{--h:50}.c3{--h:130}.c4{--h:175}.c5{--h:215}.c6{--h:270}.c7{--h:330}.c8{--h:28;--s:35%}.c9{--h:220;--s:8%}.me{flex:none;display:grid}.me>.av{grid-area:1/1;width:26px;height:26px;font-size:13px}.you{display:grid;padding:0 34px;min-height:24px;font-size:12px;color:var(--fa)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.say{white-space:pre;overflow:hidden}.nm{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.say button{flex:none}.say button{color:var(--mu);text-decoration:underline;text-decoration-color:var(--ln);text-underline-offset:2px;transition:color .2s var(--eo)}.say button:hover,.say button:focus-visible{color:var(--pu-accent);outline:none}.nf{opacity:0;transform:translateY(-4px);pointer-events:none}.nf .input{font-size:13px;height:24px}.you.naming .nf{opacity:1;transform:none;pointer-events:auto}.you.naming .say{opacity:0;pointer-events:none}.send{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;color:var(--pu-accent);flex:none;opacity:0;pointer-events:none;transition:opacity var(--in) var(--eo),background-color .2s var(--eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--as)}.bub{position:fixed;left:0;top:0;width:20px;height:20px;margin:-20px 0 0 -2px;border-radius:50% 50% 50% 0;background:var(--pu-accent);border:2px solid var(--su);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--in) var(--eo),transform var(--in) var(--eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--fa)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--eo),transform .26s var(--eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--eo),transform .26s var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.pop{position:fixed;width:var(--pu-pop);border-radius:12px;padding:10px 12px 8px;pointer-events:none;opacity:0;transform:translateY(6px) scale(.98);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.pop.show.glide{transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo),left var(--mv) var(--eio),top var(--mv) var(--eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--as);border-radius:8px;opacity:0;transition:opacity .3s var(--eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--as);animation:pu-pulse var(--pl) var(--eio) forwards}@keyframes pu-pulse{0%{opacity:0;transform:scale(.985)}35%{opacity:.85;transform:scale(1)}to{opacity:0;transform:scale(1.02)}}.col{position:fixed;left:0;top:0;pointer-events:none;transition:opacity var(--in) var(--eo)}.th{position:absolute;left:0;right:0;top:0;padding:4px 4px 4px 12px;pointer-events:auto;cursor:pointer;box-shadow:inset 2px 0 0 transparent;transition:transform var(--mv) var(--eio),box-shadow var(--in) var(--eo),opacity var(--in) var(--eo)}.th.hot{box-shadow:inset 2px 0 0 var(--ln)}.th.on{box-shadow:inset 2px 0 0 var(--pu-accent);cursor:default}.th.dim{opacity:.45}.th.resolved:not(.on):not(.hot){opacity:.6}.th.lost .ctx{white-space:normal}.th.wait{opacity:0!important;pointer-events:none}.th.out{opacity:0!important;pointer-events:none;transition:opacity var(--out) var(--ei)}.th:has(.opn:focus-visible){box-shadow:inset 2px 0 0 var(--ln);outline:2px solid var(--pu-accent);outline-offset:2px;border-radius:4px}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.selbar.show{opacity:1;transform:none;pointer-events:auto}.selbar button{width:32px;height:30px;display:grid;place-items:center;border-radius:8px;color:var(--pu-accent);transition:background-color .2s var(--eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--as);outline:none}.pick{position:fixed;left:0;top:0;border:2px solid color-mix(in srgb,var(--pu-accent) 70%,transparent);background:color-mix(in srgb,var(--pu-accent) 6%,transparent);border-radius:8px;pointer-events:none;opacity:0;transition:opacity var(--out) var(--ei),border-color var(--out) var(--ei),border-width var(--out) var(--ei),box-shadow var(--out) var(--ei)}.pick.show{opacity:1;transition-duration:var(--in);transition-timing-function:var(--eo)}.pick.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.pick.on{border-color:var(--pu-accent)}.pick.kf{border:3px solid var(--pu-accent);box-shadow:0 0 0 2px var(--su)}.km{position:fixed;left:0;top:0;pointer-events:none;outline:none}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.namebar{position:fixed;left:0;top:0;display:flex;align-items:center;gap:2px;padding:2px 2px 2px 10px;border-radius:10px;font-size:12px;color:var(--mu);white-space:nowrap;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform .3s var(--eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--mv);transition-timing-function:var(--eio)}.namebar .lbl{margin-right:6px;max-width:260px;overflow:hidden;text-overflow:ellipsis}.namebar .nb{padding:4px;display:grid;place-items:center;border-radius:7px;transition:background-color .2s var(--eo),color .2s var(--eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--ho);color:var(--k);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{position:relative;display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);transition:background-color .3s var(--eo),color .3s var(--eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--in) var(--eo)}.cnt,.has>.plus{opacity:0}.has>.cnt{opacity:1}.n{font-size:12px;font-weight:500;line-height:1;margin:-1.4px 0 0 1.4px;font-variant-numeric:tabular-nums;opacity:0;transition:opacity var(--in) var(--eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--ho)}.launch .mode.on{background:var(--pu-accent);color:#fff}.mode>.dot{position:absolute;top:3px;right:3px;width:9px;height:9px;border-radius:50%;background:var(--pu-accent);border:2px solid var(--su);opacity:0}.mode.else>.dot{opacity:1}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--fa)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--out) var(--ei)}@media(hover:none){.ttip,.tt{display:none}}.menu{position:fixed;right:20px;bottom:76px;width:290px;border-radius:12px;padding:4px;pointer-events:none;opacity:0;transform:translateY(6px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--in) var(--eo),transform var(--mv) var(--eo)}.mi{position:relative;display:flex;gap:10px;align-items:center;width:100%;min-height:34px;text-align:left;padding:6px 10px;border-radius:8px;transition:background-color .2s var(--eo)}.mi:hover,.mi:focus-visible{background:var(--so);outline:none}.mi svg{color:var(--mu);flex:none}.mi small{display:block;color:var(--fa);font-size:12px}.lb{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ma{flex:none;display:grid;margin:-2px 0}.ma .av{width:20px;height:20px;font-size:11px}.mi .av svg{color:inherit}.sep{height:1px;margin:4px 10px;background:var(--ru)}.tt{position:absolute;right:calc(100% + 14px);top:50%;translate:0 -50%;width:max-content;max-width:220px;padding:4px 9px;border-radius:8px;font-size:12px;line-height:1.4;color:var(--mu);background:var(--su);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--out) var(--ei),transform var(--out) var(--ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--in) var(--eo) .5s,transform var(--in) var(--eo) .5s}@media(max-width:600px){.tt{right:8px;top:auto;bottom:100%;translate:none;transform:translateY(3px)}}.sw{position:relative;flex:none;width:26px;height:16px;border-radius:8px;background:var(--ln);transition:background-color var(--mv) var(--eio)}.sw:before,.sw:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 2px #00000040;transition:transform var(--mv) var(--eio),opacity var(--mv) var(--eio)}.sw:before{opacity:0;transform:translate(10px)}[aria-checked=true]>.sw{background:var(--pu-accent)}[aria-checked=true]>.sw:after{transform:translate(10px)}.all{position:fixed;top:0;right:0;bottom:0;width:var(--pu-panel);display:flex;flex-direction:column;border-width:0 0 0 1px;opacity:0;transform:translate(100%);transition:transform var(--out) var(--ei),opacity var(--out) var(--ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--mv) var(--eo),opacity var(--in) var(--eo)}.all.full{width:100%}.hd{display:flex;align-items:center;gap:8px;padding:12px 10px 8px 16px;font-weight:600}.pn{font-weight:400;color:var(--fa)}.hs{margin-left:auto;display:flex;align-items:center;gap:6px;padding:3px 4px 3px 6px;border-radius:6px;font-size:12px;font-weight:400;color:var(--mu);transition:background-color .2s var(--eo)}.hs:hover,.hs:focus-visible{background:var(--ho);outline:none}.list{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:4px}.all .mi{align-items:flex-start}.all .mi>.av{flex:none}.all .mi>span:last-child{flex:1;min-width:0}.all .mi small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.all .mi .av svg{margin:0}.all .mi.done{opacity:.6}.layer.listing .col{opacity:0;transition:opacity var(--out) var(--ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--fa)}.sec b{margin-left:6px;font-weight:500;color:var(--pu-accent)}.toast{position:fixed;left:50%;bottom:28px;border-radius:10px;padding:8px 14px;font-size:13px;opacity:0;transform:translate(-50%,6px);transition:opacity .3s var(--eo),transform .36s var(--eo)}.toast.show{opacity:1;transform:translate(-50%)}@media(forced-colors:active){.pick.kf{border:3px solid Highlight}.layer :is(.ib,.mi,.nb,.hs,.selbar button,.say button):focus-visible{outline:2px solid Highlight}}@media(prefers-reduced-motion:reduce){.bub,.bub.in,.bub.in:hover,.bub.on,.tip,.pop,.selbar,.menu,.all,.ttip,.tt,.toast{transform:none!important}.sw:after{transform:none!important;transition-property:opacity}[aria-checked=true]>.sw:after{opacity:0}[aria-checked=true]>.sw:before{opacity:1}.th{transition-property:opacity,box-shadow}.tip.show{transition-property:opacity}.pick,.pick.show{transition:opacity .16s ease-in-out}.all,.all.show{transition-property:opacity}.namebar,.namebar.show{transform:none!important;transition:opacity .16s ease-in-out}.av,.nf{transform:none!important}@keyframes pu-pulse{0%{opacity:0}35%{opacity:.85}to{opacity:0}}}';var Bo="#534AB7",ti="rgb(0, 0, 238)";function Do(e){let t=/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)/.exec(e);if(!t||t[1]===void 0||t[2]===void 0||t[3]===void 0)return null;let o=t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]);return{r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:o}}function ni(e){let t=o=>{let n=o/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Fo(e){let t=e.ownerDocument,o=t.defaultView;if(!o)return{font:"system-ui, sans-serif",accent:Bo,dark:!1};let n=t.documentElement,r=o.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(o.getComputedStyle(n).getPropertyValue("--pipeup-accent")||n.style.getPropertyValue("--pipeup-accent")).trim(),c=e.querySelector("a[href]"),l=c?o.getComputedStyle(c).color:"",p=i||(l&&l!==ti?l:Bo),d=Do(o.getComputedStyle(t.body).backgroundColor);(!d||d.a===0)&&(d=Do(o.getComputedStyle(n).backgroundColor));let m=d&&d.a>0?ni(d)<.2:o.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(o.getComputedStyle(n).colorScheme||"");return{font:r,accent:p,dark:!!m}}function Vo(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function qo(e,t=document){let o=t.createElement("pipeup-root");o.setAttribute("data-pipeup-ignore",""),o.style.cssText="position:fixed!important;inset:0!important;pointer-events:none!important;z-index:2147483000!important;display:block!important;margin:0!important;visibility:visible!important;opacity:1!important;transform:none!important;filter:none!important;";let n=o.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in n){let c=new r;c.replaceSync(Cn),n.adoptedStyleSheets=[c]}else{let c=t.createElement("style");c.textContent=Cn,n.append(c)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${mt}px`),i.style.setProperty("--pu-pop",`${Je}px`),Vo(i,e),n.append(i),t.documentElement.append(o),{element:o,shadow:n,n:i,destroy:()=>o.remove()}}var oi=40,ri=250,ii=120,si=2400,ai=4e3,li=1e4;function _o(e,t=!1){return Sn(e,t)?"column":"bubbles"}function ci(e){return[...e.state.mode==="column"?[xo(e),wn(e,{q:!1})]:[wn(e,{q:!0})],ko(e),To(e)]}var di=1e3,en="Shown here, but not saved yet \u2014 it will be saved with your next change",Qe=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function Ko(e){let t=Fo(e.root),o=qo(t),n=No(document,t.dark);n.Y(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),c=new Map,l=new Set,p=new WeakSet,d={o:null,w:null,E:!1,hidden:!0,mode:_o(e.root),t:null,s:!1,l:!1,L:!1,c:!1},m=g("div",{class:"toast",role:"status","aria-live":"polite"}),M=g("div",{class:"sr","aria-live":"polite"});o.n.append(m,M);let C=null,u=[],h=null,y=!1,E=0,L=0,T=0,x=0,O=0,k=new Set,z="",G=new Map,q=Oo(e.root,()=>{!y&&N()&&W()}),X=!1,j=0;function H(a,v=si,A=!1,$=!1){y||(X=A,m.textContent=a,$?m.setAttribute("aria-hidden","true"):m.removeAttribute("aria-hidden"),m.classList.add("show"),window.clearTimeout(E),E=window.setTimeout(()=>m.classList.remove("show"),v))}function te(){X&&(X=!1,window.clearTimeout(E),m.classList.remove("show"))}function xe(a){M.textContent="",cancelAnimationFrame(j),j=requestAnimationFrame(()=>M.textContent=a)}function se(a){H(Qe(a))}function ae(a){throw se(a),a}let le=a=>({thread:a,location:At(a.anchor,c.get(a.id)??dt(a.anchor,e.root),e.root)}),Ee=a=>d.o!==a||d.E?!1:(h?.z()?h.W():o.n.querySelector(".launch .mode")?.focus({preventScroll:!0}),!0),ke={reply:async(a,v)=>{try{await e.doc.reply(a,v)}catch(A){A instanceof ve?H(en):ae(A)}},resolve:async a=>{try{await e.doc.resolve(a),Ee(a)&&(d.o=null),H("Resolved \xB7 Show resolved brings it back")}catch(v){v instanceof ve?(Ee(a)&&(d.o=null),H(`Resolved \xB7 ${en}`)):H(Qe(v))}},reopen:async a=>{try{await e.doc.reopen(a),H("Reopened")}catch(v){H(v instanceof ve?`Reopened \xB7 ${en}`:Qe(v))}},close:()=>{ee(null);let a=ye&&o.n.querySelector(ye);a?a.focus({preventScroll:!0}):h?.W(),ye=""},copy:a=>{try{let v=e.doc.threads().find($=>$.id===a);if(!v)return;let A=Nt(le(v),"ai",location.href,Date.now());Ln(A,o.n).then(()=>H("Thread copied as Markdown for AI"),$=>H(Qe($)))}catch(v){H(Qe(v))}}},pe={copyAll:async a=>{let v=pe.all(),A=Ht(v,a,{title:document.title,url:location.href,exportedAt:new Date});try{await Ln(A,o.n);let $=v.filter(V=>!V.thread.resolved).length;H(`Copied ${$} thread${$===1?"":"s"}${a==="ai"?" as Markdown for AI":""}`)}catch($){H(Qe($))}},ve:()=>{d.E=!d.E,W()},rename:async a=>{let v=a.replace(/\s+/g," ").trim();try{await f(v)?H(`New comments will say ${v}, but this browser couldn't remember it`):H(`New comments will say ${v}`)}catch(A){H(Qe(A))}},name:()=>e.doc.name,all:()=>[...e.doc.threads()].sort(qe(w)).map(le)},w={doc:e.doc,root:e.root,n:o.n,host:o.element,state:d,resolved:c,te:l,D:ke,c:pe,d:q,O:a=>k.has(a.id),ne:()=>{N()&&W()},I:a=>!d.hidden&&(!a.resolved||d.E)&&!k.has(a.id),be:(a,v)=>{for(let A of e.doc.threads()){let $=c.get(A.id);if(A.anchor.quote&&w.I(A)&&$?.range&&uo(a,v,pt($)))return A}return null},_:(a,v)=>w.T()?w.be(a,v):null,f:a=>a.composedPath().includes(o.element),X:a=>void p.add(a),pe:a=>p.has(a),open:ee,we:a=>ce(a),w:tt,Q:Ne,ue:Ke,T:()=>!C||C.se(),J:a=>{let v=C?.G();a(),v?.()},he:()=>{let a=d.t?.anchor.view,v=C?.G();Promise.resolve(q.u(a)||q.j(a??{}).then(()=>w.ne())).then(v)},ae:S,le:Le,ye:He,F:Ue,R:a=>{C=a},xe:H,S:xe,fe:te,Z:se,Ee:I,p:W,U:re};function P(a){let v=performance.now(),A=e.doc.threads();for(let $ of A){if(a&&!a.has($.id))continue;let V=performance.now()-v<oi,J=dt($.anchor,e.root,{fuzzy:V});c.set($.id,J),!V&&J.state==="orphaned"?l.add($.id):l.delete($.id)}for(let $ of[...c.keys()])A.some(V=>V.id===$)||c.delete($);l.size===0?(window.clearTimeout(x),x=0):x===0&&(x=window.setTimeout(()=>{x=0,!y&&(P(new Set(l)),W())},ri))}function N(){let a=new Set,v=q.slide()!==null,A=new Set;for(let V of e.doc.threads()){A.add(V.id);let J=c.get(V.id)?.element;(!q.u(V.anchor.view)||!v&&J?.checkVisibility?.({visibilityProperty:!0})===!1)&&a.add(V.id)}k=a;for(let V of G.keys())A.has(V)||G.delete(V);let $=`${q.slide()}|${[...a].join()}`;return $===z?!1:(z=$,!0)}function K(a){let v=[],A=[],$=[];for(let V of a){let J=c.get(V.id);V.resolved&&!d.E||!J?.range||k.has(V.id)||(V.id===d.o||V.id===d.w?A.push(J.range):V.resolved?$.push(J.range):v.push(J.range))}d.t&&q.u(d.t.anchor.view)&&A.push(...d.t.ranges),Ho({quote:v,on:A,done:$})}let Y=0,D=0,U=0;function Q(a){if(a===D)return;D=a,cancelAnimationFrame(U);let v=Y,A=performance.now(),$=a?260:200,V=J=>{let he=Math.min(1,(J-A)/$);Y=v+(a-v)*(a?1-(1-he)**3:he*he),n.Y(Y),he<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let fe=0,Se=0;function _e(a){a!==fe&&(fe=a,n.ie(a,r),window.clearTimeout(Se),Se=window.setTimeout(()=>{P(),W()},r?0:400))}function W(){if(y)return;let a=e.doc.threads();if(N(),d.o&&k.has(d.o)){let A=o.n.querySelector(`[data-thread="${d.o}"] .rbox textarea`)?.value;A&&G.set(d.o,A),d.o=null}d.hidden=!d.s&&!d.l&&!d.L&&!d.t,d.hidden&&(d.o=null),Q(d.hidden?0:1),o.n.classList.toggle("hidden",d.hidden),o.n.classList.toggle("listing",d.l);let v=d.l&&!Ze();_e(v?mt:0),n.oe(i?d.mode==="column"&&!d.hidden&&!v?vt:0:null),K(a);for(let A of u)A.p(a);h?.p(a)}let ye="",Te=()=>o.n.getRootNode().activeElement,Ie="input,textarea,select,[contenteditable]:not([contenteditable=false])",me=()=>{let a=Te();return a instanceof HTMLTextAreaElement&&a.value!==""||!!document.activeElement?.matches(Ie)};function ce(a,v=me(),A=Te()){let $=[...o.n.querySelectorAll(`[data-thread="${a}"] .rbox textarea`)].find(J=>!J.closest("[inert]")),V=A?.getAttribute("data-thread");ye=V?`.${A.classList[0]}[data-thread="${V}"]`:"",!(v||!$)&&$.focus({preventScroll:!0})}function $e(){let a=d.t;return!a||w.T()?!1:(q.u(a.anchor.view)||q.j(a.anchor.view??{}),!0)}function ee(a,v=!1){if(a&&$e())return;if(d.o===a&&!d.t)return a?ce(a):void 0;let A=!v&&me(),$=Te();if(a||(d.L=!1),d.o=a,a&&(d.t=null,I(a)),W(),a){let V=G.get(a),J=V&&o.n.querySelector(`[data-thread="${a}"] .rbox textarea`);J&&!J.value&&(J.value=V,J.dispatchEvent(new Event("input",{bubbles:!0}))),G.delete(a),v&&h?.z()?h.W():ce(a,A,$)}}function tt(a){d.w!==a&&(d.w=a,a&&a!==d.o&&I(a),W())}function Ne(a){te(),d.l=!1,d.t=a,d.o=null,W()}function Ke(a){if(!d.t)return Ne(a);Object.assign(d.t,a),W()}function Le(){d.t&&(d.t=null,W())}function He(a,v=!1){d.s!==a&&(d.s=a,n.re(a),a?(d.o=null,d.l=!1,h=yo(w)):(te(),h?.destroy(),h=null,xe("Comment mode off")),W(),h&&(v&&h.ee(),v?h.z()?H(En,li,!0,!0):H("Nothing here to comment on"):H(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${Ge} or Esc to finish`,ai,!0)))}function re(){d.t&&(q.u(d.t.anchor.view)||w.T())?Le():d.o?ee(null):h&&!h.U()&&He(!1)}function Ue(){if(d.t){$e()||Le();return}d.o&&ee(null)}async function f(a){try{return await e.onName(a),!1}catch(v){if(e.doc.name!==a)throw v;return!0}}async function S(a){let v=d.t;if(v)try{let A=await e.doc.comment(v.anchor,a);d.t=null,P(new Set([A])),ee(A,!0)}catch(A){if(A instanceof ve){d.t=null,P(new Set([A.id])),ee(A.id,!0),H(en);return}ae(A)}}function I(a){let v=c.get(a);if(!v||v.state==="orphaned")return;let A=v.range?pt(v):v.element?[v.element.getBoundingClientRect()]:[];for(let $ of A.slice(0,6)){let V=g("div",{class:"pulse"});Ve(V,$,4),o.n.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function R(){for(let a of u)a.destroy();u=ci(w),W()}let F=()=>{if(!y){for(let a of u)a.M();h?.M(),O=requestAnimationFrame(F)}},B=a=>{let v=a.composedPath()[0];return v instanceof Element&&v.closest(Ie)!==null},_=a=>{if(a.key==="Escape")return re();if(ao(a)&&!a.isComposing&&!a.defaultPrevented&&!B(a)){if(a.preventDefault(),h?.ge()&&h.ee())return;He(!d.s,!0)}},de=a=>{if(w.f(a)||p.has(a))return;let v=window.getSelection();v&&!v.isCollapsed||Ue()},Ae=()=>{let a=_o(e.root,d.mode==="column");a!==d.mode?(d.mode=a,R()):W()};function Me(){let a=performance.now();L===0&&(T=a),window.clearTimeout(L);let v=Math.min(ii,Math.max(0,T+di-a));L=window.setTimeout(()=>{L=0,P(),W()},v)}let at=new MutationObserver(a=>{a.every(v=>o.element.contains(v.target))||Me()});window.addEventListener("keydown",_),window.addEventListener("click",de),window.addEventListener("resize",Ae),at.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let s=typeof ResizeObserver>"u"?null:new ResizeObserver(Me);s?.observe(e.root);let b=e.doc.onChange(()=>{P(),W()});return P(),R(),O=requestAnimationFrame(F),{ctx:w,destroy(){y=!0,cancelAnimationFrame(O),cancelAnimationFrame(U),cancelAnimationFrame(j),q.destroy(),window.clearTimeout(Se),window.clearTimeout(E),window.clearTimeout(L),window.clearTimeout(x),at.disconnect(),s?.disconnect(),b(),window.removeEventListener("keydown",_),window.removeEventListener("click",de),window.removeEventListener("resize",Ae),h?.destroy();for(let a of u)a.destroy();n.remove(),o.destroy()}}}var et=null,ui=4e3;function Pn(e={}){if(et)return et;let t=fi(e,()=>t).catch(o=>{throw et===t&&(et=null),o});return et=t,t}function pi(e,t){return new Promise((o,n)=>{let r=setTimeout(()=>n(new Error("timed out")),t);e.then(o,n).finally(()=>clearTimeout(r))})}async function fi(e,t){let o=document.documentElement.getAttribute("data-pipeup-doc"),{id:n,key:r}=o?await xt(o):{id:`page-${Fe(location.origin+location.pathname)}`,key:null},i,c=!1,l;if(e.store)i=e.store,l=await it(i);else try{let u=ot.open();i=await pi(u,ui).catch(h=>{throw u.then(y=>y.close(),()=>{}),h}),l=await it(i)}catch{i=new rt,c=!0,l=await it(i)}let p=e.name?.trim();p&&p!==l.name&&(l={...l,name:p},await i.saveProfile(l));let d=await nt.open({doc:n,key:r,store:i,identity:l.identity,name:l.name});Qt(e.slides??null);let m;try{m=Ko({doc:d,root:e.root??document.body,onName:async u=>{d.name=u,l={...l,name:u},await i.saveProfile(l)}})}catch(u){throw Qt(null),u}c&&m.ctx.xe("This browser can't keep comments for this page \u2014 copy the comments (Copy as Markdown) to keep them");let M=()=>void d.flush().catch(u=>globalThis.reportError?.(u)),C=!1;return window.addEventListener("pagehide",M),{document:d,flush:()=>d.flush(),unmount:()=>{C||(C=!0,window.removeEventListener("pagehide",M),m.destroy(),Qt(null),et===t()&&(et=null))}}}function Uo(){let e=document.documentElement;if(!e.hasAttribute("data-pipeup-doc")||e.getAttribute("data-pipeup-auto")==="off")return;let t=()=>void Pn().catch(o=>console.error(o));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}var mi="0.4.0";typeof document<"u"&&Uo();return Xo(hi);})();
|
package/dist/types/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VERSION = "0.4.0
|
|
1
|
+
export declare const VERSION = "0.4.0";
|
|
2
2
|
export { PipeupDocument, UnsavedChangeError, type Listener, type OpenOptions } from "./document";
|
|
3
3
|
export { DEFAULT_PROFILE_NAME, MemoryStore, loadOrCreateProfile, type OpStore, type Profile, } from "./storage/store";
|
|
4
4
|
export { IndexedDbStore } from "./storage/indexeddb";
|