pipeup 0.3.0 → 0.3.2
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.3.
|
|
5
|
+
> **Alpha (0.3.2).** 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.3.
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/pipeup@0.3.2/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 Pe(t){let{thread:e,location:n}=t,r=[u(n.where)+(n.quote?`, on the text "${u(n.quote)}"`:""),`${u(A(e.root))}: ${F(e.root," ")}`];for(let o of e.root.replies)r.push(` ${u(A(o))}: ${F(o," ")}`);return r.join(`
|
|
7
7
|
`)+`
|
|
8
8
|
`}function F(t,e){return t.deleted?"(deleted)":t.text.replace(/\r\n|\r|\n/g,`
|
|
9
|
-
`+e)+(t.edited?" (edited)":"")}var Yt="0.3.
|
|
9
|
+
`+e)+(t.edited?" (edited)":"")}var Yt="0.3.2";export{N as ANIMALS,G as COLOURS,ue as DEFAULT_PROFILE_NAME,j as IndexedDbStore,q as MemoryStore,K as PipeupDocument,v as UnsavedChangeError,Yt as VERSION,Ee as animalName,lt as copyAll,pt as copyThread,R as createIdentity,He as describeElement,je as describeRange,$ as formatAgo,Ae as labelOf,De as loadOrCreateProfile,it as locate,A as nameOf,$e as newDocumentAttribute,Fe as parseDocumentAttribute,Ve as resolveAnchor};
|
package/dist/pipeup.esm.js
CHANGED
|
@@ -6,4 +6,4 @@ function pe(e){let t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t).
|
|
|
6
6
|
`}function Sn(e){let{thread:t,location:n}=e,o=[Q(n.where)+(n.quote?`, on the text "${Q(n.quote)}"`:""),`${Q(se(t.root))}: ${pt(t.root," ")}`];for(let r of t.root.replies)o.push(` ${Q(se(r))}: ${pt(r," ")}`);return o.join(`
|
|
7
7
|
`)+`
|
|
8
8
|
`}function pt(e,t){return e.deleted?"(deleted)":e.text.replace(/\r\n|\r|\n/g,`
|
|
9
|
-
`+t)+(e.edited?" (edited)":"")}var ni="0.3.0";function m(e,t={},...n){let o=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?o.className=String(i):o.setAttribute(r,i===!0?"":i));for(let r of n)r!=null&&r!==!1&&o.append(r);return o}function J(e,t){let n=e.getRootNode().activeElement;t&&n instanceof HTMLElement&&e.contains(n)&&n.blur(),e.inert=t}function he(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function $e(e,t,n=4){e.style.left=`${t.left-n}px`,e.style.top=`${t.top-n}px`,e.style.width=`${t.width+n*2}px`,e.style.height=`${t.height+n*2}px`}var No=/\bhttps?:\/\/[^\s<>"'`]+/gi,$o=`.,;:!?'"]}`,Do=2048,Bo=/[\u202A-\u202E\u2066-\u2069]/;function Ho(e){let t=0,n=0;for(let r of e)r==="("?t++:r===")"&&n++;let o=e.length;for(;o>0;){let r=e[o-1];if(r===")"&&n>t)n--;else if(!$o.includes(r))break;o--}return e.slice(0,o)}function dt(e){let t=[],n=0;for(let o of e.matchAll(No)){if(o[0].length>Do||Bo.test(o[0]))continue;let r=Ho(o[0]),i=o.index??0,s;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;s=p.href}catch{continue}i>n&&t.push(e.slice(n,i));let a=m("a",{href:s,target:"_blank",rel:"noopener noreferrer"},r);a.addEventListener("click",p=>p.stopPropagation()),t.push(a),n=i+r.length}return n<e.length&&t.push(e.slice(n)),t}var ge={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"}},An=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),Ye=(An?ge.mac:ge.other).label,_t=(An?ge.mac:ge.other).aria;function Ln(e){return e.code===ge.code&&e.shiftKey===ge.mods.shift&&e.altKey===ge.mods.alt&&e.metaKey===ge.mods.meta&&e.ctrlKey===ge.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var Mn="http://www.w3.org/2000/svg",Fo={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"],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 Y(e,t=15,n){let o=qt(Fo[e],t);return n&&o.setAttribute("stroke-width",String(n)),o}function qt(e,t){let n=document.createElementNS(Mn,"svg"),o={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(o))n.setAttribute(r,i);for(let r of e){let i=document.createElementNS(Mn,"path");i.setAttribute("d",r),n.append(i)}return n}var ut=(e,t,n)=>`M${e} ${t}a${n} ${n} 0 1 0 ${2*n} 0a${n} ${n} 0 1 0 -${2*n} 0`,_o={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${ut(7.4,11.5,1.9)}${ut(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${ut(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:`${ut(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 Cn(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let n=t[0].toUpperCase();return[...n].length===1?n:t[0]}var je=(e,t)=>Cn(t)||fe(e);function Ee(e,t){return m("span",{class:`av c${Bt(e)}`,"aria-hidden":"true","data-animal":fe(e)},Cn(t)||qt([_o[Ie[Dt(e)]]],24))}var qo=320;function mt(e,t){setTimeout(()=>{e.remove(),t?.()},qo)}function ft(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function ht(e){let t=m("textarea",{class:"input",rows:"1","aria-label":e.label}),n=m("button",{class:"send",type:"button","aria-label":"Send",title:"Send"},Y("send")),o=m("div",{class:"row"},e.before,t,n),r=!1,i=()=>{n.classList.toggle("show",t.value.trim()!==""),t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},s=async()=>{let a=t.value.trim();if(!(!a||r)){r=!0;try{await e.onSend(a),t.value="",i()}catch{}finally{r=!1}}};return o.addEventListener("mousedown",a=>{a.target===t||n.contains(a.target)||(a.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",a=>{a.stopPropagation(),a.key==="Enter"&&!a.shiftKey&&!a.isComposing?(a.preventDefault(),s()):a.key==="Escape"&&(a.preventDefault(),t.value="",i(),t.blur(),e.onCancel?.())}),n.addEventListener("click",a=>{a.stopPropagation(),s()}),{element:o,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Vo(e){let t=m("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",w=>w.preventDefault());let n=ht({label:"Comment",before:t,onSend:e.onSend,onCancel:e.onCancel}),o=m("div",{class:"say"}),r=m("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=m("div",{class:"nf"},r),s=m("div",{class:"you"},o,i),a="",p=!1,l=()=>{let w=e.name(),v=w?"change":"add your name";if(t.title=w?"Change your name":"Add your name",!t.lastChild||a!==w){let T=Ee(e.me,w),S=t.lastChild;S?(ft(T),mt(S)):T.classList.add("in"),t.append(T),a=w}let A=m("button",{type:"button"},v);A.addEventListener("click",y),o.replaceChildren(m("span",{class:"nm"},w||`You're ${fe(e.me)}`)," \xB7 ",A)},d=w=>{s.classList.toggle("naming",w),J(o,w),J(i,!w)};function y(w){w.stopPropagation(),r.value=e.name(),d(!0),r.focus({preventScroll:!0}),r.select()}let E=()=>{d(!1),n.focus()};t.addEventListener("click",y),r.addEventListener("keydown",w=>{if(w.stopPropagation(),w.key==="Escape")w.preventDefault(),E();else if(w.key==="Enter"){w.preventDefault();let v=r.value.trim();if(!v||v===e.name())return E();if(p)return;p=!0,e.rename(v).finally(()=>{p=!1,l(),E()})}}),l(),d(!1);let f=m("div",{class:"ctx"},e.label);return{element:m("div",{class:"draft"},f,n.element,s),caret:()=>{let{selectionStart:w,selectionEnd:v}=n.input;return()=>{n.focus(),n.input.setSelectionRange(w,v)}},hideLabel:w=>{f.hidden=w},setLabel:w=>{f.textContent=w},focus:()=>n.focus(),isEmpty:()=>n.input.value.trim()===""}}function gt(e,t){let n=Vo({label:t.label,me:e.doc.me,name:()=>e.menu.name(),rename:o=>e.menu.rename(o),onSend:o=>e.postDraft(o),onCancel:()=>e.cancelDraft()});return e.registerDraft(n),n}function vt(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let n=t.element.getBoundingClientRect();if(!n.width&&!n.height)return null;if(e.point)return{x:n.left+e.point.x*n.width,y:n.top+e.point.y*n.height};let o=t.element.ownerDocument.createRange();o.selectNodeContents(t.element);let r=o.getBoundingClientRect();return{x:r.width?Math.min(n.right-8,r.right+6):n.right-8,y:(r.height?r.top:n.top)+8}}function Ge(e){return e.range?[...e.range.getClientRects()]:[]}function Vt(e,t){let n=Ge(t)[0];if(n)return n.top;if(t.state==="orphaned"||!t.element)return null;let o=t.element.getBoundingClientRect();return e.point?o.top+e.point.y*o.height:o.top}function Xe(e,t){let n=Ge(t).at(-1);if(n)return{x:n.left,y:n.bottom,below:!0};let o=vt(e,t);return o?{...o,below:!1}:null}function Pn(e,t,n){for(let o of n)if(e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom)return!0;return!1}function On(e,t,n=10){let o=[...e].sort((a,p)=>a.want-p.want),r=new Array(o.length).fill(0),i=o.findIndex(a=>a.id===t),s=a=>o[a];if(i<0)o.forEach((a,p)=>{r[p]=p===0?a.want:Math.max(a.want,(r[p-1]??0)+s(p-1).height+n)});else{r[i]=s(i).want;for(let a=i+1;a<o.length;a++)r[a]=Math.max(s(a).want,(r[a-1]??0)+s(a-1).height+n);for(let a=i-1;a>=0;a--)r[a]=Math.min(s(a).want,(r[a+1]??0)-s(a).height-n)}return new Map(o.map((a,p)=>[a.id,r[p]??0]))}var Ze=320,ke=300,Uo=480,Te=()=>window.innerWidth<=Uo;function yt(e){let t=window.innerWidth;return{width:e&&!Te()?t-Ze:t,height:window.innerHeight}}function wt(e,t,n,o=12){let r,i;return e.below?(r=Math.min(e.x,n.width-t.width-o),i=e.y+8,i+t.height>n.height-o&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>n.width-o&&(r=e.x-t.width-28),i=Math.min(e.y-12,n.height-t.height-o)),{left:Math.max(o,r),top:Math.max(o,i)}}function Rn(e,t,n,o=12,r=44){let i=e.top-r>=8,s=e.top+e.height+8+(i?0:r),a=e.top-8-(i?r:0)-t.height,p=s+t.height<=n.height-o||a<o,l=p?s:a;return{above:!p,left:Math.max(o,Math.min(e.left,n.width-t.width-o)),top:Math.max(o,l)}}function bt(e,t,n){let o=e.top-t.height-10;return o<8&&(o=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,n.width-t.width-8)),top:o}}var In=e=>`${e} ${e===1?"reply":"replies"}`;function De(e,t,n){let o={...n},r=e.id,i=m("div",{class:"rbox always"},m("div",{},ht({label:"Reply",onSend:v=>t.reply(r,v),onCancel:t.close}).element)),s=m("div",{}),a=m("div",{}),p=null,l=m("div",{},a,m("div",{class:"more"},s)),d=new Map,y=new Map,E=new Map,f=v=>{let A=je(v.author,v.name),T=d.get(v.id),S=T?.el;if((!S||T.key!==A)&&(S=ft(Ee(v.author,v.name)),T)){let C=T.el;E.set(v.id,C),mt(C,()=>E.get(v.id)===C&&E.delete(v.id))}S.title=se(v),y.set(v.id,{key:A,el:S});let P=E.get(v.id);return P?[P,S]:[S]},x=(v,A,T)=>{let S=m("button",{class:"ib",type:"button","aria-label":A,title:A},Y(v));return S.addEventListener("click",P=>{P.stopPropagation(),T()}),S};function w(v,A={}){Object.assign(o,A),r=v.id;let T=(o.now??Date.now)(),S=v.root.replies.length,P=q=>m("span",{class:"who"},`${se(q)} \xB7 ${Ne(q.at,T)}`),C=q=>m("div",{class:q.deleted?"tx del":"tx"},...q.deleted?["Deleted"]:[...dt(q.text),q.edited?" (edited)":""]),z=v.resolved?"Resolved"+(S?` \xB7 ${In(S)}`:""):S?In(S):"",G=m("div",{class:o.variant==="column"&&z?"ft has-rest":"ft"},o.variant==="column"&&z?m("span",{class:"rest"},z):null,m("span",{class:"hover"},P(v.root),m("span",{class:"acts"},x("copy","Copy thread",()=>t.copy(v.id)),v.resolved?x("reopen","Reopen",()=>void t.reopen(v.id)):x("resolve","Resolve",()=>void t.resolve(v.id))))),K=o.lost?m("div",{class:"ctx"},`No longer on the page \u2014 it read \u201C${he(o.lost,120)}\u201D`):o.quote?m("div",{class:"ctx"},`\u201C${he(o.quote,80)}\u201D`):null;y=new Map;let ie=m("div",{class:"root"},...f(v.root),K,C(v.root),G);a.replaceWith(ie),a=ie,p?.remove(),p=S?m("div",{class:"rps"},...v.root.replies.map(q=>m("div",{class:"it"},...f(q),C(q),m("div",{class:"rft"},P(q))))):null,p&&s.prepend(p),d=y,v.resolved?i.remove():i.parentNode!==s&&s.append(i),l.className=v.resolved?"thread resolved":"thread",l.setAttribute("data-thread",v.id)}return w(e),{element:l,update:w}}var zo="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",Ko=400;function Ut(e,t){let n=new Map,o=m("div",{class:"tip",role:"tooltip"}),r=m("div",{class:"mark"}),i=m("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});o.inert=i.inert=!0,e.layer.append(r,o,i);let s=m("div",{class:"bub pin ghost","aria-hidden":"true"}),a=[],p=null,l=null,d=null,y=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,E=0,f=null,x=null,w=null,v=0,A=h=>a.find(L=>L.id===h)??null,T=()=>t.popovers||e.state.listing,S=!1,P=h=>{let L=e.resolved.get(h.id);return L?Xe(h.anchor,L):null};function C(h,L,M){let{left:H,top:R}=wt(L,{width:h.offsetWidth||M,height:h.offsetHeight},yt(e.state.listing));h.style.left=`${H}px`,h.style.top=`${R}px`}function z(h){let L=h&&T()&&e.state.active!==h?A(h):null,M=L?P(L):null;if(!L||!M){w=null,o.classList.remove("show"),J(o,!0);return}if(w!==L.id){let H=L.root.replies.length;o.replaceChildren(m("div",{class:"tx clamp"},...L.root.deleted?["Deleted"]:dt(L.root.text)),m("div",{class:"who"},`${se(L.root)}${H?` \xB7 ${H} ${H===1?"reply":"replies"}`:""}`)),w=L.id}C(o,M,260),o.classList.contains("show")||o.offsetWidth,o.classList.add("show"),o.inert=!1}function G(h){f=h,z(h),e.hot(h)}function K(h){if(window.clearTimeout(v),h!==null){G(h);return}v=window.setTimeout(()=>G(null),T()?Ko:0)}o.addEventListener("mouseenter",()=>window.clearTimeout(v)),o.addEventListener("mouseleave",()=>K(null)),o.addEventListener("click",h=>{h.stopPropagation();let L=w;L&&(window.clearTimeout(v),G(null),e.open(L))});function ie(h){let L=n.get(h.id);if(L)return L;let M=m("button",{class:"bub",type:"button","aria-label":`Comment: ${he(h.root.text,60)}`});return M.addEventListener("mouseenter",()=>K(h.id)),M.addEventListener("mouseleave",()=>K(null)),M.addEventListener("click",H=>{H.stopPropagation(),z(null),e.open(h.id)}),e.layer.insertBefore(M,r),n.set(h.id,M),M}function q(){let h=e.state.draft,L=d&&h&&!h.anchor.quote&&!h.anchor.point?h.resolved.element:null;if(L){let{left:H,top:R,above:F}=Rn(L.getBoundingClientRect(),{width:i.offsetWidth||ke,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),X=d?.above!==null&&d?.above!==F;if(d&&(d.above=F),X&&le())return;i.style.left=`${H}px`,i.style.top=`${R}px`;return}let M=d&&h?Xe(h.anchor,h.resolved):p?P(p):null;M&&C(i,M,ke)}let oe=h=>e.state.commenting&&!h.anchor.quote&&!h.anchor.point;function le(){return window.clearTimeout(E),y?(i.classList.remove("show"),E=window.setTimeout(()=>{q(),i.classList.add("show")},220),!0):(i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function j(h){if(window.clearTimeout(E),y){i.classList.remove("show"),E=window.setTimeout(()=>{d?.box.setLabel(h),q(),i.classList.add("show")},220);return}d?.box.setLabel(h),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)}function ee(){if(!T())return null;let h=e.state.draft;return h?h.anchor.quote||h.anchor.point||e.state.commenting?null:h.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function u(h){a=h;let L=new Set;for(let F of h){if(!e.visible(F)||F.anchor.quote)continue;let X=e.resolved.get(F.id);if(!X||X.state==="orphaned")continue;L.add(F.id);let Z=ie(F);Z.classList.toggle("done",F.resolved),Z.classList.toggle("on",e.state.active===F.id),Z.classList.toggle("pin",F.anchor.point!==void 0)}for(let[F,X]of n)L.has(F)||(X.classList.remove("in"),n.delete(F),window.setTimeout(()=>X.remove(),300));z(f),S!==e.state.listing&&i.classList.contains("show")&&!y&&(window.clearTimeout(E),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)),S=e.state.listing;let M=t.popovers?e.state.draft:null;if(M){d?.of!==M?(window.clearTimeout(E),i.classList.remove("glide"),d={box:gt(e,M),of:M,at:M.resolved.element,above:null},d.box.hideLabel(oe(M)),i.replaceChildren(d.box.element),i.inert=!1,d.box.focus(),p=null,l=null,q(),i.classList.add("show")):d&&(d.at!==M.resolved.element&&(d.at=M.resolved.element,d.above=null,j(M.label)),d.box.hideLabel(oe(M)));return}d&&(window.clearTimeout(E),i.classList.remove("glide"),d=null,e.registerDraft(null));let H=T()&&e.state.active?A(e.state.active):null;if(!H||!e.visible(H)){p=null,l=null,i.classList.remove("show"),J(i,!0);return}let R=H.anchor.quote?.exact??null;!p||!l||p.id!==H.id?(l=De(H,e.actions,{variant:"popover",quote:R}),i.replaceChildren(l.element),p=H,q(),i.classList.add("show"),i.inert=!1):p!==H&&(l.update(H,{quote:R}),p=H)}function N(){for(let[H,R]of n){let F=A(H),X=e.resolved.get(H),Z=F&&X?vt(F.anchor,X):null;if(!Z||Z.y<-40||Z.y>window.innerHeight+40){R.style.visibility="hidden";continue}R.style.visibility="",R.style.left=`${Z.x}px`,R.style.top=`${Z.y}px`,R.classList.contains("in")||(R.offsetWidth,R.classList.add("in"))}let h=e.state.draft,L=h?.anchor.point?vt(h.anchor,h.resolved):null;L?(s.style.left=`${L.x}px`,s.style.top=`${L.y}px`,s.classList.contains("in")||(e.layer.insertBefore(s,r),s.offsetWidth,s.classList.add("in"))):s.classList.contains("in")&&(s.classList.remove("in"),window.setTimeout(()=>s.classList.contains("in")||s.remove(),300)),i.classList.contains("show")&&q();let M=ee();r.classList.toggle("show",M!==null),M&&$e(r,M.getBoundingClientRect(),4)}let B=h=>{if(e.owns(h)){let M=h.composedPath()[0];x!==null&&!(M instanceof Element&&M.closest(".tip,.bub"))&&K(null),x=null;return}let L=e.readsAt(h.clientX,h.clientY)?.id??null;L!==x&&(x=L,K(L))},U=h=>{if(e.owns(h))return;let L=window.getSelection();if(L&&!L.isCollapsed||(e.state.commenting?h.altKey:h.target instanceof Element&&h.target.closest(zo)))return;let M=e.readsAt(h.clientX,h.clientY);M&&(e.claim(h),z(null),e.open(M.id))};return window.addEventListener("pointermove",B,{capture:!0,passive:!0}),window.addEventListener("click",U,!0),{render:u,frame:N,destroy(){window.clearTimeout(v),window.clearTimeout(E),window.removeEventListener("pointermove",B,!0),window.removeEventListener("click",U,!0),e.registerDraft(null);for(let h of n.values())h.remove();s.remove(),o.remove(),r.remove(),i.remove()}}}var Wo="button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,table,th,td,li,p,h1,h2,h3,h4,h5,h6,blockquote,pre";var Nn=(e,t)=>Math.abs(e.left-t.left)<=2&&Math.abs(e.top-t.top)<=2&&Math.abs(e.width-t.width)<=2&&Math.abs(e.height-t.height)<=2;function Qe(e,t,n){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let o=n.viewport(),r=.6*o.width*o.height,i=null;for(let a=e;a&&a!==t;a=a.parentElement){let p=n.box(a);if(!(p.width<2||p.height<2)){if(a.hasAttribute("data-pipeup-id")){i=a;break}if(!(p.width*p.height>r)&&(a.matches(Wo)||n.drawn(a))){i=a;break}}}if(!i||i.hasAttribute("data-pipeup-id"))return i;let s=n.box(i);for(let a=i.parentElement;a&&a!==t&&Nn(n.box(a),s);a=a.parentElement)if(a.hasAttribute("data-pipeup-id"))return a;return i}function zt(e,t,n){let o=n.box(e);for(let r=e.parentElement;r&&r!==t;){let i=Qe(r,t,n);if(!i)return null;if(!Nn(n.box(i),o))return i;r=i.parentElement}return null}function $n(e=window){return{box:t=>t.getBoundingClientRect(),drawn:t=>{let n=e.getComputedStyle(t),o=n.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(n.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(n.getPropertyValue(`border-${i}-width`))>0);return o||r||n.backgroundImage!=="none"||n.boxShadow!=="none"},viewport:()=>({width:e.innerWidth,height:e.innerHeight})}}var Hn="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]",Yo=`${Hn},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,Dn=["click","dblclick","auxclick","submit","contextmenu","dragstart"],Bn=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],jo=400;function Fn(e,t=$n()){let n=m("div",{class:"pick"});e.layer.append(n);let o=m("span",{class:"lbl"}),r=m("button",{class:"nb",type:"button","aria-label":"Select the block around it",title:"Select the block around it"},Y("expand",16)),i=m("div",{class:"namebar",role:"toolbar","aria-label":"Chosen block"},o,r);i.inert=!0,e.layer.append(i),i.addEventListener("mousedown",u=>u.preventDefault()),r.addEventListener("click",u=>{u.stopPropagation();let N=p&&zt(p,e.root,t);N&&K(N)});let s=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,a=null,p=null,l=null,d=null,y=0,E=()=>{},f=null,x=()=>{},w=u=>!e.owns(u)&&!(u.target instanceof Element&&u.target.closest("[data-pipeup-ignore]"));function v(){d&&(n.classList.toggle("glide",performance.now()<y),$e(n,d.getBoundingClientRect(),4))}function A(){if(!f)return;i.classList.toggle("glide",performance.now()<y&&i.classList.contains("show"));let u=f.getBoundingClientRect(),{left:N,top:B}=bt({left:u.left,top:u.top,width:u.width,height:u.height},{width:i.offsetWidth||200,height:i.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});i.style.left=`${N}px`,i.style.top=`${B}px`}function T(u,N){d=u,y=N?performance.now()+jo:0,v(),n.classList.add("show")}function S(u,N){let B=getComputedStyle(u);if(B.opacity==="0")return N(),()=>{};let U=0,h=()=>{window.clearTimeout(U),u.removeEventListener("transitionend",M)},L=()=>{h(),N()},M=R=>{R.target===u&&R.propertyName==="opacity"&&L()},H=Math.max(...B.transitionDuration.split(",").map(R=>parseFloat(R)*1e3||0));return U=window.setTimeout(L,H+100),u.addEventListener("transitionend",M),h}function P(u){if(u!==a){if(a=u,E(),!u){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?T(u,!1):s?(n.classList.remove("show"),E=S(n,()=>T(u,!1))):T(u,!0)}}function C(u){p=u,n.classList.toggle("on",u!==null),P(u),x(),i.inert=!u,u?s?(i.classList.remove("show"),x=S(i,()=>z(u))):z(u):(i.classList.remove("show"),f=null)}function z(u){o.textContent=o.title=Re(u);let N=zt(u,e.root,t)===null;r.hidden=N;let B=i.classList.contains("show");f=u,A(),B||(i.offsetWidth,i.classList.add("show"))}function G(u){let N;try{N=lt(u,e.root)}catch(h){e.report(h);return}let B={anchor:N,label:Re(u),ranges:[],resolved:{state:"attached",element:u,range:null}},U=e.state.draft;C(u),l=U??{...B,ranges:[]},U?e.moveDraft({...B,ranges:[]}):e.startDraft(l)}function K(u){e.keepCaret(()=>G(u))}function ie(u){let N=(u.target instanceof Element?Qe(u.target,e.root,t):null)??e.root,B=N.getBoundingClientRect();if(!B.width||!B.height)return;let U={x:(u.clientX-B.left)/B.width,y:(u.clientY-B.top)/B.height},h;try{h=lt(N,e.root,U)}catch(M){e.report(M);return}let L=Re(N).replace(/^[A-Z](?=[a-z])/,M=>M.toLowerCase());C(null),P(null),e.startDraft({anchor:h,label:`Pin on ${L}`,ranges:[],resolved:{state:"attached",element:N,range:null}})}function q(u){let N=window.getSelection();if(N&&!N.isCollapsed)return;if(e.state.draft&&(u.altKey||!e.draftEmpty())){e.dismiss();return}if(!u.altKey&&e.readsAt(u.clientX,u.clientY))return;if(e.state.active&&e.open(null),u.altKey){ie(u);return}let B=u.target instanceof Element?Qe(u.target,e.root,t):null;B?G(B):(e.dismiss(),C(null))}let oe=u=>{if(!e.owns(u)){if(!w(u)){p||P(null);return}u.stopPropagation(),!(p||e.state.draft)&&P(u.target instanceof Element?Qe(u.target,e.root,t):null)}},le=u=>{w(u)&&(u.stopPropagation(),(u.type==="pointerdown"||u.type==="mousedown")&&u.target instanceof Element&&u.target.closest(Yo)&&u.preventDefault())},j=u=>{w(u)&&(u.preventDefault(),u.stopPropagation(),u.type==="click"&&q(u))},ee=u=>{(u.key==="Enter"||u.key===" ")&&w(u)&&u.target instanceof Element&&u.target.closest(Hn)&&(u.preventDefault(),u.stopPropagation())};window.addEventListener("pointermove",oe,!0);for(let u of Bn)window.addEventListener(u,le,!0);for(let u of Dn)window.addEventListener(u,j,!0);return window.addEventListener("keydown",ee,!0),{back(){return p?(C(null),!0):!1},render(){let u=e.state.draft;l&&u!==l?(l=null,C(null)):u&&!l&&(a||p)&&C(null)},frame(){v(),A()},destroy(){E(),x(),window.removeEventListener("pointermove",oe,!0);for(let u of Bn)window.removeEventListener(u,le,!0);for(let u of Dn)window.removeEventListener(u,j,!0);window.removeEventListener("keydown",ee,!0),n.classList.remove("show"),i.classList.remove("show"),J(i,!0),S(n,()=>n.remove()),S(i,()=>i.remove())}}}var Go=300,Xo=32,Kt=220,Je=320,Zo=24,_n=24;function Wt(e,t=!1){let n=e.ownerDocument.documentElement,o=n.getAttribute("data-pipeup-layout");if(o==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(o==="column"?e:null);if(!r)return null;if(n.hasAttribute("data-pipeup-reserve")){let a=n.clientWidth,l=getComputedStyle(r).maxWidth,d;return l.endsWith("px")?d=parseFloat(l):l.endsWith("%")?d=parseFloat(l)/100*a:d=r.getBoundingClientRect().width,o!=="column"&&a<d+Je-(t?Zo:0)?null:{x:a-Je+_n,width:Je-2*_n}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<Go&&o!=="column")return null;let s=i+Xo;return{x:s,width:Math.max(220,Math.min(300,window.innerWidth-s-16))}}function Yt(e,t){let n=e.resolved.get(t.id);return!n||n.state==="orphaned"&&!e.pending.has(t.id)}function qn(e){let t=m("div",{class:"col"});e.layer.append(t);let n=new Map,o=null,r=new ResizeObserver(()=>a()),i=f=>Yt(e,f);function s(f){let x=e.resolved.get(f.id),w=x?Vt(f.anchor,x):null;return w===null?Number.POSITIVE_INFINITY:w+window.scrollY-4}function a(){let f=[],x=[];for(let[S,P]of n){let C=s(P.thread);if(Number.isFinite(C))P.placed=C;else if(e.pending.has(S)){if(P.placed===null){P.el.classList.add("wait");continue}C=P.placed}Number.isFinite(C)?f.push({id:S,want:C,height:P.el.offsetHeight}):x.push({id:S,height:P.el.offsetHeight})}let w=e.state.draft,v=w?Vt(w.anchor,w.resolved):null;o&&v!==null&&f.push({id:"draft",want:v+window.scrollY-4,height:o.el.offsetHeight});let A=On(f,o?"draft":e.state.active),T=Math.max(0,...f.map(S=>(A.get(S.id)??0)+S.height))+24;for(let S of x)A.set(S.id,T),T+=S.height+10;for(let[S,P]of n){if(P.el.classList.contains("wait")){if(!A.has(S))continue;P.el.style.transition="none",P.el.style.transform=`translateY(${Math.round(A.get(S))}px)`,P.el.offsetWidth,P.el.style.transition="",P.el.classList.remove("wait");continue}P.el.style.transform=`translateY(${Math.round(A.get(S)??0)}px)`}o&&(o.el.style.transform=`translateY(${Math.round(A.get("draft")??0)}px)`)}function p(f,x){f.thread=x,f.lost=i(x),f.view.update(x,{lost:f.lost?x.anchor.snapshot:null})}function l(f){let x=i(f),w=De(f,e.actions,{variant:"column",lost:x?f.anchor.snapshot:null}),v=m("div",{class:"th","data-thread":f.id},w.element);return v.style.transition="none",v.addEventListener("mouseenter",()=>e.hot(f.id)),v.addEventListener("mouseleave",()=>e.hot(null)),v.addEventListener("click",()=>e.open(f.id)),t.append(v),r.observe(v),{el:v,thread:f,lost:x,placed:null,view:w}}function d(){let f=e.state.draft;if(o&&f&&o.of!==f){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Kt),o=null}if(f&&o&&(o.box.setLabel(f.label),o.box.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point)),f&&!o){let x=gt(e,f),w=m("div",{class:"th on"},x.element);w.style.transition="none",t.append(w),r.observe(w),o={el:w,box:x,of:f},x.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point),x.focus()}else if(!f&&o){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Kt),o=null,e.registerDraft(null)}}function y(f){J(t,e.state.listing);let x=new Set,w=[],v=e.state.active!==null||e.state.draft!==null;for(let A of f){if(!e.visible(A))continue;x.add(A.id);let T=n.get(A.id);T?(T.thread!==A||T.lost!==i(A))&&p(T,A):(T=l(A),n.set(A.id,T),w.push(T.el));let S=T.el;S.classList.toggle("on",e.state.active===A.id);let P=S.querySelector(".more");P&&J(P,e.state.active!==A.id),S.classList.toggle("dim",v&&e.state.active!==A.id),S.classList.toggle("hot",e.state.hot===A.id&&e.state.active!==A.id),S.classList.toggle("resolved",A.resolved),S.classList.toggle("lost",T.lost)}for(let[A,T]of n)x.has(A)||(n.delete(A),r.unobserve(T.el),T.el.classList.add("out"),window.setTimeout(()=>T.el.remove(),Kt));d(),a(),o&&w.push(o.el);for(let A of w)A.offsetWidth,A.style.transition=""}function E(){let f=Wt(e.root,!0);f&&(t.style.width=`${f.width}px`,t.style.transform=`translate(${f.x}px, ${-window.scrollY}px)`)}return{render:y,frame:E,destroy(){r.disconnect(),e.registerDraft(null),t.remove()}}}var Qo="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function Vn(e){let t=m("button",{type:"button","aria-label":"Comment",title:"Comment"},Y("comment",17)),n=m("div",{class:"selbar"},t);n.inert=!0,e.layer.append(n);let o=null,r=d=>{let y=d&&(d.nodeType===Node.ELEMENT_NODE?d:d.parentElement);return!!y&&e.root.contains(y)&&!y.closest(Qo)};function i(){if(!o)return;let d=o.getBoundingClientRect(),{left:y,top:E}=bt({left:d.left,top:d.top,width:d.width,height:d.height},{width:n.offsetWidth||36,height:n.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});n.style.left=`${y}px`,n.style.top=`${E}px`}function s(){o=null,n.inert=!0,n.classList.remove("show")}function a(){let d=window.getSelection();if(!e.state.commenting||!d||d.isCollapsed||d.rangeCount===0||!d.toString().trim()||!r(d.anchorNode)||!r(d.focusNode)){s();return}o=d.getRangeAt(0).cloneRange(),i(),n.inert=!1,n.classList.add("show")}t.addEventListener("mousedown",d=>d.preventDefault()),t.addEventListener("click",d=>{d.stopPropagation();let y=o;if(!y)return;let E;try{E=Rt(y,e.root)}catch(x){e.report(x),s();return}let f=he(y.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),s(),e.startDraft({anchor:E,label:`\u201C${f}\u201D`,ranges:[y],resolved:{state:"attached",element:null,range:y}})});let p=()=>{if(!o)return;let d=window.getSelection();(!d||d.isCollapsed||!d.toString().trim())&&s()};document.addEventListener("selectionchange",p);let l=d=>{e.owns(d)||window.setTimeout(a,0)};return window.addEventListener("mouseup",l,!0),window.addEventListener("keyup",l,!0),{render(){!e.state.commenting&&o&&s()},frame(){o&&i()},destroy(){window.removeEventListener("mouseup",l,!0),window.removeEventListener("keyup",l,!0),document.removeEventListener("selectionchange",p),n.remove()}}}async function jt(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(n),n.select();let o=document.execCommand("copy");if(n.remove(),!o)throw new Error("pipeup: your browser blocked copying")}function Un(e){let t=[m("span",{class:"n"}),m("span",{class:"n"})],n=Y("comment",20,1.4);n.lastElementChild.setAttribute("stroke-width","1.6");let o=m("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":_t,"aria-haspopup":"menu","aria-expanded":"false"},m("span",{class:"plus"},n),m("span",{class:"cnt"},Y("bubble",34,1.4),...t)),r=m("span",{class:"ttip","aria-hidden":"true"},"Comment",m("small",{},Ye)),i=m("div",{class:"launch"},o,r),s=m("div",{class:"menu",role:"menu","aria-label":"Comments"}),a=m("div",{class:"list",role:"menu","aria-label":"All comments"}),p=m("span",{class:"pn"}),l=m("button",{class:"ib",type:"button","aria-label":"Close"},Y("close")),d=m("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",m("span",{class:"sw","aria-hidden":"true"}));d.addEventListener("click",g=>{g.stopPropagation(),e.menu.toggleResolved()});let y=m("div",{class:"all",role:"dialog","aria-label":"All comments"},m("div",{class:"hd"},m("span",{},"All comments"),p,d,l),a),E=m("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});s.inert=y.inert=E.inert=!0,e.layer.append(s,i,y);let f=!1,x=!1,w=[],v=!1,A=0,T=null,S=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,P=g=>{f=g,g||x&&(x=!1,Me()),s.classList.toggle("show",g),J(s,!g),o.setAttribute("aria-expanded",String(g))},C=(g,k=!1)=>{e.state.listing!==g&&(e.state.listing=g,e.render(),g?(z(a)[0]??l).focus({preventScroll:!0}):k&&o.focus({preventScroll:!0}))},z=(g=s)=>[...g.querySelectorAll(".mi")],G=()=>s.getRootNode().activeElement,K=()=>{P(!1),o.focus({preventScroll:!0})},ie=()=>{x=!1,Me(),F.focus({preventScroll:!0})},q=g=>{let k=z(g.currentTarget);if(k.length===0)return;let $=G(),I=k.indexOf($),_=te=>{g.preventDefault(),k[(te+k.length)%k.length]?.focus({preventScroll:!0})};g.key==="ArrowDown"?_(I+1):g.key==="ArrowUp"?_(I<0?k.length-1:I-1):g.key==="Home"?_(0):g.key==="End"&&_(k.length-1)};s.addEventListener("keydown",q),a.addEventListener("keydown",q),l.addEventListener("click",g=>{g.stopPropagation(),C(!1,!0)});let oe=g=>Yt(e,g),le=()=>w.filter(g=>!g.resolved).length;function j(){let g=z(a).indexOf(G()),k=e.menu.all().filter(re=>!re.thread.resolved||e.state.showResolved),$=re=>{let ae=re.thread,_e=Ee(ae.root.author,ae.root.name);_e.classList.add("in");let Oe=m("button",{class:ae.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":ae.id},_e,m("span",{},m("span",{class:"clamp"},ae.root.deleted?"Deleted":ae.root.text),m("small",{},oe(ae)?`\u201C${he(ae.anchor.snapshot,80)}\u201D`:re.location.where)));return Oe.addEventListener("click",tt=>{tt.stopPropagation(),ee(ae.id,Oe.getBoundingClientRect().top)}),Oe},I=k.filter(re=>oe(re.thread)),_="No longer on the page";p.textContent=String(le()),d.setAttribute("aria-checked",String(e.state.showResolved)),a.replaceChildren(k.length?"":m("div",{class:"sec",role:"presentation"},"No open comments"),...k.filter(re=>!oe(re.thread)).map($),I.length?m("div",{role:"group","aria-label":_},m("div",{class:"sec","aria-hidden":"true"},_),...I.map($)):"");let te=z(a);g>=0&&te[Math.min(g,te.length-1)]?.focus({preventScroll:!0})}function ee(g,k){Te()&&(e.state.reading=!0,C(!1)),u(g,k)}function u(g,k){let $=w.find(te=>te.id===g),I=e.resolved.get(g);if(!$)return;let _=I&&!oe($)?I.element??I.range?.startContainer.parentElement??null:null;if(_?.scrollIntoView({block:"center",inline:"nearest",behavior:S?"auto":"smooth"}),_&&I&&Xe($.anchor,I)&&_.checkVisibility?.({visibilityProperty:!0})!==!1){B(),e.open(g);return}e.open(null),Te()&&(e.state.reading=!0,e.render()),N($,k)}function N(g,k){let $={quote:g.anchor.quote?.exact??null,lost:oe(g)?g.anchor.snapshot:null};if(T?.id===g.id?T.view.update(g,$):(T={id:g.id,view:De(g,e.actions,{variant:"popover",...$})},E.replaceChildren(T.view.element)),k===void 0)return;E.isConnected||(e.layer.insertBefore(E,y),E.offsetWidth);let I=yt(e.state.listing),{left:_,top:te}=wt({x:I.width,y:k,below:!1},{width:ke,height:E.offsetHeight},I);E.style.left=`${_}px`,E.style.top=`${te}px`,E.classList.add("show"),E.inert=!1,e.focusReply(g.id)}function B(g=!1){T&&(T=null,E.classList.remove("show"),J(E,!0),g&&e.state.reading&&(e.state.reading=!1,e.render()))}function U(g,k,$,I=!1,..._){let te=m("button",{class:"mi",type:"button",role:I?"menuitemcheckbox":"menuitem"},g,m("span",{class:"lb"},k),..._,I&&m("span",{class:"sw","aria-hidden":"true"}),m("span",{class:"tt","aria-hidden":"true"}));return te.addEventListener("click",re=>{re.stopPropagation(),$()}),te}let h=(g,k,$,I)=>{let _=g.querySelector(".lb");_.textContent!==k&&(_.textContent=k),g.querySelector(".tt").textContent=$,g.setAttribute("aria-description",$),I!==void 0&&g.setAttribute("aria-checked",String(I))},L=()=>m("div",{class:"sep",role:"separator"}),M=m("span",{class:"ma"}),H=m("span",{class:"kc"}),R="",F=U(M,"",()=>{x=!0,Me()},!1,H);F.dataset.item="name";let X=U(Y("copy"),"Copy all",()=>{K(),e.menu.copyAll("ai")}),Z=U(Y("lines"),"Copy all as text",()=>{K(),e.menu.copyAll("text")}),Be=m("span",{class:"kc"}),Le=U(Y("list"),"All comments",()=>{P(!1),C(!0)},!1,Be),ce=U(Y("comment"),"Start commenting",()=>{K(),e.setCommenting(!e.state.commenting)},!0,m("span",{class:"kc","aria-hidden":"true"},Ye));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",_t);let Et=[F,L(),X,Z,Le,L(),ce];function He(){let g=le(),k=e.menu.name(),$=k||fe(e.doc.me);if(h(F,$,k?"The name on your comments":"Add a name to show on your comments"),F.setAttribute("aria-label",`${$}, ${k?"edit":"add"} your name`),H.replaceChildren(k?Y("edit",13):"Add name"),je(e.doc.me,k)!==R){R=je(e.doc.me,k);let I=Ee(e.doc.me,k);I.classList.add("in"),M.replaceChildren(I)}h(X,"Copy all","Markdown, with where each thread is"),h(Z,"Copy all as text","Just the words"),h(Le,"All comments","Every thread, and where it is"),Be.textContent=g?String(g):"",h(ce,"Start commenting",e.state.commenting?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.commenting)}function Me(){if(x){let g=m("textarea",{class:"input",rows:"1","aria-label":"Your name"});g.value=e.menu.name(),g.addEventListener("keydown",k=>{if(k.stopPropagation(),k.key==="Enter"){k.preventDefault();let $=g.value.trim();$&&e.menu.rename($).then(ie)}else k.key==="Escape"&&ie()}),s.replaceChildren(m("label",{class:"name"},"Your name",g)),g.focus({preventScroll:!0});return}He(),s.firstChild!==F&&s.replaceChildren(...Et)}o.addEventListener("click",g=>{if(g.stopPropagation(),f){P(!1);return}Me(),P(!0),g.detail===0&&z().at(-1)?.focus({preventScroll:!0})});let Ce=!1,Pe=()=>{Ce=y.contains(G())},Fe=g=>{let k=g.composedPath();f&&!k.includes(s)&&!k.includes(o)&&P(!1),e.state.listing&&!e.owns(g)&&C(!1,Ce&&(!document.activeElement||document.activeElement===document.body)),!k.includes(E)&&!k.includes(y)&&B(!0)};window.addEventListener("pointerdown",Pe,!0),window.addEventListener("click",Fe,!0);let et=g=>{if(g.key!=="Escape"||x)return;let k=g.composedPath()[0];if(f)K();else if(e.state.listing&&!(k instanceof HTMLTextAreaElement&&!y.contains(k)))C(!1,!0);else if(T)B(!0),e.actions.close();else return;g.stopPropagation()};return window.addEventListener("keydown",et,!0),{render(g){w=g;let k=le();if(k!==A){if(k){let[I,_]=t[0].classList.contains("on")?t:[t[1],t[0]];_.textContent=k>99?"99+":String(k),_.classList.toggle("s",k>99),I.classList.remove("on"),_.classList.add("on")}o.classList.toggle("has",k>0),o.setAttribute("aria-label",k?`Comment, ${k} open`:"Comment"),A=k}e.state.commenting&&!v&&f&&K(),v=e.state.commenting,o.classList.toggle("on",v),f&&!x&&He();let $=e.state.listing;if(y.classList.toggle("full",Te()),y.classList.contains("show")!==$&&(y.classList.toggle("show",$),J(y,!$)),$&&j(),T){let I=g.find(_=>_.id===T?.id);!I||e.state.active||I.resolved&&!e.state.showResolved?B():N(I)}},frame(){},destroy(){window.removeEventListener("pointerdown",Pe,!0),window.removeEventListener("click",Fe,!0),window.removeEventListener("keydown",et,!0),s.remove(),y.remove(),E.remove(),i.remove()}}}var Kn=["pipeup-quote","pipeup-on","pipeup-done"],Jo={"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]]},er=(e,t)=>Kn.map(n=>{let[o,r,i,s]=Jo[n][e?1:0];return`::highlight(${n}){background-color:rgba(${o},${r},${i},${+(s*t).toFixed(3)})}`}).join("");function Wn(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var tr="<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>",nr=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(tr)}") 3 2,crosshair!important}`;function Yn(e=document,t=!1){let n=e.defaultView?.CSSStyleSheet;if(!n||!("replaceSync"in n.prototype)||!("adoptedStyleSheets"in e))return{gutter(){},picking(){},fade(){},room(){},remove:()=>zn()};let o=new n,r=null,i=!1,s=1,a=0,p="",l=0,d=()=>o.replaceSync(er(t,s)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?nr:"")+(a||p?`html{${a?`margin-right:${a}px!important;`:""}${p}}`:""));return d(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,o],{gutter(y){y!==r&&(r=y,d())},picking(y){y!==i&&(i=y,d())},fade(y){s=y,d()},room(y,E){y!==a&&(a=y,p=E?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(l),!y&&p&&(l=window.setTimeout(()=>{p="",d()},400)),d())},remove(){clearTimeout(l),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(y=>y!==o),zn()}}}function jn(e){Wn()&&(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 zn(){if(Wn())for(let e of Kn)CSS.highlights.delete(e)}var Gt=':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(--pu-ink);--pu-ink:#2C2C2A;--pu-muted:#5F5E5A;--pu-faint:#888780;--pu-line:#E5E3DA;--pu-rule:#ECEAE2;--pu-soft:#FAFAF7;--pu-surface:#FFFFFF;--pu-hover:#F1EFE8;--pu-accent-soft:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--pu-shadow:0 8px 28px rgba(44,44,42,.1);--pu-enter:.26s;--pu-move:.34s;--pu-exit:.2s;--pu-pulse:1.2s;--pu-eo:cubic-bezier(.22,.61,.36,1);--pu-eio:cubic-bezier(.4,0,.2,1);--pu-ei:cubic-bezier(.4,0,1,1)}.layer.dark{--pu-ink:#ECEBE6;--pu-muted:#B4B2A9;--pu-faint:#8D8B84;--pu-line:#3A3936;--pu-rule:#34332F;--pu-soft:#22221F;--pu-surface:#1B1B19;--pu-hover:#2C2C29;--pu-shadow: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(--pu-ink);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--pu-faint)}.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(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.ft .rest{transition:opacity var(--pu-enter) var(--pu-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(--pu-muted);transition:background-color .2s var(--pu-eo),color .2s var(--pu-eo)}.ib:hover,.ib:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--pu-move) var(--pu-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(--pu-line);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--pu-ink);background:transparent;transition:border-color var(--pu-enter) var(--pu-eo)}.row:hover .input,.input:hover{border-bottom-color:var(--pu-muted)}.input:focus{border-bottom-color:var(--pu-accent)}.name{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--pu-faint);padding-top:6px}.name .input{font-size:13px;height:24px}.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(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-faint)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-muted);text-decoration:underline;text-decoration-color:var(--pu-line);text-underline-offset:2px;transition:color .2s var(--pu-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(--pu-enter) var(--pu-eo),background-color .2s var(--pu-eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--pu-accent-soft)}.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(--pu-surface);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--pu-faint)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo)}.pop.show.glide{transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--pu-accent-soft);border-radius:8px;opacity:0;transition:opacity .3s var(--pu-eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--pu-accent-soft);animation:pu-pulse var(--pu-pulse) var(--pu-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(--pu-enter) var(--pu-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(--pu-move) var(--pu-eio),box-shadow var(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-eo)}.th.hot{box-shadow:inset 2px 0 0 var(--pu-line)}.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(--pu-exit) var(--pu-ei)}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-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(--pu-eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--pu-accent-soft);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(--pu-exit) var(--pu-ei),border-color var(--pu-exit) var(--pu-ei)}.pick.show{opacity:1;transition-duration:var(--pu-enter);transition-timing-function:var(--pu-eo)}.pick.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-eio)}.pick.on{border-color:var(--pu-accent)}.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(--pu-muted);white-space:nowrap;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-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(--pu-eo),color .2s var(--pu-eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);transition:background-color .3s var(--pu-eo),color .3s var(--pu-eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--pu-hover)}.launch .mode.on{background:var(--pu-accent);color:#fff}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--pu-faint)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--pu-exit) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-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(--pu-eo)}.mi:hover,.mi:focus-visible{background:var(--pu-soft);outline:none}.mi svg{color:var(--pu-muted);flex:none}.mi small{display:block;color:var(--pu-faint);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(--pu-rule)}.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(--pu-muted);background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-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(--pu-line);transition:background-color var(--pu-move) var(--pu-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(--pu-move) var(--pu-eio),opacity var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),opacity var(--pu-exit) var(--pu-ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--pu-move) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-faint)}.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(--pu-muted);transition:background-color .2s var(--pu-eo)}.hs:hover,.hs:focus-visible{background:var(--pu-hover);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(--pu-exit) var(--pu-ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--pu-faint)}.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(--pu-eo),transform .36s var(--pu-eo)}.toast.show{opacity:1;transform:translate(-50%)}@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 Gn="#534AB7",or="rgb(0, 0, 238)";function Xn(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 n=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:n}}function rr(e){let t=n=>{let o=n/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Zn(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{font:"system-ui, sans-serif",accent:Gn,dark:!1};let o=t.documentElement,r=n.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(n.getComputedStyle(o).getPropertyValue("--pipeup-accent")||o.style.getPropertyValue("--pipeup-accent")).trim(),s=e.querySelector("a[href]"),a=s?n.getComputedStyle(s).color:"",p=i||(a&&a!==or?a:Gn),l=Xn(n.getComputedStyle(t.body).backgroundColor);(!l||l.a===0)&&(l=Xn(n.getComputedStyle(o).backgroundColor));let d=l&&l.a>0?rr(l)<.2:n.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(n.getComputedStyle(o).colorScheme||"");return{font:r,accent:p,dark:!!d}}function Qn(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function Jn(e,t=document){let n=t.createElement("pipeup-root");n.setAttribute("data-pipeup-ignore",""),n.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 o=n.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in o){let s=new r;s.replaceSync(Gt),o.adoptedStyleSheets=[s]}else{let s=t.createElement("style");s.textContent=Gt,o.append(s)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${Ze}px`),i.style.setProperty("--pu-pop",`${ke}px`),Qn(i,e),o.append(i),t.documentElement.append(n),{element:n,shadow:o,layer:i,destroy:()=>n.remove()}}var ir=40,ar=250,sr=120,lr=2400,eo=4e3;function to(e,t=!1){return Wt(e,t)?"column":"bubbles"}function cr(e){return[...e.state.mode==="column"?[qn(e),Ut(e,{popovers:!1})]:[Ut(e,{popovers:!0})],Vn(e),Un(e)]}var pr=1e3,xt="Shown here, but not saved yet \u2014 it will be saved with your next change",Se=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function no(e){let t=Zn(e.root),n=Jn(t),o=Yn(document,t.dark);o.fade(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),s=new Map,a=new Set,p=new WeakSet,l={active:null,hot:null,showResolved:!1,hidden:!0,mode:to(e.root),draft:null,commenting:!1,listing:!1,reading:!1},d=m("div",{class:"toast",role:"status","aria-live":"polite"});n.layer.append(d);let y=null,E=[],f=null,x=!1,w=0,v=0,A=0,T=0,S=0,P=!1;function C(c,b=lr){x||(P=b===eo,d.textContent=c,d.classList.add("show"),window.clearTimeout(w),w=window.setTimeout(()=>d.classList.remove("show"),b))}function z(){P&&(P=!1,window.clearTimeout(w),d.classList.remove("show"))}function G(c){C(Se(c))}function K(c){throw G(c),c}let ie=c=>({thread:c,location:Nt(c.anchor,s.get(c.id)??ct(c.anchor,e.root),e.root)}),q={reply:async(c,b)=>{try{await e.doc.reply(c,b)}catch(O){O instanceof de?C(xt):K(O)}},resolve:async c=>{try{await e.doc.resolve(c),l.active===c&&!l.showResolved&&(l.active=null),C("Resolved \xB7 Show resolved brings it back")}catch(b){b instanceof de?(l.active===c&&!l.showResolved&&(l.active=null),C(`Resolved \xB7 ${xt}`)):C(Se(b))}},reopen:async c=>{try{await e.doc.reopen(c),C("Reopened")}catch(b){C(b instanceof de?`Reopened \xB7 ${xt}`:Se(b))}},close:()=>{ce(null),F&&X(F)?.focus({preventScroll:!0}),F=""},copy:c=>{try{let b=e.doc.threads().find(D=>D.id===c);if(!b)return;let O=Ht(ie(b),"ai",location.href,Date.now());jt(O,n.layer).then(()=>C("Thread copied as Markdown for AI"),D=>C(Se(D)))}catch(b){C(Se(b))}}};function oe(c){let b=O=>s.get(O.id)?.element??null;return[...c].sort((O,D)=>{let V=b(O),ne=b(D);return!V||!ne?V?-1:ne?1:0:V===ne?0:V.compareDocumentPosition(ne)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1})}let le={copyAll:async c=>{let b=le.all(),O=Ft(b,c,{title:document.title,url:location.href,exportedAt:new Date});try{await jt(O,n.layer);let D=b.filter(V=>!V.thread.resolved).length;C(`Copied ${D} thread${D===1?"":"s"}${c==="ai"?" as Markdown for AI":""}`)}catch(D){C(Se(D))}},toggleResolved:()=>{l.showResolved=!l.showResolved,R()},rename:async c=>{let b=c.replace(/\s+/g," ").trim();try{await et(b)?C(`New comments will say ${b}, but this browser couldn't remember it`):C(`New comments will say ${b}`)}catch(O){C(Se(O))}},name:()=>e.doc.name,all:()=>oe(e.doc.threads()).map(ie)},j={doc:e.doc,root:e.root,layer:n.layer,host:n.element,state:l,resolved:s,pending:a,actions:q,menu:le,visible:c=>!l.hidden&&(!c.resolved||l.showResolved),quoteAt:(c,b)=>{for(let O of e.doc.threads()){let D=s.get(O.id);if(O.anchor.quote&&j.visible(O)&&D?.range&&Pn(c,b,Ge(D)))return O}return null},readsAt:(c,b)=>j.draftEmpty()?j.quoteAt(c,b):null,owns:c=>c.composedPath().includes(n.element),claim:c=>void p.add(c),open:ce,focusReply:c=>Le(c),hot:Et,startDraft:He,moveDraft:Me,draftEmpty:()=>!y||y.isEmpty(),keepCaret:c=>{let b=y?.caret();c(),b?.()},postDraft:g,cancelDraft:Ce,setCommenting:Pe,dismiss:Fe,registerDraft:c=>{y=c},toast:C,report:G,pulse:k,render:R};function ee(c){let b=performance.now(),O=e.doc.threads();for(let D of O){if(c&&!c.has(D.id))continue;let V=performance.now()-b<ir,ne=ct(D.anchor,e.root,{fuzzy:V});s.set(D.id,ne),!V&&ne.state==="orphaned"?a.add(D.id):a.delete(D.id)}for(let D of[...s.keys()])O.some(V=>V.id===D)||s.delete(D);a.size===0?(window.clearTimeout(T),T=0):T===0&&(T=window.setTimeout(()=>{T=0,!x&&(ee(new Set(a)),R())},ar))}function u(c){let b=[],O=[],D=[];for(let V of c){let ne=s.get(V.id);V.resolved&&!l.showResolved||!ne?.range||(V.id===l.active||V.id===l.hot?O.push(ne.range):V.resolved?D.push(ne.range):b.push(ne.range))}l.draft&&O.push(...l.draft.ranges),jn({quote:b,on:O,done:D})}let N=0,B=0,U=0;function h(c){if(c===B)return;B=c,cancelAnimationFrame(U);let b=N,O=performance.now(),D=c?260:200,V=ne=>{let nt=Math.min(1,(ne-O)/D);N=b+(c-b)*(c?1-(1-nt)**3:nt*nt),o.fade(N),nt<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let L=0,M=0;function H(c){c!==L&&(L=c,o.room(c,r),window.clearTimeout(M),M=window.setTimeout(()=>{ee(),R()},r?0:400))}function R(){if(x)return;let c=e.doc.threads();l.hidden=!l.commenting&&!l.listing&&!l.reading&&!l.draft,l.hidden&&(l.active=null),h(l.hidden?0:1),n.layer.classList.toggle("hidden",l.hidden),n.layer.classList.toggle("listing",l.listing);let b=l.listing&&!Te();H(b?Ze:0),o.gutter(i?l.mode==="column"&&!l.hidden&&!b?Je:0:null),u(c);for(let O of E)O.render(c);f?.render(c)}let F="",X=c=>n.layer.querySelector(`.all .mi[data-thread="${c}"]`),Z="input,textarea,select,[contenteditable]:not([contenteditable=false])",Be=()=>{let c=n.layer.getRootNode().activeElement;return c instanceof HTMLTextAreaElement&&c.value!==""||!!document.activeElement?.matches(Z)};function Le(c,b=Be()){let O=[...n.layer.querySelectorAll(`[data-thread="${c}"] .rbox textarea`)].find(D=>!D.closest("[inert]"));b||!O||(F=n.layer.getRootNode().activeElement?.getAttribute("data-thread")??"",O.focus({preventScroll:!0}))}function ce(c){if(c&&l.draft&&!j.draftEmpty())return;if(l.active===c&&!l.draft)return c?Le(c):void 0;let b=Be();c||(l.reading=!1),l.active=c,c&&(l.draft=null,k(c)),R(),c&&Le(c,b)}function Et(c){l.hot!==c&&(l.hot=c,c&&c!==l.active&&k(c),R())}function He(c){z(),l.listing=!1,l.draft=c,l.active=null,R()}function Me(c){if(!l.draft)return He(c);Object.assign(l.draft,c),R()}function Ce(){l.draft&&(l.draft=null,R())}function Pe(c){l.commenting!==c&&(l.commenting=c,o.picking(c),c?(l.active=null,l.listing=!1,C(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${Ye} or Esc to finish`,eo),f=Fn(j)):(z(),f?.destroy(),f=null),R())}function Fe(){if(l.draft){j.draftEmpty()&&Ce();return}l.active&&ce(null)}async function et(c){try{return await e.onName(c),!1}catch(b){if(e.doc.name!==c)throw b;return!0}}async function g(c){let b=l.draft;if(b)try{let O=await e.doc.comment(b.anchor,c);l.draft=null,ee(new Set([O])),ce(O)}catch(O){if(O instanceof de){l.draft=null,ee(new Set([O.id])),ce(O.id),C(xt);return}K(O)}}function k(c){let b=s.get(c);if(!b||b.state==="orphaned")return;let O=b.range?Ge(b):b.element?[b.element.getBoundingClientRect()]:[];for(let D of O.slice(0,6)){let V=m("div",{class:"pulse"});$e(V,D,4),n.layer.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function $(){for(let c of E)c.destroy();E=cr(j),R()}let I=()=>{if(!x){for(let c of E)c.frame();f?.frame(),S=requestAnimationFrame(I)}},_=c=>{let b=c.composedPath()[0];return b instanceof Element&&b.closest(Z)!==null},te=c=>{if(c.key==="Escape"){l.draft?Ce():l.active?ce(null):f&&!f.back()&&Pe(!1);return}Ln(c)&&!c.isComposing&&!c.defaultPrevented&&!_(c)&&(c.preventDefault(),Pe(!l.commenting))},re=c=>{if(j.owns(c)||p.has(c))return;let b=window.getSelection();b&&!b.isCollapsed||Fe()},ae=()=>{let c=to(e.root,l.mode==="column");c!==l.mode?(l.mode=c,$()):R()};function _e(){let c=performance.now();v===0&&(A=c),window.clearTimeout(v);let b=Math.min(sr,Math.max(0,A+pr-c));v=window.setTimeout(()=>{v=0,ee(),R()},b)}let Oe=new MutationObserver(c=>{c.every(b=>n.element.contains(b.target))||_e()});window.addEventListener("keydown",te),window.addEventListener("click",re),window.addEventListener("resize",ae),Oe.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let tt=typeof ResizeObserver>"u"?null:new ResizeObserver(_e);tt?.observe(e.root);let oo=e.doc.onChange(()=>{ee(),R()});return ee(),$(),S=requestAnimationFrame(I),{ctx:j,destroy(){x=!0,cancelAnimationFrame(S),cancelAnimationFrame(U),window.clearTimeout(M),window.clearTimeout(w),window.clearTimeout(v),window.clearTimeout(T),Oe.disconnect(),tt?.disconnect(),oo(),window.removeEventListener("keydown",te),window.removeEventListener("click",re),window.removeEventListener("resize",ae),f?.destroy();for(let c of E)c.destroy();o.remove(),n.destroy()}}}var Ae=null,dr=4e3;function ur(e={}){if(Ae)return Ae;let t=fr(e,()=>t).catch(n=>{throw Ae===t&&(Ae=null),n});return Ae=t,t}function mr(e,t){return new Promise((n,o)=>{let r=setTimeout(()=>o(new Error("timed out")),t);e.then(n,o).finally(()=>clearTimeout(r))})}async function fr(e,t){let n=document.documentElement.getAttribute("data-pipeup-doc"),{id:o,key:r}=n?await Mt(n):{id:`page-${we(location.origin+location.pathname)}`,key:null},i,s=!1,a;if(e.store)i=e.store,a=await Ue(i);else try{let f=ze.open();i=await mr(f,dr).catch(x=>{throw f.then(w=>w.close(),()=>{}),x}),a=await Ue(i)}catch{i=new Ve,s=!0,a=await Ue(i)}let p=e.name?.trim();p&&p!==a.name&&(a={...a,name:p},await i.saveProfile(a));let l=await qe.open({doc:o,key:r,store:i,identity:a.identity,name:a.name}),d=no({doc:l,root:e.root??document.body,onName:async f=>{l.name=f,a={...a,name:f},await i.saveProfile(a)}});s&&d.ctx.toast("This browser can't keep comments for this page \u2014 copy the comments (Copy all) to keep them");let y=()=>void l.flush().catch(f=>globalThis.reportError?.(f)),E=!1;return window.addEventListener("pagehide",y),{document:l,flush:()=>l.flush(),unmount:()=>{E||(E=!0,window.removeEventListener("pagehide",y),d.destroy(),Ae===t()&&(Ae=null))}}}export{Ie as ANIMALS,$t as COLOURS,fn as DEFAULT_PROFILE_NAME,ze as IndexedDbStore,Ve as MemoryStore,qe as PipeupDocument,de as UnsavedChangeError,ni as VERSION,fe as animalName,Ft as copyAll,Ht as copyThread,kt as createIdentity,lt as describeElement,Rt as describeRange,Ne as formatAgo,Re as labelOf,Ue as loadOrCreateProfile,Nt as locate,ur as mount,se as nameOf,po as newDocumentAttribute,Mt as parseDocumentAttribute,ct as resolveAnchor};
|
|
9
|
+
`+t)+(e.edited?" (edited)":"")}var ni="0.3.2";function m(e,t={},...n){let o=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?o.className=String(i):o.setAttribute(r,i===!0?"":i));for(let r of n)r!=null&&r!==!1&&o.append(r);return o}function J(e,t){let n=e.getRootNode().activeElement;t&&n instanceof HTMLElement&&e.contains(n)&&n.blur(),e.inert=t}function he(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function $e(e,t,n=4){e.style.left=`${t.left-n}px`,e.style.top=`${t.top-n}px`,e.style.width=`${t.width+n*2}px`,e.style.height=`${t.height+n*2}px`}var No=/\bhttps?:\/\/[^\s<>"'`]+/gi,$o=`.,;:!?'"]}`,Do=2048,Bo=/[\u202A-\u202E\u2066-\u2069]/;function Ho(e){let t=0,n=0;for(let r of e)r==="("?t++:r===")"&&n++;let o=e.length;for(;o>0;){let r=e[o-1];if(r===")"&&n>t)n--;else if(!$o.includes(r))break;o--}return e.slice(0,o)}function dt(e){let t=[],n=0;for(let o of e.matchAll(No)){if(o[0].length>Do||Bo.test(o[0]))continue;let r=Ho(o[0]),i=o.index??0,s;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;s=p.href}catch{continue}i>n&&t.push(e.slice(n,i));let a=m("a",{href:s,target:"_blank",rel:"noopener noreferrer"},r);a.addEventListener("click",p=>p.stopPropagation()),t.push(a),n=i+r.length}return n<e.length&&t.push(e.slice(n)),t}var ge={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"}},An=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),Ye=(An?ge.mac:ge.other).label,_t=(An?ge.mac:ge.other).aria;function Ln(e){return e.code===ge.code&&e.shiftKey===ge.mods.shift&&e.altKey===ge.mods.alt&&e.metaKey===ge.mods.meta&&e.ctrlKey===ge.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var Mn="http://www.w3.org/2000/svg",Fo={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"],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 Y(e,t=15,n){let o=qt(Fo[e],t);return n&&o.setAttribute("stroke-width",String(n)),o}function qt(e,t){let n=document.createElementNS(Mn,"svg"),o={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(o))n.setAttribute(r,i);for(let r of e){let i=document.createElementNS(Mn,"path");i.setAttribute("d",r),n.append(i)}return n}var ut=(e,t,n)=>`M${e} ${t}a${n} ${n} 0 1 0 ${2*n} 0a${n} ${n} 0 1 0 -${2*n} 0`,_o={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${ut(7.4,11.5,1.9)}${ut(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${ut(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:`${ut(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 Cn(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let n=t[0].toUpperCase();return[...n].length===1?n:t[0]}var je=(e,t)=>Cn(t)||fe(e);function Ee(e,t){return m("span",{class:`av c${Bt(e)}`,"aria-hidden":"true","data-animal":fe(e)},Cn(t)||qt([_o[Ie[Dt(e)]]],24))}var qo=320;function mt(e,t){setTimeout(()=>{e.remove(),t?.()},qo)}function ft(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function ht(e){let t=m("textarea",{class:"input",rows:"1","aria-label":e.label}),n=m("button",{class:"send",type:"button","aria-label":"Send",title:"Send"},Y("send")),o=m("div",{class:"row"},e.before,t,n),r=!1,i=()=>{n.classList.toggle("show",t.value.trim()!==""),t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},s=async()=>{let a=t.value.trim();if(!(!a||r)){r=!0;try{await e.onSend(a),t.value="",i()}catch{}finally{r=!1}}};return o.addEventListener("mousedown",a=>{a.target===t||n.contains(a.target)||(a.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",a=>{a.stopPropagation(),a.key==="Enter"&&!a.shiftKey&&!a.isComposing?(a.preventDefault(),s()):a.key==="Escape"&&(a.preventDefault(),t.value="",i(),t.blur(),e.onCancel?.())}),n.addEventListener("click",a=>{a.stopPropagation(),s()}),{element:o,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Vo(e){let t=m("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",w=>w.preventDefault());let n=ht({label:"Comment",before:t,onSend:e.onSend,onCancel:e.onCancel}),o=m("div",{class:"say"}),r=m("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=m("div",{class:"nf"},r),s=m("div",{class:"you"},o,i),a="",p=!1,l=()=>{let w=e.name(),v=w?"change":"add your name";if(t.title=w?"Change your name":"Add your name",!t.lastChild||a!==w){let T=Ee(e.me,w),S=t.lastChild;S?(ft(T),mt(S)):T.classList.add("in"),t.append(T),a=w}let A=m("button",{type:"button"},v);A.addEventListener("click",y),o.replaceChildren(m("span",{class:"nm"},w||`You're ${fe(e.me)}`)," \xB7 ",A)},d=w=>{s.classList.toggle("naming",w),J(o,w),J(i,!w)};function y(w){w.stopPropagation(),r.value=e.name(),d(!0),r.focus({preventScroll:!0}),r.select()}let E=()=>{d(!1),n.focus()};t.addEventListener("click",y),r.addEventListener("keydown",w=>{if(w.stopPropagation(),w.key==="Escape")w.preventDefault(),E();else if(w.key==="Enter"){w.preventDefault();let v=r.value.trim();if(!v||v===e.name())return E();if(p)return;p=!0,e.rename(v).finally(()=>{p=!1,l(),E()})}}),l(),d(!1);let f=m("div",{class:"ctx"},e.label);return{element:m("div",{class:"draft"},f,n.element,s),caret:()=>{let{selectionStart:w,selectionEnd:v}=n.input;return()=>{n.focus(),n.input.setSelectionRange(w,v)}},hideLabel:w=>{f.hidden=w},setLabel:w=>{f.textContent=w},focus:()=>n.focus(),isEmpty:()=>n.input.value.trim()===""}}function gt(e,t){let n=Vo({label:t.label,me:e.doc.me,name:()=>e.menu.name(),rename:o=>e.menu.rename(o),onSend:o=>e.postDraft(o),onCancel:()=>e.cancelDraft()});return e.registerDraft(n),n}function vt(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let n=t.element.getBoundingClientRect();if(!n.width&&!n.height)return null;if(e.point)return{x:n.left+e.point.x*n.width,y:n.top+e.point.y*n.height};let o=t.element.ownerDocument.createRange();o.selectNodeContents(t.element);let r=o.getBoundingClientRect();return{x:r.width?Math.min(n.right-8,r.right+6):n.right-8,y:(r.height?r.top:n.top)+8}}function Ge(e){return e.range?[...e.range.getClientRects()]:[]}function Vt(e,t){let n=Ge(t)[0];if(n)return n.top;if(t.state==="orphaned"||!t.element)return null;let o=t.element.getBoundingClientRect();return e.point?o.top+e.point.y*o.height:o.top}function Xe(e,t){let n=Ge(t).at(-1);if(n)return{x:n.left,y:n.bottom,below:!0};let o=vt(e,t);return o?{...o,below:!1}:null}function Pn(e,t,n){for(let o of n)if(e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom)return!0;return!1}function On(e,t,n=10){let o=[...e].sort((a,p)=>a.want-p.want),r=new Array(o.length).fill(0),i=o.findIndex(a=>a.id===t),s=a=>o[a];if(i<0)o.forEach((a,p)=>{r[p]=p===0?a.want:Math.max(a.want,(r[p-1]??0)+s(p-1).height+n)});else{r[i]=s(i).want;for(let a=i+1;a<o.length;a++)r[a]=Math.max(s(a).want,(r[a-1]??0)+s(a-1).height+n);for(let a=i-1;a>=0;a--)r[a]=Math.min(s(a).want,(r[a+1]??0)-s(a).height-n)}return new Map(o.map((a,p)=>[a.id,r[p]??0]))}var Ze=320,ke=300,Uo=480,Te=()=>window.innerWidth<=Uo;function yt(e){let t=window.innerWidth;return{width:e&&!Te()?t-Ze:t,height:window.innerHeight}}function wt(e,t,n,o=12){let r,i;return e.below?(r=Math.min(e.x,n.width-t.width-o),i=e.y+8,i+t.height>n.height-o&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>n.width-o&&(r=e.x-t.width-28),i=Math.min(e.y-12,n.height-t.height-o)),{left:Math.max(o,r),top:Math.max(o,i)}}function Rn(e,t,n,o=12,r=44){let i=e.top-r>=8,s=e.top+e.height+8+(i?0:r),a=e.top-8-(i?r:0)-t.height,p=s+t.height<=n.height-o||a<o,l=p?s:a;return{above:!p,left:Math.max(o,Math.min(e.left,n.width-t.width-o)),top:Math.max(o,l)}}function bt(e,t,n){let o=e.top-t.height-10;return o<8&&(o=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,n.width-t.width-8)),top:o}}var In=e=>`${e} ${e===1?"reply":"replies"}`;function De(e,t,n){let o={...n},r=e.id,i=m("div",{class:"rbox always"},m("div",{},ht({label:"Reply",onSend:v=>t.reply(r,v),onCancel:t.close}).element)),s=m("div",{}),a=m("div",{}),p=null,l=m("div",{},a,m("div",{class:"more"},s)),d=new Map,y=new Map,E=new Map,f=v=>{let A=je(v.author,v.name),T=d.get(v.id),S=T?.el;if((!S||T.key!==A)&&(S=ft(Ee(v.author,v.name)),T)){let C=T.el;E.set(v.id,C),mt(C,()=>E.get(v.id)===C&&E.delete(v.id))}S.title=se(v),y.set(v.id,{key:A,el:S});let P=E.get(v.id);return P?[P,S]:[S]},x=(v,A,T)=>{let S=m("button",{class:"ib",type:"button","aria-label":A,title:A},Y(v));return S.addEventListener("click",P=>{P.stopPropagation(),T()}),S};function w(v,A={}){Object.assign(o,A),r=v.id;let T=(o.now??Date.now)(),S=v.root.replies.length,P=q=>m("span",{class:"who"},`${se(q)} \xB7 ${Ne(q.at,T)}`),C=q=>m("div",{class:q.deleted?"tx del":"tx"},...q.deleted?["Deleted"]:[...dt(q.text),q.edited?" (edited)":""]),z=v.resolved?"Resolved"+(S?` \xB7 ${In(S)}`:""):S?In(S):"",G=m("div",{class:o.variant==="column"&&z?"ft has-rest":"ft"},o.variant==="column"&&z?m("span",{class:"rest"},z):null,m("span",{class:"hover"},P(v.root),m("span",{class:"acts"},x("copy","Copy thread",()=>t.copy(v.id)),v.resolved?x("reopen","Reopen",()=>void t.reopen(v.id)):x("resolve","Resolve",()=>void t.resolve(v.id))))),K=o.lost?m("div",{class:"ctx"},`No longer on the page \u2014 it read \u201C${he(o.lost,120)}\u201D`):o.quote?m("div",{class:"ctx"},`\u201C${he(o.quote,80)}\u201D`):null;y=new Map;let ie=m("div",{class:"root"},...f(v.root),K,C(v.root),G);a.replaceWith(ie),a=ie,p?.remove(),p=S?m("div",{class:"rps"},...v.root.replies.map(q=>m("div",{class:"it"},...f(q),C(q),m("div",{class:"rft"},P(q))))):null,p&&s.prepend(p),d=y,v.resolved?i.remove():i.parentNode!==s&&s.append(i),l.className=v.resolved?"thread resolved":"thread",l.setAttribute("data-thread",v.id)}return w(e),{element:l,update:w}}var zo="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",Ko=400;function Ut(e,t){let n=new Map,o=m("div",{class:"tip",role:"tooltip"}),r=m("div",{class:"mark"}),i=m("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});o.inert=i.inert=!0,e.layer.append(r,o,i);let s=m("div",{class:"bub pin ghost","aria-hidden":"true"}),a=[],p=null,l=null,d=null,y=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,E=0,f=null,x=null,w=null,v=0,A=h=>a.find(L=>L.id===h)??null,T=()=>t.popovers||e.state.listing,S=!1,P=h=>{let L=e.resolved.get(h.id);return L?Xe(h.anchor,L):null};function C(h,L,M){let{left:H,top:R}=wt(L,{width:h.offsetWidth||M,height:h.offsetHeight},yt(e.state.listing));h.style.left=`${H}px`,h.style.top=`${R}px`}function z(h){let L=h&&T()&&e.state.active!==h?A(h):null,M=L?P(L):null;if(!L||!M){w=null,o.classList.remove("show"),J(o,!0);return}if(w!==L.id){let H=L.root.replies.length;o.replaceChildren(m("div",{class:"tx clamp"},...L.root.deleted?["Deleted"]:dt(L.root.text)),m("div",{class:"who"},`${se(L.root)}${H?` \xB7 ${H} ${H===1?"reply":"replies"}`:""}`)),w=L.id}C(o,M,260),o.classList.contains("show")||o.offsetWidth,o.classList.add("show"),o.inert=!1}function G(h){f=h,z(h),e.hot(h)}function K(h){if(window.clearTimeout(v),h!==null){G(h);return}v=window.setTimeout(()=>G(null),T()?Ko:0)}o.addEventListener("mouseenter",()=>window.clearTimeout(v)),o.addEventListener("mouseleave",()=>K(null)),o.addEventListener("click",h=>{h.stopPropagation();let L=w;L&&(window.clearTimeout(v),G(null),e.open(L))});function ie(h){let L=n.get(h.id);if(L)return L;let M=m("button",{class:"bub",type:"button","aria-label":`Comment: ${he(h.root.text,60)}`});return M.addEventListener("mouseenter",()=>K(h.id)),M.addEventListener("mouseleave",()=>K(null)),M.addEventListener("click",H=>{H.stopPropagation(),z(null),e.open(h.id)}),e.layer.insertBefore(M,r),n.set(h.id,M),M}function q(){let h=e.state.draft,L=d&&h&&!h.anchor.quote&&!h.anchor.point?h.resolved.element:null;if(L){let{left:H,top:R,above:F}=Rn(L.getBoundingClientRect(),{width:i.offsetWidth||ke,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),X=d?.above!==null&&d?.above!==F;if(d&&(d.above=F),X&&le())return;i.style.left=`${H}px`,i.style.top=`${R}px`;return}let M=d&&h?Xe(h.anchor,h.resolved):p?P(p):null;M&&C(i,M,ke)}let oe=h=>e.state.commenting&&!h.anchor.quote&&!h.anchor.point;function le(){return window.clearTimeout(E),y?(i.classList.remove("show"),E=window.setTimeout(()=>{q(),i.classList.add("show")},220),!0):(i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function j(h){if(window.clearTimeout(E),y){i.classList.remove("show"),E=window.setTimeout(()=>{d?.box.setLabel(h),q(),i.classList.add("show")},220);return}d?.box.setLabel(h),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)}function ee(){if(!T())return null;let h=e.state.draft;return h?h.anchor.quote||h.anchor.point||e.state.commenting?null:h.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function u(h){a=h;let L=new Set;for(let F of h){if(!e.visible(F)||F.anchor.quote)continue;let X=e.resolved.get(F.id);if(!X||X.state==="orphaned")continue;L.add(F.id);let Z=ie(F);Z.classList.toggle("done",F.resolved),Z.classList.toggle("on",e.state.active===F.id),Z.classList.toggle("pin",F.anchor.point!==void 0)}for(let[F,X]of n)L.has(F)||(X.classList.remove("in"),n.delete(F),window.setTimeout(()=>X.remove(),300));z(f),S!==e.state.listing&&i.classList.contains("show")&&!y&&(window.clearTimeout(E),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)),S=e.state.listing;let M=t.popovers?e.state.draft:null;if(M){d?.of!==M?(window.clearTimeout(E),i.classList.remove("glide"),d={box:gt(e,M),of:M,at:M.resolved.element,above:null},d.box.hideLabel(oe(M)),i.replaceChildren(d.box.element),i.inert=!1,d.box.focus(),p=null,l=null,q(),i.classList.add("show")):d&&(d.at!==M.resolved.element&&(d.at=M.resolved.element,d.above=null,j(M.label)),d.box.hideLabel(oe(M)));return}d&&(window.clearTimeout(E),i.classList.remove("glide"),d=null,e.registerDraft(null));let H=T()&&e.state.active?A(e.state.active):null;if(!H||!e.visible(H)){p=null,l=null,i.classList.remove("show"),J(i,!0);return}let R=H.anchor.quote?.exact??null;!p||!l||p.id!==H.id?(l=De(H,e.actions,{variant:"popover",quote:R}),i.replaceChildren(l.element),p=H,q(),i.classList.add("show"),i.inert=!1):p!==H&&(l.update(H,{quote:R}),p=H)}function N(){for(let[H,R]of n){let F=A(H),X=e.resolved.get(H),Z=F&&X?vt(F.anchor,X):null;if(!Z||Z.y<-40||Z.y>window.innerHeight+40){R.style.visibility="hidden";continue}R.style.visibility="",R.style.left=`${Z.x}px`,R.style.top=`${Z.y}px`,R.classList.contains("in")||(R.offsetWidth,R.classList.add("in"))}let h=e.state.draft,L=h?.anchor.point?vt(h.anchor,h.resolved):null;L?(s.style.left=`${L.x}px`,s.style.top=`${L.y}px`,s.classList.contains("in")||(e.layer.insertBefore(s,r),s.offsetWidth,s.classList.add("in"))):s.classList.contains("in")&&(s.classList.remove("in"),window.setTimeout(()=>s.classList.contains("in")||s.remove(),300)),i.classList.contains("show")&&q();let M=ee();r.classList.toggle("show",M!==null),M&&$e(r,M.getBoundingClientRect(),4)}let B=h=>{if(e.owns(h)){let M=h.composedPath()[0];x!==null&&!(M instanceof Element&&M.closest(".tip,.bub"))&&K(null),x=null;return}let L=e.readsAt(h.clientX,h.clientY)?.id??null;L!==x&&(x=L,K(L))},U=h=>{if(e.owns(h))return;let L=window.getSelection();if(L&&!L.isCollapsed||(e.state.commenting?h.altKey:h.target instanceof Element&&h.target.closest(zo)))return;let M=e.readsAt(h.clientX,h.clientY);M&&(e.claim(h),z(null),e.open(M.id))};return window.addEventListener("pointermove",B,{capture:!0,passive:!0}),window.addEventListener("click",U,!0),{render:u,frame:N,destroy(){window.clearTimeout(v),window.clearTimeout(E),window.removeEventListener("pointermove",B,!0),window.removeEventListener("click",U,!0),e.registerDraft(null);for(let h of n.values())h.remove();s.remove(),o.remove(),r.remove(),i.remove()}}}var Wo="button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,table,th,td,li,p,h1,h2,h3,h4,h5,h6,blockquote,pre";var Nn=(e,t)=>Math.abs(e.left-t.left)<=2&&Math.abs(e.top-t.top)<=2&&Math.abs(e.width-t.width)<=2&&Math.abs(e.height-t.height)<=2;function Qe(e,t,n){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let o=n.viewport(),r=.6*o.width*o.height,i=null;for(let a=e;a&&a!==t;a=a.parentElement){let p=n.box(a);if(!(p.width<2||p.height<2)){if(a.hasAttribute("data-pipeup-id")){i=a;break}if(!(p.width*p.height>r)&&(a.matches(Wo)||n.drawn(a))){i=a;break}}}if(!i||i.hasAttribute("data-pipeup-id"))return i;let s=n.box(i);for(let a=i.parentElement;a&&a!==t&&Nn(n.box(a),s);a=a.parentElement)if(a.hasAttribute("data-pipeup-id"))return a;return i}function zt(e,t,n){let o=n.box(e);for(let r=e.parentElement;r&&r!==t;){let i=Qe(r,t,n);if(!i)return null;if(!Nn(n.box(i),o))return i;r=i.parentElement}return null}function $n(e=window){return{box:t=>t.getBoundingClientRect(),drawn:t=>{let n=e.getComputedStyle(t),o=n.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(n.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(n.getPropertyValue(`border-${i}-width`))>0);return o||r||n.backgroundImage!=="none"||n.boxShadow!=="none"},viewport:()=>({width:e.innerWidth,height:e.innerHeight})}}var Hn="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]",Yo=`${Hn},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,Dn=["click","dblclick","auxclick","submit","contextmenu","dragstart"],Bn=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],jo=400;function Fn(e,t=$n()){let n=m("div",{class:"pick"});e.layer.append(n);let o=m("span",{class:"lbl"}),r=m("button",{class:"nb",type:"button","aria-label":"Select the block around it",title:"Select the block around it"},Y("expand",16)),i=m("div",{class:"namebar",role:"toolbar","aria-label":"Chosen block"},o,r);i.inert=!0,e.layer.append(i),i.addEventListener("mousedown",u=>u.preventDefault()),r.addEventListener("click",u=>{u.stopPropagation();let N=p&&zt(p,e.root,t);N&&K(N)});let s=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,a=null,p=null,l=null,d=null,y=0,E=()=>{},f=null,x=()=>{},w=u=>!e.owns(u)&&!(u.target instanceof Element&&u.target.closest("[data-pipeup-ignore]"));function v(){d&&(n.classList.toggle("glide",performance.now()<y),$e(n,d.getBoundingClientRect(),4))}function A(){if(!f)return;i.classList.toggle("glide",performance.now()<y&&i.classList.contains("show"));let u=f.getBoundingClientRect(),{left:N,top:B}=bt({left:u.left,top:u.top,width:u.width,height:u.height},{width:i.offsetWidth||200,height:i.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});i.style.left=`${N}px`,i.style.top=`${B}px`}function T(u,N){d=u,y=N?performance.now()+jo:0,v(),n.classList.add("show")}function S(u,N){let B=getComputedStyle(u);if(B.opacity==="0")return N(),()=>{};let U=0,h=()=>{window.clearTimeout(U),u.removeEventListener("transitionend",M)},L=()=>{h(),N()},M=R=>{R.target===u&&R.propertyName==="opacity"&&L()},H=Math.max(...B.transitionDuration.split(",").map(R=>parseFloat(R)*1e3||0));return U=window.setTimeout(L,H+100),u.addEventListener("transitionend",M),h}function P(u){if(u!==a){if(a=u,E(),!u){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?T(u,!1):s?(n.classList.remove("show"),E=S(n,()=>T(u,!1))):T(u,!0)}}function C(u){p=u,n.classList.toggle("on",u!==null),P(u),x(),i.inert=!u,u?s?(i.classList.remove("show"),x=S(i,()=>z(u))):z(u):(i.classList.remove("show"),f=null)}function z(u){o.textContent=o.title=Re(u);let N=zt(u,e.root,t)===null;r.hidden=N;let B=i.classList.contains("show");f=u,A(),B||(i.offsetWidth,i.classList.add("show"))}function G(u){let N;try{N=lt(u,e.root)}catch(h){e.report(h);return}let B={anchor:N,label:Re(u),ranges:[],resolved:{state:"attached",element:u,range:null}},U=e.state.draft;C(u),l=U??{...B,ranges:[]},U?e.moveDraft({...B,ranges:[]}):e.startDraft(l)}function K(u){e.keepCaret(()=>G(u))}function ie(u){let N=(u.target instanceof Element?Qe(u.target,e.root,t):null)??e.root,B=N.getBoundingClientRect();if(!B.width||!B.height)return;let U={x:(u.clientX-B.left)/B.width,y:(u.clientY-B.top)/B.height},h;try{h=lt(N,e.root,U)}catch(M){e.report(M);return}let L=Re(N).replace(/^[A-Z](?=[a-z])/,M=>M.toLowerCase());C(null),P(null),e.startDraft({anchor:h,label:`Pin on ${L}`,ranges:[],resolved:{state:"attached",element:N,range:null}})}function q(u){let N=window.getSelection();if(N&&!N.isCollapsed)return;if(e.state.draft&&(u.altKey||!e.draftEmpty())){e.dismiss();return}if(!u.altKey&&e.readsAt(u.clientX,u.clientY))return;if(e.state.active&&e.open(null),u.altKey){ie(u);return}let B=u.target instanceof Element?Qe(u.target,e.root,t):null;B?G(B):(e.dismiss(),C(null))}let oe=u=>{if(!e.owns(u)){if(!w(u)){p||P(null);return}u.stopPropagation(),!(p||e.state.draft)&&P(u.target instanceof Element?Qe(u.target,e.root,t):null)}},le=u=>{w(u)&&(u.stopPropagation(),(u.type==="pointerdown"||u.type==="mousedown")&&u.target instanceof Element&&u.target.closest(Yo)&&u.preventDefault())},j=u=>{w(u)&&(u.preventDefault(),u.stopPropagation(),u.type==="click"&&q(u))},ee=u=>{(u.key==="Enter"||u.key===" ")&&w(u)&&u.target instanceof Element&&u.target.closest(Hn)&&(u.preventDefault(),u.stopPropagation())};window.addEventListener("pointermove",oe,!0);for(let u of Bn)window.addEventListener(u,le,!0);for(let u of Dn)window.addEventListener(u,j,!0);return window.addEventListener("keydown",ee,!0),{back(){return p?(C(null),!0):!1},render(){let u=e.state.draft;l&&u!==l?(l=null,C(null)):u&&!l&&(a||p)&&C(null)},frame(){v(),A()},destroy(){E(),x(),window.removeEventListener("pointermove",oe,!0);for(let u of Bn)window.removeEventListener(u,le,!0);for(let u of Dn)window.removeEventListener(u,j,!0);window.removeEventListener("keydown",ee,!0),n.classList.remove("show"),i.classList.remove("show"),J(i,!0),S(n,()=>n.remove()),S(i,()=>i.remove())}}}var Go=300,Xo=32,Kt=220,Je=320,Zo=24,_n=24;function Wt(e,t=!1){let n=e.ownerDocument.documentElement,o=n.getAttribute("data-pipeup-layout");if(o==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(o==="column"?e:null);if(!r)return null;if(n.hasAttribute("data-pipeup-reserve")){let a=n.clientWidth,l=getComputedStyle(r).maxWidth,d;return l.endsWith("px")?d=parseFloat(l):l.endsWith("%")?d=parseFloat(l)/100*a:d=r.getBoundingClientRect().width,o!=="column"&&a<d+Je-(t?Zo:0)?null:{x:a-Je+_n,width:Je-2*_n}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<Go&&o!=="column")return null;let s=i+Xo;return{x:s,width:Math.max(220,Math.min(300,window.innerWidth-s-16))}}function Yt(e,t){let n=e.resolved.get(t.id);return!n||n.state==="orphaned"&&!e.pending.has(t.id)}function qn(e){let t=m("div",{class:"col"});e.layer.append(t);let n=new Map,o=null,r=new ResizeObserver(()=>a()),i=f=>Yt(e,f);function s(f){let x=e.resolved.get(f.id),w=x?Vt(f.anchor,x):null;return w===null?Number.POSITIVE_INFINITY:w+window.scrollY-4}function a(){let f=[],x=[];for(let[S,P]of n){let C=s(P.thread);if(Number.isFinite(C))P.placed=C;else if(e.pending.has(S)){if(P.placed===null){P.el.classList.add("wait");continue}C=P.placed}Number.isFinite(C)?f.push({id:S,want:C,height:P.el.offsetHeight}):x.push({id:S,height:P.el.offsetHeight})}let w=e.state.draft,v=w?Vt(w.anchor,w.resolved):null;o&&v!==null&&f.push({id:"draft",want:v+window.scrollY-4,height:o.el.offsetHeight});let A=On(f,o?"draft":e.state.active),T=Math.max(0,...f.map(S=>(A.get(S.id)??0)+S.height))+24;for(let S of x)A.set(S.id,T),T+=S.height+10;for(let[S,P]of n){if(P.el.classList.contains("wait")){if(!A.has(S))continue;P.el.style.transition="none",P.el.style.transform=`translateY(${Math.round(A.get(S))}px)`,P.el.offsetWidth,P.el.style.transition="",P.el.classList.remove("wait");continue}P.el.style.transform=`translateY(${Math.round(A.get(S)??0)}px)`}o&&(o.el.style.transform=`translateY(${Math.round(A.get("draft")??0)}px)`)}function p(f,x){f.thread=x,f.lost=i(x),f.view.update(x,{lost:f.lost?x.anchor.snapshot:null})}function l(f){let x=i(f),w=De(f,e.actions,{variant:"column",lost:x?f.anchor.snapshot:null}),v=m("div",{class:"th","data-thread":f.id},w.element);return v.style.transition="none",v.addEventListener("mouseenter",()=>e.hot(f.id)),v.addEventListener("mouseleave",()=>e.hot(null)),v.addEventListener("click",()=>e.open(f.id)),t.append(v),r.observe(v),{el:v,thread:f,lost:x,placed:null,view:w}}function d(){let f=e.state.draft;if(o&&f&&o.of!==f){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Kt),o=null}if(f&&o&&(o.box.setLabel(f.label),o.box.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point)),f&&!o){let x=gt(e,f),w=m("div",{class:"th on"},x.element);w.style.transition="none",t.append(w),r.observe(w),o={el:w,box:x,of:f},x.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point),x.focus()}else if(!f&&o){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Kt),o=null,e.registerDraft(null)}}function y(f){J(t,e.state.listing);let x=new Set,w=[],v=e.state.active!==null||e.state.draft!==null;for(let A of f){if(!e.visible(A))continue;x.add(A.id);let T=n.get(A.id);T?(T.thread!==A||T.lost!==i(A))&&p(T,A):(T=l(A),n.set(A.id,T),w.push(T.el));let S=T.el;S.classList.toggle("on",e.state.active===A.id);let P=S.querySelector(".more");P&&J(P,e.state.active!==A.id),S.classList.toggle("dim",v&&e.state.active!==A.id),S.classList.toggle("hot",e.state.hot===A.id&&e.state.active!==A.id),S.classList.toggle("resolved",A.resolved),S.classList.toggle("lost",T.lost)}for(let[A,T]of n)x.has(A)||(n.delete(A),r.unobserve(T.el),T.el.classList.add("out"),window.setTimeout(()=>T.el.remove(),Kt));d(),a(),o&&w.push(o.el);for(let A of w)A.offsetWidth,A.style.transition=""}function E(){let f=Wt(e.root,!0);f&&(t.style.width=`${f.width}px`,t.style.transform=`translate(${f.x}px, ${-window.scrollY}px)`)}return{render:y,frame:E,destroy(){r.disconnect(),e.registerDraft(null),t.remove()}}}var Qo="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function Vn(e){let t=m("button",{type:"button","aria-label":"Comment",title:"Comment"},Y("comment",17)),n=m("div",{class:"selbar"},t);n.inert=!0,e.layer.append(n);let o=null,r=d=>{let y=d&&(d.nodeType===Node.ELEMENT_NODE?d:d.parentElement);return!!y&&e.root.contains(y)&&!y.closest(Qo)};function i(){if(!o)return;let d=o.getBoundingClientRect(),{left:y,top:E}=bt({left:d.left,top:d.top,width:d.width,height:d.height},{width:n.offsetWidth||36,height:n.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});n.style.left=`${y}px`,n.style.top=`${E}px`}function s(){o=null,n.inert=!0,n.classList.remove("show")}function a(){let d=window.getSelection();if(!e.state.commenting||!d||d.isCollapsed||d.rangeCount===0||!d.toString().trim()||!r(d.anchorNode)||!r(d.focusNode)){s();return}o=d.getRangeAt(0).cloneRange(),i(),n.inert=!1,n.classList.add("show")}t.addEventListener("mousedown",d=>d.preventDefault()),t.addEventListener("click",d=>{d.stopPropagation();let y=o;if(!y)return;let E;try{E=Rt(y,e.root)}catch(x){e.report(x),s();return}let f=he(y.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),s(),e.startDraft({anchor:E,label:`\u201C${f}\u201D`,ranges:[y],resolved:{state:"attached",element:null,range:y}})});let p=()=>{if(!o)return;let d=window.getSelection();(!d||d.isCollapsed||!d.toString().trim())&&s()};document.addEventListener("selectionchange",p);let l=d=>{e.owns(d)||window.setTimeout(a,0)};return window.addEventListener("mouseup",l,!0),window.addEventListener("keyup",l,!0),{render(){!e.state.commenting&&o&&s()},frame(){o&&i()},destroy(){window.removeEventListener("mouseup",l,!0),window.removeEventListener("keyup",l,!0),document.removeEventListener("selectionchange",p),n.remove()}}}async function jt(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(n),n.select();let o=document.execCommand("copy");if(n.remove(),!o)throw new Error("pipeup: your browser blocked copying")}function Un(e){let t=[m("span",{class:"n"}),m("span",{class:"n"})],n=Y("comment",20,1.4);n.lastElementChild.setAttribute("stroke-width","1.6");let o=m("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":_t,"aria-haspopup":"menu","aria-expanded":"false"},m("span",{class:"plus"},n),m("span",{class:"cnt"},Y("bubble",34,1.4),...t)),r=m("span",{class:"ttip","aria-hidden":"true"},"Comment",m("small",{},Ye)),i=m("div",{class:"launch"},o,r),s=m("div",{class:"menu",role:"menu","aria-label":"Comments"}),a=m("div",{class:"list",role:"menu","aria-label":"All comments"}),p=m("span",{class:"pn"}),l=m("button",{class:"ib",type:"button","aria-label":"Close"},Y("close")),d=m("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",m("span",{class:"sw","aria-hidden":"true"}));d.addEventListener("click",g=>{g.stopPropagation(),e.menu.toggleResolved()});let y=m("div",{class:"all",role:"dialog","aria-label":"All comments"},m("div",{class:"hd"},m("span",{},"All comments"),p,d,l),a),E=m("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});s.inert=y.inert=E.inert=!0,e.layer.append(s,i,y);let f=!1,x=!1,w=[],v=!1,A=0,T=null,S=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,P=g=>{f=g,g||x&&(x=!1,Me()),s.classList.toggle("show",g),J(s,!g),o.setAttribute("aria-expanded",String(g))},C=(g,k=!1)=>{e.state.listing!==g&&(e.state.listing=g,e.render(),g?(z(a)[0]??l).focus({preventScroll:!0}):k&&o.focus({preventScroll:!0}))},z=(g=s)=>[...g.querySelectorAll(".mi")],G=()=>s.getRootNode().activeElement,K=()=>{P(!1),o.focus({preventScroll:!0})},ie=()=>{x=!1,Me(),F.focus({preventScroll:!0})},q=g=>{let k=z(g.currentTarget);if(k.length===0)return;let $=G(),I=k.indexOf($),_=te=>{g.preventDefault(),k[(te+k.length)%k.length]?.focus({preventScroll:!0})};g.key==="ArrowDown"?_(I+1):g.key==="ArrowUp"?_(I<0?k.length-1:I-1):g.key==="Home"?_(0):g.key==="End"&&_(k.length-1)};s.addEventListener("keydown",q),a.addEventListener("keydown",q),l.addEventListener("click",g=>{g.stopPropagation(),C(!1,!0)});let oe=g=>Yt(e,g),le=()=>w.filter(g=>!g.resolved).length;function j(){let g=z(a).indexOf(G()),k=e.menu.all().filter(re=>!re.thread.resolved||e.state.showResolved),$=re=>{let ae=re.thread,_e=Ee(ae.root.author,ae.root.name);_e.classList.add("in");let Oe=m("button",{class:ae.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":ae.id},_e,m("span",{},m("span",{class:"clamp"},ae.root.deleted?"Deleted":ae.root.text),m("small",{},oe(ae)?`\u201C${he(ae.anchor.snapshot,80)}\u201D`:re.location.where)));return Oe.addEventListener("click",tt=>{tt.stopPropagation(),ee(ae.id,Oe.getBoundingClientRect().top)}),Oe},I=k.filter(re=>oe(re.thread)),_="No longer on the page";p.textContent=String(le()),d.setAttribute("aria-checked",String(e.state.showResolved)),a.replaceChildren(k.length?"":m("div",{class:"sec",role:"presentation"},"No open comments"),...k.filter(re=>!oe(re.thread)).map($),I.length?m("div",{role:"group","aria-label":_},m("div",{class:"sec","aria-hidden":"true"},_),...I.map($)):"");let te=z(a);g>=0&&te[Math.min(g,te.length-1)]?.focus({preventScroll:!0})}function ee(g,k){Te()&&(e.state.reading=!0,C(!1)),u(g,k)}function u(g,k){let $=w.find(te=>te.id===g),I=e.resolved.get(g);if(!$)return;let _=I&&!oe($)?I.element??I.range?.startContainer.parentElement??null:null;if(_?.scrollIntoView({block:"center",inline:"nearest",behavior:S?"auto":"smooth"}),_&&I&&Xe($.anchor,I)&&_.checkVisibility?.({visibilityProperty:!0})!==!1){B(),e.open(g);return}e.open(null),Te()&&(e.state.reading=!0,e.render()),N($,k)}function N(g,k){let $={quote:g.anchor.quote?.exact??null,lost:oe(g)?g.anchor.snapshot:null};if(T?.id===g.id?T.view.update(g,$):(T={id:g.id,view:De(g,e.actions,{variant:"popover",...$})},E.replaceChildren(T.view.element)),k===void 0)return;E.isConnected||(e.layer.insertBefore(E,y),E.offsetWidth);let I=yt(e.state.listing),{left:_,top:te}=wt({x:I.width,y:k,below:!1},{width:ke,height:E.offsetHeight},I);E.style.left=`${_}px`,E.style.top=`${te}px`,E.classList.add("show"),E.inert=!1,e.focusReply(g.id)}function B(g=!1){T&&(T=null,E.classList.remove("show"),J(E,!0),g&&e.state.reading&&(e.state.reading=!1,e.render()))}function U(g,k,$,I=!1,..._){let te=m("button",{class:"mi",type:"button",role:I?"menuitemcheckbox":"menuitem"},g,m("span",{class:"lb"},k),..._,I&&m("span",{class:"sw","aria-hidden":"true"}),m("span",{class:"tt","aria-hidden":"true"}));return te.addEventListener("click",re=>{re.stopPropagation(),$()}),te}let h=(g,k,$,I)=>{let _=g.querySelector(".lb");_.textContent!==k&&(_.textContent=k),g.querySelector(".tt").textContent=$,g.setAttribute("aria-description",$),I!==void 0&&g.setAttribute("aria-checked",String(I))},L=()=>m("div",{class:"sep",role:"separator"}),M=m("span",{class:"ma"}),H=m("span",{class:"kc"}),R="",F=U(M,"",()=>{x=!0,Me()},!1,H);F.dataset.item="name";let X=U(Y("copy"),"Copy all",()=>{K(),e.menu.copyAll("ai")}),Z=U(Y("lines"),"Copy all as text",()=>{K(),e.menu.copyAll("text")}),Be=m("span",{class:"kc"}),Le=U(Y("list"),"All comments",()=>{P(!1),C(!0)},!1,Be),ce=U(Y("comment"),"Start commenting",()=>{K(),e.setCommenting(!e.state.commenting)},!0,m("span",{class:"kc","aria-hidden":"true"},Ye));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",_t);let Et=[F,L(),X,Z,Le,L(),ce];function He(){let g=le(),k=e.menu.name(),$=k||fe(e.doc.me);if(h(F,$,k?"The name on your comments":"Add a name to show on your comments"),F.setAttribute("aria-label",`${$}, ${k?"edit":"add"} your name`),H.replaceChildren(k?Y("edit",13):"Add name"),je(e.doc.me,k)!==R){R=je(e.doc.me,k);let I=Ee(e.doc.me,k);I.classList.add("in"),M.replaceChildren(I)}h(X,"Copy all","Markdown, with where each thread is"),h(Z,"Copy all as text","Just the words"),h(Le,"All comments","Every thread, and where it is"),Be.textContent=g?String(g):"",h(ce,"Start commenting",e.state.commenting?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.commenting)}function Me(){if(x){let g=m("textarea",{class:"input",rows:"1","aria-label":"Your name"});g.value=e.menu.name(),g.addEventListener("keydown",k=>{if(k.stopPropagation(),k.key==="Enter"){k.preventDefault();let $=g.value.trim();$&&e.menu.rename($).then(ie)}else k.key==="Escape"&&ie()}),s.replaceChildren(m("label",{class:"name"},"Your name",g)),g.focus({preventScroll:!0});return}He(),s.firstChild!==F&&s.replaceChildren(...Et)}o.addEventListener("click",g=>{if(g.stopPropagation(),f){P(!1);return}Me(),P(!0),g.detail===0&&z().at(-1)?.focus({preventScroll:!0})});let Ce=!1,Pe=()=>{Ce=y.contains(G())},Fe=g=>{let k=g.composedPath();f&&!k.includes(s)&&!k.includes(o)&&P(!1),e.state.listing&&!e.owns(g)&&C(!1,Ce&&(!document.activeElement||document.activeElement===document.body)),!k.includes(E)&&!k.includes(y)&&B(!0)};window.addEventListener("pointerdown",Pe,!0),window.addEventListener("click",Fe,!0);let et=g=>{if(g.key!=="Escape"||x)return;let k=g.composedPath()[0];if(f)K();else if(e.state.listing&&!(k instanceof HTMLTextAreaElement&&!y.contains(k)))C(!1,!0);else if(T)B(!0),e.actions.close();else return;g.stopPropagation()};return window.addEventListener("keydown",et,!0),{render(g){w=g;let k=le();if(k!==A){if(k){let[I,_]=t[0].classList.contains("on")?t:[t[1],t[0]];_.textContent=k>99?"99+":String(k),_.classList.toggle("s",k>99),I.classList.remove("on"),_.classList.add("on")}o.classList.toggle("has",k>0),o.setAttribute("aria-label",k?`Comment, ${k} open`:"Comment"),A=k}e.state.commenting&&!v&&f&&K(),v=e.state.commenting,o.classList.toggle("on",v),f&&!x&&He();let $=e.state.listing;if(y.classList.toggle("full",Te()),y.classList.contains("show")!==$&&(y.classList.toggle("show",$),J(y,!$)),$&&j(),T){let I=g.find(_=>_.id===T?.id);!I||e.state.active||I.resolved&&!e.state.showResolved?B():N(I)}},frame(){},destroy(){window.removeEventListener("pointerdown",Pe,!0),window.removeEventListener("click",Fe,!0),window.removeEventListener("keydown",et,!0),s.remove(),y.remove(),E.remove(),i.remove()}}}var Kn=["pipeup-quote","pipeup-on","pipeup-done"],Jo={"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]]},er=(e,t)=>Kn.map(n=>{let[o,r,i,s]=Jo[n][e?1:0];return`::highlight(${n}){background-color:rgba(${o},${r},${i},${+(s*t).toFixed(3)})}`}).join("");function Wn(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var tr="<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>",nr=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(tr)}") 3 2,crosshair!important}`;function Yn(e=document,t=!1){let n=e.defaultView?.CSSStyleSheet;if(!n||!("replaceSync"in n.prototype)||!("adoptedStyleSheets"in e))return{gutter(){},picking(){},fade(){},room(){},remove:()=>zn()};let o=new n,r=null,i=!1,s=1,a=0,p="",l=0,d=()=>o.replaceSync(er(t,s)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?nr:"")+(a||p?`html{${a?`margin-right:${a}px!important;`:""}${p}}`:""));return d(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,o],{gutter(y){y!==r&&(r=y,d())},picking(y){y!==i&&(i=y,d())},fade(y){s=y,d()},room(y,E){y!==a&&(a=y,p=E?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(l),!y&&p&&(l=window.setTimeout(()=>{p="",d()},400)),d())},remove(){clearTimeout(l),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(y=>y!==o),zn()}}}function jn(e){Wn()&&(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 zn(){if(Wn())for(let e of Kn)CSS.highlights.delete(e)}var Gt=':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(--pu-ink);--pu-ink:#2C2C2A;--pu-muted:#5F5E5A;--pu-faint:#888780;--pu-line:#E5E3DA;--pu-rule:#ECEAE2;--pu-soft:#FAFAF7;--pu-surface:#FFFFFF;--pu-hover:#F1EFE8;--pu-accent-soft:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--pu-shadow:0 8px 28px rgba(44,44,42,.1);--pu-enter:.26s;--pu-move:.34s;--pu-exit:.2s;--pu-pulse:1.2s;--pu-eo:cubic-bezier(.22,.61,.36,1);--pu-eio:cubic-bezier(.4,0,.2,1);--pu-ei:cubic-bezier(.4,0,1,1)}.layer.dark{--pu-ink:#ECEBE6;--pu-muted:#B4B2A9;--pu-faint:#8D8B84;--pu-line:#3A3936;--pu-rule:#34332F;--pu-soft:#22221F;--pu-surface:#1B1B19;--pu-hover:#2C2C29;--pu-shadow: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(--pu-ink);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--pu-faint)}.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(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.ft .rest{transition:opacity var(--pu-enter) var(--pu-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(--pu-muted);transition:background-color .2s var(--pu-eo),color .2s var(--pu-eo)}.ib:hover,.ib:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--pu-move) var(--pu-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(--pu-line);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--pu-ink);background:transparent;transition:border-color var(--pu-enter) var(--pu-eo)}.row:hover .input,.input:hover{border-bottom-color:var(--pu-muted)}.input:focus{border-bottom-color:var(--pu-accent)}.name{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--pu-faint);padding-top:6px}.name .input{font-size:13px;height:24px}.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(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-faint)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-muted);text-decoration:underline;text-decoration-color:var(--pu-line);text-underline-offset:2px;transition:color .2s var(--pu-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(--pu-enter) var(--pu-eo),background-color .2s var(--pu-eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--pu-accent-soft)}.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(--pu-surface);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--pu-faint)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo)}.pop.show.glide{transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--pu-accent-soft);border-radius:8px;opacity:0;transition:opacity .3s var(--pu-eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--pu-accent-soft);animation:pu-pulse var(--pu-pulse) var(--pu-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(--pu-enter) var(--pu-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(--pu-move) var(--pu-eio),box-shadow var(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-eo)}.th.hot{box-shadow:inset 2px 0 0 var(--pu-line)}.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(--pu-exit) var(--pu-ei)}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-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(--pu-eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--pu-accent-soft);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(--pu-exit) var(--pu-ei),border-color var(--pu-exit) var(--pu-ei)}.pick.show{opacity:1;transition-duration:var(--pu-enter);transition-timing-function:var(--pu-eo)}.pick.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-eio)}.pick.on{border-color:var(--pu-accent)}.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(--pu-muted);white-space:nowrap;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-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(--pu-eo),color .2s var(--pu-eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);transition:background-color .3s var(--pu-eo),color .3s var(--pu-eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--pu-hover)}.launch .mode.on{background:var(--pu-accent);color:#fff}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--pu-faint)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--pu-exit) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-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(--pu-eo)}.mi:hover,.mi:focus-visible{background:var(--pu-soft);outline:none}.mi svg{color:var(--pu-muted);flex:none}.mi small{display:block;color:var(--pu-faint);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(--pu-rule)}.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(--pu-muted);background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-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(--pu-line);transition:background-color var(--pu-move) var(--pu-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(--pu-move) var(--pu-eio),opacity var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),opacity var(--pu-exit) var(--pu-ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--pu-move) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-faint)}.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(--pu-muted);transition:background-color .2s var(--pu-eo)}.hs:hover,.hs:focus-visible{background:var(--pu-hover);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(--pu-exit) var(--pu-ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--pu-faint)}.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(--pu-eo),transform .36s var(--pu-eo)}.toast.show{opacity:1;transform:translate(-50%)}@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 Gn="#534AB7",or="rgb(0, 0, 238)";function Xn(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 n=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:n}}function rr(e){let t=n=>{let o=n/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Zn(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{font:"system-ui, sans-serif",accent:Gn,dark:!1};let o=t.documentElement,r=n.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(n.getComputedStyle(o).getPropertyValue("--pipeup-accent")||o.style.getPropertyValue("--pipeup-accent")).trim(),s=e.querySelector("a[href]"),a=s?n.getComputedStyle(s).color:"",p=i||(a&&a!==or?a:Gn),l=Xn(n.getComputedStyle(t.body).backgroundColor);(!l||l.a===0)&&(l=Xn(n.getComputedStyle(o).backgroundColor));let d=l&&l.a>0?rr(l)<.2:n.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(n.getComputedStyle(o).colorScheme||"");return{font:r,accent:p,dark:!!d}}function Qn(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function Jn(e,t=document){let n=t.createElement("pipeup-root");n.setAttribute("data-pipeup-ignore",""),n.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 o=n.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in o){let s=new r;s.replaceSync(Gt),o.adoptedStyleSheets=[s]}else{let s=t.createElement("style");s.textContent=Gt,o.append(s)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${Ze}px`),i.style.setProperty("--pu-pop",`${ke}px`),Qn(i,e),o.append(i),t.documentElement.append(n),{element:n,shadow:o,layer:i,destroy:()=>n.remove()}}var ir=40,ar=250,sr=120,lr=2400,eo=4e3;function to(e,t=!1){return Wt(e,t)?"column":"bubbles"}function cr(e){return[...e.state.mode==="column"?[qn(e),Ut(e,{popovers:!1})]:[Ut(e,{popovers:!0})],Vn(e),Un(e)]}var pr=1e3,xt="Shown here, but not saved yet \u2014 it will be saved with your next change",Se=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function no(e){let t=Zn(e.root),n=Jn(t),o=Yn(document,t.dark);o.fade(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),s=new Map,a=new Set,p=new WeakSet,l={active:null,hot:null,showResolved:!1,hidden:!0,mode:to(e.root),draft:null,commenting:!1,listing:!1,reading:!1},d=m("div",{class:"toast",role:"status","aria-live":"polite"});n.layer.append(d);let y=null,E=[],f=null,x=!1,w=0,v=0,A=0,T=0,S=0,P=!1;function C(c,b=lr){x||(P=b===eo,d.textContent=c,d.classList.add("show"),window.clearTimeout(w),w=window.setTimeout(()=>d.classList.remove("show"),b))}function z(){P&&(P=!1,window.clearTimeout(w),d.classList.remove("show"))}function G(c){C(Se(c))}function K(c){throw G(c),c}let ie=c=>({thread:c,location:Nt(c.anchor,s.get(c.id)??ct(c.anchor,e.root),e.root)}),q={reply:async(c,b)=>{try{await e.doc.reply(c,b)}catch(O){O instanceof de?C(xt):K(O)}},resolve:async c=>{try{await e.doc.resolve(c),l.active===c&&!l.showResolved&&(l.active=null),C("Resolved \xB7 Show resolved brings it back")}catch(b){b instanceof de?(l.active===c&&!l.showResolved&&(l.active=null),C(`Resolved \xB7 ${xt}`)):C(Se(b))}},reopen:async c=>{try{await e.doc.reopen(c),C("Reopened")}catch(b){C(b instanceof de?`Reopened \xB7 ${xt}`:Se(b))}},close:()=>{ce(null),F&&X(F)?.focus({preventScroll:!0}),F=""},copy:c=>{try{let b=e.doc.threads().find(D=>D.id===c);if(!b)return;let O=Ht(ie(b),"ai",location.href,Date.now());jt(O,n.layer).then(()=>C("Thread copied as Markdown for AI"),D=>C(Se(D)))}catch(b){C(Se(b))}}};function oe(c){let b=O=>s.get(O.id)?.element??null;return[...c].sort((O,D)=>{let V=b(O),ne=b(D);return!V||!ne?V?-1:ne?1:0:V===ne?0:V.compareDocumentPosition(ne)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1})}let le={copyAll:async c=>{let b=le.all(),O=Ft(b,c,{title:document.title,url:location.href,exportedAt:new Date});try{await jt(O,n.layer);let D=b.filter(V=>!V.thread.resolved).length;C(`Copied ${D} thread${D===1?"":"s"}${c==="ai"?" as Markdown for AI":""}`)}catch(D){C(Se(D))}},toggleResolved:()=>{l.showResolved=!l.showResolved,R()},rename:async c=>{let b=c.replace(/\s+/g," ").trim();try{await et(b)?C(`New comments will say ${b}, but this browser couldn't remember it`):C(`New comments will say ${b}`)}catch(O){C(Se(O))}},name:()=>e.doc.name,all:()=>oe(e.doc.threads()).map(ie)},j={doc:e.doc,root:e.root,layer:n.layer,host:n.element,state:l,resolved:s,pending:a,actions:q,menu:le,visible:c=>!l.hidden&&(!c.resolved||l.showResolved),quoteAt:(c,b)=>{for(let O of e.doc.threads()){let D=s.get(O.id);if(O.anchor.quote&&j.visible(O)&&D?.range&&Pn(c,b,Ge(D)))return O}return null},readsAt:(c,b)=>j.draftEmpty()?j.quoteAt(c,b):null,owns:c=>c.composedPath().includes(n.element),claim:c=>void p.add(c),open:ce,focusReply:c=>Le(c),hot:Et,startDraft:He,moveDraft:Me,draftEmpty:()=>!y||y.isEmpty(),keepCaret:c=>{let b=y?.caret();c(),b?.()},postDraft:g,cancelDraft:Ce,setCommenting:Pe,dismiss:Fe,registerDraft:c=>{y=c},toast:C,report:G,pulse:k,render:R};function ee(c){let b=performance.now(),O=e.doc.threads();for(let D of O){if(c&&!c.has(D.id))continue;let V=performance.now()-b<ir,ne=ct(D.anchor,e.root,{fuzzy:V});s.set(D.id,ne),!V&&ne.state==="orphaned"?a.add(D.id):a.delete(D.id)}for(let D of[...s.keys()])O.some(V=>V.id===D)||s.delete(D);a.size===0?(window.clearTimeout(T),T=0):T===0&&(T=window.setTimeout(()=>{T=0,!x&&(ee(new Set(a)),R())},ar))}function u(c){let b=[],O=[],D=[];for(let V of c){let ne=s.get(V.id);V.resolved&&!l.showResolved||!ne?.range||(V.id===l.active||V.id===l.hot?O.push(ne.range):V.resolved?D.push(ne.range):b.push(ne.range))}l.draft&&O.push(...l.draft.ranges),jn({quote:b,on:O,done:D})}let N=0,B=0,U=0;function h(c){if(c===B)return;B=c,cancelAnimationFrame(U);let b=N,O=performance.now(),D=c?260:200,V=ne=>{let nt=Math.min(1,(ne-O)/D);N=b+(c-b)*(c?1-(1-nt)**3:nt*nt),o.fade(N),nt<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let L=0,M=0;function H(c){c!==L&&(L=c,o.room(c,r),window.clearTimeout(M),M=window.setTimeout(()=>{ee(),R()},r?0:400))}function R(){if(x)return;let c=e.doc.threads();l.hidden=!l.commenting&&!l.listing&&!l.reading&&!l.draft,l.hidden&&(l.active=null),h(l.hidden?0:1),n.layer.classList.toggle("hidden",l.hidden),n.layer.classList.toggle("listing",l.listing);let b=l.listing&&!Te();H(b?Ze:0),o.gutter(i?l.mode==="column"&&!l.hidden&&!b?Je:0:null),u(c);for(let O of E)O.render(c);f?.render(c)}let F="",X=c=>n.layer.querySelector(`.all .mi[data-thread="${c}"]`),Z="input,textarea,select,[contenteditable]:not([contenteditable=false])",Be=()=>{let c=n.layer.getRootNode().activeElement;return c instanceof HTMLTextAreaElement&&c.value!==""||!!document.activeElement?.matches(Z)};function Le(c,b=Be()){let O=[...n.layer.querySelectorAll(`[data-thread="${c}"] .rbox textarea`)].find(D=>!D.closest("[inert]"));b||!O||(F=n.layer.getRootNode().activeElement?.getAttribute("data-thread")??"",O.focus({preventScroll:!0}))}function ce(c){if(c&&l.draft&&!j.draftEmpty())return;if(l.active===c&&!l.draft)return c?Le(c):void 0;let b=Be();c||(l.reading=!1),l.active=c,c&&(l.draft=null,k(c)),R(),c&&Le(c,b)}function Et(c){l.hot!==c&&(l.hot=c,c&&c!==l.active&&k(c),R())}function He(c){z(),l.listing=!1,l.draft=c,l.active=null,R()}function Me(c){if(!l.draft)return He(c);Object.assign(l.draft,c),R()}function Ce(){l.draft&&(l.draft=null,R())}function Pe(c){l.commenting!==c&&(l.commenting=c,o.picking(c),c?(l.active=null,l.listing=!1,C(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${Ye} or Esc to finish`,eo),f=Fn(j)):(z(),f?.destroy(),f=null),R())}function Fe(){if(l.draft){j.draftEmpty()&&Ce();return}l.active&&ce(null)}async function et(c){try{return await e.onName(c),!1}catch(b){if(e.doc.name!==c)throw b;return!0}}async function g(c){let b=l.draft;if(b)try{let O=await e.doc.comment(b.anchor,c);l.draft=null,ee(new Set([O])),ce(O)}catch(O){if(O instanceof de){l.draft=null,ee(new Set([O.id])),ce(O.id),C(xt);return}K(O)}}function k(c){let b=s.get(c);if(!b||b.state==="orphaned")return;let O=b.range?Ge(b):b.element?[b.element.getBoundingClientRect()]:[];for(let D of O.slice(0,6)){let V=m("div",{class:"pulse"});$e(V,D,4),n.layer.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function $(){for(let c of E)c.destroy();E=cr(j),R()}let I=()=>{if(!x){for(let c of E)c.frame();f?.frame(),S=requestAnimationFrame(I)}},_=c=>{let b=c.composedPath()[0];return b instanceof Element&&b.closest(Z)!==null},te=c=>{if(c.key==="Escape"){l.draft?Ce():l.active?ce(null):f&&!f.back()&&Pe(!1);return}Ln(c)&&!c.isComposing&&!c.defaultPrevented&&!_(c)&&(c.preventDefault(),Pe(!l.commenting))},re=c=>{if(j.owns(c)||p.has(c))return;let b=window.getSelection();b&&!b.isCollapsed||Fe()},ae=()=>{let c=to(e.root,l.mode==="column");c!==l.mode?(l.mode=c,$()):R()};function _e(){let c=performance.now();v===0&&(A=c),window.clearTimeout(v);let b=Math.min(sr,Math.max(0,A+pr-c));v=window.setTimeout(()=>{v=0,ee(),R()},b)}let Oe=new MutationObserver(c=>{c.every(b=>n.element.contains(b.target))||_e()});window.addEventListener("keydown",te),window.addEventListener("click",re),window.addEventListener("resize",ae),Oe.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let tt=typeof ResizeObserver>"u"?null:new ResizeObserver(_e);tt?.observe(e.root);let oo=e.doc.onChange(()=>{ee(),R()});return ee(),$(),S=requestAnimationFrame(I),{ctx:j,destroy(){x=!0,cancelAnimationFrame(S),cancelAnimationFrame(U),window.clearTimeout(M),window.clearTimeout(w),window.clearTimeout(v),window.clearTimeout(T),Oe.disconnect(),tt?.disconnect(),oo(),window.removeEventListener("keydown",te),window.removeEventListener("click",re),window.removeEventListener("resize",ae),f?.destroy();for(let c of E)c.destroy();o.remove(),n.destroy()}}}var Ae=null,dr=4e3;function ur(e={}){if(Ae)return Ae;let t=fr(e,()=>t).catch(n=>{throw Ae===t&&(Ae=null),n});return Ae=t,t}function mr(e,t){return new Promise((n,o)=>{let r=setTimeout(()=>o(new Error("timed out")),t);e.then(n,o).finally(()=>clearTimeout(r))})}async function fr(e,t){let n=document.documentElement.getAttribute("data-pipeup-doc"),{id:o,key:r}=n?await Mt(n):{id:`page-${we(location.origin+location.pathname)}`,key:null},i,s=!1,a;if(e.store)i=e.store,a=await Ue(i);else try{let f=ze.open();i=await mr(f,dr).catch(x=>{throw f.then(w=>w.close(),()=>{}),x}),a=await Ue(i)}catch{i=new Ve,s=!0,a=await Ue(i)}let p=e.name?.trim();p&&p!==a.name&&(a={...a,name:p},await i.saveProfile(a));let l=await qe.open({doc:o,key:r,store:i,identity:a.identity,name:a.name}),d=no({doc:l,root:e.root??document.body,onName:async f=>{l.name=f,a={...a,name:f},await i.saveProfile(a)}});s&&d.ctx.toast("This browser can't keep comments for this page \u2014 copy the comments (Copy all) to keep them");let y=()=>void l.flush().catch(f=>globalThis.reportError?.(f)),E=!1;return window.addEventListener("pagehide",y),{document:l,flush:()=>l.flush(),unmount:()=>{E||(E=!0,window.removeEventListener("pagehide",y),d.destroy(),Ae===t()&&(Ae=null))}}}export{Ie as ANIMALS,$t as COLOURS,fn as DEFAULT_PROFILE_NAME,ze as IndexedDbStore,Ve as MemoryStore,qe as PipeupDocument,de as UnsavedChangeError,ni as VERSION,fe as animalName,Ft as copyAll,Ht as copyThread,kt as createIdentity,lt as describeElement,Rt as describeRange,Ne as formatAgo,Re as labelOf,Ue as loadOrCreateProfile,Nt as locate,ur as mount,se as nameOf,po as newDocumentAttribute,Mt as parseDocumentAttribute,ct as resolveAnchor};
|
package/dist/pipeup.min.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
`}function Mn(e){let{thread:t,location:n}=e,o=[Q(n.where)+(n.quote?`, on the text "${Q(n.quote)}"`:""),`${Q(ie(t.root))}: ${ht(t.root," ")}`];for(let r of t.root.replies)o.push(` ${Q(ie(r))}: ${ht(r," ")}`);return o.join(`
|
|
7
7
|
`)+`
|
|
8
8
|
`}function ht(e,t){return e.deleted?"(deleted)":e.text.replace(/\r\n|\r|\n/g,`
|
|
9
|
-
`+t)+(e.edited?" (edited)":"")}function m(e,t={},...n){let o=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?o.className=String(i):o.setAttribute(r,i===!0?"":i));for(let r of n)r!=null&&r!==!1&&o.append(r);return o}function J(e,t){let n=e.getRootNode().activeElement;t&&n instanceof HTMLElement&&e.contains(n)&&n.blur(),e.inert=t}function he(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function Fe(e,t,n=4){e.style.left=`${t.left-n}px`,e.style.top=`${t.top-n}px`,e.style.width=`${t.width+n*2}px`,e.style.height=`${t.height+n*2}px`}var Uo=/\bhttps?:\/\/[^\s<>"'`]+/gi,zo=`.,;:!?'"]}`,Ko=2048,Wo=/[\u202A-\u202E\u2066-\u2069]/;function Yo(e){let t=0,n=0;for(let r of e)r==="("?t++:r===")"&&n++;let o=e.length;for(;o>0;){let r=e[o-1];if(r===")"&&n>t)n--;else if(!zo.includes(r))break;o--}return e.slice(0,o)}function yt(e){let t=[],n=0;for(let o of e.matchAll(Uo)){if(o[0].length>Ko||Wo.test(o[0]))continue;let r=Yo(o[0]),i=o.index??0,s;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;s=p.href}catch{continue}i>n&&t.push(e.slice(n,i));let a=m("a",{href:s,target:"_blank",rel:"noopener noreferrer"},r);a.addEventListener("click",p=>p.stopPropagation()),t.push(a),n=i+r.length}return n<e.length&&t.push(e.slice(n)),t}var ge={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"}},Cn=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),Ge=(Cn?ge.mac:ge.other).label,Vt=(Cn?ge.mac:ge.other).aria;function Pn(e){return e.code===ge.code&&e.shiftKey===ge.mods.shift&&e.altKey===ge.mods.alt&&e.metaKey===ge.mods.meta&&e.ctrlKey===ge.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var On="http://www.w3.org/2000/svg",jo={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"],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 Y(e,t=15,n){let o=Ut(jo[e],t);return n&&o.setAttribute("stroke-width",String(n)),o}function Ut(e,t){let n=document.createElementNS(On,"svg"),o={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(o))n.setAttribute(r,i);for(let r of e){let i=document.createElementNS(On,"path");i.setAttribute("d",r),n.append(i)}return n}var wt=(e,t,n)=>`M${e} ${t}a${n} ${n} 0 1 0 ${2*n} 0a${n} ${n} 0 1 0 -${2*n} 0`,Go={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${wt(7.4,11.5,1.9)}${wt(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${wt(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:`${wt(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 Rn(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let n=t[0].toUpperCase();return[...n].length===1?n:t[0]}var Xe=(e,t)=>Rn(t)||ue(e);function Se(e,t){return m("span",{class:`av c${qt(e)}`,"aria-hidden":"true","data-animal":ue(e)},Rn(t)||Ut([Go[ke[_t(e)]]],24))}var Xo=320;function bt(e,t){setTimeout(()=>{e.remove(),t?.()},Xo)}function xt(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function Et(e){let t=m("textarea",{class:"input",rows:"1","aria-label":e.label}),n=m("button",{class:"send",type:"button","aria-label":"Send",title:"Send"},Y("send")),o=m("div",{class:"row"},e.before,t,n),r=!1,i=()=>{n.classList.toggle("show",t.value.trim()!==""),t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},s=async()=>{let a=t.value.trim();if(!(!a||r)){r=!0;try{await e.onSend(a),t.value="",i()}catch{}finally{r=!1}}};return o.addEventListener("mousedown",a=>{a.target===t||n.contains(a.target)||(a.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",a=>{a.stopPropagation(),a.key==="Enter"&&!a.shiftKey&&!a.isComposing?(a.preventDefault(),s()):a.key==="Escape"&&(a.preventDefault(),t.value="",i(),t.blur(),e.onCancel?.())}),n.addEventListener("click",a=>{a.stopPropagation(),s()}),{element:o,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Zo(e){let t=m("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",w=>w.preventDefault());let n=Et({label:"Comment",before:t,onSend:e.onSend,onCancel:e.onCancel}),o=m("div",{class:"say"}),r=m("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=m("div",{class:"nf"},r),s=m("div",{class:"you"},o,i),a="",p=!1,l=()=>{let w=e.name(),v=w?"change":"add your name";if(t.title=w?"Change your name":"Add your name",!t.lastChild||a!==w){let T=Se(e.me,w),S=t.lastChild;S?(xt(T),bt(S)):T.classList.add("in"),t.append(T),a=w}let A=m("button",{type:"button"},v);A.addEventListener("click",y),o.replaceChildren(m("span",{class:"nm"},w||`You're ${ue(e.me)}`)," \xB7 ",A)},d=w=>{s.classList.toggle("naming",w),J(o,w),J(i,!w)};function y(w){w.stopPropagation(),r.value=e.name(),d(!0),r.focus({preventScroll:!0}),r.select()}let E=()=>{d(!1),n.focus()};t.addEventListener("click",y),r.addEventListener("keydown",w=>{if(w.stopPropagation(),w.key==="Escape")w.preventDefault(),E();else if(w.key==="Enter"){w.preventDefault();let v=r.value.trim();if(!v||v===e.name())return E();if(p)return;p=!0,e.rename(v).finally(()=>{p=!1,l(),E()})}}),l(),d(!1);let f=m("div",{class:"ctx"},e.label);return{element:m("div",{class:"draft"},f,n.element,s),caret:()=>{let{selectionStart:w,selectionEnd:v}=n.input;return()=>{n.focus(),n.input.setSelectionRange(w,v)}},hideLabel:w=>{f.hidden=w},setLabel:w=>{f.textContent=w},focus:()=>n.focus(),isEmpty:()=>n.input.value.trim()===""}}function kt(e,t){let n=Zo({label:t.label,me:e.doc.me,name:()=>e.menu.name(),rename:o=>e.menu.rename(o),onSend:o=>e.postDraft(o),onCancel:()=>e.cancelDraft()});return e.registerDraft(n),n}function Tt(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let n=t.element.getBoundingClientRect();if(!n.width&&!n.height)return null;if(e.point)return{x:n.left+e.point.x*n.width,y:n.top+e.point.y*n.height};let o=t.element.ownerDocument.createRange();o.selectNodeContents(t.element);let r=o.getBoundingClientRect();return{x:r.width?Math.min(n.right-8,r.right+6):n.right-8,y:(r.height?r.top:n.top)+8}}function Ze(e){return e.range?[...e.range.getClientRects()]:[]}function zt(e,t){let n=Ze(t)[0];if(n)return n.top;if(t.state==="orphaned"||!t.element)return null;let o=t.element.getBoundingClientRect();return e.point?o.top+e.point.y*o.height:o.top}function Qe(e,t){let n=Ze(t).at(-1);if(n)return{x:n.left,y:n.bottom,below:!0};let o=Tt(e,t);return o?{...o,below:!1}:null}function In(e,t,n){for(let o of n)if(e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom)return!0;return!1}function Nn(e,t,n=10){let o=[...e].sort((a,p)=>a.want-p.want),r=new Array(o.length).fill(0),i=o.findIndex(a=>a.id===t),s=a=>o[a];if(i<0)o.forEach((a,p)=>{r[p]=p===0?a.want:Math.max(a.want,(r[p-1]??0)+s(p-1).height+n)});else{r[i]=s(i).want;for(let a=i+1;a<o.length;a++)r[a]=Math.max(s(a).want,(r[a-1]??0)+s(a-1).height+n);for(let a=i-1;a>=0;a--)r[a]=Math.min(s(a).want,(r[a+1]??0)-s(a).height-n)}return new Map(o.map((a,p)=>[a.id,r[p]??0]))}var Je=320,Ae=300,Qo=480,Le=()=>window.innerWidth<=Qo;function St(e){let t=window.innerWidth;return{width:e&&!Le()?t-Je:t,height:window.innerHeight}}function At(e,t,n,o=12){let r,i;return e.below?(r=Math.min(e.x,n.width-t.width-o),i=e.y+8,i+t.height>n.height-o&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>n.width-o&&(r=e.x-t.width-28),i=Math.min(e.y-12,n.height-t.height-o)),{left:Math.max(o,r),top:Math.max(o,i)}}function $n(e,t,n,o=12,r=44){let i=e.top-r>=8,s=e.top+e.height+8+(i?0:r),a=e.top-8-(i?r:0)-t.height,p=s+t.height<=n.height-o||a<o,l=p?s:a;return{above:!p,left:Math.max(o,Math.min(e.left,n.width-t.width-o)),top:Math.max(o,l)}}function Lt(e,t,n){let o=e.top-t.height-10;return o<8&&(o=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,n.width-t.width-8)),top:o}}var Dn=e=>`${e} ${e===1?"reply":"replies"}`;function _e(e,t,n){let o={...n},r=e.id,i=m("div",{class:"rbox always"},m("div",{},Et({label:"Reply",onSend:v=>t.reply(r,v),onCancel:t.close}).element)),s=m("div",{}),a=m("div",{}),p=null,l=m("div",{},a,m("div",{class:"more"},s)),d=new Map,y=new Map,E=new Map,f=v=>{let A=Xe(v.author,v.name),T=d.get(v.id),S=T?.el;if((!S||T.key!==A)&&(S=xt(Se(v.author,v.name)),T)){let C=T.el;E.set(v.id,C),bt(C,()=>E.get(v.id)===C&&E.delete(v.id))}S.title=ie(v),y.set(v.id,{key:A,el:S});let P=E.get(v.id);return P?[P,S]:[S]},x=(v,A,T)=>{let S=m("button",{class:"ib",type:"button","aria-label":A,title:A},Y(v));return S.addEventListener("click",P=>{P.stopPropagation(),T()}),S};function w(v,A={}){Object.assign(o,A),r=v.id;let T=(o.now??Date.now)(),S=v.root.replies.length,P=q=>m("span",{class:"who"},`${ie(q)} \xB7 ${Te(q.at,T)}`),C=q=>m("div",{class:q.deleted?"tx del":"tx"},...q.deleted?["Deleted"]:[...yt(q.text),q.edited?" (edited)":""]),z=v.resolved?"Resolved"+(S?` \xB7 ${Dn(S)}`:""):S?Dn(S):"",G=m("div",{class:o.variant==="column"&&z?"ft has-rest":"ft"},o.variant==="column"&&z?m("span",{class:"rest"},z):null,m("span",{class:"hover"},P(v.root),m("span",{class:"acts"},x("copy","Copy thread",()=>t.copy(v.id)),v.resolved?x("reopen","Reopen",()=>void t.reopen(v.id)):x("resolve","Resolve",()=>void t.resolve(v.id))))),K=o.lost?m("div",{class:"ctx"},`No longer on the page \u2014 it read \u201C${he(o.lost,120)}\u201D`):o.quote?m("div",{class:"ctx"},`\u201C${he(o.quote,80)}\u201D`):null;y=new Map;let ae=m("div",{class:"root"},...f(v.root),K,C(v.root),G);a.replaceWith(ae),a=ae,p?.remove(),p=S?m("div",{class:"rps"},...v.root.replies.map(q=>m("div",{class:"it"},...f(q),C(q),m("div",{class:"rft"},P(q))))):null,p&&s.prepend(p),d=y,v.resolved?i.remove():i.parentNode!==s&&s.append(i),l.className=v.resolved?"thread resolved":"thread",l.setAttribute("data-thread",v.id)}return w(e),{element:l,update:w}}var Jo="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",er=400;function Kt(e,t){let n=new Map,o=m("div",{class:"tip",role:"tooltip"}),r=m("div",{class:"mark"}),i=m("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});o.inert=i.inert=!0,e.layer.append(r,o,i);let s=m("div",{class:"bub pin ghost","aria-hidden":"true"}),a=[],p=null,l=null,d=null,y=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,E=0,f=null,x=null,w=null,v=0,A=h=>a.find(L=>L.id===h)??null,T=()=>t.popovers||e.state.listing,S=!1,P=h=>{let L=e.resolved.get(h.id);return L?Qe(h.anchor,L):null};function C(h,L,M){let{left:H,top:R}=At(L,{width:h.offsetWidth||M,height:h.offsetHeight},St(e.state.listing));h.style.left=`${H}px`,h.style.top=`${R}px`}function z(h){let L=h&&T()&&e.state.active!==h?A(h):null,M=L?P(L):null;if(!L||!M){w=null,o.classList.remove("show"),J(o,!0);return}if(w!==L.id){let H=L.root.replies.length;o.replaceChildren(m("div",{class:"tx clamp"},...L.root.deleted?["Deleted"]:yt(L.root.text)),m("div",{class:"who"},`${ie(L.root)}${H?` \xB7 ${H} ${H===1?"reply":"replies"}`:""}`)),w=L.id}C(o,M,260),o.classList.contains("show")||o.offsetWidth,o.classList.add("show"),o.inert=!1}function G(h){f=h,z(h),e.hot(h)}function K(h){if(window.clearTimeout(v),h!==null){G(h);return}v=window.setTimeout(()=>G(null),T()?er:0)}o.addEventListener("mouseenter",()=>window.clearTimeout(v)),o.addEventListener("mouseleave",()=>K(null)),o.addEventListener("click",h=>{h.stopPropagation();let L=w;L&&(window.clearTimeout(v),G(null),e.open(L))});function ae(h){let L=n.get(h.id);if(L)return L;let M=m("button",{class:"bub",type:"button","aria-label":`Comment: ${he(h.root.text,60)}`});return M.addEventListener("mouseenter",()=>K(h.id)),M.addEventListener("mouseleave",()=>K(null)),M.addEventListener("click",H=>{H.stopPropagation(),z(null),e.open(h.id)}),e.layer.insertBefore(M,r),n.set(h.id,M),M}function q(){let h=e.state.draft,L=d&&h&&!h.anchor.quote&&!h.anchor.point?h.resolved.element:null;if(L){let{left:H,top:R,above:F}=$n(L.getBoundingClientRect(),{width:i.offsetWidth||Ae,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),X=d?.above!==null&&d?.above!==F;if(d&&(d.above=F),X&&le())return;i.style.left=`${H}px`,i.style.top=`${R}px`;return}let M=d&&h?Qe(h.anchor,h.resolved):p?P(p):null;M&&C(i,M,Ae)}let oe=h=>e.state.commenting&&!h.anchor.quote&&!h.anchor.point;function le(){return window.clearTimeout(E),y?(i.classList.remove("show"),E=window.setTimeout(()=>{q(),i.classList.add("show")},220),!0):(i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function j(h){if(window.clearTimeout(E),y){i.classList.remove("show"),E=window.setTimeout(()=>{d?.box.setLabel(h),q(),i.classList.add("show")},220);return}d?.box.setLabel(h),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)}function ee(){if(!T())return null;let h=e.state.draft;return h?h.anchor.quote||h.anchor.point||e.state.commenting?null:h.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function u(h){a=h;let L=new Set;for(let F of h){if(!e.visible(F)||F.anchor.quote)continue;let X=e.resolved.get(F.id);if(!X||X.state==="orphaned")continue;L.add(F.id);let Z=ae(F);Z.classList.toggle("done",F.resolved),Z.classList.toggle("on",e.state.active===F.id),Z.classList.toggle("pin",F.anchor.point!==void 0)}for(let[F,X]of n)L.has(F)||(X.classList.remove("in"),n.delete(F),window.setTimeout(()=>X.remove(),300));z(f),S!==e.state.listing&&i.classList.contains("show")&&!y&&(window.clearTimeout(E),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)),S=e.state.listing;let M=t.popovers?e.state.draft:null;if(M){d?.of!==M?(window.clearTimeout(E),i.classList.remove("glide"),d={box:kt(e,M),of:M,at:M.resolved.element,above:null},d.box.hideLabel(oe(M)),i.replaceChildren(d.box.element),i.inert=!1,d.box.focus(),p=null,l=null,q(),i.classList.add("show")):d&&(d.at!==M.resolved.element&&(d.at=M.resolved.element,d.above=null,j(M.label)),d.box.hideLabel(oe(M)));return}d&&(window.clearTimeout(E),i.classList.remove("glide"),d=null,e.registerDraft(null));let H=T()&&e.state.active?A(e.state.active):null;if(!H||!e.visible(H)){p=null,l=null,i.classList.remove("show"),J(i,!0);return}let R=H.anchor.quote?.exact??null;!p||!l||p.id!==H.id?(l=_e(H,e.actions,{variant:"popover",quote:R}),i.replaceChildren(l.element),p=H,q(),i.classList.add("show"),i.inert=!1):p!==H&&(l.update(H,{quote:R}),p=H)}function N(){for(let[H,R]of n){let F=A(H),X=e.resolved.get(H),Z=F&&X?Tt(F.anchor,X):null;if(!Z||Z.y<-40||Z.y>window.innerHeight+40){R.style.visibility="hidden";continue}R.style.visibility="",R.style.left=`${Z.x}px`,R.style.top=`${Z.y}px`,R.classList.contains("in")||(R.offsetWidth,R.classList.add("in"))}let h=e.state.draft,L=h?.anchor.point?Tt(h.anchor,h.resolved):null;L?(s.style.left=`${L.x}px`,s.style.top=`${L.y}px`,s.classList.contains("in")||(e.layer.insertBefore(s,r),s.offsetWidth,s.classList.add("in"))):s.classList.contains("in")&&(s.classList.remove("in"),window.setTimeout(()=>s.classList.contains("in")||s.remove(),300)),i.classList.contains("show")&&q();let M=ee();r.classList.toggle("show",M!==null),M&&Fe(r,M.getBoundingClientRect(),4)}let B=h=>{if(e.owns(h)){let M=h.composedPath()[0];x!==null&&!(M instanceof Element&&M.closest(".tip,.bub"))&&K(null),x=null;return}let L=e.readsAt(h.clientX,h.clientY)?.id??null;L!==x&&(x=L,K(L))},U=h=>{if(e.owns(h))return;let L=window.getSelection();if(L&&!L.isCollapsed||(e.state.commenting?h.altKey:h.target instanceof Element&&h.target.closest(Jo)))return;let M=e.readsAt(h.clientX,h.clientY);M&&(e.claim(h),z(null),e.open(M.id))};return window.addEventListener("pointermove",B,{capture:!0,passive:!0}),window.addEventListener("click",U,!0),{render:u,frame:N,destroy(){window.clearTimeout(v),window.clearTimeout(E),window.removeEventListener("pointermove",B,!0),window.removeEventListener("click",U,!0),e.registerDraft(null);for(let h of n.values())h.remove();s.remove(),o.remove(),r.remove(),i.remove()}}}var tr="button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,table,th,td,li,p,h1,h2,h3,h4,h5,h6,blockquote,pre";var Bn=(e,t)=>Math.abs(e.left-t.left)<=2&&Math.abs(e.top-t.top)<=2&&Math.abs(e.width-t.width)<=2&&Math.abs(e.height-t.height)<=2;function et(e,t,n){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let o=n.viewport(),r=.6*o.width*o.height,i=null;for(let a=e;a&&a!==t;a=a.parentElement){let p=n.box(a);if(!(p.width<2||p.height<2)){if(a.hasAttribute("data-pipeup-id")){i=a;break}if(!(p.width*p.height>r)&&(a.matches(tr)||n.drawn(a))){i=a;break}}}if(!i||i.hasAttribute("data-pipeup-id"))return i;let s=n.box(i);for(let a=i.parentElement;a&&a!==t&&Bn(n.box(a),s);a=a.parentElement)if(a.hasAttribute("data-pipeup-id"))return a;return i}function Wt(e,t,n){let o=n.box(e);for(let r=e.parentElement;r&&r!==t;){let i=et(r,t,n);if(!i)return null;if(!Bn(n.box(i),o))return i;r=i.parentElement}return null}function Hn(e=window){return{box:t=>t.getBoundingClientRect(),drawn:t=>{let n=e.getComputedStyle(t),o=n.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(n.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(n.getPropertyValue(`border-${i}-width`))>0);return o||r||n.backgroundImage!=="none"||n.boxShadow!=="none"},viewport:()=>({width:e.innerWidth,height:e.innerHeight})}}var qn="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]",nr=`${qn},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,Fn=["click","dblclick","auxclick","submit","contextmenu","dragstart"],_n=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],or=400;function Vn(e,t=Hn()){let n=m("div",{class:"pick"});e.layer.append(n);let o=m("span",{class:"lbl"}),r=m("button",{class:"nb",type:"button","aria-label":"Select the block around it",title:"Select the block around it"},Y("expand",16)),i=m("div",{class:"namebar",role:"toolbar","aria-label":"Chosen block"},o,r);i.inert=!0,e.layer.append(i),i.addEventListener("mousedown",u=>u.preventDefault()),r.addEventListener("click",u=>{u.stopPropagation();let N=p&&Wt(p,e.root,t);N&&K(N)});let s=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,a=null,p=null,l=null,d=null,y=0,E=()=>{},f=null,x=()=>{},w=u=>!e.owns(u)&&!(u.target instanceof Element&&u.target.closest("[data-pipeup-ignore]"));function v(){d&&(n.classList.toggle("glide",performance.now()<y),Fe(n,d.getBoundingClientRect(),4))}function A(){if(!f)return;i.classList.toggle("glide",performance.now()<y&&i.classList.contains("show"));let u=f.getBoundingClientRect(),{left:N,top:B}=Lt({left:u.left,top:u.top,width:u.width,height:u.height},{width:i.offsetWidth||200,height:i.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});i.style.left=`${N}px`,i.style.top=`${B}px`}function T(u,N){d=u,y=N?performance.now()+or:0,v(),n.classList.add("show")}function S(u,N){let B=getComputedStyle(u);if(B.opacity==="0")return N(),()=>{};let U=0,h=()=>{window.clearTimeout(U),u.removeEventListener("transitionend",M)},L=()=>{h(),N()},M=R=>{R.target===u&&R.propertyName==="opacity"&&L()},H=Math.max(...B.transitionDuration.split(",").map(R=>parseFloat(R)*1e3||0));return U=window.setTimeout(L,H+100),u.addEventListener("transitionend",M),h}function P(u){if(u!==a){if(a=u,E(),!u){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?T(u,!1):s?(n.classList.remove("show"),E=S(n,()=>T(u,!1))):T(u,!0)}}function C(u){p=u,n.classList.toggle("on",u!==null),P(u),x(),i.inert=!u,u?s?(i.classList.remove("show"),x=S(i,()=>z(u))):z(u):(i.classList.remove("show"),f=null)}function z(u){o.textContent=o.title=Ee(u);let N=Wt(u,e.root,t)===null;r.hidden=N;let B=i.classList.contains("show");f=u,A(),B||(i.offsetWidth,i.classList.add("show"))}function G(u){let N;try{N=We(u,e.root)}catch(h){e.report(h);return}let B={anchor:N,label:Ee(u),ranges:[],resolved:{state:"attached",element:u,range:null}},U=e.state.draft;C(u),l=U??{...B,ranges:[]},U?e.moveDraft({...B,ranges:[]}):e.startDraft(l)}function K(u){e.keepCaret(()=>G(u))}function ae(u){let N=(u.target instanceof Element?et(u.target,e.root,t):null)??e.root,B=N.getBoundingClientRect();if(!B.width||!B.height)return;let U={x:(u.clientX-B.left)/B.width,y:(u.clientY-B.top)/B.height},h;try{h=We(N,e.root,U)}catch(M){e.report(M);return}let L=Ee(N).replace(/^[A-Z](?=[a-z])/,M=>M.toLowerCase());C(null),P(null),e.startDraft({anchor:h,label:`Pin on ${L}`,ranges:[],resolved:{state:"attached",element:N,range:null}})}function q(u){let N=window.getSelection();if(N&&!N.isCollapsed)return;if(e.state.draft&&(u.altKey||!e.draftEmpty())){e.dismiss();return}if(!u.altKey&&e.readsAt(u.clientX,u.clientY))return;if(e.state.active&&e.open(null),u.altKey){ae(u);return}let B=u.target instanceof Element?et(u.target,e.root,t):null;B?G(B):(e.dismiss(),C(null))}let oe=u=>{if(!e.owns(u)){if(!w(u)){p||P(null);return}u.stopPropagation(),!(p||e.state.draft)&&P(u.target instanceof Element?et(u.target,e.root,t):null)}},le=u=>{w(u)&&(u.stopPropagation(),(u.type==="pointerdown"||u.type==="mousedown")&&u.target instanceof Element&&u.target.closest(nr)&&u.preventDefault())},j=u=>{w(u)&&(u.preventDefault(),u.stopPropagation(),u.type==="click"&&q(u))},ee=u=>{(u.key==="Enter"||u.key===" ")&&w(u)&&u.target instanceof Element&&u.target.closest(qn)&&(u.preventDefault(),u.stopPropagation())};window.addEventListener("pointermove",oe,!0);for(let u of _n)window.addEventListener(u,le,!0);for(let u of Fn)window.addEventListener(u,j,!0);return window.addEventListener("keydown",ee,!0),{back(){return p?(C(null),!0):!1},render(){let u=e.state.draft;l&&u!==l?(l=null,C(null)):u&&!l&&(a||p)&&C(null)},frame(){v(),A()},destroy(){E(),x(),window.removeEventListener("pointermove",oe,!0);for(let u of _n)window.removeEventListener(u,le,!0);for(let u of Fn)window.removeEventListener(u,j,!0);window.removeEventListener("keydown",ee,!0),n.classList.remove("show"),i.classList.remove("show"),J(i,!0),S(n,()=>n.remove()),S(i,()=>i.remove())}}}var rr=300,ir=32,Yt=220,tt=320,ar=24,Un=24;function jt(e,t=!1){let n=e.ownerDocument.documentElement,o=n.getAttribute("data-pipeup-layout");if(o==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(o==="column"?e:null);if(!r)return null;if(n.hasAttribute("data-pipeup-reserve")){let a=n.clientWidth,l=getComputedStyle(r).maxWidth,d;return l.endsWith("px")?d=parseFloat(l):l.endsWith("%")?d=parseFloat(l)/100*a:d=r.getBoundingClientRect().width,o!=="column"&&a<d+tt-(t?ar:0)?null:{x:a-tt+Un,width:tt-2*Un}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<rr&&o!=="column")return null;let s=i+ir;return{x:s,width:Math.max(220,Math.min(300,window.innerWidth-s-16))}}function Gt(e,t){let n=e.resolved.get(t.id);return!n||n.state==="orphaned"&&!e.pending.has(t.id)}function zn(e){let t=m("div",{class:"col"});e.layer.append(t);let n=new Map,o=null,r=new ResizeObserver(()=>a()),i=f=>Gt(e,f);function s(f){let x=e.resolved.get(f.id),w=x?zt(f.anchor,x):null;return w===null?Number.POSITIVE_INFINITY:w+window.scrollY-4}function a(){let f=[],x=[];for(let[S,P]of n){let C=s(P.thread);if(Number.isFinite(C))P.placed=C;else if(e.pending.has(S)){if(P.placed===null){P.el.classList.add("wait");continue}C=P.placed}Number.isFinite(C)?f.push({id:S,want:C,height:P.el.offsetHeight}):x.push({id:S,height:P.el.offsetHeight})}let w=e.state.draft,v=w?zt(w.anchor,w.resolved):null;o&&v!==null&&f.push({id:"draft",want:v+window.scrollY-4,height:o.el.offsetHeight});let A=Nn(f,o?"draft":e.state.active),T=Math.max(0,...f.map(S=>(A.get(S.id)??0)+S.height))+24;for(let S of x)A.set(S.id,T),T+=S.height+10;for(let[S,P]of n){if(P.el.classList.contains("wait")){if(!A.has(S))continue;P.el.style.transition="none",P.el.style.transform=`translateY(${Math.round(A.get(S))}px)`,P.el.offsetWidth,P.el.style.transition="",P.el.classList.remove("wait");continue}P.el.style.transform=`translateY(${Math.round(A.get(S)??0)}px)`}o&&(o.el.style.transform=`translateY(${Math.round(A.get("draft")??0)}px)`)}function p(f,x){f.thread=x,f.lost=i(x),f.view.update(x,{lost:f.lost?x.anchor.snapshot:null})}function l(f){let x=i(f),w=_e(f,e.actions,{variant:"column",lost:x?f.anchor.snapshot:null}),v=m("div",{class:"th","data-thread":f.id},w.element);return v.style.transition="none",v.addEventListener("mouseenter",()=>e.hot(f.id)),v.addEventListener("mouseleave",()=>e.hot(null)),v.addEventListener("click",()=>e.open(f.id)),t.append(v),r.observe(v),{el:v,thread:f,lost:x,placed:null,view:w}}function d(){let f=e.state.draft;if(o&&f&&o.of!==f){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Yt),o=null}if(f&&o&&(o.box.setLabel(f.label),o.box.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point)),f&&!o){let x=kt(e,f),w=m("div",{class:"th on"},x.element);w.style.transition="none",t.append(w),r.observe(w),o={el:w,box:x,of:f},x.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point),x.focus()}else if(!f&&o){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Yt),o=null,e.registerDraft(null)}}function y(f){J(t,e.state.listing);let x=new Set,w=[],v=e.state.active!==null||e.state.draft!==null;for(let A of f){if(!e.visible(A))continue;x.add(A.id);let T=n.get(A.id);T?(T.thread!==A||T.lost!==i(A))&&p(T,A):(T=l(A),n.set(A.id,T),w.push(T.el));let S=T.el;S.classList.toggle("on",e.state.active===A.id);let P=S.querySelector(".more");P&&J(P,e.state.active!==A.id),S.classList.toggle("dim",v&&e.state.active!==A.id),S.classList.toggle("hot",e.state.hot===A.id&&e.state.active!==A.id),S.classList.toggle("resolved",A.resolved),S.classList.toggle("lost",T.lost)}for(let[A,T]of n)x.has(A)||(n.delete(A),r.unobserve(T.el),T.el.classList.add("out"),window.setTimeout(()=>T.el.remove(),Yt));d(),a(),o&&w.push(o.el);for(let A of w)A.offsetWidth,A.style.transition=""}function E(){let f=jt(e.root,!0);f&&(t.style.width=`${f.width}px`,t.style.transform=`translate(${f.x}px, ${-window.scrollY}px)`)}return{render:y,frame:E,destroy(){r.disconnect(),e.registerDraft(null),t.remove()}}}var sr="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function Kn(e){let t=m("button",{type:"button","aria-label":"Comment",title:"Comment"},Y("comment",17)),n=m("div",{class:"selbar"},t);n.inert=!0,e.layer.append(n);let o=null,r=d=>{let y=d&&(d.nodeType===Node.ELEMENT_NODE?d:d.parentElement);return!!y&&e.root.contains(y)&&!y.closest(sr)};function i(){if(!o)return;let d=o.getBoundingClientRect(),{left:y,top:E}=Lt({left:d.left,top:d.top,width:d.width,height:d.height},{width:n.offsetWidth||36,height:n.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});n.style.left=`${y}px`,n.style.top=`${E}px`}function s(){o=null,n.inert=!0,n.classList.remove("show")}function a(){let d=window.getSelection();if(!e.state.commenting||!d||d.isCollapsed||d.rangeCount===0||!d.toString().trim()||!r(d.anchorNode)||!r(d.focusNode)){s();return}o=d.getRangeAt(0).cloneRange(),i(),n.inert=!1,n.classList.add("show")}t.addEventListener("mousedown",d=>d.preventDefault()),t.addEventListener("click",d=>{d.stopPropagation();let y=o;if(!y)return;let E;try{E=mt(y,e.root)}catch(x){e.report(x),s();return}let f=he(y.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),s(),e.startDraft({anchor:E,label:`\u201C${f}\u201D`,ranges:[y],resolved:{state:"attached",element:null,range:y}})});let p=()=>{if(!o)return;let d=window.getSelection();(!d||d.isCollapsed||!d.toString().trim())&&s()};document.addEventListener("selectionchange",p);let l=d=>{e.owns(d)||window.setTimeout(a,0)};return window.addEventListener("mouseup",l,!0),window.addEventListener("keyup",l,!0),{render(){!e.state.commenting&&o&&s()},frame(){o&&i()},destroy(){window.removeEventListener("mouseup",l,!0),window.removeEventListener("keyup",l,!0),document.removeEventListener("selectionchange",p),n.remove()}}}async function Xt(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(n),n.select();let o=document.execCommand("copy");if(n.remove(),!o)throw new Error("pipeup: your browser blocked copying")}function Wn(e){let t=[m("span",{class:"n"}),m("span",{class:"n"})],n=Y("comment",20,1.4);n.lastElementChild.setAttribute("stroke-width","1.6");let o=m("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":Vt,"aria-haspopup":"menu","aria-expanded":"false"},m("span",{class:"plus"},n),m("span",{class:"cnt"},Y("bubble",34,1.4),...t)),r=m("span",{class:"ttip","aria-hidden":"true"},"Comment",m("small",{},Ge)),i=m("div",{class:"launch"},o,r),s=m("div",{class:"menu",role:"menu","aria-label":"Comments"}),a=m("div",{class:"list",role:"menu","aria-label":"All comments"}),p=m("span",{class:"pn"}),l=m("button",{class:"ib",type:"button","aria-label":"Close"},Y("close")),d=m("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",m("span",{class:"sw","aria-hidden":"true"}));d.addEventListener("click",g=>{g.stopPropagation(),e.menu.toggleResolved()});let y=m("div",{class:"all",role:"dialog","aria-label":"All comments"},m("div",{class:"hd"},m("span",{},"All comments"),p,d,l),a),E=m("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});s.inert=y.inert=E.inert=!0,e.layer.append(s,i,y);let f=!1,x=!1,w=[],v=!1,A=0,T=null,S=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,P=g=>{f=g,g||x&&(x=!1,Oe()),s.classList.toggle("show",g),J(s,!g),o.setAttribute("aria-expanded",String(g))},C=(g,k=!1)=>{e.state.listing!==g&&(e.state.listing=g,e.render(),g?(z(a)[0]??l).focus({preventScroll:!0}):k&&o.focus({preventScroll:!0}))},z=(g=s)=>[...g.querySelectorAll(".mi")],G=()=>s.getRootNode().activeElement,K=()=>{P(!1),o.focus({preventScroll:!0})},ae=()=>{x=!1,Oe(),F.focus({preventScroll:!0})},q=g=>{let k=z(g.currentTarget);if(k.length===0)return;let $=G(),I=k.indexOf($),_=te=>{g.preventDefault(),k[(te+k.length)%k.length]?.focus({preventScroll:!0})};g.key==="ArrowDown"?_(I+1):g.key==="ArrowUp"?_(I<0?k.length-1:I-1):g.key==="Home"?_(0):g.key==="End"&&_(k.length-1)};s.addEventListener("keydown",q),a.addEventListener("keydown",q),l.addEventListener("click",g=>{g.stopPropagation(),C(!1,!0)});let oe=g=>Gt(e,g),le=()=>w.filter(g=>!g.resolved).length;function j(){let g=z(a).indexOf(G()),k=e.menu.all().filter(re=>!re.thread.resolved||e.state.showResolved),$=re=>{let se=re.thread,ze=Se(se.root.author,se.root.name);ze.classList.add("in");let Ne=m("button",{class:se.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":se.id},ze,m("span",{},m("span",{class:"clamp"},se.root.deleted?"Deleted":se.root.text),m("small",{},oe(se)?`\u201C${he(se.anchor.snapshot,80)}\u201D`:re.location.where)));return Ne.addEventListener("click",ot=>{ot.stopPropagation(),ee(se.id,Ne.getBoundingClientRect().top)}),Ne},I=k.filter(re=>oe(re.thread)),_="No longer on the page";p.textContent=String(le()),d.setAttribute("aria-checked",String(e.state.showResolved)),a.replaceChildren(k.length?"":m("div",{class:"sec",role:"presentation"},"No open comments"),...k.filter(re=>!oe(re.thread)).map($),I.length?m("div",{role:"group","aria-label":_},m("div",{class:"sec","aria-hidden":"true"},_),...I.map($)):"");let te=z(a);g>=0&&te[Math.min(g,te.length-1)]?.focus({preventScroll:!0})}function ee(g,k){Le()&&(e.state.reading=!0,C(!1)),u(g,k)}function u(g,k){let $=w.find(te=>te.id===g),I=e.resolved.get(g);if(!$)return;let _=I&&!oe($)?I.element??I.range?.startContainer.parentElement??null:null;if(_?.scrollIntoView({block:"center",inline:"nearest",behavior:S?"auto":"smooth"}),_&&I&&Qe($.anchor,I)&&_.checkVisibility?.({visibilityProperty:!0})!==!1){B(),e.open(g);return}e.open(null),Le()&&(e.state.reading=!0,e.render()),N($,k)}function N(g,k){let $={quote:g.anchor.quote?.exact??null,lost:oe(g)?g.anchor.snapshot:null};if(T?.id===g.id?T.view.update(g,$):(T={id:g.id,view:_e(g,e.actions,{variant:"popover",...$})},E.replaceChildren(T.view.element)),k===void 0)return;E.isConnected||(e.layer.insertBefore(E,y),E.offsetWidth);let I=St(e.state.listing),{left:_,top:te}=At({x:I.width,y:k,below:!1},{width:Ae,height:E.offsetHeight},I);E.style.left=`${_}px`,E.style.top=`${te}px`,E.classList.add("show"),E.inert=!1,e.focusReply(g.id)}function B(g=!1){T&&(T=null,E.classList.remove("show"),J(E,!0),g&&e.state.reading&&(e.state.reading=!1,e.render()))}function U(g,k,$,I=!1,..._){let te=m("button",{class:"mi",type:"button",role:I?"menuitemcheckbox":"menuitem"},g,m("span",{class:"lb"},k),..._,I&&m("span",{class:"sw","aria-hidden":"true"}),m("span",{class:"tt","aria-hidden":"true"}));return te.addEventListener("click",re=>{re.stopPropagation(),$()}),te}let h=(g,k,$,I)=>{let _=g.querySelector(".lb");_.textContent!==k&&(_.textContent=k),g.querySelector(".tt").textContent=$,g.setAttribute("aria-description",$),I!==void 0&&g.setAttribute("aria-checked",String(I))},L=()=>m("div",{class:"sep",role:"separator"}),M=m("span",{class:"ma"}),H=m("span",{class:"kc"}),R="",F=U(M,"",()=>{x=!0,Oe()},!1,H);F.dataset.item="name";let X=U(Y("copy"),"Copy all",()=>{K(),e.menu.copyAll("ai")}),Z=U(Y("lines"),"Copy all as text",()=>{K(),e.menu.copyAll("text")}),qe=m("span",{class:"kc"}),Pe=U(Y("list"),"All comments",()=>{P(!1),C(!0)},!1,qe),ce=U(Y("comment"),"Start commenting",()=>{K(),e.setCommenting(!e.state.commenting)},!0,m("span",{class:"kc","aria-hidden":"true"},Ge));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",Vt);let Ct=[F,L(),X,Z,Pe,L(),ce];function Ve(){let g=le(),k=e.menu.name(),$=k||ue(e.doc.me);if(h(F,$,k?"The name on your comments":"Add a name to show on your comments"),F.setAttribute("aria-label",`${$}, ${k?"edit":"add"} your name`),H.replaceChildren(k?Y("edit",13):"Add name"),Xe(e.doc.me,k)!==R){R=Xe(e.doc.me,k);let I=Se(e.doc.me,k);I.classList.add("in"),M.replaceChildren(I)}h(X,"Copy all","Markdown, with where each thread is"),h(Z,"Copy all as text","Just the words"),h(Pe,"All comments","Every thread, and where it is"),qe.textContent=g?String(g):"",h(ce,"Start commenting",e.state.commenting?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.commenting)}function Oe(){if(x){let g=m("textarea",{class:"input",rows:"1","aria-label":"Your name"});g.value=e.menu.name(),g.addEventListener("keydown",k=>{if(k.stopPropagation(),k.key==="Enter"){k.preventDefault();let $=g.value.trim();$&&e.menu.rename($).then(ae)}else k.key==="Escape"&&ae()}),s.replaceChildren(m("label",{class:"name"},"Your name",g)),g.focus({preventScroll:!0});return}Ve(),s.firstChild!==F&&s.replaceChildren(...Ct)}o.addEventListener("click",g=>{if(g.stopPropagation(),f){P(!1);return}Oe(),P(!0),g.detail===0&&z().at(-1)?.focus({preventScroll:!0})});let Re=!1,Ie=()=>{Re=y.contains(G())},Ue=g=>{let k=g.composedPath();f&&!k.includes(s)&&!k.includes(o)&&P(!1),e.state.listing&&!e.owns(g)&&C(!1,Re&&(!document.activeElement||document.activeElement===document.body)),!k.includes(E)&&!k.includes(y)&&B(!0)};window.addEventListener("pointerdown",Ie,!0),window.addEventListener("click",Ue,!0);let nt=g=>{if(g.key!=="Escape"||x)return;let k=g.composedPath()[0];if(f)K();else if(e.state.listing&&!(k instanceof HTMLTextAreaElement&&!y.contains(k)))C(!1,!0);else if(T)B(!0),e.actions.close();else return;g.stopPropagation()};return window.addEventListener("keydown",nt,!0),{render(g){w=g;let k=le();if(k!==A){if(k){let[I,_]=t[0].classList.contains("on")?t:[t[1],t[0]];_.textContent=k>99?"99+":String(k),_.classList.toggle("s",k>99),I.classList.remove("on"),_.classList.add("on")}o.classList.toggle("has",k>0),o.setAttribute("aria-label",k?`Comment, ${k} open`:"Comment"),A=k}e.state.commenting&&!v&&f&&K(),v=e.state.commenting,o.classList.toggle("on",v),f&&!x&&Ve();let $=e.state.listing;if(y.classList.toggle("full",Le()),y.classList.contains("show")!==$&&(y.classList.toggle("show",$),J(y,!$)),$&&j(),T){let I=g.find(_=>_.id===T?.id);!I||e.state.active||I.resolved&&!e.state.showResolved?B():N(I)}},frame(){},destroy(){window.removeEventListener("pointerdown",Ie,!0),window.removeEventListener("click",Ue,!0),window.removeEventListener("keydown",nt,!0),s.remove(),y.remove(),E.remove(),i.remove()}}}var jn=["pipeup-quote","pipeup-on","pipeup-done"],lr={"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]]},cr=(e,t)=>jn.map(n=>{let[o,r,i,s]=lr[n][e?1:0];return`::highlight(${n}){background-color:rgba(${o},${r},${i},${+(s*t).toFixed(3)})}`}).join("");function Gn(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var pr="<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>",dr=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(pr)}") 3 2,crosshair!important}`;function Xn(e=document,t=!1){let n=e.defaultView?.CSSStyleSheet;if(!n||!("replaceSync"in n.prototype)||!("adoptedStyleSheets"in e))return{gutter(){},picking(){},fade(){},room(){},remove:()=>Yn()};let o=new n,r=null,i=!1,s=1,a=0,p="",l=0,d=()=>o.replaceSync(cr(t,s)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?dr:"")+(a||p?`html{${a?`margin-right:${a}px!important;`:""}${p}}`:""));return d(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,o],{gutter(y){y!==r&&(r=y,d())},picking(y){y!==i&&(i=y,d())},fade(y){s=y,d()},room(y,E){y!==a&&(a=y,p=E?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(l),!y&&p&&(l=window.setTimeout(()=>{p="",d()},400)),d())},remove(){clearTimeout(l),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(y=>y!==o),Yn()}}}function Zn(e){Gn()&&(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 Yn(){if(Gn())for(let e of jn)CSS.highlights.delete(e)}var Zt=':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(--pu-ink);--pu-ink:#2C2C2A;--pu-muted:#5F5E5A;--pu-faint:#888780;--pu-line:#E5E3DA;--pu-rule:#ECEAE2;--pu-soft:#FAFAF7;--pu-surface:#FFFFFF;--pu-hover:#F1EFE8;--pu-accent-soft:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--pu-shadow:0 8px 28px rgba(44,44,42,.1);--pu-enter:.26s;--pu-move:.34s;--pu-exit:.2s;--pu-pulse:1.2s;--pu-eo:cubic-bezier(.22,.61,.36,1);--pu-eio:cubic-bezier(.4,0,.2,1);--pu-ei:cubic-bezier(.4,0,1,1)}.layer.dark{--pu-ink:#ECEBE6;--pu-muted:#B4B2A9;--pu-faint:#8D8B84;--pu-line:#3A3936;--pu-rule:#34332F;--pu-soft:#22221F;--pu-surface:#1B1B19;--pu-hover:#2C2C29;--pu-shadow: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(--pu-ink);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--pu-faint)}.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(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.ft .rest{transition:opacity var(--pu-enter) var(--pu-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(--pu-muted);transition:background-color .2s var(--pu-eo),color .2s var(--pu-eo)}.ib:hover,.ib:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--pu-move) var(--pu-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(--pu-line);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--pu-ink);background:transparent;transition:border-color var(--pu-enter) var(--pu-eo)}.row:hover .input,.input:hover{border-bottom-color:var(--pu-muted)}.input:focus{border-bottom-color:var(--pu-accent)}.name{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--pu-faint);padding-top:6px}.name .input{font-size:13px;height:24px}.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(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-faint)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-muted);text-decoration:underline;text-decoration-color:var(--pu-line);text-underline-offset:2px;transition:color .2s var(--pu-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(--pu-enter) var(--pu-eo),background-color .2s var(--pu-eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--pu-accent-soft)}.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(--pu-surface);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--pu-faint)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo)}.pop.show.glide{transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--pu-accent-soft);border-radius:8px;opacity:0;transition:opacity .3s var(--pu-eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--pu-accent-soft);animation:pu-pulse var(--pu-pulse) var(--pu-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(--pu-enter) var(--pu-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(--pu-move) var(--pu-eio),box-shadow var(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-eo)}.th.hot{box-shadow:inset 2px 0 0 var(--pu-line)}.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(--pu-exit) var(--pu-ei)}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-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(--pu-eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--pu-accent-soft);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(--pu-exit) var(--pu-ei),border-color var(--pu-exit) var(--pu-ei)}.pick.show{opacity:1;transition-duration:var(--pu-enter);transition-timing-function:var(--pu-eo)}.pick.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-eio)}.pick.on{border-color:var(--pu-accent)}.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(--pu-muted);white-space:nowrap;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-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(--pu-eo),color .2s var(--pu-eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);transition:background-color .3s var(--pu-eo),color .3s var(--pu-eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--pu-hover)}.launch .mode.on{background:var(--pu-accent);color:#fff}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--pu-faint)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--pu-exit) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-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(--pu-eo)}.mi:hover,.mi:focus-visible{background:var(--pu-soft);outline:none}.mi svg{color:var(--pu-muted);flex:none}.mi small{display:block;color:var(--pu-faint);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(--pu-rule)}.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(--pu-muted);background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-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(--pu-line);transition:background-color var(--pu-move) var(--pu-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(--pu-move) var(--pu-eio),opacity var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),opacity var(--pu-exit) var(--pu-ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--pu-move) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-faint)}.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(--pu-muted);transition:background-color .2s var(--pu-eo)}.hs:hover,.hs:focus-visible{background:var(--pu-hover);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(--pu-exit) var(--pu-ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--pu-faint)}.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(--pu-eo),transform .36s var(--pu-eo)}.toast.show{opacity:1;transform:translate(-50%)}@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 Qn="#534AB7",ur="rgb(0, 0, 238)";function Jn(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 n=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:n}}function mr(e){let t=n=>{let o=n/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function eo(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{font:"system-ui, sans-serif",accent:Qn,dark:!1};let o=t.documentElement,r=n.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(n.getComputedStyle(o).getPropertyValue("--pipeup-accent")||o.style.getPropertyValue("--pipeup-accent")).trim(),s=e.querySelector("a[href]"),a=s?n.getComputedStyle(s).color:"",p=i||(a&&a!==ur?a:Qn),l=Jn(n.getComputedStyle(t.body).backgroundColor);(!l||l.a===0)&&(l=Jn(n.getComputedStyle(o).backgroundColor));let d=l&&l.a>0?mr(l)<.2:n.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(n.getComputedStyle(o).colorScheme||"");return{font:r,accent:p,dark:!!d}}function to(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function no(e,t=document){let n=t.createElement("pipeup-root");n.setAttribute("data-pipeup-ignore",""),n.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 o=n.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in o){let s=new r;s.replaceSync(Zt),o.adoptedStyleSheets=[s]}else{let s=t.createElement("style");s.textContent=Zt,o.append(s)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${Je}px`),i.style.setProperty("--pu-pop",`${Ae}px`),to(i,e),o.append(i),t.documentElement.append(n),{element:n,shadow:o,layer:i,destroy:()=>n.remove()}}var fr=40,hr=250,gr=120,vr=2400,oo=4e3;function ro(e,t=!1){return jt(e,t)?"column":"bubbles"}function yr(e){return[...e.state.mode==="column"?[zn(e),Kt(e,{popovers:!1})]:[Kt(e,{popovers:!0})],Kn(e),Wn(e)]}var wr=1e3,Mt="Shown here, but not saved yet \u2014 it will be saved with your next change",Me=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function io(e){let t=eo(e.root),n=no(t),o=Xn(document,t.dark);o.fade(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),s=new Map,a=new Set,p=new WeakSet,l={active:null,hot:null,showResolved:!1,hidden:!0,mode:ro(e.root),draft:null,commenting:!1,listing:!1,reading:!1},d=m("div",{class:"toast",role:"status","aria-live":"polite"});n.layer.append(d);let y=null,E=[],f=null,x=!1,w=0,v=0,A=0,T=0,S=0,P=!1;function C(c,b=vr){x||(P=b===oo,d.textContent=c,d.classList.add("show"),window.clearTimeout(w),w=window.setTimeout(()=>d.classList.remove("show"),b))}function z(){P&&(P=!1,window.clearTimeout(w),d.classList.remove("show"))}function G(c){C(Me(c))}function K(c){throw G(c),c}let ae=c=>({thread:c,location:pt(c.anchor,s.get(c.id)??je(c.anchor,e.root),e.root)}),q={reply:async(c,b)=>{try{await e.doc.reply(c,b)}catch(O){O instanceof de?C(Mt):K(O)}},resolve:async c=>{try{await e.doc.resolve(c),l.active===c&&!l.showResolved&&(l.active=null),C("Resolved \xB7 Show resolved brings it back")}catch(b){b instanceof de?(l.active===c&&!l.showResolved&&(l.active=null),C(`Resolved \xB7 ${Mt}`)):C(Me(b))}},reopen:async c=>{try{await e.doc.reopen(c),C("Reopened")}catch(b){C(b instanceof de?`Reopened \xB7 ${Mt}`:Me(b))}},close:()=>{ce(null),F&&X(F)?.focus({preventScroll:!0}),F=""},copy:c=>{try{let b=e.doc.threads().find(D=>D.id===c);if(!b)return;let O=gt(ae(b),"ai",location.href,Date.now());Xt(O,n.layer).then(()=>C("Thread copied as Markdown for AI"),D=>C(Me(D)))}catch(b){C(Me(b))}}};function oe(c){let b=O=>s.get(O.id)?.element??null;return[...c].sort((O,D)=>{let V=b(O),ne=b(D);return!V||!ne?V?-1:ne?1:0:V===ne?0:V.compareDocumentPosition(ne)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1})}let le={copyAll:async c=>{let b=le.all(),O=vt(b,c,{title:document.title,url:location.href,exportedAt:new Date});try{await Xt(O,n.layer);let D=b.filter(V=>!V.thread.resolved).length;C(`Copied ${D} thread${D===1?"":"s"}${c==="ai"?" as Markdown for AI":""}`)}catch(D){C(Me(D))}},toggleResolved:()=>{l.showResolved=!l.showResolved,R()},rename:async c=>{let b=c.replace(/\s+/g," ").trim();try{await nt(b)?C(`New comments will say ${b}, but this browser couldn't remember it`):C(`New comments will say ${b}`)}catch(O){C(Me(O))}},name:()=>e.doc.name,all:()=>oe(e.doc.threads()).map(ae)},j={doc:e.doc,root:e.root,layer:n.layer,host:n.element,state:l,resolved:s,pending:a,actions:q,menu:le,visible:c=>!l.hidden&&(!c.resolved||l.showResolved),quoteAt:(c,b)=>{for(let O of e.doc.threads()){let D=s.get(O.id);if(O.anchor.quote&&j.visible(O)&&D?.range&&In(c,b,Ze(D)))return O}return null},readsAt:(c,b)=>j.draftEmpty()?j.quoteAt(c,b):null,owns:c=>c.composedPath().includes(n.element),claim:c=>void p.add(c),open:ce,focusReply:c=>Pe(c),hot:Ct,startDraft:Ve,moveDraft:Oe,draftEmpty:()=>!y||y.isEmpty(),keepCaret:c=>{let b=y?.caret();c(),b?.()},postDraft:g,cancelDraft:Re,setCommenting:Ie,dismiss:Ue,registerDraft:c=>{y=c},toast:C,report:G,pulse:k,render:R};function ee(c){let b=performance.now(),O=e.doc.threads();for(let D of O){if(c&&!c.has(D.id))continue;let V=performance.now()-b<fr,ne=je(D.anchor,e.root,{fuzzy:V});s.set(D.id,ne),!V&&ne.state==="orphaned"?a.add(D.id):a.delete(D.id)}for(let D of[...s.keys()])O.some(V=>V.id===D)||s.delete(D);a.size===0?(window.clearTimeout(T),T=0):T===0&&(T=window.setTimeout(()=>{T=0,!x&&(ee(new Set(a)),R())},hr))}function u(c){let b=[],O=[],D=[];for(let V of c){let ne=s.get(V.id);V.resolved&&!l.showResolved||!ne?.range||(V.id===l.active||V.id===l.hot?O.push(ne.range):V.resolved?D.push(ne.range):b.push(ne.range))}l.draft&&O.push(...l.draft.ranges),Zn({quote:b,on:O,done:D})}let N=0,B=0,U=0;function h(c){if(c===B)return;B=c,cancelAnimationFrame(U);let b=N,O=performance.now(),D=c?260:200,V=ne=>{let rt=Math.min(1,(ne-O)/D);N=b+(c-b)*(c?1-(1-rt)**3:rt*rt),o.fade(N),rt<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let L=0,M=0;function H(c){c!==L&&(L=c,o.room(c,r),window.clearTimeout(M),M=window.setTimeout(()=>{ee(),R()},r?0:400))}function R(){if(x)return;let c=e.doc.threads();l.hidden=!l.commenting&&!l.listing&&!l.reading&&!l.draft,l.hidden&&(l.active=null),h(l.hidden?0:1),n.layer.classList.toggle("hidden",l.hidden),n.layer.classList.toggle("listing",l.listing);let b=l.listing&&!Le();H(b?Je:0),o.gutter(i?l.mode==="column"&&!l.hidden&&!b?tt:0:null),u(c);for(let O of E)O.render(c);f?.render(c)}let F="",X=c=>n.layer.querySelector(`.all .mi[data-thread="${c}"]`),Z="input,textarea,select,[contenteditable]:not([contenteditable=false])",qe=()=>{let c=n.layer.getRootNode().activeElement;return c instanceof HTMLTextAreaElement&&c.value!==""||!!document.activeElement?.matches(Z)};function Pe(c,b=qe()){let O=[...n.layer.querySelectorAll(`[data-thread="${c}"] .rbox textarea`)].find(D=>!D.closest("[inert]"));b||!O||(F=n.layer.getRootNode().activeElement?.getAttribute("data-thread")??"",O.focus({preventScroll:!0}))}function ce(c){if(c&&l.draft&&!j.draftEmpty())return;if(l.active===c&&!l.draft)return c?Pe(c):void 0;let b=qe();c||(l.reading=!1),l.active=c,c&&(l.draft=null,k(c)),R(),c&&Pe(c,b)}function Ct(c){l.hot!==c&&(l.hot=c,c&&c!==l.active&&k(c),R())}function Ve(c){z(),l.listing=!1,l.draft=c,l.active=null,R()}function Oe(c){if(!l.draft)return Ve(c);Object.assign(l.draft,c),R()}function Re(){l.draft&&(l.draft=null,R())}function Ie(c){l.commenting!==c&&(l.commenting=c,o.picking(c),c?(l.active=null,l.listing=!1,C(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${Ge} or Esc to finish`,oo),f=Vn(j)):(z(),f?.destroy(),f=null),R())}function Ue(){if(l.draft){j.draftEmpty()&&Re();return}l.active&&ce(null)}async function nt(c){try{return await e.onName(c),!1}catch(b){if(e.doc.name!==c)throw b;return!0}}async function g(c){let b=l.draft;if(b)try{let O=await e.doc.comment(b.anchor,c);l.draft=null,ee(new Set([O])),ce(O)}catch(O){if(O instanceof de){l.draft=null,ee(new Set([O.id])),ce(O.id),C(Mt);return}K(O)}}function k(c){let b=s.get(c);if(!b||b.state==="orphaned")return;let O=b.range?Ze(b):b.element?[b.element.getBoundingClientRect()]:[];for(let D of O.slice(0,6)){let V=m("div",{class:"pulse"});Fe(V,D,4),n.layer.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function $(){for(let c of E)c.destroy();E=yr(j),R()}let I=()=>{if(!x){for(let c of E)c.frame();f?.frame(),S=requestAnimationFrame(I)}},_=c=>{let b=c.composedPath()[0];return b instanceof Element&&b.closest(Z)!==null},te=c=>{if(c.key==="Escape"){l.draft?Re():l.active?ce(null):f&&!f.back()&&Ie(!1);return}Pn(c)&&!c.isComposing&&!c.defaultPrevented&&!_(c)&&(c.preventDefault(),Ie(!l.commenting))},re=c=>{if(j.owns(c)||p.has(c))return;let b=window.getSelection();b&&!b.isCollapsed||Ue()},se=()=>{let c=ro(e.root,l.mode==="column");c!==l.mode?(l.mode=c,$()):R()};function ze(){let c=performance.now();v===0&&(A=c),window.clearTimeout(v);let b=Math.min(gr,Math.max(0,A+wr-c));v=window.setTimeout(()=>{v=0,ee(),R()},b)}let Ne=new MutationObserver(c=>{c.every(b=>n.element.contains(b.target))||ze()});window.addEventListener("keydown",te),window.addEventListener("click",re),window.addEventListener("resize",se),Ne.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let ot=typeof ResizeObserver>"u"?null:new ResizeObserver(ze);ot?.observe(e.root);let so=e.doc.onChange(()=>{ee(),R()});return ee(),$(),S=requestAnimationFrame(I),{ctx:j,destroy(){x=!0,cancelAnimationFrame(S),cancelAnimationFrame(U),window.clearTimeout(M),window.clearTimeout(w),window.clearTimeout(v),window.clearTimeout(T),Ne.disconnect(),ot?.disconnect(),so(),window.removeEventListener("keydown",te),window.removeEventListener("click",re),window.removeEventListener("resize",se),f?.destroy();for(let c of E)c.destroy();o.remove(),n.destroy()}}}var Ce=null,br=4e3;function Qt(e={}){if(Ce)return Ce;let t=Er(e,()=>t).catch(n=>{throw Ce===t&&(Ce=null),n});return Ce=t,t}function xr(e,t){return new Promise((n,o)=>{let r=setTimeout(()=>o(new Error("timed out")),t);e.then(n,o).finally(()=>clearTimeout(r))})}async function Er(e,t){let n=document.documentElement.getAttribute("data-pipeup-doc"),{id:o,key:r}=n?await it(n):{id:`page-${we(location.origin+location.pathname)}`,key:null},i,s=!1,a;if(e.store)i=e.store,a=await He(i);else try{let f=De.open();i=await xr(f,br).catch(x=>{throw f.then(w=>w.close(),()=>{}),x}),a=await He(i)}catch{i=new Be,s=!0,a=await He(i)}let p=e.name?.trim();p&&p!==a.name&&(a={...a,name:p},await i.saveProfile(a));let l=await $e.open({doc:o,key:r,store:i,identity:a.identity,name:a.name}),d=io({doc:l,root:e.root??document.body,onName:async f=>{l.name=f,a={...a,name:f},await i.saveProfile(a)}});s&&d.ctx.toast("This browser can't keep comments for this page \u2014 copy the comments (Copy all) to keep them");let y=()=>void l.flush().catch(f=>globalThis.reportError?.(f)),E=!1;return window.addEventListener("pagehide",y),{document:l,flush:()=>l.flush(),unmount:()=>{E||(E=!0,window.removeEventListener("pagehide",y),d.destroy(),Ce===t()&&(Ce=null))}}}function ao(){let e=document.documentElement;if(!e.hasAttribute("data-pipeup-doc")||e.getAttribute("data-pipeup-auto")==="off")return;let t=()=>void Qt().catch(n=>console.error(n));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}var kr="0.3.0";typeof document<"u"&&ao();return fo(Tr);})();
|
|
9
|
+
`+t)+(e.edited?" (edited)":"")}function m(e,t={},...n){let o=document.createElement(e);for(let[r,i]of Object.entries(t))i===void 0||i===!1||(r==="class"?o.className=String(i):o.setAttribute(r,i===!0?"":i));for(let r of n)r!=null&&r!==!1&&o.append(r);return o}function J(e,t){let n=e.getRootNode().activeElement;t&&n instanceof HTMLElement&&e.contains(n)&&n.blur(),e.inert=t}function he(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function Fe(e,t,n=4){e.style.left=`${t.left-n}px`,e.style.top=`${t.top-n}px`,e.style.width=`${t.width+n*2}px`,e.style.height=`${t.height+n*2}px`}var Uo=/\bhttps?:\/\/[^\s<>"'`]+/gi,zo=`.,;:!?'"]}`,Ko=2048,Wo=/[\u202A-\u202E\u2066-\u2069]/;function Yo(e){let t=0,n=0;for(let r of e)r==="("?t++:r===")"&&n++;let o=e.length;for(;o>0;){let r=e[o-1];if(r===")"&&n>t)n--;else if(!zo.includes(r))break;o--}return e.slice(0,o)}function yt(e){let t=[],n=0;for(let o of e.matchAll(Uo)){if(o[0].length>Ko||Wo.test(o[0]))continue;let r=Yo(o[0]),i=o.index??0,s;try{let p=new URL(r);if(p.protocol!=="http:"&&p.protocol!=="https:")continue;s=p.href}catch{continue}i>n&&t.push(e.slice(n,i));let a=m("a",{href:s,target:"_blank",rel:"noopener noreferrer"},r);a.addEventListener("click",p=>p.stopPropagation()),t.push(a),n=i+r.length}return n<e.length&&t.push(e.slice(n)),t}var ge={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"}},Cn=typeof navigator<"u"&&/Mac|iP(hone|ad|od)/.test(navigator.platform),Ge=(Cn?ge.mac:ge.other).label,Vt=(Cn?ge.mac:ge.other).aria;function Pn(e){return e.code===ge.code&&e.shiftKey===ge.mods.shift&&e.altKey===ge.mods.alt&&e.metaKey===ge.mods.meta&&e.ctrlKey===ge.mods.ctrl&&!e.repeat&&!e.getModifierState("AltGraph")}var On="http://www.w3.org/2000/svg",jo={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"],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 Y(e,t=15,n){let o=Ut(jo[e],t);return n&&o.setAttribute("stroke-width",String(n)),o}function Ut(e,t){let n=document.createElementNS(On,"svg"),o={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(o))n.setAttribute(r,i);for(let r of e){let i=document.createElementNS(On,"path");i.setAttribute("d",r),n.append(i)}return n}var wt=(e,t,n)=>`M${e} ${t}a${n} ${n} 0 1 0 ${2*n} 0a${n} ${n} 0 1 0 -${2*n} 0`,Go={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${wt(7.4,11.5,1.9)}${wt(12.8,11.5,1.9)}M11.3 14.6l.7 1 .7-1`,Bear:`${wt(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:`${wt(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 Rn(e){let t=/[\p{L}\p{N}]/u.exec(e);if(!t)return"";let n=t[0].toUpperCase();return[...n].length===1?n:t[0]}var Xe=(e,t)=>Rn(t)||ue(e);function Se(e,t){return m("span",{class:`av c${qt(e)}`,"aria-hidden":"true","data-animal":ue(e)},Rn(t)||Ut([Go[ke[_t(e)]]],24))}var Xo=320;function bt(e,t){setTimeout(()=>{e.remove(),t?.()},Xo)}function xt(e){return requestAnimationFrame(()=>{e.offsetWidth,e.classList.add("in")}),e}function Et(e){let t=m("textarea",{class:"input",rows:"1","aria-label":e.label}),n=m("button",{class:"send",type:"button","aria-label":"Send",title:"Send"},Y("send")),o=m("div",{class:"row"},e.before,t,n),r=!1,i=()=>{n.classList.toggle("show",t.value.trim()!==""),t.style.height="auto",t.style.height=`${Math.max(27,t.scrollHeight)}px`},s=async()=>{let a=t.value.trim();if(!(!a||r)){r=!0;try{await e.onSend(a),t.value="",i()}catch{}finally{r=!1}}};return o.addEventListener("mousedown",a=>{a.target===t||n.contains(a.target)||(a.preventDefault(),t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))}),t.addEventListener("input",i),t.addEventListener("keydown",a=>{a.stopPropagation(),a.key==="Enter"&&!a.shiftKey&&!a.isComposing?(a.preventDefault(),s()):a.key==="Escape"&&(a.preventDefault(),t.value="",i(),t.blur(),e.onCancel?.())}),n.addEventListener("click",a=>{a.stopPropagation(),s()}),{element:o,input:t,focus:()=>t.focus({preventScroll:!0}),clear:()=>{t.value="",i()}}}function Zo(e){let t=m("button",{class:"me",type:"button",tabindex:"-1","aria-hidden":"true"});t.addEventListener("mousedown",w=>w.preventDefault());let n=Et({label:"Comment",before:t,onSend:e.onSend,onCancel:e.onCancel}),o=m("div",{class:"say"}),r=m("input",{class:"input",type:"text",maxlength:"80","aria-label":"Your name"}),i=m("div",{class:"nf"},r),s=m("div",{class:"you"},o,i),a="",p=!1,l=()=>{let w=e.name(),v=w?"change":"add your name";if(t.title=w?"Change your name":"Add your name",!t.lastChild||a!==w){let T=Se(e.me,w),S=t.lastChild;S?(xt(T),bt(S)):T.classList.add("in"),t.append(T),a=w}let A=m("button",{type:"button"},v);A.addEventListener("click",y),o.replaceChildren(m("span",{class:"nm"},w||`You're ${ue(e.me)}`)," \xB7 ",A)},d=w=>{s.classList.toggle("naming",w),J(o,w),J(i,!w)};function y(w){w.stopPropagation(),r.value=e.name(),d(!0),r.focus({preventScroll:!0}),r.select()}let E=()=>{d(!1),n.focus()};t.addEventListener("click",y),r.addEventListener("keydown",w=>{if(w.stopPropagation(),w.key==="Escape")w.preventDefault(),E();else if(w.key==="Enter"){w.preventDefault();let v=r.value.trim();if(!v||v===e.name())return E();if(p)return;p=!0,e.rename(v).finally(()=>{p=!1,l(),E()})}}),l(),d(!1);let f=m("div",{class:"ctx"},e.label);return{element:m("div",{class:"draft"},f,n.element,s),caret:()=>{let{selectionStart:w,selectionEnd:v}=n.input;return()=>{n.focus(),n.input.setSelectionRange(w,v)}},hideLabel:w=>{f.hidden=w},setLabel:w=>{f.textContent=w},focus:()=>n.focus(),isEmpty:()=>n.input.value.trim()===""}}function kt(e,t){let n=Zo({label:t.label,me:e.doc.me,name:()=>e.menu.name(),rename:o=>e.menu.rename(o),onSend:o=>e.postDraft(o),onCancel:()=>e.cancelDraft()});return e.registerDraft(n),n}function Tt(e,t){if(t.state==="orphaned"||!t.element||e.quote)return null;let n=t.element.getBoundingClientRect();if(!n.width&&!n.height)return null;if(e.point)return{x:n.left+e.point.x*n.width,y:n.top+e.point.y*n.height};let o=t.element.ownerDocument.createRange();o.selectNodeContents(t.element);let r=o.getBoundingClientRect();return{x:r.width?Math.min(n.right-8,r.right+6):n.right-8,y:(r.height?r.top:n.top)+8}}function Ze(e){return e.range?[...e.range.getClientRects()]:[]}function zt(e,t){let n=Ze(t)[0];if(n)return n.top;if(t.state==="orphaned"||!t.element)return null;let o=t.element.getBoundingClientRect();return e.point?o.top+e.point.y*o.height:o.top}function Qe(e,t){let n=Ze(t).at(-1);if(n)return{x:n.left,y:n.bottom,below:!0};let o=Tt(e,t);return o?{...o,below:!1}:null}function In(e,t,n){for(let o of n)if(e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom)return!0;return!1}function Nn(e,t,n=10){let o=[...e].sort((a,p)=>a.want-p.want),r=new Array(o.length).fill(0),i=o.findIndex(a=>a.id===t),s=a=>o[a];if(i<0)o.forEach((a,p)=>{r[p]=p===0?a.want:Math.max(a.want,(r[p-1]??0)+s(p-1).height+n)});else{r[i]=s(i).want;for(let a=i+1;a<o.length;a++)r[a]=Math.max(s(a).want,(r[a-1]??0)+s(a-1).height+n);for(let a=i-1;a>=0;a--)r[a]=Math.min(s(a).want,(r[a+1]??0)-s(a).height-n)}return new Map(o.map((a,p)=>[a.id,r[p]??0]))}var Je=320,Ae=300,Qo=480,Le=()=>window.innerWidth<=Qo;function St(e){let t=window.innerWidth;return{width:e&&!Le()?t-Je:t,height:window.innerHeight}}function At(e,t,n,o=12){let r,i;return e.below?(r=Math.min(e.x,n.width-t.width-o),i=e.y+8,i+t.height>n.height-o&&(i=e.y-t.height-40)):(r=e.x+14,r+t.width>n.width-o&&(r=e.x-t.width-28),i=Math.min(e.y-12,n.height-t.height-o)),{left:Math.max(o,r),top:Math.max(o,i)}}function $n(e,t,n,o=12,r=44){let i=e.top-r>=8,s=e.top+e.height+8+(i?0:r),a=e.top-8-(i?r:0)-t.height,p=s+t.height<=n.height-o||a<o,l=p?s:a;return{above:!p,left:Math.max(o,Math.min(e.left,n.width-t.width-o)),top:Math.max(o,l)}}function Lt(e,t,n){let o=e.top-t.height-10;return o<8&&(o=e.top+e.height+10),{left:Math.max(8,Math.min(e.left+e.width/2-t.width/2,n.width-t.width-8)),top:o}}var Dn=e=>`${e} ${e===1?"reply":"replies"}`;function _e(e,t,n){let o={...n},r=e.id,i=m("div",{class:"rbox always"},m("div",{},Et({label:"Reply",onSend:v=>t.reply(r,v),onCancel:t.close}).element)),s=m("div",{}),a=m("div",{}),p=null,l=m("div",{},a,m("div",{class:"more"},s)),d=new Map,y=new Map,E=new Map,f=v=>{let A=Xe(v.author,v.name),T=d.get(v.id),S=T?.el;if((!S||T.key!==A)&&(S=xt(Se(v.author,v.name)),T)){let C=T.el;E.set(v.id,C),bt(C,()=>E.get(v.id)===C&&E.delete(v.id))}S.title=ie(v),y.set(v.id,{key:A,el:S});let P=E.get(v.id);return P?[P,S]:[S]},x=(v,A,T)=>{let S=m("button",{class:"ib",type:"button","aria-label":A,title:A},Y(v));return S.addEventListener("click",P=>{P.stopPropagation(),T()}),S};function w(v,A={}){Object.assign(o,A),r=v.id;let T=(o.now??Date.now)(),S=v.root.replies.length,P=q=>m("span",{class:"who"},`${ie(q)} \xB7 ${Te(q.at,T)}`),C=q=>m("div",{class:q.deleted?"tx del":"tx"},...q.deleted?["Deleted"]:[...yt(q.text),q.edited?" (edited)":""]),z=v.resolved?"Resolved"+(S?` \xB7 ${Dn(S)}`:""):S?Dn(S):"",G=m("div",{class:o.variant==="column"&&z?"ft has-rest":"ft"},o.variant==="column"&&z?m("span",{class:"rest"},z):null,m("span",{class:"hover"},P(v.root),m("span",{class:"acts"},x("copy","Copy thread",()=>t.copy(v.id)),v.resolved?x("reopen","Reopen",()=>void t.reopen(v.id)):x("resolve","Resolve",()=>void t.resolve(v.id))))),K=o.lost?m("div",{class:"ctx"},`No longer on the page \u2014 it read \u201C${he(o.lost,120)}\u201D`):o.quote?m("div",{class:"ctx"},`\u201C${he(o.quote,80)}\u201D`):null;y=new Map;let ae=m("div",{class:"root"},...f(v.root),K,C(v.root),G);a.replaceWith(ae),a=ae,p?.remove(),p=S?m("div",{class:"rps"},...v.root.replies.map(q=>m("div",{class:"it"},...f(q),C(q),m("div",{class:"rft"},P(q))))):null,p&&s.prepend(p),d=y,v.resolved?i.remove():i.parentNode!==s&&s.append(i),l.className=v.resolved?"thread resolved":"thread",l.setAttribute("data-thread",v.id)}return w(e),{element:l,update:w}}var Jo="a,button,input,select,textarea,label,summary,[role=button],[contenteditable]",er=400;function Kt(e,t){let n=new Map,o=m("div",{class:"tip",role:"tooltip"}),r=m("div",{class:"mark"}),i=m("div",{class:"pop",role:"dialog","aria-label":"Comment thread"});o.inert=i.inert=!0,e.layer.append(r,o,i);let s=m("div",{class:"bub pin ghost","aria-hidden":"true"}),a=[],p=null,l=null,d=null,y=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,E=0,f=null,x=null,w=null,v=0,A=h=>a.find(L=>L.id===h)??null,T=()=>t.popovers||e.state.listing,S=!1,P=h=>{let L=e.resolved.get(h.id);return L?Qe(h.anchor,L):null};function C(h,L,M){let{left:H,top:R}=At(L,{width:h.offsetWidth||M,height:h.offsetHeight},St(e.state.listing));h.style.left=`${H}px`,h.style.top=`${R}px`}function z(h){let L=h&&T()&&e.state.active!==h?A(h):null,M=L?P(L):null;if(!L||!M){w=null,o.classList.remove("show"),J(o,!0);return}if(w!==L.id){let H=L.root.replies.length;o.replaceChildren(m("div",{class:"tx clamp"},...L.root.deleted?["Deleted"]:yt(L.root.text)),m("div",{class:"who"},`${ie(L.root)}${H?` \xB7 ${H} ${H===1?"reply":"replies"}`:""}`)),w=L.id}C(o,M,260),o.classList.contains("show")||o.offsetWidth,o.classList.add("show"),o.inert=!1}function G(h){f=h,z(h),e.hot(h)}function K(h){if(window.clearTimeout(v),h!==null){G(h);return}v=window.setTimeout(()=>G(null),T()?er:0)}o.addEventListener("mouseenter",()=>window.clearTimeout(v)),o.addEventListener("mouseleave",()=>K(null)),o.addEventListener("click",h=>{h.stopPropagation();let L=w;L&&(window.clearTimeout(v),G(null),e.open(L))});function ae(h){let L=n.get(h.id);if(L)return L;let M=m("button",{class:"bub",type:"button","aria-label":`Comment: ${he(h.root.text,60)}`});return M.addEventListener("mouseenter",()=>K(h.id)),M.addEventListener("mouseleave",()=>K(null)),M.addEventListener("click",H=>{H.stopPropagation(),z(null),e.open(h.id)}),e.layer.insertBefore(M,r),n.set(h.id,M),M}function q(){let h=e.state.draft,L=d&&h&&!h.anchor.quote&&!h.anchor.point?h.resolved.element:null;if(L){let{left:H,top:R,above:F}=$n(L.getBoundingClientRect(),{width:i.offsetWidth||Ae,height:i.offsetHeight},{width:window.innerWidth,height:window.innerHeight}),X=d?.above!==null&&d?.above!==F;if(d&&(d.above=F),X&&le())return;i.style.left=`${H}px`,i.style.top=`${R}px`;return}let M=d&&h?Qe(h.anchor,h.resolved):p?P(p):null;M&&C(i,M,Ae)}let oe=h=>e.state.commenting&&!h.anchor.quote&&!h.anchor.point;function le(){return window.clearTimeout(E),y?(i.classList.remove("show"),E=window.setTimeout(()=>{q(),i.classList.add("show")},220),!0):(i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450),!1)}function j(h){if(window.clearTimeout(E),y){i.classList.remove("show"),E=window.setTimeout(()=>{d?.box.setLabel(h),q(),i.classList.add("show")},220);return}d?.box.setLabel(h),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)}function ee(){if(!T())return null;let h=e.state.draft;return h?h.anchor.quote||h.anchor.point||e.state.commenting?null:h.resolved.element:!p||p.anchor.quote||p.anchor.point?null:e.resolved.get(p.id)?.element??null}function u(h){a=h;let L=new Set;for(let F of h){if(!e.visible(F)||F.anchor.quote)continue;let X=e.resolved.get(F.id);if(!X||X.state==="orphaned")continue;L.add(F.id);let Z=ae(F);Z.classList.toggle("done",F.resolved),Z.classList.toggle("on",e.state.active===F.id),Z.classList.toggle("pin",F.anchor.point!==void 0)}for(let[F,X]of n)L.has(F)||(X.classList.remove("in"),n.delete(F),window.setTimeout(()=>X.remove(),300));z(f),S!==e.state.listing&&i.classList.contains("show")&&!y&&(window.clearTimeout(E),i.classList.add("glide"),E=window.setTimeout(()=>i.classList.remove("glide"),450)),S=e.state.listing;let M=t.popovers?e.state.draft:null;if(M){d?.of!==M?(window.clearTimeout(E),i.classList.remove("glide"),d={box:kt(e,M),of:M,at:M.resolved.element,above:null},d.box.hideLabel(oe(M)),i.replaceChildren(d.box.element),i.inert=!1,d.box.focus(),p=null,l=null,q(),i.classList.add("show")):d&&(d.at!==M.resolved.element&&(d.at=M.resolved.element,d.above=null,j(M.label)),d.box.hideLabel(oe(M)));return}d&&(window.clearTimeout(E),i.classList.remove("glide"),d=null,e.registerDraft(null));let H=T()&&e.state.active?A(e.state.active):null;if(!H||!e.visible(H)){p=null,l=null,i.classList.remove("show"),J(i,!0);return}let R=H.anchor.quote?.exact??null;!p||!l||p.id!==H.id?(l=_e(H,e.actions,{variant:"popover",quote:R}),i.replaceChildren(l.element),p=H,q(),i.classList.add("show"),i.inert=!1):p!==H&&(l.update(H,{quote:R}),p=H)}function N(){for(let[H,R]of n){let F=A(H),X=e.resolved.get(H),Z=F&&X?Tt(F.anchor,X):null;if(!Z||Z.y<-40||Z.y>window.innerHeight+40){R.style.visibility="hidden";continue}R.style.visibility="",R.style.left=`${Z.x}px`,R.style.top=`${Z.y}px`,R.classList.contains("in")||(R.offsetWidth,R.classList.add("in"))}let h=e.state.draft,L=h?.anchor.point?Tt(h.anchor,h.resolved):null;L?(s.style.left=`${L.x}px`,s.style.top=`${L.y}px`,s.classList.contains("in")||(e.layer.insertBefore(s,r),s.offsetWidth,s.classList.add("in"))):s.classList.contains("in")&&(s.classList.remove("in"),window.setTimeout(()=>s.classList.contains("in")||s.remove(),300)),i.classList.contains("show")&&q();let M=ee();r.classList.toggle("show",M!==null),M&&Fe(r,M.getBoundingClientRect(),4)}let B=h=>{if(e.owns(h)){let M=h.composedPath()[0];x!==null&&!(M instanceof Element&&M.closest(".tip,.bub"))&&K(null),x=null;return}let L=e.readsAt(h.clientX,h.clientY)?.id??null;L!==x&&(x=L,K(L))},U=h=>{if(e.owns(h))return;let L=window.getSelection();if(L&&!L.isCollapsed||(e.state.commenting?h.altKey:h.target instanceof Element&&h.target.closest(Jo)))return;let M=e.readsAt(h.clientX,h.clientY);M&&(e.claim(h),z(null),e.open(M.id))};return window.addEventListener("pointermove",B,{capture:!0,passive:!0}),window.addEventListener("click",U,!0),{render:u,frame:N,destroy(){window.clearTimeout(v),window.clearTimeout(E),window.removeEventListener("pointermove",B,!0),window.removeEventListener("click",U,!0),e.registerDraft(null);for(let h of n.values())h.remove();s.remove(),o.remove(),r.remove(),i.remove()}}}var tr="button,a,input,select,textarea,label,summary,details,img,svg,canvas,video,picture,figure,table,th,td,li,p,h1,h2,h3,h4,h5,h6,blockquote,pre";var Bn=(e,t)=>Math.abs(e.left-t.left)<=2&&Math.abs(e.top-t.top)<=2&&Math.abs(e.width-t.width)<=2&&Math.abs(e.height-t.height)<=2;function et(e,t,n){if(e===t||!t.contains(e)||e.closest("[data-pipeup-ignore]"))return null;let o=n.viewport(),r=.6*o.width*o.height,i=null;for(let a=e;a&&a!==t;a=a.parentElement){let p=n.box(a);if(!(p.width<2||p.height<2)){if(a.hasAttribute("data-pipeup-id")){i=a;break}if(!(p.width*p.height>r)&&(a.matches(tr)||n.drawn(a))){i=a;break}}}if(!i||i.hasAttribute("data-pipeup-id"))return i;let s=n.box(i);for(let a=i.parentElement;a&&a!==t&&Bn(n.box(a),s);a=a.parentElement)if(a.hasAttribute("data-pipeup-id"))return a;return i}function Wt(e,t,n){let o=n.box(e);for(let r=e.parentElement;r&&r!==t;){let i=et(r,t,n);if(!i)return null;if(!Bn(n.box(i),o))return i;r=i.parentElement}return null}function Hn(e=window){return{box:t=>t.getBoundingClientRect(),drawn:t=>{let n=e.getComputedStyle(t),o=n.backgroundColor!=="transparent"&&!/,\s*0\)$/.test(n.backgroundColor),r=["top","right","bottom","left"].some(i=>parseFloat(n.getPropertyValue(`border-${i}-width`))>0);return o||r||n.backgroundImage!=="none"||n.boxShadow!=="none"},viewport:()=>({width:e.innerWidth,height:e.innerHeight})}}var qn="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]",nr=`${qn},input,select,textarea,[contenteditable]:not([contenteditable=false]),[tabindex]:not([tabindex="-1"])`,Fn=["click","dblclick","auxclick","submit","contextmenu","dragstart"],_n=[...["over","out","enter","leave","down","up"].flatMap(e=>[`pointer${e}`,`mouse${e}`]),"mousemove","touchstart","touchmove","touchend","touchcancel"],or=400;function Vn(e,t=Hn()){let n=m("div",{class:"pick"});e.layer.append(n);let o=m("span",{class:"lbl"}),r=m("button",{class:"nb",type:"button","aria-label":"Select the block around it",title:"Select the block around it"},Y("expand",16)),i=m("div",{class:"namebar",role:"toolbar","aria-label":"Chosen block"},o,r);i.inert=!0,e.layer.append(i),i.addEventListener("mousedown",u=>u.preventDefault()),r.addEventListener("click",u=>{u.stopPropagation();let N=p&&Wt(p,e.root,t);N&&K(N)});let s=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,a=null,p=null,l=null,d=null,y=0,E=()=>{},f=null,x=()=>{},w=u=>!e.owns(u)&&!(u.target instanceof Element&&u.target.closest("[data-pipeup-ignore]"));function v(){d&&(n.classList.toggle("glide",performance.now()<y),Fe(n,d.getBoundingClientRect(),4))}function A(){if(!f)return;i.classList.toggle("glide",performance.now()<y&&i.classList.contains("show"));let u=f.getBoundingClientRect(),{left:N,top:B}=Lt({left:u.left,top:u.top,width:u.width,height:u.height},{width:i.offsetWidth||200,height:i.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});i.style.left=`${N}px`,i.style.top=`${B}px`}function T(u,N){d=u,y=N?performance.now()+or:0,v(),n.classList.add("show")}function S(u,N){let B=getComputedStyle(u);if(B.opacity==="0")return N(),()=>{};let U=0,h=()=>{window.clearTimeout(U),u.removeEventListener("transitionend",M)},L=()=>{h(),N()},M=R=>{R.target===u&&R.propertyName==="opacity"&&L()},H=Math.max(...B.transitionDuration.split(",").map(R=>parseFloat(R)*1e3||0));return U=window.setTimeout(L,H+100),u.addEventListener("transitionend",M),h}function P(u){if(u!==a){if(a=u,E(),!u){n.classList.remove("show");return}getComputedStyle(n).opacity==="0"?T(u,!1):s?(n.classList.remove("show"),E=S(n,()=>T(u,!1))):T(u,!0)}}function C(u){p=u,n.classList.toggle("on",u!==null),P(u),x(),i.inert=!u,u?s?(i.classList.remove("show"),x=S(i,()=>z(u))):z(u):(i.classList.remove("show"),f=null)}function z(u){o.textContent=o.title=Ee(u);let N=Wt(u,e.root,t)===null;r.hidden=N;let B=i.classList.contains("show");f=u,A(),B||(i.offsetWidth,i.classList.add("show"))}function G(u){let N;try{N=We(u,e.root)}catch(h){e.report(h);return}let B={anchor:N,label:Ee(u),ranges:[],resolved:{state:"attached",element:u,range:null}},U=e.state.draft;C(u),l=U??{...B,ranges:[]},U?e.moveDraft({...B,ranges:[]}):e.startDraft(l)}function K(u){e.keepCaret(()=>G(u))}function ae(u){let N=(u.target instanceof Element?et(u.target,e.root,t):null)??e.root,B=N.getBoundingClientRect();if(!B.width||!B.height)return;let U={x:(u.clientX-B.left)/B.width,y:(u.clientY-B.top)/B.height},h;try{h=We(N,e.root,U)}catch(M){e.report(M);return}let L=Ee(N).replace(/^[A-Z](?=[a-z])/,M=>M.toLowerCase());C(null),P(null),e.startDraft({anchor:h,label:`Pin on ${L}`,ranges:[],resolved:{state:"attached",element:N,range:null}})}function q(u){let N=window.getSelection();if(N&&!N.isCollapsed)return;if(e.state.draft&&(u.altKey||!e.draftEmpty())){e.dismiss();return}if(!u.altKey&&e.readsAt(u.clientX,u.clientY))return;if(e.state.active&&e.open(null),u.altKey){ae(u);return}let B=u.target instanceof Element?et(u.target,e.root,t):null;B?G(B):(e.dismiss(),C(null))}let oe=u=>{if(!e.owns(u)){if(!w(u)){p||P(null);return}u.stopPropagation(),!(p||e.state.draft)&&P(u.target instanceof Element?et(u.target,e.root,t):null)}},le=u=>{w(u)&&(u.stopPropagation(),(u.type==="pointerdown"||u.type==="mousedown")&&u.target instanceof Element&&u.target.closest(nr)&&u.preventDefault())},j=u=>{w(u)&&(u.preventDefault(),u.stopPropagation(),u.type==="click"&&q(u))},ee=u=>{(u.key==="Enter"||u.key===" ")&&w(u)&&u.target instanceof Element&&u.target.closest(qn)&&(u.preventDefault(),u.stopPropagation())};window.addEventListener("pointermove",oe,!0);for(let u of _n)window.addEventListener(u,le,!0);for(let u of Fn)window.addEventListener(u,j,!0);return window.addEventListener("keydown",ee,!0),{back(){return p?(C(null),!0):!1},render(){let u=e.state.draft;l&&u!==l?(l=null,C(null)):u&&!l&&(a||p)&&C(null)},frame(){v(),A()},destroy(){E(),x(),window.removeEventListener("pointermove",oe,!0);for(let u of _n)window.removeEventListener(u,le,!0);for(let u of Fn)window.removeEventListener(u,j,!0);window.removeEventListener("keydown",ee,!0),n.classList.remove("show"),i.classList.remove("show"),J(i,!0),S(n,()=>n.remove()),S(i,()=>i.remove())}}}var rr=300,ir=32,Yt=220,tt=320,ar=24,Un=24;function jt(e,t=!1){let n=e.ownerDocument.documentElement,o=n.getAttribute("data-pipeup-layout");if(o==="bubbles"||e.querySelector("[data-pipeup-slide]"))return null;let r=e.querySelector("article, main, [role=main]")??(o==="column"?e:null);if(!r)return null;if(n.hasAttribute("data-pipeup-reserve")){let a=n.clientWidth,l=getComputedStyle(r).maxWidth,d;return l.endsWith("px")?d=parseFloat(l):l.endsWith("%")?d=parseFloat(l)/100*a:d=r.getBoundingClientRect().width,o!=="column"&&a<d+tt-(t?ar:0)?null:{x:a-tt+Un,width:tt-2*Un}}let i=r.getBoundingClientRect().right;if(window.innerWidth-i<rr&&o!=="column")return null;let s=i+ir;return{x:s,width:Math.max(220,Math.min(300,window.innerWidth-s-16))}}function Gt(e,t){let n=e.resolved.get(t.id);return!n||n.state==="orphaned"&&!e.pending.has(t.id)}function zn(e){let t=m("div",{class:"col"});e.layer.append(t);let n=new Map,o=null,r=new ResizeObserver(()=>a()),i=f=>Gt(e,f);function s(f){let x=e.resolved.get(f.id),w=x?zt(f.anchor,x):null;return w===null?Number.POSITIVE_INFINITY:w+window.scrollY-4}function a(){let f=[],x=[];for(let[S,P]of n){let C=s(P.thread);if(Number.isFinite(C))P.placed=C;else if(e.pending.has(S)){if(P.placed===null){P.el.classList.add("wait");continue}C=P.placed}Number.isFinite(C)?f.push({id:S,want:C,height:P.el.offsetHeight}):x.push({id:S,height:P.el.offsetHeight})}let w=e.state.draft,v=w?zt(w.anchor,w.resolved):null;o&&v!==null&&f.push({id:"draft",want:v+window.scrollY-4,height:o.el.offsetHeight});let A=Nn(f,o?"draft":e.state.active),T=Math.max(0,...f.map(S=>(A.get(S.id)??0)+S.height))+24;for(let S of x)A.set(S.id,T),T+=S.height+10;for(let[S,P]of n){if(P.el.classList.contains("wait")){if(!A.has(S))continue;P.el.style.transition="none",P.el.style.transform=`translateY(${Math.round(A.get(S))}px)`,P.el.offsetWidth,P.el.style.transition="",P.el.classList.remove("wait");continue}P.el.style.transform=`translateY(${Math.round(A.get(S)??0)}px)`}o&&(o.el.style.transform=`translateY(${Math.round(A.get("draft")??0)}px)`)}function p(f,x){f.thread=x,f.lost=i(x),f.view.update(x,{lost:f.lost?x.anchor.snapshot:null})}function l(f){let x=i(f),w=_e(f,e.actions,{variant:"column",lost:x?f.anchor.snapshot:null}),v=m("div",{class:"th","data-thread":f.id},w.element);return v.style.transition="none",v.addEventListener("mouseenter",()=>e.hot(f.id)),v.addEventListener("mouseleave",()=>e.hot(null)),v.addEventListener("click",()=>e.open(f.id)),t.append(v),r.observe(v),{el:v,thread:f,lost:x,placed:null,view:w}}function d(){let f=e.state.draft;if(o&&f&&o.of!==f){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Yt),o=null}if(f&&o&&(o.box.setLabel(f.label),o.box.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point)),f&&!o){let x=kt(e,f),w=m("div",{class:"th on"},x.element);w.style.transition="none",t.append(w),r.observe(w),o={el:w,box:x,of:f},x.hideLabel(e.state.commenting&&!f.anchor.quote&&!f.anchor.point),x.focus()}else if(!f&&o){let x=o.el;r.unobserve(x),x.classList.add("out"),window.setTimeout(()=>x.remove(),Yt),o=null,e.registerDraft(null)}}function y(f){J(t,e.state.listing);let x=new Set,w=[],v=e.state.active!==null||e.state.draft!==null;for(let A of f){if(!e.visible(A))continue;x.add(A.id);let T=n.get(A.id);T?(T.thread!==A||T.lost!==i(A))&&p(T,A):(T=l(A),n.set(A.id,T),w.push(T.el));let S=T.el;S.classList.toggle("on",e.state.active===A.id);let P=S.querySelector(".more");P&&J(P,e.state.active!==A.id),S.classList.toggle("dim",v&&e.state.active!==A.id),S.classList.toggle("hot",e.state.hot===A.id&&e.state.active!==A.id),S.classList.toggle("resolved",A.resolved),S.classList.toggle("lost",T.lost)}for(let[A,T]of n)x.has(A)||(n.delete(A),r.unobserve(T.el),T.el.classList.add("out"),window.setTimeout(()=>T.el.remove(),Yt));d(),a(),o&&w.push(o.el);for(let A of w)A.offsetWidth,A.style.transition=""}function E(){let f=jt(e.root,!0);f&&(t.style.width=`${f.width}px`,t.style.transform=`translate(${f.x}px, ${-window.scrollY}px)`)}return{render:y,frame:E,destroy(){r.disconnect(),e.registerDraft(null),t.remove()}}}var sr="[data-pipeup-ignore],input,textarea,select,[contenteditable]:not([contenteditable=false])";function Kn(e){let t=m("button",{type:"button","aria-label":"Comment",title:"Comment"},Y("comment",17)),n=m("div",{class:"selbar"},t);n.inert=!0,e.layer.append(n);let o=null,r=d=>{let y=d&&(d.nodeType===Node.ELEMENT_NODE?d:d.parentElement);return!!y&&e.root.contains(y)&&!y.closest(sr)};function i(){if(!o)return;let d=o.getBoundingClientRect(),{left:y,top:E}=Lt({left:d.left,top:d.top,width:d.width,height:d.height},{width:n.offsetWidth||36,height:n.offsetHeight||34},{width:window.innerWidth,height:window.innerHeight});n.style.left=`${y}px`,n.style.top=`${E}px`}function s(){o=null,n.inert=!0,n.classList.remove("show")}function a(){let d=window.getSelection();if(!e.state.commenting||!d||d.isCollapsed||d.rangeCount===0||!d.toString().trim()||!r(d.anchorNode)||!r(d.focusNode)){s();return}o=d.getRangeAt(0).cloneRange(),i(),n.inert=!1,n.classList.add("show")}t.addEventListener("mousedown",d=>d.preventDefault()),t.addEventListener("click",d=>{d.stopPropagation();let y=o;if(!y)return;let E;try{E=mt(y,e.root)}catch(x){e.report(x),s();return}let f=he(y.toString().replace(/\s+/g," ").trim(),60);window.getSelection()?.removeAllRanges(),s(),e.startDraft({anchor:E,label:`\u201C${f}\u201D`,ranges:[y],resolved:{state:"attached",element:null,range:y}})});let p=()=>{if(!o)return;let d=window.getSelection();(!d||d.isCollapsed||!d.toString().trim())&&s()};document.addEventListener("selectionchange",p);let l=d=>{e.owns(d)||window.setTimeout(a,0)};return window.addEventListener("mouseup",l,!0),window.addEventListener("keyup",l,!0),{render(){!e.state.commenting&&o&&s()},frame(){o&&i()},destroy(){window.removeEventListener("mouseup",l,!0),window.removeEventListener("keyup",l,!0),document.removeEventListener("selectionchange",p),n.remove()}}}async function Xt(e,t){try{await navigator.clipboard.writeText(e);return}catch{}let n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.cssText="position:fixed;opacity:0;pointer-events:none",t.append(n),n.select();let o=document.execCommand("copy");if(n.remove(),!o)throw new Error("pipeup: your browser blocked copying")}function Wn(e){let t=[m("span",{class:"n"}),m("span",{class:"n"})],n=Y("comment",20,1.4);n.lastElementChild.setAttribute("stroke-width","1.6");let o=m("button",{class:"mode",type:"button","aria-label":"Comment","aria-keyshortcuts":Vt,"aria-haspopup":"menu","aria-expanded":"false"},m("span",{class:"plus"},n),m("span",{class:"cnt"},Y("bubble",34,1.4),...t)),r=m("span",{class:"ttip","aria-hidden":"true"},"Comment",m("small",{},Ge)),i=m("div",{class:"launch"},o,r),s=m("div",{class:"menu",role:"menu","aria-label":"Comments"}),a=m("div",{class:"list",role:"menu","aria-label":"All comments"}),p=m("span",{class:"pn"}),l=m("button",{class:"ib",type:"button","aria-label":"Close"},Y("close")),d=m("button",{class:"hs",type:"button",role:"switch","aria-checked":"false"},"Show resolved",m("span",{class:"sw","aria-hidden":"true"}));d.addEventListener("click",g=>{g.stopPropagation(),e.menu.toggleResolved()});let y=m("div",{class:"all",role:"dialog","aria-label":"All comments"},m("div",{class:"hd"},m("span",{},"All comments"),p,d,l),a),E=m("div",{class:"pop side",role:"dialog","aria-label":"Comment thread"});s.inert=y.inert=E.inert=!0,e.layer.append(s,i,y);let f=!1,x=!1,w=[],v=!1,A=0,T=null,S=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,P=g=>{f=g,g||x&&(x=!1,Oe()),s.classList.toggle("show",g),J(s,!g),o.setAttribute("aria-expanded",String(g))},C=(g,k=!1)=>{e.state.listing!==g&&(e.state.listing=g,e.render(),g?(z(a)[0]??l).focus({preventScroll:!0}):k&&o.focus({preventScroll:!0}))},z=(g=s)=>[...g.querySelectorAll(".mi")],G=()=>s.getRootNode().activeElement,K=()=>{P(!1),o.focus({preventScroll:!0})},ae=()=>{x=!1,Oe(),F.focus({preventScroll:!0})},q=g=>{let k=z(g.currentTarget);if(k.length===0)return;let $=G(),I=k.indexOf($),_=te=>{g.preventDefault(),k[(te+k.length)%k.length]?.focus({preventScroll:!0})};g.key==="ArrowDown"?_(I+1):g.key==="ArrowUp"?_(I<0?k.length-1:I-1):g.key==="Home"?_(0):g.key==="End"&&_(k.length-1)};s.addEventListener("keydown",q),a.addEventListener("keydown",q),l.addEventListener("click",g=>{g.stopPropagation(),C(!1,!0)});let oe=g=>Gt(e,g),le=()=>w.filter(g=>!g.resolved).length;function j(){let g=z(a).indexOf(G()),k=e.menu.all().filter(re=>!re.thread.resolved||e.state.showResolved),$=re=>{let se=re.thread,ze=Se(se.root.author,se.root.name);ze.classList.add("in");let Ne=m("button",{class:se.resolved?"mi done":"mi",type:"button",role:"menuitem","data-thread":se.id},ze,m("span",{},m("span",{class:"clamp"},se.root.deleted?"Deleted":se.root.text),m("small",{},oe(se)?`\u201C${he(se.anchor.snapshot,80)}\u201D`:re.location.where)));return Ne.addEventListener("click",ot=>{ot.stopPropagation(),ee(se.id,Ne.getBoundingClientRect().top)}),Ne},I=k.filter(re=>oe(re.thread)),_="No longer on the page";p.textContent=String(le()),d.setAttribute("aria-checked",String(e.state.showResolved)),a.replaceChildren(k.length?"":m("div",{class:"sec",role:"presentation"},"No open comments"),...k.filter(re=>!oe(re.thread)).map($),I.length?m("div",{role:"group","aria-label":_},m("div",{class:"sec","aria-hidden":"true"},_),...I.map($)):"");let te=z(a);g>=0&&te[Math.min(g,te.length-1)]?.focus({preventScroll:!0})}function ee(g,k){Le()&&(e.state.reading=!0,C(!1)),u(g,k)}function u(g,k){let $=w.find(te=>te.id===g),I=e.resolved.get(g);if(!$)return;let _=I&&!oe($)?I.element??I.range?.startContainer.parentElement??null:null;if(_?.scrollIntoView({block:"center",inline:"nearest",behavior:S?"auto":"smooth"}),_&&I&&Qe($.anchor,I)&&_.checkVisibility?.({visibilityProperty:!0})!==!1){B(),e.open(g);return}e.open(null),Le()&&(e.state.reading=!0,e.render()),N($,k)}function N(g,k){let $={quote:g.anchor.quote?.exact??null,lost:oe(g)?g.anchor.snapshot:null};if(T?.id===g.id?T.view.update(g,$):(T={id:g.id,view:_e(g,e.actions,{variant:"popover",...$})},E.replaceChildren(T.view.element)),k===void 0)return;E.isConnected||(e.layer.insertBefore(E,y),E.offsetWidth);let I=St(e.state.listing),{left:_,top:te}=At({x:I.width,y:k,below:!1},{width:Ae,height:E.offsetHeight},I);E.style.left=`${_}px`,E.style.top=`${te}px`,E.classList.add("show"),E.inert=!1,e.focusReply(g.id)}function B(g=!1){T&&(T=null,E.classList.remove("show"),J(E,!0),g&&e.state.reading&&(e.state.reading=!1,e.render()))}function U(g,k,$,I=!1,..._){let te=m("button",{class:"mi",type:"button",role:I?"menuitemcheckbox":"menuitem"},g,m("span",{class:"lb"},k),..._,I&&m("span",{class:"sw","aria-hidden":"true"}),m("span",{class:"tt","aria-hidden":"true"}));return te.addEventListener("click",re=>{re.stopPropagation(),$()}),te}let h=(g,k,$,I)=>{let _=g.querySelector(".lb");_.textContent!==k&&(_.textContent=k),g.querySelector(".tt").textContent=$,g.setAttribute("aria-description",$),I!==void 0&&g.setAttribute("aria-checked",String(I))},L=()=>m("div",{class:"sep",role:"separator"}),M=m("span",{class:"ma"}),H=m("span",{class:"kc"}),R="",F=U(M,"",()=>{x=!0,Oe()},!1,H);F.dataset.item="name";let X=U(Y("copy"),"Copy all",()=>{K(),e.menu.copyAll("ai")}),Z=U(Y("lines"),"Copy all as text",()=>{K(),e.menu.copyAll("text")}),qe=m("span",{class:"kc"}),Pe=U(Y("list"),"All comments",()=>{P(!1),C(!0)},!1,qe),ce=U(Y("comment"),"Start commenting",()=>{K(),e.setCommenting(!e.state.commenting)},!0,m("span",{class:"kc","aria-hidden":"true"},Ge));ce.dataset.item="comment",ce.setAttribute("aria-keyshortcuts",Vt);let Ct=[F,L(),X,Z,Pe,L(),ce];function Ve(){let g=le(),k=e.menu.name(),$=k||ue(e.doc.me);if(h(F,$,k?"The name on your comments":"Add a name to show on your comments"),F.setAttribute("aria-label",`${$}, ${k?"edit":"add"} your name`),H.replaceChildren(k?Y("edit",13):"Add name"),Xe(e.doc.me,k)!==R){R=Xe(e.doc.me,k);let I=Se(e.doc.me,k);I.classList.add("in"),M.replaceChildren(I)}h(X,"Copy all","Markdown, with where each thread is"),h(Z,"Copy all as text","Just the words"),h(Pe,"All comments","Every thread, and where it is"),qe.textContent=g?String(g):"",h(ce,"Start commenting",e.state.commenting?"Turn off to hide the comments again":"Shows the comments; choose any part of the page to comment on it",e.state.commenting)}function Oe(){if(x){let g=m("textarea",{class:"input",rows:"1","aria-label":"Your name"});g.value=e.menu.name(),g.addEventListener("keydown",k=>{if(k.stopPropagation(),k.key==="Enter"){k.preventDefault();let $=g.value.trim();$&&e.menu.rename($).then(ae)}else k.key==="Escape"&&ae()}),s.replaceChildren(m("label",{class:"name"},"Your name",g)),g.focus({preventScroll:!0});return}Ve(),s.firstChild!==F&&s.replaceChildren(...Ct)}o.addEventListener("click",g=>{if(g.stopPropagation(),f){P(!1);return}Oe(),P(!0),g.detail===0&&z().at(-1)?.focus({preventScroll:!0})});let Re=!1,Ie=()=>{Re=y.contains(G())},Ue=g=>{let k=g.composedPath();f&&!k.includes(s)&&!k.includes(o)&&P(!1),e.state.listing&&!e.owns(g)&&C(!1,Re&&(!document.activeElement||document.activeElement===document.body)),!k.includes(E)&&!k.includes(y)&&B(!0)};window.addEventListener("pointerdown",Ie,!0),window.addEventListener("click",Ue,!0);let nt=g=>{if(g.key!=="Escape"||x)return;let k=g.composedPath()[0];if(f)K();else if(e.state.listing&&!(k instanceof HTMLTextAreaElement&&!y.contains(k)))C(!1,!0);else if(T)B(!0),e.actions.close();else return;g.stopPropagation()};return window.addEventListener("keydown",nt,!0),{render(g){w=g;let k=le();if(k!==A){if(k){let[I,_]=t[0].classList.contains("on")?t:[t[1],t[0]];_.textContent=k>99?"99+":String(k),_.classList.toggle("s",k>99),I.classList.remove("on"),_.classList.add("on")}o.classList.toggle("has",k>0),o.setAttribute("aria-label",k?`Comment, ${k} open`:"Comment"),A=k}e.state.commenting&&!v&&f&&K(),v=e.state.commenting,o.classList.toggle("on",v),f&&!x&&Ve();let $=e.state.listing;if(y.classList.toggle("full",Le()),y.classList.contains("show")!==$&&(y.classList.toggle("show",$),J(y,!$)),$&&j(),T){let I=g.find(_=>_.id===T?.id);!I||e.state.active||I.resolved&&!e.state.showResolved?B():N(I)}},frame(){},destroy(){window.removeEventListener("pointerdown",Ie,!0),window.removeEventListener("click",Ue,!0),window.removeEventListener("keydown",nt,!0),s.remove(),y.remove(),E.remove(),i.remove()}}}var jn=["pipeup-quote","pipeup-on","pipeup-done"],lr={"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]]},cr=(e,t)=>jn.map(n=>{let[o,r,i,s]=lr[n][e?1:0];return`::highlight(${n}){background-color:rgba(${o},${r},${i},${+(s*t).toFixed(3)})}`}).join("");function Gn(){return typeof CSS<"u"&&"highlights"in CSS&&typeof Highlight<"u"}var pr="<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>",dr=`:not([data-pipeup-ignore],[data-pipeup-ignore] *){cursor:url("data:image/svg+xml,${encodeURIComponent(pr)}") 3 2,crosshair!important}`;function Xn(e=document,t=!1){let n=e.defaultView?.CSSStyleSheet;if(!n||!("replaceSync"in n.prototype)||!("adoptedStyleSheets"in e))return{gutter(){},picking(){},fade(){},room(){},remove:()=>Yn()};let o=new n,r=null,i=!1,s=1,a=0,p="",l=0,d=()=>o.replaceSync(cr(t,s)+(r===null?"":`:root{--pipeup-gutter:${r}px}`)+(i?dr:"")+(a||p?`html{${a?`margin-right:${a}px!important;`:""}${p}}`:""));return d(),e.adoptedStyleSheets=[...e.adoptedStyleSheets,o],{gutter(y){y!==r&&(r=y,d())},picking(y){y!==i&&(i=y,d())},fade(y){s=y,d()},room(y,E){y!==a&&(a=y,p=E?"":"transition:margin-right .34s cubic-bezier(.4,0,.2,1)!important",clearTimeout(l),!y&&p&&(l=window.setTimeout(()=>{p="",d()},400)),d())},remove(){clearTimeout(l),e.adoptedStyleSheets=e.adoptedStyleSheets.filter(y=>y!==o),Yn()}}}function Zn(e){Gn()&&(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 Yn(){if(Gn())for(let e of jn)CSS.highlights.delete(e)}var Zt=':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(--pu-ink);--pu-ink:#2C2C2A;--pu-muted:#5F5E5A;--pu-faint:#888780;--pu-line:#E5E3DA;--pu-rule:#ECEAE2;--pu-soft:#FAFAF7;--pu-surface:#FFFFFF;--pu-hover:#F1EFE8;--pu-accent-soft:color-mix(in srgb,var(--pu-accent,#534AB7) 12%,transparent);--pu-shadow:0 8px 28px rgba(44,44,42,.1);--pu-enter:.26s;--pu-move:.34s;--pu-exit:.2s;--pu-pulse:1.2s;--pu-eo:cubic-bezier(.22,.61,.36,1);--pu-eio:cubic-bezier(.4,0,.2,1);--pu-ei:cubic-bezier(.4,0,1,1)}.layer.dark{--pu-ink:#ECEBE6;--pu-muted:#B4B2A9;--pu-faint:#8D8B84;--pu-line:#3A3936;--pu-rule:#34332F;--pu-soft:#22221F;--pu-surface:#1B1B19;--pu-hover:#2C2C29;--pu-shadow: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(--pu-ink);white-space:pre-wrap;overflow-wrap:anywhere}.tx.del,.who,.rest,.ctx{color:var(--pu-faint)}.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(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.ft .rest{transition:opacity var(--pu-enter) var(--pu-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(--pu-muted);transition:background-color .2s var(--pu-eo),color .2s var(--pu-eo)}.ib:hover,.ib:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.rps,.rbox{padding-left:14px}.rps .it{padding-top:6px}.more{display:grid;grid-template-rows:1fr;transition:grid-template-rows var(--pu-move) var(--pu-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(--pu-line);outline:none;resize:none;overflow:hidden;font:inherit;font-size:14px;line-height:1.5;padding:3px 0;color:var(--pu-ink);background:transparent;transition:border-color var(--pu-enter) var(--pu-eo)}.row:hover .input,.input:hover{border-bottom-color:var(--pu-muted)}.input:focus{border-bottom-color:var(--pu-accent)}.name{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--pu-faint);padding-top:6px}.name .input{font-size:13px;height:24px}.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(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-faint)}.you>*{grid-area:1/1;display:flex;align-items:center;min-width:0;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-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(--pu-muted);text-decoration:underline;text-decoration-color:var(--pu-line);text-underline-offset:2px;transition:color .2s var(--pu-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(--pu-enter) var(--pu-eo),background-color .2s var(--pu-eo)}.send.show{opacity:1;pointer-events:auto}.send:hover{background:var(--pu-accent-soft)}.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(--pu-surface);box-shadow:0 1px 4px #0003;pointer-events:auto;opacity:0;transform:translateY(-6px) scale(.9);transform-origin:2px 20px;transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.bub.in{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-enter) var(--pu-eo)}.bub.in:hover,.bub.on{transform:scale(1.18)}.bub.done{background:var(--pu-faint)}.bub.ghost{pointer-events:none}.tip,.pop,.menu,.all,.toast,.selbar{background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow)}.tip{position:fixed;max-width:260px;border-radius:10px;padding:7px 10px;opacity:0;transform:translateY(3px);transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo)}.tip.show{opacity:1;transform:none;pointer-events:auto;cursor:pointer;transition:opacity .22s var(--pu-eo),transform .26s var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.pop.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo)}.pop.show.glide{transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-eo),left var(--pu-move) var(--pu-eio),top var(--pu-move) var(--pu-eio)}.mark{position:fixed;border:2px solid color-mix(in srgb,var(--pu-accent) 50%,transparent);background:var(--pu-accent-soft);border-radius:8px;opacity:0;transition:opacity .3s var(--pu-eo)}.mark.show{opacity:1}.pulse{position:fixed;border:2px solid var(--pu-accent);border-radius:8px;background:var(--pu-accent-soft);animation:pu-pulse var(--pu-pulse) var(--pu-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(--pu-enter) var(--pu-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(--pu-move) var(--pu-eio),box-shadow var(--pu-enter) var(--pu-eo),opacity var(--pu-enter) var(--pu-eo)}.th.hot{box-shadow:inset 2px 0 0 var(--pu-line)}.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(--pu-exit) var(--pu-ei)}.selbar{position:fixed;display:flex;border-radius:10px;padding:2px;opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-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(--pu-eo)}.selbar button:hover,.selbar button:focus-visible{background:var(--pu-accent-soft);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(--pu-exit) var(--pu-ei),border-color var(--pu-exit) var(--pu-ei)}.pick.show{opacity:1;transition-duration:var(--pu-enter);transition-timing-function:var(--pu-eo)}.pick.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-eio)}.pick.on{border-color:var(--pu-accent)}.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(--pu-muted);white-space:nowrap;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(4px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.namebar.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform .3s var(--pu-eo)}.namebar.show.glide{transition-property:all;transition-duration:var(--pu-move);transition-timing-function:var(--pu-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(--pu-eo),color .2s var(--pu-eo)}.namebar .nb:hover,.namebar .nb:focus-visible{background:var(--pu-hover);color:var(--pu-ink);outline:none}.namebar .nb[hidden]{display:none}.launch{position:fixed;right:20px;bottom:20px;pointer-events:auto}.launch .mode{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);transition:background-color .3s var(--pu-eo),color .3s var(--pu-eo)}.mode>*,.cnt>*{grid-area:1/1}.mode>*{display:grid;place-items:center;transition:opacity var(--pu-enter) var(--pu-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(--pu-enter) var(--pu-eo)}.n.s{font-size:9.5px;letter-spacing:-.04em}.n.on{opacity:1}.launch .mode:hover,.launch .mode[aria-expanded=true]{background:var(--pu-hover)}.launch .mode.on{background:var(--pu-accent);color:#fff}.ttip{position:absolute;right:0;bottom:54px;white-space:nowrap;border-radius:8px;padding:4px 9px;font-size:12px;background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translateY(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.ttip small{margin-left:8px}.ttip small,.mi .kc{font-size:12px;color:var(--pu-faint)}.mode:hover+.ttip,.mode:focus-visible+.ttip{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-eo) .5s}.launch .mode[aria-expanded=true]+.ttip{opacity:0;transition:opacity var(--pu-exit) var(--pu-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(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.menu.show{opacity:1;transform:none;pointer-events:auto;transition:opacity var(--pu-enter) var(--pu-eo),transform var(--pu-move) var(--pu-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(--pu-eo)}.mi:hover,.mi:focus-visible{background:var(--pu-soft);outline:none}.mi svg{color:var(--pu-muted);flex:none}.mi small{display:block;color:var(--pu-faint);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(--pu-rule)}.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(--pu-muted);background:var(--pu-surface);border:1px solid var(--pu-line);box-shadow:var(--pu-shadow);pointer-events:none;opacity:0;transform:translate(3px);transition:opacity var(--pu-exit) var(--pu-ei),transform var(--pu-exit) var(--pu-ei)}.mi:hover>.tt,.mi:focus-visible>.tt{opacity:1;transform:none;transition:opacity var(--pu-enter) var(--pu-eo) .5s,transform var(--pu-enter) var(--pu-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(--pu-line);transition:background-color var(--pu-move) var(--pu-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(--pu-move) var(--pu-eio),opacity var(--pu-move) var(--pu-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(--pu-exit) var(--pu-ei),opacity var(--pu-exit) var(--pu-ei)}.all.show{opacity:1;transform:none;pointer-events:auto;transition:transform var(--pu-move) var(--pu-eo),opacity var(--pu-enter) var(--pu-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(--pu-faint)}.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(--pu-muted);transition:background-color .2s var(--pu-eo)}.hs:hover,.hs:focus-visible{background:var(--pu-hover);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(--pu-exit) var(--pu-ei)}.sec{padding:8px 10px 2px;font-size:12px;color:var(--pu-faint)}.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(--pu-eo),transform .36s var(--pu-eo)}.toast.show{opacity:1;transform:translate(-50%)}@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 Qn="#534AB7",ur="rgb(0, 0, 238)";function Jn(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 n=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:n}}function mr(e){let t=n=>{let o=n/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function eo(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{font:"system-ui, sans-serif",accent:Qn,dark:!1};let o=t.documentElement,r=n.getComputedStyle(e).fontFamily||"system-ui, sans-serif",i=(n.getComputedStyle(o).getPropertyValue("--pipeup-accent")||o.style.getPropertyValue("--pipeup-accent")).trim(),s=e.querySelector("a[href]"),a=s?n.getComputedStyle(s).color:"",p=i||(a&&a!==ur?a:Qn),l=Jn(n.getComputedStyle(t.body).backgroundColor);(!l||l.a===0)&&(l=Jn(n.getComputedStyle(o).backgroundColor));let d=l&&l.a>0?mr(l)<.2:n.matchMedia?.("(prefers-color-scheme: dark)").matches===!0&&/dark/.test(n.getComputedStyle(o).colorScheme||"");return{font:r,accent:p,dark:!!d}}function to(e,t){e.style.setProperty("--pu-font",t.font),e.style.setProperty("--pu-accent",t.accent),e.classList.toggle("dark",t.dark)}function no(e,t=document){let n=t.createElement("pipeup-root");n.setAttribute("data-pipeup-ignore",""),n.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 o=n.attachShadow({mode:"open"}),r=t.defaultView?.CSSStyleSheet;if(r&&"replaceSync"in r.prototype&&"adoptedStyleSheets"in o){let s=new r;s.replaceSync(Zt),o.adoptedStyleSheets=[s]}else{let s=t.createElement("style");s.textContent=Zt,o.append(s)}let i=t.createElement("div");return i.className="layer",i.style.setProperty("--pu-panel",`${Je}px`),i.style.setProperty("--pu-pop",`${Ae}px`),to(i,e),o.append(i),t.documentElement.append(n),{element:n,shadow:o,layer:i,destroy:()=>n.remove()}}var fr=40,hr=250,gr=120,vr=2400,oo=4e3;function ro(e,t=!1){return jt(e,t)?"column":"bubbles"}function yr(e){return[...e.state.mode==="column"?[zn(e),Kt(e,{popovers:!1})]:[Kt(e,{popovers:!0})],Kn(e),Wn(e)]}var wr=1e3,Mt="Shown here, but not saved yet \u2014 it will be saved with your next change",Me=e=>e instanceof Error?e.message.replace(/^pipeup: /,""):"Something went wrong";function io(e){let t=eo(e.root),n=no(t),o=Xn(document,t.dark);o.fade(0);let r=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,i=document.documentElement.hasAttribute("data-pipeup-reserve"),s=new Map,a=new Set,p=new WeakSet,l={active:null,hot:null,showResolved:!1,hidden:!0,mode:ro(e.root),draft:null,commenting:!1,listing:!1,reading:!1},d=m("div",{class:"toast",role:"status","aria-live":"polite"});n.layer.append(d);let y=null,E=[],f=null,x=!1,w=0,v=0,A=0,T=0,S=0,P=!1;function C(c,b=vr){x||(P=b===oo,d.textContent=c,d.classList.add("show"),window.clearTimeout(w),w=window.setTimeout(()=>d.classList.remove("show"),b))}function z(){P&&(P=!1,window.clearTimeout(w),d.classList.remove("show"))}function G(c){C(Me(c))}function K(c){throw G(c),c}let ae=c=>({thread:c,location:pt(c.anchor,s.get(c.id)??je(c.anchor,e.root),e.root)}),q={reply:async(c,b)=>{try{await e.doc.reply(c,b)}catch(O){O instanceof de?C(Mt):K(O)}},resolve:async c=>{try{await e.doc.resolve(c),l.active===c&&!l.showResolved&&(l.active=null),C("Resolved \xB7 Show resolved brings it back")}catch(b){b instanceof de?(l.active===c&&!l.showResolved&&(l.active=null),C(`Resolved \xB7 ${Mt}`)):C(Me(b))}},reopen:async c=>{try{await e.doc.reopen(c),C("Reopened")}catch(b){C(b instanceof de?`Reopened \xB7 ${Mt}`:Me(b))}},close:()=>{ce(null),F&&X(F)?.focus({preventScroll:!0}),F=""},copy:c=>{try{let b=e.doc.threads().find(D=>D.id===c);if(!b)return;let O=gt(ae(b),"ai",location.href,Date.now());Xt(O,n.layer).then(()=>C("Thread copied as Markdown for AI"),D=>C(Me(D)))}catch(b){C(Me(b))}}};function oe(c){let b=O=>s.get(O.id)?.element??null;return[...c].sort((O,D)=>{let V=b(O),ne=b(D);return!V||!ne?V?-1:ne?1:0:V===ne?0:V.compareDocumentPosition(ne)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1})}let le={copyAll:async c=>{let b=le.all(),O=vt(b,c,{title:document.title,url:location.href,exportedAt:new Date});try{await Xt(O,n.layer);let D=b.filter(V=>!V.thread.resolved).length;C(`Copied ${D} thread${D===1?"":"s"}${c==="ai"?" as Markdown for AI":""}`)}catch(D){C(Me(D))}},toggleResolved:()=>{l.showResolved=!l.showResolved,R()},rename:async c=>{let b=c.replace(/\s+/g," ").trim();try{await nt(b)?C(`New comments will say ${b}, but this browser couldn't remember it`):C(`New comments will say ${b}`)}catch(O){C(Me(O))}},name:()=>e.doc.name,all:()=>oe(e.doc.threads()).map(ae)},j={doc:e.doc,root:e.root,layer:n.layer,host:n.element,state:l,resolved:s,pending:a,actions:q,menu:le,visible:c=>!l.hidden&&(!c.resolved||l.showResolved),quoteAt:(c,b)=>{for(let O of e.doc.threads()){let D=s.get(O.id);if(O.anchor.quote&&j.visible(O)&&D?.range&&In(c,b,Ze(D)))return O}return null},readsAt:(c,b)=>j.draftEmpty()?j.quoteAt(c,b):null,owns:c=>c.composedPath().includes(n.element),claim:c=>void p.add(c),open:ce,focusReply:c=>Pe(c),hot:Ct,startDraft:Ve,moveDraft:Oe,draftEmpty:()=>!y||y.isEmpty(),keepCaret:c=>{let b=y?.caret();c(),b?.()},postDraft:g,cancelDraft:Re,setCommenting:Ie,dismiss:Ue,registerDraft:c=>{y=c},toast:C,report:G,pulse:k,render:R};function ee(c){let b=performance.now(),O=e.doc.threads();for(let D of O){if(c&&!c.has(D.id))continue;let V=performance.now()-b<fr,ne=je(D.anchor,e.root,{fuzzy:V});s.set(D.id,ne),!V&&ne.state==="orphaned"?a.add(D.id):a.delete(D.id)}for(let D of[...s.keys()])O.some(V=>V.id===D)||s.delete(D);a.size===0?(window.clearTimeout(T),T=0):T===0&&(T=window.setTimeout(()=>{T=0,!x&&(ee(new Set(a)),R())},hr))}function u(c){let b=[],O=[],D=[];for(let V of c){let ne=s.get(V.id);V.resolved&&!l.showResolved||!ne?.range||(V.id===l.active||V.id===l.hot?O.push(ne.range):V.resolved?D.push(ne.range):b.push(ne.range))}l.draft&&O.push(...l.draft.ranges),Zn({quote:b,on:O,done:D})}let N=0,B=0,U=0;function h(c){if(c===B)return;B=c,cancelAnimationFrame(U);let b=N,O=performance.now(),D=c?260:200,V=ne=>{let rt=Math.min(1,(ne-O)/D);N=b+(c-b)*(c?1-(1-rt)**3:rt*rt),o.fade(N),rt<1&&(U=requestAnimationFrame(V))};U=requestAnimationFrame(V)}let L=0,M=0;function H(c){c!==L&&(L=c,o.room(c,r),window.clearTimeout(M),M=window.setTimeout(()=>{ee(),R()},r?0:400))}function R(){if(x)return;let c=e.doc.threads();l.hidden=!l.commenting&&!l.listing&&!l.reading&&!l.draft,l.hidden&&(l.active=null),h(l.hidden?0:1),n.layer.classList.toggle("hidden",l.hidden),n.layer.classList.toggle("listing",l.listing);let b=l.listing&&!Le();H(b?Je:0),o.gutter(i?l.mode==="column"&&!l.hidden&&!b?tt:0:null),u(c);for(let O of E)O.render(c);f?.render(c)}let F="",X=c=>n.layer.querySelector(`.all .mi[data-thread="${c}"]`),Z="input,textarea,select,[contenteditable]:not([contenteditable=false])",qe=()=>{let c=n.layer.getRootNode().activeElement;return c instanceof HTMLTextAreaElement&&c.value!==""||!!document.activeElement?.matches(Z)};function Pe(c,b=qe()){let O=[...n.layer.querySelectorAll(`[data-thread="${c}"] .rbox textarea`)].find(D=>!D.closest("[inert]"));b||!O||(F=n.layer.getRootNode().activeElement?.getAttribute("data-thread")??"",O.focus({preventScroll:!0}))}function ce(c){if(c&&l.draft&&!j.draftEmpty())return;if(l.active===c&&!l.draft)return c?Pe(c):void 0;let b=qe();c||(l.reading=!1),l.active=c,c&&(l.draft=null,k(c)),R(),c&&Pe(c,b)}function Ct(c){l.hot!==c&&(l.hot=c,c&&c!==l.active&&k(c),R())}function Ve(c){z(),l.listing=!1,l.draft=c,l.active=null,R()}function Oe(c){if(!l.draft)return Ve(c);Object.assign(l.draft,c),R()}function Re(){l.draft&&(l.draft=null,R())}function Ie(c){l.commenting!==c&&(l.commenting=c,o.picking(c),c?(l.active=null,l.listing=!1,C(`Click anything to comment \xB7 Option-click (Alt-click) to pin \xB7 ${Ge} or Esc to finish`,oo),f=Vn(j)):(z(),f?.destroy(),f=null),R())}function Ue(){if(l.draft){j.draftEmpty()&&Re();return}l.active&&ce(null)}async function nt(c){try{return await e.onName(c),!1}catch(b){if(e.doc.name!==c)throw b;return!0}}async function g(c){let b=l.draft;if(b)try{let O=await e.doc.comment(b.anchor,c);l.draft=null,ee(new Set([O])),ce(O)}catch(O){if(O instanceof de){l.draft=null,ee(new Set([O.id])),ce(O.id),C(Mt);return}K(O)}}function k(c){let b=s.get(c);if(!b||b.state==="orphaned")return;let O=b.range?Ze(b):b.element?[b.element.getBoundingClientRect()]:[];for(let D of O.slice(0,6)){let V=m("div",{class:"pulse"});Fe(V,D,4),n.layer.prepend(V),window.setTimeout(()=>V.remove(),1300)}}function $(){for(let c of E)c.destroy();E=yr(j),R()}let I=()=>{if(!x){for(let c of E)c.frame();f?.frame(),S=requestAnimationFrame(I)}},_=c=>{let b=c.composedPath()[0];return b instanceof Element&&b.closest(Z)!==null},te=c=>{if(c.key==="Escape"){l.draft?Re():l.active?ce(null):f&&!f.back()&&Ie(!1);return}Pn(c)&&!c.isComposing&&!c.defaultPrevented&&!_(c)&&(c.preventDefault(),Ie(!l.commenting))},re=c=>{if(j.owns(c)||p.has(c))return;let b=window.getSelection();b&&!b.isCollapsed||Ue()},se=()=>{let c=ro(e.root,l.mode==="column");c!==l.mode?(l.mode=c,$()):R()};function ze(){let c=performance.now();v===0&&(A=c),window.clearTimeout(v);let b=Math.min(gr,Math.max(0,A+wr-c));v=window.setTimeout(()=>{v=0,ee(),R()},b)}let Ne=new MutationObserver(c=>{c.every(b=>n.element.contains(b.target))||ze()});window.addEventListener("keydown",te),window.addEventListener("click",re),window.addEventListener("resize",se),Ne.observe(e.root,{subtree:!0,childList:!0,characterData:!0});let ot=typeof ResizeObserver>"u"?null:new ResizeObserver(ze);ot?.observe(e.root);let so=e.doc.onChange(()=>{ee(),R()});return ee(),$(),S=requestAnimationFrame(I),{ctx:j,destroy(){x=!0,cancelAnimationFrame(S),cancelAnimationFrame(U),window.clearTimeout(M),window.clearTimeout(w),window.clearTimeout(v),window.clearTimeout(T),Ne.disconnect(),ot?.disconnect(),so(),window.removeEventListener("keydown",te),window.removeEventListener("click",re),window.removeEventListener("resize",se),f?.destroy();for(let c of E)c.destroy();o.remove(),n.destroy()}}}var Ce=null,br=4e3;function Qt(e={}){if(Ce)return Ce;let t=Er(e,()=>t).catch(n=>{throw Ce===t&&(Ce=null),n});return Ce=t,t}function xr(e,t){return new Promise((n,o)=>{let r=setTimeout(()=>o(new Error("timed out")),t);e.then(n,o).finally(()=>clearTimeout(r))})}async function Er(e,t){let n=document.documentElement.getAttribute("data-pipeup-doc"),{id:o,key:r}=n?await it(n):{id:`page-${we(location.origin+location.pathname)}`,key:null},i,s=!1,a;if(e.store)i=e.store,a=await He(i);else try{let f=De.open();i=await xr(f,br).catch(x=>{throw f.then(w=>w.close(),()=>{}),x}),a=await He(i)}catch{i=new Be,s=!0,a=await He(i)}let p=e.name?.trim();p&&p!==a.name&&(a={...a,name:p},await i.saveProfile(a));let l=await $e.open({doc:o,key:r,store:i,identity:a.identity,name:a.name}),d=io({doc:l,root:e.root??document.body,onName:async f=>{l.name=f,a={...a,name:f},await i.saveProfile(a)}});s&&d.ctx.toast("This browser can't keep comments for this page \u2014 copy the comments (Copy all) to keep them");let y=()=>void l.flush().catch(f=>globalThis.reportError?.(f)),E=!1;return window.addEventListener("pagehide",y),{document:l,flush:()=>l.flush(),unmount:()=>{E||(E=!0,window.removeEventListener("pagehide",y),d.destroy(),Ce===t()&&(Ce=null))}}}function ao(){let e=document.documentElement;if(!e.hasAttribute("data-pipeup-doc")||e.getAttribute("data-pipeup-auto")==="off")return;let t=()=>void Qt().catch(n=>console.error(n));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}var kr="0.3.2";typeof document<"u"&&ao();return fo(Tr);})();
|
package/dist/types/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VERSION = "0.3.
|
|
1
|
+
export declare const VERSION = "0.3.2";
|
|
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";
|